Commit c13a84a8 authored by Michal Kubeček's avatar Michal Kubeček Committed by Pablo Neira Ayuso

netfilter: nf_conntrack: use RCU safe kfree for conntrack extensions

Commit 68b80f11 (netfilter: nf_nat: fix RCU races) introduced
RCU protection for freeing extension data when reallocation
moves them to a new location. We need the same protection when
freeing them in nf_ct_ext_free() in order to prevent a
use-after-free by other threads referencing a NAT extension data
via bysource list.
Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent c19d65c9
...@@ -86,7 +86,7 @@ static inline void nf_ct_ext_destroy(struct nf_conn *ct) ...@@ -86,7 +86,7 @@ static inline void nf_ct_ext_destroy(struct nf_conn *ct)
static inline void nf_ct_ext_free(struct nf_conn *ct) static inline void nf_ct_ext_free(struct nf_conn *ct)
{ {
if (ct->ext) if (ct->ext)
kfree(ct->ext); kfree_rcu(ct->ext, rcu);
} }
/* Add this type, returns pointer to data or NULL. */ /* Add this type, returns pointer to data or NULL. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment