summaryrefslogtreecommitdiffstats
path: root/sys/isofs/cd9660/cd9660_node.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1996-06-12 03:36:23 +0000
committerdg <dg@FreeBSD.org>1996-06-12 03:36:23 +0000
commit6e349b6b4756260c2efd6d1e925c366e50db77d0 (patch)
tree28ec6a96ef6c38db9763c0cfe731285bce71bade /sys/isofs/cd9660/cd9660_node.c
parent120a4c2a81f784c25bd672b47e2ccde78dbcb5ca (diff)
downloadFreeBSD-src-6e349b6b4756260c2efd6d1e925c366e50db77d0.zip
FreeBSD-src-6e349b6b4756260c2efd6d1e925c366e50db77d0.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.
Diffstat (limited to 'sys/isofs/cd9660/cd9660_node.c')
-rw-r--r--sys/isofs/cd9660/cd9660_node.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/isofs/cd9660/cd9660_node.c b/sys/isofs/cd9660/cd9660_node.c
index e0cea29..b8512b7 100644
--- a/sys/isofs/cd9660/cd9660_node.c
+++ b/sys/isofs/cd9660/cd9660_node.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_node.c 8.2 (Berkeley) 1/23/94
- * $Id: cd9660_node.c,v 1.11 1995/05/30 08:04:59 rgrimes Exp $
+ * $Id: cd9660_node.c,v 1.12 1995/12/03 17:14:33 bde Exp $
*/
#include <sys/param.h>
@@ -204,15 +204,22 @@ loop:
*ipp = ip;
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(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE, M_WAITOK);
+
/*
* Allocate a new vnode/iso_node.
*/
if ((error = getnewvnode(VT_ISOFS, mntp, cd9660_vnodeop_p, &nvp))) {
- *ipp = 0;
+ *ipp = NULL;
+ FREE(ip, M_ISOFSNODE);
return error;
}
- MALLOC(ip, struct iso_node *, sizeof(struct iso_node),
- M_ISOFSNODE, M_WAITOK);
bzero((caddr_t)ip, sizeof(struct iso_node));
nvp->v_data = ip;
ip->i_vnode = nvp;
OpenPOWER on IntegriCloud