Skip to content

Commit 91e968d

Browse files
Krishna Tkrish2718
authored andcommitted
Fix handling of IEs in authentication
When copying event from driver and postnig to WPA supplicant, the IE's are not copied, so, if WPA supplicant takes longer to process the event the driver frees the IEs causing invalid data to be processed by WPA supplicant. This is a common issue to all events. For now Authentication events are being affected due to WPA3-SAE taking longer to process, so, fix only Authentication events for now as a generic fix needs more work and thought. Signed-off-by: Krishna T <[email protected]>
1 parent 490d2fd commit 91e968d

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/drivers/driver_zephyr.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ void wpa_supplicant_event_wrapper(void *ctx,
3232
return;
3333
}
3434
os_memcpy(msg.data, data, sizeof(*data));
35+
if (event == EVENT_AUTH) {
36+
union wpa_event_data *data_tmp = msg.data;
37+
38+
if (data->auth.ies) {
39+
char *ies = os_zalloc(data->auth.ies_len);
40+
41+
if (!ies) {
42+
wpa_printf(MSG_ERROR, "%s: Failed to alloc ies\n", __func__);
43+
return;
44+
}
45+
46+
os_memcpy(ies, data->auth.ies, data->auth.ies_len);
47+
data_tmp->auth.ies = ies;
48+
}
49+
}
3550
}
3651
z_wpas_send_event(&msg);
3752
}

zephyr/src/supp_main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ static void z_wpas_event_sock_handler(int sock, void *eloop_ctx, void *sock_ctx)
311311
}
312312

313313
if (msg.data) {
314+
if (msg.event == EVENT_AUTH) {
315+
union wpa_event_data *data = msg.data;
316+
317+
os_free((char *)data->auth.ies);
318+
}
314319
os_free(msg.data);
315320
}
316321
}

0 commit comments

Comments
 (0)