From: Mike Christie Date: Tue, 13 Aug 2019 16:39:51 +0000 (-0500) Subject: nbd: add missing config put X-Git-Tag: v5.2.19~191 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8e8821e511803d07375ffe20a326b3baaac87f64;p=users%2Fdwmw2%2Flinux.git nbd: add missing config put [ Upstream commit 887e975c4172d0d5670c39ead2f18ba1e4ec8133 ] Fix bug added with the patch: commit 8f3ea35929a0806ad1397db99a89ffee0140822a Author: Josef Bacik Date: Mon Jul 16 12:11:35 2018 -0400 nbd: handle unexpected replies better where if the timeout handler runs when the completion path is and we fail to grab the mutex in the timeout handler we will leave a config reference and cannot free the config later. Reviewed-by: Josef Bacik Signed-off-by: Mike Christie Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 57aebc6e1c288..5d5e52c6509ce 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -355,8 +355,10 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req, } config = nbd->config; - if (!mutex_trylock(&cmd->lock)) + if (!mutex_trylock(&cmd->lock)) { + nbd_config_put(nbd); return BLK_EH_RESET_TIMER; + } if (config->num_connections > 1) { dev_err_ratelimited(nbd_to_dev(nbd),