]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: qla2xxx: Fix possible fcport null-pointer dereferences
authorJia-Ju Bai <baijiaju1990@gmail.com>
Mon, 29 Jul 2019 08:44:51 +0000 (16:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Aug 2019 08:50:14 +0000 (10:50 +0200)
commitf366bdf3f821d63bf4c4e02e1472cbe06e44b5a5
tree191f453bd47a8a99743718d33fcb833bcb1f604a
parentd110628c3f5cbe59625c60b49438cfe49fe97578
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>
drivers/scsi/qla2xxx/qla_init.c