Skip to contentSkip to conversation

scsi: qla2xxx: Check return value of alloc_workqueue()

PATCH In review Daniel Wagner 1 participant 2 messages Oct 28, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: qla2xxx: Check return value of alloc_workqueue()

Do not derefence the pointer without checking it first. alloc_workqueue() can return a NULL pointer.

---
 drivers/scsi/qla2xxx/qla_os.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/scsi/qla2xxx/qla_os.c +4 -0
index 16f9b6ed574a..040f82ccacba 100644
@@ -3224,6 +3224,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	    req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out);
 
 	ha->wq = alloc_workqueue("qla2xxx_wq", 0, 0);
+	if (!ha->wq) {
+		ret = -ENOMEM;
+		goto probe_failed;
+	}
 
 	if (ha->isp_ops->initialize_adapter(base_vha)) {
 		ql_log(ql_log_fatal, base_vha, 0x00d6,
Signature · 1 line
2.16.4
#1 lore raw
Quoted 2 lines · Daniel Wagner

Do not derefence the pointer without checking it first. alloc_workqueue() can return a NULL pointer.

Oh forget it. Someone was faster :)