Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Michal Kubeček and committed by
Pablo Neira Ayuso
c13a84a8 c19d65c9

+1 -1
+1 -1
include/net/netfilter/nf_conntrack_extend.h
··· 86 86 static inline void nf_ct_ext_free(struct nf_conn *ct) 87 87 { 88 88 if (ct->ext) 89 - kfree(ct->ext); 89 + kfree_rcu(ct->ext, rcu); 90 90 } 91 91 92 92 /* Add this type, returns pointer to data or NULL. */