From 028065f7d82f833c77de75ba8cf44b16c2288489 Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Wed, 1 Jun 2022 22:35:27 +0200 Subject: [PATCH] epoch: fix assertion If we call epoch_exit_preempt() on an epoch that's not net_epoch_preempt we can't assert td->td_net_epoch. Move the assertion under the 'epoch == net_epoch_preempt' conditional. No functional change for pfSense, as we don't build with INVARIANTS (unless debugging, in which case this panicked during boot). --- sys/kern/subr_epoch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c index 41efc180668aa..f64965db9b726 100644 --- a/sys/kern/subr_epoch.c +++ b/sys/kern/subr_epoch.c @@ -377,9 +377,10 @@ epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et) td = curthread; critical_enter(); sched_unpin(); - MPASS(td->td_net_epoch); - if (epoch == net_epoch_preempt) + if (epoch == net_epoch_preempt) { + MPASS(td->td_net_epoch); td->td_net_epoch--; + } MPASS(td->td_epochnest); td->td_epochnest--; er = epoch_currecord(epoch);