]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "block: nbd: add sanity check for first_minor"
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Sep 2021 08:17:11 +0000 (10:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Sep 2021 10:56:13 +0000 (12:56 +0200)
This reverts commit b3fa499d72a0db612f12645265a36751955c0037 which is
commit b1a811633f7321cf1ae2bb76a66805b7720e44c9 upstream.

The backport of this is reported to be causing some problems, so revert
this for now until they are worked out.

Link: https://lore.kernel.org/r/CACPK8XfUWoOHr-0RwRoYoskia4fbAbZ7DYf5wWBnv6qUnGq18w@mail.gmail.com
Reported-by: Joel Stanley <joel@jms.id.au>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Pavel Skripkin <paskripkin@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/nbd.c

index bc3ab98855cf04144d3e5545671912cf8b5f81cb..25e81b1a59a54b6e40109c4a9fe1defba2aa86b2 100644 (file)
@@ -1744,17 +1744,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 first_minor will be truncated to
-        * byte in __device_add_disk().
-        */
        disk->first_minor = index << part_shift;
-       if (disk->first_minor > 0xff) {
-               err = -EINVAL;
-               goto out_free_idr;
-       }
-
        disk->fops = &nbd_fops;
        disk->private_data = nbd;
        sprintf(disk->disk_name, "nbd%d", index);