Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/union Fix union_parsepath(), either the upper or the ...



details:   https://anonhg.NetBSD.org/src/rev/a4b7c65ae1ec
branches:  trunk
changeset: 984347:a4b7c65ae1ec
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sun Jul 04 11:24:09 2021 +0000

description:
Fix union_parsepath(), either the upper or the lower dvp may be NULL.

diffstat:

 sys/fs/union/union_vnops.c |  28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diffs (51 lines):

diff -r b131cd4a9d3a -r a4b7c65ae1ec sys/fs/union/union_vnops.c
--- a/sys/fs/union/union_vnops.c        Sun Jul 04 09:13:59 2021 +0000
+++ b/sys/fs/union/union_vnops.c        Sun Jul 04 11:24:09 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: union_vnops.c,v 1.77 2021/06/29 22:39:20 dholland Exp $        */
+/*     $NetBSD: union_vnops.c,v 1.78 2021/07/04 11:24:09 hannken Exp $ */
 
 /*
  * Copyright (c) 1992, 1993, 1994, 1995
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.77 2021/06/29 22:39:20 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.78 2021/07/04 11:24:09 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -213,14 +213,26 @@
        upperdvp = UPPERVP(ap->a_dvp);
        lowerdvp = LOWERVP(ap->a_dvp);
 
-       error = VOP_PARSEPATH(upperdvp, ap->a_name, &upper);
-       if (error) {
-               return error;
+       if (upperdvp != NULLVP) {
+               error = VOP_PARSEPATH(upperdvp, ap->a_name, &upper);
+               if (error) {
+                       return error;
+               }
+       } else {
+               upper = 0;
        }
 
-       error = VOP_PARSEPATH(lowerdvp, ap->a_name, &lower);
-       if (error) {
-               return error;
+       if (lowerdvp != NULLVP) {
+               error = VOP_PARSEPATH(lowerdvp, ap->a_name, &lower);
+               if (error) {
+                       return error;
+               }
+       } else {
+               lower = 0;
+       }
+
+       if (upper == 0 && lower == 0) {
+               panic("%s: missing both layers", __func__);
        }
 
        /*



Home | Main Index | Thread Index | Old Index