summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-12 03:05:02 -0500
committerKalle Valo <kvalo@codeaurora.org>2019-04-25 19:40:09 +0300
commit0ed2a005347400500a39ea7c7318f1fea57fb3ca (patch)
tree3e8e0054f5f73f51dd73f2b540c745406c2b71c3
parentb2c01aab9646ed8ffb7c549afe55d5349c482425 (diff)
downloadlinux-0ed2a005347400500a39ea7c7318f1fea57fb3ca.tar.bz2
net: cw1200: fix a NULL pointer dereference
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>
-rw-r--r--drivers/net/wireless/st/cw1200/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/wireless/st/cw1200/main.c b/drivers/net/wireless/st/cw1200/main.c
index 90dc979f260b..c1608f0bf6d0 100644
--- a/drivers/net/wireless/st/cw1200/main.c
+++ b/drivers/net/wireless/st/cw1200/main.c
@@ -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);