Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christoph Hellwig and committed by
Jens Axboe
de65b012 10433d04

+7
+7
block/genhd.c
··· 1357 1357 struct gendisk *disk; 1358 1358 struct disk_part_tbl *ptbl; 1359 1359 1360 + if (minors > DISK_MAX_PARTS) { 1361 + printk(KERN_ERR 1362 + "block: can't allocated more than %d partitions\n", 1363 + DISK_MAX_PARTS); 1364 + minors = DISK_MAX_PARTS; 1365 + } 1366 + 1360 1367 disk = kzalloc_node(sizeof(struct gendisk), GFP_KERNEL, node_id); 1361 1368 if (disk) { 1362 1369 if (!init_part_stats(&disk->part0)) {