Set WoWLAN triggers only if driver capabilities are known
Previously, wpas_set_wowlan_triggers() could have been called in uninitialized wpa_driver_capa data if the driver interface did not support reporting of capabilities. While this would not really happen with a driver wrapper that implements set_wowlan() and as such, would not cause any difference in practice, it is better to clean this up to make the code path easier to understand for static analyzers. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
e635efb407
commit
6cbdb0c537
1 changed files with 5 additions and 3 deletions
|
@ -3267,7 +3267,7 @@ static int wpas_check_wowlan_trigger(const char *start, const char *trigger,
|
||||||
|
|
||||||
|
|
||||||
static int wpas_set_wowlan_triggers(struct wpa_supplicant *wpa_s,
|
static int wpas_set_wowlan_triggers(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_driver_capa *capa)
|
const struct wpa_driver_capa *capa)
|
||||||
{
|
{
|
||||||
struct wowlan_triggers triggers;
|
struct wowlan_triggers triggers;
|
||||||
char *start, *end, *buf;
|
char *start, *end, *buf;
|
||||||
|
@ -3632,6 +3632,7 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_interface *iface)
|
struct wpa_interface *iface)
|
||||||
{
|
{
|
||||||
struct wpa_driver_capa capa;
|
struct wpa_driver_capa capa;
|
||||||
|
int capa_res;
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "Initializing interface '%s' conf '%s' driver "
|
wpa_printf(MSG_DEBUG, "Initializing interface '%s' conf '%s' driver "
|
||||||
"'%s' ctrl_interface '%s' bridge '%s'", iface->ifname,
|
"'%s' ctrl_interface '%s' bridge '%s'", iface->ifname,
|
||||||
|
@ -3761,7 +3762,8 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
|
||||||
&wpa_s->hw.num_modes,
|
&wpa_s->hw.num_modes,
|
||||||
&wpa_s->hw.flags);
|
&wpa_s->hw.flags);
|
||||||
|
|
||||||
if (wpa_drv_get_capa(wpa_s, &capa) == 0) {
|
capa_res = wpa_drv_get_capa(wpa_s, &capa);
|
||||||
|
if (capa_res == 0) {
|
||||||
wpa_s->drv_capa_known = 1;
|
wpa_s->drv_capa_known = 1;
|
||||||
wpa_s->drv_flags = capa.flags;
|
wpa_s->drv_flags = capa.flags;
|
||||||
wpa_s->drv_enc = capa.enc;
|
wpa_s->drv_enc = capa.enc;
|
||||||
|
@ -3851,7 +3853,7 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
|
||||||
* Note: We don't restore/remove the triggers on shutdown (it doesn't
|
* Note: We don't restore/remove the triggers on shutdown (it doesn't
|
||||||
* have effect anyway when the interface is down).
|
* have effect anyway when the interface is down).
|
||||||
*/
|
*/
|
||||||
if (wpas_set_wowlan_triggers(wpa_s, &capa) < 0)
|
if (capa_res == 0 && wpas_set_wowlan_triggers(wpa_s, &capa) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
#ifdef CONFIG_EAP_PROXY
|
#ifdef CONFIG_EAP_PROXY
|
||||||
|
|
Loading…
Reference in a new issue