mirror of
https://github.com/torvalds/linux.git
synced 2024-10-31 09:11:49 +00:00
btrfs: Check name_len before reading btrfs_get_name
In btrfs_get_name, there's btrfs_search_slot and reads name from inode_ref/root_ref. Call btrfs_is_name_len_valid in btrfs_get_name. Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
59b0a7f2c7
commit
488d7c4566
@ -282,6 +282,11 @@ static int btrfs_get_name(struct dentry *parent, char *name,
|
||||
name_len = btrfs_inode_ref_name_len(leaf, iref);
|
||||
}
|
||||
|
||||
ret = btrfs_is_name_len_valid(leaf, path->slots[0], name_ptr, name_len);
|
||||
if (!ret) {
|
||||
btrfs_free_path(path);
|
||||
return -EIO;
|
||||
}
|
||||
read_extent_buffer(leaf, name, name_ptr, name_len);
|
||||
btrfs_free_path(path);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user