git: f102a1834933 - main - net: on interface detach purge all its routes before detaching protocols
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Jan 2026 00:44:08 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=f102a18349335bfda1eb373a64eb1ba7462cd6bb
commit f102a18349335bfda1eb373a64eb1ba7462cd6bb
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-01-17 00:38:02 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-01-17 00:38:02 +0000
net: on interface detach purge all its routes before detaching protocols
Otherwise, a forwarding thread may use the interface being detached. This
is a regression from 0d469d23715d, which manifests itself as a reliably
reproducible panic in in6_selecthlim(). Note that there are old bug
reports about such a panic, and I believe this change will not fix them,
as their nature is not due to a screwed up detach sequence, but due to
lack of proper epoch(9) based synchronization between the detach and
forwarding.
Reviewed by: pouria
Reported & tested by: jhibbits
PR: 292162
Fixes: 0d469d23715d690b863787ebfa51529e1f6a9092
Differential Revision: https://reviews.freebsd.org/D54721
---
sys/net/if.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/net/if.c b/sys/net/if.c
index 4ddf8a69b3f0..047ccd2ecda7 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1115,6 +1115,8 @@ if_detach_internal(struct ifnet *ifp, bool vmove)
altq_detach(&ifp->if_snd);
#endif
+ rt_flushifroutes(ifp);
+
if_purgeaddrs(ifp);
EVENTHANDLER_INVOKE(ifnet_departure_event, ifp);
if_purgemaddrs(ifp);
@@ -1139,8 +1141,6 @@ if_detach_internal(struct ifnet *ifp, bool vmove)
} else
IF_ADDR_WUNLOCK(ifp);
}
-
- rt_flushifroutes(ifp);
}
#ifdef VIMAGE