]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: cw1200: fix a NULL pointer dereference
authorKangjie Lu <kjlu@umn.edu>
Tue, 12 Mar 2019 08:05:02 +0000 (03:05 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jun 2019 10:23:55 +0000 (12:23 +0200)
[ Upstream commit 0ed2a005347400500a39ea7c7318f1fea57fb3ca ]

In case create_singlethread_workqueue fails, the fix free the
hardware and returns NULL to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/cw1200/main.c

index 0e51e27d2e3f1bba627d8b9fd5f7c68be7bff662..317daa968e0377749f7cfd93c4bdda3bbfd2e465 100644 (file)
@@ -345,6 +345,11 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr,
        mutex_init(&priv->wsm_cmd_mux);
        mutex_init(&priv->conf_mutex);
        priv->workqueue = create_singlethread_workqueue("cw1200_wq");
+       if (!priv->workqueue) {
+               ieee80211_free_hw(hw);
+               return NULL;
+       }
+
        sema_init(&priv->scan.lock, 1);
        INIT_WORK(&priv->scan.work, cw1200_scan_work);
        INIT_DELAYED_WORK(&priv->scan.probe_work, cw1200_probe_work);