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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1380296235-24194-1-git-send-email-richard.genoud@gmail.com>
Date:	Fri, 27 Sep 2013 17:37:15 +0200
From:	Richard Genoud <richard.genoud@...il.com>
To:	Richard Weinberger <richard@....at>,
	Artem Bityutskiy <dedekind1@...il.com>
Cc:	David Woodhouse <dwmw2@...radead.org>,
	linux-mtd <linux-mtd@...ts.infradead.org>,
	linux-kernel@...r.kernel.org,
	Richard Genoud <richard.genoud@...il.com>
Subject: [PATCH] UBI: fastmap: fix a mem leak on error path

If the scan_pool() function fails, the "free" list is not freed.
This leads to destroy_ai(ai) complaining with:
"kmem_cache_destroy ubi_ainf_peb_slab: Slab cache still has objects"

Signed-off-by: Richard Genoud <richard.genoud@...il.com>
---
 drivers/mtd/ubi/fastmap.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 05067f5..22eb527 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -841,6 +841,10 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
 fail_bad:
 	ret = UBI_BAD_FASTMAP;
 fail:
+	list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &free, u.list) {
+		kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
+		list_del(&tmp_aeb->u.list);
+	}
 	return ret;
 }
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ