diff options
author | Jinhong Zhu <jinhongzhu@hust.edu.cn> | 2023-05-02 22:00:21 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-07-19 16:21:34 +0200 |
commit | c316bde418af4c2a9df51149ed01d1bd8ca5bebf (patch) | |
tree | f2cd74772adce600726adf39435ba35c32cfd9c1 | |
parent | c52502b67424a076cbb92e589de5201c61c3086d (diff) | |
download | linux-stable-c316bde418af4c2a9df51149ed01d1bd8ca5bebf.tar.gz linux-stable-c316bde418af4c2a9df51149ed01d1bd8ca5bebf.tar.bz2 linux-stable-c316bde418af4c2a9df51149ed01d1bd8ca5bebf.zip |
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>
-rw-r--r-- | drivers/scsi/qedf/qedf_main.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index e045c6e25090..ecff2ec83a00 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -3046,9 +3046,8 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) * addresses of our queues */ if (!qedf->p_cpuq) { - status = -EINVAL; QEDF_ERR(&qedf->dbg_ctx, "p_cpuq is NULL.\n"); - goto mem_alloc_failure; + return -EINVAL; } qedf->global_queues = kzalloc((sizeof(struct global_queue *) |