Source-Changes-HG archive

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

[src/trunk]: src/sys/net Remove wrong assertions



details:   https://anonhg.NetBSD.org/src/rev/59cfaae65a2d
branches:  trunk
changeset: 828296:59cfaae65a2d
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Thu Dec 07 10:22:04 2017 +0000

description:
Remove wrong assertions

rw_lock_held() returns true when any context holds the lock. However, in
if_pppoe.c, the function was used wrongly as it returns true only if the lock is
held in the same context.

>From s-yamaguchi@IIJ

diffstat:

 sys/net/if_pppoe.c |  18 ++----------------
 1 files changed, 2 insertions(+), 16 deletions(-)

diffs (82 lines):

diff -r c5344b3f34b8 -r 59cfaae65a2d sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c        Thu Dec 07 10:05:42 2017 +0000
+++ b/sys/net/if_pppoe.c        Thu Dec 07 10:22:04 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.132 2017/11/17 07:37:12 ozaki-r Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.133 2017/12/07 10:22:04 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.132 2017/11/17 07:37:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.133 2017/12/07 10:22:04 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -135,9 +135,7 @@
 
 #define PPPOE_LOCK(_sc, _op)   rw_enter(&(_sc)->sc_lock, (_op))
 #define PPPOE_UNLOCK(_sc)      rw_exit(&(_sc)->sc_lock)
-#define PPPOE_LOCKED(_sc)      rw_lock_held(&(_sc)->sc_lock)
 #define PPPOE_WLOCKED(_sc)     rw_write_held(&(_sc)->sc_lock)
-#define PPPOE_RLOCKED(_sc)     rw_read_held(&(_sc)->sc_lock)
 
 #ifdef PPPOE_MPSAFE
 #define DECLARE_SPLNET_VARIABLE
@@ -1056,8 +1054,6 @@
        struct ether_header *eh;
        uint16_t etype;
 
-       KASSERT(PPPOE_LOCKED(sc));
-
        if (sc->sc_eth_if == NULL) {
                m_freem(m);
                return EIO;
@@ -1261,8 +1257,6 @@
        int len, l1 = 0, l2 = 0; /* XXX: gcc */
        uint8_t *p;
 
-       KASSERT(PPPOE_LOCKED(sc));
-
        if (sc->sc_state >PPPOE_STATE_PADI_SENT)
                panic("pppoe_send_padi in state %d", sc->sc_state);
 
@@ -1537,8 +1531,6 @@
        uint8_t *p;
        size_t len, l1 = 0; /* XXX: gcc */
 
-       KASSERT(PPPOE_LOCKED(sc));
-
        if (sc->sc_state != PPPOE_STATE_PADR_SENT)
                return EIO;
 
@@ -1632,8 +1624,6 @@
        uint8_t *p;
        size_t len;
 
-       KASSERT(PPPOE_LOCKED(sc)); /* required by pppoe_output(). */
-
        if (sc->sc_state != PPPOE_STATE_PADO_SENT)
                return EIO;
 
@@ -1707,8 +1697,6 @@
        struct pppoe_softc *sc = (void *)sp;
        int wtime;
 
-       KASSERT(!PPPOE_LOCKED(sc));
-
        PPPOE_LOCK(sc, RW_READER);
 
        if (sc->sc_state != PPPOE_STATE_INITIAL) {
@@ -1738,8 +1726,6 @@
 {
        struct pppoe_softc *sc = (void *)sp;
 
-       KASSERT(!PPPOE_LOCKED(sc));
-
        PPPOE_LOCK(sc, RW_WRITER);
 
        if (sc->sc_state < PPPOE_STATE_SESSION) {



Home | Main Index | Thread Index | Old Index