]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
btrfs: tree-log: check btrfs_lookup_data_extent return value
authorMarcos Paulo de Souza <mpdesouza@suse.com>
Mon, 2 Aug 2021 12:34:00 +0000 (09:34 -0300)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 5 Nov 2021 09:18:43 +0000 (10:18 +0100)
commit0af22cf3af7c6a7798cd9c8f0ab15cccdbc469ce
treee2e5910633f5054bce01d874d7422973cc5884cf
parent8bc00cfaf51fc84cf8651915ba7344d7f70e54a6
btrfs: tree-log: check btrfs_lookup_data_extent return value

BugLink: https://bugs.launchpad.net/bugs/1947781
[ Upstream commit 3736127a3aa805602b7a2ad60ec9cfce68065fbb ]

Function btrfs_lookup_data_extent calls btrfs_search_slot to verify if
the EXTENT_ITEM exists in the extent tree. btrfs_search_slot can return
values bellow zero if an error happened.

Function replay_one_extent currently checks if the search found
something (0 returned) and increments the reference, and if not, it
seems to evaluate as 'not found'.

Fix the condition by checking if the value was bellow zero and return
early.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
fs/btrfs/tree-log.c