From c30c6a2311ce011b397664715a52c72ba73b0b05 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sat, 19 Feb 2011 07:47:25 +0000 Subject: [PATCH] v_mountedhere is a member of the union. Check that the vnodes have proper type before using the member. Reported and tested by: Michael Butler --- sys/ufs/ufs/ufs_vnops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 084971eddfc8..34b1758d471a 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1295,7 +1295,9 @@ relock: newparent = tdp->i_number; doingdirectory = 1; } - if (fvp->v_mountedhere != NULL || (tvp && tvp->v_mountedhere != NULL)) { + if ((fvp->v_type == VDIR && fvp->v_mountedhere != NULL) || + (tvp != NULL && tvp->v_type == VDIR && + tvp->v_mountedhere != NULL)) { error = EXDEV; goto unlockout; }