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: <1376907631-13725-1-git-send-email-andi@etezian.org>
Date:	Mon, 19 Aug 2013 12:20:31 +0200
From:	Andi Shyti <andi@...zian.org>
To:	josh.h.morris@...ibm.com, pjk1939@...ux.vnet.ibm.com
Cc:	linux-kernel@...r.kernel.org, andi@...zian.org
Subject: [PATCH] rsxx: core: fix memory leak

if 'copy_from_user' fails, the 'rsxx_cram_write()' function
returns without freeing the allocated buffer 'buf'.

Free 'buf' before returning.

This issue has been reported by scan.coverity.com

Signed-off-by: Andi Shyti <andi@...zian.org>
---
 drivers/block/rsxx/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index 6e85e21..1ddb284 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -223,8 +223,10 @@ static ssize_t rsxx_cram_write(struct file *fp, const char __user *ubuf,
 		return -ENOMEM;
 
 	st = copy_from_user(buf, ubuf, cnt);
-	if (st)
+	if (st) {
+		kfree(buf);
 		return st;
+	}
 
 	info->f_pos = (u32)*ppos + info->offset;
 
-- 
1.8.4.rc2

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