1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-14 14:55:41 +00:00

Apply the same fix to a potential race in the ISDOTDOT code in

cd9660_lookup() that was used to fix an actual race in ufs_lookup.c:1.78.
This is not currently a hazard, but the bug would be activated by
marking cd9660 as MPSAFE.

Requested by:	bde
This commit is contained in:
Don Lewis 2005-10-16 21:41:54 +00:00
parent 9e4ce0ae8f
commit d31c91fbcf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=151392
2 changed files with 8 additions and 6 deletions

View File

@ -103,7 +103,7 @@ cd9660_lookup(ap)
struct vnode *tdp; /* returned by cd9660_vget_internal */
u_long bmask; /* block offset mask */
int error;
ino_t ino = 0;
ino_t ino = 0, saved_ino;
int reclen;
u_short namelen;
int isoflags;
@ -348,10 +348,11 @@ cd9660_lookup(ap)
* it's a relocated directory.
*/
if (flags & ISDOTDOT) {
saved_ino = dp->i_ino;
VOP_UNLOCK(pdp, 0, td); /* race to get the inode */
error = cd9660_vget_internal(vdp->v_mount, dp->i_ino,
error = cd9660_vget_internal(vdp->v_mount, saved_ino,
LK_EXCLUSIVE, &tdp,
dp->i_ino != ino, ep);
saved_ino != ino, ep);
brelse(bp);
vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, td);
if (error)

View File

@ -103,7 +103,7 @@ cd9660_lookup(ap)
struct vnode *tdp; /* returned by cd9660_vget_internal */
u_long bmask; /* block offset mask */
int error;
ino_t ino = 0;
ino_t ino = 0, saved_ino;
int reclen;
u_short namelen;
int isoflags;
@ -348,10 +348,11 @@ cd9660_lookup(ap)
* it's a relocated directory.
*/
if (flags & ISDOTDOT) {
saved_ino = dp->i_ino;
VOP_UNLOCK(pdp, 0, td); /* race to get the inode */
error = cd9660_vget_internal(vdp->v_mount, dp->i_ino,
error = cd9660_vget_internal(vdp->v_mount, saved_ino,
LK_EXCLUSIVE, &tdp,
dp->i_ino != ino, ep);
saved_ino != ino, ep);
brelse(bp);
vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, td);
if (error)