* [PATCH] Fix Null Pointer Dereference in uvcg_video_init()
@ 2026-07-30 5:57 Jeffin Philip
2026-07-30 6:16 ` Greg KH
2026-07-30 6:40 ` Xu Yang
0 siblings, 2 replies; 3+ messages in thread
From: Jeffin Philip @ 2026-07-30 5:57 UTC (permalink / raw)
To: gregkh
Cc: xu.yang_2, Frank.Li, panjunzhong, kees, jeffinphilip14, linux-usb,
linux-kernel, syzbot+8dcac923582c28505fd7
uvcg_video_init references video->uvc before assigning it
leading to a null pointer dereference. Fix this by assigning
video->uvc first and then dereferencing it later.
Reported-by: syzbot+8dcac923582c28505fd7@syzkaller.appspotmail.com
Fixes: https://syzkaller.appspot.com/bug?extid=8dcac923582c28505fd7
Signed-off-by: Jeffin Philip <jeffinphilip14@gmail.com>
---
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..cb532654b9b8 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -806,6 +806,7 @@ int uvcg_video_enable(struct uvc_video *video)
*/
int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc)
{
+ video->uvc = uvc;
video->is_enabled = false;
INIT_LIST_HEAD(&video->ureqs);
INIT_LIST_HEAD(&video->req_free);
@@ -829,7 +830,6 @@ int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc)
sched_set_fifo(video->kworker->task);
- video->uvc = uvc;
video->fcc = V4L2_PIX_FMT_YUYV;
video->bpp = 16;
video->width = 320;
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Fix Null Pointer Dereference in uvcg_video_init()
2026-07-30 5:57 [PATCH] Fix Null Pointer Dereference in uvcg_video_init() Jeffin Philip
@ 2026-07-30 6:16 ` Greg KH
2026-07-30 6:40 ` Xu Yang
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2026-07-30 6:16 UTC (permalink / raw)
To: Jeffin Philip
Cc: xu.yang_2, Frank.Li, panjunzhong, kees, linux-usb, linux-kernel,
syzbot+8dcac923582c28505fd7
On Thu, Jul 30, 2026 at 11:27:05AM +0530, Jeffin Philip wrote:
> uvcg_video_init references video->uvc before assigning it
> leading to a null pointer dereference. Fix this by assigning
> video->uvc first and then dereferencing it later.
Please say _when_ this dereference happens (i.e. in an error path only,
right?)
> Reported-by: syzbot+8dcac923582c28505fd7@syzkaller.appspotmail.com
> Fixes: https://syzkaller.appspot.com/bug?extid=8dcac923582c28505fd7
> Signed-off-by: Jeffin Philip <jeffinphilip14@gmail.com>
No cc: stable or Fixes: tag?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix Null Pointer Dereference in uvcg_video_init()
2026-07-30 5:57 [PATCH] Fix Null Pointer Dereference in uvcg_video_init() Jeffin Philip
2026-07-30 6:16 ` Greg KH
@ 2026-07-30 6:40 ` Xu Yang
1 sibling, 0 replies; 3+ messages in thread
From: Xu Yang @ 2026-07-30 6:40 UTC (permalink / raw)
To: Jeffin Philip
Cc: gregkh, xu.yang_2, Frank.Li, panjunzhong, kees, linux-usb,
linux-kernel, syzbot+8dcac923582c28505fd7
On Thu, Jul 30, 2026 at 11:27:05AM +0530, Jeffin Philip wrote:
> uvcg_video_init references video->uvc before assigning it
> leading to a null pointer dereference. Fix this by assigning
> video->uvc first and then dereferencing it later.
The subject should indicate the subsystem:
usb: gadget: uvc: Fix Null Pointer Dereference in uvcg_video_init()
Please refer to: https://www.kernel.org/doc/html/latest/process/submitting-patches.html
>
> Reported-by: syzbot+8dcac923582c28505fd7@syzkaller.appspotmail.com
> Fixes: https://syzkaller.appspot.com/bug?extid=8dcac923582c28505fd7
Not Fixes, it should be:
Closes: https://syzkaller.appspot.com/bug?extid=8dcac923582c28505fd7
> Signed-off-by: Jeffin Philip <jeffinphilip14@gmail.com>
> ---
> 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..cb532654b9b8 100644
> --- a/drivers/usb/gadget/function/uvc_video.c
> +++ b/drivers/usb/gadget/function/uvc_video.c
> @@ -806,6 +806,7 @@ int uvcg_video_enable(struct uvc_video *video)
> */
> int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc)
> {
> + video->uvc = uvc;
> video->is_enabled = false;
> INIT_LIST_HEAD(&video->ureqs);
> INIT_LIST_HEAD(&video->req_free);
> @@ -829,7 +830,6 @@ int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc)
>
> sched_set_fifo(video->kworker->task);
>
> - video->uvc = uvc;
> video->fcc = V4L2_PIX_FMT_YUYV;
> video->bpp = 16;
> video->width = 320;
It's caused by below code:
uvcg_err(&video->uvc->func, "failed to create UVCG kworker\n");
Would directly use "&uvc->func" be more reasonable?
Thanks,
Xu Yang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-30 6:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30 5:57 [PATCH] Fix Null Pointer Dereference in uvcg_video_init() Jeffin Philip
2026-07-30 6:16 ` Greg KH
2026-07-30 6:40 ` Xu Yang
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.