From: Defang Bo <bodefang@126.com>
To: sfrench@samba.org
Cc: linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
linux-kernel@vger.kernel.org, Defang Bo <bodefang@126.com>
Subject: [PATCH] cifs : fix memory leak on error path
Date: Mon, 19 Oct 2020 18:45:23 +0800 [thread overview]
Message-ID: <1603104323-4438-1-git-send-email-bodefang@126.com> (raw)
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@126.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
reply other threads:[~2020-10-19 11:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1603104323-4438-1-git-send-email-bodefang@126.com \
--to=bodefang@126.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox