[Bug 257067] panic: Assertion in_epoch(net_epoch_preempt) failed at /usr/src/sys/net/if_vlan.c:1185

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 09 Jul 2021 08:27:46 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257067

Aleksandr Fedorov <afedorov@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |afedorov@FreeBSD.org,
                   |                            |donner@FreeBSD.org,
                   |                            |glebius@FreeBSD.org,
                   |                            |markj@FreeBSD.org

--- Comment #1 from Aleksandr Fedorov <afedorov@FreeBSD.org> ---
I think this is a bug in the ng_ppoe(4) code. Disconnecting hooks are called
outside of NET_EPOCH, but ng_pppoe_disconnect() calls NG_SEND_DATA_ONLY() which
should be called in NET_EPOCH.

Please try the following patch:

diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c
index 295a136cc55..e07f77b9d54 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)

-- 
You are receiving this mail because:
You are the assignee for the bug.