From nobody Tue Nov 12 21:32:57 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 4Xp0560Whkz5cf25; Tue, 12 Nov 2024 21:32:58 +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 4Xp0556YWsz4MTY; Tue, 12 Nov 2024 21:32:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731447178; 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=YbV74cwTjBl4Lg1IOZ+dnQXBjCil5dSEgPruT0vD/jo=; b=vPSUUnoS0PD337eulWA9kmvkSI4M8s7hCzRohmsvbfprLXeLpJlHsipUovfiJHuDoBN/8o DKtxg7UuUZD0RgX38aqxdji2RjllE9G9NDMmBwBtkE9iQObFe/ir9dXfqHcG3RDZz0wgUa P6HtqxjCjz8jDJmTH0ORabdp9nejoDzTWkRtq3mS1TmlyMEPil+TiwVHpMnNHV6iDkIJgC RxtsfhqGGpZ4O9WulFvq7m9UOr5O0aPlwunxp9VQ6HAvEO6D4TZS0O4RaPUkjwKLs2Yxiu YdkyYxLescaV8/lA/c/fDvXbs2f9amWGFkRMvG8lX66aw3dA5hchTJJKPv250A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731447178; 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=YbV74cwTjBl4Lg1IOZ+dnQXBjCil5dSEgPruT0vD/jo=; b=vxaRh8oaR/GTt3ysKuwYSn7f8uPWRt8etS0HpCsCW05QFA+HeEVoPDrkViar+dsKgbrR0z z9eTkLC0beWkHr+1jyJAdmCcZIFRZ3qSMQGsQw47wLVdyJOBF2aHzJUZDTgz7GBb/BNQrq 7FF5lF+vf4E1055NGMvldtFc3xEYqqp2kmzulxcZtMB4B75m+mDW9C1/8uWWds4F9wfVO9 uNAYNH+bDVoMmMxO1OH9ERBWakgdN0WitNQLbvRNQKiJkYd0CyNKmlOztN8LohyQdjAz0G oBfcFdB6h56/BfLEtmS967awq9PZeunnFY1GKNUzZKUi1HZqDdr1eVVl1MHUOw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731447178; a=rsa-sha256; cv=none; b=qGx4SXMSVTQWhKKEO3gR956gd1xRETJCt5ZEBUTID+BLFZUFRAI2kkFFk20emDW5+QSyHW x4pxUj/Pm6kKylk3W1tzr7B0XsvZvUyW3NyKbIhPIYHLQxzMm5AxPkYem2nCUlNzh8UwRO xt8L5tol4RI35Z8+UecLvePaxL4wm1L+yiTEivVMyDZDfbyfQzPGVc29FvMzSsIR3PzGwp P9W7Wmbtpx9IcnjmLA+y/f37r6QQO4Ytajzi4TFn4EW2leGNfmcSMPx38pDy/0vWdJSdaQ 8a+/ju08dSr5bP9yJiZjt3shXYmI2zxaIXYYYErLKONRiMqRgu4LPP7/aYf78A== 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 4Xp05564frzRWl; Tue, 12 Nov 2024 21:32:57 +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 4ACLWv37096369; Tue, 12 Nov 2024 21:32:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ACLWvXk096366; Tue, 12 Nov 2024 21:32:57 GMT (envelope-from git) Date: Tue, 12 Nov 2024 21:32:57 GMT Message-Id: <202411122132.4ACLWvXk096366@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 650900cc2f60 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 650900cc2f607458d32d333bd7ab0aa10be13ba4 Auto-Submitted: auto-generated The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=650900cc2f607458d32d333bd7ab0aa10be13ba4 commit 650900cc2f607458d32d333bd7ab0aa10be13ba4 Author: Jose Luis Duran AuthorDate: 2024-11-12 21:08:50 +0000 Commit: Jose Luis Duran CommitDate: 2024-11-12 21:31:24 +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 --- 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 84fac0205ffc..3d3601ede00f 100644 --- a/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c +++ b/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c @@ -172,18 +172,15 @@ ipf_timer_func(void *arg) SPL_INT(s); SPL_NET(s); - READ_ENTER(&softc->ipf_global); if (softc->ipf_running > 0) ipf_slowtimer(softc); if (softc->ipf_running == -1 || softc->ipf_running == 1) { - 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); } @@ -218,7 +215,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);