diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-04-05 08:56:10 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-04-05 08:56:10 +0200 |
commit | de800f290dfaa341f22acac22bc454ea2bbf8f71 (patch) | |
tree | 02ac02009524e4a8a4c1b169583618690bdd2567 /block/partitions/core.c | |
parent | bee1f89aad2a51cd3339571bc8eadbb0dc88a683 (diff) | |
parent | e49d033bddf5b565044e2abe4241353959bc9120 (diff) |
Merge 5.12-rc6 into usb-next
We want the USB fixes in here as well and it resolves a merge issue with
xhci-mtk.c
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'block/partitions/core.c')
-rw-r--r-- | block/partitions/core.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c index 1a7558917c47..46f055bc7ecb 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -323,6 +323,13 @@ static struct block_device *add_partition(struct gendisk *disk, int partno, int err; /* + * disk_max_parts() won't be zero, either GENHD_FL_EXT_DEVT is set + * or 'minors' is passed to alloc_disk(). + */ + if (partno >= disk_max_parts(disk)) + return ERR_PTR(-EINVAL); + + /* * Partitions are not supported on zoned block devices that are used as * such. */ |