Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: pankaj.gupta@oss.nxp.com
Cc: conor+dt@kernel.org, robh@kernel.org, Frank.Li@kernel.org,
	imx@lists.linux.dev, devicetree@vger.kernel.org
Subject: Re: [PATCH v51 5/7] firmware: imx: adds miscdev
Date: Mon, 14 Sep 2026 15:09:50 +0000	[thread overview]
Message-ID: <20260914150950.CADB01F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915-imx-se-if-v51-5-4a7dac612cb5@nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The firmware-busy circuit breaker can be permanently disabled if a recovery command times out.
--

commit 8efdce1526b5b7fd05d241f2ae2a7a89f4376e43
Author: Pankaj Gupta <pankaj.gupta@nxp.com>

firmware: imx: adds miscdev

Adds the driver for communication interface to secure-enclave, that
enables exchanging messages with NXP secure enclave HW IP(s)
like EdgeLock Enclave.

> diff --git a/drivers/firmware/imx/se_ctrl.c b/drivers/firmware/imx/se_ctrl.c
> index b5d3421c09878..519f24d24a859 100644
> --- a/drivers/firmware/imx/se_ctrl.c
> +++ b/drivers/firmware/imx/se_ctrl.c

[ ... ]

> +static void se_clear_fw_busy(struct se_if_priv *priv)
> +{
> +	struct fw_busy_info *fbusy_info = &priv->fw_busy_info;
> +	struct se_if_device_ctx *dev_ctx = NULL;
> +	unsigned long flags;
> +
> +	scoped_guard(spinlock_irqsave, &fbusy_info->fw_busy_lock) {
> +		dev_ctx = fbusy_info->fw_busy_dev_ctx;
> +		fbusy_info->fw_busy_dev_ctx = NULL;
> +
> +		if (!dev_ctx) {
[ ... ]
> +			atomic_set(&fbusy_info->fw_busy, 0);
> +			return;
> +		}
> +	}
[ ... ]
> +	scoped_guard(mutex, &dev_ctx->fops_lock) {
[ ... ]
> +		if (have_snap) {
[ ... ]
> +			fw_api_specific_ops(priv->priv_dev_ctx,
> +					    (struct se_api_msg *)late_rx_snap, true);
[ ... ]
> +	se_release_msg_if(priv);
> +
> +	spin_lock_irqsave(&fbusy_info->fw_busy_lock, flags);
> +	atomic_set(&fbusy_info->fw_busy, 0);
> +	spin_unlock_irqrestore(&fbusy_info->fw_busy_lock, flags);

[Severity: High]
Can the circuit breaker be permanently bypassed if a recovery command times
out?

If fw_api_specific_ops() triggers a cleanup command like se_close_session()
and the firmware is still hung, that command will time out and call
se_mark_fw_busy(). Since fbusy_info->fw_busy_dev_ctx was set to NULL at the
start of this function, se_mark_fw_busy() will claim the slot again and set
fw_busy = 1.

When se_clear_fw_busy() finishes, it unconditionally sets fw_busy to 0
here, but leaves the newly armed fw_busy_dev_ctx populated. This leaves
the system in a state where fw_busy = 0 but fw_busy_dev_ctx != NULL.

If this happens, could subsequent timeouts from user-space ioctls fail to
re-arm the circuit breaker because se_mark_fw_busy() sees a non-NULL
fw_busy_dev_ctx and silently returns? This would permanently bypass the
fast reject mechanism.

> +	kref_put(&dev_ctx->refcount, se_if_dev_ctx_release);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260915-imx-se-if-v51-0-4a7dac612cb5@nxp.com?part=5

  reply	other threads:[~2026-09-14 15:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 19:39 [PATCH v51 0/7] firmware: imx: driver for NXP secure-enclave pankaj.gupta
2026-09-14 19:39 ` [PATCH v51 1/7] Documentation/firmware: add imx/se to other_interfaces pankaj.gupta
2026-09-14 14:27   ` sashiko-bot
2026-09-14 19:39 ` [PATCH v51 2/7] dt-bindings: arm: fsl: add imx-se-fw binding doc pankaj.gupta
2026-09-14 19:40 ` [PATCH v51 3/7] firmware: imx: add driver for NXP EdgeLock Enclave pankaj.gupta
2026-09-14 19:40 ` [PATCH v51 4/7] firmware: imx: device context dedicated to priv pankaj.gupta
2026-09-14 19:40 ` [PATCH v51 5/7] firmware: imx: adds miscdev pankaj.gupta
2026-09-14 15:09   ` sashiko-bot [this message]
2026-09-14 17:34     ` Pankaj Gupta (OSS)
2026-09-16 13:16   ` Arnd Bergmann
2026-09-16 14:39     ` Frank Li
2026-10-05 14:28       ` Frieder Schrempf
2026-09-24 16:14     ` [EXT] " Pankaj Gupta
2026-09-14 19:40 ` [PATCH v51 6/7] arm64: dts: imx8ulp: add secure enclave node pankaj.gupta
2026-09-14 15:17   ` sashiko-bot
2026-09-14 19:40 ` [PATCH v51 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=20260914150950.CADB01F000FF@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