diff mbox series

[-next,2/3] cifsd: fix memleak in ksmbd_vfs_stream_read()

Message ID 20210529082058.3012233-2-yangyingliang@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next,1/3] cifsd: fix memleak in ksmbd_vfs_stream_write() | expand

Commit Message

Yang Yingliang May 29, 2021, 8:20 a.m. UTC
Before ksmbd_vfs_stream_read() return, 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(+)

Comments

Namjae Jeon May 31, 2021, 1:09 a.m. UTC | #1
> Before ksmbd_vfs_stream_read() return, memory allocate in
> ksmbd_vfs_getcasexattr() need be freed.
> 
> Fixes: f44158485826 ("cifsd: add file operations")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
I will apply, Thanks for your patch!
diff mbox series

Patch

diff --git a/fs/cifsd/vfs.c b/fs/cifsd/vfs.c
index 9057b30278b9..97d5584ec870 100644
--- a/fs/cifsd/vfs.c
+++ b/fs/cifsd/vfs.c
@@ -290,6 +290,7 @@  static int ksmbd_vfs_stream_read(struct ksmbd_file *fp, char *buf, loff_t *pos,
 	}
 
 	memcpy(buf, &stream_buf[*pos], count);
+	kfree(stream_buf);
 	return v_len > count ? count : v_len;
 }