]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
media: uvcvideo: Avoid partial metadata buffers
authorRicardo Ribalda <ribalda@chromium.org>
Fri, 17 Apr 2026 05:19:29 +0000 (05:19 +0000)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Thu, 21 May 2026 19:14:07 +0000 (21:14 +0200)
commita15b773fe4ffa450b56347cc506b2d1405600f5d
treeb6e4038287398944f65d104d592d8f06cfbae8d0
parenta307316ae7db7961ac485463501a040495f4e634
media: uvcvideo: Avoid partial metadata buffers

If the metadata queue that is empty receives a new buffer while we are
in the middle of processing a frame, the first metadata buffer will
contain partial information.

Avoid this by tracking the state of the metadata buffer and making sure
that it is in sync with the data buffer.

Now that we are at it, make sure that we skip buffers of size 1 or 0.
They are not allowed by the spec... but it is a simple check to add and
better be safe than sorry.

Fixes: 088ead255245 ("media: uvcvideo: Add a metadata device node")
Cc: stable@vger.kernel.org
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://patch.msgid.link/20260417-uvc-meta-partial-v2-2-31d274af7d2d@chromium.org
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/usb/uvc/uvc_video.c