summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_mroute.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2003-10-29 19:15:00 +0000
committersam <sam@FreeBSD.org>2003-10-29 19:15:00 +0000
commit16414b86ee1f6ced718757e12e7f1fc472169377 (patch)
tree6dd76d6abf0eab87bdb5543d278b5c50d88117f1 /sys/netinet/ip_mroute.c
parentf65eafde266b11dfb1c6b136829eb1c959ed5cb8 (diff)
downloadFreeBSD-src-16414b86ee1f6ced718757e12e7f1fc472169377.zip
FreeBSD-src-16414b86ee1f6ced718757e12e7f1fc472169377.tar.gz
Potential fix for races shutting down callouts when unloading
the module. Previously we grabbed the mutex used by the callouts, then stopped the callout with callout_stop, but if the callout was already active and blocked by the mutex then it would continue later and reference the mutex after it was destroyed. Instead stop the callout first then lock. Supported by: FreeBSD Foundation
Diffstat (limited to 'sys/netinet/ip_mroute.c')
-rw-r--r--sys/netinet/ip_mroute.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 354aafc..7764c9b 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -661,11 +661,15 @@ X_ip_mrouter_done(void)
VIF_LOCK();
if (encap_cookie) {
- encap_detach(encap_cookie);
+ const struct encaptab *c = encap_cookie;
encap_cookie = NULL;
+ encap_detach(c);
}
+ VIF_UNLOCK();
+
callout_stop(&tbf_reprocess_ch);
+ VIF_LOCK();
/*
* For each phyint in use, disable promiscuous reception of all IP
* multicasts.
@@ -691,11 +695,11 @@ X_ip_mrouter_done(void)
/*
* Free all multicast forwarding cache entries.
*/
- MFC_LOCK();
callout_stop(&expire_upcalls_ch);
callout_stop(&bw_upcalls_ch);
callout_stop(&bw_meter_ch);
+ MFC_LOCK();
for (i = 0; i < MFCTBLSIZ; i++) {
for (rt = mfctable[i]; rt != NULL; ) {
struct mfc *nr = rt->mfc_next;
OpenPOWER on IntegriCloud