Skip to content

Commit

Permalink
net: qlogic: fix a potential NULL pointer dereference
Browse files Browse the repository at this point in the history
In case create_singlethread_workqueue fails, the fix returns
-ENOMEM to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Kangjie Lu authored and David S. Miller committed Mar 12, 2019
1 parent 1001049 commit eb32cfc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/ethernet/qlogic/qla3xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit eb32cfc

Please sign in to comment.