diff options
author | Jia-Ju Bai <baijiaju1990@gmail.com> | 2019-07-29 16:44:51 +0800 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2019-08-25 10:10:30 -0400 |
commit | 70025ef1e6eed4e36c642259d15007782bd4efdf (patch) | |
tree | af273f1d25279ef4682219eae8d72902a426decb /drivers/scsi | |
parent | a3980c1191b134f7d0fc33f42458ddb693fd32dd (diff) | |
download | linux-stable-70025ef1e6eed4e36c642259d15007782bd4efdf.tar.gz linux-stable-70025ef1e6eed4e36c642259d15007782bd4efdf.tar.bz2 linux-stable-70025ef1e6eed4e36c642259d15007782bd4efdf.zip |
scsi: qla2xxx: Fix possible fcport null-pointer dereferences
[ Upstream commit e82f04ec6ba91065fd33a6201ffd7cab840e1475 ]
In qla2x00_alloc_fcport(), fcport is assigned to NULL in the error
handling code on line 4880:
fcport = NULL;
Then fcport is used on lines 4883-4886:
INIT_WORK(&fcport->del_work, qla24xx_delete_sess_fn);
INIT_WORK(&fcport->reg_work, qla_register_fcport_fn);
INIT_LIST_HEAD(&fcport->gnl_entry);
INIT_LIST_HEAD(&fcport->list);
Thus, possible null-pointer dereferences may occur.
To fix these bugs, qla2x00_alloc_fcport() directly returns NULL
in the error handling code.
These bugs are found by a static analysis tool STCheck written by us.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 54772d4c377f..6a4c719497ca 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -4877,7 +4877,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags) ql_log(ql_log_warn, vha, 0xd049, "Failed to allocate ct_sns request.\n"); kfree(fcport); - fcport = NULL; + return NULL; } INIT_WORK(&fcport->del_work, qla24xx_delete_sess_fn); |