mesh: Leave mesh in driver setup if initialization fails
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 6 Mar 2015 18:58:56 +0000 (20:58 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 6 Mar 2015 18:58:56 +0000 (20:58 +0200)
It was possible to leave the driver in mesh point state if upper layer
mesh initialization failed in wpa_supplicant_mesh_init(). With nl80211,
this results in the vif being left in mesh point mode instead of
restoring it to station mode. That seems to break normal functionality,
e.g., for Public Action frame TX/RX. Fix this by restoring station mode
on mesh failure path.

This error could be triggered, e.g., with the following hwsim test case
sequence: wpas_mesh_secure_sae_missing_password
nfc_p2p_static_handover_tagdev_go_forced_freq

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

index cf3676c..33b4af3 100644 (file)
@@ -344,6 +344,7 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
 
        if (wpa_supplicant_mesh_init(wpa_s, ssid)) {
                wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh");
+               wpa_drv_leave_mesh(wpa_s);
                ret = -1;
                goto out;
        }