diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2020-03-15 05:34:15 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2020-03-15 05:34:15 +0000 |
commit | 7b15ebfe4d2426ac925e67780a0aba09f1b7ae4b (patch) | |
tree | 7644c01b236a984b1495797ae9aa17a35d782134 /sys/netinet6 | |
parent | 1033b63777491693c4a054ff49f9c83284255454 (diff) |
Guard SIOCDELMULTI if_ioctl calls with KERNEL_LOCK() where the call is
made from socket close path. Most device drivers are not MP-safe yet,
and the closing of AF_INET and AF_INET6 sockets is no longer under the
kernel lock.
This fixes a panic seen by jcs@.
OK mpi@
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6.c | 4 | ||||
-rw-r--r-- | sys/netinet6/ip6_mroute.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 417c3f50996..2bd9a74b8ae 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.234 2019/11/18 22:08:59 bluhm Exp $ */ +/* $OpenBSD: in6.c,v 1.235 2020/03/15 05:34:14 visa Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -1100,7 +1100,9 @@ in6_delmulti(struct in6_multi *in6m) ifr.ifr_addr.sin6_len = sizeof(struct sockaddr_in6); ifr.ifr_addr.sin6_family = AF_INET6; ifr.ifr_addr.sin6_addr = in6m->in6m_addr; + KERNEL_LOCK(); (*ifp->if_ioctl)(ifp, SIOCDELMULTI, (caddr_t)&ifr); + KERNEL_UNLOCK(); TAILQ_REMOVE(&ifp->if_maddrlist, &in6m->in6m_ifma, ifma_list); diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 55de51659bd..9203f5a8c80 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_mroute.c,v 1.122 2019/09/04 16:13:49 bluhm Exp $ */ +/* $OpenBSD: ip6_mroute.c,v 1.123 2020/03/15 05:34:14 visa Exp $ */ /* $NetBSD: ip6_mroute.c,v 1.59 2003/12/10 09:28:38 itojun Exp $ */ /* $KAME: ip6_mroute.c,v 1.45 2001/03/25 08:38:51 itojun Exp $ */ @@ -565,7 +565,9 @@ ip6_mrouter_detach(struct ifnet *ifp) memset(&ifr, 0, sizeof(ifr)); ifr.ifr_addr.sin6_family = AF_INET6; ifr.ifr_addr.sin6_addr = in6addr_any; + KERNEL_LOCK(); (*ifp->if_ioctl)(ifp, SIOCDELMULTI, (caddr_t)&ifr); + KERNEL_UNLOCK(); free(m6, M_MRTABLE, sizeof(*m6)); } |