提交 5bd5f581 编写于 作者: A Akinobu Mita 提交者: Linus Torvalds

sunrpc: fix error path in module_init

register_rpc_pipefs() needs to clean up rpc_inode_cache
by kmem_cache_destroy() on register_filesystem() failure.

init_sunrpc() needs to unregister rpc_pipe_fs by unregister_rpc_pipefs()
when rpc_init_mempool() returns error.
Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
Cc: Neil Brown <neilb@suse.de>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 cd123012
......@@ -845,6 +845,8 @@ init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
int register_rpc_pipefs(void)
{
int err;
rpc_inode_cachep = kmem_cache_create("rpc_inode_cache",
sizeof(struct rpc_inode),
0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
......@@ -852,7 +854,12 @@ int register_rpc_pipefs(void)
init_once, NULL);
if (!rpc_inode_cachep)
return -ENOMEM;
register_filesystem(&rpc_pipe_fs_type);
err = register_filesystem(&rpc_pipe_fs_type);
if (err) {
kmem_cache_destroy(rpc_inode_cachep);
return err;
}
return 0;
}
......
......@@ -146,9 +146,11 @@ init_sunrpc(void)
int err = register_rpc_pipefs();
if (err)
goto out;
err = rpc_init_mempool() != 0;
if (err)
err = rpc_init_mempool();
if (err) {
unregister_rpc_pipefs();
goto out;
}
#ifdef RPC_DEBUG
rpc_register_sysctl();
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册