Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: Ricardo Ribalda <ribalda@chromium.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 1/2] media: uvcvideo: Introduce scattered field for uvc_control_mapping
Date: Mon, 30 Nov 2026 16:41:06 +0100	[thread overview]
Message-ID: <b970dd2d-3706-4365-9c84-c9474686a34a@kernel.org> (raw)
In-Reply-To: <20261002-uvc-status-11-v2-1-a98a135df0eb@chromium.org>

Hi,

On 2-Oct-26 13:21, Ricardo Ribalda wrote:
> Most of the mappings are contiguous, but the one for
> V4L2_CID_ZOOM_CONTINUOUS is not. Instead it uses bytes 0 and 2 but
> not 1.
> 
> To force reading the byte 1 every time we set the control we used a
> fake size of 0, but that was far from nice.
> 
> Instead make a new field for this kind of controls.
> 
> Cc: stable@vger.kernel.org
> Fixes: e5225c820c05 ("media: uvcvideo: Send a control event when a Control Change interrupt arrives")
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>

Regards,

Hans


> ---
>  drivers/media/usb/uvc/uvc_ctrl.c | 6 ++++--
>  drivers/media/usb/uvc/uvcvideo.h | 6 ++++++
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index d2f722bc3459..6224ecf28ec6 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -998,7 +998,9 @@ static const struct uvc_control_mapping uvc_ctrl_mappings[] = {
>  		.id		= V4L2_CID_ZOOM_CONTINUOUS,
>  		.entity		= UVC_GUID_UVC_CAMERA,
>  		.selector	= UVC_CT_ZOOM_RELATIVE_CONTROL,
> -		.size		= 0,
> +		.size		= 24,
> +		/* Byte 1 (bDigitalZoom) is not part of the mapping. */
> +		.scattered	= true,
>  		.offset		= 0,
>  		.v4l2_type	= V4L2_CTRL_TYPE_INTEGER,
>  		.data_type	= UVC_CTRL_DATA_TYPE_SIGNED,
> @@ -2815,7 +2817,7 @@ int uvc_ctrl_set(struct uvc_fh *handle, struct v4l2_ext_control *xctrl)
>  	 * needs to be loaded from the device to perform the read-modify-write
>  	 * operation.
>  	 */
> -	if ((ctrl->info.size * 8) != mapping->size) {
> +	if ((ctrl->info.size * 8) != mapping->size || mapping->scattered) {
>  		ret = __uvc_ctrl_load_cur(chain, ctrl);
>  		if (ret < 0)
>  			return ret;
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index af8cef94ffff..69ee3d0c971d 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -126,6 +126,12 @@ struct uvc_control_mapping {
>  	 */
>  	u8 size;
>  
> +	/*
> +	 * True if the mapping does not cover all bits between offset and
> +	 * offset + size.
> +	 */
> +	bool scattered;
> +
>  	u8 offset;
>  	enum v4l2_ctrl_type v4l2_type;
>  	u32 data_type;
> 


  reply	other threads:[~2026-11-30 15:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 11:21 [PATCH v2 0/2] media: uvcvideo: Do not read beyond the uvc_status urb Ricardo Ribalda
2026-10-02 11:21 ` [PATCH v2 1/2] media: uvcvideo: Introduce scattered field for uvc_control_mapping Ricardo Ribalda
2026-11-30 15:41   ` Hans de Goede [this message]
2026-10-02 11:21 ` [PATCH v2 2/2] media: uvcvideo: Do not read beyond the uvc_status_control memory Ricardo Ribalda
2026-11-30 15:44   ` Hans de Goede
2026-11-30 15:50 ` [PATCH v2 0/2] media: uvcvideo: Do not read beyond the uvc_status urb Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b970dd2d-3706-4365-9c84-c9474686a34a@kernel.org \
    --to=hansg@kernel.org \
    --cc=guennadi.liakhovetski@intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab+samsung@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox