linux/drivers/media/usb
Ricardo Ribalda 5332491be2 media: uvcvideo: Fix allocation for small frame sizes
[ Upstream commit 40d3ac25c1 ]

If a frame has size of less or equal than one packet size
uvc_alloc_urb_buffers() is unable to allocate memory for it due to a
off-by-one error.

Fix the off-by-one-error and now that we are at it, make sure that
stream->urb_size has always a valid value when we return from the
function, even when an error happens.

Fixes: efdc8a9585 ("V4L/DVB (10295): uvcvideo: Retry URB buffers allocation when the system is low on memory.")
Reported-by: Itay Chamiel <itay.chamiel@q.ai>
Closes: https://lore.kernel.org/linux-media/CANiDSCsSoZf2LsCCoWAUbCg6tJT-ypXR1B85aa6rAdMVYr2iBQ@mail.gmail.com/T/#t
Co-developed-by: Itay Chamiel <itay.chamiel@q.ai>
Signed-off-by: Itay Chamiel <itay.chamiel@q.ai>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Itay Chamiel <itay.chamiel@q.ai>
Link: https://patch.msgid.link/20260114-uvc-alloc-urb-v1-1-cedf3fb66711@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-02-26 14:59:14 -08:00
..
airspy media: usb: drop vb2_ops_wait_prepare/finish 2024-10-28 09:19:56 +01:00
as102 media: as102: avoid GFP_ATOMIC 2024-04-29 12:07:00 +01:00
au0828 media: au0828: Use USB API functions rather than constants 2025-08-29 11:04:01 +02:00
b2c2 media: b2c2: flexcop-usb: fix flexcop_usb_memory_req 2024-06-24 11:05:07 +02:00
cx231xx media: v4l2: Rename second ioctl handlers argument to 'void *priv' 2025-08-13 08:34:01 +02:00
dvb-usb media: dvb-usb: dtv5100: fix out-of-bounds in dtv5100_i2c_msg() 2026-01-02 12:57:12 +01:00
dvb-usb-v2 media: dvb-usb-v2: Constify struct i2c_algorithm 2025-02-21 10:33:14 +01:00
em28xx media: em28xx: add special case for legacy gpiolib interface 2025-08-29 11:04:02 +02:00
go7007 media: usb: drop vb2_ops_wait_prepare/finish 2024-10-28 09:19:56 +01:00
gspca media: v4l2: Rename second ioctl handlers argument to 'void *priv' 2025-08-13 08:34:01 +02:00
hackrf media: usb: drop vb2_ops_wait_prepare/finish 2024-10-28 09:19:56 +01:00
hdpvr media: v4l2: Rename second ioctl handlers argument to 'void *priv' 2025-08-13 08:34:01 +02:00
msi2500 media updates for v6.13-rc1 2024-11-20 14:01:15 -08:00
pvrusb2 media: pvrusb2: Fix incorrect variable used in trace message 2026-01-02 12:57:13 +01:00
pwc media: pwc: remove useless header files 2025-02-21 10:33:04 +01:00
s2255 treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
siano media: usb: siano: Fix allocation of urbs 2024-04-16 00:02:53 +02:00
stk1160 media: stk1160: Restore deleted comment in stk1160_fill_urb() 2025-08-29 11:04:02 +02:00
ttusb-budget media: dvb-ttusb-budget: cleanup printk logic 2020-09-03 11:15:47 +02:00
ttusb-dec media: Convert from tasklet to BH workqueue 2024-06-21 08:57:09 +02:00
usbtv media: usbtv: Lock resolution while streaming 2025-06-17 10:35:14 +02:00
uvc media: uvcvideo: Fix allocation for small frame sizes 2026-02-26 14:59:14 -08:00
Kconfig media: tm6000: deprecate this driver 2022-08-29 16:43:00 +02:00
Makefile media: tm6000: deprecate this driver 2022-08-29 16:43:00 +02:00