lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 23 May 2021 13:02:29 +0200
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     skashyap@...vell.com, jhasan@...vell.com,
        GR-QLogic-Storage-Upstream@...vell.com, jejb@...ux.ibm.com,
        martin.petersen@...cle.com, chad.dupuis@...ium.com,
        arun.easi@...ium.com, nilesh.javali@...ium.com
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH 1/3] scsi: qedf: Fix an error handling path in 'qedf_alloc_global_queues()'

If 'qedf_alloc_bdq()' fails, 'status' is known to be 0, so we report
success to the caller.

In fact going to 'mem_alloc_failure' is pointless here, because we try to
free some resources that have not been allocated yet.
This is however harmless because 'qedf_free_global_queues()' is robust
enough.

So make a direct return instead, as already done just a few lines above.

While at it, also do a direct return if '!qedf->p_cpuq'. Going to
'mem_alloc_failure' is also pointless here and mixing goto and direct
return is spurious. So make it clear that nothing has to be undone.

Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
 drivers/scsi/qedf/qedf_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 7368a40ba649..ff3a1b183a7c 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -3022,9 +3022,8 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
 	 * addresses of our queues
 	 */
 	if (!qedf->p_cpuq) {
-		status = 1;
 		QEDF_ERR(&qedf->dbg_ctx, "p_cpuq is NULL.\n");
-		goto mem_alloc_failure;
+		return 1;
 	}
 
 	qedf->global_queues = kzalloc((sizeof(struct global_queue *)
@@ -3041,7 +3040,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
 	rc = qedf_alloc_bdq(qedf);
 	if (rc) {
 		QEDF_ERR(&qedf->dbg_ctx, "Unable to allocate bdq.\n");
-		goto mem_alloc_failure;
+		return -ENOMEM;
 	}
 
 	/* Allocate a CQ and an associated PBL for each MSI-X vector */
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ