diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2020-10-09 08:20:47 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2020-10-09 08:20:47 +0000 |
commit | a29c3a5e3d05695bf9092c4244ff661c1d5eccf0 (patch) | |
tree | 346ae066200a5fcb70428cba559280fe80fa5f07 /sys/ufs | |
parent | 2d747ad46ffef9fbf118ff7fba47d1060e0c42dc (diff) |
Do not dereference `vp' after vput(9)ing it.
From dholland@NetBSD
ok anton@
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_lookup.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index ec8466a4c30..6f0d6dcaed9 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_lookup.c,v 1.57 2019/05/09 15:35:19 deraadt Exp $ */ +/* $OpenBSD: ufs_lookup.c,v 1.58 2020/10/09 08:20:46 mpi Exp $ */ /* $NetBSD: ufs_lookup.c,v 1.7 1996/02/09 22:36:06 christos Exp $ */ /* @@ -1121,7 +1121,7 @@ ufs_dirempty(struct inode *ip, ufsino_t parentino, struct ucred *cred) int ufs_checkpath(struct inode *source, struct inode *target, struct ucred *cred) { - struct vnode *vp; + struct vnode *nextvp, *vp; int error, rootino, namlen; struct dirtemplate dirbuf; @@ -1165,12 +1165,14 @@ ufs_checkpath(struct inode *source, struct inode *target, struct ucred *cred) } if (dirbuf.dotdot_ino == rootino) break; - vput(vp); - error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, &vp); + VOP_UNLOCK(vp); + error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, &nextvp); + vrele(vp); if (error) { vp = NULL; break; } + vp = nextvp; } out: |