[PATCH] mtd: lantiq-flash: Fix NULL pointer dereference in probe

Miquel Raynal miquel.raynal at bootlin.com
Tue Nov 17 05:32:26 PST 2026


On 06/11/2026 at 09:49:28 +08, Guo Zihao <guozh23 at xiaopeng.com> wrote:

> ltq_mtd_probe() dereferences ltq_mtd->map->virt before the map_info
> structure is allocated: the map pointer itself is still NULL when
> ltq_mtd->map->virt is assigned, because the structure is allocated a
> few lines below. Any device with a "lantiq,nor" compatible therefore
> crashes the kernel with a NULL pointer dereference during probe.
>
> Assign the mapping after the map_info allocation instead.
>
> Fixes: 6145e07e9c77 ("mtd: lantiq-flash: Use devm_platform_get_and_ioremap_resource()")
> Cc: stable at vger.kernel.org
> Signed-off-by: Guo Zihao <guozh23 at xiaopeng.com>

Hello, this is a duplicate of a wider series from Simon Wunderlich, I
took his since there are more behavioral fixes.

Thanks for the contribution anyway!
Miquèl



More information about the linux-mtd mailing list