Module Name: src Committed By: jakllsch Date: Sat Dec 22 21:24:49 UTC 2012
Modified Files: src/sys/dev/sdmmc: sdmmc.c Log Message: We can't block our interrupt while sdmmc_detach_card is called, as it can issue commands, and some host drivers have interrupt-driven command completion. Prevents assertion (or deadlock) upon detach of sdhc(4) with inserted card. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/sdmmc/sdmmc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/sdmmc/sdmmc.c diff -u src/sys/dev/sdmmc/sdmmc.c:1.19 src/sys/dev/sdmmc/sdmmc.c:1.20 --- src/sys/dev/sdmmc/sdmmc.c:1.19 Sat Dec 22 20:21:09 2012 +++ src/sys/dev/sdmmc/sdmmc.c Sat Dec 22 21:24:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: sdmmc.c,v 1.19 2012/12/22 20:21:09 jakllsch Exp $ */ +/* $NetBSD: sdmmc.c,v 1.20 2012/12/22 21:24:49 jakllsch Exp $ */ /* $OpenBSD: sdmmc.c,v 1.18 2009/01/09 10:58:38 jsg Exp $ */ /* @@ -49,7 +49,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.19 2012/12/22 20:21:09 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.20 2012/12/22 21:24:49 jakllsch Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -271,8 +271,15 @@ sdmmc_task_thread(void *arg) } /* time to die. */ sc->sc_dying = 0; - if (ISSET(sc->sc_flags, SMF_CARD_PRESENT)) + if (ISSET(sc->sc_flags, SMF_CARD_PRESENT)) { + /* + * sdmmc_card_detach() may issue commands, + * so temporarily drop the interrupt-blocking lock. + */ + mutex_exit(&sc->sc_tskq_mtx); sdmmc_card_detach(sc, DETACH_FORCE); + mutex_enter(&sc->sc_tskq_mtx); + } sc->sc_tskq_lwp = NULL; cv_broadcast(&sc->sc_tskq_cv); mutex_exit(&sc->sc_tskq_mtx);