summaryrefslogtreecommitdiffstats
path: root/sys/net/route.c
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2016-09-04 15:45:42 +0000
committerbluhm <bluhm@openbsd.org>2016-09-04 15:45:42 +0000
commit76ed92a289894193469b877fef10c955e8edbeb3 (patch)
tree31c38ff71e67fa6464658412a5b9c612642439f6 /sys/net/route.c
parentchop out the zread code since we only write files (diff)
downloadwireguard-openbsd-76ed92a289894193469b877fef10c955e8edbeb3.tar.xz
wireguard-openbsd-76ed92a289894193469b877fef10c955e8edbeb3.zip
Do not assume that an interface index of a route is still valid in
rtrequest_delete(). The inpcb has a cache of the route that still exists when the interface has been detached. kassert triggered from tcp timeout by awolk@; OK mpi@
Diffstat (limited to 'sys/net/route.c')
-rw-r--r--sys/net/route.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index ed828c835ad..3d91064650a 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.324 2016/09/04 10:32:01 mpi Exp $ */
+/* $OpenBSD: route.c,v 1.325 2016/09/04 15:45:42 bluhm Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -904,9 +904,10 @@ rtrequest_delete(struct rt_addrinfo *info, u_int8_t prio, struct ifnet *ifp,
if (ifp == NULL) {
ifp = if_get(rt->rt_ifidx);
- KASSERT(ifp != NULL);
- ifp->if_rtrequest(ifp, RTM_DELETE, rt);
- if_put(ifp);
+ if (ifp != NULL) {
+ ifp->if_rtrequest(ifp, RTM_DELETE, rt);
+ if_put(ifp);
+ }
} else {
KASSERT(ifp->if_index == rt->rt_ifidx);
ifp->if_rtrequest(ifp, RTM_DELETE, rt);