Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=62.96.220.36 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796129052; b=dtP60VWRztpB5vW/O3Z8FIYpoojv5V21GFM9jyjkp1lATNGJTVDlX2Fm2du97sX7/Aph xKxLowSserP1D9SExlS/E+3v6R3xHE3AI6IOhLofxe8RF8VcSjP1wqjMB9Gef0bqIsvtZ LHnwxZQflBwT0+5wxt6Sf1NKgLeAEzICg+pjEcfc36dcg5IspLrcIBCbU5ASKjRhIc/ct KRFkt4YFuYAC6JywPGAHcUSuVW68yHXvCBZhmzLl/UgW0WKLULjQR7UYF2528XW50V8nd BtVF8clBSHIJQV3TyGehSXN/4TkzjIoQ4raQkCE31DXnsLl5wNK82slTcQLuJ+7dO1Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796129052; h=DMARC-Filter:Received:X-Virus-Scanned:Received:Received:DKIM-Filter: DKIM-Signature:Received:Received:From:To:CC:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-Type:X-ClientProxiedBy; bh=8kkxlaLTWybJWEBv++jtHjkTGT0aV9rbIF4X+bnm7Bo=; b=ef+BxwIGv51P1d95wZEqt51PEg6mz2+Ls1v802nme7nRFnVmqYc998+wVBpVEoObjujD zxYnM/CY2j2Q3A8BB3OCp/QRes0YuYgnlVXmuBzYTvsIuaDsS65JDRJkeL7AriOxzF+/w xk75/d3M7znWS6oXlbRNQQOzPC7QuE/cfSYJWkcZoqNgrtvZM03rzFNToclVaEtpqjRsP h5ybBrcQy2F+udLEysHLEEuLxXuYp9oGJEIS6eu5MgIMDu1cp77pSMpmPky0+VKwCDGJy mV+KxpTEMjc/Lyn0oFBM7ex8O+JCGy+AUExkMumQtQrETOXvIQVKweoA2ubobxjBt1Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=F83rgn6i; arc=none smtp.remote-ip=62.96.220.36 Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A95A7606A335 for ; Tue, 1 Dec 2026 12:44:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A95A7606A335 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=F83rgn6i Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id 7955B205FA; Tue, 1 Dec 2026 13:44:10 +0100 (CET) X-Virus-Scanned: by secunet Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mhyMqtczgWua; Tue, 1 Dec 2026 13:44:09 +0100 (CET) Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id 98554207C6; Tue, 1 Dec 2026 13:44:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 98554207C6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1796129049; bh=8kkxlaLTWybJWEBv++jtHjkTGT0aV9rbIF4X+bnm7Bo=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=F83rgn6iQMdxKAxK6r7uCD+AaLNoOb/AsD3k4U+3hgzNWZbYvkeeDQ0hW2AXm20ud kAc/UICVZq41+CbmZVXhaUsy8rmzRAFhOEm3WPaxT5v2auvE9qXq7DdDeLioxK7JCp HE+OzeCuwnMhfqOLDySMoiuXQorjp0r7jdOnGkDFXWjOLz62lpjwuuvS7Ia9klHOER IN9NL/ui1XjlxIwg9qRuvzCOGKViPj26wnV0W+0NhjYpAVv0HXGyg90KgYVTlM4eWg nVqi6N64oAxnIh9PkUCGKoiUqDO4ah7ok33j+wqiL3Q5UMjM3v8djJmVvzV5tKI1rm gWIgVKvfm/BTA== Received: from gauss4 (10.182.7.102) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Tue, 1 Dec 2026 13:44:09 +0100 Received: (nullmailer pid 1165839 invoked by uid 1000); Tue, 01 Dec 2026 12:43:56 -0000 From: Steffen Klassert To: David Miller , Jakub Kicinski CC: Herbert Xu , Steffen Klassert , Subject: [PATCH 21/22] Revert "xfrm: serialize state GC with device state flush" Date: Tue, 1 Dec 2026 13:41:47 +0100 Message-ID: <20261201124252.1163254-22-steffen.klassert@secunet.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261201124252.1163254-1-steffen.klassert@secunet.com> References: <20261201124252.1163254-1-steffen.klassert@secunet.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-02.secunet.de (10.32.0.172) To EXCH-01.secunet.de (10.32.0.171) From: Jianbo Liu This reverts commit 89fefad9f971bc637fb22373078144f2563c4be9. The mutex kept the state GC from destroying a state while xfrm_dev_state_flush() was freeing its device state. It can't cover xfrm_state_find(), which frees device state under RCU. The flush now holds a reference on each state it frees, and xfrm_dev_state_free() lets only one caller free the device state. Nothing is left for the mutex to protect, so remove it. This needs "xfrm: Serialize device state teardown". Without that patch the flush frees the device state of a state it holds no reference on. Link: https://lore.kernel.org/netdev/aqfZNeR58HLm2x1o@secunet.com/ Signed-off-by: Jianbo Liu Reviewed-by: Carolina Jubran Signed-off-by: Steffen Klassert --- net/xfrm/xfrm_state.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 92c3631a43bf..d48c88f2df64 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -226,7 +226,6 @@ static struct xfrm_state_afinfo __rcu *xfrm_state_afinfo[NPROTO]; static DEFINE_SPINLOCK(xfrm_state_gc_lock); static DEFINE_SPINLOCK(xfrm_state_dev_gc_lock); -static DEFINE_MUTEX(xfrm_state_gc_mutex); int __xfrm_state_delete(struct xfrm_state *x); @@ -639,10 +638,8 @@ static void xfrm_state_gc_task(struct work_struct *work) synchronize_rcu(); - mutex_lock(&xfrm_state_gc_mutex); hlist_for_each_entry_safe(x, tmp, &gc_list, gclist) xfrm_state_gc_destroy(x); - mutex_unlock(&xfrm_state_gc_mutex); } static enum hrtimer_restart xfrm_timer_handler(struct hrtimer *me) @@ -1018,7 +1015,6 @@ int xfrm_dev_state_flush(struct net *net, struct net_device *dev, bool task_vali out: spin_unlock_bh(&net->xfrm.xfrm_state_lock); - mutex_lock(&xfrm_state_gc_mutex); spin_lock_bh(&xfrm_state_dev_gc_lock); hlist_for_each_entry_safe(x, tmp, &xfrm_state_dev_gc_list, dev_gclist) { xso = &x->xso; @@ -1035,7 +1031,6 @@ int xfrm_dev_state_flush(struct net *net, struct net_device *dev, bool task_vali } } spin_unlock_bh(&xfrm_state_dev_gc_lock); - mutex_unlock(&xfrm_state_gc_mutex); if (!hlist_empty(&flush_list)) synchronize_rcu(); -- 2.53.0