netfilter: nf_tables: avoid false-postive lockdep splat
Subsystems (2)
Florian Westphal
maintainerPATCH 1/1 netfilter: nf_tables: avoid false-postive lockdep splat
There are reports wrt lockdep splat in nftables, e.g.:
------------[ cut here ]------------ WARNING: CPU: 2 PID: 31416 at net/netfilter/nf_tables_api.c:622 lockdep_nfnl_nft_mutex_not_held+0x28/0x38 [nf_tables]
...
These are caused by an earlier, unrelated bug such as a n ABBA deadlock in a different subsystem.
In such an event, lockdep is disabled and lockdep_is_held returns true unconditionally. This then causes the WARN() in nf_tables.
Make the WARN conditional on lockdep still active to avoid this.
--- net/netfilter/nf_tables_api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +2 -1
@@ -619,7 +619,8 @@ static int nft_request_module(struct net *net, const char *fmt, ...)static void lockdep_nfnl_nft_mutex_not_held (void ) {#ifdef CONFIG_PROVE_LOCKING -WARN_ON_ONCE (lockdep_nfnl_is_held (NFNL_SUBSYS_NFTABLES )); +if (debug_locks) +WARN_ON_ONCE (lockdep_nfnl_is_held (NFNL_SUBSYS_NFTABLES ));#endif }
Signature · 1 line
2.26.2
Quoted 4 lines · Florian Westphal
There are reports wrt lockdep splat in nftables, e.g.:
------------[ cut here ]------------ WARNING: CPU: 2 PID: 31416 at net/netfilter/nf_tables_api.c:622 lockdep_nfnl_nft_mutex_not_held+0x28/0x38 [nf_tables]
Quoted 8 lines
...
These are caused by an earlier, unrelated bug such as a n ABBA deadlock in a different subsystem.
In such an event, lockdep is disabled andlockdep_is_heldreturns true unconditionally. This then causes theWARN()innf_tables.Make the WARN conditional on lockdep still active to avoid this.
Applied, thanks.