From: Greg Kroah-Hartman Date: Mon, 9 May 2022 08:49:05 +0000 (+0200) Subject: 5.15-stable patches X-Git-Tag: v4.9.313~89 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f6228312df092e876309f548b58e476b6557a210;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: btrfs-do-not-bug_on-on-failure-to-update-inode-when-setting-xattr.patch --- diff --git a/queue-5.15/btrfs-do-not-bug_on-on-failure-to-update-inode-when-setting-xattr.patch b/queue-5.15/btrfs-do-not-bug_on-on-failure-to-update-inode-when-setting-xattr.patch new file mode 100644 index 00000000000..93f68b470fc --- /dev/null +++ b/queue-5.15/btrfs-do-not-bug_on-on-failure-to-update-inode-when-setting-xattr.patch @@ -0,0 +1,52 @@ +From 193b4e83986d7ee6caa8ceefb5ee9f58240fbee0 Mon Sep 17 00:00:00 2001 +From: Filipe Manana +Date: Thu, 21 Apr 2022 11:03:09 +0100 +Subject: btrfs: do not BUG_ON() on failure to update inode when setting xattr + +From: Filipe Manana + +commit 193b4e83986d7ee6caa8ceefb5ee9f58240fbee0 upstream. + +We are doing a BUG_ON() if we fail to update an inode after setting (or +clearing) a xattr, but there's really no reason to not instead simply +abort the transaction and return the error to the caller. This should be +a rare error because we have previously reserved enough metadata space to +update the inode and the delayed inode should have already been setup, so +an -ENOSPC or -ENOMEM, which are the possible errors, are very unlikely to +happen. + +So replace the BUG_ON()s with a transaction abort. + +CC: stable@vger.kernel.org # 4.9+ +Reviewed-by: Qu Wenruo +Reviewed-by: Anand Jain +Signed-off-by: Filipe Manana +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman +--- + fs/btrfs/xattr.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/fs/btrfs/xattr.c ++++ b/fs/btrfs/xattr.c +@@ -264,7 +264,8 @@ int btrfs_setxattr_trans(struct inode *i + inode_inc_iversion(inode); + inode->i_ctime = current_time(inode); + ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); +- BUG_ON(ret); ++ if (ret) ++ btrfs_abort_transaction(trans, ret); + out: + if (start_trans) + btrfs_end_transaction(trans); +@@ -418,7 +419,8 @@ static int btrfs_xattr_handler_set_prop( + inode_inc_iversion(inode); + inode->i_ctime = current_time(inode); + ret = btrfs_update_inode(trans, root, BTRFS_I(inode)); +- BUG_ON(ret); ++ if (ret) ++ btrfs_abort_transaction(trans, ret); + } + + btrfs_end_transaction(trans); diff --git a/queue-5.15/series b/queue-5.15/series index 479a73c27c1..d22481fcc0c 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -20,3 +20,4 @@ firewire-fix-potential-uaf-in-outbound_phy_packet_callback.patch firewire-remove-check-of-list-iterator-against-head-past-the-loop-body.patch firewire-core-extend-card-lock-in-fw_core_handle_bus_reset.patch net-stmmac-disable-split-header-sph-for-intel-platforms.patch +btrfs-do-not-bug_on-on-failure-to-update-inode-when-setting-xattr.patch