diff options
| author | Haoxiang Li <haoxiang_li2024@163.com> | 2025-03-03 10:42:33 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-03-13 13:07:42 +0100 |
| commit | 72b6b93970fc05986738eabf8f2e538a5f8a71fa (patch) | |
| tree | d080aa7e4cdf991f231faa4eca631e48bfb173d9 /fs | |
| parent | 3fcff2f55389306482ab049b4321bda49495e546 (diff) | |
| download | linux-72b6b93970fc05986738eabf8f2e538a5f8a71fa.tar.gz linux-72b6b93970fc05986738eabf8f2e538a5f8a71fa.tar.bz2 linux-72b6b93970fc05986738eabf8f2e538a5f8a71fa.zip | |
btrfs: fix a leaked chunk map issue in read_one_chunk()
commit 35d99c68af40a8ca175babc5a89ef7e2226fb3ca upstream.
Add btrfs_free_chunk_map() to free the memory allocated
by btrfs_alloc_chunk_map() if btrfs_add_chunk_map() fails.
Fixes: 7dc66abb5a47 ("btrfs: use a dedicated data structure for chunk maps")
CC: stable@vger.kernel.org
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/btrfs/volumes.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 3d0ac8bdb21f..083841e45689 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -7076,6 +7076,7 @@ static int read_one_chunk(struct btrfs_key *key, struct extent_buffer *leaf, btrfs_err(fs_info, "failed to add chunk map, start=%llu len=%llu: %d", map->start, map->chunk_len, ret); + btrfs_free_chunk_map(map); } return ret; |
