Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit adae0fe0 authored by Stanislav Kinsbursky's avatar Stanislav Kinsbursky Committed by Trond Myklebust
Browse files

SUNRPC: register PipeFS file system after pernet sybsystem



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: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 6c216ec6
Loading
Loading
Loading
Loading
+9 −8
Original line number Original line Diff line number Diff line
@@ -75,19 +75,20 @@ static struct pernet_operations sunrpc_net_ops = {
static int __init
static int __init
init_sunrpc(void)
init_sunrpc(void)
{
{
	int err = register_rpc_pipefs();
	int err = rpc_init_mempool();
	if (err)
	if (err)
		goto out;
		goto out;
	err = rpc_init_mempool();
	if (err)
		goto out2;
	err = rpcauth_init_module();
	err = rpcauth_init_module();
	if (err)
	if (err)
		goto out3;
		goto out2;


	cache_initialize();
	cache_initialize();


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

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


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