Skip to content

Commit 1898631

Browse files
edumazetgregkh
authored andcommitted
netfilter: nf_conntrack: do not skip entries in /proc/net/nf_conntrack
[ Upstream commit c5ba345 ] ct_seq_show() has an opportunistic garbage collector : if (nf_ct_should_gc(ct)) { nf_ct_kill(ct); goto release; } So if one nf_conn is killed there, next time ct_get_next() runs, we skip the following item in the bucket, even if it should have been displayed if gc did not take place. We can decrement st->skip_elems to tell ct_get_next() one of the items was removed from the chain. Fixes: 58e207e ("netfilter: evict stale entries when user reads /proc/net/nf_conntrack") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 8736a4b commit 1898631

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/netfilter/nf_conntrack_standalone.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ static int ct_seq_show(struct seq_file *s, void *v)
317317
smp_acquire__after_ctrl_dep();
318318

319319
if (nf_ct_should_gc(ct)) {
320+
struct ct_iter_state *st = s->private;
321+
322+
st->skip_elems--;
320323
nf_ct_kill(ct);
321324
goto release;
322325
}

0 commit comments

Comments
 (0)