From: Amelia Crate <acrate@waldn.net>
To: gregkh@linuxfoundation.org
Cc: dimitri.ledkov@surgut.co.uk, stable@vger.kernel.org,
Aditya Kumar Singh <quic_adisi@quicinc.com>,
Jeff Johnson <jeff.johnson@oss.qualcomm.com>,
Kalle Valo <kvalo@kernel.org>, Amelia Crate <acrate@waldn.net>
Subject: [PATCH v2 3/4] wifi: ath12k: fix read pointer after free in ath12k_mac_assign_vif_to_vdev()
Date: Thu, 30 Oct 2025 11:08:33 -0500 [thread overview]
Message-ID: <20251030160942.19490-4-acrate@waldn.net> (raw)
In-Reply-To: <20251030160942.19490-1-acrate@waldn.net>
From: Aditya Kumar Singh <quic_adisi@quicinc.com>
[ Upstream commit 5a10971c7645a95f5d5dc23c26fbac4bf61801d0 ]
In ath12k_mac_assign_vif_to_vdev(), if arvif is created on a different
radio, it gets deleted from that radio through a call to
ath12k_mac_unassign_link_vif(). This action frees the arvif pointer.
Subsequently, there is a check involving arvif, which will result in a
read-after-free scenario.
Fix this by moving this check after arvif is again assigned via call to
ath12k_mac_assign_link_vif().
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Closes: https://scan5.scan.coverity.com/#/project-view/63541/10063?selectedIssue=1636423
Fixes: b5068bc9180d ("wifi: ath12k: Cache vdev configs before vdev create")
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Acked-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Acked-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241210-read_after_free-v1-1-969f69c7d66c@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Amelia Crate <acrate@waldn.net>
---
drivers/net/wireless/ath/ath12k/mac.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 4b3fbec397ac..c15eecf2a188 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -6733,15 +6733,15 @@ static struct ath12k *ath12k_mac_assign_vif_to_vdev(struct ieee80211_hw *hw,
mutex_lock(&ar->conf_mutex);
- if (arvif->is_created)
- goto flush;
-
if (vif->type == NL80211_IFTYPE_AP &&
ar->num_peers > (ar->max_num_peers - 1)) {
ath12k_warn(ab, "failed to create vdev due to insufficient peer entry resource in firmware\n");
goto unlock;
}
+ if (arvif->is_created)
+ goto flush;
+
if (ar->num_created_vdevs > (TARGET_NUM_VDEVS - 1)) {
ath12k_warn(ab, "failed to create vdev, reached max vdev limit %d\n",
TARGET_NUM_VDEVS);
--
2.50.1
next prev parent reply other threads:[~2025-10-30 16:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 22:24 [PATCH 0/4] Backport CVE fixes to 6.12.y Amelia Crate
2025-10-29 22:25 ` [PATCH 1/4] iommu/vt-d: Avoid use of NULL after WARN_ON_ONCE Amelia Crate
2025-10-29 22:26 ` [PATCH 2/4] udmabuf: fix a buf size overflow issue during udmabuf creation Amelia Crate
2025-10-29 22:27 ` [PATCH 3/4] wifi: ath12k: fix read pointer after free in ath12k_mac_assign_vif_to_vdev() Amelia Crate
2025-10-29 22:27 ` [PATCH 4/4] sfc: fix NULL dereferences in ef100_process_design_param() Amelia Crate
2025-10-30 5:26 ` [PATCH 0/4] Backport CVE fixes to 6.12.y Greg KH
2025-10-30 16:08 ` [PATCH v2 " Amelia Crate
2025-10-30 16:08 ` [PATCH v2 1/4] iommu/vt-d: Avoid use of NULL after WARN_ON_ONCE Amelia Crate
2025-10-30 16:08 ` [PATCH v2 2/4] udmabuf: fix a buf size overflow issue during udmabuf creation Amelia Crate
2025-10-30 16:08 ` Amelia Crate [this message]
2025-10-30 16:08 ` [PATCH v2 4/4] sfc: fix NULL dereferences in ef100_process_design_param() Amelia Crate
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=20251030160942.19490-4-acrate@waldn.net \
--to=acrate@waldn.net \
--cc=dimitri.ledkov@surgut.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=kvalo@kernel.org \
--cc=quic_adisi@quicinc.com \
--cc=stable@vger.kernel.org \
/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