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>] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 15 Oct 2016 16:32:14 +0100
From:   Colin King <colin.king@...onical.com>
To:     Dan Williams <dan.j.williams@...el.com>, linux-nvdimm@...ts.01.org
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH] libnvdimm: fix dereference on null devs on error exit path

From: Colin Ian King <colin.king@...onical.com>

If devs cannot be allocated then the error exit path jumps to
a cleanup loop that iterates over a null array of devs which
is incorrect.  Fix this by jumping instead to the end of the
function where NULL is returned.

Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
 drivers/nvdimm/namespace_devs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index 3509cff..5d2755a 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -2125,7 +2125,7 @@ static struct device **scan_labels(struct nd_region *nd_region)
 
 		devs = kcalloc(2, sizeof(dev), GFP_KERNEL);
 		if (!devs)
-			goto err;
+			goto err_ret;
 		if (is_nd_blk(&nd_region->dev)) {
 			struct nd_namespace_blk *nsblk;
 
@@ -2182,6 +2182,7 @@ static struct device **scan_labels(struct nd_region *nd_region)
 		else
 			namespace_pmem_release(devs[i]);
 	kfree(devs);
+ err_ret:
 	return NULL;
 }
 
-- 
2.9.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ