mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: syzbot <syzbot+596b59aea1a9deaaab67@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Forwarded: [PATCH] usb: raw-gadget: fix UAF in raw_process_ep_io
Date: Fri, 25 Sep 2026 15:15:56 -0700	[thread overview]
Message-ID: <6ab6f29c.e548f532.1ca396.0029.GAE@google.com> (raw)
In-Reply-To: <6a6972a5.d9e86bb5.297b12.004f.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [PATCH] usb: raw-gadget: fix UAF in raw_process_ep_io
Author: drifabdelmalekmohamedsaid@gmail.com

#syz test

diff --git a/drivers/usb/gadget/legacy/raw_gadget.c b/drivers/usb/gadget/legacy/raw_gadget.c
index 4febf8dac7ca..9c263950f609 100644
--- a/drivers/usb/gadget/legacy/raw_gadget.c
+++ b/drivers/usb/gadget/legacy/raw_gadget.c
@@ -327,9 +327,16 @@ static int gadget_bind(struct usb_gadget *gadget,
 
 static void gadget_unbind(struct usb_gadget *gadget)
 {
+	unsigned long flags;
 	struct raw_dev *dev = get_gadget_data(gadget);
 
 	set_gadget_data(gadget, NULL);
+
+	/*Avoid dangling pointer in case it remaining references*/
+	spin_lock_irqsave(&dev->lock, flags);
+	dev->gadget = NULL;
+	spin_unlock_irqrestore(&dev->lock, flags);
+
 	/* Matches kref_get() in gadget_bind(). */
 	kref_put(&dev->count, dev_free);
 }

      parent reply	other threads:[~2026-09-25 22:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29  3:25 [syzbot] [kernel?] KASAN: slab-use-after-free Read in raw_process_ep_io (2) syzbot
2026-08-08 18:00 ` syzbot
2026-09-25 22:15 ` syzbot [this message]

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=6ab6f29c.e548f532.1ca396.0029.GAE@google.com \
    --to=syzbot+596b59aea1a9deaaab67@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®