[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190311071022.27610-1-kjlu@umn.edu>
Date: Mon, 11 Mar 2019 02:10:21 -0500
From: Kangjie Lu <kjlu@....edu>
To: kjlu@....edu
Cc: pakki001@....edu, "David S. Miller" <davem@...emloft.net>,
Colin Ian King <colin.king@...onical.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] net: fjes: fix potential NULL pointer dereferences
In case alloc_workqueue fails, the fix returns -ENOMEM to avoid
ULL pointer dereferences.
Signed-off-by: Kangjie Lu <kjlu@....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
Powered by blists - more mailing lists