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:
parent
445f595a98
commit
61af195933
@ -630,6 +630,7 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
|
|||||||
devvp = udfmp->im_devvp;
|
devvp = udfmp->im_devvp;
|
||||||
if ((error = RDSECTOR(devvp, sector, udfmp->bsize, &bp)) != 0) {
|
if ((error = RDSECTOR(devvp, sector, udfmp->bsize, &bp)) != 0) {
|
||||||
printf("Cannot read sector %d\n", sector);
|
printf("Cannot read sector %d\n", sector);
|
||||||
|
vgone(vp);
|
||||||
vput(vp);
|
vput(vp);
|
||||||
brelse(bp);
|
brelse(bp);
|
||||||
*vpp = NULL;
|
*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;
|
fe = (struct file_entry *)bp->b_data;
|
||||||
if (udf_checktag(&fe->tag, TAGID_FENTRY)) {
|
if (udf_checktag(&fe->tag, TAGID_FENTRY)) {
|
||||||
printf("Invalid file entry!\n");
|
printf("Invalid file entry!\n");
|
||||||
|
vgone(vp);
|
||||||
vput(vp);
|
vput(vp);
|
||||||
brelse(bp);
|
brelse(bp);
|
||||||
*vpp = NULL;
|
*vpp = NULL;
|
||||||
@ -649,6 +651,7 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
|
|||||||
M_NOWAIT | M_ZERO);
|
M_NOWAIT | M_ZERO);
|
||||||
if (unode->fentry == NULL) {
|
if (unode->fentry == NULL) {
|
||||||
printf("Cannot allocate file entry block\n");
|
printf("Cannot allocate file entry block\n");
|
||||||
|
vgone(vp);
|
||||||
vput(vp);
|
vput(vp);
|
||||||
brelse(bp);
|
brelse(bp);
|
||||||
*vpp = NULL;
|
*vpp = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user