immortalwrt-VIKINGYFY/package/kernel/mac80211/patches/nss/subsys/999-918-mac80211-fix-NULL-pointer-access-Klocwork-issue.patch
2025-12-09 20:09:13 +08: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
@@ -1430,7 +1430,8 @@ int ieee80211_do_open(struct wireless_de
ieee80211_link_vlan_copy_chanctx(link);
}
- 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);
@@ -1441,7 +1442,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:
@@ -1472,7 +1474,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);
list_add_tail_rcu(&sdata->u.mntr.list, &local->mon_list);
break;
default:
@@ -1517,7 +1520,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: