uvc: fix access to uninitialized fields on probe error
Subsystems (2)
PATCH 1/1 uvc: 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 <[email protected]>
Reported-by [email protected]
--- drivers/media/usb/uvc/uvc_ctrl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_ctrl.c +3 -1
@@ -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) {
Signature · 1 line
2.16.4
Hi Oliver,
Thank you for the patch.
Quoted 2 lines · Oliver Neukum
We need to check whether this work we are canceling actually is initialized.
I think we should add
Fixes e5225c820c05 ("media: uvcvideo: Send a control event when a Control Change interrupt arrives")
Quoted 11 lines
Signed-off-by Oliver Neukum <[email protected]>Reported-by [email protected]--- drivers/media/usb/uvc/uvc_ctrl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/media/usb/uvc/uvc_ctrl.c +0
-0
drivers/media/usb/uvc/uvc_ctrl.c void uvc_ctrl_cleanup_device(struct uvc_device *dev) · line 2353
Quoted 5 lines
drivers/media/usb/uvc/uvc_ctrl.c +1
-1@@ -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 */
Let's capitalise the comment and end it with a period to match the rest of the driver. With these small issues fixed,
Reviewed-by Laurent Pinchart <[email protected]>
If you agree with the changes there's no need to resubmit, I'll fix when applying.
Quoted 5 lines
drivers/media/usb/uvc/uvc_ctrl.c +2
-0+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) {
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 4 lines · Laurent Pinchart
Let's capitalise the comment and end it with a period to match the rest of the driver. With these small issues fixed,
Reviewed-by Laurent Pinchart <[email protected]>
Hi,
thank you. I agree with them.
Regards
Oliver