Skip to content

Commit

Permalink
SUNRPC: register PipeFS file system after pernet sybsystem
Browse files Browse the repository at this point in the history
PipeFS superblock creation routine relays on SUNRPC pernet data presense, which
is created on register_pernet_subsys() call in SUNRPC module init function.
Registering of PipeFS filesystem prior to registering of per-net subsystem
leads to races (mount of PipeFS can dereference uninitialized data).

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Stanislav Kinsbursky authored and Trond Myklebust committed Apr 18, 2012
1 parent 6c216ec commit adae0fe
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions net/sunrpc/sunrpc_syms.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,20 @@ static struct pernet_operations sunrpc_net_ops = {
static int __init
init_sunrpc(void)
{
int err = register_rpc_pipefs();
int err = rpc_init_mempool();
if (err)
goto out;
err = rpc_init_mempool();
if (err)
goto out2;
err = rpcauth_init_module();
if (err)
goto out3;
goto out2;

cache_initialize();

err = register_pernet_subsys(&sunrpc_net_ops);
if (err)
goto out3;

err = register_rpc_pipefs();
if (err)
goto out4;
#ifdef RPC_DEBUG
Expand All @@ -98,11 +99,11 @@ init_sunrpc(void)
return 0;

out4:
rpcauth_remove_module();
unregister_pernet_subsys(&sunrpc_net_ops);
out3:
rpc_destroy_mempool();
rpcauth_remove_module();
out2:
unregister_rpc_pipefs();
rpc_destroy_mempool();
out:
return err;
}
Expand Down

0 comments on commit adae0fe

Please sign in to comment.