From f993c6f7844b25fe298d121c5af2d511a74112bf Mon Sep 17 00:00:00 2001 From: beck Date: Thu, 2 Aug 2018 04:41:47 +0000 Subject: [PATCH] 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 --- sys/kern/vfs_lookup.c | 5 +++-- 1 file 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)) -- 2.20.1