wlan-ap-Telecominfraproject/feeds/ipq95xx/mac80211/patches/qca/802-ath12k-validate-peer-id-for-search.patch
John Crispin 144c5d00f4 ipq95xx/mac80211: update to ATH12.3-CS
Signed-off-by: John Crispin <john@phrozen.org>
2024-02-28 18:56:21 +01:00

56 lines
1.9 KiB
Diff

From 3c9af747ef156b4c9265a3b59d2e48d668423b8f Mon Sep 17 00:00:00 2001
From: Sriram R <quic_srirrama@quicinc.com>
Date: Wed, 12 Jul 2023 09:37:29 +0530
Subject: [PATCH] ath12k: validate peer id before searching for peer
HW may pass invalid peer id(=16383) in error scenarios.
Avoid searching the peer list for this peer id, rather
return NULL.
Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
---
drivers/net/wireless/ath/ath12k/dp.h | 2 ++
drivers/net/wireless/ath/ath12k/peer.c | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/drivers/net/wireless/ath/ath12k/dp.h b/drivers/net/wireless/ath/ath12k/dp.h
index 8e3654d..39d7c53 100644
--- a/drivers/net/wireless/ath/ath12k/dp.h
+++ b/drivers/net/wireless/ath/ath12k/dp.h
@@ -2309,6 +2309,8 @@ static inline void ath12k_dp_get_mac_addr(u32 addr_l32, u16 addr_h16, u8 *addr)
#define ATH12K_ML_PEER_ID GENMASK(13, 0)
#define ATH12K_ML_PEER_ID_VALID BIT(13)
+#define ATH12K_PEER_ID_INVALID 0x3FFF
+
#define ATH12K_HTT_MLO_PEER_MAP_TLV_LINK_INFO_TAG 0
#define ATH12K_HTT_MAX_MLO_LINKS 3
#define ATH12K_HTT_MLO_CHIP_ID GENMASK(2, 0)
diff --git a/drivers/net/wireless/ath/ath12k/peer.c b/drivers/net/wireless/ath/ath12k/peer.c
index 419921a..a9f41da 100644
--- a/drivers/net/wireless/ath/ath12k/peer.c
+++ b/drivers/net/wireless/ath/ath12k/peer.c
@@ -79,6 +79,9 @@ struct ath12k_peer *ath12k_peer_find_list_by_id(struct ath12k_base *ab,
lockdep_assert_held(&ab->base_lock);
+ if (peer_id == ATH12K_PEER_ID_INVALID)
+ return NULL;
+
if (peer_id & ATH12K_ML_PEER_ID_VALID) {
return ath12k_peer_find_by_ml_id(ab, peer_id);
} else {
@@ -96,6 +99,9 @@ struct ath12k_peer *ath12k_peer_find_by_id(struct ath12k_base *ab,
{
lockdep_assert_held(&ab->base_lock);
+ if (peer_id == ATH12K_PEER_ID_INVALID)
+ return NULL;
+
if (peer_id & ATH12K_ML_PEER_ID_VALID) {
return ath12k_peer_find_by_ml_id(ab, peer_id);
} else {
--
2.17.1