[Intel-gfx] [PATCH] drm/i915: Fix pid leak with banned clients
Chris Wilson
chris at chris-wilson.co.uk
Tue Dec 17 16:25:08 UTC 2019
Quoting Tvrtko Ursulin (2019-12-17 16:18:14)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> Get_pid_task() needs to be paired with a put_pid or we leak a pid
> reference every time a banned client tries to create a context.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Fixes: b083a0870c79 ("drm/i915: Add per client max context ban limit")
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala at intel.com>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_context.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> index 46b4d1d643f8..eace1607ceb2 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> @@ -2193,9 +2193,11 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
>
> ext_data.fpriv = file->driver_priv;
> if (client_is_banned(ext_data.fpriv)) {
> + struct pid *pid = get_task_pid(current, PIDTYPE_PID);
> +
> DRM_DEBUG("client %s[%d] banned from creating ctx\n",
> - current->comm,
> - pid_nr(get_task_pid(current, PIDTYPE_PID)));
> + current->comm, pid_nr(pid));
Or, going out on a limb here, task_pid_nr(current)).
-Chris
More information about the Intel-gfx
mailing list