git: b27e6e91d0ad - main - ng pppoe(4): Add the required NET_EPOCH section to the hook disconnection function.

From: Aleksandr Fedorov <afedorov_at_FreeBSD.org>
Date: Wed, 09 Feb 2022 19:03:53 UTC
The branch main has been updated by afedorov:

URL: https://cgit.FreeBSD.org/src/commit/?id=b27e6e91d0ad1f87b296f7583d4f5d938d7a997c

commit b27e6e91d0ad1f87b296f7583d4f5d938d7a997c
Author:     Aleksandr Fedorov <afedorov@FreeBSD.org>
AuthorDate: 2022-02-09 19:00:50 +0000
Commit:     Aleksandr Fedorov <afedorov@FreeBSD.org>
CommitDate: 2022-02-09 19:00:50 +0000

    ng pppoe(4): Add the required NET_EPOCH section to the hook
    disconnection function.
    
    Disconnecting hooks are called outside of NET_EPOCH, but
    ng_pppoe_disconnect() calls NG_SEND_DATA_ONLY() which should be called
    in NET_EPOCH.
    
    PR:     257067
    Reported by:    niels=freebsd@bakker.net
    Reviewed by:    vmaffione (mentor), glebius, donner
    Approved by:    vmaffione (mentor), glebius, donner
    Sponsored by:   vstack.com
    Differential Revision:  https://reviews.freebsd.org/D34185
---
 sys/netgraph/ng_pppoe.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c
index a18d6a0498a7..8bc44e160044 100644
--- a/sys/netgraph/ng_pppoe.c
+++ b/sys/netgraph/ng_pppoe.c
@@ -2031,6 +2031,7 @@ ng_pppoe_disconnect(hook_p hook)
 				log(LOG_NOTICE, "ng_pppoe[%x]: session out of "
 				    "mbufs\n", node->nd_ID);
 			else {
+				struct epoch_tracker et;
 				struct pppoe_full_hdr *wh;
 				struct pppoe_tag *tag;
 				int	msglen = strlen(SIGNOFF);
@@ -2061,8 +2062,11 @@ ng_pppoe_disconnect(hook_p hook)
 				m->m_pkthdr.len = m->m_len = sizeof(*wh) + sizeof(*tag) +
 				    msglen;
 				wh->ph.length = htons(sizeof(*tag) + msglen);
+
+				NET_EPOCH_ENTER(et);
 				NG_SEND_DATA_ONLY(error,
 					privp->ethernet_hook, m);
+				NET_EPOCH_EXIT(et);
 			}
 		}
 		if (sp->state == PPPOE_LISTENING)