nbd: fix a block_device refcount leak in nbd_release
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- drivers/block/nbd.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/nbd.c +1 -0
@@ -1493,6 +1493,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);
Signature · 1 line
2.28.0
Quoted 5 lines · Christoph Hellwig
bdget_diskneeds 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 <[email protected]>
Reviewed-by Josef Bacik <[email protected]>
Thanks,
Josef
Quoted 2 lines · Christoph Hellwig
bdget_diskneeds to be paired with bdput to not leak a reference on the block device inode.
Applied, thanks.
Signature · 1 line
Jens Axboe