summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/nbd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index e11fddcb73b9..839364371f9a 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -2016,7 +2016,8 @@ static void nbd_disconnect_and_put(struct nbd_device *nbd)
* config ref and try to destroy the workqueue from inside the work
* queue.
*/
- flush_workqueue(nbd->recv_workq);
+ if (nbd->recv_workq)
+ flush_workqueue(nbd->recv_workq);
if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF,
&nbd->config->runtime_flags))
nbd_config_put(nbd);