[PATCH 1/1] Fix NAN USD state machine stall seen with listen failure.

Ajay Davanageri ajay.davanageri at synaptics.corp-partner.google.com
Sun Jul 13 21:39:24 PDT 2025


If driver returns -EBUSY for remain_on_channel operation, NAN USD state-machine gets stuck and no further listen is configured from supplicant.
This patch clears the states and re-triggers the nan_de_timer to restart the listen operation.

bug:298345110
test:benchtested.

Signed-off-by: Ajay Davanageri <ajay.davanageri at synaptics.corp-partner.google.com>
---
 wpa_supplicant/nan_usd.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/wpa_supplicant/nan_usd.c b/wpa_supplicant/nan_usd.c
index 946d62fb3..46df47291 100644
--- a/wpa_supplicant/nan_usd.c
+++ b/wpa_supplicant/nan_usd.c
@@ -9,6 +9,7 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
+#include "utils/eloop.h"
 #include "common/nan_de.h"
 #include "wpa_supplicant_i.h"
 #include "offchannel.h"
@@ -180,6 +181,13 @@ static void wpas_nan_usd_listen_work_done(struct wpa_supplicant *wpa_s)
 	wpa_s->nan_usd_listen_work = NULL;
 }
 
+static void wpas_nan_usd_remain_on_channel_timeout(void *eloop_ctx, void *timeout_ctx)
+{
+	struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)eloop_ctx;
+	struct wpas_nan_usd_listen_work *lwork = (struct wpas_nan_usd_listen_work *)timeout_ctx;
+
+	wpas_nan_usd_cancel_remain_on_channel_cb(wpa_s, lwork->freq);
+}
 
 static void wpas_nan_usd_start_listen_cb(struct wpa_radio_work *work,
 					 int deinit)
@@ -208,6 +216,9 @@ static void wpas_nan_usd_start_listen_cb(struct wpa_radio_work *work,
 		wpa_printf(MSG_DEBUG,
 			   "NAN: Failed to request the driver to remain on channel (%u MHz) for listen",
 			   lwork->freq);
+                eloop_cancel_timeout(wpas_nan_usd_remain_on_channel_timeout, wpa_s, NULL);
+		/* restart the listen state after a delay */
+		eloop_register_timeout(0, 500, wpas_nan_usd_remain_on_channel_timeout, wpa_s, lwork)
 		wpas_nan_usd_listen_work_done(wpa_s);
 		return;
 	}
-- 
2.34.1




More information about the Hostap mailing list