linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: Check return value of alloc_workqueue()
@ 2019-10-28  8:47 Daniel Wagner
  2019-10-28  9:03 ` Daniel Wagner
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Wagner @ 2019-10-28  8:47 UTC (permalink / raw)
  To: linux-scsi
  Cc: linux-kernel, Martin K . Petersen, Daniel Wagner, Himanshu Madhani

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(+)

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,
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: qla2xxx: Check return value of alloc_workqueue()
  2019-10-28  8:47 [PATCH] scsi: qla2xxx: Check return value of alloc_workqueue() Daniel Wagner
@ 2019-10-28  9:03 ` Daniel Wagner
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Wagner @ 2019-10-28  9:03 UTC (permalink / raw)
  To: linux-scsi; +Cc: linux-kernel, Martin K . Petersen, Himanshu Madhani

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 :)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-28  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28  8:47 [PATCH] scsi: qla2xxx: Check return value of alloc_workqueue() Daniel Wagner
2019-10-28  9:03 ` Daniel Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).