diff options
author | dg <dg@FreeBSD.org> | 1996-06-12 03:37:57 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1996-06-12 03:37:57 +0000 |
commit | 5026fc1c3662189cacaad4f0eb1fc0222ec8def1 (patch) | |
tree | 0244ce546b0fc6e415af50b64cc8c473ae6be049 /sys/fs/umapfs | |
parent | 6e349b6b4756260c2efd6d1e925c366e50db77d0 (diff) | |
download | FreeBSD-src-5026fc1c3662189cacaad4f0eb1fc0222ec8def1.zip FreeBSD-src-5026fc1c3662189cacaad4f0eb1fc0222ec8def1.tar.gz |
Moved the fsnode MALLOC to before the call to getnewvnode() so that the
process won't possibly block before filling in the fsnode pointer (v_data)
which might be dereferenced during a sync since the vnode is put on the
mnt_vnodelist by getnewvnode.
Pointed out by Matt Day <mday@artisoft.com>
Diffstat (limited to 'sys/fs/umapfs')
-rw-r--r-- | sys/fs/umapfs/umap_subr.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/fs/umapfs/umap_subr.c b/sys/fs/umapfs/umap_subr.c index 0267584..fe1ec56 100644 --- a/sys/fs/umapfs/umap_subr.c +++ b/sys/fs/umapfs/umap_subr.c @@ -35,7 +35,7 @@ * * @(#)umap_subr.c 8.6 (Berkeley) 1/26/94 * - * $Id: umap_subr.c,v 1.5 1995/12/03 14:38:57 bde Exp $ + * $Id: umap_subr.c,v 1.6 1995/12/03 14:54:39 bde Exp $ */ #include <sys/param.h> @@ -222,13 +222,23 @@ umap_node_alloc(mp, lowervp, vpp) struct vnode *othervp, *vp; int error; + /* XXX This routine probably needs a node_alloc lock */ + + /* + * 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 umap_node *, sizeof(struct umap_node), + M_TEMP, M_WAITOK); + error = getnewvnode(VT_UMAP, mp, umap_vnodeop_p, vpp); - if (error) + if (error) { + FREE(xp, M_TEMP); return (error); + } vp = *vpp; - MALLOC(xp, struct umap_node *, sizeof(struct umap_node), - M_TEMP, M_WAITOK); vp->v_type = lowervp->v_type; xp->umap_vnode = vp; vp->v_data = xp; |