From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AB841E9919; Thu, 20 Aug 2026 16:45:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787244332; cv=none; b=cMxxnMCoYIbVvFQo3JtvQlK8tEQRPl/MGehPji75As75e+IZvFd5uhZiczaUmOqFnaKANkxx447N2jcpbb2olEZtJ7BdJvL3uddGoQafG/j1llD3Wy1g/8i9AIlC3I83nXyMi2In8kCXl6SVMi3V+oO6v8Uf4sT73wJRhxtIWUw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787244332; c=relaxed/simple; bh=dUpQqPeU9geQZKNwL9/+gYdipfCwGxuA1zcLSNQzjN4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CSXbazV/x7XoQCBDCIw3q20bcItfiAhrUX29Cjrf+R7U1z4OCmvwtTBm0ELDm8yMSaj/ATp/deUiGLuyPjgc/tGeyZAJX6hZSNayOOVo0Bbu4UkYqQ9K/bS4SA0nJflUP5OKBYK0bdOlX9Fdiy/fu68MpsaOEZC5tFJPaFPIHAs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eIkLTOFO; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eIkLTOFO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01D771F000E9; Thu, 20 Aug 2026 16:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787244331; bh=H95lRthlJu1mjBaqWcRfvAz5nFRKi31okTi8PM9bBUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eIkLTOFOEvh6a7BQoRTUhXXsPlqHNryYFVduJ28svQrm2umhtaJKdhzN5mRYqiYc4 b7V1TTgXVEMcUkBINcblA+dfYqCa/z2Bb22PuPDL+uNnFiCfGPWUUyGJv7TfY7yMyX FcmZc3fStatPStQDRx32CY2v9StiWt/A9c0kgC9o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Haoxiang Li , Larysa Zaremba , Alex Elder , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 131/235] net: ipa: fix SMEM state handle leaks in SMP2P init Date: Thu, 20 Aug 2026 16:56:07 +0200 Message-ID: <20260820145220.420945735@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260820145216.426568665@linuxfoundation.org> References: <20260820145216.426568665@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Haoxiang Li [ Upstream commit 96ca1e658ae459276292bd6d971ab5d8c7e0379a ] 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. Release both handles with qcom_smem_state_put() in the init error paths and in ipa_smp2p_exit(). Fixes: 530f9216a953 ("soc: qcom: ipa: AP/modem communications") Cc: stable@vger.kernel.org Signed-off-by: Haoxiang Li Reviewed-by: Larysa Zaremba Reviewed-by: Alex Elder Link: https://patch.msgid.link/20260624065955.2822765-1-haoxiang_li2024@163.com Signed-off-by: Jakub Kicinski [ kzalloc_obj() context line kept as kzalloc(sizeof(*smp2p), GFP_KERNEL) since ipa_smp2p.c was not yet converted in this tree ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ipa/ipa_smp2p.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) --- a/drivers/net/ipa/ipa_smp2p.c +++ b/drivers/net/ipa/ipa_smp2p.c @@ -222,19 +222,27 @@ int ipa_smp2p_init(struct ipa *ipa, bool &valid_bit); if (IS_ERR(valid_state)) return PTR_ERR(valid_state); - if (valid_bit >= 32) /* BITS_PER_U32 */ - return -EINVAL; + if (valid_bit >= 32) { /* BITS_PER_U32 */ + ret = -EINVAL; + goto err_valid_state_put; + } enabled_state = 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 */ - return -EINVAL; + if (IS_ERR(enabled_state)) { + ret = PTR_ERR(enabled_state); + goto err_valid_state_put; + } + if (enabled_bit >= 32) { /* BITS_PER_U32 */ + ret = -EINVAL; + goto err_enabled_state_put; + } smp2p = kzalloc(sizeof(*smp2p), GFP_KERNEL); - if (!smp2p) - return -ENOMEM; + if (!smp2p) { + ret = -ENOMEM; + goto err_enabled_state_put; + } smp2p->ipa = ipa; @@ -279,6 +287,10 @@ err_null_smp2p: ipa->smp2p = NULL; mutex_destroy(&smp2p->mutex); kfree(smp2p); +err_enabled_state_put: + qcom_smem_state_put(enabled_state); +err_valid_state_put: + qcom_smem_state_put(valid_state); return ret; } @@ -295,6 +307,8 @@ void ipa_smp2p_exit(struct ipa *ipa) ipa_smp2p_clock_release(ipa); ipa->smp2p = NULL; mutex_destroy(&smp2p->mutex); + qcom_smem_state_put(smp2p->enabled_state); + qcom_smem_state_put(smp2p->valid_state); kfree(smp2p); }