summaryrefslogtreecommitdiffstats
path: root/sys/miscfs
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>1997-08-12 07:18:59 +0000
committerkato <kato@FreeBSD.org>1997-08-12 07:18:59 +0000
commitd0850efd52427acd806c17150ff085f63ebd85e8 (patch)
tree492fd2aa2478712ea74a1ef05a5915376a9d9ec8 /sys/miscfs
parentec86e12dab6e3fedadef181f2ce7688abb1309ee (diff)
downloadFreeBSD-src-d0850efd52427acd806c17150ff085f63ebd85e8.zip
FreeBSD-src-d0850efd52427acd806c17150ff085f63ebd85e8.tar.gz
Fixed vnode corruption by undefined case in union_lookup(). When
uerror == 0 && lerror == EACCES, lowervp == NULLVP and union_allocvp doesn't find existing union node and new union node is created. Sicne it is dificult to cover all the case, union_lookup always returns when union_lookup1() returns EACCES. Submitted by: Naofumi Honda <honda@Kururu.math.sci.hokudai.ac.jp> Obtained from: NetBSD/pc98
Diffstat (limited to 'sys/miscfs')
-rw-r--r--sys/miscfs/union/union_vnops.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/miscfs/union/union_vnops.c b/sys/miscfs/union/union_vnops.c
index f9c7702..3132dd1 100644
--- a/sys/miscfs/union/union_vnops.c
+++ b/sys/miscfs/union/union_vnops.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* @(#)union_vnops.c 8.32 (Berkeley) 6/23/95
- * $Id: union_vnops.c,v 1.33 1997/05/03 01:55:19 kato Exp $
+ * $Id: union_vnops.c,v 1.34 1997/05/07 14:37:32 kato Exp $
*/
#include <sys/param.h>
@@ -286,7 +286,9 @@ union_lookup(ap)
/*if (uppervp == upperdvp)
dun->un_flags |= UN_KLOCK;*/
- if (cnp->cn_consume != 0) {
+ if (cnp->cn_consume != 0 || uerror == EACCES) {
+ if (uerror == EACCES)
+ uppervp = NULLVP;
*ap->a_vpp = uppervp;
if (!lockparent)
cnp->cn_flags &= ~LOCKPARENT;
@@ -343,7 +345,9 @@ union_lookup(ap)
if (lowervp != lowerdvp)
VOP_UNLOCK(lowerdvp, 0, p);
- if (cnp->cn_consume != 0) {
+ if (cnp->cn_consume != 0 || lerror == EACCES) {
+ if (lerror == EACCES)
+ lowervp = NULLVP;
if (uppervp != NULLVP) {
if (uppervp == upperdvp)
vrele(uppervp);
OpenPOWER on IntegriCloud