mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeffin Philip <jeffinphilip14@gmail.com>
To: gregkh@linuxfoundation.org
Cc: xu.yang_2@nxp.com, Frank.Li@nxp.com,
	panjunzhong@linux.spacemit.com, kees@kernel.org,
	jeffinphilip14@gmail.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	syzbot+8dcac923582c28505fd7@syzkaller.appspotmail.com
Subject: [PATCH] Fix Null Pointer Dereference in uvcg_video_init()
Date: Thu, 30 Jul 2026 11:27:05 +0530	[thread overview]
Message-ID: <20260730055705.13784-1-jeffinphilip14@gmail.com> (raw)

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


             reply	other threads:[~2026-07-30  5:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  5:57 Jeffin Philip [this message]
2026-07-30  6:16 ` Greg KH
2026-07-30  6:40 ` Xu Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260730055705.13784-1-jeffinphilip14@gmail.com \
    --to=jeffinphilip14@gmail.com \
    --cc=Frank.Li@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=panjunzhong@linux.spacemit.com \
    --cc=syzbot+8dcac923582c28505fd7@syzkaller.appspotmail.com \
    --cc=xu.yang_2@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®