From owner-dev-commits-src-branches@freebsd.org Mon Aug 30 09:18:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBB066730E3; Mon, 30 Aug 2021 09:18:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gyl9P4s4nz3Qtp; Mon, 30 Aug 2021 09:18:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9034F1B4FF; Mon, 30 Aug 2021 09:18:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17U9IHWI056325; Mon, 30 Aug 2021 09:18:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17U9IHk0056324; Mon, 30 Aug 2021 09:18:17 GMT (envelope-from git) Date: Mon, 30 Aug 2021 09:18:17 GMT Message-Id: <202108300918.17U9IHk0056324@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: d6163ad0d9ef - stable/12 - altq: Fix panics on rmc_restart() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d6163ad0d9ef7098ba58f77c792166efe32db8cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2021 09:18:17 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d6163ad0d9ef7098ba58f77c792166efe32db8cb commit d6163ad0d9ef7098ba58f77c792166efe32db8cb Author: Kristof Provost AuthorDate: 2021-08-21 11:42:27 +0000 Commit: Kristof Provost CommitDate: 2021-08-30 09:15:24 +0000 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) --- sys/net/altq/altq_rmclass.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/net/altq/altq_rmclass.c b/sys/net/altq/altq_rmclass.c index 655b5da724cb..288821867b3a 100644 --- a/sys/net/altq/altq_rmclass.c +++ b/sys/net/altq/altq_rmclass.c @@ -1567,7 +1567,9 @@ rmc_restart(struct rm_class *cl) int s; s = splnet(); + NET_EPOCH_ENTER(); IFQ_LOCK(ifd->ifq_); + CURVNET_SET(ifd->ifq_->altq_ifp->if_vnet); if (cl->sleeping_) { cl->sleeping_ = 0; cl->undertime_.tv_sec = 0; @@ -1577,7 +1579,9 @@ rmc_restart(struct rm_class *cl) (ifd->restart)(ifd->ifq_); } } + CURVNET_RESTORE(); IFQ_UNLOCK(ifd->ifq_); + NET_EPOCH_EXIT(); splx(s); }