aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/nullfs
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2019-02-08 08:17:31 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2019-02-08 08:17:31 +0000
commit25728e8411704dc40ac2e46d79d8b44f0ae76f82 (patch)
tree0eecb0d5cfbf3e68ba948cefdd9b58207e2b58c8 /sys/fs/nullfs
parent930cc2dbef3d6493d5f7bd71a24386ad51c6884a (diff)
downloadsrc-25728e8411704dc40ac2e46d79d8b44f0ae76f82.tar.gz
src-25728e8411704dc40ac2e46d79d8b44f0ae76f82.zip
Before using VTONULL(), check that the covered vnode belongs to nullfs.
Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week
Notes
Notes: svn path=/head/; revision=343898
Diffstat (limited to 'sys/fs/nullfs')
-rw-r--r--sys/fs/nullfs/null_vfsops.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index d68d02991034..fdb5e9e7e7e0 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -145,10 +145,13 @@ nullfs_mount(struct mount *mp)
/*
* Check multi null mount to avoid `lock against myself' panic.
*/
- if (lowerrootvp == VTONULL(mp->mnt_vnodecovered)->null_lowervp) {
- NULLFSDEBUG("nullfs_mount: multi null mount?\n");
- vput(lowerrootvp);
- return (EDEADLK);
+ if (mp->mnt_vnodecovered->v_op == &null_vnodeops) {
+ nn = VTONULL(mp->mnt_vnodecovered);
+ if (nn == NULL || lowerrootvp == nn->null_lowervp) {
+ NULLFSDEBUG("nullfs_mount: multi null mount?\n");
+ vput(lowerrootvp);
+ return (EDEADLK);
+ }
}
xmp = (struct null_mount *) malloc(sizeof(struct null_mount),