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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux