Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, "Aaro Koskinen" <aaro.koskinen@iki.fi>,
	"Ulf Hansson" <ulfh@kernel.org>,
	"Juha Yrjola" <juha.yrjola@nokia.com>,
	"Tony Lindgren" <tony@atomide.com>,
	"Hiroshi DOYU" <Hiroshi.DOYU@nokia.com>,
	"Jarkko Lavinen" <jarkko.lavinen@nokia.com>,
	"Pierre Ossman" <drzeus@drzeus.cx>,
	"Aubin Constans" <aubin.constans@microchip.com>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Allen Pais" <allen.lkml@gmail.com>,
	"Christian Loehle" <christian.loehle@arm.com>,
	linux-omap@vger.kernel.org, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 08/13] mmc: omap: Shut down cover timer before disabling cover BH work
Date: Mon, 23 Nov 2026 19:15:52 +0000	[thread overview]
Message-ID: <20261123191703.179283-9-lee@kernel.org> (raw)
In-Reply-To: <20261123191703.179283-1-lee@kernel.org>

In mmc_omap_remove_slot(), cancel_work_sync(&slot->cover_bh_work) is
called before timer_delete_sync(&slot->cover_timer).  Because
mmc_omap_cover_timer() queues slot->cover_bh_work and
mmc_omap_cover_bh_handler() rearms slot->cover_timer, a timer expiry
between the two calls (or a concurrent omap_mmc_notify_cover_event()
before platform cleanup) can re-queue cover_bh_work so that it runs
after the slot and its struct mmc_host have been freed.

When cover state polling is configured, shut down slot->cover_timer
first with timer_shutdown_sync() to prevent re-arming, and then stop
slot->cover_bh_work with disable_work_sync() so no further work can be
queued during teardown.

Fixes: 7584d276d47a ("MMC: OMAP: Use tasklet instead of workqueue for cover switch notification")
Fixes: 921c87ba3893 ("mmc: Convert from tasklet to BH workqueue")
Closes: https://sashiko.dev/#/bug/linux-f30b1077-ed4d-4d62-a07b-11fff78d42c5
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/mmc/host/omap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 36df578298c3..55efc4ec9d03 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1356,11 +1356,11 @@ static void mmc_omap_remove_slot(struct mmc_omap_slot *slot)
 
 	if (slot->pdata->name != NULL)
 		device_remove_file(&mmc->class_dev, &dev_attr_slot_name);
-	if (slot->pdata->get_cover_state != NULL)
+	if (slot->pdata->get_cover_state) {
 		device_remove_file(&mmc->class_dev, &dev_attr_cover_switch);
-
-	cancel_work_sync(&slot->cover_bh_work);
-	timer_delete_sync(&slot->cover_timer);
+		timer_shutdown_sync(&slot->cover_timer);
+		disable_work_sync(&slot->cover_bh_work);
+	}
 	flush_workqueue(slot->host->mmc_omap_wq);
 
 	mmc_remove_host(mmc);
-- 
2.56.1.750.gf70dc682cf-goog


      reply	other threads:[~2026-11-23 19:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 19:15 [PATCH 00/13] mmc: Assorted bug fixes across MMC host drivers Lee Jones
2026-11-23 19:15 ` Lee Jones [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=20261123191703.179283-9-lee@kernel.org \
    --to=lee@kernel.org \
    --cc=Hiroshi.DOYU@nokia.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=allen.lkml@gmail.com \
    --cc=aubin.constans@microchip.com \
    --cc=christian.loehle@arm.com \
    --cc=drzeus@drzeus.cx \
    --cc=jarkko.lavinen@nokia.com \
    --cc=juha.yrjola@nokia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=stable@vger.kernel.org \
    --cc=tony@atomide.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox