[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211021125231.916081-2-yebin10@huawei.com>
Date: Thu, 21 Oct 2021 20:52:30 +0800
From: Ye Bin <yebin10@...wei.com>
To: <josef@...icpanda.com>, <axboe@...nel.dk>,
<linux-block@...r.kernel.org>, <nbd@...er.debian.org>
CC: <linux-kernel@...r.kernel.org>, Ye Bin <yebin10@...wei.com>
Subject: [PATCH -next v2 1/2] nbd: Fix incorrect error handle when first_minor big than '0xff' in nbd_dev_add
If first_minor big than '0xff' 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 <yebin10@...wei.com>
---
drivers/block/nbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index c38971874ea3..6b6ae08ec93b 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1820,7 +1820,7 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs)
disk->first_minor = index << part_shift;
if (disk->first_minor > 0xff) {
err = -EINVAL;
- goto out_free_idr;
+ goto out_err_disk;
}
disk->minors = 1 << part_shift;
--
2.31.1
Powered by blists - more mailing lists