Messages in this thread Patch in this message | | | From | Kangjie Lu <> | Subject | [PATCH] net: fjes: fix potential NULL pointer dereferences | Date | Mon, 11 Mar 2019 02:10:21 -0500 |
| |
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
| |