Commit d9595a7b authored by David S. Miller's avatar David S. Miller

[AF_KEY]: Fix oops by converting to proc_net_*().

To make sure the procfs visibility occurs after the ->proc_fs ops are
setup, use proc_net_fops_create() and proc_net_remove().

This also fixes an OOPS after module unload in that the name string
for remove was wrong, so it wouldn't actually be removed.  That bug
was introduced by commit 61145aa1
("[KEY]: Clean up proc files creation a bit.")
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 78374676
...@@ -3807,17 +3807,16 @@ static int pfkey_init_proc(void) ...@@ -3807,17 +3807,16 @@ static int pfkey_init_proc(void)
{ {
struct proc_dir_entry *e; struct proc_dir_entry *e;
e = create_proc_entry("pfkey", 0, init_net.proc_net); e = proc_net_fops_create(&init_net, "pfkey", 0, &pfkey_proc_ops);
if (e == NULL) if (e == NULL)
return -ENOMEM; return -ENOMEM;
e->proc_fops = &pfkey_proc_ops;
return 0; return 0;
} }
static void pfkey_exit_proc(void) static void pfkey_exit_proc(void)
{ {
remove_proc_entry("net/pfkey", NULL); proc_net_remove(&init_net, "pfkey");
} }
#else #else
static inline int pfkey_init_proc(void) static inline int pfkey_init_proc(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