From: jan Date: Sat, 23 Sep 2023 09:17:21 +0000 (+0000) Subject: Fix unreliable sys_setsockopt() with consistent use of M_WAIT X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a9de4b0b46f2c22f561b99cb11b1bc21b02ff824;p=openbsd Fix unreliable sys_setsockopt() with consistent use of M_WAIT Also remove useless NULL check. ok bluhm@ --- diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 7e6cb9b2731..2919c1c9686 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.213 2023/08/03 09:49:08 mvs Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.214 2023/09/23 09:17:21 jan Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -1214,16 +1214,12 @@ sys_setsockopt(struct proc *p, void *v, register_t *retval) if (SCARG(uap, val)) { m = m_get(M_WAIT, MT_SOOPTS); if (SCARG(uap, valsize) > MLEN) { - MCLGET(m, M_DONTWAIT); + MCLGET(m, M_WAIT); if ((m->m_flags & M_EXT) == 0) { error = ENOBUFS; goto bad; } } - if (m == NULL) { - error = ENOBUFS; - goto bad; - } error = copyin(SCARG(uap, val), mtod(m, caddr_t), SCARG(uap, valsize)); if (error) {