From: Johan Hovold <johan@kernel.org>
To: Yogesh Gaur <yogeshgaur.83@gmail.com>
Cc: Ulf Hansson <ulfh@kernel.org>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Runyu Xiao <runyu.xiao@seu.edu.cn>,
Guangshuo Li <lgs201920130244@gmail.com>,
Tony Olech <tony.olech@elandigitalsystems.com>,
Chris Ball <cjb@laptop.org>,
syzbot+f4a0159ce6802a0a4774@syzkaller.appspotmail.com,
syzbot+1ee4f3b9228e35f14677@syzkaller.appspotmail.com
Subject: Re: [PATCH] mmc: vub300: never tear the host down from the inactivity timer
Date: Wed, 9 Sep 2026 08:53:24 +0200 [thread overview]
Message-ID: <aqECZPhDe_elcG5P@hovoldconsulting.com> (raw)
In-Reply-To: <20260908165050.1930-1-yogeshgaur.83@gmail.com>
On Tue, Sep 08, 2026 at 10:20:50PM +0530, Yogesh Gaur wrote:
> vub300_probe() takes a second kref reference on behalf of the inactivity
> timer and arms it:
>
> kref_init(&vub300->kref);
> ...
> kref_get(&vub300->kref);
> timer_setup(&vub300->inactivity_timer,
> vub300_inactivity_timer_expired, 0);
> vub300->inactivity_timer.expires = jiffies + HZ;
> add_timer(&vub300->inactivity_timer);
>
> and expects the timer to release that reference from its own expiry
> function, once it observes that vub300->interface has been cleared:
>
> if (!vub300->interface) {
> kref_put(&vub300->kref, vub300_delete);
> } else if (vub300->cmd) {
>
> That is wrong in both directions, because the expiry function runs in
> softirq context.
>
> If the timer happens to hold the last reference, the kref_put() runs
> vub300_delete() -> mmc_free_host() -> cancel_delayed_work_sync(), which
> sleeps. The ->probe() error path arranges exactly that: it clears
> ->interface and drops only its own reference, leaving the timer armed
> and owning the last one.
>
> BUG: sleeping function called from invalid context at kernel/workqueue.c:4487
> in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 191, name: kworker/0:2
> Call Trace:
> <IRQ>
> __might_resched.cold+0x1ec/0x232 kernel/sched/core.c:9197
> __cancel_work_sync kernel/workqueue.c:4487 [inline]
> cancel_delayed_work_sync+0xb8/0xf0 kernel/workqueue.c:4568
> mmc_free_host+0x19/0x30 drivers/mmc/core/host.c:700
> vub300_delete drivers/mmc/host/vub300.c:379 [inline]
> kref_put include/linux/kref.h:65 [inline]
> vub300_inactivity_timer_expired drivers/mmc/host/vub300.c:747
> call_timer_fn+0x11f/0x610 kernel/time/timer.c:1745
> </IRQ>
> Fixes: 88095e7b473a ("mmc: Add new VUB300 USB-to-SD/SDIO/MMC driver")
> Reported-by: syzbot+f4a0159ce6802a0a4774@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=f4a0159ce6802a0a4774
> Reported-by: syzbot+1ee4f3b9228e35f14677@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=1ee4f3b9228e35f14677
> Signed-off-by: Yogesh Gaur <yogeshgaur.83@gmail.com>
You forgot to add an Assisted-by tag.
Several people have already proposed (LLM generated) fixes for this.
Please search the lists.
Johan
next prev parent reply other threads:[~2026-09-09 6:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 16:50 [PATCH] mmc: vub300: never tear the host down from the inactivity timer Yogesh Gaur
2026-09-09 6:53 ` Johan Hovold [this message]
2026-09-09 9:17 ` Yogesh Gaur
2026-09-09 10:09 ` [PATCH v2] " Yogesh Gaur
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=aqECZPhDe_elcG5P@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=cjb@laptop.org \
--cc=lgs201920130244@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=runyu.xiao@seu.edu.cn \
--cc=syzbot+1ee4f3b9228e35f14677@syzkaller.appspotmail.com \
--cc=syzbot+f4a0159ce6802a0a4774@syzkaller.appspotmail.com \
--cc=tony.olech@elandigitalsystems.com \
--cc=ulfh@kernel.org \
--cc=yogeshgaur.83@gmail.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 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.