V4L/DVB (13151): uvcvideo: Dismiss privileges when freeing video buffers
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 2 Sep 2009 06:12:26 +0000 (03:12 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 5 Dec 2009 20:40:35 +0000 (18:40 -0200)
Dismiss privileges on the file handle when calling VIDIOC_REQBUFS with a
buffer count of 0. This allows applications to release the streaming
permissions on the file handle without closing it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/uvc/uvc_v4l2.c

index 7c555712411a75c16eca39616c86bf5e401427f3..94c1d6696af5ee5ee429abe8149648785662b936 100644 (file)
@@ -364,7 +364,8 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
  * unprivileged state. Only a single instance can be in a privileged state at
  * a given time. Trying to perform an operation that requires privileges will
  * automatically acquire the required privileges if possible, or return -EBUSY
- * otherwise. Privileges are dismissed when closing the instance.
+ * otherwise. Privileges are dismissed when closing the instance or when
+ * freeing the video buffers using VIDIOC_REQBUFS.
  *
  * Operations that require privileges are:
  *
@@ -884,6 +885,9 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
                if (ret < 0)
                        return ret;
 
+               if (ret == 0)
+                       uvc_dismiss_privileges(handle);
+
                rb->count = ret;
                ret = 0;
                break;