aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira <pablo@netfilter.org>2016-09-09 08:01:26 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2016-09-12 13:54:34 -0400
commitcf71c03edf10076f05a0b678fc9c8f8e6c6e24e4 (patch)
tree200cff9b0554affd3eb5f0dc63a5508151f9c705
parent71212c9b04eba76faa4dca26ccd1552d6bb300c1 (diff)
netfilter: nf_conntrack: simplify __nf_ct_try_assign_helper() return logic
Instead of several goto's just to return the result, simply return it. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--net/netfilter/nf_conntrack_helper.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index b989b81ac156..4ffe388a9a1e 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -189,7 +189,6 @@ int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
189 struct nf_conntrack_helper *helper = NULL; 189 struct nf_conntrack_helper *helper = NULL;
190 struct nf_conn_help *help; 190 struct nf_conn_help *help;
191 struct net *net = nf_ct_net(ct); 191 struct net *net = nf_ct_net(ct);
192 int ret = 0;
193 192
194 /* We already got a helper explicitly attached. The function 193 /* We already got a helper explicitly attached. The function
195 * nf_conntrack_alter_reply - in case NAT is in use - asks for looking 194 * nf_conntrack_alter_reply - in case NAT is in use - asks for looking
@@ -223,15 +222,13 @@ int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
223 if (helper == NULL) { 222 if (helper == NULL) {
224 if (help) 223 if (help)
225 RCU_INIT_POINTER(help->helper, NULL); 224 RCU_INIT_POINTER(help->helper, NULL);
226 goto out; 225 return 0;
227 } 226 }
228 227
229 if (help == NULL) { 228 if (help == NULL) {
230 help = nf_ct_helper_ext_add(ct, helper, flags); 229 help = nf_ct_helper_ext_add(ct, helper, flags);
231 if (help == NULL) { 230 if (help == NULL)
232 ret = -ENOMEM; 231 return -ENOMEM;
233 goto out;
234 }
235 } else { 232 } else {
236 /* We only allow helper re-assignment of the same sort since 233 /* We only allow helper re-assignment of the same sort since
237 * we cannot reallocate the helper extension area. 234 * we cannot reallocate the helper extension area.
@@ -240,13 +237,13 @@ int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
240 237
241 if (tmp && tmp->help != helper->help) { 238 if (tmp && tmp->help != helper->help) {
242 RCU_INIT_POINTER(help->helper, NULL); 239 RCU_INIT_POINTER(help->helper, NULL);
243 goto out; 240 return 0;
244 } 241 }
245 } 242 }
246 243
247 rcu_assign_pointer(help->helper, helper); 244 rcu_assign_pointer(help->helper, helper);
248out: 245
249 return ret; 246 return 0;
250} 247}
251EXPORT_SYMBOL_GPL(__nf_ct_try_assign_helper); 248EXPORT_SYMBOL_GPL(__nf_ct_try_assign_helper);
252 249