netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf] netfilter: use RCU safe kfree for conntrack extensions
@ 2013-09-11  8:17 Michal Kubecek
  2013-09-11 14:57 ` Phil Oester
  0 siblings, 1 reply; 7+ messages in thread
From: Michal Kubecek @ 2013-09-11  8:17 UTC (permalink / raw)
  To: netfilter-devel
  Cc: netdev, Pablo Neira Ayuso, Patrick McHardy, Jozsef Kadlecsik,
	coreteam

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>
---
 include/net/netfilter/nf_conntrack_extend.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 977bc8a..3313108 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -80,7 +80,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. */
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-09-11 17:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-11  8:17 [PATCH nf] netfilter: use RCU safe kfree for conntrack extensions Michal Kubecek
2013-09-11 14:57 ` Phil Oester
2013-09-11 15:28   ` Michal Kubecek
2013-09-11 17:09     ` Phil Oester
2013-09-11 17:42       ` Michal Kubecek
2013-09-11 17:54         ` Eric Dumazet
2013-09-11 17:50       ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).