From faf6d96b45973a9a1d02396d427ff8fd357115ce Mon Sep 17 00:00:00 2001 From: Navdeep Parhar Date: Tue, 1 May 2018 14:59:38 +0000 Subject: [PATCH] cxgbe(4): Destroy the cdev before disabling interrupts in driver detach. Filter work requests are submitted in the nexus cdev's ioctl which then blocks waiting for a reply. If driver detach runs in this state and disables interrupts the ioctl will never complete and detach will hang in destroy_cdev. Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 19d04f0956b..e9724d0dc0c 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -1317,17 +1317,17 @@ t4_detach_common(device_t dev) sc = device_get_softc(dev); + if (sc->cdev) { + destroy_dev(sc->cdev); + sc->cdev = NULL; + } + sc->flags &= ~CHK_MBOX_ACCESS; if (sc->flags & FULL_INIT_DONE) { if (!(sc->flags & IS_VF)) t4_intr_disable(sc); } - if (sc->cdev) { - destroy_dev(sc->cdev); - sc->cdev = NULL; - } - if (device_is_attached(dev)) { rc = bus_generic_detach(dev); if (rc) {