Skip to content

Commit 69beb62

Browse files
Ye Binaxboe
authored andcommitted
nbd: Fix incorrect error handle when first_minor is illegal in nbd_dev_add
If first_minor is illegal will goto out_free_idr label, this will miss cleanup disk. Fixes: b1a8116 ("block: nbd: add sanity check for first_minor") Signed-off-by: Ye Bin <[email protected]> Reviewed-by: Josef Bacik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 940c264 commit 69beb62

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/block/nbd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,7 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs)
18141814
disk->first_minor = index << part_shift;
18151815
if (disk->first_minor < index || disk->first_minor > MINORMASK) {
18161816
err = -EINVAL;
1817-
goto out_free_idr;
1817+
goto out_err_disk;
18181818
}
18191819

18201820
disk->minors = 1 << part_shift;

0 commit comments

Comments
 (0)