summaryrefslogtreecommitdiffstats
path: root/sys/miscfs/portal/portal_vnops.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/miscfs/portal/portal_vnops.c')
-rw-r--r--sys/miscfs/portal/portal_vnops.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/miscfs/portal/portal_vnops.c b/sys/miscfs/portal/portal_vnops.c
index 27780bf..fcd5958 100644
--- a/sys/miscfs/portal/portal_vnops.c
+++ b/sys/miscfs/portal/portal_vnops.c
@@ -35,7 +35,7 @@
*
* @(#)portal_vnops.c 8.8 (Berkeley) 1/21/94
*
- * $Id: portal_vnops.c,v 1.10 1995/12/11 09:24:45 phk Exp $
+ * $Id: portal_vnops.c,v 1.11 1996/02/13 18:16:25 wollman Exp $
*/
/*
@@ -126,15 +126,21 @@ portal_lookup(ap)
return (0);
}
+ /*
+ * 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(pt, struct portalnode *, sizeof(struct portalnode),
+ M_TEMP, M_WAITOK);
error = getnewvnode(VT_PORTAL, ap->a_dvp->v_mount, portal_vnodeop_p, &fvp);
- if (error)
+ if (error) {
+ FREE(pt, M_TEMP);
goto bad;
+ }
fvp->v_type = VREG;
- MALLOC(fvp->v_data, void *, sizeof(struct portalnode),
- M_TEMP, M_WAITOK);
-
- pt = VTOPORTAL(fvp);
+ fvp->v_data = pt;
/*
* Save all of the remaining pathname and
* advance the namei next pointer to the end
OpenPOWER on IntegriCloud