summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-06-07 13:28:03 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-06-07 13:28:03 +0000
commit275bbd85f95e1e46cce9b4534166c79813637f94 (patch)
tree89500c630cb7f24896e64547b41e339e3547e401 /sys/netinet
parentbe620380aae9af5b69e96ac7f61d812db6e68e55 (diff)
Grab the KERNEL_LOCK() around rtm*() functions. Routing sockets globals
aren't protected by the NET_LOCK(). While here change lock assertions in rt_{set,put}gwroute(), the NET_LOCK() is enough. Tested by Hrvoje Popovski. ok jmatthew@, claudio@
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_pcb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 68d995f50a7..533ed7fa37e 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.220 2017/03/07 16:59:40 bluhm Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.221 2017/06/07 13:28:02 mpi Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -716,8 +716,11 @@ in_losing(struct inpcb *inp)
info.rti_info[RTAX_DST] = &inp->inp_route.ro_dst;
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
info.rti_info[RTAX_NETMASK] = rt_plen2mask(rt, &sa_mask);
+
+ KERNEL_LOCK();
rtm_miss(RTM_LOSING, &info, rt->rt_flags, rt->rt_priority,
rt->rt_ifidx, 0, inp->inp_rtableid);
+ KERNEL_UNLOCK();
if (rt->rt_flags & RTF_DYNAMIC)
(void)rtrequest(RTM_DELETE, &info, rt->rt_priority,
NULL, inp->inp_rtableid);