]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix ulist leaks in error paths of qgroup self tests
authorFilipe Manana <fdmanana@suse.com>
Tue, 1 Nov 2022 16:15:39 +0000 (16:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2022 16:57:52 +0000 (17:57 +0100)
commit2e968743b5be3b1d6910f3ea2ec6c6645593b76b
tree497323180c5f66518cbdfb0f6b1d6014306eea15
parent64ae3780fda979f054490c6c93242502e5a00399
btrfs: fix ulist leaks in error paths of qgroup self tests

[ Upstream commit 7e94333f2238e3e49829f304e0381c35061b1cbf ]

In the test_no_shared_qgroup() and test_multiple_refs() qgroup self tests,
if we fail to add the tree ref, remove the extent item or remove the
extent ref, we are returning from the test function without freeing the
"old_roots" ulist that was allocated by the previous calls to
btrfs_find_all_roots(). Fix that by calling ulist_free() before returning.

Fixes: ead7e1afe481 ("btrfs: qgroup: Switch self test to extent-oriented qgroup mechanism.")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/tests/qgroup-tests.c