qla2xxx: fix a potential NULL pointer dereference
diff mbox series

Message ID 1568824618-4366-1-git-send-email-allen.pais@oracle.com
State In Next
Commit 35a79a63517981a8aea395497c548776347deda8
Headers show
Series
  • qla2xxx: fix a potential NULL pointer dereference
Related show

Commit Message

Allen Sept. 18, 2019, 4:36 p.m. UTC
alloc_workqueue is not checked for errors and as a result,
a potential NULL dereference could occur.

Signed-off-by: Allen Pais <allen.pais@oracle.com>
---
 drivers/scsi/qla2xxx/qla_os.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Martin K. Petersen Oct. 4, 2019, 1:56 a.m. UTC | #1
> alloc_workqueue is not checked for errors and as a result,
> a potential NULL dereference could occur.

Himanshu: Please review!
Martin Wilck Oct. 4, 2019, 6:10 a.m. UTC | #2
On Wed, 2019-09-18 at 22:06 +0530, Allen Pais wrote:
> alloc_workqueue is not checked for errors and as a result,
> a potential NULL dereference could occur.
> 
> Signed-off-by: Allen Pais <allen.pais@oracle.com>
> ---
>  drivers/scsi/qla2xxx/qla_os.c | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Martin Wilck <mwilck@suse.com>
Martin K. Petersen Oct. 10, 2019, 2:29 a.m. UTC | #3
Allen,

> alloc_workqueue is not checked for errors and as a result,
> a potential NULL dereference could occur.

Applied to 5.4/scsi-fixes, thanks!

Patch
diff mbox series

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 98e60a3..31714c9 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3232,6 +3232,10 @@  static void qla2x00_iocb_work_fn(struct work_struct *work)
 	    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 (unlikely(!ha->wq)) {
+		ret = -ENOMEM;
+		goto probe_failed;
+	}
 
 	if (ha->isp_ops->initialize_adapter(base_vha)) {
 		ql_log(ql_log_fatal, base_vha, 0x00d6,