summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2022-03-04 21:09:04 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2022-03-04 21:09:04 +0000
commita24764da362ac4ccfc11f006505135b8185f8275 (patch)
tree10f02bf356be239dee19a2e83a5249328914aea3
parent47a7c6217e305b8c0d8339c378bfba04eef38ca5 (diff)
in_addmulti() is only called from ioctl(2) or setsockopt(2). Wait
for malloc(9) to make the system call reliable. OK mvs@
-rw-r--r--sys/netinet/in.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 8ea29ad341b..0563d04f876 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.171 2021/03/10 10:21:48 jsg Exp $ */
+/* $OpenBSD: in.c,v 1.172 2022/03/04 21:09:03 bluhm Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -866,10 +866,7 @@ in_addmulti(struct in_addr *ap, struct ifnet *ifp)
* New address; allocate a new multicast record
* and link it into the interface's multicast list.
*/
- inm = malloc(sizeof(*inm), M_IPMADDR, M_NOWAIT | M_ZERO);
- if (inm == NULL)
- return (NULL);
-
+ inm = malloc(sizeof(*inm), M_IPMADDR, M_WAITOK | M_ZERO);
inm->inm_sin.sin_len = sizeof(struct sockaddr_in);
inm->inm_sin.sin_family = AF_INET;
inm->inm_sin.sin_addr = *ap;