netfilter: conntrack: protect early_drop by rcu read lock
authorLiping Zhang <liping.zhang@spreadtrum.com>
Tue, 12 Jul 2016 11:45:00 +0000 (19:45 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 12 Jul 2016 14:24:22 +0000 (16:24 +0200)
commit3101e0fc1f6e809d38fbb5845c6c5eb0eefeda07
tree79b1f0820d001fa4c34efec874fc527377808a6d
parentc2b9b4fee8ab86f2bb657e5ac48d803879e92765
netfilter: conntrack: protect early_drop by rcu read lock

User can add ct entry via nfnetlink(IPCTNL_MSG_CT_NEW), and if the total
number reach the nf_conntrack_max, we will try to drop some ct entries.

But in this case(the main function call path is ctnetlink_create_conntrack
-> nf_conntrack_alloc -> early_drop), rcu_read_lock is not held, so race
with hash resize will happen.

Fixes: 242922a02717 ("netfilter: conntrack: simplify early_drop")
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conntrack_core.c