[PATCH] IBSS: Clean up existing peer auth state machine on re-init

Ruth Mekonnen rmekonnen at chromium.org
Thu Nov 5 11:04:48 PST 2026


If ibss_rsn_auth_init() is called for a peer that already has an
allocated authenticator state machine, deinitialize the existing
peer->auth via wpa_auth_sta_deinit() before allocating a new one.

Signed-off-by: Ruth Mekonnen <rmekonnen at chromium.org>
---
 wpa_supplicant/ibss_rsn.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/wpa_supplicant/ibss_rsn.c b/wpa_supplicant/ibss_rsn.c
index 06228d0ef..dfbd48aeb 100644
--- a/wpa_supplicant/ibss_rsn.c
+++ b/wpa_supplicant/ibss_rsn.c
@@ -484,6 +484,11 @@ static int ibss_rsn_auth_init_group(struct ibss_rsn *ibss_rsn,
 static int ibss_rsn_auth_init(struct ibss_rsn *ibss_rsn,
 			      struct ibss_rsn_peer *peer)
 {
+	if (peer->auth) {
+		/* Deinitialize existing state machine before re-creating it */
+		wpa_auth_sta_deinit(peer->auth);
+		peer->auth = NULL;
+	}
 	peer->auth = wpa_auth_sta_init(ibss_rsn->auth_group, peer->addr, NULL);
 	if (peer->auth == NULL) {
 		wpa_printf(MSG_DEBUG, "AUTH: wpa_auth_sta_init() failed");
-- 
2.56.0.455.g6c5a503b38-goog




More information about the Hostap mailing list