usb: gadget: uvc: Fix Null Pointer Dereference in
Subsystems (3)
PATCH v4 1/1 usb: gadget: uvc: Fix Null Pointer Dereference in
In uvcg_video_init(), if kthread_run_worker() fails, the error logged uses uvcg_err(), however, the pointer it uses:video->uvc is not assigned at this point, triggering a null pointer dereference. Fix this by directly using uvc->func which is assigned already.
--- drivers/usb/gadget/function/uvc_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/function/uvc_video.c +1 -1
@@ -821,7 +821,7 @@ int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc)/* Allocate a kthread for asynchronous hw submit handler. */ video->kworker =kthread_run_worker (0 ,"UVCG" );if (IS_ERR (video->kworker)) { -uvcg_err (&video->uvc->func,"failed to create UVCG kworker\n" ); +uvcg_err (&uvc->func,"failed to create UVCG kworker\n" );return PTR_ERR (video->kworker); }
--
2.55.0
Greg KH
maintainerQuoted 29 lines · Jeffin Philip
In
uvcg_video_init(), ifkthread_run_worker()fails, the error logged usesuvcg_err(), however, the pointer it uses:video->uvcis not assigned at this point, triggering a null pointer dereference. Fix this by directly usinguvc->funcwhich is assigned already.Reported-by [email protected]Fixes 7ea95b110811 (usb: gadget: uvc: rename functions to avoid conflicts with host uvc)Signed-off-by Jeffin Philip <[email protected]>--- drivers/usb/gadget/function/uvc_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/gadget/function/uvc_video.c +1
-2@@ -821,7 +821,7 @@ int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc)/* Allocate a kthread for asynchronous hw submit handler. */ video->kworker =kthread_run_worker (0 ,"UVCG" );if (IS_ERR (video->kworker)) { -uvcg_err (&video->uvc->func,"failed to create UVCG kworker\n" ); +uvcg_err (&uvc->func,"failed to create UVCG kworker\n" );return PTR_ERR (video->kworker); } --
Quoted 2 lines
2.55.0
Please slow down. Only do 1 patch per day, at the most.
This one is still wrong (hint, no changelog of what changed between versions.)
There is no rush here, relax :)
thanks,
greg k-h