* [PATCH] net: ipa: fix SMEM state handle leaks in SMP2P init
@ 2026-06-23 3:18 Haoxiang Li
2026-06-23 15:53 ` Alex Elder
0 siblings, 1 reply; 3+ messages in thread
From: Haoxiang Li @ 2026-06-23 3:18 UTC (permalink / raw)
To: elder, andrew+netdev, davem, edumazet, kuba, pabeni
Cc: netdev, linux-kernel, Haoxiang Li, stable
ipa_smp2p_init() acquires two Qualcomm SMEM state handles with
qcom_smem_state_get(). However, neither the init error paths
nor ipa_smp2p_exit() release them.
Use devm_qcom_smem_state_get() for both state handles so the
references are released automatically when the platform device
is removed.
Fixes: 530f9216a953 ("soc: qcom: ipa: AP/modem communications")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
drivers/net/ipa/ipa_smp2p.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ipa/ipa_smp2p.c b/drivers/net/ipa/ipa_smp2p.c
index 2f0ccdd937cc..d8fd56949082 100644
--- a/drivers/net/ipa/ipa_smp2p.c
+++ b/drivers/net/ipa/ipa_smp2p.c
@@ -228,15 +228,15 @@ ipa_smp2p_init(struct ipa *ipa, struct platform_device *pdev, bool modem_init)
u32 valid_bit;
int ret;
- valid_state = qcom_smem_state_get(dev, "ipa-clock-enabled-valid",
- &valid_bit);
+ valid_state = devm_qcom_smem_state_get(dev, "ipa-clock-enabled-valid",
+ &valid_bit);
if (IS_ERR(valid_state))
return PTR_ERR(valid_state);
if (valid_bit >= 32) /* BITS_PER_U32 */
return -EINVAL;
- enabled_state = qcom_smem_state_get(dev, "ipa-clock-enabled",
- &enabled_bit);
+ enabled_state = devm_qcom_smem_state_get(dev, "ipa-clock-enabled",
+ &enabled_bit);
if (IS_ERR(enabled_state))
return PTR_ERR(enabled_state);
if (enabled_bit >= 32) /* BITS_PER_U32 */
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: ipa: fix SMEM state handle leaks in SMP2P init
2026-06-23 3:18 [PATCH] net: ipa: fix SMEM state handle leaks in SMP2P init Haoxiang Li
@ 2026-06-23 15:53 ` Alex Elder
2026-06-23 21:06 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Alex Elder @ 2026-06-23 15:53 UTC (permalink / raw)
To: Haoxiang Li, elder, andrew+netdev, davem, edumazet, kuba, pabeni
Cc: netdev, linux-kernel, stable
On 6/22/26 10:18 PM, Haoxiang Li wrote:
> ipa_smp2p_init() acquires two Qualcomm SMEM state handles with
> qcom_smem_state_get(). However, neither the init error paths
> nor ipa_smp2p_exit() release them.
>
> Use devm_qcom_smem_state_get() for both state handles so the
> references are released automatically when the platform device
> is removed.
>
> Fixes: 530f9216a953 ("soc: qcom: ipa: AP/modem communications")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
So I guess they were never "put" before?
This looks OK, but I'll just mention that the IPA code
doesn't use devm_*() (managed) interfaces. So it would
be more consistent to just call qcom_smem_state_put()
at the end of ipa_smp2p_exit() for both ipa->enabled_state
and ipa->valid_state.
-Alex
> ---
> drivers/net/ipa/ipa_smp2p.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ipa/ipa_smp2p.c b/drivers/net/ipa/ipa_smp2p.c
> index 2f0ccdd937cc..d8fd56949082 100644
> --- a/drivers/net/ipa/ipa_smp2p.c
> +++ b/drivers/net/ipa/ipa_smp2p.c
> @@ -228,15 +228,15 @@ ipa_smp2p_init(struct ipa *ipa, struct platform_device *pdev, bool modem_init)
> u32 valid_bit;
> int ret;
>
> - valid_state = qcom_smem_state_get(dev, "ipa-clock-enabled-valid",
> - &valid_bit);
> + valid_state = devm_qcom_smem_state_get(dev, "ipa-clock-enabled-valid",
> + &valid_bit);
> if (IS_ERR(valid_state))
> return PTR_ERR(valid_state);
> if (valid_bit >= 32) /* BITS_PER_U32 */
> return -EINVAL;
>
> - enabled_state = qcom_smem_state_get(dev, "ipa-clock-enabled",
> - &enabled_bit);
> + enabled_state = devm_qcom_smem_state_get(dev, "ipa-clock-enabled",
> + &enabled_bit);
> if (IS_ERR(enabled_state))
> return PTR_ERR(enabled_state);
> if (enabled_bit >= 32) /* BITS_PER_U32 */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: ipa: fix SMEM state handle leaks in SMP2P init
2026-06-23 15:53 ` Alex Elder
@ 2026-06-23 21:06 ` Jakub Kicinski
0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2026-06-23 21:06 UTC (permalink / raw)
To: Haoxiang Li
Cc: Alex Elder, elder, andrew+netdev, davem, edumazet, pabeni, netdev,
linux-kernel, stable
On Tue, 23 Jun 2026 10:53:49 -0500 Alex Elder wrote:
> So I guess they were never "put" before?
>
> This looks OK, but I'll just mention that the IPA code
> doesn't use devm_*() (managed) interfaces. So it would
> be more consistent to just call qcom_smem_state_put()
> at the end of ipa_smp2p_exit() for both ipa->enabled_state
> and ipa->valid_state.
Let's do that instead. The devm_ APIs prevent about as many bugs
as they cause.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-23 21:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23 3:18 [PATCH] net: ipa: fix SMEM state handle leaks in SMP2P init Haoxiang Li
2026-06-23 15:53 ` Alex Elder
2026-06-23 21:06 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox