[Intel-gfx] [PATCH v5 07/10] drm/i915: add a new perf configuration execbuf parameter

Chris Wilson chris at chris-wilson.co.uk
Thu Jun 27 09:19:02 UTC 2019


Quoting Lionel Landwerlin (2019-06-27 09:00:42)
> +static int
> +get_execbuf_oa_config(struct drm_i915_private *dev_priv,
> +                     s32 perf_fd, u64 oa_config_id,
> +                     struct i915_oa_config **out_oa_config,
> +                     struct drm_i915_gem_object **out_oa_obj)
> +{
> +       struct file *perf_file;
> +       int ret;
> +
> +       if (!dev_priv->perf.oa.exclusive_stream)
> +               return -EINVAL;
> +
> +       perf_file = fget(perf_fd);
> +       if (!perf_file)
> +               return -EINVAL;
> +
> +       if (perf_file->private_data != dev_priv->perf.oa.exclusive_stream)
> +               return -EINVAL;

Leaked the file.

> +       fput(perf_file);

and we never use perf_file again? It's only use is as a permission check
on the ioctl? Just checking in case perf_fd is dup()ed by the user after
we check it.
-Chris


More information about the Intel-gfx mailing list