diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-07-24 22:38:26 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-07-24 22:38:26 +0000 |
commit | b1020af93e7d07965c1c5ab6fa5f65053daf2f06 (patch) | |
tree | a34eb4fa7940cd382d6e3957ca35df2753d4f608 /sys/netinet6 | |
parent | 9cfc21751d66a5e0316ade0be80f49d0d9951be1 (diff) |
Fix assertion for write netlock in rip6_input(). ip6_input() has
shared net lock. ip_deliver() needs exclusive net lock. Instead
of calling ip_deliver() directly, use ip6_ours() to queue the packet.
Move the write lock assertion into ip_deliver() to catch such bugs
earlier.
The assertion was only triggered with IPv6 multicast forwarding or
router alert hop by hop option. Found by regress test.
OK kn@ mvs@
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/ip6_input.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 2fa634927ad..7f3b8a60934 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.248 2022/06/29 22:45:24 bluhm Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.249 2022/07/24 22:38:25 bluhm Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -448,8 +448,7 @@ ip6_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp) if (ours) { if (af == AF_UNSPEC) - nxt = ip_deliver(mp, offp, nxt, - AF_INET6); + nxt = ip6_ours(mp, offp, nxt, af); goto out; } goto bad; @@ -550,7 +549,7 @@ ip6_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp) if (ours) { if (af == AF_UNSPEC) - nxt = ip_deliver(mp, offp, nxt, AF_INET6); + nxt = ip6_ours(mp, offp, nxt, af); goto out; } @@ -584,8 +583,6 @@ ip6_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp) int ip6_local(struct mbuf **mp, int *offp, int nxt, int af) { - NET_ASSERT_WLOCKED(); - nxt = ip6_hbhchcheck(mp, offp, NULL); if (nxt == IPPROTO_DONE) return IPPROTO_DONE; |