Skip to content

Commit 2bd645b

Browse files
Christoph Hellwigaxboe
authored andcommitted
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: 08ba91e ("nbd: Add the nbd NBD_DISCONNECT_ON_CLOSE config flag.") Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent b5214c6 commit 2bd645b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/block/nbd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,7 @@ static void nbd_release(struct gendisk *disk, fmode_t mode)
15181518
if (test_bit(NBD_RT_DISCONNECT_ON_CLOSE, &nbd->config->runtime_flags) &&
15191519
bdev->bd_openers == 0)
15201520
nbd_disconnect_and_put(nbd);
1521+
bdput(bdev);
15211522

15221523
nbd_config_put(nbd);
15231524
nbd_put(nbd);

0 commit comments

Comments
 (0)