[PATCH 1/2] media: uvcvideo: Do not setup queues with buffersize 0

From: Ricardo Ribalda

Date: Tue Nov 17 2026 - 06:45:47 EST


Vb2 (correctly) does not expect queues to have a buffer size of 0
and throws a nasty warning:
WARNING: at vb2_core_reqbufs+0x60e/0x630 [videobuf2_common]

If a device has a descriptor with an invalid size, exit early before
bothering the vb2 functions.

Fixes: 6998b6fb4b1c ("[media] uvcvideo: Use videobuf2-vmalloc")
Cc: stable@xxxxxxxxxxxxxxx
Reported-by: Jordan Moormann <service@xxxxxxxxxxxxxxxxx>
Closes: https://lore.kernel.org/linux-media/c2c00ad1-b21c-42f9-b3a1-e03a0ad49651@xxxxxxxxxxxxxxxxx
Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
---
drivers/media/usb/uvc/uvc_queue.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c
index 3c002c8f442f..46b807b95d2c 100644
--- a/drivers/media/usb/uvc/uvc_queue.c
+++ b/drivers/media/usb/uvc/uvc_queue.c
@@ -91,6 +91,9 @@ static int uvc_queue_setup(struct vb2_queue *vq,
break;
}

+ if (!size)
+ return -EINVAL;
+
/*
* When called with plane sizes, validate them. The driver supports
* single planar formats only, and requires buffers to be large enough

--
2.56.1.708.g77570a6a1d-goog