Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

authored by

Stanislav Kinsbursky and committed by
Trond Myklebust
adae0fe0 6c216ec6

+9 -8
+9 -8
net/sunrpc/sunrpc_syms.c
··· 75 75 static int __init 76 76 init_sunrpc(void) 77 77 { 78 - int err = register_rpc_pipefs(); 78 + int err = rpc_init_mempool(); 79 79 if (err) 80 80 goto out; 81 - err = rpc_init_mempool(); 82 - if (err) 83 - goto out2; 84 81 err = rpcauth_init_module(); 85 82 if (err) 86 - goto out3; 83 + goto out2; 87 84 88 85 cache_initialize(); 89 86 90 87 err = register_pernet_subsys(&sunrpc_net_ops); 88 + if (err) 89 + goto out3; 90 + 91 + err = register_rpc_pipefs(); 91 92 if (err) 92 93 goto out4; 93 94 #ifdef RPC_DEBUG ··· 99 98 return 0; 100 99 101 100 out4: 102 - rpcauth_remove_module(); 101 + unregister_pernet_subsys(&sunrpc_net_ops); 103 102 out3: 104 - rpc_destroy_mempool(); 103 + rpcauth_remove_module(); 105 104 out2: 106 - unregister_rpc_pipefs(); 105 + rpc_destroy_mempool(); 107 106 out: 108 107 return err; 109 108 }