aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-12-18 01:42:51 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:59:06 -0500
commit051578ccbcdad3b24b621dfb652194e36759e8d5 (patch)
treed0afda1f43bd1e6de4d38e9efa4c498723e7f206 /include
parent1e796fda00f06bac584f0e4ad8750ab9430d79d3 (diff)
[NETFILTER]: nf_nat: properly use RCU for ip_nat_decode_session
We need to use rcu_assign_pointer/rcu_dereference to avoid races. Also remove an obsolete CONFIG_IP_NAT_NEEDED ifdef. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/netfilter.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 0947424d01d6..1a8487325a4f 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -256,11 +256,16 @@ extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
256static inline void 256static inline void
257nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) 257nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family)
258{ 258{
259#if defined(CONFIG_IP_NF_NAT_NEEDED) || defined(CONFIG_NF_NAT_NEEDED) 259#ifdef CONFIG_NF_NAT_NEEDED
260 void (*decodefn)(struct sk_buff *, struct flowi *); 260 void (*decodefn)(struct sk_buff *, struct flowi *);
261 261
262 if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL) 262 if (family == AF_INET) {
263 decodefn(skb, fl); 263 rcu_read_lock();
264 decodefn = rcu_dereference(ip_nat_decode_session);
265 if (decodefn)
266 decodefn(skb, fl);
267 rcu_read_unlock();
268 }
264#endif 269#endif
265} 270}
266 271