From: Alex Elder <elder@ieee.org>
To: Wentao Liang <vulab@iscas.ac.cn>, andrew+netdev@lunn.ch
Cc: davem@davemloft.net, edumazet@google.com, elder@kernel.org,
kuba@kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, pabeni@redhat.com,
stable@vger.kernel.org
Subject: Re: [PATCH] net: ipa: Fix valid_state leak in ipa_smp2p_init()
Date: Thu, 17 Sep 2026 07:18:50 -0500 [thread overview]
Message-ID: <ced2ea64-6415-425b-aa8f-68df68253bc2@ieee.org> (raw)
In-Reply-To: <20260917115424.2149947-1-vulab@iscas.ac.cn>
On 9/17/26 6:54 AM, Wentao Liang wrote:
> qcom_smem_state_get() takes a reference on the state, but
> ipa_smp2p_init() returns without releasing the "ipa-clock-enabled-valid"
> state when the bit number is out of range, when the "ipa-clock-enabled"
> state cannot be acquired or its bit number is out of range, when the
> smp2p structure cannot be allocated, and on the error paths that free
> the structure. Release the reference on all of these paths.
I haven't looked very closely at this one but it also seems
to have been fixed already.
96ca1e658ae45 net: ipa: fix SMEM state handle leaks in SMP2P init
-Alex
>
> Fixes: 530f9216a953 ("soc: qcom: ipa: AP/modem communications")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/net/ipa/ipa_smp2p.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ipa/ipa_smp2p.c b/drivers/net/ipa/ipa_smp2p.c
> index 78f6df2cad76..f45225b16722 100644
> --- a/drivers/net/ipa/ipa_smp2p.c
> +++ b/drivers/net/ipa/ipa_smp2p.c
> @@ -232,21 +232,27 @@ ipa_smp2p_init(struct ipa *ipa, struct platform_device *pdev, bool modem_init)
> &valid_bit);
> if (IS_ERR(valid_state))
> return PTR_ERR(valid_state);
> - if (valid_bit >= 32) /* BITS_PER_U32 */
> + if (valid_bit >= 32) { /* BITS_PER_U32 */
> + qcom_smem_state_put(valid_state);
> return -EINVAL;
> + }
>
> enabled_state = qcom_smem_state_get(dev, "ipa-clock-enabled",
> &enabled_bit);
> - if (IS_ERR(enabled_state))
> + if (IS_ERR(enabled_state)) {
> + qcom_smem_state_put(valid_state);
> return PTR_ERR(enabled_state);
> + }
> if (enabled_bit >= 32) { /* BITS_PER_U32 */
> qcom_smem_state_put(enabled_state);
> + qcom_smem_state_put(valid_state);
> return -EINVAL;
> }
>
> smp2p = kzalloc_obj(*smp2p);
> if (!smp2p) {
> qcom_smem_state_put(enabled_state);
> + qcom_smem_state_put(valid_state);
> return -ENOMEM;
> }
>
> @@ -293,6 +299,7 @@ ipa_smp2p_init(struct ipa *ipa, struct platform_device *pdev, bool modem_init)
> ipa->smp2p = NULL;
> mutex_destroy(&smp2p->mutex);
> qcom_smem_state_put(enabled_state);
> + qcom_smem_state_put(valid_state);
> kfree(smp2p);
>
> return ret;
prev parent reply other threads:[~2026-09-17 12:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 11:54 Wentao Liang
2026-09-17 12:14 ` Greg KH
2026-09-17 12:18 ` Alex Elder [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ced2ea64-6415-425b-aa8f-68df68253bc2@ieee.org \
--to=elder@ieee.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=elder@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=vulab@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®