From d6d731b848d8d44b5a1db2e6d6b56625f2b83859 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 30 Nov 2011 14:44:23 +0200 Subject: [PATCH] WPS ER: Fix segfault in some selected registrar change cases Commit 628d54639a90f779fd5c98c31e049638de56b17e introduced number of new WPS related ctrl_iface messages to hostapd. Some of these were for ER events which do not make any sense to hostapd that cannot operate as an ER. The WPS_EV_ER_SET_SELECTED_REGISTRAR one from wps_registrar_sel_registrar_changed_event() was especially problematic since it can cause wpa_supplicant ER code segfault due to missing event data. Revert all the ER specific changes from commit 628d54639a90f779fd5c98c31e049638de56b17e to get rid of the segfault and undesired extra code in hostapd. Signed-hostap: Jouni Malinen --- src/ap/wps_hostapd.c | 6 ------ src/wps/wps_common.c | 9 --------- src/wps/wps_i.h | 1 - src/wps/wps_registrar.c | 1 - 4 files changed, 17 deletions(-) diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c index 671bc6747..28e037dc1 100644 --- a/src/ap/wps_hostapd.c +++ b/src/ap/wps_hostapd.c @@ -599,22 +599,16 @@ static void hostapd_wps_event_cb(void *ctx, enum wps_event event, wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_TIMEOUT); break; case WPS_EV_ER_AP_ADD: - wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_ER_AP_ADD); break; case WPS_EV_ER_AP_REMOVE: - wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_ER_AP_REMOVE); break; case WPS_EV_ER_ENROLLEE_ADD: - wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_ER_ENROLLEE_ADD); break; case WPS_EV_ER_ENROLLEE_REMOVE: - wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_ER_ENROLLEE_REMOVE); break; case WPS_EV_ER_AP_SETTINGS: - wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_ER_AP_SETTINGS); break; case WPS_EV_ER_SET_SELECTED_REGISTRAR: - wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_ER_SET_SEL_REG); break; } if (hapd->wps_event_cb) diff --git a/src/wps/wps_common.c b/src/wps/wps_common.c index a8942e93a..505837b17 100644 --- a/src/wps/wps_common.c +++ b/src/wps/wps_common.c @@ -312,15 +312,6 @@ void wps_pbc_timeout_event(struct wps_context *wps) } -void wps_registrar_sel_registrar_changed_event(struct wps_context *wps) -{ - if (wps->event_cb == NULL) - return; - - wps->event_cb(wps->cb_ctx, WPS_EV_ER_SET_SELECTED_REGISTRAR, NULL); -} - - #ifdef CONFIG_WPS_OOB static struct wpabuf * wps_get_oob_cred(struct wps_context *wps) diff --git a/src/wps/wps_i.h b/src/wps/wps_i.h index a147da12e..bdb6da2bf 100644 --- a/src/wps/wps_i.h +++ b/src/wps/wps_i.h @@ -228,7 +228,6 @@ void wps_success_event(struct wps_context *wps); void wps_pwd_auth_fail_event(struct wps_context *wps, int enrollee, int part); void wps_pbc_overlap_event(struct wps_context *wps); void wps_pbc_timeout_event(struct wps_context *wps); -void wps_registrar_sel_registrar_changed_event(struct wps_context *wps); extern struct oob_device_data oob_ufd_device_data; extern struct oob_device_data oob_nfc_device_data; diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c index 4a4919790..66ed41086 100644 --- a/src/wps/wps_registrar.c +++ b/src/wps/wps_registrar.c @@ -3137,7 +3137,6 @@ static void wps_registrar_set_selected_timeout(void *eloop_ctx, "unselect internal Registrar"); reg->selected_registrar = 0; reg->pbc = 0; - wps_registrar_sel_registrar_changed_event(reg->wps); wps_registrar_selected_registrar_changed(reg); }