]> git.hungrycats.org Git - linux/commit
scsi: qedf: Fix NULL dereference in error handling
authorJinhong Zhu <jinhongzhu@hust.edu.cn>
Tue, 2 May 2023 14:00:21 +0000 (22:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jul 2023 17:39:45 +0000 (19:39 +0200)
commit08c001c1e9444a3046c79a99aa93ac48073b18cc
tree2ac89e12f660f86f989b31823d26f7804dfa9d1f
parentc6bfda50e00920d719fff9688533a369f40dc27f
scsi: qedf: Fix NULL dereference in error handling

[ Upstream commit f025312b089474a54e4859f3453771314d9e3d4f ]

Smatch reported:

drivers/scsi/qedf/qedf_main.c:3056 qedf_alloc_global_queues()
warn: missing unwind goto?

At this point in the function, nothing has been allocated so we can return
directly. In particular the "qedf->global_queues" have not been allocated
so calling qedf_free_global_queues() will lead to a NULL dereference when
we check if (!gl[i]) and "gl" is NULL.

Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Signed-off-by: Jinhong Zhu <jinhongzhu@hust.edu.cn>
Link: https://lore.kernel.org/r/20230502140022.2852-1-jinhongzhu@hust.edu.cn
Reviewed-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/qedf/qedf_main.c