AF_UNIX: Allocate pcb using M_WAITOK|M_NULLOK instead of M_NOWAIT
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 27 Apr 2011 05:48:48 +0000 (13:48 +0800)
committerVenkatesh Srinivas <me@endeavour.zapto.org>
Tue, 7 Jun 2011 02:00:27 +0000 (19:00 -0700)
So the allocation will not fail mysteriously while the system will not
panic if the system is really out of memory.

sys/kern/uipc_usrreq.c

index a710462..fad2f23 100644 (file)
@@ -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;