From: Pablo Neira Ayuso Date: Wed, 4 Oct 2017 15:18:27 +0000 (+0200) Subject: netfilter: nf_tables: do not dump chain counters if not enabled X-Git-Tag: v5.15~10263^2~2^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f9bfe0ef622a7bb9707c22ceb4b6451e1e2cb7b;p=platform%2Fkernel%2Flinux-starfive.git netfilter: nf_tables: do not dump chain counters if not enabled Chain counters are only enabled on demand since 9f08ea848117, skip them when dumping them via netlink. Fixes: 9f08ea848117 ("netfilter: nf_tables: keep chain counters away from hot path") Reported-by: Johny Mattsson Tested-by: Johny Mattsson Signed-off-by: Pablo Neira Ayuso --- diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 34adedcb239e..64e1ee091225 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -1048,7 +1048,7 @@ static int nf_tables_fill_chain_info(struct sk_buff *skb, struct net *net, if (nla_put_string(skb, NFTA_CHAIN_TYPE, basechain->type->name)) goto nla_put_failure; - if (nft_dump_stats(skb, nft_base_chain(chain)->stats)) + if (basechain->stats && nft_dump_stats(skb, basechain->stats)) goto nla_put_failure; }