This is a note to let you know that I've just added the patch titled ext4: avoid BUG_ON when creating xattrs to the 6.0-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-avoid-bug_on-when-creating-xattrs.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From b40ebaf63851b3a401b0dc9263843538f64f5ce6 Mon Sep 17 00:00:00 2001 From: Jan Kara <jack@xxxxxxx> Date: Mon, 21 Nov 2022 14:09:29 +0100 Subject: ext4: avoid BUG_ON when creating xattrs From: Jan Kara <jack@xxxxxxx> commit b40ebaf63851b3a401b0dc9263843538f64f5ce6 upstream. Commit fb0a387dcdcd ("ext4: limit block allocations for indirect-block files to < 2^32") added code to try to allocate xattr block with 32-bit block number for indirect block based files on the grounds that these files cannot use larger block numbers. It also added BUG_ON when allocated block could not fit into 32 bits. This is however bogus reasoning because xattr block is stored in inode->i_file_acl and inode->i_file_acl_hi and as such even indirect block based files can happily use full 48 bits for xattr block number. The proper handling seems to be there basically since 64-bit block number support was added. So remove the bogus limitation and BUG_ON. Cc: Eric Sandeen <sandeen@xxxxxxxxxx> Fixes: fb0a387dcdcd ("ext4: limit block allocations for indirect-block files to < 2^32") Signed-off-by: Jan Kara <jack@xxxxxxx> Link: https://lore.kernel.org/r/20221121130929.32031-1-jack@xxxxxxx Signed-off-by: Theodore Ts'o <tytso@xxxxxxx> Cc: stable@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/ext4/xattr.c | 8 -------- 1 file changed, 8 deletions(-) --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2070,19 +2070,11 @@ inserted: goal = ext4_group_first_block_no(sb, EXT4_I(inode)->i_block_group); - - /* non-extent files can't have physical blocks past 2^32 */ - if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) - goal = goal & EXT4_MAX_BLOCK_FILE_PHYS; - block = ext4_new_meta_blocks(handle, inode, goal, 0, NULL, &error); if (error) goto cleanup; - if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) - BUG_ON(block > EXT4_MAX_BLOCK_FILE_PHYS); - ea_idebug(inode, "creating block %llu", (unsigned long long)block); Patches currently in stable-queue which might be from jack@xxxxxxx are queue-6.0/ext4-fix-deadlock-due-to-mbcache-entry-corruption.patch queue-6.0/ext4-fix-use-after-free-in-ext4_orphan_cleanup.patch queue-6.0/ext4-avoid-unaccounted-block-allocation-when-expanding-inode.patch queue-6.0/ext4-check-and-assert-if-marking-an-no_delete-evicting-inode-dirty.patch queue-6.0/ext4-fix-bug_on-in-__es_tree_search-caused-by-bad-boot-loader-inode.patch queue-6.0/ext4-fix-inode-leak-in-ext4_xattr_inode_create-on-an-error-path.patch queue-6.0/ext4-add-helper-to-check-quota-inums.patch queue-6.0/ext4-fix-corruption-when-online-resizing-a-1k-bigalloc-fs.patch queue-6.0/ext4-allocate-extended-attribute-value-in-vmalloc-area.patch queue-6.0/ext4-fix-uninititialized-value-in-ext4_evict_inode.patch queue-6.0/ext4-fix-corrupt-backup-group-descriptors-after-online-resize.patch queue-6.0/ext4-init-quota-for-old.inode-in-ext4_rename.patch queue-6.0/ext4-add-ext4_iget_bad-flag-to-prevent-unexpected-bad-inode.patch queue-6.0/ext4-avoid-bug_on-when-creating-xattrs.patch queue-6.0/ext4-fix-bug_on-in-__es_tree_search-caused-by-bad-quota-inode.patch queue-6.0/ext4-fix-bad-checksum-after-online-resize.patch queue-6.0/ext4-silence-the-warning-when-evicting-inode-with-dioread_nolock.patch queue-6.0/ext2-unbugger-ext2_empty_dir.patch queue-6.0/ext4-initialize-quota-before-expanding-inode-in-setproject-ioctl.patch