summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorVitaliy Makkoveev <mvs@cvs.openbsd.org>2022-12-06 22:19:40 +0000
committerVitaliy Makkoveev <mvs@cvs.openbsd.org>2022-12-06 22:19:40 +0000
commit196ef09d7875e7dc231e37c91c7b2ce5a15a22af (patch)
tree9e874f30be4df56019e998b4e0251c57bd550144 /sys/netinet
parent7897ba5d796ecfb3b0a402a377f6bd55f4285180 (diff)
Add missing kernel lock around (*if_ioctl)() call within
in{,6}_addmulti(). Since kernel lock is no more taken while following setsockopt() path, it should be taken in this place. Corresponding in{,6}_delmulti() already acquire kernel lock around (*if_ioctl)(). Problem reported and diff tested by weerd@ ok kn@ bluhm@
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 0a59d708dfb..fa778ef580f 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.178 2022/11/19 14:26:40 kn Exp $ */
+/* $OpenBSD: in.c,v 1.179 2022/12/06 22:19:39 mvs Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -885,10 +885,13 @@ in_addmulti(struct in_addr *ap, struct ifnet *ifp)
*/
memset(&ifr, 0, sizeof(ifr));
memcpy(&ifr.ifr_addr, &inm->inm_sin, sizeof(inm->inm_sin));
+ KERNEL_LOCK();
if ((*ifp->if_ioctl)(ifp, SIOCADDMULTI,(caddr_t)&ifr) != 0) {
+ KERNEL_UNLOCK();
free(inm, M_IPMADDR, sizeof(*inm));
return (NULL);
}
+ KERNEL_UNLOCK();
TAILQ_INSERT_HEAD(&ifp->if_maddrlist, &inm->inm_ifma,
ifma_list);