commit c7034aa41bd7d44ce8280aabe68769fe67cc4939
parent 95652a30d14f92eed81d941172884ccd0d266b6e
Author: James Prestwood <prestwoj@gmail.com>
Date: Thu, 23 Feb 2023 10:14:17 -0800
netdev: check iftype in channel switch event
Some drivers send this event when starting AP mode which means
the handshake object is NULL, causing a crash.
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
@@ -5170,8 +5170,12 @@ static void netdev_send_sa_query_delay(struct l_timeout *timeout,
static void netdev_channel_switch_event(struct l_genl_msg *msg,
struct netdev *netdev)
{
- _auto_(l_free) struct band_chandef *chandef =
- l_new(struct band_chandef, 1);
+ _auto_(l_free) struct band_chandef *chandef = NULL;
+
+ if (netdev->type != NL80211_IFTYPE_STATION)
+ return;
+
+ chandef = l_new(struct band_chandef, 1);
if (nl80211_parse_chandef(msg, chandef) < 0) {
l_debug("Couldn't parse operating channel info.");