1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

vp->v_object must be valid after normal flow of vfs_object_create()

completes, change if() to KASSERT().  This is not a bug, we are
    simplify clarifying and optimizing the code.

    In if/else in vfs_object_create(), the failure of both conditionals
    will lead to a NULL object.  Exit gracefully if this case occurs.
    ( this case does not normally occur, but needed to be handled ).

Obtained from: Eivind Eklund <eivind@FreeBSD.org>
This commit is contained in:
Matthew Dillon 1999-02-04 18:25:39 +00:00
parent 431552d221
commit 82b23b5384
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=43618
2 changed files with 18 additions and 6 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.184 1999/01/28 00:57:47 dillon Exp $
* $Id: vfs_subr.c,v 1.185 1999/01/29 23:18:49 dillon Exp $
*/
/*
@ -2555,7 +2555,13 @@ vfs_object_create(vp, p, cred)
* cause any problems (yet).
*/
object = vnode_pager_alloc(vp, IDX_TO_OFF(INT_MAX), 0, 0);
} else {
goto retn;
}
/*
* Dereference the reference we just created. This assumes
* that the object is associated with the vp.
*/
object->ref_count--;
vp->v_usecount--;
} else {
@ -2567,8 +2573,8 @@ vfs_object_create(vp, p, cred)
}
}
if (vp->v_object)
vp->v_flag |= VOBJBUF;
KASSERT(vp->v_object != NULL, ("vfs_object_create: NULL object"));
vp->v_flag |= VOBJBUF;
retn:
return error;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.184 1999/01/28 00:57:47 dillon Exp $
* $Id: vfs_subr.c,v 1.185 1999/01/29 23:18:49 dillon Exp $
*/
/*
@ -2555,7 +2555,13 @@ vfs_object_create(vp, p, cred)
* cause any problems (yet).
*/
object = vnode_pager_alloc(vp, IDX_TO_OFF(INT_MAX), 0, 0);
} else {
goto retn;
}
/*
* Dereference the reference we just created. This assumes
* that the object is associated with the vp.
*/
object->ref_count--;
vp->v_usecount--;
} else {
@ -2567,8 +2573,8 @@ vfs_object_create(vp, p, cred)
}
}
if (vp->v_object)
vp->v_flag |= VOBJBUF;
KASSERT(vp->v_object != NULL, ("vfs_object_create: NULL object"));
vp->v_flag |= VOBJBUF;
retn:
return error;