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]
Message-Id: <1448267375-19009-1-git-send-email-ww.tao0320@gmail.com>
Date:	Mon, 23 Nov 2015 16:29:35 +0800
From:	Wenwei Tao <ww.tao0320@...il.com>
To:	mb@...htnvm.io
Cc:	linux-kernel@...r.kernel.org, linux-block@...r.kernel.org
Subject: [PATCH] lightnvm: free allocated memory when gennvm register fails

free allocated nvm block and gennvm lun structures when
gennvm register fails, otherwise it will cause memory leak.

Signed-off-by: Wenwei Tao <ww.tao0320@...il.com>
---
 drivers/lightnvm/gennvm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c
index ae1fb2b..03fc7a5 100644
--- a/drivers/lightnvm/gennvm.c
+++ b/drivers/lightnvm/gennvm.c
@@ -211,12 +211,15 @@ static int gennvm_register(struct nvm_dev *dev)
 	ret = gennvm_blocks_init(dev, gn);
 	if (ret) {
 		pr_err("gennvm: could not initialize blocks\n");
+		gennvm_blocks_free(dev);
+		gennvm_luns_free(dev);
 		goto err;
 	}
 
 	return 1;
 err:
 	kfree(gn);
+	dev->mp = NULL;
 	return ret;
 }
 
-- 
1.8.3.1

--
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