Hi,

in_addmulti() is only called from ioctl(2) or setsockopt(2).  Wait
for malloc(9) to make the system call reliable.

ok?

bluhm

Index: netinet/in.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/in.c,v
retrieving revision 1.171
diff -u -p -r1.171 in.c
--- netinet/in.c        10 Mar 2021 10:21:48 -0000      1.171
+++ netinet/in.c        4 Mar 2022 15:42:55 -0000
@@ -866,10 +866,7 @@ in_addmulti(struct in_addr *ap, struct i
                 * 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;

Reply via email to