* [PATCH 01/10] remoteproc: core: Fix integer overflow in rproc_check_carveout_da()
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 02/10] remoteproc: k3: Fix integer overflow in k3_rproc_da_to_va() Lee Jones
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2026-11-23 17:20 UTC (permalink / raw)
To: lee, Bjorn Andersson, Mathieu Poirier, Ohad Ben-Cohen,
Brian Swetland, Mark Grosen, Guzman Lugo, Suman Anna, Robert Tivy,
De Leon, Loic Pallardy, linux-remoteproc, linux-kernel
Cc: stable
rproc_check_carveout_da() subtracts two unsigned 32-bit device addresses
and stores the difference in a signed int variable before checking the
carveout bounds. When da exceeds mem->da by 0x80000000 or more, delta
wraps negative; conversely, when da is less than mem->da by more than
0x80000000, delta wraps to a positive integer and bypasses the lower
bound check. Furthermore, delta + len is evaluated in 32-bit unsigned
arithmetic before promotion to size_t, allowing large da and len values
to wrap around 32 bits and bypass the upper bound check as well.
Since len > mem->len is already rejected upfront, compare da < mem->da
directly and check da - mem->da > mem->len - len using subtraction to
eliminate signedness bugs and integer wraparound.
Fixes: c874bf59add0 ("remoteproc: add helper function to check carveout device address")
Closes: https://sashiko.dev/#/bug/linux-8c4ef7d2-a95d-4267-b41e-9023431eba23
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/remoteproc/remoteproc_core.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 23f8539a99bd..2b2ebf39a40a 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -287,7 +287,6 @@ static int rproc_check_carveout_da(struct rproc *rproc,
struct rproc_mem_entry *mem, u32 da, u32 len)
{
struct device *dev = &rproc->dev;
- int delta;
/* Check requested resource length */
if (len > mem->len) {
@@ -299,16 +298,14 @@ static int rproc_check_carveout_da(struct rproc *rproc,
/* Address doesn't match registered carveout configuration */
return -EINVAL;
} else if (da != FW_RSC_ADDR_ANY && mem->da != FW_RSC_ADDR_ANY) {
- delta = da - mem->da;
-
/* Check requested resource belongs to registered carveout */
- if (delta < 0) {
+ if (da < mem->da) {
dev_err(dev,
"Registered carveout doesn't fit da request\n");
return -EINVAL;
}
- if (delta + len > mem->len) {
+ if (da - mem->da > mem->len - len) {
dev_err(dev,
"Registered carveout doesn't fit len request\n");
return -EINVAL;
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 02/10] remoteproc: k3: Fix integer overflow in k3_rproc_da_to_va()
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 01/10] remoteproc: core: Fix integer overflow in rproc_check_carveout_da() Lee Jones
@ 2026-11-23 17:20 ` Lee Jones
2026-11-23 17:20 ` [PATCH 03/10] remoteproc: omap: Fix integer overflow in omap_rproc_da_to_va() Lee Jones
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2026-11-23 17:20 UTC (permalink / raw)
To: lee, Bjorn Andersson, Mathieu Poirier, Rob Herring (Arm),
Suman Anna, Hari Nagalla, Beleswar Padhi, Andrew Davis,
linux-remoteproc, linux-kernel
Cc: stable
k3_rproc_da_to_va() validates memory regions using (da + len) <=
(base + size) and stores da - base in a 32-bit unsigned offset variable.
Because da is u64 and len is size_t, a malformed firmware segment or
resource entry with a large da value causes da + len to wrap around 64
bits and pass the upper bound check. Subsequent assignment to the u32
offset variable truncates the 64-bit difference, returning an
out-of-bounds kernel virtual address to callers such as the ELF segment
loader.
Widen offset to u64 and rewrite the range checks across all three memory
loops using overflow-safe subtraction.
Fixes: 9179f8bfa98d ("remoteproc: k3: Refactor .da_to_va rproc ops into common driver")
Closes: https://sashiko.dev/#/bug/linux-36b3e1ce-919c-4ea8-b7de-b8a5a191c8b4
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/remoteproc/ti_k3_common.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/remoteproc/ti_k3_common.c b/drivers/remoteproc/ti_k3_common.c
index f79ccb57a372..1d06f46b75c6 100644
--- a/drivers/remoteproc/ti_k3_common.c
+++ b/drivers/remoteproc/ti_k3_common.c
@@ -356,7 +356,8 @@ void *k3_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem)
struct k3_rproc *kproc = rproc->priv;
void __iomem *va = NULL;
phys_addr_t bus_addr;
- u32 dev_addr, offset;
+ u32 dev_addr;
+ u64 offset;
size_t size;
int i;
@@ -369,17 +370,21 @@ void *k3_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem)
size = kproc->mem[i].size;
/* handle rproc-view addresses */
- if (da >= dev_addr && ((da + len) <= (dev_addr + size))) {
+ if (da >= dev_addr) {
offset = da - dev_addr;
- va = kproc->mem[i].cpu_addr + offset;
- return (__force void *)va;
+ if (offset <= size && len <= size - offset) {
+ va = kproc->mem[i].cpu_addr + offset;
+ return (__force void *)va;
+ }
}
/* handle SoC-view addresses */
- if (da >= bus_addr && (da + len) <= (bus_addr + size)) {
+ if (da >= bus_addr) {
offset = da - bus_addr;
- va = kproc->mem[i].cpu_addr + offset;
- return (__force void *)va;
+ if (offset <= size && len <= size - offset) {
+ va = kproc->mem[i].cpu_addr + offset;
+ return (__force void *)va;
+ }
}
}
@@ -388,10 +393,12 @@ void *k3_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem)
dev_addr = kproc->rmem[i].dev_addr;
size = kproc->rmem[i].size;
- if (da >= dev_addr && ((da + len) <= (dev_addr + size))) {
+ if (da >= dev_addr) {
offset = da - dev_addr;
- va = kproc->rmem[i].cpu_addr + offset;
- return (__force void *)va;
+ if (offset <= size && len <= size - offset) {
+ va = kproc->rmem[i].cpu_addr + offset;
+ return (__force void *)va;
+ }
}
}
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 03/10] remoteproc: omap: Fix integer overflow in omap_rproc_da_to_va()
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 01/10] remoteproc: core: Fix integer overflow in rproc_check_carveout_da() Lee Jones
2026-11-23 17:20 ` [PATCH 02/10] remoteproc: k3: Fix integer overflow in k3_rproc_da_to_va() Lee Jones
@ 2026-11-23 17:20 ` Lee Jones
2026-11-23 17:20 ` [PATCH 04/10] remoteproc: elf_loader: Fix overflow in rproc_elf_load_segments() Lee Jones
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2026-11-23 17:20 UTC (permalink / raw)
To: lee, Bjorn Andersson, Mathieu Poirier, Andrew Davis,
Ohad Ben-Cohen, Brian Swetland, Guzman Lugo, Mark Grosen,
Suman Anna, Hari Kanigeri, Tero Kristo, linux-remoteproc,
linux-kernel
Cc: stable
omap_rproc_da_to_va() checks da + len <= dev_addr + size using 64-bit
unsigned addition and stores da - dev_addr in a 32-bit unsigned offset
variable. A crafted firmware segment or resource entry with a large
da value can wrap da + len around 64 bits, bypassing the upper bound
check, while truncating da - dev_addr to 32 bits yields an
out-of-bounds pointer offset into kernel memory.
Widen offset to u64 and validate both offset <= size and
len <= size - offset without addition overflow.
Fixes: 530a1b57e859 ("remoteproc/omap: Add the rproc ops .da_to_va() implementation")
Closes: https://sashiko.dev/#/bug/linux-e1bfa1ec-93c7-47ac-aba5-bce08be0f756
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/remoteproc/omap_remoteproc.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c
index f52a531877ae..573f8d9ae8eb 100644
--- a/drivers/remoteproc/omap_remoteproc.c
+++ b/drivers/remoteproc/omap_remoteproc.c
@@ -735,7 +735,7 @@ static void *omap_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *
{
struct omap_rproc *oproc = rproc->priv;
int i;
- u32 offset;
+ u64 offset;
if (len <= 0)
return NULL;
@@ -744,9 +744,12 @@ static void *omap_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *
return NULL;
for (i = 0; i < oproc->num_mems; i++) {
- if (da >= oproc->mem[i].dev_addr && da + len <=
- oproc->mem[i].dev_addr + oproc->mem[i].size) {
- offset = da - oproc->mem[i].dev_addr;
+ if (da < oproc->mem[i].dev_addr)
+ continue;
+
+ offset = da - oproc->mem[i].dev_addr;
+ if (offset <= oproc->mem[i].size &&
+ len <= oproc->mem[i].size - offset) {
/* __force to make sparse happy with type conversion */
return (__force void *)(oproc->mem[i].cpu_addr +
offset);
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 04/10] remoteproc: elf_loader: Fix overflow in rproc_elf_load_segments()
2026-11-23 17:20 [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers Lee Jones
` (2 preceding siblings ...)
2026-11-23 17:20 ` [PATCH 03/10] remoteproc: omap: Fix integer overflow in omap_rproc_da_to_va() Lee Jones
@ 2026-11-23 17:20 ` Lee Jones
2026-11-23 17:20 ` [PATCH 05/10] remoteproc: imx_rproc: Avoid stale mailbox pointers on request failure Lee Jones
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2026-11-23 17:20 UTC (permalink / raw)
To: lee, Bjorn Andersson, Mathieu Poirier, HyeongJun An,
Ohad Ben-Cohen, Brian Swetland, Mark Grosen, Guzman Lugo,
Suman Anna, Robert Tivy, De Leon, Sjur Brændeland,
Clement Leger, linux-remoteproc, linux-kernel
Cc: stable
For 64-bit ELF firmware images, rproc_elf_load_segments() reads 64-bit
p_offset and p_filesz fields and checks offset + filesz > fw->size. A
malformed segment header where offset + filesz wraps around 64 bits
bypasses this truncation check, causing the subsequent segment copy
from elf_data + offset to read out of bounds outside the firmware
buffer.
Replace the addition with an overflow-safe subtraction check and log
offset and filesz individually when rejecting a truncated image.
Fixes: f31e339f1b9b ("remoteproc: Add elf64 support in elf loader")
Closes: https://sashiko.dev/#/bug/linux-754a0c40-c150-42df-9c0d-bbb2c3846fa7
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/remoteproc/remoteproc_elf_loader.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c
index da3cddbe7d4c..6b9de0627768 100644
--- a/drivers/remoteproc/remoteproc_elf_loader.c
+++ b/drivers/remoteproc/remoteproc_elf_loader.c
@@ -213,9 +213,9 @@ int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw)
break;
}
- if (offset + filesz > fw->size) {
- dev_err(dev, "truncated fw: need 0x%llx avail 0x%zx\n",
- offset + filesz, fw->size);
+ if (offset > fw->size || filesz > fw->size - offset) {
+ dev_err(dev, "truncated fw: offset 0x%llx filesz 0x%llx avail 0x%zx\n",
+ offset, filesz, fw->size);
ret = -EINVAL;
break;
}
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 05/10] remoteproc: imx_rproc: Avoid stale mailbox pointers on request failure
2026-11-23 17:20 [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers Lee Jones
` (3 preceding siblings ...)
2026-11-23 17:20 ` [PATCH 04/10] remoteproc: elf_loader: Fix overflow in rproc_elf_load_segments() Lee Jones
@ 2026-11-23 17:20 ` Lee Jones
2026-11-23 17:20 ` [PATCH 06/10] remoteproc: imx_rproc: Register SCU cleanup after resource acquisition Lee Jones
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2026-11-23 17:20 UTC (permalink / raw)
To: lee, Bjorn Andersson, Mathieu Poirier, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Peng Fan, Oleksij Rempel,
linux-remoteproc, imx, linux-arm-kernel, linux-kernel
Cc: stable
imx_rproc_xtr_mbox_init() stores the result of
mbox_request_channel_byname() directly into priv->tx_ch and priv->rx_ch.
Because mailbox channels are freed on stop() and detach() and
re-requested on start(), attach(), and system shutdown, a failure while
requesting "tx" leaves an ERR_PTR in priv->tx_ch, which is later
dereferenced by imx_rproc_kick() and imx_rproc_free_mbox(). If "rx"
fails after "tx" succeeds, priv->tx_ch is freed without being cleared
while priv->rx_ch retains an ERR_PTR, causing subsequent calls to see
both pointers as non-NULL and skip initialisation, leading to a
use-after-free on priv->tx_ch and an ERR_PTR dereference on priv->rx_ch.
Request both channels into local variables and assign priv->tx_ch and
priv->rx_ch only after both requests succeed.
Fixes: 99b142cf7191 ("remoteproc: imx_rproc: Request mbox channel later")
Closes: https://sashiko.dev/#/bug/linux-ac0f248a-bdfd-41da-95f8-44b8f1f7091d
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/remoteproc/imx_rproc.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 581bb07f5893..a77a3342e1ed 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -875,6 +875,7 @@ static void imx_rproc_rx_callback(struct mbox_client *cl, void *msg)
static int imx_rproc_xtr_mbox_init(struct rproc *rproc, bool tx_block)
{
struct imx_rproc *priv = rproc->priv;
+ struct mbox_chan *tx_ch, *rx_ch;
struct device *dev = priv->dev;
struct mbox_client *cl;
@@ -900,18 +901,21 @@ static int imx_rproc_xtr_mbox_init(struct rproc *rproc, bool tx_block)
cl->knows_txdone = false;
cl->rx_callback = imx_rproc_rx_callback;
- priv->tx_ch = mbox_request_channel_byname(cl, "tx");
- if (IS_ERR(priv->tx_ch))
- return dev_err_probe(cl->dev, PTR_ERR(priv->tx_ch),
+ tx_ch = mbox_request_channel_byname(cl, "tx");
+ if (IS_ERR(tx_ch))
+ return dev_err_probe(cl->dev, PTR_ERR(tx_ch),
"failed to request tx mailbox channel\n");
- priv->rx_ch = mbox_request_channel_byname(cl, "rx");
- if (IS_ERR(priv->rx_ch)) {
- mbox_free_channel(priv->tx_ch);
- return dev_err_probe(cl->dev, PTR_ERR(priv->rx_ch),
+ rx_ch = mbox_request_channel_byname(cl, "rx");
+ if (IS_ERR(rx_ch)) {
+ mbox_free_channel(tx_ch);
+ return dev_err_probe(cl->dev, PTR_ERR(rx_ch),
"failed to request rx mailbox channel\n");
}
+ priv->tx_ch = tx_ch;
+ priv->rx_ch = rx_ch;
+
return 0;
}
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 06/10] remoteproc: imx_rproc: Register SCU cleanup after resource acquisition
2026-11-23 17:20 [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers Lee Jones
` (4 preceding siblings ...)
2026-11-23 17:20 ` [PATCH 05/10] remoteproc: imx_rproc: Avoid stale mailbox pointers on request failure Lee Jones
@ 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
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2026-11-23 17:20 UTC (permalink / raw)
To: lee, Bjorn Andersson, Mathieu Poirier, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Peng Fan, Oleksij Rempel,
Daniel Baluta, linux-remoteproc, imx, linux-arm-kernel,
linux-kernel
Cc: stable
imx_rproc_scu_api_detect_mode() registers the imx_rproc_put_scu()
devres cleanup action before attaching power domains or registering the
SCU partition reboot notifier and enabling its interrupt group. If
imx_sc_rm_get_resource_owner() or imx_scu_irq_register_notifier() fails,
imx_rproc_put_scu() runs during failure unwind and unregisters an
unregistered notifier block while disabling an unconfigured interrupt
bit. Worse, if imx_scu_irq_group_enable() fails, the error path
explicitly unregisters priv->rproc_nb and devres subsequently invokes
imx_rproc_put_scu() to unregister the same notifier block a second time.
Defer devm_add_action_or_reset() until power-domain attachment or SCU
notifier and interrupt setup have completed.
Fixes: 9b2451658afa ("remoteproc: imx_rproc: Use devm_add_action_or_reset() for scu cleanup")
Closes: https://sashiko.dev/#/bug/linux-1230a154-7627-4ce2-96f3-d0033709ba4e
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/remoteproc/imx_rproc.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index a77a3342e1ed..9ff2cd50acb6 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -1083,10 +1083,6 @@ static int imx_rproc_scu_api_detect_mode(struct rproc *rproc)
else
priv->core_index = 0;
- ret = devm_add_action_or_reset(dev, imx_rproc_put_scu, priv);
- if (ret)
- return dev_err_probe(dev, ret, "Failed to add action for put scu\n");
-
/*
* If Mcore resource is not owned by Acore partition, It is kicked by ROM,
* and Linux could only do IPC with Mcore and nothing else.
@@ -1095,7 +1091,11 @@ static int imx_rproc_scu_api_detect_mode(struct rproc *rproc)
if (of_property_read_u32(dev->of_node, "fsl,entry-address", &priv->entry))
return -EINVAL;
- return imx_rproc_attach_pd(priv);
+ ret = imx_rproc_attach_pd(priv);
+ if (ret)
+ return ret;
+
+ goto add_scu_action;
}
priv->rproc->state = RPROC_DETACHED;
@@ -1126,6 +1126,11 @@ static int imx_rproc_scu_api_detect_mode(struct rproc *rproc)
return ret;
}
+add_scu_action:
+ ret = devm_add_action_or_reset(dev, imx_rproc_put_scu, priv);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to add action for put scu\n");
+
return 0;
}
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply related [flat|nested] 11+ 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
` (5 preceding siblings ...)
2026-11-23 17:20 ` [PATCH 06/10] remoteproc: imx_rproc: Register SCU cleanup after resource acquisition 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
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ 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] 11+ 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
` (6 preceding siblings ...)
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 17:20 ` [PATCH 09/10] remoteproc: imx_dsp_rproc: Fix pointer stride in imx_dsp_rproc_memset() Lee Jones
2026-11-23 17:20 ` [PATCH 10/10] remoteproc: imx_dsp_rproc: Fix off-by-one bitmask for trailing bytes Lee Jones
9 siblings, 0 replies; 11+ 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] 11+ messages in thread* [PATCH 09/10] remoteproc: imx_dsp_rproc: Fix pointer stride in imx_dsp_rproc_memset()
2026-11-23 17:20 [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers Lee Jones
` (7 preceding siblings ...)
2026-11-23 17:20 ` [PATCH 08/10] remoteproc: qcom: Skip unregistering uninitialised SSR subdevice Lee Jones
@ 2026-11-23 17:20 ` Lee Jones
2026-11-23 17:20 ` [PATCH 10/10] remoteproc: imx_dsp_rproc: Fix off-by-one bitmask for trailing bytes Lee Jones
9 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2026-11-23 17:20 UTC (permalink / raw)
To: lee, Bjorn Andersson, Mathieu Poirier, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Shengjiu Wang,
Iuliana Prodan, linux-remoteproc, imx, linux-arm-kernel,
linux-kernel
Cc: stable
Commit 3c497f624d40 ("remoteproc: imx_dsp_rproc: Fix kernel test robot
sparse warning") changed tmp_dst from u32 * to void __iomem *. In GNU
C, incrementing a void pointer advances it by 1 byte rather than 4
bytes. Consequently, the word-fill loop in imx_dsp_rproc_memset()
steps by 1 byte per 32-bit writel(), triggering unaligned 32-bit MMIO
accesses on Device-mapped DSP IRAM, mispositioning tmp_dst for the
trailing-byte read-modify-write, and leaving roughly three quarters of
the target region uninitialised.
Advance tmp_dst by 4 bytes per 32-bit word write.
Fixes: 3c497f624d40 ("remoteproc: imx_dsp_rproc: Fix kernel test robot sparse warning")
Closes: https://sashiko.dev/#/bug/linux-720f943f-eefd-4df7-806e-0b50cad1abbe
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/remoteproc/imx_dsp_rproc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index 96d619daf3f5..2771043ee433 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -843,8 +843,10 @@ static int imx_dsp_rproc_memset(void *addr, u8 value, size_t size)
q = size / 4;
r = size % 4;
- while (q--)
- writel(tmp_val, tmp_dst++);
+ while (q--) {
+ writel(tmp_val, tmp_dst);
+ tmp_dst += 4;
+ }
if (r) {
affected_mask = GENMASK(8 * r, 0);
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 10/10] remoteproc: imx_dsp_rproc: Fix off-by-one bitmask for trailing bytes
2026-11-23 17:20 [PATCH 00/10] remoteproc: Assorted bug fixes across remoteproc core and drivers Lee Jones
` (8 preceding siblings ...)
2026-11-23 17:20 ` [PATCH 09/10] remoteproc: imx_dsp_rproc: Fix pointer stride in imx_dsp_rproc_memset() Lee Jones
@ 2026-11-23 17:20 ` Lee Jones
9 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2026-11-23 17:20 UTC (permalink / raw)
To: lee, Bjorn Andersson, Mathieu Poirier, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Shengjiu Wang,
Iuliana Prodan, linux-remoteproc, imx, linux-arm-kernel,
linux-kernel
Cc: stable
When size is not a multiple of 4, both imx_dsp_rproc_memcpy() and
imx_dsp_rproc_memset() compute affected_mask as GENMASK(8 * r, 0) for
the remaining r bytes (1 <= r <= 3). Because GENMASK(h, l) is inclusive
of bit h, GENMASK(8 * r, 0) sets 8 * r + 1 bits and clears or overwrites
the least-significant bit of the first byte past the end of the target
region during the 32-bit read-modify-write.
Use GENMASK(8 * r - 1, 0) to mask exclusively the r trailing bytes.
Fixes: 408ec1ff0caa ("remoteproc: imx_dsp_rproc: Add custom memory copy implementation for i.MX DSP Cores")
Closes: https://sashiko.dev/#/bug/linux-2e407b68-a7e9-42ff-a613-e61b47a4461b
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/remoteproc/imx_dsp_rproc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index 2771043ee433..0e0325d5df9f 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -799,7 +799,7 @@ static int imx_dsp_rproc_memcpy(void *dst, const void *src, size_t size)
writel(source[i], dest + i * 4);
if (r) {
- affected_mask = GENMASK(8 * r, 0);
+ affected_mask = GENMASK(8 * r - 1, 0);
/*
* first read the 32bit data of dest, then change affected
@@ -849,7 +849,7 @@ static int imx_dsp_rproc_memset(void *addr, u8 value, size_t size)
}
if (r) {
- affected_mask = GENMASK(8 * r, 0);
+ affected_mask = GENMASK(8 * r - 1, 0);
/*
* first read the 32bit data of addr, then change affected
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread