git: 50b26566c7f4 - stable/13 - mmc: Drain the intrhook in mmc_detach()

Mark Johnston markj at FreeBSD.org
Thu Jul 29 12:13:58 UTC 2021


The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=50b26566c7f4b605d5db4464e259d7db9626dd86

commit 50b26566c7f4b605d5db4464e259d7db9626dd86
Author:     Yang Zhong <yzhong at freebsdfoundation.org>
AuthorDate: 2021-07-22 17:16:01 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-07-29 12:11:50 +0000

    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
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit d5341d72a11be200e536ac7d8967449a3f521792)
---
 sys/dev/mmc/mmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c
index ddbc2669b1f7..47df562e73fd 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);


More information about the dev-commits-src-all mailing list