diff options
author | Mike Christie <mchristi@redhat.com> | 2019-08-13 11:39:51 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-10-05 12:47:53 +0200 |
commit | 2b0354c44763c9b0f0a6fad4da2c6d467b7a696a (patch) | |
tree | 21105d529d4f9667a123be3a9ff89068be0e57d6 /drivers | |
parent | 09b07fd149d0610e767853396a7c216c6dac203a (diff) | |
download | linux-stable-2b0354c44763c9b0f0a6fad4da2c6d467b7a696a.tar.gz linux-stable-2b0354c44763c9b0f0a6fad4da2c6d467b7a696a.tar.bz2 linux-stable-2b0354c44763c9b0f0a6fad4da2c6d467b7a696a.zip |
nbd: add missing config put
[ Upstream commit 887e975c4172d0d5670c39ead2f18ba1e4ec8133 ]
Fix bug added with the patch:
commit 8f3ea35929a0806ad1397db99a89ffee0140822a
Author: Josef Bacik <josef@toxicpanda.com>
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 <josef@toxicpanda.com>
Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/nbd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index b77e9281c039..e4b049f281f5 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -340,8 +340,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), |