[PATCH] mtd: fix 'part' field data corruption in mtd_info

Miquel Raynal miquel.raynal at bootlin.com
Thu Apr 21 00:35:33 PDT 2022


On Sun, 2022-04-17 at 18:46:47 UTC, Oleksandr Ocheretnyi wrote:
> Commit 46b5889cc2c5 ("mtd: implement proper partition handling")
> started using "mtd_get_master_ofs()" in mtd callbacks to determine
> memory offsets by means of 'part' field from mtd_info, what previously
> was smashed accessing 'master' field in the mtd_set_dev_defaults() method.
> That provides wrong offset what causes hardware access errors.
> 
> Just make 'part', 'master' as separate fields, rather than using
> union type to avoid 'part' data corruption when mtd_set_dev_defaults()
> is called.
> 
> Fixes: 46b5889cc2c5 ("mtd: implement proper partition handling")
> Signed-off-by: Oleksandr Ocheretnyi <oocheret at cisco.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks.

Miquel



More information about the linux-mtd mailing list