lkml.org 
[lkml]   [2022]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 9/9] drm/tegra: Support context isolation
From
18.02.2022 14:39, Mikko Perttunen пишет:
> + if (context->memory_context && context->client->ops->get_streamid_offset) {
^^^
> + int offset = context->client->ops->get_streamid_offset(context->client);
> +
> + if (offset >= 0) {
> + job->context = context->memory_context;
> + job->engine_streamid_offset = offset;
> + host1x_context_get(job->context);
> + }

You should bump refcount unconditionally or you'll get refcnt underflow
on put, when offset < 0.

> + }
> +
> /*
> * job_data is now part of job reference counting, so don't release
> * it from here.
> diff --git a/drivers/gpu/drm/tegra/uapi.c b/drivers/gpu/drm/tegra/uapi.c
> index 9ab9179d2026..be33da54d12c 100644
> --- a/drivers/gpu/drm/tegra/uapi.c
> +++ b/drivers/gpu/drm/tegra/uapi.c
> @@ -33,6 +33,9 @@ static void tegra_drm_channel_context_close(struct tegra_drm_context *context)
> struct tegra_drm_mapping *mapping;
> unsigned long id;
>
> + if (context->memory_context)
> + host1x_context_put(context->memory_context);

The "if (context->memory_context &&
context->client->ops->get_streamid_offset)" above doesn't match the "if
(context->memory_context)". You'll get refcount underflow.

\
 
 \ /
  Last update: 2022-02-19 19:38    [W:0.201 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site