Skip to content

Commit

Permalink
Bugfix: Avoid a null pointer dereference in zfs_mount() on FreeBSD
Browse files Browse the repository at this point in the history
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 <mm@FreeBSD.org>
Sponsored-by: Klara, Inc.
Signed-off-by: Allan Jude <allan@klarasystems.com>
  • Loading branch information
allanjude committed Nov 23, 2022
1 parent b0657a5 commit 422f474
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion module/os/freebsd/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ 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?
Expand Down

0 comments on commit 422f474

Please sign in to comment.