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/netinet | |
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/netinet')
-rw-r--r-- | sys/netinet/in.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_mroute.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 85116527742..b494b72e844 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in.c,v 1.168 2019/12/01 21:12:42 jca Exp $ */ +/* $OpenBSD: in.c,v 1.169 2020/03/15 05:34:13 visa Exp $ */ /* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */ /* @@ -929,7 +929,9 @@ in_delmulti(struct in_multi *inm) sizeof(struct sockaddr_in); satosin(&ifr.ifr_addr)->sin_family = AF_INET; satosin(&ifr.ifr_addr)->sin_addr = inm->inm_addr; + KERNEL_LOCK(); (*ifp->if_ioctl)(ifp, SIOCDELMULTI, (caddr_t)&ifr); + KERNEL_UNLOCK(); TAILQ_REMOVE(&ifp->if_maddrlist, &inm->inm_ifma, ifma_list); diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index feb43cd2a65..c6aae18b8db 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_mroute.c,v 1.128 2019/09/02 13:12:09 bluhm Exp $ */ +/* $OpenBSD: ip_mroute.c,v 1.129 2020/03/15 05:34:13 visa Exp $ */ /* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */ /* @@ -772,7 +772,9 @@ vif_delete(struct ifnet *ifp) satosin(&ifr.ifr_addr)->sin_len = sizeof(struct sockaddr_in); satosin(&ifr.ifr_addr)->sin_family = AF_INET; satosin(&ifr.ifr_addr)->sin_addr = zeroin_addr; + KERNEL_LOCK(); (*ifp->if_ioctl)(ifp, SIOCDELMULTI, (caddr_t)&ifr); + KERNEL_UNLOCK(); free(v, M_MRTABLE, sizeof(*v)); } |