From 1e4f4e56b9eff06efb32089d50d06ff750f111d3 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Wed, 9 Oct 2019 17:02:28 +0000 Subject: [PATCH] ip6_output() has a complex set of gotos, and some can jump out of the epoch section towards return statement. Since entering epoch is cheap, it is easier to cover the whole function with epoch, rather than try to properly maintain its state. --- sys/netinet6/ip6_output.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index de52f6356ee..f8eb568851d 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -405,6 +405,8 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, struct m_tag *fwd_tag = NULL; uint32_t id; + NET_EPOCH_ENTER(et); + if (inp != NULL) { INP_LOCK_ASSERT(inp); M_SETFIB(m, inp->inp_inc.inc_fibnum); @@ -587,7 +589,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, ro = &opt->ip6po_route; dst = (struct sockaddr_in6 *)&ro->ro_dst; fibnum = (inp != NULL) ? inp->inp_inc.inc_fibnum : M_GETFIB(m); - NET_EPOCH_ENTER(et); again: /* * if specified, try to fill in the traffic class field.