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: <20210831030502.10965-1-xu.xin16@zte.com.cn>
Date:   Mon, 30 Aug 2021 20:05:02 -0700
From:   cgel.zte@...il.com
To:     salah.triki@...il.com
Cc:     xu.xin16@....com.cn, gregkh@...uxfoundation.org,
        linux-kernel@...r.kernel.org, Zeal Robot <zealci@....com.cn>
Subject: [linux-next,v2] dio: add missing iounmap() after ioremap() from dio.c

From: xu xin <xu.xin16@....com.cn>

When the condition 'scode >= DIOII_SCBASE' is true, the pointer 'va' is
mapped by executing ioremap(). Accordingly, if kzalloc() fails, 'va'
needs to be unmapped before returning -ENOMEM.

Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: xu xin <xu.xin16@....com.cn>
---
 drivers/dio/dio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/dio/dio.c b/drivers/dio/dio.c
index 4c06c93c93d3..7d192509a8bd 100644
--- a/drivers/dio/dio.c
+++ b/drivers/dio/dio.c
@@ -218,9 +218,11 @@ static int __init dio_init(void)
 
                 /* Found a board, allocate it an entry in the list */
 		dev = kzalloc(sizeof(struct dio_dev), GFP_KERNEL);
-		if (!dev)
+		if (!dev) {
+			if (scode >= DIOII_SCBASE)
+				iounmap(va);
 			return -ENOMEM;
-
+		}
 		dev->bus = &dio_bus;
 		dev->dev.parent = &dio_bus.dev;
 		dev->dev.bus = &dio_bus_type;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ