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]
Message-Id: <1603104323-4438-1-git-send-email-bodefang@126.com>
Date:   Mon, 19 Oct 2020 18:45:23 +0800
From:   Defang Bo <bodefang@....com>
To:     sfrench@...ba.org
Cc:     linux-cifs@...r.kernel.org, samba-technical@...ts.samba.org,
        linux-kernel@...r.kernel.org, Defang Bo <bodefang@....com>
Subject: [PATCH] cifs : fix memory leak on error path

In SMB2_open_init() , if  smb2_plain_req_init() fails, then the memory assigned to req  will be leaked. It's similar to SMB2_open() which is fixed by the commit
<b7a73c84eb96> ("cifs: fix memory leak in SMB2_open()").

Signed-off-by: Defang Bo <bodefang@....com>
---
 fs/cifs/smb2pdu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 2f4cdd2..a1f584a 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2703,9 +2703,10 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
 
 	rc = smb2_plain_req_init(SMB2_CREATE, tcon, server,
 				 (void **) &req, &total_len);
-	if (rc)
+	if (rc) {
+		cifs_small_buf_release(req);
 		return rc;
-
+	}
 	iov[0].iov_base = (char *)req;
 	/* -1 since last byte is buf[0] which is sent below (path) */
 	iov[0].iov_len = total_len - 1;
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ