Re: [PATCH] memory: fsl_ifc: fix stale global pointer on probe failure/remove

From: Krzysztof Kozlowski

Date: Sat Oct 17 2026 - 10:52:04 EST


On 17/10/2026 12:24, Reid Downing (b1nv0id) wrote:
> fsl_ifc_ctrl_dev is a global pointer. It was set at the start of
> fsl_ifc_ctrl_probe(), before anything could fail. If probe failed
> partway through, or the device was later removed, the global was
> never cleared. fsl_ifc_find() only checks it for non-NULL, so it
> could end up dereferencing freed memory or an unmapped register
> region.
>
> Use a local variable while setting up the controller struct in
> probe, and only publish it to the global once probe has fully
> succeeded. Clear the global as the first step of remove, before
> any teardown runs. Also guard the free_irq() of the optional
> nand_irq, which may be zero.
>
> Signed-off-by: Reid Downing (b1nv0id) <skibletz@xxxxxxxxx>

Please use real identity and skip custom names. See submitting patches
documents if in doubts.

I received two patches from you - please version them correctly, e.g.
use b4, plus changelog under ---.


> ---
> diff --git a/fsl_ifc.c b/fsl_ifc.c
> index e89e0c6..ff52cae 100644
> --- a/fsl_ifc.c
> +++ b/fsl_ifc.c

I don't think you use git... Why? This cannot be applied. Or you just
send LLM slop.

Best regards,
Krzysztof