Re: [PATCH 08/10] remoteproc: qcom: Skip unregistering uninitialised SSR subdevice
From: Alex Elder
Date: Mon Nov 23 2026 - 17:25:42 EST
On 11/23/26 11:20 AM, Lee Jones wrote:
If qcom_ssr_get_subsys() fails in qcom_add_ssr_subdev(), the function
logs an error and returns early without calling rproc_add_subdev(),
leaving ssr->info NULL and ssr->subdev.node uninitialised. When driver
probe unwinds or the device is later removed, qcom_remove_ssr_subdev()
unconditionally calls rproc_remove_subdev(), dereferencing a NULL list
pointer in list_del().
At first I thought a failure seen in qcom_add_ssr_subdev() should
mean that qcom_remove_ssr_subdev() never gets called. But now
I see that doesn't return any error, hence the check for a null
ssr->info pointer is necessary here.
So... this looks good to me.
Reviewed-by: Alex Elder <elder@xxxxxxxxxxxx>
Guard qcom_remove_ssr_subdev() on ssr->info being non-NULL, matching the
GLINK and SMD subdevice teardown helpers.
Fixes: 5abfe5cf0b83 ("remoteproc: qcom: Add per subsystem SSR notification")
Closes: https://sashiko.dev/#/bug/linux-5594c348-0c41-4482-b001-481878256d30
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/remoteproc/qcom_common.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
index c53190f0c537..6fd92c33392b 100644
--- a/drivers/remoteproc/qcom_common.c
+++ b/drivers/remoteproc/qcom_common.c
@@ -537,6 +537,9 @@ EXPORT_SYMBOL_GPL(qcom_add_ssr_subdev);
*/
void qcom_remove_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr)
{
+ if (!ssr->info)
+ return;
+
rproc_remove_subdev(rproc, &ssr->subdev);
ssr->info = NULL;
}