Commit fe3eb20c authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETFILTER]: nf_conntrack: change nf_conntrack_l[34]proto_unregister to void

No caller checks the return value, and since its usually called within the
module unload path there's nothing a module could do about errors anyway,
so BUG on invalid conditions and return void.
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 982d9a9c
...@@ -89,7 +89,7 @@ extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX]; ...@@ -89,7 +89,7 @@ extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX];
/* Protocol registration. */ /* Protocol registration. */
extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto);
extern int nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto);
extern struct nf_conntrack_l3proto * extern struct nf_conntrack_l3proto *
nf_ct_l3proto_find_get(u_int16_t l3proto); nf_ct_l3proto_find_get(u_int16_t l3proto);
......
...@@ -109,7 +109,7 @@ extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p); ...@@ -109,7 +109,7 @@ extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
/* Protocol registration. */ /* Protocol registration. */
extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto); extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto);
extern int nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto); extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto);
/* Generic netlink helpers */ /* Generic netlink helpers */
extern int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb, extern int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb,
......
...@@ -215,22 +215,12 @@ int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto) ...@@ -215,22 +215,12 @@ int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto)
} }
EXPORT_SYMBOL_GPL(nf_conntrack_l3proto_register); EXPORT_SYMBOL_GPL(nf_conntrack_l3proto_register);
int nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto) void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto)
{ {
int ret = 0; BUG_ON(proto->l3proto >= AF_MAX);
if (proto->l3proto >= AF_MAX) {
ret = -EBUSY;
goto out;
}
write_lock_bh(&nf_conntrack_lock); write_lock_bh(&nf_conntrack_lock);
if (nf_ct_l3protos[proto->l3proto] != proto) { BUG_ON(nf_ct_l3protos[proto->l3proto] != proto);
write_unlock_bh(&nf_conntrack_lock);
ret = -EBUSY;
goto out;
}
rcu_assign_pointer(nf_ct_l3protos[proto->l3proto], rcu_assign_pointer(nf_ct_l3protos[proto->l3proto],
&nf_conntrack_l3proto_generic); &nf_conntrack_l3proto_generic);
write_unlock_bh(&nf_conntrack_lock); write_unlock_bh(&nf_conntrack_lock);
...@@ -240,9 +230,6 @@ int nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto) ...@@ -240,9 +230,6 @@ int nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto)
/* Remove all contrack entries for this protocol */ /* Remove all contrack entries for this protocol */
nf_ct_iterate_cleanup(kill_l3proto, proto); nf_ct_iterate_cleanup(kill_l3proto, proto);
out:
return ret;
} }
EXPORT_SYMBOL_GPL(nf_conntrack_l3proto_unregister); EXPORT_SYMBOL_GPL(nf_conntrack_l3proto_unregister);
...@@ -368,27 +355,17 @@ int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *l4proto) ...@@ -368,27 +355,17 @@ int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *l4proto)
} }
EXPORT_SYMBOL_GPL(nf_conntrack_l4proto_register); EXPORT_SYMBOL_GPL(nf_conntrack_l4proto_register);
int nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *l4proto) void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *l4proto)
{ {
int ret = 0; BUG_ON(l4proto->l3proto >= PF_MAX);
if (l4proto->l3proto >= PF_MAX) {
ret = -EBUSY;
goto out;
}
if (l4proto == &nf_conntrack_l4proto_generic) { if (l4proto == &nf_conntrack_l4proto_generic) {
nf_ct_l4proto_unregister_sysctl(l4proto); nf_ct_l4proto_unregister_sysctl(l4proto);
goto out; return;
} }
write_lock_bh(&nf_conntrack_lock); write_lock_bh(&nf_conntrack_lock);
if (nf_ct_protos[l4proto->l3proto][l4proto->l4proto] BUG_ON(nf_ct_protos[l4proto->l3proto][l4proto->l4proto] != l4proto);
!= l4proto) {
write_unlock_bh(&nf_conntrack_lock);
ret = -EBUSY;
goto out;
}
rcu_assign_pointer(nf_ct_protos[l4proto->l3proto][l4proto->l4proto], rcu_assign_pointer(nf_ct_protos[l4proto->l3proto][l4proto->l4proto],
&nf_conntrack_l4proto_generic); &nf_conntrack_l4proto_generic);
write_unlock_bh(&nf_conntrack_lock); write_unlock_bh(&nf_conntrack_lock);
...@@ -398,8 +375,5 @@ int nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *l4proto) ...@@ -398,8 +375,5 @@ int nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *l4proto)
/* Remove all contrack entries for this protocol */ /* Remove all contrack entries for this protocol */
nf_ct_iterate_cleanup(kill_l4proto, l4proto); nf_ct_iterate_cleanup(kill_l4proto, l4proto);
out:
return ret;
} }
EXPORT_SYMBOL_GPL(nf_conntrack_l4proto_unregister); EXPORT_SYMBOL_GPL(nf_conntrack_l4proto_unregister);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment