diff options
author | Ye Bin <yebin10@huawei.com> | 2022-12-08 10:32:31 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-07 11:12:02 +0100 |
commit | f06a3cff1b4e4b1b5edfd5031aa58e679064db01 (patch) | |
tree | 28ab6ff0e90f2214caa7c6ff6605d0c7996415f8 /fs | |
parent | 56ecd5509fdc76af2b70a9090af15829c21d04b2 (diff) | |
download | linux-stable-f06a3cff1b4e4b1b5edfd5031aa58e679064db01.tar.gz linux-stable-f06a3cff1b4e4b1b5edfd5031aa58e679064db01.tar.bz2 linux-stable-f06a3cff1b4e4b1b5edfd5031aa58e679064db01.zip |
ext4: allocate extended attribute value in vmalloc area
commit cc12a6f25e07ed05d5825a1664b67a970842b2ca upstream.
Now, extended attribute value maximum length is 64K. The memory
requested here does not need continuous physical addresses, so it is
appropriate to use kvmalloc to request memory. At the same time, it
can also cope with the situation that the extended attribute will
become longer in the future.
Signed-off-by: Ye Bin <yebin10@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20221208023233.1231330-3-yebin@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/xattr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 2308ed061f97..866772a2e068 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2550,7 +2550,7 @@ static int ext4_xattr_move_to_block(handle_t *handle, struct inode *inode, is = kzalloc(sizeof(struct ext4_xattr_ibody_find), GFP_NOFS); bs = kzalloc(sizeof(struct ext4_xattr_block_find), GFP_NOFS); - buffer = kmalloc(value_size, GFP_NOFS); + buffer = kvmalloc(value_size, GFP_NOFS); b_entry_name = kmalloc(entry->e_name_len + 1, GFP_NOFS); if (!is || !bs || !buffer || !b_entry_name) { error = -ENOMEM; @@ -2602,7 +2602,7 @@ static int ext4_xattr_move_to_block(handle_t *handle, struct inode *inode, error = 0; out: kfree(b_entry_name); - kfree(buffer); + kvfree(buffer); if (is) brelse(is->iloc.bh); if (bs) |