Skip to content

Commit 19467b4

Browse files
committed
netfilter: nf_tables: adjust lockdep assertions handling
JIRA: https://issues.redhat.com/browse/RHEL-115582 Upstream Status: commit 8df1b40 commit 8df1b40 Author: Fedor Pchelkin <pchelkin@ispras.ru> Date: Tue Jun 24 14:12:15 2025 +0300 netfilter: nf_tables: adjust lockdep assertions handling 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: b04df3d ("netfilter: nf_tables: do not defer rule destruction via call_rcu") Reported-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Acked-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Florian Westphal <fwestpha@redhat.com>
1 parent 88cb3a2 commit 19467b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3986,7 +3986,7 @@ void nf_tables_rule_destroy(const struct nft_ctx *ctx, struct nft_rule *rule)
39863986
/* can only be used if rule is no longer visible to dumps */
39873987
static void nf_tables_rule_release(const struct nft_ctx *ctx, struct nft_rule *rule)
39883988
{
3989-
lockdep_commit_lock_is_held(ctx->net);
3989+
WARN_ON_ONCE(!lockdep_commit_lock_is_held(ctx->net));
39903990

39913991
nft_rule_expr_deactivate(ctx, rule, NFT_TRANS_RELEASE);
39923992
nf_tables_rule_destroy(ctx, rule);
@@ -5806,7 +5806,7 @@ void nf_tables_deactivate_set(const struct nft_ctx *ctx, struct nft_set *set,
58065806
struct nft_set_binding *binding,
58075807
enum nft_trans_phase phase)
58085808
{
5809-
lockdep_commit_lock_is_held(ctx->net);
5809+
WARN_ON_ONCE(!lockdep_commit_lock_is_held(ctx->net));
58105810

58115811
switch (phase) {
58125812
case NFT_TRANS_PREPARE_ERROR:

0 commit comments

Comments
 (0)