• N
    fs: fix superblock iteration race · 57439f87
    npiggin@suse.de 提交于
    list_for_each_entry_safe is not suitable to protect against concurrent
    modification of the list. 6754af64 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: NNick Piggin <npiggin@suse.de>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: John Stultz <johnstul@us.ibm.com>
    Cc: Frank Mayhar <fmayhar@google.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    57439f87
list.h 21.1 KB