[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>
This commit is contained in:
parent
9ef513bed6
commit
c090971326
@ -30,36 +30,44 @@ static struct llc_sap *br_stp_sap;
|
|||||||
|
|
||||||
static int __init br_init(void)
|
static int __init br_init(void)
|
||||||
{
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
br_stp_sap = llc_sap_open(LLC_SAP_BSPAN, br_stp_rcv);
|
br_stp_sap = llc_sap_open(LLC_SAP_BSPAN, br_stp_rcv);
|
||||||
if (!br_stp_sap) {
|
if (!br_stp_sap) {
|
||||||
printk(KERN_ERR "bridge: can't register sap for STP\n");
|
printk(KERN_ERR "bridge: can't register sap for STP\n");
|
||||||
return -EBUSY;
|
return -EADDRINUSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
br_fdb_init();
|
br_fdb_init();
|
||||||
|
|
||||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
err = br_netfilter_init();
|
||||||
if (br_netfilter_init())
|
if (err)
|
||||||
return 1;
|
goto err_out1;
|
||||||
#endif
|
|
||||||
|
err = register_netdevice_notifier(&br_device_notifier);
|
||||||
|
if (err)
|
||||||
|
goto err_out2;
|
||||||
|
|
||||||
brioctl_set(br_ioctl_deviceless_stub);
|
brioctl_set(br_ioctl_deviceless_stub);
|
||||||
br_handle_frame_hook = br_handle_frame;
|
br_handle_frame_hook = br_handle_frame;
|
||||||
|
|
||||||
br_fdb_get_hook = br_fdb_get;
|
br_fdb_get_hook = br_fdb_get;
|
||||||
br_fdb_put_hook = br_fdb_put;
|
br_fdb_put_hook = br_fdb_put;
|
||||||
|
|
||||||
register_netdevice_notifier(&br_device_notifier);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_out2:
|
||||||
|
br_netfilter_fini();
|
||||||
|
err_out1:
|
||||||
|
llc_sap_put(br_stp_sap);
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit br_deinit(void)
|
static void __exit br_deinit(void)
|
||||||
{
|
{
|
||||||
rcu_assign_pointer(br_stp_sap->rcv_func, NULL);
|
rcu_assign_pointer(br_stp_sap->rcv_func, NULL);
|
||||||
|
|
||||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
|
||||||
br_netfilter_fini();
|
br_netfilter_fini();
|
||||||
#endif
|
|
||||||
unregister_netdevice_notifier(&br_device_notifier);
|
unregister_netdevice_notifier(&br_device_notifier);
|
||||||
brioctl_set(NULL);
|
brioctl_set(NULL);
|
||||||
|
|
||||||
|
@ -192,8 +192,13 @@ extern int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
|
|||||||
extern int br_ioctl_deviceless_stub(unsigned int cmd, void __user *arg);
|
extern int br_ioctl_deviceless_stub(unsigned int cmd, void __user *arg);
|
||||||
|
|
||||||
/* br_netfilter.c */
|
/* br_netfilter.c */
|
||||||
|
#ifdef CONFIG_BRIDGE_NETFILTER
|
||||||
extern int br_netfilter_init(void);
|
extern int br_netfilter_init(void);
|
||||||
extern void br_netfilter_fini(void);
|
extern void br_netfilter_fini(void);
|
||||||
|
#else
|
||||||
|
#define br_netfilter_init() (0)
|
||||||
|
#define br_netfilter_fini() do { } while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* br_stp.c */
|
/* br_stp.c */
|
||||||
extern void br_log_state(const struct net_bridge_port *p);
|
extern void br_log_state(const struct net_bridge_port *p);
|
||||||
|
Loading…
Reference in New Issue
Block a user