]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
f2fs: fix to avoid memory leakage in f2fs_listxattr
authorRandall Huang <huangrandall@google.com>
Fri, 18 Oct 2019 06:56:22 +0000 (14:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Apr 2020 14:31:17 +0000 (16:31 +0200)
commited523cbd4a6594edf123dc03ec9d70ea4f793671
tree11ccbd2707a95320f861d3a27360f1f64863f1e3
parent6d1444dbf949f78af996a044d39838b1a8d8de3d
f2fs: fix to avoid memory leakage in f2fs_listxattr

commit 688078e7f36c293dae25b338ddc9e0a2790f6e06 upstream.

In f2fs_listxattr, there is no boundary check before
memcpy e_name to buffer.
If the e_name_len is corrupted,
unexpected memory contents may be returned to the buffer.

Signed-off-by: Randall Huang <huangrandall@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
[bwh: Backported to 4.19: Use f2fs_msg() instead of f2fs_err()]
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/xattr.c