Skip to content

Commit c6ef3a7

Browse files
pinchartlmchehab
authored andcommitted
media: uvcvideo: Fix double free in error path
If the uvc_status_init() function fails to allocate the int_urb, it will free the dev->status pointer but doesn't reset the pointer to NULL. This results in the kfree() call in uvc_status_cleanup() trying to double-free the memory. Fix it by resetting the dev->status pointer to NULL after freeing it. Fixes: a31a405 ("V4L/DVB:usbvideo:don't use part of buffer for USB transfer #4") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20241107235130.31372-1-laurent.pinchart@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent a9ea1a3 commit c6ef3a7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/media/usb/uvc/uvc_status.c

+1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ int uvc_status_init(struct uvc_device *dev)
269269
dev->int_urb = usb_alloc_urb(0, GFP_KERNEL);
270270
if (!dev->int_urb) {
271271
kfree(dev->status);
272+
dev->status = NULL;
272273
return -ENOMEM;
273274
}
274275

0 commit comments

Comments
 (0)