All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Jakov Novak <jakovnovak30@gmail.com>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linux.dev,
	Ulf Hansson <ulfh@kernel.org>,
	Guangshuo Li <lgs201920130244@gmail.com>,
	Runyu Xiao <runyu.xiao@seu.edu.cn>,
	Shuah Khan <skhan@linuxfoundation.org>,
	syzbot+1ee4f3b9228e35f14677@syzkaller.appspotmail.com,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: Re: [PATCH] mmc: vub300: fix sleeping function call from invalid context in vub300_inactivity_timer_expired
Date: Mon, 17 Aug 2026 10:13:35 +0200	[thread overview]
Message-ID: <aoLCr8JEYaYxcJcQ@hovoldconsulting.com> (raw)
In-Reply-To: <20260816153809.7067-1-jakovnovak30@gmail.com>

[ +CC: Geert ]

On Sun, Aug 16, 2026 at 05:38:09PM +0200, Jakov Novak wrote:
>  Currently, the function vub300_inactivity_timer_expired, which gets
>  called in a softirq context, calls a sleeping function in the following
>  call chain:
> 
>  vub300_inactivity_timer_expired -> kref_put -> vub300_delete ->
>  mmc_free_host -> cancel_delayed_work_sync -> __cancel_work_sync ->
>  might_sleep -> BUG
> 
>  Fix this by replacing kref_put(&vub300->kref, vub300_delete) with
>  vub300_queue_dead_work(vub300), which does the same thing, but in a
>  workqueue context.
> 
> Fixes: 88095e7b473a ("mmc: Add new VUB300 USB-to-SD/SDIO/MMC driver")

This isn't the commit that introduced the issue. The blocking call in
mmc_free_host() was added by commit 1036f69e2513 ("mmc: core: Cancel
delayed work before releasing host") in 2023. 

I didn't look at this in any detail, but having that call in
mmc_free_host() (e.g. rather than in mmc_remove_host()) looks wrong so
perhaps the fix really lies in MMC core.

> Reported-and-tested-by: syzbot+1ee4f3b9228e35f14677@syzkaller.appspotmail.com

Not sure if syzbot has started suggesting this tag, but this should
be two separate tags.

> Closes: https://syzkaller.appspot.com/bug?extid=1ee4f3b9228e35f14677
> Signed-off-by: Jakov Novak <jakovnovak30@gmail.com>
> ---
>  drivers/mmc/host/vub300.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
> index 2dae474dcd06..df0096bc53db 100644
> --- a/drivers/mmc/host/vub300.c
> +++ b/drivers/mmc/host/vub300.c
> @@ -744,7 +744,7 @@ 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);
> +		vub300_queue_dead_work(vub300);
>  	} else if (vub300->cmd) {
>  		mod_timer(&vub300->inactivity_timer, jiffies + HZ);
>  	} else {

Johan

      reply	other threads:[~2026-08-17  8:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16 15:38 [PATCH] mmc: vub300: fix sleeping function call from invalid context in vub300_inactivity_timer_expired Jakov Novak
2026-08-17  8:13 ` Johan Hovold [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=aoLCr8JEYaYxcJcQ@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=jakovnovak30@gmail.com \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=runyu.xiao@seu.edu.cn \
    --cc=skhan@linuxfoundation.org \
    --cc=syzbot+1ee4f3b9228e35f14677@syzkaller.appspotmail.com \
    --cc=ulfh@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 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.