aboutsummaryrefslogtreecommitdiffstats
path: root/lib/linear_ranges.c
diff options
context:
space:
mode:
authorXiyu Yang <[email protected]>2020-04-20 05:39:39 +0000
committerDavid Sterba <[email protected]>2020-04-23 15:24:56 +0000
commit1402d17dfd9657be0da8458b2079d03c2d61c86a (patch)
tree6b7e86fd65a27538cdfac75edbb640c39bcb08eb /lib/linear_ranges.c
parentbtrfs: fix block group leak when removing fails (diff)
downloadkernel-1402d17dfd9657be0da8458b2079d03c2d61c86a.tar.gz
kernel-1402d17dfd9657be0da8458b2079d03c2d61c86a.zip
btrfs: fix transaction leak in btrfs_recover_relocation
btrfs_recover_relocation() invokes btrfs_join_transaction(), which joins a btrfs_trans_handle object into transactions and returns a reference of it with increased refcount to "trans". When btrfs_recover_relocation() returns, "trans" becomes invalid, so the refcount should be decreased to keep refcount balanced. The reference counting issue happens in one exception handling path of btrfs_recover_relocation(). When read_fs_root() failed, the refcnt increased by btrfs_join_transaction() is not decreased, causing a refcnt leak. Fix this issue by calling btrfs_end_transaction() on this error path when read_fs_root() failed. Fixes: 79787eaab461 ("btrfs: replace many BUG_ONs with proper error handling") CC: [email protected] # 4.4+ Reviewed-by: Filipe Manana <[email protected]> Signed-off-by: Xiyu Yang <[email protected]> Signed-off-by: Xin Tan <[email protected]> Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'lib/linear_ranges.c')
0 files changed, 0 insertions, 0 deletions