Return error from wpa_drv_get_pref_freq_list() if no driver support
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 30 Jul 2015 19:10:46 +0000 (22:10 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 30 Jul 2015 19:13:47 +0000 (22:13 +0300)
Commit 983422088f0066068fd364013623d1e475031e6b ('nl80211: Add means to
query preferred channels') return success if no driver wrapper callback
was provided for fetching the preferred channel list. That is
problematic since the *num argument is not updated and uninitialized
freq_list could end up getting used with arbitrary frequency values. Fix
this by returning error in case the values were not available due to
driver wrapper not implementing the function. This matches the style
used in the driver_nl80211.c implementation for the case where the
driver does not support such fetch operation.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/driver_i.h

index 909515b..73768c7 100644 (file)
@@ -899,7 +899,7 @@ static inline int wpa_drv_get_pref_freq_list(struct wpa_supplicant *wpa_s,
                                             unsigned int *freq_list)
 {
        if (!wpa_s->driver->get_pref_freq_list)
-               return 0;
+               return -1;
        return wpa_s->driver->get_pref_freq_list(wpa_s->drv_priv, if_type,
                                                 num, freq_list);
 }