From f9ceb7c7b5dcad26a6ba4a2e1b7df01791349c02 Mon Sep 17 00:00:00 2001 From: David Greenman Date: Mon, 27 Feb 1995 06:50:08 +0000 Subject: [PATCH] Initialize v_rdev in getnewvnode() - it appears that some filesystems may not properly initialize this field in all cases, and this would result in very anti-social behavior (overwriting on some other random device/location). Submitted by: John Dyson --- sys/kern/vfs_export.c | 5 +++-- sys/kern/vfs_subr.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index b1da08036a65..7962a6a86d0d 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94 - * $Id: vfs_subr.c,v 1.15 1995/01/10 07:32:36 davidg Exp $ + * $Id: vfs_subr.c,v 1.16 1995/02/22 09:39:22 davidg Exp $ */ /* @@ -370,8 +370,9 @@ getnewvnode(tag, mp, vops, vpp) vp->v_socket = 0; vp->v_writecount = 0; /* XXX */ } - vp->v_type = VNON; cache_purge(vp); + vp->v_type = VNON; + vp->v_rdev = NODEV; vp->v_tag = tag; vp->v_op = vops; insmntque(vp, mp); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index b1da08036a65..7962a6a86d0d 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94 - * $Id: vfs_subr.c,v 1.15 1995/01/10 07:32:36 davidg Exp $ + * $Id: vfs_subr.c,v 1.16 1995/02/22 09:39:22 davidg Exp $ */ /* @@ -370,8 +370,9 @@ getnewvnode(tag, mp, vops, vpp) vp->v_socket = 0; vp->v_writecount = 0; /* XXX */ } - vp->v_type = VNON; cache_purge(vp); + vp->v_type = VNON; + vp->v_rdev = NODEV; vp->v_tag = tag; vp->v_op = vops; insmntque(vp, mp);