diff options
author | Josef Bacik <josef@toxicpanda.com> | 2021-01-25 16:42:35 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2021-02-22 18:07:45 +0100 |
commit | 95c85fba1f64c3249c67f0078a29f8a125078189 (patch) | |
tree | 94759fd6b4bb04faa4daabca4a1c75583be1757d /lib/test_ubsan.c | |
parent | 3660d0bcdb82807d434da9d2e57d88b37331182d (diff) | |
download | linux-stable-95c85fba1f64c3249c67f0078a29f8a125078189.tar.gz linux-stable-95c85fba1f64c3249c67f0078a29f8a125078189.tar.bz2 linux-stable-95c85fba1f64c3249c67f0078a29f8a125078189.zip |
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 'lib/test_ubsan.c')
0 files changed, 0 insertions, 0 deletions