fs: fix superblock iteration race
list_for_each_entry_safe is not suitable to protect against concurrent
modification of the list. 6754af6 introduced a race in sb walking.
list_for_each_entry can use the trick of pinning the current entry in
the list before we drop and retake the lock because it subsequently
follows cur->next. However list_for_each_entry_safe saves n=cur->next
for following before entering the loop body, so when the lock is
dropped, n may be deleted.
Signed-off-by: Nick Piggin <firstname.lastname@example.org>
Cc: Christoph Hellwig <email@example.com>
Cc: John Stultz <firstname.lastname@example.org>
Cc: Frank Mayhar <email@example.com>
Cc: Al Viro <firstname.lastname@example.org>
Signed-off-by: Linus Torvalds <email@example.com>
3 files changed