* [PATCH] pinctrl: qcom: check the return value of qcom_scm_io_readl()
@ 2026-11-05 16:18 Bartosz Golaszewski
2026-11-06 8:48 ` Konrad Dybcio
0 siblings, 1 reply; 2+ messages in thread
From: Bartosz Golaszewski @ 2026-11-05 16:18 UTC (permalink / raw)
To: Bjorn Andersson, Bartosz Golaszewski, Linus Walleij,
Christian Marangi, Ajay Kishore, Konrad Dybcio
Cc: linux-arm-msm, linux-gpio, linux-kernel, stable, Bartosz Golaszewski
qcom_scm_io_readl() performs an SCM call and may fail in which case, the
stack variable val remains uninitialized and its contents are written to
HW registers. Check the return value and bail-out on failure.
Cc: stable@vger.kernel.org
Closes: https://sashiko.dev/#/bug/linux-a5545ffd-48cc-4856-94cc-4b2dd7968f50
Fixes: 13bec8d49bdf ("pinctrl: qcom: use scm_call to route GPIO irq to Apps")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/pinctrl/qcom/pinctrl-msm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index 32aa7b919e24a0e614078ddc70a248c746e4813b..0053d1d927dc134ee81377fe480befa2da87c7f5 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -1117,7 +1117,12 @@ static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type)
u32 addr = pctrl->phys_base[0] + reg;
int ret;
- qcom_scm_io_readl(addr, &val);
+ ret = qcom_scm_io_readl(addr, &val);
+ if (ret) {
+ raw_spin_unlock_irqrestore(&pctrl->lock, flags);
+ return ret;
+ }
+
val &= ~(intr_target_mask << g->intr_target_bit);
val |= g->intr_target_kpss_val << g->intr_target_bit;
---
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
change-id: 20261105-pinctrl-qcom-scm-fail-3a5a2efa79e1
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] pinctrl: qcom: check the return value of qcom_scm_io_readl()
2026-11-05 16:18 [PATCH] pinctrl: qcom: check the return value of qcom_scm_io_readl() Bartosz Golaszewski
@ 2026-11-06 8:48 ` Konrad Dybcio
0 siblings, 0 replies; 2+ messages in thread
From: Konrad Dybcio @ 2026-11-06 8:48 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Bartosz Golaszewski,
Linus Walleij, Christian Marangi, Ajay Kishore, Konrad Dybcio
Cc: linux-arm-msm, linux-gpio, linux-kernel, stable
On 11/5/26 5:18 PM, Bartosz Golaszewski wrote:
> qcom_scm_io_readl() performs an SCM call and may fail in which case, the
> stack variable val remains uninitialized and its contents are written to
> HW registers. Check the return value and bail-out on failure.
>
> Cc: stable@vger.kernel.org
> Closes: https://sashiko.dev/#/bug/linux-a5545ffd-48cc-4856-94cc-4b2dd7968f50
> Fixes: 13bec8d49bdf ("pinctrl: qcom: use scm_call to route GPIO irq to Apps")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
> drivers/pinctrl/qcom/pinctrl-msm.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
> index 32aa7b919e24a0e614078ddc70a248c746e4813b..0053d1d927dc134ee81377fe480befa2da87c7f5 100644
> --- a/drivers/pinctrl/qcom/pinctrl-msm.c
> +++ b/drivers/pinctrl/qcom/pinctrl-msm.c
> @@ -1117,7 +1117,12 @@ static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type)
> u32 addr = pctrl->phys_base[0] + reg;
> int ret;
>
> - qcom_scm_io_readl(addr, &val);
> + ret = qcom_scm_io_readl(addr, &val);
> + if (ret) {
> + raw_spin_unlock_irqrestore(&pctrl->lock, flags);
> + return ret;
> + }
Linus already pulled Lee's fix
https://lore.kernel.org/linux-arm-msm/20261103213002.1673560-11-lee@kernel.org/
Konrad
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-06 8:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 16:18 [PATCH] pinctrl: qcom: check the return value of qcom_scm_io_readl() Bartosz Golaszewski
2026-11-06 8:48 ` Konrad Dybcio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®