mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: syzbot <syzbot+f4a0159ce6802a0a4774@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Forwarded: [PATCH] WARNING: ODEBUG bug in vub300_disconnect
Date: Wed, 16 Sep 2026 18:27:53 -0700	[thread overview]
Message-ID: <6aab4219.87c06881.1db2b3.0004.GAE@google.com> (raw)
In-Reply-To: <6a8cf1e8.dbb3a75c.7844.001a.GAE@google.com>

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

***

Subject: [PATCH] WARNING: ODEBUG bug in vub300_disconnect
Author: jchuang26@m.fudan.edu.cn

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 50d05c7c76c96b90462f24debacca971d2e86713

Reported-by: syzbot+f4a0159ce6802a0a4774@syzkaller.appspotmail.com

diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index 2dae474dc..9914c8b58 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -744,7 +744,11 @@ static void vub300_inactivity_timer_expired(struct timer_list *t)
 	struct vub300_mmc_host *vub300 = timer_container_of(vub300, t,
 							    inactivity_timer);
 	if (!vub300->interface) {
-		kref_put(&vub300->kref, vub300_delete);
+		/*
+		 * The disconnect/error paths have already shut this timer
+		 * down, so it can no longer be rearmed or run.
+		 */
+		return;
 	} else if (vub300->cmd) {
 		mod_timer(&vub300->inactivity_timer, jiffies + HZ);
 	} else {
@@ -2327,7 +2331,6 @@ static int vub300_probe(struct usb_interface *interface,
 	INIT_WORK(&vub300->deadwork, vub300_deadwork_thread);
 	kref_init(&vub300->kref);
 	timer_setup(&vub300->sg_transfer_timer, vub300_sg_timed_out, 0);
-	kref_get(&vub300->kref);
 	timer_setup(&vub300->inactivity_timer,
 		    vub300_inactivity_timer_expired, 0);
 	vub300->inactivity_timer.expires = jiffies + HZ;
@@ -2349,6 +2352,13 @@ static int vub300_probe(struct usb_interface *interface,
 	return 0;
 
 err_stop_io:
+	/*
+	 * The inactivity timer was armed before mmc_add_host() failed.
+	 * Shut it down before dropping the host reference so that its
+	 * callback can neither run nor be rearmed after the memory
+	 * holding the timer has been freed.
+	 */
+	timer_shutdown_sync(&vub300->inactivity_timer);
 	vub300->interface = NULL;
 	kref_put(&vub300->kref, vub300_delete);
 
@@ -2382,6 +2392,13 @@ static void vub300_disconnect(struct usb_interface *interface)
 		} else {
 			int ifnum = interface_to_InterfaceNumber(interface);
 			usb_set_intfdata(interface, NULL);
+			/*
+			 * Shut the inactivity timer down before clearing interface.
+			 * Otherwise it can be rearmed (by its own callback or by a
+			 * concurrent path that already checked interface) and later
+			 * fire after the host, which embeds the timer, is freed.
+			 */
+			timer_shutdown_sync(&vub300->inactivity_timer);
 			/* prevent more I/O from starting */
 			vub300->interface = NULL;
 			mmc_remove_host(mmc);

  parent reply	other threads:[~2026-09-17  1:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  1:37 [syzbot] [kernel?] " syzbot
2026-09-11  1:36 ` [syzbot] [mmc?] " syzbot
2026-09-14 12:13 ` Forwarded: [PATCH] " syzbot
2026-09-15  1:38 ` syzbot
2026-09-17  1:27 ` syzbot [this message]
2026-09-17  5:50   ` Hillf Danton

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=6aab4219.87c06881.1db2b3.0004.GAE@google.com \
    --to=syzbot+f4a0159ce6802a0a4774@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®