DF-2587 / fix.diff
diff --git a/sys/netgraph/ether/ng_ether.c b/sys/netgraph/ether/ng_ether.c @@ -204,7 +204,12 @@ ng_ether_input(struct ifnet *ifp, struct mbuf **mp) { const node_p node = IFP2NG(ifp); - const priv_p priv = node->private; + priv_p priv; + + /* No netgraph node attached (attach failed / detach racing) */ + if (node == NULL) + return; + priv = node->private; /* If "lower" hook not connected, let packet continue */ if (priv->lower == NULL || priv->lowerOrphan) @@ -220,7 +225,14 @@ ng_ether_input_orphan(struct ifnet *ifp, struct mbuf *m) { const node_p node = IFP2NG(ifp); - const priv_p priv = node->private; + priv_p priv; + + /* No netgraph node attached (attach failed / detach racing) */ + if (node == NULL) { + m_freem(m); + return; + } + priv = node->private; /* If "orphan" hook not connected, let packet continue */ if (priv->lower == NULL || !priv->lowerOrphan) { @@ -258,10 +270,15 @@ ng_ether_output(struct ifnet *ifp, struct mbuf **mp) { const node_p node = IFP2NG(ifp); - const priv_p priv = node->private; + priv_p priv; meta_p meta = NULL; int error = 0; + /* No netgraph node attached (attach failed / detach racing) */ + if (node == NULL) + return (0); + priv = node->private; + /* If "upper" hook not connected, let packet continue */ if (priv->upper == NULL) return (0); |