diff options
author | Mike Christie <mchristi@redhat.com> | 2019-08-13 11:39:51 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-08-20 12:44:04 -0600 |
commit | 887e975c4172d0d5670c39ead2f18ba1e4ec8133 (patch) | |
tree | 9e96fabbac3a23b55eed3d3c3b775eca86c6acb2 | |
parent | 00514677ed829efa2fc688ca60a72e52695529cc (diff) | |
download | linux-887e975c4172d0d5670c39ead2f18ba1e4ec8133.tar.bz2 |
nbd: add missing config put
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>
-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 c6ff8f922fd7..ebc98cf76365 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -373,8 +373,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), |