From cf19868b22c48caa3b6403f46dd53b528f696145 Mon Sep 17 00:00:00 2001 From: bluhm Date: Fri, 4 Mar 2022 21:09:03 +0000 Subject: [PATCH] in_addmulti() is only called from ioctl(2) or setsockopt(2). Wait for malloc(9) to make the system call reliable. OK mvs@ --- sys/netinet/in.c | 7 ++----- 1 file 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; -- 2.20.1