From: Johan Hovold <johan@kernel.org>
To: Muhammad Bilal <meatuni001@gmail.com>
Cc: Ulf Hansson <ulfh@kernel.org>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] mmc: vub300: fix Use-After-Free of inactivity_timer on disconnect and probe failure
Date: Wed, 19 Aug 2026 16:19:53 +0200 [thread overview]
Message-ID: <aoW7iR8Rp4hUCtHq@hovoldconsulting.com> (raw)
In-Reply-To: <20260818210322.53266-1-meatuni001@gmail.com>
On Wed, Aug 19, 2026 at 02:03:22AM +0500, Muhammad Bilal wrote:
> The vub300 driver arms inactivity_timer during probe and acquires a kref
> reference for the running timer. However, vub300_disconnect() sets
> vub300->interface = NULL and drops the driver's kref without shutting down
> the timer via timer_shutdown_sync().
>
> If the timer expires after the host is removed and vub300 is freed,
> or if concurrent work items re-arm the timer,
> vub300_inactivity_timer_expired() accesses the already freed vub300
> structure, causing a Use-After-Free.
No, this cannot happen as the timer holds another reference.
> Fix this by explicitly shutting down inactivity_timer via
> timer_shutdown_sync() and releasing the timer's kref reference in
> vub300_disconnect() and probe error cleanup paths.
>
> Fixes: 88095e7b473a ("mmc: Add new VUB300 USB-to-SD/SDIO/MMC driver")
> Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
How was this "issue" found? Are you using an LLM?
> ---
> drivers/mmc/host/vub300.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
> index 8e45dc1a4a12..9f84bd1531e2 100644
> --- a/drivers/mmc/host/vub300.c
> +++ b/drivers/mmc/host/vub300.c
> @@ -2350,6 +2350,8 @@ static int vub300_probe(struct usb_interface *interface,
>
> err_stop_io:
> vub300->interface = NULL;
> + timer_shutdown_sync(&vub300->inactivity_timer);
> + kref_put(&vub300->kref, vub300_delete);
> kref_put(&vub300->kref, vub300_delete);
And this results in a reference underflow.
Johan
next prev parent reply other threads:[~2026-08-19 14:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 21:03 Muhammad Bilal
2026-08-19 14:19 ` Johan Hovold [this message]
2026-08-19 14:33 ` Muhammad Bilal
2026-08-19 14:46 ` Johan Hovold
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=aoW7iR8Rp4hUCtHq@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=meatuni001@gmail.com \
--cc=stable@vger.kernel.org \
--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 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®