Skip to content

Commit 6c36dcd

Browse files
pinchartlgregkh
authored andcommitted
media: uvcvideo: Fix double free in error path
commit c6ef3a7 upstream. 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: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Laurent Pinchart <[email protected]> Reviewed by: Ricardo Ribalda <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b32d60a commit 6c36dcd

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)