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

mtd: mtdpart: check for subpartitions parsing result

parse_mtd_partitions() may return an error so it should be checked and
optionally passed up

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20230927202657.27169-1-zajec5@gmail.com

authored by

Rafał Miłecki and committed by
Miquel Raynal
5c2f7727 8baba8d5

+5 -1
+5 -1
drivers/mtd/mtdpart.c
··· 426 426 mtd_add_partition_attrs(child); 427 427 428 428 /* Look for subpartitions */ 429 - parse_mtd_partitions(child, parts[i].types, NULL); 429 + ret = parse_mtd_partitions(child, parts[i].types, NULL); 430 + if (ret < 0) { 431 + pr_err("Failed to parse subpartitions: %d\n", ret); 432 + goto err_del_partitions; 433 + } 430 434 431 435 cur_offset = child->part.offset + child->part.size; 432 436 }