From: Myeonghun Pak <mhun512@gmail.com>
To: Maxim Levitsky <maximlevitsky@gmail.com>,
Alex Dubov <oakad@yahoo.com>, Ulf Hansson <ulfh@kernel.org>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Ijae Kim <ae878000@gmail.com>
Subject: [PATCH] memstick: r592: shut down the detect timer on removal
Date: Mon, 9 Nov 2026 23:30:08 -0500 [thread overview]
Message-ID: <20261110043008.56716-1-mhun512@gmail.com> (raw)
r592_remove() deletes detect_timer before freeing the interrupt.
A card insertion or removal interrupt can re-arm it in between,
allowing r592_detect_timer() to access unmapped registers and queue
media_checker work on the freed host.
Use timer_shutdown_sync() to wait for the callback and prevent
re-arming. Keep timer_delete_sync() in r592_suspend(), since the
timer is needed again after resume.
Found by a static analysis tool under development.
Fixes: 632644227850 ("memstick: r592: Fix UAF bug in r592_remove due to race condition")
Cc: stable@vger.kernel.org
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
drivers/memstick/host/r592.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c
index dc3de63901be..399873a61d1b 100644
--- a/drivers/memstick/host/r592.c
+++ b/drivers/memstick/host/r592.c
@@ -827,7 +827,7 @@ static void r592_remove(struct pci_dev *pdev)
/* Stop the processing thread.
That ensures that we won't take any more requests */
kthread_stop(dev->io_thread);
- timer_delete_sync(&dev->detect_timer);
+ timer_shutdown_sync(&dev->detect_timer);
r592_enable_device(dev, false);
while (!error && dev->req) {
base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47
--
2.43.0
reply other threads:[~2026-11-10 4:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261110043008.56716-1-mhun512@gmail.com \
--to=mhun512@gmail.com \
--cc=ae878000@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=maximlevitsky@gmail.com \
--cc=oakad@yahoo.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®