All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] usb: gadget: uvc: Fix Null Pointer Dereference in uvcg_video_init()
@ 2026-07-30  7:02 Jeffin Philip
  2026-07-30  7:08 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Jeffin Philip @ 2026-07-30  7:02 UTC (permalink / raw)
  To: gregkh
  Cc: xu.yang_2, Frank.Li, panjunzhong, kees, jeffinphilip14, linux-usb,
	linux-kernel, syzbot+8dcac923582c28505fd7, stable

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.

Reported-by: syzbot+8dcac923582c28505fd7@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8dcac923582c28505fd7
Fixes: 7ea95b110811fa8e41f5960c278bcfc80b8b21c1 (usb: gadget: uvc: rename functions to avoid conflicts with host uvc)
Cc: stable@vger.kernel.org
Signed-off-by: Jeffin Philip <jeffinphilip14@gmail.com>
---
Changelog:
 - Implemented fixes suggested in v1 discussion
   https://lore.kernel.org/all/20260730055705.13784-1-jeffinphilip14@gmail.com/T/#u
 
 drivers/usb/gadget/function/uvc_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
index 2f9700b3f1b6..9ba09118bb74 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-30  7:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30  7:02 [PATCH v2] usb: gadget: uvc: Fix Null Pointer Dereference in uvcg_video_init() Jeffin Philip
2026-07-30  7:08 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.