diff options
Diffstat (limited to 'sys/miscfs/umapfs/umap_subr.c')
-rw-r--r-- | sys/miscfs/umapfs/umap_subr.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/miscfs/umapfs/umap_subr.c b/sys/miscfs/umapfs/umap_subr.c index 0267584..fe1ec56 100644 --- a/sys/miscfs/umapfs/umap_subr.c +++ b/sys/miscfs/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; |