Skip to content

Commit eb32cfc

Browse files
kengiterdavem330
authored andcommitted
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 <kjlu@umn.edu> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1001049 commit eb32cfc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/ethernet/qlogic/qla3xxx.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3886,6 +3886,12 @@ static int ql3xxx_probe(struct pci_dev *pdev,
38863886
netif_stop_queue(ndev);
38873887

38883888
qdev->workqueue = create_singlethread_workqueue(ndev->name);
3889+
if (!qdev->workqueue) {
3890+
unregister_netdev(ndev);
3891+
err = -ENOMEM;
3892+
goto err_out_iounmap;
3893+
}
3894+
38893895
INIT_DELAYED_WORK(&qdev->reset_work, ql_reset_work);
38903896
INIT_DELAYED_WORK(&qdev->tx_timeout_work, ql_tx_timeout_work);
38913897
INIT_DELAYED_WORK(&qdev->link_state_work, ql_link_state_machine_work);

0 commit comments

Comments
 (0)