summaryrefslogtreecommitdiffstats
path: root/net/bridge/br.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2006-05-25 15:59:33 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-17 21:26:12 -0700
commitc090971326db094ed702c1f8f2dbe04b7e3b8f27 (patch)
tree9c964fc79298455eb4b45981a34a6117175ff846 /net/bridge/br.c
parent9ef513bed68534110727381ab652f06756803f5a (diff)
downloadop-kernel-dev-c090971326db094ed702c1f8f2dbe04b7e3b8f27.zip
op-kernel-dev-c090971326db094ed702c1f8f2dbe04b7e3b8f27.tar.gz
[BRIDGE]: fix module startup error handling
Return address in use, if some other kernel code has the SAP. Propogate out error codes from netfilter registration and unwind. Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br.c')
-rw-r--r--net/bridge/br.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/net/bridge/br.c b/net/bridge/br.c
index 12da21a..558d2720 100644
--- a/net/bridge/br.c
+++ b/net/bridge/br.c
@@ -30,36 +30,44 @@ static struct llc_sap *br_stp_sap;
static int __init br_init(void)
{
+ int err;
+
br_stp_sap = llc_sap_open(LLC_SAP_BSPAN, br_stp_rcv);
if (!br_stp_sap) {
printk(KERN_ERR "bridge: can't register sap for STP\n");
- return -EBUSY;
+ return -EADDRINUSE;
}
br_fdb_init();
-#ifdef CONFIG_BRIDGE_NETFILTER
- if (br_netfilter_init())
- return 1;
-#endif
+ err = br_netfilter_init();
+ if (err)
+ goto err_out1;
+
+ err = register_netdevice_notifier(&br_device_notifier);
+ if (err)
+ goto err_out2;
+
brioctl_set(br_ioctl_deviceless_stub);
br_handle_frame_hook = br_handle_frame;
br_fdb_get_hook = br_fdb_get;
br_fdb_put_hook = br_fdb_put;
- register_netdevice_notifier(&br_device_notifier);
-
return 0;
+
+err_out2:
+ br_netfilter_fini();
+err_out1:
+ llc_sap_put(br_stp_sap);
+ return err;
}
static void __exit br_deinit(void)
{
rcu_assign_pointer(br_stp_sap->rcv_func, NULL);
-#ifdef CONFIG_BRIDGE_NETFILTER
br_netfilter_fini();
-#endif
unregister_netdevice_notifier(&br_device_notifier);
brioctl_set(NULL);
OpenPOWER on IntegriCloud