]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: evict stale entries when user reads /proc/net/nf_conntrack
authorFlorian Westphal <fw@strlen.de>
Thu, 22 Sep 2016 21:49:17 +0000 (23:49 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 25 Sep 2016 12:54:08 +0000 (14:54 +0200)
commit77724c6dc047bf4361ca331468931564b2a6a557
tree3fd31a00ff22584e3800e6f1538a67b94bb4d701
parentd301b61159f866c6225ae6eefa93a689cc14cbd3
netfilter: evict stale entries when user reads /proc/net/nf_conntrack

Fabian reports a possible conntrack memory leak (could not reproduce so
far), however, one minor issue can be easily resolved:

> cat /proc/net/nf_conntrack | wc -l = 5
> 4 minutes required to clean up the table.

We should not report those timed-out entries to the user in first place.
And instead of just skipping those timed-out entries while iterating over
the table we can also zap them (we already do this during ctnetlink
walks, but I forgot about the /proc interface).

Fixes: 662b185f6bc9 ("netfilter: conntrack: get rid of conntrack timer")
Reported-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conntrack_standalone.c