Skip to contentSkip to conversation

net: cw1200: fix a NULL pointer dereference

PATCH In review Kangjie Lu 2 participants 2 messages Mar 12, 2019 – Apr 25, 2019

Subsystems (3)
lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/net/wireless/st/cw1200/main.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/wireless/st/cw1200/main.c +5 -0
index 90dc979f260b..c1608f0bf6d0 100644
@@ -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);
Signature · 1 line
2.17.1
#1 lore raw
Quoted 4 lines · Kangjie Lu

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

Patch applied to wireless-drivers-next.git, thanks.

0ed2a0053474 net: cw1200: fix a NULL pointer dereference

Signature · 3 lines
https://patchwork.kernel.org/patch/10848701/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches