]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: conntrack: fix crash on timeout object removal
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 5 Oct 2015 14:51:01 +0000 (16:51 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 12 Oct 2015 15:04:34 +0000 (17:04 +0200)
commitaddeddbd407ada56d120411a25842f66c93f46d0
tree20ea2799e0bcc69377bd4eeee66f530cb0afae5e
parent9932dad0876a9143be2a452d69802bec562662e6
netfilter: conntrack: fix crash on timeout object removal

The object and module refcounts are updated for each conntrack template,
however, if we delete the iptables rules and we flush the timeout
database, we may end up with invalid references to timeout object that
are just gone.

Resolve this problem by setting the timeout reference to NULL when the
custom timeout entry is removed from our base. This patch requires some
RCU trickery to ensure safe pointer handling.

This handling is similar to what we already do with conntrack helpers,
the idea is to avoid bumping the timeout object reference counter from
the packet path to avoid the cost of atomic ops.

Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_conntrack_timeout.h
net/netfilter/nf_conntrack_core.c
net/netfilter/nfnetlink_cttimeout.c
net/netfilter/xt_CT.c