From 940508a5beb61bf614c10e6e6e8763303c5b9ab6 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Wed, 5 Feb 2020 03:06:29 +0000 Subject: [PATCH] Enter the network epoch when ng_socket sends data or control from user land to the netgraph and potentially further down the network stack. --- sys/netgraph/ng_socket.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c index 08ee76300ae8..6339ce0e2ccf 100644 --- a/sys/netgraph/ng_socket.c +++ b/sys/netgraph/ng_socket.c @@ -58,6 +58,8 @@ #include #include #include +#include +#include #include #include #include @@ -217,6 +219,7 @@ static int ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *td) { + struct epoch_tracker et; struct ngpcb *const pcbp = sotongpcb(so); struct ngsock *const priv = NG_NODE_PRIVATE(pcbp->sockdata->node); struct sockaddr_ng *const sap = (struct sockaddr_ng *) addr; @@ -335,7 +338,9 @@ ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, item->apply = &apply; priv->error = -1; + NET_EPOCH_ENTER(et); error = ng_snd_item(item, 0); + NET_EPOCH_EXIT(et); mtx_lock(&priv->mtx); if (priv->error == -1) @@ -403,6 +408,7 @@ static int ngd_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *td) { + struct epoch_tracker et; struct ngpcb *const pcbp = sotongpcb(so); struct sockaddr_ng *const sap = (struct sockaddr_ng *) addr; int len, error; @@ -459,7 +465,9 @@ ngd_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, } /* Send data. */ + NET_EPOCH_ENTER(et); NG_SEND_DATA_FLAGS(error, hook, m, NG_WAITOK); + NET_EPOCH_EXIT(et); release: if (control != NULL)