aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2015-12-03 04:49:42 -0500
committerPablo Neira Ayuso <pablo@netfilter.org>2015-12-15 09:14:04 -0500
commit9c55d3b5459bffe8ac098175e672a90260c0cfa4 (patch)
tree0abda573f209020c8877a48dd4517c917ea8be3f /net/netfilter
parentc38c4597e4bf3e99860eac98211748e1ecb0e139 (diff)
nfnetlink: add nfnl_dereference_protected helper
to avoid overly long line in followup patch. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nfnetlink.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 28591fa94ba5..aebf5cd45602 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -33,6 +33,10 @@ MODULE_LICENSE("GPL");
33MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); 33MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
34MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_NETFILTER); 34MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_NETFILTER);
35 35
36#define nfnl_dereference_protected(id) \
37 rcu_dereference_protected(table[(id)].subsys, \
38 lockdep_nfnl_is_held((id)))
39
36static char __initdata nfversion[] = "0.30"; 40static char __initdata nfversion[] = "0.30";
37 41
38static struct { 42static struct {
@@ -208,8 +212,7 @@ replay:
208 } else { 212 } else {
209 rcu_read_unlock(); 213 rcu_read_unlock();
210 nfnl_lock(subsys_id); 214 nfnl_lock(subsys_id);
211 if (rcu_dereference_protected(table[subsys_id].subsys, 215 if (nfnl_dereference_protected(subsys_id) != ss ||
212 lockdep_is_held(&table[subsys_id].mutex)) != ss ||
213 nfnetlink_find_client(type, ss) != nc) 216 nfnetlink_find_client(type, ss) != nc)
214 err = -EAGAIN; 217 err = -EAGAIN;
215 else if (nc->call) 218 else if (nc->call)
@@ -299,15 +302,13 @@ replay:
299 skb->sk = oskb->sk; 302 skb->sk = oskb->sk;
300 303
301 nfnl_lock(subsys_id); 304 nfnl_lock(subsys_id);
302 ss = rcu_dereference_protected(table[subsys_id].subsys, 305 ss = nfnl_dereference_protected(subsys_id);
303 lockdep_is_held(&table[subsys_id].mutex));
304 if (!ss) { 306 if (!ss) {
305#ifdef CONFIG_MODULES 307#ifdef CONFIG_MODULES
306 nfnl_unlock(subsys_id); 308 nfnl_unlock(subsys_id);
307 request_module("nfnetlink-subsys-%d", subsys_id); 309 request_module("nfnetlink-subsys-%d", subsys_id);
308 nfnl_lock(subsys_id); 310 nfnl_lock(subsys_id);
309 ss = rcu_dereference_protected(table[subsys_id].subsys, 311 ss = nfnl_dereference_protected(subsys_id);
310 lockdep_is_held(&table[subsys_id].mutex));
311 if (!ss) 312 if (!ss)
312#endif 313#endif
313 { 314 {