linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fjes: fix potential NULL pointer dereferences
@ 2019-03-11  7:10 Kangjie Lu
  2019-03-11 23:19 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Kangjie Lu @ 2019-03-11  7:10 UTC (permalink / raw)
  To: kjlu; +Cc: pakki001, David S. Miller, Colin Ian King, netdev, linux-kernel

In case alloc_workqueue fails, the fix returns -ENOMEM to avoid
ULL pointer dereferences.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/net/fjes/fjes_main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
index d3eae1239045..18c2c9e24c24 100644
--- a/drivers/net/fjes/fjes_main.c
+++ b/drivers/net/fjes/fjes_main.c
@@ -1252,8 +1252,17 @@ static int fjes_probe(struct platform_device *plat_dev)
 	adapter->open_guard = false;
 
 	adapter->txrx_wq = alloc_workqueue(DRV_NAME "/txrx", WQ_MEM_RECLAIM, 0);
+	if (!adapter->txrx_wq) {
+		err = -ENOMEM;
+		goto err_free_netdev;
+	}
+
 	adapter->control_wq = alloc_workqueue(DRV_NAME "/control",
 					      WQ_MEM_RECLAIM, 0);
+	if (!adapter->control_wq) {
+		err = -ENOMEM;
+		goto err_free_netdev;
+	}
 
 	INIT_WORK(&adapter->tx_stall_task, fjes_tx_stall_task);
 	INIT_WORK(&adapter->raise_intr_rxdata_task,
-- 
2.17.1


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

end of thread, other threads:[~2019-03-26 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-11  7:10 [PATCH] net: fjes: fix potential NULL pointer dereferences Kangjie Lu
2019-03-11 23:19 ` David Miller
2019-03-12  4:56   ` Kangjie Lu
2019-03-23  3:52   ` [PATCH v2] " Kangjie Lu
2019-03-26 17:50     ` David Miller

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