Thread (13 messages) flat view 13 messages, 2 authors, 1d ago

Re: [PATCH v47 3/7] firmware: imx: add driver for NXP EdgeLock Enclave

From: sashiko-bot@kernel.org
Date: 2026-09-04 06:39:00
Also in: imx

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Discarding successful firmware response and breaking idempotency on deferred signal
--

commit c3c233856b9a36edd6fd79385b30e7951622e780
Author: Pankaj Gupta [off-list ref]

firmware: imx: add driver for NXP EdgeLock Enclave

This commit adds the MU-based communication interface for the NXP EdgeLock
Enclave. It enables messaging between the secure enclave firmware and Linux
for features like HSM, SHE, and V2X on i.MX SoCs.
quoted hunk ↗ jump to hunk
diff --git a/drivers/firmware/imx/ele_common.c b/drivers/firmware/imx/ele_common.c
--- /dev/null
+++ b/drivers/firmware/imx/ele_common.c
[ ... ]
+int ele_msg_send_rcv(struct se_if_priv *priv, void *tx_msg, int tx_msg_sz,
+		     void *rx_msg, int exp_rx_msg_sz)
+{
[ ... ]
+	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]
If the firmware successfully completes the transaction and ele_msg_rcv
returns a positive response size (err > 0), does returning -ERESTARTSYS
cause the VFS layer to automatically restart the identical syscall?

Since the hardware has already processed the command successfully and mutated
its state, wouldn't restarting the syscall cause the same command to be sent
a second time? This appears to break idempotency and could potentially leak
hardware resources (such as unclosed sessions or orphaned keys) because the
first successful response is discarded and userspace is unaware it succeeded.
+		priv->waiting_rsp_clbk_hdl.signal_rcvd = false;
+		dev_dbg(priv->dev, "Err[0x%x]:Interrupted by signal.\n", err);
+	}
+
+	ele_msg_send_rcv_cleanup(priv);
+
+	return err;
+}
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260904-imx-se-if-v47-0-b474ec6fc52a@nxp.com?part=3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help