[PATCH 1/3] netdev: check connected in channel switch event

James Prestwood
2025-08-15T15:26:12Z

In an ideal world userspace should never be getting a channel switch
event unless connected to an AP, but alas this has been seen at least
with ath10k hardware. This causes IWD to crash since the logic
assumes netdev->handshake is set.
---
src/netdev.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/netdev.c b/src/netdev.c
index 53a97cbd..ca8bfea0 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -5402,6 +5402,9 @@ static void netdev_channel_switch_event(struct l_genl_msg *msg,
if (netdev->type != NL80211_IFTYPE_STATION)
return;

+ if (L_WARN_ON(!netdev->connected))
+ return;
+
chandef = l_new(struct band_chandef, 1);

if (nl80211_parse_chandef(msg, chandef) < 0) {
--
2.34.1