diff mbox series

wifi: ath12k: fix firmware crash due to invalid peer nss

Message ID 20240613053528.2541645-1-quic_ajithc@quicinc.com
State New
Headers show
Series wifi: ath12k: fix firmware crash due to invalid peer nss | expand

Commit Message

Ajith C June 13, 2024, 5:35 a.m. UTC
Currently, if the access point receives an association
request containing an Extended HE Capabilities Information
Element with an invalid MCS-NSS, it triggers a firmware
crash.

This issue arises when EHT-PHY capabilities shows support
for a bandwidth and MCS-NSS set for that particular
bandwidth is filled by zeros and due to this, driver obtains
peer_nss as 0 and sending this value to firmware causes
crash.

Address this issue by implementing a validation step for
the peer_nss value before passing it to the firmware. If
the value is greater than zero, proceed with forwarding
it to the firmware. However, if the value is invalid,
reject the association request to prevent potential
firmware crashes.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Ajith C <quic_ajithc@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/mac.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jeff Johnson June 13, 2024, 10:12 p.m. UTC | #1
On 6/12/2024 10:35 PM, Ajith C wrote:
> Currently, if the access point receives an association
> request containing an Extended HE Capabilities Information
> Element with an invalid MCS-NSS, it triggers a firmware
> crash.
> 
> This issue arises when EHT-PHY capabilities shows support
> for a bandwidth and MCS-NSS set for that particular
> bandwidth is filled by zeros and due to this, driver obtains
> peer_nss as 0 and sending this value to firmware causes
> crash.
> 
> Address this issue by implementing a validation step for
> the peer_nss value before passing it to the firmware. If
> the value is greater than zero, proceed with forwarding
> it to the firmware. However, if the value is invalid,
> reject the association request to prevent potential
> firmware crashes.
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Ajith C <quic_ajithc@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Kalle Valo June 19, 2024, 2:19 p.m. UTC | #2
Ajith C <quic_ajithc@quicinc.com> wrote:

> Currently, if the access point receives an association
> request containing an Extended HE Capabilities Information
> Element with an invalid MCS-NSS, it triggers a firmware
> crash.
> 
> This issue arises when EHT-PHY capabilities shows support
> for a bandwidth and MCS-NSS set for that particular
> bandwidth is filled by zeros and due to this, driver obtains
> peer_nss as 0 and sending this value to firmware causes
> crash.
> 
> Address this issue by implementing a validation step for
> the peer_nss value before passing it to the firmware. If
> the value is greater than zero, proceed with forwarding
> it to the firmware. However, if the value is invalid,
> reject the association request to prevent potential
> firmware crashes.
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Ajith C <quic_ajithc@quicinc.com>
> Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

db163a463bb9 wifi: ath12k: fix firmware crash due to invalid peer nss
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 784964ae03ec..198aa5a88a6e 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -4087,6 +4087,11 @@  static int ath12k_station_assoc(struct ath12k *ar,
 
 	ath12k_peer_assoc_prepare(ar, vif, sta, &peer_arg, reassoc);
 
+	if (peer_arg.peer_nss < 1) {
+		ath12k_warn(ar->ab,
+			    "invalid peer NSS %d\n", peer_arg.peer_nss);
+		return -EINVAL;
+	}
 	ret = ath12k_wmi_send_peer_assoc_cmd(ar, &peer_arg);
 	if (ret) {
 		ath12k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n",