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: <20170430071420.24906-1-christophe.jaillet@wanadoo.fr>
Date:   Sun, 30 Apr 2017 09:14:20 +0200
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     starvik@...s.com, jesper.nilsson@...s.com
Cc:     linux-cris-kernel@...s.com, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH] cris: nand: fix a leak in error handling path

If only 1 of the 2 'ioremap' fails, then there is a small leak.

Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
 arch/cris/arch-v32/drivers/mach-fs/nandflash.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
index a74540514bdb..57622fbd9f25 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
@@ -123,7 +123,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
 	if (!read_cs || !write_cs) {
 		printk(KERN_ERR "CRISv32 NAND ioremap failed\n");
 		err = -EIO;
-		goto out_mtd;
+		goto out_ior;
 	}
 
 	/* Get pointer to private data */
@@ -162,9 +162,11 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
 	return crisv32_mtd;
 
 out_ior:
-	iounmap((void *)read_cs);
-	iounmap((void *)write_cs);
-out_mtd:
+	if (read_cs)
+		iounmap((void *)read_cs);
+	if (write_cs)
+		iounmap((void *)write_cs);
+
 	kfree(wrapper);
 	return NULL;
 }
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ