Patch "media: uvcvideo: Override default flags" has been added to the 5.15-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    media: uvcvideo: Override default flags

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     media-uvcvideo-override-default-flags.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5fc3e7c5d1dbe7b5069eec281b51d9074cfa2aad
Author: Daniel Schaefer <dhs@xxxxxxxxxx>
Date:   Sun Jun 2 14:50:53 2024 +0800

    media: uvcvideo: Override default flags
    
    [ Upstream commit 86419686e66da5b90a07fb8a40ab138fe97189b5 ]
    
    When the UVC device has a control that is readonly it doesn't set the
    SET_CUR flag. For example the privacy control has SET_CUR flag set in
    the defaults in the `uvc_ctrls` variable. Even if the device does not
    have it set, it's not cleared by uvc_ctrl_get_flags().
    
    Originally written with assignment in commit 859086ae3636 ("media:
    uvcvideo: Apply flags from device to actual properties"). But changed to
    |= in commit 0dc68cabdb62 ("media: uvcvideo: Prevent setting unavailable
    flags"). It would not clear the default flags.
    
    With this patch applied the correct flags are reported to user space.
    Tested with:
    
    ```
    > v4l2-ctl --list-ctrls | grep privacy
    privacy 0x009a0910 (bool)   : default=0 value=0 flags=read-only
    ```
    
    Signed-off-by: Daniel Schaefer <dhs@xxxxxxxxxx>
    Fixes: 0dc68cabdb62 ("media: uvcvideo: Prevent setting unavailable flags")
    Reviewed-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240602065053.36850-1-dhs@xxxxxxxxxx
    Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index 05335866e6d62..050d334265828 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1868,7 +1868,13 @@ static int uvc_ctrl_get_flags(struct uvc_device *dev,
 	else
 		ret = uvc_query_ctrl(dev, UVC_GET_INFO, ctrl->entity->id,
 				     dev->intfnum, info->selector, data, 1);
-	if (!ret)
+
+	if (!ret) {
+		info->flags &= ~(UVC_CTRL_FLAG_GET_CUR |
+				 UVC_CTRL_FLAG_SET_CUR |
+				 UVC_CTRL_FLAG_AUTO_UPDATE |
+				 UVC_CTRL_FLAG_ASYNCHRONOUS);
+
 		info->flags |= (data[0] & UVC_CONTROL_CAP_GET ?
 				UVC_CTRL_FLAG_GET_CUR : 0)
 			    |  (data[0] & UVC_CONTROL_CAP_SET ?
@@ -1877,6 +1883,7 @@ static int uvc_ctrl_get_flags(struct uvc_device *dev,
 				UVC_CTRL_FLAG_AUTO_UPDATE : 0)
 			    |  (data[0] & UVC_CONTROL_CAP_ASYNCHRONOUS ?
 				UVC_CTRL_FLAG_ASYNCHRONOUS : 0);
+	}
 
 	kfree(data);
 	return ret;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux