Skip to content

Commit

Permalink
netfilter: nf_conntrack: use RCU safe kfree for conntrack extensions
Browse files Browse the repository at this point in the history
Commit 68b80f1 (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: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Michal Kubeček authored and Pablo Neira Ayuso committed Sep 13, 2013
1 parent c19d65c commit c13a84a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/net/netfilter/nf_conntrack_extend.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
if (ct->ext)
kfree(ct->ext);
kfree_rcu(ct->ext, rcu);
}

/* Add this type, returns pointer to data or NULL. */
Expand Down

0 comments on commit c13a84a

Please sign in to comment.