Skip to content

Commit 313ef70

Browse files
adam900710kdave
authored andcommitted
btrfs: fix a potential path leak in print_data_reloc_error()
Inside print_data_reloc_error(), if extent_from_logical() failed we return immediately. However there are the following cases where extent_from_logical() can return error but still holds a path: - btrfs_search_slot() returned 0 - No backref item found in extent tree - No flags_ret provided This is not possible in this call site though. So for the above two cases, we can return without releasing the path, causing extent buffer leaks. Fixes: b9a9a85 ("btrfs: output affected files when relocation fails") Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 428e1b1 commit 313ef70

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fs/btrfs/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ static void print_data_reloc_error(const struct btrfs_inode *inode, u64 file_off
255255
if (ret < 0) {
256256
btrfs_err_rl(fs_info, "failed to lookup extent item for logical %llu: %d",
257257
logical, ret);
258+
btrfs_release_path(&path);
258259
return;
259260
}
260261
eb = path.nodes[0];

0 commit comments

Comments
 (0)