git: 85cd9f7e989b - stable/13 - ng pppoe(4): Add the required NET_EPOCH section to the hook disconnection function.

From: Aleksandr Fedorov <afedorov_at_FreeBSD.org>
Date: Sun, 13 Feb 2022 12:08:13 UTC
The branch stable/13 has been updated by afedorov:

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

commit 85cd9f7e989bab02aee32a5f25d517567a0cc928
Author:     Aleksandr Fedorov <afedorov@FreeBSD.org>
AuthorDate: 2022-02-09 19:00:50 +0000
Commit:     Aleksandr Fedorov <afedorov@FreeBSD.org>
CommitDate: 2022-02-13 12:05:45 +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
    
    (cherry picked from commit b27e6e91d0ad1f87b296f7583d4f5d938d7a997c)
---
 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 295a136cc554..e07f77b9d541 100644
--- a/sys/netgraph/ng_pppoe.c
+++ b/sys/netgraph/ng_pppoe.c
@@ -2037,6 +2037,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);
@@ -2067,8 +2068,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)