From 4a8f23fcb9aceb9c6ef8bdabccadc392b1cef571 Mon Sep 17 00:00:00 2001 From: Rathees Kumar R Chinannan Date: Tue, 14 Nov 2023 16:19:24 +0530 Subject: [PATCH] hostapd: Avoid NULL pointer dereference. Added NULL check before accessing hapd ptr on hostapd_wpa_event function. This NULL check is added to avoid unusual hostapd crashes observed during module reload test cases. Signed-off-by: Rathees Kumar R Chinannan Change-Id: Ia4a5525694e6b8acdc707b431c54b98f90bdd2aa --- src/ap/drv_callbacks.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 2b10cc6..a01d8f2 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -2148,10 +2148,13 @@ void hostapd_wpa_event(void *ctx, enum wpa_event_type event, { struct hostapd_data *hapd = ctx; int b, err; - #ifndef CONFIG_NO_STDOUT_DEBUG int level = MSG_DEBUG; +#endif /* CONFIG_NO_STDOUT_DEBUG */ + if (hapd == NULL) + return; +#ifndef CONFIG_NO_STDOUT_DEBUG if (event == EVENT_RX_MGMT && data->rx_mgmt.frame && data->rx_mgmt.frame_len >= 24) { const struct ieee80211_hdr *hdr; -- 2.42.0