git: kernel - Make sure nl_dvp is non-NULL in a few situations

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Jun 8 14:42:20 PDT 2021


commit aaf02314232b3cf4787a697e85543193215f1699
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Jun 8 14:34:40 2021 -0700

    kernel - Make sure nl_dvp is non-NULL in a few situations
    
    * When NLC_REFDVP is set, nl_dvp should be returned non-NULL
      when the nlookup succeeds.
    
      However, there is one case where nlookup() can succeed but nl_dvp
      can be NULL, and this is when the nlookup() represents a
      mount-point.
    
    * Fix three instances where this case was not being checked and
      could lead to a NULL pointer dereference / kernel panic.
    
    * Do the full resolve treatment for cache_resolve_dvp().  In
      null-mount situations where we have A/B and we null-mount B onto C,
      path resolutions of C via the null mount will resolve B but
      not resolve A.
    
      This breaks an assumption that nlookup() and cache_dvpref()
      make about the parent ncp having a valid vnode.  In fact, the
      parent ncp of B (which is A) might not, because the resolve
      path for B may have bypassed it due to the presence of the null
      mount.
    
    * Should fix occassional 'mkdir /var/cache' calls that fail with
      EINVAL instead of EEXIST.
    
    Reported-by: zach

Summary of changes:
 sys/kern/uipc_usrreq.c  |   2 +
 sys/kern/vfs_cache.c    | 132 ++++++++++++++++++++++++++++++++++++++++++++++++
 sys/kern/vfs_nlookup.c  |  74 ++++++++++++++++++---------
 sys/kern/vfs_syscalls.c |  23 +++++++++
 sys/kern/vfs_vnops.c    |  13 ++++-
 sys/sys/namecache.h     |   2 +
 6 files changed, 222 insertions(+), 24 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/aaf02314232b3cf4787a697e85543193215f1699


-- 
DragonFly BSD source repository


More information about the Commits mailing list