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]
Message-Id: <20210512144849.719291602@linuxfoundation.org>
Date:   Wed, 12 May 2021 16:46:59 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        stable@...r.kernel.org,
        Himanshu Madhani <himanshu.madhani@...cle.com>,
        Saurav Kashyap <skashyap@...vell.com>,
        Nilesh Javali <njavali@...vell.com>,
        Quinn Tran <qutran@...vell.com>,
        Mike Christie <michael.christie@...cle.com>,
        Daniel Wagner <dwagner@...e.de>, Lee Duncan <lduncan@...e.com>,
        Bart Van Assche <bvanassche@....org>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Sasha Levin <sashal@...nel.org>
Subject: [PATCH 5.12 373/677] scsi: qla2xxx: Check kzalloc() return value

From: Bart Van Assche <bvanassche@....org>

[ Upstream commit e5406d8ad4a1659f4d4d1b39fe203855c4eaef2d ]

Instead of crashing if kzalloc() fails, make qla2x00_get_host_stats()
return -ENOMEM.

Link: https://lore.kernel.org/r/20210320232359.941-8-bvanassche@acm.org
Fixes: dbf1f53cfd23 ("scsi: qla2xxx: Implementation to get and manage host, target stats and initiator port")
Cc: Himanshu Madhani <himanshu.madhani@...cle.com>
Cc: Saurav Kashyap <skashyap@...vell.com>
Cc: Nilesh Javali <njavali@...vell.com>
Cc: Quinn Tran <qutran@...vell.com>
Cc: Mike Christie <michael.christie@...cle.com>
Cc: Daniel Wagner <dwagner@...e.de>
Cc: Lee Duncan <lduncan@...e.com>
Reviewed-by: Daniel Wagner <dwagner@...e.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@...cle.com>
Acked-by: Saurav Kashyap <skashyap@...vell.com>
Signed-off-by: Bart Van Assche <bvanassche@....org>
Signed-off-by: Martin K. Petersen <martin.petersen@...cle.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
 drivers/scsi/qla2xxx/qla_bsg.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index d021e51344f5..aef2f7cc89d3 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2584,6 +2584,10 @@ qla2x00_get_host_stats(struct bsg_job *bsg_job)
 	}
 
 	data = kzalloc(response_len, GFP_KERNEL);
+	if (!data) {
+		kfree(req_data);
+		return -ENOMEM;
+	}
 
 	ret = qla2xxx_get_ini_stats(fc_bsg_to_shost(bsg_job), req_data->stat_type,
 				    data, response_len);
-- 
2.30.2



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ