From: Seevalamuthu Mariappan Date: Fri, 13 Dec 2019 10:16:41 +0000 (+0530) Subject: DFS: Do not process radar event while disabling an interface X-Git-Tag: hostap_2_10~1699 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7242087d1c04c6647f22facd6958af7a63f617e2;p=thirdparty%2Fhostap.git DFS: Do not process radar event while disabling an interface In the normal case hostapd_disable_iface() and hostapd_enable_iface() will be done while switching to another DFS channel upon radar detection. In certain scenarios radar detected event can come while hostapd_disable_iface() is in progress and iface->current_mode will be NULL in that scenario. Previously, we did not check for this scenario and proceeded with the radar detection logic which can trigger a segmentation fault. To fix this, avoid proceeding the radar detection event if iface->current_mode is NULL. Signed-off-by: Seevalamuthu Mariappan --- diff --git a/src/ap/dfs.c b/src/ap/dfs.c index f70ecc946..554231e18 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -1040,8 +1040,10 @@ int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq, return 0; /* mark radar frequency as invalid */ - set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width, - cf1, cf2, HOSTAPD_CHAN_DFS_UNAVAILABLE); + res = set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width, + cf1, cf2, HOSTAPD_CHAN_DFS_UNAVAILABLE); + if (!res) + return 0; /* Skip if reported radar event not overlapped our channels */ res = dfs_are_channels_overlapped(iface, freq, chan_width, cf1, cf2);