From 80700e8efc4882936013101e91714d96fab5709a Mon Sep 17 00:00:00 2001 From: truckman Date: Sun, 16 Oct 2005 21:41:54 +0000 Subject: 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 --- sys/fs/cd9660/cd9660_lookup.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/fs/cd9660/cd9660_lookup.c') diff --git a/sys/fs/cd9660/cd9660_lookup.c b/sys/fs/cd9660/cd9660_lookup.c index b89e670..59607b9 100644 --- a/sys/fs/cd9660/cd9660_lookup.c +++ b/sys/fs/cd9660/cd9660_lookup.c @@ -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 @@ found: * 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) -- cgit v1.1