Skip to content

Commit

Permalink
[AF_KEY]: Fix oops by converting to proc_net_*().
Browse files Browse the repository at this point in the history
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 61145aa
("[KEY]: Clean up proc files creation a bit.")

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Feb 27, 2008
1 parent 7837467 commit d9595a7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/key/af_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -3807,17 +3807,16 @@ static int pfkey_init_proc(void)
{
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)
return -ENOMEM;

e->proc_fops = &pfkey_proc_ops;
return 0;
}

static void pfkey_exit_proc(void)
{
remove_proc_entry("net/pfkey", NULL);
proc_net_remove(&init_net, "pfkey");
}
#else
static inline int pfkey_init_proc(void)
Expand Down

0 comments on commit d9595a7

Please sign in to comment.