diff options
| author | David Greenman <dg@FreeBSD.org> | 1996-06-12 03:37:57 +0000 |
|---|---|---|
| committer | David Greenman <dg@FreeBSD.org> | 1996-06-12 03:37:57 +0000 |
| commit | 2f9bae59d66ce0d8d74807af1036164af819f415 (patch) | |
| tree | 0244ce546b0fc6e415af50b64cc8c473ae6be049 /sys/miscfs/nullfs/null_subr.c | |
| parent | 74ae43213c20d95600f6d890cd539b3bcda44b1d (diff) | |
Notes
Diffstat (limited to 'sys/miscfs/nullfs/null_subr.c')
| -rw-r--r-- | sys/miscfs/nullfs/null_subr.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/miscfs/nullfs/null_subr.c b/sys/miscfs/nullfs/null_subr.c index e5fa5900ccf9..4123dc2e7d5f 100644 --- a/sys/miscfs/nullfs/null_subr.c +++ b/sys/miscfs/nullfs/null_subr.c @@ -35,7 +35,7 @@ * * @(#)null_subr.c 8.4 (Berkeley) 1/21/94 * - * $Id: null_subr.c,v 1.4 1995/12/03 14:38:49 bde Exp $ + * $Id: null_subr.c,v 1.5 1995/12/03 14:54:22 bde Exp $ */ #include <sys/param.h> @@ -162,12 +162,20 @@ null_node_alloc(mp, lowervp, vpp) struct vnode *othervp, *vp; int error; + /* + * Do the MALLOC before the getnewvnode since doing so afterward + * might cause a bogus v_data pointer to get dereferenced + * elsewhere if MALLOC should block. + */ + MALLOC(xp, struct null_node *, sizeof(struct null_node), M_TEMP, M_WAITOK); + error = getnewvnode(VT_NULL, mp, null_vnodeop_p, vpp); - if (error) + if (error) { + FREE(xp, M_TEMP); return (error); + } vp = *vpp; - MALLOC(xp, struct null_node *, sizeof(struct null_node), M_TEMP, M_WAITOK); vp->v_type = lowervp->v_type; xp->null_vnode = vp; vp->v_data = xp; |
