drivers/misc/fastrpc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
In the SDSP probe path, qcom_scm_assign_mem() is used to assign the
reserved memory to the configured VMIDs, but its return value was not
checked.
Fail the probe if the SCM call fails to avoid continuing with an
unexpected/incorrect memory permission configuration
Fixes: c3c0363bc72d4 ("misc: fastrpc: support complete DMA pool access to the DSP")
Cc: stable@vger.kernel.org # 6.11-rc1
Signed-off-by: Xingjing Deng <xjdeng@buaa.edu.cn>
---
v3:
- Add missing linux-kernel@vger.kernel.org to cc list.
- Standarlize changelog placement/format.
v2:
- Add Fixes: and Cc: stable tags.
Link: https://lore.kernel.org/linux-arm-msm/20260113063618.e2ke47gy3hnfi67e@hu-mojha-hyd.qualcomm.com/T/#t
Link: https://lore.kernel.org/linux-arm-msm/20260113022550.4029635-1-xjdeng@buaa.edu.cn/T/#u
drivers/misc/fastrpc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index fb3b54e05928..cbb12db110b3 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -2338,8 +2338,13 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
if (!err) {
src_perms = BIT(QCOM_SCM_VMID_HLOS);
- qcom_scm_assign_mem(res.start, resource_size(&res), &src_perms,
+ err = qcom_scm_assign_mem(res.start, resource_size(&res), &src_perms,
data->vmperms, data->vmcount);
+ if (err) {
+ dev_err(rdev, "Failed to assign memory phys 0x%llx size 0x%llx err %d",
+ res.start, resource_size(&res), err);
+ goto err_free_data;
+ }
}
}
--
2.25.1
On Tue, Jan 13, 2026 at 02:54:09PM +0800, Xingjing Deng wrote:
> In the SDSP probe path, qcom_scm_assign_mem() is used to assign the
> reserved memory to the configured VMIDs, but its return value was not
> checked.
>
> Fail the probe if the SCM call fails to avoid continuing with an
> unexpected/incorrect memory permission configuration
>
> Fixes: c3c0363bc72d4 ("misc: fastrpc: support complete DMA pool access to the DSP")
> Cc: stable@vger.kernel.org # 6.11-rc1
> Signed-off-by: Xingjing Deng <xjdeng@buaa.edu.cn>
>
> ---
>
> v3:
> - Add missing linux-kernel@vger.kernel.org to cc list.
> - Standarlize changelog placement/format.
>
> v2:
> - Add Fixes: and Cc: stable tags.
>
> Link: https://lore.kernel.org/linux-arm-msm/20260113063618.e2ke47gy3hnfi67e@hu-mojha-hyd.qualcomm.com/T/#t
> Link: https://lore.kernel.org/linux-arm-msm/20260113022550.4029635-1-xjdeng@buaa.edu.cn/T/#u
v3:
- ...
- ..
- Links to v2 : https://lore.kernel.org/linux-arm-msm/20260113063618.e2ke47gy3hnfi67e@hu-mojha-hyd.qualcomm.com/T/#m84a16b6d0f58e93c1f786ea04550681b23e79df4
v2:
- ..
- ..
- Link to v1: ...
You could even use b4..
> drivers/misc/fastrpc.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index fb3b54e05928..cbb12db110b3 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -2338,8 +2338,13 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
> if (!err) {
> src_perms = BIT(QCOM_SCM_VMID_HLOS);
>
> - qcom_scm_assign_mem(res.start, resource_size(&res), &src_perms,
> + err = qcom_scm_assign_mem(res.start, resource_size(&res), &src_perms,
> data->vmperms, data->vmcount);
Fix the alignment to previous line '(' like you did for dev_err(), I know this file lacks it,
but that does not mean we should repeat it.
> + if (err) {
> + dev_err(rdev, "Failed to assign memory phys 0x%llx size 0x%llx err %d",
> + res.start, resource_size(&res), err);
> + goto err_free_data;
> + }
> }
With the above change.
Reviewed-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
>
> }
> --
> 2.25.1
>
--
-Mukesh Ojha
OK, I will do that.
PATCH v4 is released now.
Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> 于2026年1月13日周二 16:44写道:
>
> On Tue, Jan 13, 2026 at 02:54:09PM +0800, Xingjing Deng wrote:
> > In the SDSP probe path, qcom_scm_assign_mem() is used to assign the
> > reserved memory to the configured VMIDs, but its return value was not
> > checked.
> >
> > Fail the probe if the SCM call fails to avoid continuing with an
> > unexpected/incorrect memory permission configuration
> >
> > Fixes: c3c0363bc72d4 ("misc: fastrpc: support complete DMA pool access to the DSP")
> > Cc: stable@vger.kernel.org # 6.11-rc1
> > Signed-off-by: Xingjing Deng <xjdeng@buaa.edu.cn>
> >
> > ---
> >
> > v3:
> > - Add missing linux-kernel@vger.kernel.org to cc list.
> > - Standarlize changelog placement/format.
> >
> > v2:
> > - Add Fixes: and Cc: stable tags.
> >
> > Link: https://lore.kernel.org/linux-arm-msm/20260113063618.e2ke47gy3hnfi67e@hu-mojha-hyd.qualcomm.com/T/#t
> > Link: https://lore.kernel.org/linux-arm-msm/20260113022550.4029635-1-xjdeng@buaa.edu.cn/T/#u
>
> v3:
> - ...
> - ..
> - Links to v2 : https://lore.kernel.org/linux-arm-msm/20260113063618.e2ke47gy3hnfi67e@hu-mojha-hyd.qualcomm.com/T/#m84a16b6d0f58e93c1f786ea04550681b23e79df4
>
>
> v2:
> - ..
> - ..
> - Link to v1: ...
>
> You could even use b4..
>
>
> > drivers/misc/fastrpc.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> > index fb3b54e05928..cbb12db110b3 100644
> > --- a/drivers/misc/fastrpc.c
> > +++ b/drivers/misc/fastrpc.c
> > @@ -2338,8 +2338,13 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
> > if (!err) {
> > src_perms = BIT(QCOM_SCM_VMID_HLOS);
> >
> > - qcom_scm_assign_mem(res.start, resource_size(&res), &src_perms,
> > + err = qcom_scm_assign_mem(res.start, resource_size(&res), &src_perms,
> > data->vmperms, data->vmcount);
>
> Fix the alignment to previous line '(' like you did for dev_err(), I know this file lacks it,
> but that does not mean we should repeat it.
>
>
> > + if (err) {
> > + dev_err(rdev, "Failed to assign memory phys 0x%llx size 0x%llx err %d",
> > + res.start, resource_size(&res), err);
> > + goto err_free_data;
> > + }
> > }
>
> With the above change.
>
> Reviewed-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
>
> >
> > }
> > --
> > 2.25.1
> >
>
> --
> -Mukesh Ojha
© 2016 - 2026 Red Hat, Inc.