From nobody Tue Nov 19 02:39:03 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XspbW34kcz5dQsq; Tue, 19 Nov 2024 02:39:03 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XspbW2Cybz4113; Tue, 19 Nov 2024 02:39:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731983943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uvVvydrlnCu76S1b7170Jv6TpIXy+VPfihojEoSQCXU=; b=diCM/PyAcE7mA8ezP/jjIFzdLkdOSTPTlGkNYY3cFWkQU8SZcScN2ZYn9L5TjvtYnlCktm IWSWffhS231hxnBZ86fOOBGylfpwwbirefdpYY3jqufFVHaFR/IJAf+0/F4Q3ZKV+mFGHq taMOMlWjFY2INRFcKEjp4j0VpCrlFyPh4CfxFYSO9M5ST5fMCqN0qHEnDQ4eIdz9AvCYHh xDJgXndccxDlaDXDCgyFWeDl72crow019jTT1O+bp3wa8w/XmCj8+5HqfhfTGdOMkcV+lc trC98Zbow/vQqIEPfwPNs3dXvt0pNx587E7bhT39hpGwMQePrgrgZZIS3/9vBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731983943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uvVvydrlnCu76S1b7170Jv6TpIXy+VPfihojEoSQCXU=; b=UbHo79+mD8h9f5gsoXNEEtoL058SV4PGYklAkWO10fBDw2j2O9df3wp302Z8ecH6XjTcOf 2eJ3DRXVWzM+nuWuubZRFb4+il4bWqNplPNssmxIgsXIJB+h3U+wD76OzBmp5uT8FlYtDF suk5TzJiNn5dlGByXvXIzRvnell3dD6e1i/akmCdzt+zmJx3tI3bj+FGZSkbnEytvHxTZr W7SmY11RiiwqSmtTP3r9PdR26IASCvh2OHD6G7aQ82tuDQ1BSDXXsyJbCtZTkyu+QqAj/z yiO2nkkymuVhEmRJ/oNYFJXjDYixhFWIchKsTOVd1Tr/fY9VFTiopLJKsvvZsg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731983943; a=rsa-sha256; cv=none; b=KtZYv3aTiyq1U0dYGOxk4dg/0AcL1GWIc8KImuhOG6cNZ/HGOJBtTuwOSHbPC+Ik/J+ndx IhTAubXlSST1rlJqIjv0tnwhNHJpRwKtupcZMyPetwaO6SdCvezrqGK7QW2sDqwT05CPMw UGxUUBi/mcDmX/5NI6T/xmitLCCcbMi5QCYf1W93dFQkbcUfAUJWR2yZoM1aYM4SeUN9eL OlVKBQGW/hyM3LrFpSgi/B2nbBJln37Ysx1JfubN2KdRCuG5ed7XHJSD+8rc4pj57uB5VX OBuKDep3Ty3mSHfxJvAMZ8gTKnrWumHzH69kF9TTH4yfzEXIcGkUywrawC4YXg== 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 4XspbW1M3Sz16Bc; Tue, 19 Nov 2024 02:39:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AJ2d3c6006969; Tue, 19 Nov 2024 02:39:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AJ2d372006966; Tue, 19 Nov 2024 02:39:03 GMT (envelope-from git) Date: Tue, 19 Nov 2024 02:39:03 GMT Message-Id: <202411190239.4AJ2d372006966@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jose Luis Duran Subject: git: 8b29ab3aff13 - stable/14 - ipfilter: Avoid holding a lock while stopping List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8b29ab3aff13366f1032ec28611db5200e3badf5 Auto-Submitted: auto-generated The branch stable/14 has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=8b29ab3aff13366f1032ec28611db5200e3badf5 commit 8b29ab3aff13366f1032ec28611db5200e3badf5 Author: Jose Luis Duran AuthorDate: 2024-11-02 17:58:59 +0000 Commit: Jose Luis Duran CommitDate: 2024-11-19 02:32:59 +0000 ipfilter: Avoid holding a lock while stopping Avoid calling _callout_stop_safe with a non-sleepable lock held when detaching by initializing callout_init_rw() with CALLOUT_SHAREDLOCK, and avoiding re-initialization inside the timer function. PR: 282478 Reviewed by: cy, emaste, jhb, markj Tested by: cy Approved by: emaste (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47530 (cherry picked from commit 1fa6daaafd74c1a457dcfe26e0a5943b5441dc9d) (cherry picked from commit a0618fbe19dfedcdf01b4c232fe6669ae19505c4) (cherry picked from commit 650900cc2f607458d32d333bd7ab0aa10be13ba4) --- sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c b/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c index 95f9fa1dd278..2a6ff68649b9 100644 --- a/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c +++ b/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c @@ -172,7 +172,6 @@ ipf_timer_func(void *arg) SPL_INT(s); SPL_NET(s); - READ_ENTER(&softc->ipf_global); if (softc->ipf_running > 0) ipf_slowtimer(softc); @@ -181,12 +180,10 @@ ipf_timer_func(void *arg) #if 0 softc->ipf_slow_ch = timeout(ipf_timer_func, softc, hz/2); #endif - callout_init(&softc->ipf_slow_ch, 1); callout_reset(&softc->ipf_slow_ch, (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT, ipf_timer_func, softc); } - RWLOCK_EXIT(&softc->ipf_global); SPL_X(s); } @@ -221,7 +218,7 @@ ipfattach(ipf_main_softc_t *softc) softc->ipf_slow_ch = timeout(ipf_timer_func, softc, (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT); #endif - callout_init(&softc->ipf_slow_ch, 1); + callout_init_rw(&softc->ipf_slow_ch, &softc->ipf_global.ipf_lk, CALLOUT_SHAREDLOCK); callout_reset(&softc->ipf_slow_ch, (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT, ipf_timer_func, softc); return (0);