From f71291a65edabf05123ac95754778ec67717a463 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Wed, 5 Feb 2020 03:07:20 +0000 Subject: [PATCH] I doubt anybody in the world uses ng_device, but its write method should also enter the network epoch when sending data from user level to netgraph. --- sys/netgraph/ng_device.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/netgraph/ng_device.c b/sys/netgraph/ng_device.c index b239982df28c..248572b6fd49 100644 --- a/sys/netgraph/ng_device.c +++ b/sys/netgraph/ng_device.c @@ -46,6 +46,8 @@ #include #include #include +#include +#include #include #include #include @@ -454,6 +456,7 @@ ngdread(struct cdev *dev, struct uio *uio, int flag) static int ngdwrite(struct cdev *dev, struct uio *uio, int flag) { + struct epoch_tracker et; priv_p priv = (priv_p )dev->si_drv1; struct mbuf *m; int error = 0; @@ -469,7 +472,9 @@ ngdwrite(struct cdev *dev, struct uio *uio, int flag) if ((m = m_uiotombuf(uio, M_NOWAIT, 0, 0, M_PKTHDR)) == NULL) return (ENOBUFS); + NET_EPOCH_ENTER(et); NG_SEND_DATA_ONLY(error, priv->hook, m); + NET_EPOCH_EXIT(et); return (error); }