svn commit: r237103 - stable/9/sys/net
Andrew Thompson
thompsa at FreeBSD.org
Thu Jun 14 21:35:21 UTC 2012
Author: thompsa
Date: Thu Jun 14 21:35:20 2012
New Revision: 237103
URL: http://svn.freebsd.org/changeset/base/237103
Log:
MFC r236916
Fix a panic I introduced in r234487, the bridge softc pointer is set to null
early in the detach so rearrange things not to explode.
Reported by: David Roffiaen, Gustau Perez Querol
Modified:
stable/9/sys/net/if_bridge.c
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/amd64/include/xen/ (props changed)
stable/9/sys/boot/ (props changed)
stable/9/sys/boot/i386/efi/ (props changed)
stable/9/sys/boot/ia64/efi/ (props changed)
stable/9/sys/boot/ia64/ski/ (props changed)
stable/9/sys/boot/powerpc/boot1.chrp/ (props changed)
stable/9/sys/boot/powerpc/ofw/ (props changed)
stable/9/sys/cddl/contrib/opensolaris/ (props changed)
stable/9/sys/conf/ (props changed)
stable/9/sys/contrib/dev/acpica/ (props changed)
stable/9/sys/contrib/octeon-sdk/ (props changed)
stable/9/sys/contrib/pf/ (props changed)
stable/9/sys/contrib/x86emu/ (props changed)
stable/9/sys/dev/ (props changed)
stable/9/sys/dev/e1000/ (props changed)
stable/9/sys/dev/ixgbe/ (props changed)
stable/9/sys/fs/ (props changed)
stable/9/sys/fs/ntfs/ (props changed)
stable/9/sys/modules/ (props changed)
Modified: stable/9/sys/net/if_bridge.c
==============================================================================
--- stable/9/sys/net/if_bridge.c Thu Jun 14 21:16:19 2012 (r237102)
+++ stable/9/sys/net/if_bridge.c Thu Jun 14 21:35:20 2012 (r237103)
@@ -334,6 +334,7 @@ static int bridge_ip6_checkbasic(struct
static int bridge_fragment(struct ifnet *, struct mbuf *,
struct ether_header *, int, struct llc *);
static void bridge_linkstate(struct ifnet *ifp);
+static void bridge_linkcheck(struct bridge_softc *sc);
extern void (*bridge_linkstate_p)(struct ifnet *ifp);
@@ -964,6 +965,7 @@ bridge_delete_member(struct bridge_softc
EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp);
}
+ bridge_linkcheck(sc);
bridge_mutecaps(sc); /* recalcuate now this interface is removed */
bridge_rtdelete(sc, ifs, IFBF_FLUSHALL);
KASSERT(bif->bif_addrcnt == 0,
@@ -993,7 +995,6 @@ bridge_delete_member(struct bridge_softc
bridge_set_ifcap(sc, bif, bif->bif_savedcaps);
}
bstp_destroy(&bif->bif_stp); /* prepare to free */
- bridge_linkstate(ifs);
BRIDGE_LOCK(sc);
free(bif, M_DEVBUF);
}
@@ -1092,18 +1093,17 @@ bridge_ioctl_add(struct bridge_softc *sc
/* Set interface capabilities to the intersection set of all members */
bridge_mutecaps(sc);
+ bridge_linkcheck(sc);
- BRIDGE_UNLOCK(sc);
- /* Update the linkstate for the bridge */
- bridge_linkstate(ifs);
/* Place the interface into promiscuous mode */
switch (ifs->if_type) {
case IFT_ETHER:
case IFT_L2VLAN:
+ BRIDGE_UNLOCK(sc);
error = ifpromisc(ifs, 1);
+ BRIDGE_LOCK(sc);
break;
}
- BRIDGE_LOCK(sc);
if (error)
bridge_delete_member(sc, bif, 0);
out:
@@ -3486,8 +3486,7 @@ static void
bridge_linkstate(struct ifnet *ifp)
{
struct bridge_softc *sc = ifp->if_bridge;
- struct bridge_iflist *bif, *bif2;
- int new_link, hasls;
+ struct bridge_iflist *bif;
BRIDGE_LOCK(sc);
bif = bridge_lookup_member_if(sc, ifp);
@@ -3495,13 +3494,26 @@ bridge_linkstate(struct ifnet *ifp)
BRIDGE_UNLOCK(sc);
return;
}
+ bridge_linkcheck(sc);
+ BRIDGE_UNLOCK(sc);
+
+ bstp_linkstate(&bif->bif_stp);
+}
+
+static void
+bridge_linkcheck(struct bridge_softc *sc)
+{
+ struct bridge_iflist *bif;
+ int new_link, hasls;
+
+ BRIDGE_LOCK_ASSERT(sc);
new_link = LINK_STATE_DOWN;
hasls = 0;
/* Our link is considered up if at least one of our ports is active */
- LIST_FOREACH(bif2, &sc->sc_iflist, bif_next) {
- if (bif2->bif_ifp->if_capabilities & IFCAP_LINKSTATE)
+ LIST_FOREACH(bif, &sc->sc_iflist, bif_next) {
+ if (bif->bif_ifp->if_capabilities & IFCAP_LINKSTATE)
hasls++;
- if (bif2->bif_ifp->if_link_state == LINK_STATE_UP) {
+ if (bif->bif_ifp->if_link_state == LINK_STATE_UP) {
new_link = LINK_STATE_UP;
break;
}
@@ -3511,8 +3523,4 @@ bridge_linkstate(struct ifnet *ifp)
new_link = LINK_STATE_UP;
}
if_link_state_change(sc->sc_ifp, new_link);
- BRIDGE_UNLOCK(sc);
-
- bstp_linkstate(&bif->bif_stp);
}
-
More information about the svn-src-stable
mailing list