* [PATCH] wifi: ath12k: fix read pointer after free in ath12k_mac_assign_vif_to_vdev()
@ 2024-12-10 5:26 Aditya Kumar Singh
2024-12-10 6:04 ` Jeff Johnson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Aditya Kumar Singh @ 2024-12-10 5:26 UTC (permalink / raw)
To: Kalle Valo, Jeff Johnson, Rameshkumar Sundaram, Sriram R
Cc: Kalle Valo, Jeff Johnson, linux-wireless, ath12k, linux-kernel,
Aditya Kumar Singh
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>
---
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 c4eab4c1c10e0a05248fb58858dac9a00ef2e799..47a80d28d1d7f83ae7f61ecb89c6cd7d1d779494 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -8064,9 +8064,6 @@ static struct ath12k *ath12k_mac_assign_vif_to_vdev(struct ieee80211_hw *hw,
ab = ar->ab;
- if (arvif->is_created)
- goto flush;
-
/* Assign arvif again here since previous radio switch block
* would've unassigned and cleared it.
*/
@@ -8077,6 +8074,9 @@ static struct ath12k *ath12k_mac_assign_vif_to_vdev(struct ieee80211_hw *hw,
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);
---
base-commit: 27909c77d085d32db141cbb32b2cc9fbef874197
change-id: 20241210-read_after_free-4e22cbdc1ed8
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] wifi: ath12k: fix read pointer after free in ath12k_mac_assign_vif_to_vdev()
2024-12-10 5:26 [PATCH] wifi: ath12k: fix read pointer after free in ath12k_mac_assign_vif_to_vdev() Aditya Kumar Singh
@ 2024-12-10 6:04 ` Jeff Johnson
2024-12-12 11:26 ` Kalle Valo
2024-12-12 18:29 ` Jeff Johnson
2 siblings, 0 replies; 4+ messages in thread
From: Jeff Johnson @ 2024-12-10 6:04 UTC (permalink / raw)
To: Aditya Kumar Singh, Kalle Valo, Jeff Johnson,
Rameshkumar Sundaram, Sriram R
Cc: Kalle Valo, linux-wireless, ath12k, linux-kernel
On 12/9/2024 9:26 PM, Aditya Kumar Singh wrote:
> 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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] wifi: ath12k: fix read pointer after free in ath12k_mac_assign_vif_to_vdev()
2024-12-10 5:26 [PATCH] wifi: ath12k: fix read pointer after free in ath12k_mac_assign_vif_to_vdev() Aditya Kumar Singh
2024-12-10 6:04 ` Jeff Johnson
@ 2024-12-12 11:26 ` Kalle Valo
2024-12-12 18:29 ` Jeff Johnson
2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2024-12-12 11:26 UTC (permalink / raw)
To: Aditya Kumar Singh
Cc: Jeff Johnson, Rameshkumar Sundaram, Sriram R, Kalle Valo,
Jeff Johnson, linux-wireless, ath12k, linux-kernel
Aditya Kumar Singh <quic_adisi@quicinc.com> writes:
> 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: Kalle Valo <kvalo@kernel.org>
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] wifi: ath12k: fix read pointer after free in ath12k_mac_assign_vif_to_vdev()
2024-12-10 5:26 [PATCH] wifi: ath12k: fix read pointer after free in ath12k_mac_assign_vif_to_vdev() Aditya Kumar Singh
2024-12-10 6:04 ` Jeff Johnson
2024-12-12 11:26 ` Kalle Valo
@ 2024-12-12 18:29 ` Jeff Johnson
2 siblings, 0 replies; 4+ messages in thread
From: Jeff Johnson @ 2024-12-12 18:29 UTC (permalink / raw)
To: Kalle Valo, Jeff Johnson, Rameshkumar Sundaram, Sriram R,
Aditya Kumar Singh
Cc: Kalle Valo, Jeff Johnson, linux-wireless, ath12k, linux-kernel
On Tue, 10 Dec 2024 10:56:33 +0530, Aditya Kumar Singh wrote:
> 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().
>
> [...]
Applied, thanks!
[1/1] wifi: ath12k: fix read pointer after free in ath12k_mac_assign_vif_to_vdev()
commit: 5a10971c7645a95f5d5dc23c26fbac4bf61801d0
Best regards,
--
Jeff Johnson <jeff.johnson@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-12 18:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-10 5:26 [PATCH] wifi: ath12k: fix read pointer after free in ath12k_mac_assign_vif_to_vdev() Aditya Kumar Singh
2024-12-10 6:04 ` Jeff Johnson
2024-12-12 11:26 ` Kalle Valo
2024-12-12 18:29 ` Jeff Johnson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox