diff options
author | truckman <truckman@FreeBSD.org> | 2005-10-16 21:39:29 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2005-10-16 21:39:29 +0000 |
commit | 199934d64b0cf348cb2f63cbe6d749d249ffdbb0 (patch) | |
tree | 95870005119797db26c620bcb19d213c1d52d3a0 | |
parent | 48313c9c1a563128b40937f365b46cf89d00ab09 (diff) | |
download | FreeBSD-src-199934d64b0cf348cb2f63cbe6d749d249ffdbb0.zip FreeBSD-src-199934d64b0cf348cb2f63cbe6d749d249ffdbb0.tar.gz |
Apply the same fix to a potential race in the ISDOTDOT code in
ext2_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 ext2fs as MPSAFE.
Requested by: bde
MFC after: 2 weeks
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_lookup.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/gnu/fs/ext2fs/ext2_lookup.c b/sys/gnu/fs/ext2fs/ext2_lookup.c index a238878..d057e2a 100644 --- a/sys/gnu/fs/ext2fs/ext2_lookup.c +++ b/sys/gnu/fs/ext2fs/ext2_lookup.c @@ -319,6 +319,7 @@ ext2_lookup(ap) int flags = cnp->cn_flags; int nameiop = cnp->cn_nameiop; struct thread *td = cnp->cn_thread; + ino_t saved_ino; int DIRBLKSIZ = VTOI(ap->a_dvp)->i_e2fs->s_blocksize; @@ -655,8 +656,9 @@ found: */ pdp = vdp; if (flags & ISDOTDOT) { + saved_ino = dp->i_ino; VOP_UNLOCK(pdp, 0, td); /* race to get the inode */ - error = VFS_VGET(vdp->v_mount, dp->i_ino, LK_EXCLUSIVE, &tdp); + error = VFS_VGET(vdp->v_mount, saved_ino, LK_EXCLUSIVE, &tdp); vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, td); if (error != 0) return (error); |