diff mbox series

[-next,v3,1/2] nbd: Fix incorrect error handle when first_minor big than '0xff' in nbd_dev_add

Message ID 20211029094228.1853434-2-yebin10@huawei.com (mailing list archive)
State New, archived
Headers show
Series Fix hungtask when nbd_config_put | expand

Commit Message

yebin (H) Oct. 29, 2021, 9:42 a.m. UTC
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@huawei.com>
---
 drivers/block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Josef Bacik Oct. 29, 2021, 2:34 p.m. UTC | #1
On Fri, Oct 29, 2021 at 05:42:27PM +0800, Ye Bin wrote:
> 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@huawei.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef
diff mbox series

Patch

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index b47b2a87ae8f..096883ab9b76 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1809,7 +1809,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;