linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>,
	<linux-cifsd-devel@lists.sourceforge.net>,
	<linux-cifs@vger.kernel.org>
Cc: <namjae.jeon@samsung.com>, <sergey.senozhatsky@gmail.com>,
	<sfrench@samba.org>, <hyc.lee@gmail.com>
Subject: [PATCH -next 1/3] cifsd: fix memleak in ksmbd_vfs_stream_write()
Date: Sat, 29 May 2021 16:20:56 +0800	[thread overview]
Message-ID: <20210529082058.3012233-1-yangyingliang@huawei.com> (raw)

Before assigning wbuf to stream_buf, memory allocate in
ksmbd_vfs_getcasexattr() need be freed.

Fixes: f44158485826 ("cifsd: add file operations")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 fs/cifsd/vfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifsd/vfs.c b/fs/cifsd/vfs.c
index 291953eff5fa..9057b30278b9 100644
--- a/fs/cifsd/vfs.c
+++ b/fs/cifsd/vfs.c
@@ -429,6 +429,7 @@ static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos,
 
 		if (v_len > 0)
 			memcpy(wbuf, stream_buf, v_len);
+		kfree(stream_buf);
 		stream_buf = wbuf;
 	}
 
-- 
2.25.1


             reply	other threads:[~2021-05-29  8:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210529081635epcas1p130adfff1e044c7749f059e413ad4e8b8@epcas1p1.samsung.com>
2021-05-29  8:20 ` Yang Yingliang [this message]
2021-05-29  8:20   ` [PATCH -next 2/3] cifsd: fix memleak in ksmbd_vfs_stream_read() Yang Yingliang
2021-05-31  1:09     ` Namjae Jeon
2021-05-29  8:20   ` [PATCH -next 3/3] cifsd: check return value of ksmbd_vfs_getcasexattr() correctly Yang Yingliang
2021-05-29 14:13     ` Hyunchul Lee
2021-05-31  1:09   ` [PATCH -next 1/3] cifsd: fix memleak in ksmbd_vfs_stream_write() Namjae Jeon

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=20210529082058.3012233-1-yangyingliang@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=hyc.lee@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-cifsd-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namjae.jeon@samsung.com \
    --cc=sergey.senozhatsky@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).