]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Fix WPA, IEEE 802.1X, and WPS deinit in cases where init fails
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 13 Oct 2015 20:35:00 +0000 (23:35 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 14 Oct 2015 15:42:07 +0000 (18:42 +0300)
With driver wrappers that implement set_privacy(), set_generic_elem(),
set_ieee8021x(), or set_ap_wps_ie(), it was possible to hit a NULL
pointer dereference in error cases where interface setup failed and
the network configuration used WPA/WPA2, IEEE 802.1X, or WPS.

Fix this by skipping the driver operations in case the driver interface
is not initialized.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/ap/ieee802_1x.c
src/ap/wpa_auth_glue.c
src/ap/wps_hostapd.c

index 0f2d428cf752aa7c826570c06bac82a0aa1677ce..c1844932268d231f091cb19cb9742b4d5b2a6d3c 100644 (file)
@@ -2190,7 +2190,7 @@ void ieee802_1x_deinit(struct hostapd_data *hapd)
 {
        eloop_cancel_timeout(ieee802_1x_rekey, hapd, NULL);
 
-       if (hapd->driver != NULL &&
+       if (hapd->driver && hapd->drv_priv &&
            (hapd->conf->ieee802_1x || hapd->conf->wpa))
                hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
 
index f98cc50599e3764c1c1aef578cb457dab14f1d96..ffd0790fe94985f263a9efce6cba9893981a8890 100644 (file)
@@ -674,13 +674,14 @@ void hostapd_deinit_wpa(struct hostapd_data *hapd)
                wpa_deinit(hapd->wpa_auth);
                hapd->wpa_auth = NULL;
 
-               if (hostapd_set_privacy(hapd, 0)) {
+               if (hapd->drv_priv && hostapd_set_privacy(hapd, 0)) {
                        wpa_printf(MSG_DEBUG, "Could not disable "
                                   "PrivacyInvoked for interface %s",
                                   hapd->conf->iface);
                }
 
-               if (hostapd_set_generic_elem(hapd, (u8 *) "", 0)) {
+               if (hapd->drv_priv &&
+                   hostapd_set_generic_elem(hapd, (u8 *) "", 0)) {
                        wpa_printf(MSG_DEBUG, "Could not remove generic "
                                   "information element from interface %s",
                                   hapd->conf->iface);
index cde31e60e03b70d574b7b989d8b8b1eacf1f1be1..66a43eb816b946ae330d5e41b2b91423ca0d3409 100644 (file)
@@ -872,7 +872,8 @@ static void hostapd_wps_clear_ies(struct hostapd_data *hapd, int deinit_only)
        hapd->wps_probe_resp_ie = NULL;
 
        if (deinit_only) {
-               hostapd_reset_ap_wps_ie(hapd);
+               if (hapd->drv_priv)
+                       hostapd_reset_ap_wps_ie(hapd);
                return;
        }