From 1dfd25a68afeae665ddff7faa13365a5c5c08bf1 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 27 Dec 2016 00:55:32 +0200 Subject: [PATCH] Fix hostapd SIGHUP processing before interface is enabled It was possible to try to do driver operations before the driver interface had been initialized when processing a SIGHUP signal. This would result in NULL pointer dereference. Fix this by skipping the steps when SIGHUP is issued before the interface is enabled. Signed-off-by: Jouni Malinen --- src/ap/hostapd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 29c17bf95..9f972ae24 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -75,6 +75,9 @@ static void hostapd_reload_bss(struct hostapd_data *hapd) { struct hostapd_ssid *ssid; + if (!hapd->started) + return; + #ifndef CONFIG_NO_RADIUS radius_client_reconfig(hapd->radius, hapd->conf->radius); #endif /* CONFIG_NO_RADIUS */ @@ -210,7 +213,7 @@ static void hostapd_broadcast_key_clear_iface(struct hostapd_data *hapd, { int i; - if (!ifname) + if (!ifname || !hapd->drv_priv) return; for (i = 0; i < NUM_WEP_KEYS; i++) { if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_NONE, NULL, i,