Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers
@ 2026-11-23 17:20 Lee Jones
  2026-11-23 17:20 ` [PATCH 07/10] remoteproc: qcom: Clear glink->node on allocation failure Lee Jones
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lee Jones @ 2026-11-23 17:20 UTC (permalink / raw)
  To: lee
  Cc: linux-kernel, Rob Herring (Arm), Sjur Brændeland, Alex Elder,
	Andrew Davis, Beleswar Padhi, Bjorn Andersson, Brian Swetland,
	Clement Leger, Daniel Baluta, De Leon, Fabio Estevam, Frank Li,
	Guzman Lugo, Hari Kanigeri, Hari Nagalla, HyeongJun An, imx,
	Iuliana Prodan, linux-arm-kernel, linux-arm-msm, linux-remoteproc,
	Loic Pallardy, Mark Grosen, Mathieu Poirier, Ohad Ben-Cohen,
	Oleksij Rempel, Peng Fan, Pengutronix Kernel Team,
	Rishabh Bhatnagar, Robert Tivy, Sascha Hauer, Shengjiu Wang,
	Siddharth Gupta, Suman Anna, Tero Kristo, Uday Khare

These issues were reported by Sashiko.

None of these changes have been tested on physical hardware.

Cc: "Rob Herring (Arm)" <robh@kernel.org>
Cc: "Sjur Brændeland" <sjur.brandeland@stericsson.com>
Cc: Alex Elder <elder@kernel.org>
Cc: Andrew Davis <afd@ti.com>
Cc: Beleswar Padhi <b-padhi@ti.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Brian Swetland <swetland@google.com>
Cc: Clement Leger <cleger@kalray.eu>
Cc: Daniel Baluta <daniel.baluta@nxp.com>
Cc: De Leon <x0095078@ti.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Frank Li <Frank.Li@nxp.com>
Cc: Guzman Lugo <fernando.lugo@ti.com>
Cc: Hari Kanigeri <h-kanigeri2@ti.com>
Cc: Hari Nagalla <hnagalla@ti.com>
Cc: HyeongJun An <sammiee5311@gmail.com>
Cc: imx@lists.linux.dev
Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-remoteproc@vger.kernel.org
Cc: Loic Pallardy <loic.pallardy@st.com>
Cc: Mark Grosen <mgrosen@ti.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Rishabh Bhatnagar <rishabhb@codeaurora.org>
Cc: Robert Tivy <rtivy@ti.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shengjiu Wang <shengjiu.wang@nxp.com>
Cc: Siddharth Gupta <sidgup@codeaurora.org>
Cc: Suman Anna <s-anna@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Uday Khare <udaykhare77@gmail.com>

Lee Jones (10):
  remoteproc: core: Fix integer overflow in rproc_check_carveout_da()
  remoteproc: k3: Fix integer overflow in k3_rproc_da_to_va()
  remoteproc: omap: Fix integer overflow in omap_rproc_da_to_va()
  remoteproc: elf_loader: Fix overflow in rproc_elf_load_segments()
  remoteproc: imx_rproc: Avoid stale mailbox pointers on request failure
  remoteproc: imx_rproc: Register SCU cleanup after resource acquisition
  remoteproc: qcom: Clear glink->node on allocation failure
  remoteproc: qcom: Skip unregistering uninitialised SSR subdevice
  remoteproc: imx_dsp_rproc: Fix pointer stride in
    imx_dsp_rproc_memset()
  remoteproc: imx_dsp_rproc: Fix off-by-one bitmask for trailing bytes

 drivers/remoteproc/imx_dsp_rproc.c         | 10 ++++---
 drivers/remoteproc/imx_rproc.c             | 33 ++++++++++++++--------
 drivers/remoteproc/omap_remoteproc.c       | 11 +++++---
 drivers/remoteproc/qcom_common.c           |  5 ++++
 drivers/remoteproc/remoteproc_core.c       |  7 ++---
 drivers/remoteproc/remoteproc_elf_loader.c |  6 ++--
 drivers/remoteproc/ti_k3_common.c          | 27 +++++++++++-------
 7 files changed, 61 insertions(+), 38 deletions(-)

-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 07/10] remoteproc: qcom: Clear glink->node on allocation failure
  2026-11-23 17:20 [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers Lee Jones
@ 2026-11-23 17:20 ` Lee Jones
  2026-11-23 17:20 ` [PATCH 08/10] remoteproc: qcom: Skip unregistering uninitialised SSR subdevice Lee Jones
  2026-11-27 16:40 ` [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers Mathieu Poirier
  2 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2026-11-23 17:20 UTC (permalink / raw)
  To: lee, Bjorn Andersson, Mathieu Poirier, Uday Khare, linux-arm-msm,
	linux-remoteproc, linux-kernel
  Cc: stable

When kstrdup_const() fails in qcom_add_glink_subdev(), the error path
drops the device-node reference via of_node_put(glink->node) and returns
before registering the GLINK subdevice, leaving glink->node non-NULL.
During subsequent teardown, qcom_remove_glink_subdev() checks
glink->node, calls rproc_remove_subdev() on an uninitialised list node
resulting in a NULL pointer dereference, and drops the device-node
reference a second time.

Reset glink->node to NULL when releasing the node reference so teardown
leaves an unregistered subdevice untouched.

Fixes: 44f4911ab8e6 ("remoteproc: qcom: Fix glink->node reference leak in qcom_add_glink_subdev")
Closes: https://sashiko.dev/#/bug/linux-eb8cc93d-8136-4bff-a5e7-3698dbe185ae
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/remoteproc/qcom_common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
index 5294e327f158..c53190f0c537 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;
 	}
 
@@ -280,6 +281,7 @@ void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glin
 	rproc_remove_subdev(rproc, &glink->subdev);
 	kfree_const(glink->ssr_name);
 	of_node_put(glink->node);
+	glink->node = NULL;
 }
 EXPORT_SYMBOL_GPL(qcom_remove_glink_subdev);
 
-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 08/10] remoteproc: qcom: Skip unregistering uninitialised SSR subdevice
  2026-11-23 17:20 [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers Lee Jones
  2026-11-23 17:20 ` [PATCH 07/10] remoteproc: qcom: Clear glink->node on allocation failure Lee Jones
@ 2026-11-23 17:20 ` Lee Jones
  2026-11-23 22:25   ` Alex Elder
  2026-11-27 16:40 ` [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers Mathieu Poirier
  2 siblings, 1 reply; 5+ messages in thread
From: Lee Jones @ 2026-11-23 17:20 UTC (permalink / raw)
  To: lee, Bjorn Andersson, Mathieu Poirier, Rishabh Bhatnagar,
	Siddharth Gupta, Alex Elder, linux-arm-msm, linux-remoteproc,
	linux-kernel
  Cc: stable

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().

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@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 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;
 }
-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 08/10] remoteproc: qcom: Skip unregistering uninitialised SSR subdevice
  2026-11-23 17:20 ` [PATCH 08/10] remoteproc: qcom: Skip unregistering uninitialised SSR subdevice Lee Jones
@ 2026-11-23 22:25   ` Alex Elder
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Elder @ 2026-11-23 22:25 UTC (permalink / raw)
  To: Lee Jones, Bjorn Andersson, Mathieu Poirier, Rishabh Bhatnagar,
	Siddharth Gupta, Alex Elder, linux-arm-msm, linux-remoteproc,
	linux-kernel
  Cc: stable

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@riscstar.com>

> 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@vger.kernel.org
> Signed-off-by: Lee Jones <lee@kernel.org>
> ---
>   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;
>   }


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers
  2026-11-23 17:20 [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers Lee Jones
  2026-11-23 17:20 ` [PATCH 07/10] remoteproc: qcom: Clear glink->node on allocation failure Lee Jones
  2026-11-23 17:20 ` [PATCH 08/10] remoteproc: qcom: Skip unregistering uninitialised SSR subdevice Lee Jones
@ 2026-11-27 16:40 ` Mathieu Poirier
  2 siblings, 0 replies; 5+ messages in thread
From: Mathieu Poirier @ 2026-11-27 16:40 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, Rob Herring (Arm), Sjur Brændeland, Alex Elder,
	Andrew Davis, Beleswar Padhi, Bjorn Andersson, Brian Swetland,
	Clement Leger, Daniel Baluta, De Leon, Fabio Estevam, Frank Li,
	Guzman Lugo, Hari Kanigeri, Hari Nagalla, HyeongJun An, imx,
	Iuliana Prodan, linux-arm-kernel, linux-arm-msm, linux-remoteproc,
	Loic Pallardy, Mark Grosen, Ohad Ben-Cohen, Oleksij Rempel,
	Peng Fan, Pengutronix Kernel Team, Rishabh Bhatnagar, Robert Tivy,
	Sascha Hauer, Shengjiu Wang, Siddharth Gupta, Suman Anna,
	Tero Kristo, Uday Khare

Hi,

On Mon, Nov 23, 2026 at 05:20:44PM +0000, Lee Jones wrote:
> These issues were reported by Sashiko.
> 
> None of these changes have been tested on physical hardware.
> 
> Cc: "Rob Herring (Arm)" <robh@kernel.org>
> Cc: "Sjur Brændeland" <sjur.brandeland@stericsson.com>
> Cc: Alex Elder <elder@kernel.org>
> Cc: Andrew Davis <afd@ti.com>
> Cc: Beleswar Padhi <b-padhi@ti.com>
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: Brian Swetland <swetland@google.com>
> Cc: Clement Leger <cleger@kalray.eu>
> Cc: Daniel Baluta <daniel.baluta@nxp.com>
> Cc: De Leon <x0095078@ti.com>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Frank Li <Frank.Li@nxp.com>
> Cc: Guzman Lugo <fernando.lugo@ti.com>
> Cc: Hari Kanigeri <h-kanigeri2@ti.com>
> Cc: Hari Nagalla <hnagalla@ti.com>
> Cc: HyeongJun An <sammiee5311@gmail.com>
> Cc: imx@lists.linux.dev
> Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-arm-msm@vger.kernel.org
> Cc: linux-remoteproc@vger.kernel.org
> Cc: Loic Pallardy <loic.pallardy@st.com>
> Cc: Mark Grosen <mgrosen@ti.com>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Ohad Ben-Cohen <ohad@wizery.com>
> Cc: Oleksij Rempel <o.rempel@pengutronix.de>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Rishabh Bhatnagar <rishabhb@codeaurora.org>
> Cc: Robert Tivy <rtivy@ti.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Shengjiu Wang <shengjiu.wang@nxp.com>
> Cc: Siddharth Gupta <sidgup@codeaurora.org>
> Cc: Suman Anna <s-anna@ti.com>
> Cc: Tero Kristo <t-kristo@ti.com>
> Cc: Uday Khare <udaykhare77@gmail.com>
> 
> Lee Jones (10):
>   remoteproc: core: Fix integer overflow in rproc_check_carveout_da()
>   remoteproc: k3: Fix integer overflow in k3_rproc_da_to_va()
>   remoteproc: omap: Fix integer overflow in omap_rproc_da_to_va()
>   remoteproc: elf_loader: Fix overflow in rproc_elf_load_segments()
>   remoteproc: imx_rproc: Avoid stale mailbox pointers on request failure
>   remoteproc: imx_rproc: Register SCU cleanup after resource acquisition
>   remoteproc: qcom: Clear glink->node on allocation failure
>   remoteproc: qcom: Skip unregistering uninitialised SSR subdevice
>   remoteproc: imx_dsp_rproc: Fix pointer stride in
>     imx_dsp_rproc_memset()
>   remoteproc: imx_dsp_rproc: Fix off-by-one bitmask for trailing bytes
>

Other than patches 7 and 8 that will be handled by Bjorn, I have applied this
set.

Thanks,
Mathieu
 
>  drivers/remoteproc/imx_dsp_rproc.c         | 10 ++++---
>  drivers/remoteproc/imx_rproc.c             | 33 ++++++++++++++--------
>  drivers/remoteproc/omap_remoteproc.c       | 11 +++++---
>  drivers/remoteproc/qcom_common.c           |  5 ++++
>  drivers/remoteproc/remoteproc_core.c       |  7 ++---
>  drivers/remoteproc/remoteproc_elf_loader.c |  6 ++--
>  drivers/remoteproc/ti_k3_common.c          | 27 +++++++++++-------
>  7 files changed, 61 insertions(+), 38 deletions(-)
> 
> -- 
> 2.56.1.750.gf70dc682cf-goog
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-27 16:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 17:20 [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers Lee Jones
2026-11-23 17:20 ` [PATCH 07/10] remoteproc: qcom: Clear glink->node on allocation failure Lee Jones
2026-11-23 17:20 ` [PATCH 08/10] remoteproc: qcom: Skip unregistering uninitialised SSR subdevice Lee Jones
2026-11-23 22:25   ` Alex Elder
2026-11-27 16:40 ` [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers Mathieu Poirier

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