summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2018-08-02 04:41:48 +0000
committerBob Beck <beck@cvs.openbsd.org>2018-08-02 04:41:48 +0000
commit6c94ef23bd82b7b426f6d235742288ee3832a1ca (patch)
tree7966ad85a52591bfb2daaa19ed2cf65a1c96839c
parent3092333580bc415b86624cf71ce4776fe34e6e74 (diff)
Fix panic when we attempt to mess with "." but have a flags mismatch
so unveil_check_final returns an error - in this case we can't just VOP_UNLOCK the parent we have to know we are dealing with "." found by anton@ - thanks
-rw-r--r--sys/kern/vfs_lookup.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index efda601ea0d..5a93a8bf48c 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_lookup.c,v 1.72 2018/07/30 00:16:59 beck Exp $ */
+/* $OpenBSD: vfs_lookup.c,v 1.73 2018/08/02 04:41:47 beck Exp $ */
/* $NetBSD: vfs_lookup.c,v 1.17 1996/02/09 19:00:59 christos Exp $ */
/*
@@ -227,7 +227,8 @@ fail:
if ((error = unveil_check_final(p, ndp))) {
pool_put(&namei_pool, cnp->cn_pnbuf);
if ((cnp->cn_flags & LOCKPARENT) &&
- (cnp->cn_flags & ISLASTCN))
+ (cnp->cn_flags & ISLASTCN) &&
+ (ndp->ni_vp != ndp->ni_dvp))
VOP_UNLOCK(ndp->ni_dvp);
if (ndp->ni_vp) {
if ((cnp->cn_flags & LOCKLEAF))