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

Lionel Landwerlin lionel.g.landwerlin at intel.com
Thu Jun 27 11:18:32 UTC 2019


On 27/06/2019 12:19, Chris Wilson wrote:
> 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.


Thanks!


>
>> +       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
>
Correct, if it's dup()ed then the application enters undefined behavior 
territory.

Much like not synchronizing buffer access across engines ;)


-Lionel



More information about the Intel-gfx mailing list