mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] memstick: r592: shut down the detect timer on removal
@ 2026-11-10  4:30 Myeonghun Pak
  0 siblings, 0 replies; only message in thread
From: Myeonghun Pak @ 2026-11-10  4:30 UTC (permalink / raw)
  To: Maxim Levitsky, Alex Dubov, Ulf Hansson
  Cc: linux-mmc, linux-kernel, stable, Ijae Kim

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-10  4:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10  4:30 [PATCH] memstick: r592: shut down the detect timer on removal Myeonghun Pak

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®