From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Hans de Goede <hansg@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 2/3] media: uvcvideo: Check header length in uvc_video_clock_decode()
Date: Mon, 16 Nov 2026 15:09:31 +0200 [thread overview]
Message-ID: <20261116130931.GB1714298@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20261116-uvc-shortmeta-v1-2-487cfe42fa89@chromium.org>
On Mon, Nov 16, 2026 at 11:56:38AM +0000, Ricardo Ribalda wrote:
> In UVC, the header size is defined in data[0]; all the bytes beyond that
> length are pixels.
>
> Currently, uvc_video_clock_decode() could parse pixels as PTS/SCR
> because it checks the bounds against the USB packet size, not the header
> size.
So you have seen those checks :-)
> Fix it.
>
> Fixes: 66847ef013cc ("[media] uvcvideo: Add UVC timestamps support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> drivers/media/usb/uvc/uvc_video.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index 9cc5d83acbc2..e9be0a627033 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -582,8 +582,12 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf,
> }
>
> /* Check for invalid headers. */
> - if (len < header_size)
> + if (len < header_size || data[0] < header_size) {
> + uvc_warn_once(stream->dev, UVC_WARN_META_SHORT,
> + "UVC non compliance: payload header length %u is shorter than expected %u (flags 0x%02x).\n",
> + data[0], header_size, data[1]);
> return;
> + }
>
> /*
> * Extract the timestamps:
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2026-11-16 13:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 11:56 [PATCH 0/3] media: uvcvideo: Improve checks for medatata size Ricardo Ribalda
2026-11-16 11:56 ` [PATCH 1/3] media: uvcvideo: Reject short metadata Ricardo Ribalda
2026-11-16 13:08 ` Laurent Pinchart
2026-11-16 13:23 ` Ricardo Ribalda
2026-11-16 14:06 ` Laurent Pinchart
2026-11-16 11:56 ` [PATCH 2/3] media: uvcvideo: Check header length in uvc_video_clock_decode() Ricardo Ribalda
2026-11-16 13:09 ` Laurent Pinchart [this message]
2026-11-16 11:56 ` [PATCH 3/3] media: uvcvideo: Fix unaligned and OOB access Ricardo Ribalda
2026-11-16 14:01 ` Laurent Pinchart
2026-11-16 14:27 ` Ricardo Ribalda
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=20261116130931.GB1714298@killaraus.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=guennadi.liakhovetski@intel.com \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.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
all inboxes | Powered by JetHome®