The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] remoteproc: qcom: Clear the GLINK node after name allocation failure
@ 2026-11-24 15:45 Yige Jiang
  0 siblings, 0 replies; only message in thread
From: Yige Jiang @ 2026-11-24 15:45 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier
  Cc: Yige Jiang, linux-arm-msm, linux-remoteproc, linux-kernel, stable

If kstrdup_const() fails, qcom_add_glink_subdev() puts the acquired node
reference and returns without adding the subdevice. However, glink->node
remains set, so qcom_remove_glink_subdev() later treats the subdevice as
registered. It attempts to remove an uninitialized list entry and can
also drop the node reference a second time.

Clear glink->node after the error-path put so that the existing guard in
qcom_remove_glink_subdev() skips a subdevice that was never added.

Fixes: 44f4911ab8e6 ("remoteproc: qcom: Fix glink->node reference leak in qcom_add_glink_subdev")
Cc: stable@vger.kernel.org
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
AI assistance was used for analysis and patch preparation.

Based on next-20261104 (8b7179210b22).
Compile-tested: arm64, GCC 14.2.0, W=1, drivers/remoteproc/qcom_common.o;
baseline and patched objects built with no warnings.
Static source review; no hardware, boot, or KASAN test was performed.

 drivers/remoteproc/qcom_common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
index 5294e327f1587efc917eb01dde59bd1e723c225e..cb3f6f93c6da85010f89244a6991f4d74ae57dc1 100644
--- a/drivers/remoteproc/qcom_common.c
+++ b/drivers/remoteproc/qcom_common.c
@@ -255,6 +255,7 @@ void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink,
 	glink->ssr_name = kstrdup_const(ssr_name, GFP_KERNEL);
 	if (!glink->ssr_name) {
 		of_node_put(glink->node);
+		glink->node = NULL;
 		return;
 	}

base-commit: 8b7179210b22f8e48a82c5ceacb9d56a9c4cfec4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-24 15:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 15:45 [PATCH] remoteproc: qcom: Clear the GLINK node after name allocation failure Yige Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox