]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
netfilter: conntrack: don't call iter for non-confirmed conntracks
authorFlorian Westphal <fw@strlen.de>
Sun, 21 May 2017 10:52:56 +0000 (12:52 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 29 May 2017 10:46:09 +0000 (12:46 +0200)
commitb0feacaad13a0aa9657c37ed80991575981e2e3b
tree0d9d33813769ea2a3d4df41b240da7d7156ee936
parent9fd6452d67fb2acda12e5914e2ad371f067f3465
netfilter: conntrack: don't call iter for non-confirmed conntracks

nf_ct_iterate_cleanup_net currently calls iter() callback also for
conntracks on the unconfirmed list, but this is unsafe.

Acesses to nf_conn are fine, but some users access the extension area
in the iter() callback, but that does only work reliably for confirmed
conntracks (ct->ext can be reallocated at any time for unconfirmed
conntrack).

The seond issue is that there is a short window where a conntrack entry
is neither on the list nor in the table: To confirm an entry, it is first
removed from the unconfirmed list, then insert into the table.

Fix this by iterating the unconfirmed list first and marking all entries
as dying, then wait for rcu grace period.

This makes sure all entries that were about to be confirmed either are
in the main table, or will be dropped soon.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conntrack_core.c