From: sashiko-bot@kernel.org
To: pankaj.gupta@oss.nxp.com
Cc: imx@lists.linux.dev, robh@kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v40 3/7] firmware: imx: add driver for NXP EdgeLock Enclave
Date: Fri, 21 Aug 2026 13:21:06 +0000 [thread overview]
Message-ID: <20260821132106.82EDC1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260822-imx-se-if-v40-3-74fbce2f2f95@nxp.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Per-instance IMEM state is gated behind a global static variable, silently breaking boot firmware loading on subsequent probes or module reload.
- [High] Overriding a successful, completed firmware transaction with `-ERESTARTSYS` due to an earlier signal causes hazardous double-execution of non-idempotent operations.
--
--- Patch [3]: [PATCH v40 3/7] firmware: imx: add driver for NXP EdgeLock Enclave ---
commit 20968ef12d731efd276f3bd73d0897a236c63074
Author: Pankaj Gupta <pankaj.gupta@nxp.com>
firmware: imx: add driver for NXP EdgeLock Enclave
Add MU-based communication interface for secure enclave.
Exists on i.MX SoC(s) like i.MX8ULP, i.MX93, i.MX95 etc.
> diff --git a/drivers/firmware/imx/ele_common.c b/drivers/firmware/imx/ele_common.c
> index 0000000000000..04ee5112d3463 100644
> --- /dev/null
> +++ b/drivers/firmware/imx/ele_common.c
[ ... ]
> + err = ele_msg_rcv(priv, &priv->waiting_rsp_clbk_hdl);
> +
> + if (priv->waiting_rsp_clbk_hdl.signal_rcvd) {
> + /*
> + * Signal was deferred until the FW/kernel protocol resynchronized.
> + * On success report -ERESTARTSYS for the interrupted wait; the
> + * command is not re-sent. Keep real errors like -ETIMEDOUT.
> + */
> + if (err > 0)
> + err = -ERESTARTSYS;
[Severity: High]
Does overriding a successful hardware response (`err > 0`) with
`-ERESTARTSYS` cause hazardous double-execution of non-idempotent hardware
operations (e.g., key generation, counter increments)?
If a transaction completes successfully in hardware, but userspace receives
`-EINTR` (from `-ERESTARTSYS`), it may reissue the system call, causing the
hardware to execute the same state-changing operation a second time. Should
returning success take precedence over the pending signal to keep the hardware
state consistent with the userspace view?
> + priv->waiting_rsp_clbk_hdl.signal_rcvd = false;
> + dev_dbg(priv->dev, "Err[0x%x]:Interrupted by signal.", err);
> + }
> +
> + ele_msg_send_rcv_cleanup(priv);
> +
> + return err;
> +}
[ ... ]
> diff --git a/drivers/firmware/imx/se_ctrl.c b/drivers/firmware/imx/se_ctrl.c
> index 0000000000000..df3d1da28a759 100644
> --- /dev/null
> +++ b/drivers/firmware/imx/se_ctrl.c
[ ... ]
> + s_info = (struct ele_dev_info *)data;
> +
> + if (!var_se_info.soc_rev) {
> + var_se_info.soc_rev = s_info->d_info.soc_rev;
> +
> + /*
> + * Only update IMEM state when the load_fw path is active;
> + * on SoCs without IMEM management (e.g. i.MX93) the field
> + * is not meaningful.
> + */
> + if (load_fw->imem_mgmt)
> + load_fw->imem.state = s_info->d_addn_info.imem_state;
> + }
[Severity: High]
Will gating the per-instance `priv->load_fw.imem.state` initialization inside
`if (!var_se_info.soc_rev)` silently break boot firmware loading on subsequent
probes or module reload?
Since `var_se_info` is a global static variable whose `soc_rev` field is never
cleared across driver unbinds, any subsequent interface probe (or re-probe
after unbind via sysfs) will find `var_se_info.soc_rev` already populated.
This causes the driver to skip updating `load_fw->imem.state`, leaving it at
`0`. Later, `se_load_firmware()` checks `if (load_fw->imem.state ==
ELE_IMEM_STATE_BAD)` to decide whether to load the primary boot firmware.
Since the state is 0 instead of `0xfe`, does it silently skip the load and
break firmware initialization for that instance?
> +
> + if (se_info->soc_name && !var_se_info.soc_dev_regn.soc_dev_registered) {
> + err = se_soc_dev_register(priv, var_se_info.soc_rev,
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260822-imx-se-if-v40-0-74fbce2f2f95@nxp.com?part=3
next prev parent reply other threads:[~2026-08-21 13:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 18:36 [PATCH v40 0/7] firmware: imx: driver for NXP secure-enclave pankaj.gupta
2026-08-21 18:36 ` [PATCH v40 1/7] Documentation/firmware: add imx/se to other_interfaces pankaj.gupta
2026-08-21 18:36 ` [PATCH v40 2/7] dt-bindings: arm: fsl: add imx-se-fw binding doc pankaj.gupta
2026-08-21 18:36 ` [PATCH v40 3/7] firmware: imx: add driver for NXP EdgeLock Enclave pankaj.gupta
2026-08-21 13:21 ` sashiko-bot [this message]
2026-08-21 16:15 ` Frank Li
2026-08-21 18:36 ` [PATCH v40 4/7] firmware: imx: device context dedicated to priv pankaj.gupta
2026-08-21 15:56 ` Frank Li
2026-08-21 18:36 ` [PATCH v40 5/7] firmware: imx: adds miscdev pankaj.gupta
2026-08-21 13:23 ` sashiko-bot
2026-08-21 15:13 ` Pankaj Gupta (OSS)
2026-08-21 15:17 ` Frank Li
2026-08-21 16:53 ` Frank Li
2026-08-21 18:36 ` [PATCH v40 6/7] arm64: dts: imx8ulp: add secure enclave node pankaj.gupta
2026-08-21 18:36 ` [PATCH v40 7/7] arm64: dts: imx8ulp: add reserved memory for EdgeLock Enclave pankaj.gupta
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=20260821132106.82EDC1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=pankaj.gupta@oss.nxp.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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