[PATCH 03/18] eloop: remove references before destroying socket table

Benjamin Berg benjamin at sipsolutions.net
Thu Oct 30 01:24:34 PDT 2025


From: Benjamin Berg <benjamin.berg at intel.com>

If the table is not yet empty, then there are still references stored
inside the table and inserted into the global reference list. Clean
these up before free'ing the table to avoid an use-after-free if a
socket was not removed and tracing is enabled.

Fixes: a6ff0e0810b4 ("trace: Add active reference tracking")
Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
---
 src/utils/eloop.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/utils/eloop.c b/src/utils/eloop.c
index 00b0beff0b..115a6d8364 100644
--- a/src/utils/eloop.c
+++ b/src/utils/eloop.c
@@ -713,6 +713,7 @@ static void eloop_sock_table_destroy(struct eloop_sock_table *table)
 						table->table[i].handler);
 			wpa_trace_dump("eloop sock", &table->table[i]);
 		}
+		eloop_trace_sock_remove_ref(table);
 		os_free(table->table);
 	}
 }
-- 
2.51.0




More information about the Hostap mailing list