hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I81XCK
--------------------------------
After commit 648bb72a02a3 ("nbd: fix possible overflow on 'first_minor' in nbd_dev_add()"), the issue of nbd first_minor has been completely resolved. Therefore, revert the redundant patches after this commit.
Revert "nbd: fix possible overflow for 'first_minor' in nbd_dev_add()" This reverts commit e7155946057dd251f09e568a5dfaf2d4381d6579.
Revert "nbd: fix max value for 'first_minor'" This reverts commit 3d2fe8edf8ff8887f54c03c7f0df5ef79cf7de88.
Revert "Revert "Revert "block: nbd: add sanity check for first_minor""" This reverts commit 6081b563fc72686e695c2a2b4c704150833b8b10.
Signed-off-by: Li Nan linan122@huawei.com --- drivers/block/nbd.c | 10 ---------- 1 file changed, 10 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 10f0acff9e69..9ed41aa17ff0 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1875,17 +1875,7 @@ static int nbd_dev_add(int index) refcount_set(&nbd->refs, 1); INIT_LIST_HEAD(&nbd->list); disk->major = NBD_MAJOR; - - /* Too big first_minor can cause duplicate creation of - * sysfs files/links, since index << part_shift might overflow, or - * MKDEV() expect that the max bits of first_minor is 20. - */ disk->first_minor = index << part_shift; - if (disk->first_minor < index || disk->first_minor > MINORMASK) { - err = -EINVAL; - goto out_free_idr; - } - disk->fops = &nbd_fops; disk->private_data = nbd; sprintf(disk->disk_name, "nbd%d", index);