From afbe57d981042f5abcd7c21016c6979016bbc81f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 17 Nov 2014 01:14:35 +0200 Subject: [PATCH] DFS: Fix hostapd operation without hw_mode driver data If DFS implementation was built in, some configurations with drivers that do not provide mode information could end up dereferencing a NULL pointer. Fix this by skipping DFS operations in such cases since not having information about modes and channels means that hostapd could not perform DFS anyway (i.e., either this is not a wireless driver or the driver takes care of DFS internally). Signed-off-by: Jouni Malinen --- src/ap/dfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 6fc891c7a..0db5ef691 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -640,6 +640,16 @@ int hostapd_handle_dfs(struct hostapd_iface *iface) int res, n_chans, n_chans1, start_chan_idx, start_chan_idx1; int skip_radar = 0; + if (!iface->current_mode) { + /* + * This can happen with drivers that do not provide mode + * information and as such, cannot really use hostapd for DFS. + */ + wpa_printf(MSG_DEBUG, + "DFS: No current_mode information - assume no need to perform DFS operations by hostapd"); + return 1; + } + iface->cac_started = 0; do {