git: DragonFly_RELEASE_6_0 kernel - Make sure nl_dvp is non-NULL in a few situations
dillon at crater.dragonflybsd.org
Mon Jun 14 14:14:13 PDT 2021
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
* 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
* Should fix occassional 'mkdir /var/cache' calls that fail with
EINVAL instead of EEXIST.
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(-)
DragonFly BSD source repository
More information about the Commits