Move NULL check for driver private data (drv_priv)

In the hostapd_cleanup_driver() function, the NULL check for the driver
private data (drv_priv) is located within the CONFIG_IEEE80211BE feature
flag. As a result, on platforms where CONFIG_IEEE80211BE is not defined,
driver->hapd_deinit(drv_priv) is called with drv_priv set to NULL. This
leads to a null pointer exception in wpa_driver_nl80211_deinit().

To address this issue, move the NULL check for drv_priv outside the
CONFIG_IEEE80211BE build flag. This ensures that the check is performed
regardless of the value of CONFIG_IEEE80211BE, preventing the NULL
pointer exception.

Fixes: df34c2ced3 ("AP MLD: De-initialize/disable link BSS properly")
Signed-off-by: Sunil Ravi <sunilravi@google.com>
This commit is contained in:
Sunil Ravi 2024-07-18 23:10:46 +00:00 committed by Jouni Malinen
parent c3d305d939
commit ed5887a8c9

View file

@ -3375,10 +3375,10 @@ hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
static void hostapd_cleanup_driver(const struct wpa_driver_ops *driver, static void hostapd_cleanup_driver(const struct wpa_driver_ops *driver,
void *drv_priv, struct hostapd_iface *iface) void *drv_priv, struct hostapd_iface *iface)
{ {
#ifdef CONFIG_IEEE80211BE
if (!driver || !driver->hapd_deinit || !drv_priv) if (!driver || !driver->hapd_deinit || !drv_priv)
return; return;
#ifdef CONFIG_IEEE80211BE
/* In case of non-ML operation, de-init. But if ML operation exist, /* In case of non-ML operation, de-init. But if ML operation exist,
* even if that's the last BSS in the interface, the driver (drv) could * even if that's the last BSS in the interface, the driver (drv) could
* be in use for a different AP MLD. Hence, need to check if drv is * be in use for a different AP MLD. Hence, need to check if drv is