media: uvcvideo: Fix access to uninitialized fields on probe error

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>
This commit is contained in:
Oliver Neukum 2019-04-30 08:28:14 -04:00 коммит произвёл Mauro Carvalho Chehab
Родитель 675e2f20b1
Коммит 11a087f484
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -2345,7 +2345,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) {