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: <20251126013618.1052-1-vulab@iscas.ac.cn>
Date: Wed, 26 Nov 2025 09:36:18 +0800
From: Haotian Zhang <vulab@...as.ac.cn>
To: dpenkler@...il.com,
	gregkh@...uxfoundation.org
Cc: matchstick@...erthere.org,
	niharchaithanya@...il.com,
	paul.retourne@...nge.fr,
	linux-staging@...ts.linux.dev,
	linux-kernel@...r.kernel.org,
	Haotian Zhang <vulab@...as.ac.cn>
Subject: [PATCH] staging: gpib: ines: Check the return value of ioremap()

The function ioremap() in ines_gpib_config() can fail and return NULL,
which is dereferenced without checking, leading to a NULL pointer
dereference.

Add a check for the return value of ioremap() and return -ENOMEM on
failure.

Fixes: bb1bd92fa0f2 ("staging: gpib: Add ines GPIB driver")
Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
---
 drivers/staging/gpib/ines/ines_gpib.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/gpib/ines/ines_gpib.c b/drivers/staging/gpib/ines/ines_gpib.c
index c851fd014f48..362a6310cab1 100644
--- a/drivers/staging/gpib/ines/ines_gpib.c
+++ b/drivers/staging/gpib/ines/ines_gpib.c
@@ -1144,6 +1144,11 @@ static int ines_gpib_config(struct pcmcia_device *link)
 		return -ENODEV;
 	}
 	virt = ioremap(link->resource[2]->start, resource_size(link->resource[2]));
+	if (!virt) {
+		dev_warn(&link->dev, "ioremap failed\n");
+		ines_gpib_release(link);
+		return -ENOMEM;
+	}
 	writeb((link->resource[2]->start >> 2) & 0xff, virt + 0xf0); // IOWindow base
 	iounmap(virt);
 
-- 
2.50.1.windows.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ