Skip to contentSkip to conversation

netfilter: nf_tables: fix chain filter in nf_tables_dump_rules()

PATCH In review Pablo Neira Ayuso 2 participants 3 messages Dec 19, 2017

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: fix chain filter in nf_tables_dump_rules()

ctx->chain may be null now that we have very large object names, so we cannot check for ctx->chain[0] here.

Fixes e46abbcc05aa ("netfilter: nf_tables: Allow table names of up to 255 chars")
---
 net/netfilter/nf_tables_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +1 -1
index 10798b357481..8d4526651661 100644
@@ -2072,7 +2072,7 @@ static int nf_tables_dump_rules(struct sk_buff *skb,
 				continue;
 
 			list_for_each_entry_rcu(chain, &table->chains, list) {
-				if (ctx && ctx->chain[0] &&
+				if (ctx && ctx->chain &&
 				    strcmp(ctx->chain, chain->name) != 0)
 					continue;
 
Signature · 1 line
2.11.0
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Pablo Neira Ayuso

ctx->chain may be null now that we have very large object names, so we cannot check for ctx->chain[0] here.

Fixes e46abbcc05aa ("netfilter: nf_tables: Allow table names of up to 255 chars")

This really fixes:

b7263e071aba7 ("netfilter: nf_tables: Allow chain name of up to 255 chars")

Quoted 1 line

Apart from that:

Thanks, Phil

author maintainer
#2 lore raw
Quoted 9 lines · Phil Sutter
Quoted 4 lines · Pablo Neira Ayuso

ctx->chain may be null now that we have very large object names, so we cannot check for ctx->chain[0] here.

Fixes e46abbcc05aa ("netfilter: nf_tables: Allow table names of up to 255 chars")

This really fixes:

b7263e071aba7 ("netfilter: nf_tables: Allow chain name of up to 255 chars")

Will fix it here.

Quoted 5 lines
Quoted 1 line

Apart from that:

Thanks for reviewing!