summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorPavel Skripkin <paskripkin@gmail.com>2021-07-07 19:54:30 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-22 11:45:15 +0200
commit4b8488c3c533ec81a2ec9f410d7a395df9191137 (patch)
treea1ef2c8099f599ed75dd4e3f2888d21a4e1d0db2 /drivers/media
parentbd0970398a7a50d5f4e09bfca73cb6249e7d5edc (diff)
downloadlinux-rt-4b8488c3c533ec81a2ec9f410d7a395df9191137.tar.gz
media: stkwebcam: fix memory leak in stk_camera_probe
commit 514e97674400462cc09c459a1ddfb9bf39017223 upstream. My local syzbot instance hit memory leak in usb_set_configuration(). The problem was in unputted usb interface. In case of errors after usb_get_intf() the reference should be putted to correclty free memory allocated for this interface. Fixes: ec16dae5453e ("V4L/DVB (7019): V4L: add support for Syntek DC1125 webcams") Cc: stable@vger.kernel.org Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/usb/stkwebcam/stk-webcam.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
index 6992e84f8a8b..2058742c556e 100644
--- a/drivers/media/usb/stkwebcam/stk-webcam.c
+++ b/drivers/media/usb/stkwebcam/stk-webcam.c
@@ -1355,7 +1355,7 @@ static int stk_camera_probe(struct usb_interface *interface,
if (!dev->isoc_ep) {
pr_err("Could not find isoc-in endpoint\n");
err = -ENODEV;
- goto error;
+ goto error_put;
}
dev->vsettings.palette = V4L2_PIX_FMT_RGB565;
dev->vsettings.mode = MODE_VGA;
@@ -1368,10 +1368,12 @@ static int stk_camera_probe(struct usb_interface *interface,
err = stk_register_video_device(dev);
if (err)
- goto error;
+ goto error_put;
return 0;
+error_put:
+ usb_put_intf(interface);
error:
v4l2_ctrl_handler_free(hdl);
v4l2_device_unregister(&dev->v4l2_dev);