Commit 17980dbf authored by Luiz Capitulino's avatar Luiz Capitulino Committed by David S. Miller

[PPPOE]: Handle disabled PROC_FS properly.

parent 748c75bd
...@@ -1075,6 +1075,20 @@ static struct file_operations pppoe_seq_fops = { ...@@ -1075,6 +1075,20 @@ static struct file_operations pppoe_seq_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = seq_release, .release = seq_release,
}; };
static int __init pppoe_proc_init(void)
{
struct proc_dir_entry *p;
p = create_proc_entry("pppoe", S_IRUGO, proc_net);
if (!p)
return -ENOMEM;
p->proc_fops = &pppoe_seq_fops;
return 0;
}
#else /* CONFIG_PROC_FS */
static inline int pppoe_proc_init(void) { return 0; }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
/* ->ioctl are set at pppox_create */ /* ->ioctl are set at pppox_create */
...@@ -1111,26 +1125,18 @@ static int __init pppoe_init(void) ...@@ -1111,26 +1125,18 @@ static int __init pppoe_init(void)
if (err) if (err)
goto out; goto out;
#ifdef CONFIG_PROC_FS
{ err = pppoe_proc_init();
struct proc_dir_entry *p = create_proc_entry("pppoe", S_IRUGO, if (err) {
proc_net); unregister_pppox_proto(PX_PROTO_OE);
err = -ENOMEM; goto out;
if (!p) }
goto out_unregister;
p->proc_fops = &pppoe_seq_fops;
err = 0;
}
#endif /* CONFIG_PROC_FS */
dev_add_pack(&pppoes_ptype); dev_add_pack(&pppoes_ptype);
dev_add_pack(&pppoed_ptype); dev_add_pack(&pppoed_ptype);
register_netdevice_notifier(&pppoe_notifier); register_netdevice_notifier(&pppoe_notifier);
out: out:
return err; return err;
out_unregister:
unregister_pppox_proto(PX_PROTO_OE);
goto out;
} }
static void __exit pppoe_exit(void) static void __exit pppoe_exit(void)
......
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