From ad2c95130b4baceca8f314e4f1d966fcac8b96b9 Mon Sep 17 00:00:00 2001 From: Lutz Donnerhacke Date: Mon, 14 Jun 2021 00:00:35 +0200 Subject: [PATCH] netgraph/bridge: malloc without flags During tests an assert was triggered and pointed to missing flags in the newlink function of ng_bridge(4). Reported by: markj Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D30759 (cherry picked from commit 4c3280e58727e900d4c217054fe655e3512380f1) --- sys/netgraph/ng_bridge.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c index baedeb911e6..3f3d8b3c406 100644 --- a/sys/netgraph/ng_bridge.c +++ b/sys/netgraph/ng_bridge.c @@ -395,9 +395,7 @@ ng_bridge_newhook(node_p node, hook_p hook, const char *name) if(NG_PEER_NODE(hook) == node) return (ELOOP); - link = malloc(sizeof(*link), M_NETGRAPH_BRIDGE, M_ZERO); - if (link == NULL) - return (ENOMEM); + link = malloc(sizeof(*link), M_NETGRAPH_BRIDGE, M_WAITOK | M_ZERO); link->stats.recvOctets = counter_u64_alloc(M_WAITOK); link->stats.recvPackets = counter_u64_alloc(M_WAITOK);