Message ID | 20191028084709.81538-1-dwagner@suse.de (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | scsi: qla2xxx: Check return value of alloc_workqueue() | expand |
On Mon, Oct 28, 2019 at 09:47:09AM +0100, Daniel Wagner wrote: > Do not derefence the pointer without checking it > first. alloc_workqueue() can return a NULL pointer. Oh forget it. Someone was faster :)
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 16f9b6ed574a..040f82ccacba 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -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,
Do not derefence the pointer without checking it first. alloc_workqueue() can return a NULL pointer. Reported-by: Semmle vulnerability research team <security-reports@semmle.com> Cc: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Daniel Wagner <dwagner@suse.de> --- drivers/scsi/qla2xxx/qla_os.c | 4 ++++ 1 file changed, 4 insertions(+)