Skip to content

Commit

Permalink
media: stkwebcam: fix memory leak in stk_camera_probe
Browse files Browse the repository at this point in the history
commit 514e976 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: ec16dae ("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>
  • Loading branch information
pskrgag authored and gregkh committed Sep 8, 2021
1 parent ad5e13f commit 4405ea2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/media/usb/stkwebcam/stk-webcam.c
Expand Up @@ -1346,7 +1346,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;
Expand All @@ -1359,10 +1359,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);
Expand Down

0 comments on commit 4405ea2

Please sign in to comment.