From: Matthew Wilcox Date: Wed, 14 Dec 2016 23:08:46 +0000 (-0800) Subject: btrfs: fix race in btrfs_free_dummy_fs_info() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b35df27a39f40e39fabf1b1e9569c7b24e1add6a;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git btrfs: fix race in btrfs_free_dummy_fs_info() We drop the lock which protects the radix tree, so we must call radix_tree_iter_next() in order to avoid a modification to the tree invalidating the iterator state. Link: http://lkml.kernel.org/r/1480369871-5271-54-git-send-email-mawilcox@linuxonhyperv.com Signed-off-by: Matthew Wilcox Tested-by: Kirill A. Shutemov Cc: Konstantin Khlebnikov Cc: Ross Zwisler Cc: Matthew Wilcox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c index bf62ad919a95..73076a0ea6a9 100644 --- a/fs/btrfs/tests/btrfs-tests.c +++ b/fs/btrfs/tests/btrfs-tests.c @@ -162,6 +162,7 @@ void btrfs_free_dummy_fs_info(struct btrfs_fs_info *fs_info) slot = radix_tree_iter_retry(&iter); continue; } + slot = radix_tree_iter_next(&iter); spin_unlock(&fs_info->buffer_lock); free_extent_buffer_stale(eb); spin_lock(&fs_info->buffer_lock);