]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nbd: fix a block_device refcount leak in nbd_release
authorChristoph Hellwig <hch@lst.de>
Mon, 9 Nov 2020 17:30:59 +0000 (18:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:20:27 +0000 (19:20 +0100)
commit81dcfdb9a01566fd8cd31adce52fb4e448bfd15d
tree299a22e818da14e6e8ffe2c3d8bc1c0146381d47
parentc602ad2b52dcbca5af08e5137bd5575c039b52e3
nbd: fix a block_device refcount leak in nbd_release

[ Upstream commit 2bd645b2d3f0bacadaa6037f067538e1cd4e42ef ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/nbd.c