diff options
author | Masao Uebayashi <uebayasi@cvs.openbsd.org> | 2013-06-18 22:42:57 +0000 |
---|---|---|
committer | Masao Uebayashi <uebayasi@cvs.openbsd.org> | 2013-06-18 22:42:57 +0000 |
commit | addb686c249c0bd50683516f299368427e6c6b0b (patch) | |
tree | eabb79b40631d7c94b3c316a6c9a873f65d43295 | |
parent | 0f0e9a7b6c3058e0d65e54785fc1e9fad8b6e9ea (diff) |
Use malloc(M_WAITOK) in if_attach_common(), because this function must
succeed, and it's always called in sleepable context.
OK mikeb@ yasuoka@
-rw-r--r-- | sys/net/if.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index ee2124408bd..f16d797d663 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.258 2013/04/02 08:54:37 mpi Exp $ */ +/* $OpenBSD: if.c,v 1.259 2013/06/18 22:42:56 uebayasi Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -435,19 +435,13 @@ if_attach_common(struct ifnet *ifp) TAILQ_INIT(&ifp->if_addrlist); ifp->if_addrhooks = malloc(sizeof(*ifp->if_addrhooks), - M_TEMP, M_NOWAIT); - if (ifp->if_addrhooks == NULL) - panic("if_attach_common: malloc"); + M_TEMP, M_WAITOK); TAILQ_INIT(ifp->if_addrhooks); ifp->if_linkstatehooks = malloc(sizeof(*ifp->if_linkstatehooks), - M_TEMP, M_NOWAIT); - if (ifp->if_linkstatehooks == NULL) - panic("if_attach_common: malloc"); + M_TEMP, M_WAITOK); TAILQ_INIT(ifp->if_linkstatehooks); ifp->if_detachhooks = malloc(sizeof(*ifp->if_detachhooks), - M_TEMP, M_NOWAIT); - if (ifp->if_detachhooks == NULL) - panic("if_attach_common: malloc"); + M_TEMP, M_WAITOK); TAILQ_INIT(ifp->if_detachhooks); } |