All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/5] NFS: Error out when register_shrinker fail in register_nfs_fs
@ 2015-07-28 11:12 Kinglong Mee
  0 siblings, 0 replies; only message in thread
From: Kinglong Mee @ 2015-07-28 11:12 UTC (permalink / raw)
  To: Trond Myklebust, linux-nfs@vger.kernel.org; +Cc: kinglongmee

Commit 1d3d4437ea "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.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfs/super.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index aa62004..383a027 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -381,9 +381,12 @@ int __init register_nfs_fs(void)
 	ret = nfs_register_sysctl();
 	if (ret < 0)
 		goto error_2;
-	register_shrinker(&acl_shrinker);
+	ret = register_shrinker(&acl_shrinker);
+	if (ret < 0)
+		goto error_3;
 	return 0;
-
+error_3:
+	nfs_unregister_sysctl();
 error_2:
 	unregister_nfs4_fs();
 error_1:
-- 
2.4.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-28 11:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-28 11:12 [PATCH 2/5] NFS: Error out when register_shrinker fail in register_nfs_fs Kinglong Mee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.