]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nf_tables: Fix for endless loop when dumping ruleset
authorPhil Sutter <phil@nwl.cc>
Sun, 30 Dec 2018 16:27:43 +0000 (17:27 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 8 Jan 2019 22:01:13 +0000 (23:01 +0100)
commitae69f4097e38ec535304c580d2eaadf431b801e4
treeab43b71812f32ae26ed5915c476c74c55badf905
parent3ba023909fd8a92cb7ce3dfa78e98208014f10a5
netfilter: nf_tables: Fix for endless loop when dumping ruleset

__nf_tables_dump_rules() stores the current idx value into cb->args[0]
before returning to caller. With multiple chains present, cb->args[0] is
therefore updated after each chain's rules have been traversed. This
though causes the final nf_tables_dump_rules() run (which should return
an skb->len of zero since no rules are left to dump) to continue dumping
rules for each but the first chain. Fix this by moving the cb->args[0]
update to nf_tables_dump_rules().

With no final action to be performed anymore in
__nf_tables_dump_rules(), drop 'out_unfinished' jump label and 'rc'
variable - instead return the appropriate value directly.

Fixes: f3aff0023c97a ("netfilter: nf_tables: Speed up selective rule dumps")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c