Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/dkwedge dk(4): Assert parent vp is nonnull before we...



details:   https://anonhg.NetBSD.org/src/rev/72076a74d070
branches:  trunk
changeset: 374383:72076a74d070
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Apr 21 18:29:26 2023 +0000

description:
dk(4): Assert parent vp is nonnull before we stash it away.

Let's enable early attribution if this goes wrong.

If it's not the parent's first open, also assert the parent vp is
already nonnull.

diffstat:

 sys/dev/dkwedge/dk.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r ed90c34c5dae -r 72076a74d070 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Fri Apr 21 18:29:18 2023 +0000
+++ b/sys/dev/dkwedge/dk.c      Fri Apr 21 18:29:26 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dk.c,v 1.137 2023/04/21 18:29:18 riastradh Exp $       */
+/*     $NetBSD: dk.c,v 1.138 2023/04/21 18:29:26 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.137 2023/04/21 18:29:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.138 2023/04/21 18:29:26 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1288,6 +1288,7 @@ dkfirstopen(struct dkwedge_softc *sc, in
                }
                if (error)
                        return error;
+               KASSERT(vp != NULL);
                sc->sc_parent->dk_rawvp = vp;
        } else {
                /*
@@ -1299,6 +1300,7 @@ dkfirstopen(struct dkwedge_softc *sc, in
                 * dk_rawopens is unsigned, this can't overflow.
                 */
                KASSERT(sc->sc_parent->dk_rawopens < UINT_MAX);
+               KASSERT(sc->sc_parent->dk_rawvp != NULL);
                mode = 0;
                LIST_FOREACH(nsc, &sc->sc_parent->dk_wedges, sc_plink) {
                        if (nsc == sc || nsc->sc_dk.dk_openmask == 0)



Home | Main Index | Thread Index | Old Index