udf_vget() shall vgone() the vnode when the file_entry cannot be allocated

or read from the volume. Otherwise, half-constructed vnode could be found
later and cause panic when accessed.

PR:	118322
MFC after:	1 week
This commit is contained in:
kib 2008-01-18 12:09:54 +00:00
parent b211e951fc
commit 8aee27b5a3

View File

@ -630,6 +630,7 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
devvp = udfmp->im_devvp;
if ((error = RDSECTOR(devvp, sector, udfmp->bsize, &bp)) != 0) {
printf("Cannot read sector %d\n", sector);
vgone(vp);
vput(vp);
brelse(bp);
*vpp = NULL;
@ -639,6 +640,7 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
fe = (struct file_entry *)bp->b_data;
if (udf_checktag(&fe->tag, TAGID_FENTRY)) {
printf("Invalid file entry!\n");
vgone(vp);
vput(vp);
brelse(bp);
*vpp = NULL;
@ -649,6 +651,7 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
M_NOWAIT | M_ZERO);
if (unode->fentry == NULL) {
printf("Cannot allocate file entry block\n");
vgone(vp);
vput(vp);
brelse(bp);
*vpp = NULL;