diff options
author | dg <dg@FreeBSD.org> | 1996-06-12 03:36:23 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1996-06-12 03:36:23 +0000 |
commit | 6e349b6b4756260c2efd6d1e925c366e50db77d0 (patch) | |
tree | 28ec6a96ef6c38db9763c0cfe731285bce71bade /sys/fs | |
parent | 120a4c2a81f784c25bd672b47e2ccde78dbcb5ca (diff) | |
download | FreeBSD-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/fs')
-rw-r--r-- | sys/fs/cd9660/cd9660_node.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/fs/cd9660/cd9660_node.c b/sys/fs/cd9660/cd9660_node.c index e0cea29..b8512b7 100644 --- a/sys/fs/cd9660/cd9660_node.c +++ b/sys/fs/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; |