aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2021-08-21 11:42:27 +0000
committerKristof Provost <kp@FreeBSD.org>2021-08-30 08:02:14 +0000
commitbd0ad8209d55aca19b5f69b2ddc7c956863382b3 (patch)
treedbf18acb93468a6ed6c27a7af40a3b8c6830494e
parent08fe2da3cef29ac837108be1ed644c52ccc04ed4 (diff)
altq: Fix panics on rmc_restart()
rmc_restart() is called from a timer, but can trigger traffic. This means the curvnet context will not be set. Use the vnet associated with the interface we're currently processing to set it. We also have to enter net_epoch here, for the same reason. Reviewed by: mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31642 (cherry picked from commit 159258afb50ad57f7ed27fe86ded83a7b3a26f90)
-rw-r--r--sys/net/altq/altq_rmclass.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/net/altq/altq_rmclass.c b/sys/net/altq/altq_rmclass.c
index a6ede6feebe2..a9af314cd48a 100644
--- a/sys/net/altq/altq_rmclass.c
+++ b/sys/net/altq/altq_rmclass.c
@@ -1554,10 +1554,13 @@ rmc_restart(void *arg)
{
struct rm_class *cl = arg;
struct rm_ifdat *ifd = cl->ifdat_;
+ struct epoch_tracker et;
int s;
s = splnet();
+ NET_EPOCH_ENTER(et);
IFQ_LOCK(ifd->ifq_);
+ CURVNET_SET(ifd->ifq_->altq_ifp->if_vnet);
if (cl->sleeping_) {
cl->sleeping_ = 0;
cl->undertime_.tv_sec = 0;
@@ -1567,7 +1570,9 @@ rmc_restart(void *arg)
(ifd->restart)(ifd->ifq_);
}
}
+ CURVNET_RESTORE();
IFQ_UNLOCK(ifd->ifq_);
+ NET_EPOCH_EXIT(et);
splx(s);
}