aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Zhong <yzhong@freebsdfoundation.org>2021-07-22 17:16:01 +0000
committerMark Johnston <markj@FreeBSD.org>2021-07-22 17:50:10 +0000
commitd5341d72a11be200e536ac7d8967449a3f521792 (patch)
treeb20af9c80c4ab26c6449b7b5d5a7110cd0f187bf
parentfd5827b1785a9363abe601cbd9d8558b0fc8d3e8 (diff)
downloadsrc-d5341d72a11be200e536ac7d8967449a3f521792.tar.gz
src-d5341d72a11be200e536ac7d8967449a3f521792.zip
mmc: Drain the intrhook in mmc_detach()
Buggy SD card drivers may attach and detach a mmc(4) driver instance in quick succession. In this case mmc(4) must disestablish its intrhook callback during detach. Thus, this change adds a call to config_intrhook_drain(), which blocks or does nothing if the intrhook is running or has already ran (the SD card was plugged in), and disestablishes the hook if it hasn't ran yet (the SD card was not plugged in). PR: 254373 Reviewed by: imp, manu, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31262
-rw-r--r--sys/dev/mmc/mmc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c
index a55ec671bdb0..29b3645beadd 100644
--- a/sys/dev/mmc/mmc.c
+++ b/sys/dev/mmc/mmc.c
@@ -271,6 +271,7 @@ mmc_detach(device_t dev)
struct mmc_softc *sc = device_get_softc(dev);
int err;
+ config_intrhook_drain(&sc->config_intrhook);
err = mmc_delete_cards(sc, true);
if (err != 0)
return (err);