]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix silent failure when deleting root reference
authorFilipe Manana <fdmanana@suse.com>
Mon, 22 Aug 2022 14:47:09 +0000 (15:47 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Sep 2022 08:27:43 +0000 (10:27 +0200)
commitb32dab336d599b144d83a2ce4d542a2efb96553a
tree794db5c7753c0bdd4ed6702faf8739a8aa6599e3
parente9b8f3a3f6c92b8e1406177eb8042cf409c63839
btrfs: fix silent failure when deleting root reference

commit 1a1af01ede05a00db90546af848af6dcfe69ceef upstream.

At btrfs_del_root_ref(), if btrfs_search_slot() returns an error, we end
up returning from the function with a value of 0 (success). This happens
because the function returns the value stored in the variable 'err',
which is 0, while the error value we got from btrfs_search_slot() is
stored in the 'ret' variable.

So fix it by setting 'err' with the error value.

Fixes: 1efedfdf7e61ce ("btrfs: replace the BUG_ON in btrfs_del_root_ref with proper error handling")
CC: stable@vger.kernel.org # 5.16+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/root-tree.c