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]
Date:   Sun,  5 Feb 2017 15:44:00 +0000
From:   Wei Yongjun <weiyj.lk@...il.com>
To:     Keith Busch <keith.busch@...el.com>, Jens Axboe <axboe@...com>,
        Christoph Hellwig <hch@....de>,
        Sagi Grimberg <sagi@...mberg.me>,
        Javier González <jg@...htnvm.io>
Cc:     Wei Yongjun <weiyongjun1@...wei.com>,
        linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH -next] lightnvm: fix possible memory leak in nvme_nvm_get_l2p_tbl()

From: Wei Yongjun <weiyongjun1@...wei.com>

'entries' is malloced in nvme_nvm_get_l2p_tbl() and should be freed
before leaving from the error handling cases, otherwise it will cause
memory leak.

Fixes: 8e79b5cb1d3b ("lightnvm: move block provisioning to targets")
Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
---
 drivers/nvme/host/lightnvm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 588d4a3..2388716 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -368,7 +368,8 @@ static int nvme_nvm_get_l2p_tbl(struct nvm_dev *nvmdev, u64 slba, u32 nlb,
 
 		if (unlikely(elba > nvmdev->total_secs)) {
 			pr_err("nvm: L2P data from device is out of bounds!\n");
-			return -EINVAL;
+			ret = -EINVAL;
+			goto out;
 		}
 
 		/* Transform physical address to target address space */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ