]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: uvcvideo: Fix double free in error path
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 7 Nov 2024 23:51:30 +0000 (01:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:50:16 +0000 (12:50 +0100)
commit3ba8884a56a3eb97c22f0ce0e4dd410d4ca4c277
treed943b8b09e9760c932a3d3932397fcfcdf99e075
parent3a7fda57b0f91f7ea34476b165f91a92feb17c96
media: uvcvideo: Fix double free in error path

commit c6ef3a7fa97ec823a1e1af9085cf13db9f7b3bac 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: a31a4055473b ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/usb/uvc/uvc_status.c