Module Name:    src
Committed By:   ozaki-r
Date:           Mon Apr 11 05:40:47 UTC 2016

Modified Files:
        src/sys/net: bridgestp.c if_bridge.c

Log Message:
Fix usage of pslist(9)

Pointed out by riastradh@.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/net/bridgestp.c
cvs rdiff -u -r1.112 -r1.113 src/sys/net/if_bridge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/bridgestp.c
diff -u src/sys/net/bridgestp.c:1.20 src/sys/net/bridgestp.c:1.21
--- src/sys/net/bridgestp.c:1.20	Mon Apr 11 02:04:14 2016
+++ src/sys/net/bridgestp.c	Mon Apr 11 05:40:47 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bridgestp.c,v 1.20 2016/04/11 02:04:14 ozaki-r Exp $	*/
+/*	$NetBSD: bridgestp.c,v 1.21 2016/04/11 05:40:47 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2000 Jason L. Wright (ja...@thought.net)
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bridgestp.c,v 1.20 2016/04/11 02:04:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bridgestp.c,v 1.21 2016/04/11 05:40:47 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -341,7 +341,7 @@ bstp_config_bpdu_generation(struct bridg
 {
 	struct bridge_iflist *bif;
 
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		if ((bif->bif_flags & IFBIF_STP) == 0)
 			continue;
@@ -416,7 +416,7 @@ bstp_root_selection(struct bridge_softc 
 {
 	struct bridge_iflist *root_port = NULL, *bif;
 
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		if ((bif->bif_flags & IFBIF_STP) == 0)
 			continue;
@@ -475,7 +475,7 @@ bstp_designated_port_selection(struct br
 {
 	struct bridge_iflist *bif;
 
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		if ((bif->bif_flags & IFBIF_STP) == 0)
 			continue;
@@ -515,7 +515,7 @@ bstp_port_state_selection(struct bridge_
 {
 	struct bridge_iflist *bif;
 
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		if ((bif->bif_flags & IFBIF_STP) == 0)
 			continue;
@@ -793,7 +793,7 @@ bstp_designated_for_some_port(struct bri
 
 	struct bridge_iflist *bif;
 
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		if ((bif->bif_flags & IFBIF_STP) == 0)
 			continue;
@@ -833,7 +833,7 @@ bstp_initialization(struct bridge_softc 
 
 	BRIDGE_LOCK(sc);
 
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		if ((bif->bif_flags & IFBIF_STP) == 0)
 			continue;
@@ -888,7 +888,7 @@ bstp_initialization(struct bridge_softc 
 
 	BRIDGE_LOCK(sc);
 
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		if (bif->bif_flags & IFBIF_STP)
 			bstp_enable_port(sc, bif);
@@ -909,7 +909,7 @@ bstp_stop(struct bridge_softc *sc)
 	struct bridge_iflist *bif;
 
 	BRIDGE_LOCK(sc);
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		bstp_set_port_state(bif, BSTP_IFSTATE_DISABLED);
 		bstp_timer_stop(&bif->bif_hold_timer);
@@ -982,7 +982,7 @@ bstp_set_bridge_priority(struct bridge_s
 
 	root = bstp_root_bridge(sc);
 
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		if ((bif->bif_flags & IFBIF_STP) == 0)
 			continue;
@@ -1076,7 +1076,7 @@ bstp_tick(void *arg)
 	s = splnet();
 	BRIDGE_LOCK(sc);
 
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		if ((bif->bif_flags & IFBIF_STP) == 0)
 			continue;
@@ -1100,7 +1100,7 @@ bstp_tick(void *arg)
 	    sc->sc_topology_change_time))
 		bstp_topology_change_timer_expiry(sc);
 
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		if ((bif->bif_flags & IFBIF_STP) == 0)
 			continue;
@@ -1109,7 +1109,7 @@ bstp_tick(void *arg)
 			bstp_message_age_timer_expiry(sc, bif);
 	}
 
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		if ((bif->bif_flags & IFBIF_STP) == 0)
 			continue;

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.112 src/sys/net/if_bridge.c:1.113
--- src/sys/net/if_bridge.c:1.112	Mon Apr 11 02:04:14 2016
+++ src/sys/net/if_bridge.c	Mon Apr 11 05:40:47 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.112 2016/04/11 02:04:14 ozaki-r Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.113 2016/04/11 05:40:47 ozaki-r Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.112 2016/04/11 02:04:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.113 2016/04/11 05:40:47 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -713,8 +713,6 @@ bridge_delete_member(struct bridge_softc
 	ifs->if_bridgeif = NULL;
 
 	PSLIST_WRITER_REMOVE(bif, bif_next);
-	PSLIST_ENTRY_DESTROY(bif, bif_next);
-
 	BRIDGE_PSZ_PERFORM(sc);
 
 #ifdef BRIDGE_MPSAFE
@@ -728,6 +726,7 @@ bridge_delete_member(struct bridge_softc
 #endif
 	BRIDGE_UNLOCK(sc);
 
+	PSLIST_ENTRY_DESTROY(bif, bif_next);
 	kmem_free(bif, sizeof(*bif));
 
 	BRIDGE_LOCK(sc);
@@ -949,7 +948,7 @@ bridge_ioctl_gifs(struct bridge_softc *s
 retry:
 	BRIDGE_LOCK(sc);
 	count = 0;
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next)
 		count++;
 	BRIDGE_UNLOCK(sc);
@@ -970,7 +969,7 @@ retry:
 	BRIDGE_LOCK(sc);
 
 	i = 0;
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next)
 		i++;
 	if (i > count) {
@@ -984,7 +983,7 @@ retry:
 	}
 
 	i = 0;
-	PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+	PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
 	    bif_next) {
 		struct ifbreq *breq = &breqs[i++];
 		memset(breq, 0, sizeof(*breq));

Reply via email to