summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2005-08-15 02:50:13 +0000
committerthompsa <thompsa@FreeBSD.org>2005-08-15 02:50:13 +0000
commit97eb04040af69ed9912a118a91116b8511b3e685 (patch)
tree7ff9208d87f177d52d9362ed8e6ed9ddfe140fe0 /sys
parent3b0e65cd6d8a4aab473fa0b0ade4fb1926113783 (diff)
downloadFreeBSD-src-97eb04040af69ed9912a118a91116b8511b3e685.zip
FreeBSD-src-97eb04040af69ed9912a118a91116b8511b3e685.tar.gz
Ensure that we are holding the lock when initialising the bridge interface. We
could initialise while unlocked if the bridge is not up when setting the inet address, ether_ioctl() would call bridge_init. Change it so bridge_init is always called unlocked and then locks before calling bstp_initialization(). Reported by: Michal Mertl Approved by: mlaier (mentor) MFC after: 3 days
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_bridge.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 6518513..06cd8f0 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -597,6 +597,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
* If interface is marked up and it is stopped, then
* start it.
*/
+ BRIDGE_UNLOCK(sc);
(*ifp->if_init)(sc);
}
break;
@@ -1214,8 +1215,10 @@ bridge_init(void *xsc)
callout_reset(&sc->sc_brcallout, bridge_rtable_prune_period * hz,
bridge_timer, sc);
+ BRIDGE_LOCK(sc);
ifp->if_drv_flags |= IFF_DRV_RUNNING;
bstp_initialization(sc);
+ BRIDGE_UNLOCK(sc);
return;
}
@@ -1229,6 +1232,8 @@ bridge_stop(struct ifnet *ifp, int disable)
{
struct bridge_softc *sc = ifp->if_softc;
+ BRIDGE_LOCK_ASSERT(sc);
+
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return;
OpenPOWER on IntegriCloud