mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
f2fs: fix listxattr handling of corrupted xattr entries
Validate the xattr entry before reading its fields in f2fs_listxattr().
Return -EFSCORRUPTED when the entry is outside the valid xattr storage
area instead of returning a successful partial result.
Fixes: 688078e7f3 ("f2fs: fix to avoid memory leakage in f2fs_listxattr")
Cc: stable@kernel.org
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Keshav Verma <iganschel@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
34636c6dcd
commit
5ef5bc304f
|
|
@ -583,8 +583,6 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
|
|||
size_t prefix_len;
|
||||
size_t size;
|
||||
|
||||
prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
|
||||
|
||||
if ((void *)(entry) + sizeof(__u32) > last_base_addr ||
|
||||
(void *)XATTR_NEXT_ENTRY(entry) > last_base_addr) {
|
||||
f2fs_err(F2FS_I_SB(inode), "list inode (%llu) has corrupted xattr",
|
||||
|
|
@ -594,9 +592,11 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
|
|||
ERROR_CORRUPTED_XATTR);
|
||||
fserror_report_file_metadata(inode,
|
||||
-EFSCORRUPTED, GFP_NOFS);
|
||||
break;
|
||||
error = -EFSCORRUPTED;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
|
||||
if (!prefix)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user