summaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2024-04-12 12:50:26 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2024-04-15 12:04:37 +0200
commitd2d73a6dd17365c43e109263841f7c26da55cfb0 (patch)
tree902e98da5fd6324844fad016e183fcc9c76e0b05 /net/dccp
parent21c9fb611c25d5cd038f6fe485232e7884bb0b3d (diff)
downloadlinux-d2d73a6dd17365c43e109263841f7c26da55cfb0.tar.gz
linux-d2d73a6dd17365c43e109263841f7c26da55cfb0.tar.bz2
linux-d2d73a6dd17365c43e109263841f7c26da55cfb0.zip
mtd: limit OTP NVMEM cell parse to non-NAND devices
MTD OTP logic is very fragile on parsing NVMEM cell and can be problematic with some specific kind of devices. The problem was discovered by e87161321a40 ("mtd: rawnand: macronix: OTP access for MX30LFxG18AC") where OTP support was added to a NAND device. With the case of NAND devices, it does require a node where ECC info are declared and all the fixed partitions, and this cause the OTP codepath to parse this node as OTP NVMEM cells, making probe fail and the NAND device registration fail. MTD OTP parsing should have been limited to always using compatible to prevent this error by using node with compatible "otp-user" or "otp-factory". NVMEM across the years had various iteration on how cells could be declared in DT, in some old implementation, no_of_node should have been enabled but now add_legacy_fixed_of_cells should be used to disable NVMEM to parse child node as NVMEM cell. To fix this and limit any regression with other MTD that makes use of declaring OTP as direct child of the dev node, disable add_legacy_fixed_of_cells if we detect the MTD type is Nand. With the following logic, the OTP NVMEM entry is correctly created with no cells and the MTD Nand is correctly probed and partitions are correctly exposed. Fixes: 4b361cfa8624 ("mtd: core: add OTP nvmem provider support") Cc: <stable@vger.kernel.org> # v6.7+ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20240412105030.1598-1-ansuelsmth@gmail.com
Diffstat (limited to 'net/dccp')
0 files changed, 0 insertions, 0 deletions