diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nf_sockopt.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c index aa2831587b82..2dfac3253569 100644 --- a/net/netfilter/nf_sockopt.c +++ b/net/netfilter/nf_sockopt.c | |||
@@ -23,14 +23,13 @@ static inline int overlap(int min1, int max1, int min2, int max2) | |||
23 | /* Functions to register sockopt ranges (exclusive). */ | 23 | /* Functions to register sockopt ranges (exclusive). */ |
24 | int nf_register_sockopt(struct nf_sockopt_ops *reg) | 24 | int nf_register_sockopt(struct nf_sockopt_ops *reg) |
25 | { | 25 | { |
26 | struct list_head *i; | 26 | struct nf_sockopt_ops *ops; |
27 | int ret = 0; | 27 | int ret = 0; |
28 | 28 | ||
29 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) | 29 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) |
30 | return -EINTR; | 30 | return -EINTR; |
31 | 31 | ||
32 | list_for_each(i, &nf_sockopts) { | 32 | list_for_each_entry(ops, &nf_sockopts, list) { |
33 | struct nf_sockopt_ops *ops = (struct nf_sockopt_ops *)i; | ||
34 | if (ops->pf == reg->pf | 33 | if (ops->pf == reg->pf |
35 | && (overlap(ops->set_optmin, ops->set_optmax, | 34 | && (overlap(ops->set_optmin, ops->set_optmax, |
36 | reg->set_optmin, reg->set_optmax) | 35 | reg->set_optmin, reg->set_optmax) |
@@ -65,7 +64,6 @@ EXPORT_SYMBOL(nf_unregister_sockopt); | |||
65 | static int nf_sockopt(struct sock *sk, int pf, int val, | 64 | static int nf_sockopt(struct sock *sk, int pf, int val, |
66 | char __user *opt, int *len, int get) | 65 | char __user *opt, int *len, int get) |
67 | { | 66 | { |
68 | struct list_head *i; | ||
69 | struct nf_sockopt_ops *ops; | 67 | struct nf_sockopt_ops *ops; |
70 | int ret; | 68 | int ret; |
71 | 69 | ||
@@ -75,8 +73,7 @@ static int nf_sockopt(struct sock *sk, int pf, int val, | |||
75 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) | 73 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) |
76 | return -EINTR; | 74 | return -EINTR; |
77 | 75 | ||
78 | list_for_each(i, &nf_sockopts) { | 76 | list_for_each_entry(ops, &nf_sockopts, list) { |
79 | ops = (struct nf_sockopt_ops *)i; | ||
80 | if (ops->pf == pf) { | 77 | if (ops->pf == pf) { |
81 | if (!try_module_get(ops->owner)) | 78 | if (!try_module_get(ops->owner)) |
82 | goto out_nosup; | 79 | goto out_nosup; |
@@ -124,7 +121,6 @@ EXPORT_SYMBOL(nf_getsockopt); | |||
124 | static int compat_nf_sockopt(struct sock *sk, int pf, int val, | 121 | static int compat_nf_sockopt(struct sock *sk, int pf, int val, |
125 | char __user *opt, int *len, int get) | 122 | char __user *opt, int *len, int get) |
126 | { | 123 | { |
127 | struct list_head *i; | ||
128 | struct nf_sockopt_ops *ops; | 124 | struct nf_sockopt_ops *ops; |
129 | int ret; | 125 | int ret; |
130 | 126 | ||
@@ -135,8 +131,7 @@ static int compat_nf_sockopt(struct sock *sk, int pf, int val, | |||
135 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) | 131 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) |
136 | return -EINTR; | 132 | return -EINTR; |
137 | 133 | ||
138 | list_for_each(i, &nf_sockopts) { | 134 | list_for_each_entry(ops, &nf_sockopts, list) { |
139 | ops = (struct nf_sockopt_ops *)i; | ||
140 | if (ops->pf == pf) { | 135 | if (ops->pf == pf) { |
141 | if (!try_module_get(ops->owner)) | 136 | if (!try_module_get(ops->owner)) |
142 | goto out_nosup; | 137 | goto out_nosup; |