diff options
author | Christoph Hellwig <hch@lst.de> | 2020-11-09 18:30:59 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-11-10 16:01:28 +0100 |
commit | 2bd645b2d3f0bacadaa6037f067538e1cd4e42ef (patch) | |
tree | dfe511cec98fc3a2ecb787ac22bb28df57ea8c4e /drivers/block | |
parent | Merge tag 'nvme-5.10-2020-11-10' of git://git.infradead.org/nvme into block-5.10 (diff) | |
download | linux-2bd645b2d3f0bacadaa6037f067538e1cd4e42ef.tar.xz linux-2bd645b2d3f0bacadaa6037f067538e1cd4e42ef.zip |
nbd: fix a block_device refcount leak in nbd_release
bdget_disk needs to be paired with bdput to not leak a reference
on the block device inode.
Fixes: 08ba91ee6e2c ("nbd: Add the nbd NBD_DISCONNECT_ON_CLOSE config flag.")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/nbd.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index c4f9ccf5cc2a..aaae9220f3a0 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1518,6 +1518,7 @@ static void nbd_release(struct gendisk *disk, fmode_t mode) if (test_bit(NBD_RT_DISCONNECT_ON_CLOSE, &nbd->config->runtime_flags) && bdev->bd_openers == 0) nbd_disconnect_and_put(nbd); + bdput(bdev); nbd_config_put(nbd); nbd_put(nbd); |