summaryrefslogtreecommitdiffstats
path: root/net/netfilter/nf_conntrack_extend.c
diff options
context:
space:
mode:
authorLiping Zhang <zlpnobody@gmail.com>2017-03-25 12:09:15 +0800
committerPablo Neira Ayuso <pablo@netfilter.org>2017-03-27 13:47:29 +0200
commit83d90219a5df8d950855ce73229a97b63605c317 (patch)
treed7679fccd772b1c7c9815e8e617566ce7d057181 /net/netfilter/nf_conntrack_extend.c
parent3b7dabf029478bb80507a6c4500ca94132a2bc0b (diff)
netfilter: nfnl_cthelper: fix a race when walk the nf_ct_helper_hash table
The nf_ct_helper_hash table is protected by nf_ct_helper_mutex, while nfct_helper operation is protected by nfnl_lock(NFNL_SUBSYS_CTHELPER). So it's possible that one CPU is walking the nf_ct_helper_hash for cthelper add/get/del, another cpu is doing nf_conntrack_helpers_unregister at the same time. This is dangrous, and may cause use after free error. Note, delete operation will flush all cthelpers added via nfnetlink, so using rcu to do protect is not easy. Now introduce a dummy list to record all the cthelpers added via nfnetlink, then we can walk the dummy list instead of walking the nf_ct_helper_hash. Also, keep nfnl_cthelper_dump_table unchanged, it may be invoked without nfnl_lock(NFNL_SUBSYS_CTHELPER) held. Signed-off-by: Liping Zhang <zlpnobody@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nf_conntrack_extend.c')
0 files changed, 0 insertions, 0 deletions