From: Jouni Malinen Date: Thu, 7 Jan 2016 14:39:10 +0000 (+0200) Subject: ACS: Be more consistent with iface->current_mode checks X-Git-Tag: hostap_2_6~1018 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a95cc47a929cb84bfc47497118f1f032043c1502;p=thirdparty%2Fhostap.git ACS: Be more consistent with iface->current_mode checks Offloading of ACS to the driver changed the design a bit in a way that iface->current_mode could actually be NULL when the offloaded ACS mechanism supports band selection in addition to channel selection. This resulted in a combination that is too complex for static analyzers to notice. While acs_init() can be called with iface->current_mode == NULL that is only in the case where WPA_DRIVER_FLAGS_ACS_OFFLOAD is in use. In other words, the actual ACS functions like acs_cleanup() that would dereference iface->current_mode are not used in such a case. Get rid of static analyzer warnings by explicitly checking iface->current_mode in acs_init() for the case where ACS offloading is not used. Signed-off-by: Jouni Malinen --- diff --git a/src/ap/acs.c b/src/ap/acs.c index 03d797fe8..0795af00b 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -933,6 +933,9 @@ enum hostapd_chan_status acs_init(struct hostapd_iface *iface) return HOSTAPD_CHAN_ACS; } + if (!iface->current_mode) + return HOSTAPD_CHAN_INVALID; + acs_cleanup(iface); err = acs_request_scan(iface);