[1/7] sunrpc: error out if register_shrinker fail
diff mbox

Message ID 03bfbff3-958a-0ae9-fbd9-1eba53fa1735@gmail.com
State New
Headers show

Commit Message

Kinglong Mee Feb. 7, 2017, 1:46 p.m. UTC
register_shrinker may return error when register fail, error out.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 net/sunrpc/auth.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch
diff mbox

diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index a7d03ea..4aa6ef1 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -873,8 +873,12 @@  int __init rpcauth_init_module(void)
 	err = rpc_init_generic_auth();
 	if (err < 0)
 		goto out2;
-	register_shrinker(&rpc_cred_shrinker);
+	err = register_shrinker(&rpc_cred_shrinker);
+	if (err < 0)
+		goto out3;
 	return 0;
+out3:
+	rpc_destroy_generic_auth();
 out2:
 	rpc_destroy_authunix();
 out1: