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>] [day] [month] [year] [list]
Message-Id: <20221214032154.41665-1-jiasheng@iscas.ac.cn>
Date:   Wed, 14 Dec 2022 11:21:54 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     aacraid@...rosemi.com, jejb@...ux.ibm.com,
        martin.petersen@...cle.com
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] scsi: ips: Add missing check for dma_alloc_coherent

Add check for the return value of the dma_alloc_coherent in order to
avoid NULL pointer dereference.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 drivers/scsi/ips.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 16419aeec02d..26101f5b0434 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -6932,6 +6932,11 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
 	if(ips_cd_boot && !ips_FlashData){
 		ips_FlashData = dma_alloc_coherent(&pci_dev->dev,
 				PAGE_SIZE << 7, &ips_flashbusaddr, GFP_KERNEL);
+		if (!ips_FlashData) {
+			IPS_PRINTK(KERN_WARNING, pci_dev,
+				   "Unable to allocate ips FlashData structure\n");
+			return ips_abort_init(ha, index);
+		}
 	}
 
 	ha->enq = dma_alloc_coherent(&pci_dev->dev, sizeof (IPS_ENQ),
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ