]> git.baikalelectronics.ru Git - kernel.git/commitdiff
rsi: fix null pointer dereference during rsi_shutdown()
authorMartin Kepplinger <martin.kepplinger@puri.sm>
Wed, 29 Jan 2020 13:02:59 +0000 (14:02 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 12 Feb 2020 16:19:14 +0000 (18:19 +0200)
Appearently the hw pointer can be NULL while the module is loaded and
in that case rsi_shutdown() crashes due to the unconditional dereference.

Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rsi/rsi_91x_sdio.c

index 1bebba4e85273f8f7d944419b6ff683e08773861..5d6143a551877527711b66bd8ac8cbe00f810545 100644 (file)
@@ -1468,12 +1468,15 @@ static void rsi_shutdown(struct device *dev)
        struct rsi_91x_sdiodev *sdev =
                (struct rsi_91x_sdiodev *)adapter->rsi_dev;
        struct ieee80211_hw *hw = adapter->hw;
-       struct cfg80211_wowlan *wowlan = hw->wiphy->wowlan_config;
 
        rsi_dbg(ERR_ZONE, "SDIO Bus shutdown =====>\n");
 
-       if (rsi_config_wowlan(adapter, wowlan))
-               rsi_dbg(ERR_ZONE, "Failed to configure WoWLAN\n");
+       if (hw) {
+               struct cfg80211_wowlan *wowlan = hw->wiphy->wowlan_config;
+
+               if (rsi_config_wowlan(adapter, wowlan))
+                       rsi_dbg(ERR_ZONE, "Failed to configure WoWLAN\n");
+       }
 
        if (IS_ENABLED(CONFIG_RSI_COEX) && adapter->priv->coex_mode > 1 &&
            adapter->priv->bt_adapter) {