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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230422101626.1722235-1-meetlpz@hust.edu.cn>
Date:   Sat, 22 Apr 2023 18:16:26 +0800
From:   Peizhi Li <meetlpz@...t.edu.cn>
To:     Nilesh Javali <njavali@...vell.com>,
        Manish Rangankar <mrangankar@...vell.com>,
        GR-QLogic-Storage-Upstream@...vell.com,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>
Cc:     hust-os-kernel-patches@...glegroups.com,
        Peizhi Li <meetlpz@...t.edu.cn>,
        Dongliang Mu <dzm91@...t.edu.cn>,
        Dan Carpenter <dan.carpenter@...aro.org>,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] scsi: qedi: qedi_main.c: modify the code flow in 'qedi_alloc_global_queues'

When goto the mem_alloc_failure, it will result in a null pointer 
reference to variable 'gl' in function 'qedi_free_global_queues', 
due to the 'qedi->global_queues' not being allocated.

Fix this by returning -EINVAL directly.

Signed-off-by: Peizhi Li <meetlpz@...t.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@...t.edu.cn>
Reviewed-by: Dan Carpenter <dan.carpenter@...aro.org>
---
The issue is found by static analysis and remains untested. Meanwhile, 
this patches is similar with qedf which Jinhong Zhu fixed already. 

https://lore.kernel.org/all/20230417135518.184595-1-jinhongzhu@hust.edu.cn/
 drivers/scsi/qedi/qedi_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index f2ee49756df8..34f38e0f1c7d 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -1637,8 +1637,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
 	 * addresses of our queues
 	 */
 	if (!qedi->p_cpuq) {
-		status = -EINVAL;
-		goto mem_alloc_failure;
+		return -EINVAL;
 	}
 
 	qedi->global_queues = kzalloc((sizeof(struct global_queue *) *
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ