aboutsummaryrefslogtreecommitdiffstats
path: root/src/ap/ap_drv_ops.h
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2016-08-19 09:24:15 (GMT)
committerJouni Malinen <j@w1.fi>2016-08-19 13:08:00 (GMT)
commit1f3b8b4edbccfdd60cc28d0f11080eb7181c28b9 (patch)
treed731bf8f9943d6329feff3050418fd0b9fab47ad /src/ap/ap_drv_ops.h
parent833d0d45e8bc625fae856ccfa895f8ed01fcd2cd (diff)
downloadhostap-1f3b8b4edbccfdd60cc28d0f11080eb7181c28b9.zip
hostap-1f3b8b4edbccfdd60cc28d0f11080eb7181c28b9.tar.gz
hostap-1f3b8b4edbccfdd60cc28d0f11080eb7181c28b9.tar.bz2
Check for driver initialization before doing driver operations
Number of hostapd control interface commands (e.g., STATUS-DRIVER) could result in NULL pointer dereference when issued on not yet enabled BSS. Fix this by checking that the driver interface has been initialized before calling the driver_ops function. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'src/ap/ap_drv_ops.h')
-rw-r--r--src/ap/ap_drv_ops.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 6406d13..0bb7954 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -160,7 +160,7 @@ static inline int hostapd_drv_get_inact_sec(struct hostapd_data *hapd,
static inline int hostapd_drv_sta_remove(struct hostapd_data *hapd,
const u8 *addr)
{
- if (hapd->driver == NULL || hapd->driver->sta_remove == NULL)
+ if (!hapd->driver || !hapd->driver->sta_remove || !hapd->drv_priv)
return 0;
return hapd->driver->sta_remove(hapd->drv_priv, addr);
}
@@ -283,7 +283,7 @@ static inline int hostapd_drv_switch_channel(struct hostapd_data *hapd,
static inline int hostapd_drv_status(struct hostapd_data *hapd, char *buf,
size_t buflen)
{
- if (hapd->driver == NULL || hapd->driver->status == NULL)
+ if (!hapd->driver || !hapd->driver->status || !hapd->drv_priv)
return -1;
return hapd->driver->status(hapd->drv_priv, buf, buflen);
}
@@ -342,7 +342,7 @@ static inline int hostapd_drv_vendor_cmd(struct hostapd_data *hapd,
static inline int hostapd_drv_stop_ap(struct hostapd_data *hapd)
{
- if (hapd->driver == NULL || hapd->driver->stop_ap == NULL)
+ if (!hapd->driver || !hapd->driver->stop_ap || !hapd->drv_priv)
return 0;
return hapd->driver->stop_ap(hapd->drv_priv);
}