netfs, 9p: Fix race between umount and async request completion
There's a problem in 9p's interaction with netfslib whereby a crash occurs because the 9p_fid structs get forcibly destroyed during client teardown (without paying attention to their refcounts) before netfslib has finished with them. However, it's not a simple case of deferring the clunking that p9_fid_put() does as that requires the p9_client record to still be present. The problem is that netfslib has to unlock pages and clear the IN_PROGRESS flag before destroying the objects involved - including the fid - and, in any case, nothing checks to see if writeback completed barring looking at the page flags. Fix this by keeping a count of outstanding I/O requests (of any type) and waiting for it to quiesce during inode eviction. Reported-by:<syzbot+df038d463cca332e8414@syzkaller.appspotmail.com> Link: https://lore.kernel.org/all/0000000000005be0aa061846f8d6@google.com/ Reported-by:
<syzbot+d7c7a495a5e466c031b6@syzkaller.appspotmail.com> Link: h...
Showing
- fs/9p/vfs_inode.c 1 addition, 0 deletionsfs/9p/vfs_inode.c
- fs/afs/inode.c 1 addition, 0 deletionsfs/afs/inode.c
- fs/netfs/objects.c 5 additions, 0 deletionsfs/netfs/objects.c
- fs/smb/client/cifsfs.c 1 addition, 0 deletionsfs/smb/client/cifsfs.c
- include/linux/netfs.h 18 additions, 0 deletionsinclude/linux/netfs.h
Please register or sign in to comment