Commit 5ef8d792 authored by Kinglong Mee's avatar Kinglong Mee Committed by Trond Myklebust

NFS: Error out when register_shrinker fail in register_nfs_fs

Commit 1d3d4437 "vmscan: per-node deferred work" have made
register_shrinker can return an intergater error.

If register_shrinker() fail, the later unregister_shrinker() will
 cause a NULL pointer access.

v2, same as v1.
Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent efcbc04e
...@@ -381,9 +381,12 @@ int __init register_nfs_fs(void) ...@@ -381,9 +381,12 @@ int __init register_nfs_fs(void)
ret = nfs_register_sysctl(); ret = nfs_register_sysctl();
if (ret < 0) if (ret < 0)
goto error_2; goto error_2;
register_shrinker(&acl_shrinker); ret = register_shrinker(&acl_shrinker);
if (ret < 0)
goto error_3;
return 0; return 0;
error_3:
nfs_unregister_sysctl();
error_2: error_2:
unregister_nfs4_fs(); unregister_nfs4_fs();
error_1: error_1:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment