Thread (370 messages) 370 messages, 4 authors, 2019-03-29
STALE2648d

[PATCH 3.16 089/366] cifs: fix memory leak in SMB2_open()

From: Ben Hutchings <hidden>
Date: 2018-10-14 15:47:00
Also in: lkml

3.16.60-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Ronnie Sahlberg <redacted>

commit b7a73c84eb96dabd6bb8e9d7c56f796d83efee8e upstream.

Signed-off-by: Ronnie Sahlberg <redacted>
Signed-off-by: Steve French <smfrench@gmail.com>
[bwh: Backported to 3.16: Only one of the failure paths exists here]
Signed-off-by: Ben Hutchings <redacted>
---
 fs/cifs/smb2pdu.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1176,8 +1176,10 @@ SMB2_open(const unsigned int xid, struct
 			copy_size += 8;
 
 		copy_path = kzalloc(copy_size, GFP_KERNEL);
-		if (!copy_path)
+		if (!copy_path) {
+			cifs_small_buf_release(req);
 			return -ENOMEM;
+		}
 		memcpy((char *)copy_path, (const char *)path,
 			uni_path_len);
 		uni_path_len = copy_size;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help