]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: parsers: qcom: Fix kernel panic on skipped partition
authorAnsuel Smith <ansuelsmth@gmail.com>
Sun, 16 Jan 2022 03:22:10 +0000 (04:22 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 25 Jan 2022 09:31:44 +0000 (10:31 +0100)
commite306dd1c8bfaafad456b7a051cfd499c56b272cd
tree10f56395411626bc6718d2a923de89a80d25720e
parentedeee88ce189e03f29bdb12d5521fe90c4244506
mtd: parsers: qcom: Fix kernel panic on skipped partition

In the event of a skipped partition (case when the entry name is empty)
the kernel panics in the cleanup function as the name entry is NULL.
Rework the parser logic by first checking the real partition number and
then allocate the space and set the data for the valid partitions.

The logic was also fundamentally wrong as with a skipped partition, the
parts number returned was incorrect by not decreasing it for the skipped
partitions.

Fixes: 2851418a086f ("mtd: parsers: Add Qcom SMEM parser")
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220116032211.9728-1-ansuelsmth@gmail.com
drivers/mtd/parsers/qcomsmempart.c