linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: cw1200: fix a NULL pointer dereference
@ 2019-03-12  8:05 Kangjie Lu
  2019-04-25 16:40 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-12  8:05 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Solomon Peachy, Kalle Valo, David S. Miller,
	linux-wireless, netdev, linux-kernel

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>
---
 drivers/net/wireless/st/cw1200/main.c | 5 +++++
 1 file changed, 5 insertions(+)

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);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: cw1200: fix a NULL pointer dereference
  2019-03-12  8:05 [PATCH] net: cw1200: fix a NULL pointer dereference Kangjie Lu
@ 2019-04-25 16:40 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2019-04-25 16:40 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: kjlu, pakki001, Solomon Peachy, David S. Miller, linux-wireless,
	netdev, linux-kernel

Kangjie Lu <kjlu@umn.edu> wrote:

> 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>

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

0ed2a0053474 net: cw1200: fix a NULL pointer dereference

-- 
https://patchwork.kernel.org/patch/10848701/

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-25 16:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12  8:05 [PATCH] net: cw1200: fix a NULL pointer dereference Kangjie Lu
2019-04-25 16:40 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).