openwrt-ipq-breeze303/package/kernel/mac80211/patches/nss/subsys/999-918-mac80211-fix-NULL-pointer-access-Klocwork-issue.patch
Sean Khan 5027f4220f ath11k_nss: mac80211: fix NULL pointer access, Klocwork issue
Currently we are dereferencing dev pointer without a NULL
check.

Fix this issue by adding a NULL check.

Patch-dependency: none
Patch-work: none
Fixes: 4b7afb52c8e2 (mac80211: reorganize code to remove a forward declaration)
Note: ath.git commit id is mentioned in the Fixes tag

Signed-off-by: Monika Korada <quic_koramoni@quicinc.com>

Signed-off-by: Sean Khan <datapronix@protonmail.com>
2024-10-12 00:13:32 -04:00

63 lines
1.8 KiB
Diff

From f5a907934f596f77b4c59e549eff5d56b1a4e226 Mon Sep 17 00:00:00 2001
From: Monika Korada <quic_koramoni@quicinc.com>
Date: Mon, 27 May 2024 11:32:49 +0530
Subject: [PATCH] KW: wifi: mac80211: fix NULL pointer access, Klocwork issue
Currently we are dereferencing dev pointer without a NULL
check.
Fix this issue by adding a NULL check.
Patch-dependency: none
Patch-work: none
Fixes: 4b7afb52c8e2 (mac80211: reorganize code to remove a forward declaration)
Note: ath.git commit id is mentioned in the Fixes tag
Signed-off-by: Monika Korada <quic_koramoni@quicinc.com>
---
net/mac80211/iface.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1348,7 +1348,8 @@ int ieee80211_do_open(struct wireless_de
case NL80211_IFTYPE_AP_VLAN:
if (sdata->bss->active) {
ieee80211_link_vlan_copy_chanctx(&sdata->deflink);
- netif_carrier_on(dev);
+ if (dev)
+ netif_carrier_on(dev);
if (ieee80211_hw_check(&local->hw, SUPPORTS_NSS_OFFLOAD)) {
ieee80211_set_sdata_offload_flags(sdata);
@@ -1359,7 +1360,8 @@ int ieee80211_do_open(struct wireless_de
ieee80211_set_vif_encap_ops(sdata);
} else {
- netif_carrier_off(dev);
+ if (dev)
+ netif_carrier_off(dev);
}
break;
case NL80211_IFTYPE_MONITOR:
@@ -1390,7 +1392,8 @@ int ieee80211_do_open(struct wireless_de
ieee80211_recalc_offload(local);
ieee80211_recalc_idle(local);
- netif_carrier_on(dev);
+ if (dev)
+ netif_carrier_on(dev);
break;
default:
if (coming_up) {
@@ -1434,7 +1437,8 @@ int ieee80211_do_open(struct wireless_de
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_MESH_POINT:
case NL80211_IFTYPE_OCB:
- netif_carrier_off(dev);
+ if (dev)
+ netif_carrier_off(dev);
break;
case NL80211_IFTYPE_P2P_DEVICE:
case NL80211_IFTYPE_NAN: