From: Sepherosa Ziehau Date: Wed, 27 Apr 2011 05:48:48 +0000 (+0800) Subject: AF_UNIX: Allocate pcb using M_WAITOK|M_NULLOK instead of M_NOWAIT X-Git-Tag: v2.12.0~749 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/c444f2f522057c0bb8f28e708cfb49889c7ab6e8 AF_UNIX: Allocate pcb using M_WAITOK|M_NULLOK instead of M_NOWAIT So the allocation will not fail mysteriously while the system will not panic if the system is really out of memory. --- diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index a710462a5f..fad2f237e8 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -726,7 +726,7 @@ unp_attach(struct socket *so, struct pru_attach_info *ai) if (error) goto failed; } - unp = kmalloc(sizeof(*unp), M_UNPCB, M_NOWAIT|M_ZERO); + unp = kmalloc(sizeof(*unp), M_UNPCB, M_WAITOK | M_ZERO | M_NULLOK); if (unp == NULL) { error = ENOBUFS; goto failed;