summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.com>2019-04-30 08:28:14 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-26 09:14:06 +0200
commit63e53991d791860131ce7bcf5c7f12704420c7c8 (patch)
tree8c96066a6db1dc583732c2f768c10b9609204578 /drivers
parentc844f4da9b92e689fc447a52d5996fd361a9d567 (diff)
downloadlinux-stable-63e53991d791860131ce7bcf5c7f12704420c7c8.tar.gz
linux-stable-63e53991d791860131ce7bcf5c7f12704420c7c8.tar.bz2
linux-stable-63e53991d791860131ce7bcf5c7f12704420c7c8.zip
media: uvcvideo: Fix access to uninitialized fields on probe error
[ Upstream commit 11a087f484bf15ff65f0a9f277aa5a61fd07ed2a ] We need to check whether this work we are canceling actually is initialized. Signed-off-by: Oliver Neukum <oneukum@suse.com> Reported-by: syzbot+2e1ef9188251d9cc7944@syzkaller.appspotmail.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/usb/uvc/uvc_ctrl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index 467b1ddaf4e7..f2854337cdca 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -2350,7 +2350,9 @@ void uvc_ctrl_cleanup_device(struct uvc_device *dev)
struct uvc_entity *entity;
unsigned int i;
- cancel_work_sync(&dev->async_ctrl.work);
+ /* Can be uninitialized if we are aborting on probe error. */
+ if (dev->async_ctrl.work.func)
+ cancel_work_sync(&dev->async_ctrl.work);
/* Free controls and control mappings for all entities. */
list_for_each_entry(entity, &dev->entities, list) {