summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qlogic
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-12 08:06:47 +0100
committerDavid S. Miller <davem@davemloft.net>2019-03-12 22:44:43 +0100
commiteb32cfcdef2305dc0e44a65d42801315669bb27e (patch)
tree643aac75c72813b02dfd9f9355d6020181419adb /drivers/net/ethernet/qlogic
parentisdn: hfcpci: fix potential NULL pointer dereference (diff)
downloadlinux-eb32cfcdef2305dc0e44a65d42801315669bb27e.tar.xz
linux-eb32cfcdef2305dc0e44a65d42801315669bb27e.zip
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>
Diffstat (limited to 'drivers/net/ethernet/qlogic')
-rw-r--r--drivers/net/ethernet/qlogic/qla3xxx.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index 10b075bc5959..b61b88cbc0c7 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -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);