aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe Bin <[email protected]>2021-11-02 09:52:36 +0800
committerJens Axboe <[email protected]>2021-11-02 10:50:27 -0600
commit69beb62ff0d1723a750eebe1c4d01da573d7cd19 (patch)
tree992618c94ab922dda47fee74432475885637c074
parent940c264984fd1457918393c49674f6b39ee16506 (diff)
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: b1a811633f73 ("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]>
-rw-r--r--drivers/block/nbd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index a5e3ee28006f..f201c40d1dc9 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1814,7 +1814,7 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs)
disk->first_minor = index << part_shift;
if (disk->first_minor < index || disk->first_minor > MINORMASK) {
err = -EINVAL;
- goto out_free_idr;
+ goto out_err_disk;
}
disk->minors = 1 << part_shift;