• Linus Torvalds's avatar
    Merge tag 'pull-fixes.pathwalk-rcu-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 66a97c2e
    Linus Torvalds authored
    Pull RCU pathwalk fixes from Al Viro:
     "We still have some races in filesystem methods when exposed to RCU
      pathwalk. This series is a result of code audit (the second round of
      it) and it should deal with most of that stuff.
    
      Still pending: ntfs3 ->d_hash()/->d_compare() and ceph_d_revalidate().
      Up to maintainers (a note for NTFS folks - when documentation says
      that a method may not block, it *does* imply that blocking allocations
      are to be avoided. Really)"
    
    [ More explanations for people who aren't familiar with the vagaries of
      RCU path walking: most of it is hidden from filesystems, but if a
      filesystem actively participates in the low-level path walking it
      needs to make sure the fields involved in that walk are RCU-safe.
    
      That "actively participate in low-level path walking" includes things
      like having its own ->d_hash()/->d_compare() routines, or by having
      its own directory permission function that doesn't just use the common
      helpers.  Having a ->d_revalidate() function will also have this issue.
    
      Note that instead of making everything RCU safe you can also choose to
      abort the RCU pathwalk if your operation cannot be done safely under
      RCU, but that obviously comes with a performance penalty. One common
      pattern is to allow the simple cases under RCU, and abort only if you
      need to do something more complicated.
    
      So not everything needs to be RCU-safe, and things like the inode etc
      that the VFS itself maintains obviously already are. But these fixes
      tend to be about properly RCU-delaying things like ->s_fs_info that
      are maintained by the filesystem and that got potentially released too
      early.   - Linus ]
    
    * tag 'pull-fixes.pathwalk-rcu-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
      ext4_get_link(): fix breakage in RCU mode
      cifs_get_link(): bail out in unsafe case
      fuse: fix UAF in rcu pathwalks
      procfs: make freeing proc_fs_info rcu-delayed
      procfs: move dropping pde and pid from ->evict_inode() to ->free_inode()
      nfs: fix UAF on pathwalk running into umount
      nfs: make nfs_set_verifier() safe for use in RCU pathwalk
      afs: fix __afs_break_callback() / afs_drop_open_mmap() race
      hfsplus: switch to rcu-delayed unloading of nls and freeing ->s_fs_info
      exfat: move freeing sbi, upcase table and dropping nls into rcu-delayed helper
      affs: free affs_sb_info with kfree_rcu()
      rcu pathwalk: prevent bogus hard errors from may_lookup()
      fs/super.c: don't drop ->s_user_ns until we free struct super_block itself
    66a97c2e
cifsfs.c 55 KB