From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C27172F83CB; Tue, 12 Aug 2025 17:42:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755020551; cv=none; b=LZdI4Il/7Orr2YguS7kA4wqFULIjzLcBPR2wEPbSj4AsbzI7awUhWTFbM7ucPnl2vwMd99OZVrjMsY/dJwa+ANYHVoDjBKHYc+bzDsZ0WHaJ8MCZYnLK20Br1H9TKBTXy4EvYiMGt8HUaZR2c9eGvyUfmtPLyMaenVbeJCFMn9c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755020551; c=relaxed/simple; bh=Czv0JqLgOsYj20WE8sNokHyRh6CZgBuLHotOoEpAkik=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aq3SvMJADk2OPvsDBxEpsncfi+QxxgUXOtiI9a44cI7TBVzC+tS/5kqUwJbEGP3ZDbR0v3mwpcgtntVKb6A3bEa8HX7O1/8Lnud1jm4PUxm0kOHIL0zi1tZFBzzPntaugEhx1coCJAo8DAjj/XQa7G3N7iZ+IZ9N9aML77WtLj8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DzPo8DBo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DzPo8DBo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13AC4C4CEF0; Tue, 12 Aug 2025 17:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755020551; bh=Czv0JqLgOsYj20WE8sNokHyRh6CZgBuLHotOoEpAkik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DzPo8DBoqf59IrUiUvwi+8P1DWMG2ZzlSOMua8w38Rs5eXZGigtQ8CkFSWlADfxma Z5taJKuk18QrDtW1d36UMwVWKhC2ZpQ/mlQ7SD48aFrNI+H5zsLrwuI8dmTk9fOtkY 3MQJkBNmZdvM7OqkNTTuZobEuJNJwxlhA0Gb14g0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexey Khoroshilov , Fedor Pchelkin , Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 6.1 113/253] netfilter: nf_tables: adjust lockdep assertions handling Date: Tue, 12 Aug 2025 19:28:21 +0200 Message-ID: <20250812172953.527258692@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250812172948.675299901@linuxfoundation.org> References: <20250812172948.675299901@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Fedor Pchelkin [ Upstream commit 8df1b40de76979bb8e975201d07b71103d5de820 ] It's needed to check the return value of lockdep_commit_lock_is_held(), otherwise there's no point in this assertion as it doesn't print any debug information on itself. Found by Linux Verification Center (linuxtesting.org) with Svace static analysis tool. Fixes: b04df3da1b5c ("netfilter: nf_tables: do not defer rule destruction via call_rcu") Reported-by: Alexey Khoroshilov Signed-off-by: Fedor Pchelkin Acked-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nf_tables_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 0bf347a0a1dd..df83224bef06 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3513,7 +3513,7 @@ void nf_tables_rule_destroy(const struct nft_ctx *ctx, struct nft_rule *rule) /* can only be used if rule is no longer visible to dumps */ static void nf_tables_rule_release(const struct nft_ctx *ctx, struct nft_rule *rule) { - lockdep_commit_lock_is_held(ctx->net); + WARN_ON_ONCE(!lockdep_commit_lock_is_held(ctx->net)); nft_rule_expr_deactivate(ctx, rule, NFT_TRANS_RELEASE); nf_tables_rule_destroy(ctx, rule); @@ -5250,7 +5250,7 @@ void nf_tables_deactivate_set(const struct nft_ctx *ctx, struct nft_set *set, struct nft_set_binding *binding, enum nft_trans_phase phase) { - lockdep_commit_lock_is_held(ctx->net); + WARN_ON_ONCE(!lockdep_commit_lock_is_held(ctx->net)); switch (phase) { case NFT_TRANS_PREPARE_ERROR: -- 2.39.5