aboutsummaryrefslogtreecommitdiffstats
path: root/module/os/freebsd
diff options
context:
space:
mode:
authorAllan Jude <[email protected]>2022-11-28 16:40:49 -0500
committerGitHub <[email protected]>2022-11-28 13:40:49 -0800
commitd27a00283faf4ec2b997ff2376dee4a080e1ca7b (patch)
tree5e60d06b1f5ebc53e1cbf0cff5b8752aab195505 /module/os/freebsd
parent3069872ef5dcffd5343a9165ce08356a840a70d1 (diff)
Avoid a null pointer dereference in zfs_mount() on FreeBSD
When mounting the root filesystem, vfs_t->mnt_vnodecovered is null This will cause zfsctl_is_node() to dereference a null pointer when mounting, or updating the mount flags, on the root filesystem, both of which happen during the boot process. Reported-by: Martin Matuska <[email protected]> Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Richard Yao <[email protected]> Signed-off-by: Allan Jude <[email protected]> Closes #14218
Diffstat (limited to 'module/os/freebsd')
-rw-r--r--module/os/freebsd/zfs/zfs_vfsops.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/module/os/freebsd/zfs/zfs_vfsops.c b/module/os/freebsd/zfs/zfs_vfsops.c
index b4c122bdf..ffe631764 100644
--- a/module/os/freebsd/zfs/zfs_vfsops.c
+++ b/module/os/freebsd/zfs/zfs_vfsops.c
@@ -1328,7 +1328,8 @@ zfs_mount(vfs_t *vfsp)
}
fetch_osname_options(osname, &checkpointrewind);
- isctlsnap = (zfsctl_is_node(mvp) && strchr(osname, '@') != NULL);
+ isctlsnap = (mvp != NULL && zfsctl_is_node(mvp) &&
+ strchr(osname, '@') != NULL);
/*
* Check for mount privilege?