diff options
author | Josef Bacik <josef@toxicpanda.com> | 2021-01-26 00:42:35 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2021-02-22 20:07:45 +0300 |
commit | 95c85fba1f64c3249c67f0078a29f8a125078189 (patch) | |
tree | 94759fd6b4bb04faa4daabca4a1c75583be1757d /fs/btrfs/ref-verify.c | |
parent | 3660d0bcdb82807d434da9d2e57d88b37331182d (diff) | |
download | linux-95c85fba1f64c3249c67f0078a29f8a125078189.tar.xz |
btrfs: avoid double put of block group when emptying cluster
It's wrong calling btrfs_put_block_group in
__btrfs_return_cluster_to_free_space if the block group passed is
different than the block group the cluster represents. As this means the
cluster doesn't have a reference to the passed block group. This results
in double put and a use-after-free bug.
Fix this by simply bailing if the block group we passed in does not
match the block group on the cluster.
Fixes: fa9c0d795f7b ("Btrfs: rework allocation clustering")
CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ref-verify.c')
0 files changed, 0 insertions, 0 deletions