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

From: Miquel Raynal

Date: Tue Nov 17 2026 - 08:32:38 EST


On 06/11/2026 at 09:49:28 +08, Guo Zihao <guozh23@xxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
> Signed-off-by: Guo Zihao <guozh23@xxxxxxxxxxxx>

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