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@vger.kernel.org Reported-by: Jordan Moormann Closes: https://lore.kernel.org/linux-media/c2c00ad1-b21c-42f9-b3a1-e03a0ad49651@jordan-systems.de Signed-off-by: Ricardo Ribalda --- 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