summaryrefslogtreecommitdiff
path: root/fs/ext2
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@mykernel.net>2020-06-26 13:49:59 +0800
committerJan Kara <jack@suse.cz>2020-07-09 08:14:01 +0200
commit1197d04fd3f1daf75cfd0a68442080186e546178 (patch)
tree6207050ad8eb190b60fb8c0b4e8f7abbe6a7377d /fs/ext2
parentcf1013f441eb997ae770566f88cf021086d34cff (diff)
ext2: initialize quota info in ext2_xattr_set()
In order to correctly account/limit space usage, should initialize quota info before calling quota related functions. Link: https://lore.kernel.org/r/20200626054959.114177-1-cgxu519@mykernel.net Signed-off-by: Chengguang Xu <cgxu519@mykernel.net> Reviewed-by: Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/xattr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index c802ea682e7f..841fa6d9d744 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -437,6 +437,9 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
name_len = strlen(name);
if (name_len > 255 || value_len > sb->s_blocksize)
return -ERANGE;
+ error = dquot_initialize(inode);
+ if (error)
+ return error;
down_write(&EXT2_I(inode)->xattr_sem);
if (EXT2_I(inode)->i_file_acl) {
/* The inode already has an extended attribute block. */