From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: 未君 <1742789905@qq.com>, "qiang.zhao" <qiang.zhao@nxp.com>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] soc: fsl: qe: Fix potential NULL pointer dereference inqe_reset()
Date: Tue, 24 Mar 2026 14:47:06 +0100 [thread overview]
Message-ID: <780c1ba3-6639-478e-896f-e35ec059b58c@kernel.org> (raw)
In-Reply-To: <tencent_89405091B7744EA070AC53E11A3FFA355609@qq.com>
Hi,
Le 16/03/2026 à 04:28, 未君 a écrit :
>
> Vous n’obtenez pas souvent d’e-mail à partir de 1742789905@qq.com.
> Pourquoi c’est important <https://aka.ms/LearnAboutSenderIdentification>
>
>
> Hi,
>
> Thank you for the detailed review. You are completely right.
>
> My commit message was confusing, and returning early in qe_reset() just
> shifts the NULL pointer dereference to the dependent drivers later on,
> without actually fixing the root cause.
>
> To achieve what you suggested ("if qe_immr remap fails, all drivers
> depending on it don't get probed"), I plan to do the following in the v2
> patch:
>
> 1. Change the return type of qe_reset() from `void` to `int`.
> 2. Return `-ENOMEM` if the ioremap() fails.
> 3. Update the callers of qe_reset() (e.g., qe_probe() and other board-
> specific setup functions) to check this return value. If qe_reset()
> fails, the callers will abort their initialization/probing, which will
> properly prevent the child devices from being probed.
>
> Does this approach sound correct to you? If so, I will prepare and
> submit the v2 patch accordingly.
Well, it would probably work but is it worth it ?
If the board is already unable to get a few bytes of memory that early
in the boot process it is unlikely that it will be able to do much more
work.
Wouldn't it be good enough to just panic() when ioremap() fails, similar
to what happens when qe_sdma_init() fails, see
https://elixir.bootlin.com/linux/v7.0-rc5/source/drivers/soc/fsl/qe/qe.c#L101
Christophe
next prev parent reply other threads:[~2026-03-24 13:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 12:11 [PATCH] soc: fsl: qe: Fix potential NULL pointer dereference in qe_reset() Wang Jun
2026-03-13 9:48 ` Christophe Leroy (CS GROUP)
[not found] ` <tencent_89405091B7744EA070AC53E11A3FFA355609@qq.com>
2026-03-24 13:47 ` Christophe Leroy (CS GROUP) [this message]
2026-03-27 0:12 ` [PATCH v2] soc: fsl: qe: panic on ioremap() failure " Wang Jun
2026-03-28 12:09 ` Christophe Leroy (CS GROUP)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=780c1ba3-6639-478e-896f-e35ec059b58c@kernel.org \
--to=chleroy@kernel.org \
--cc=1742789905@qq.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=qiang.zhao@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox