This is a note to let you know that I've just added the patch titled ext4: initialize quota before expanding inode in setproject ioctl to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ext4-initialize-quota-before-expanding-inode-in-setproject-ioctl.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 1485f726c6dec1a1f85438f2962feaa3d585526f Mon Sep 17 00:00:00 2001 From: Jan Kara <jack@xxxxxxx> Date: Wed, 7 Dec 2022 12:59:27 +0100 Subject: ext4: initialize quota before expanding inode in setproject ioctl From: Jan Kara <jack@xxxxxxx> commit 1485f726c6dec1a1f85438f2962feaa3d585526f upstream. Make sure we initialize quotas before possibly expanding inode space (and thus maybe needing to allocate external xattr block) in ext4_ioctl_setproject(). This prevents not accounting the necessary block allocation. Signed-off-by: Jan Kara <jack@xxxxxxx> Cc: stable@xxxxxxxxxx Link: https://lore.kernel.org/r/20221207115937.26601-1-jack@xxxxxxx Signed-off-by: Theodore Ts'o <tytso@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/ext4/ioctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -495,6 +495,10 @@ static int ext4_ioctl_setproject(struct if (ext4_is_quota_file(inode)) return err; + err = dquot_initialize(inode); + if (err) + return err; + err = ext4_get_inode_loc(inode, &iloc); if (err) return err; @@ -510,10 +514,6 @@ static int ext4_ioctl_setproject(struct brelse(iloc.bh); } - err = dquot_initialize(inode); - if (err) - return err; - handle = ext4_journal_start(inode, EXT4_HT_QUOTA, EXT4_QUOTA_INIT_BLOCKS(sb) + EXT4_QUOTA_DEL_BLOCKS(sb) + 3); Patches currently in stable-queue which might be from jack@xxxxxxx are queue-5.10/udf-avoid-double-brelse-in-udf_rename.patch queue-5.10/ext4-fix-use-after-free-in-ext4_orphan_cleanup.patch queue-5.10/ext4-avoid-unaccounted-block-allocation-when-expanding-inode.patch queue-5.10/ext4-check-and-assert-if-marking-an-no_delete-evicting-inode-dirty.patch queue-5.10/ext4-fix-bug_on-in-__es_tree_search-caused-by-bad-boot-loader-inode.patch queue-5.10/ext4-fix-inode-leak-in-ext4_xattr_inode_create-on-an-error-path.patch queue-5.10/ext4-add-helper-to-check-quota-inums.patch queue-5.10/ext4-fix-corruption-when-online-resizing-a-1k-bigalloc-fs.patch queue-5.10/ext4-allocate-extended-attribute-value-in-vmalloc-area.patch queue-5.10/ext4-init-quota-for-old.inode-in-ext4_rename.patch queue-5.10/ext4-add-ext4_iget_bad-flag-to-prevent-unexpected-bad-inode.patch queue-5.10/ext4-avoid-bug_on-when-creating-xattrs.patch queue-5.10/ext4-fix-bug_on-in-__es_tree_search-caused-by-bad-quota-inode.patch queue-5.10/ext4-silence-the-warning-when-evicting-inode-with-dioread_nolock.patch queue-5.10/ext4-initialize-quota-before-expanding-inode-in-setproject-ioctl.patch