net: qlogic: fix a potential NULL pointer dereference
Subsystems (3)
PATCH v2 1/1 net: qlogic: fix a potential NULL pointer dereference
In case create_singlethread_workqueue fails, the fix returns -ENOMEM to avoid NULL pointer dereference.
Signed-off-by Kangjie Lu <[email protected]>
--- drivers/net/ethernet/qlogic/qla3xxx.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/qlogic/qla3xxx.c +6 -0
@@ -3886,6 +3886,12 @@ static int ql3xxx_probe(struct pci_dev *pdev,netif_stop_queue (ndev); qdev->workqueue =create_singlethread_workqueue (ndev->name); +if (!qdev->workqueue) { +unregister_netdev (ndev); + err = -ENOMEM ; + goto err_out_iounmap; + } +INIT_DELAYED_WORK (&qdev->reset_work, ql_reset_work);INIT_DELAYED_WORK (&qdev->tx_timeout_work, ql_tx_timeout_work);INIT_DELAYED_WORK (&qdev->link_state_work, ql_link_state_machine_work);
Signature · 1 line
2.17.1
From: Kangjie Lu <[email protected]>
Date: Tue, 12 Mar 2019 02:06:47 -0500
Quoted 4 lines
In case
create_singlethread_workqueuefails, the fix returns-ENOMEMto avoid NULL pointer dereference.Signed-off-by Kangjie Lu <[email protected]>
Applied, thanks.