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:
Konstantin Belousov 2008-01-18 12:09:54 +00:00
parent 445f595a98
commit 61af195933
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=175436

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;