1
0
Fork 0

block: reject attempts to allocate more than DISK_MAX_PARTS partitions

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
hifive-unleashed-5.1
Christoph Hellwig 2017-08-23 19:10:29 +02:00 committed by Jens Axboe
parent 10433d04b8
commit de65b01232
1 changed files with 7 additions and 0 deletions

View File

@ -1357,6 +1357,13 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
struct gendisk *disk;
struct disk_part_tbl *ptbl;
if (minors > DISK_MAX_PARTS) {
printk(KERN_ERR
"block: can't allocated more than %d partitions\n",
DISK_MAX_PARTS);
minors = DISK_MAX_PARTS;
}
disk = kzalloc_node(sizeof(struct gendisk), GFP_KERNEL, node_id);
if (disk) {
if (!init_part_stats(&disk->part0)) {