]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Move NULL check for driver private data (drv_priv)
authorSunil Ravi <sunilravi@google.com>
Thu, 18 Jul 2024 23:10:46 +0000 (23:10 +0000)
committerJouni Malinen <j@w1.fi>
Sat, 20 Jul 2024 17:14:08 +0000 (20:14 +0300)
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: df34c2ced34f ("AP MLD: De-initialize/disable link BSS properly")
Signed-off-by: Sunil Ravi <sunilravi@google.com>
src/ap/hostapd.c

index 84a943ef52f7361795c19dd0ea36d09eff9d7fe8..a05de030d91f5eee65a37166afe064d8946cb6b2 100644 (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,
                                   void *drv_priv, struct hostapd_iface *iface)
 {
-#ifdef CONFIG_IEEE80211BE
        if (!driver || !driver->hapd_deinit || !drv_priv)
                return;
 
+#ifdef CONFIG_IEEE80211BE
        /* 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
         * be in use for a different AP MLD. Hence, need to check if drv is