From: Al Viro Date: Mon, 18 Dec 2017 20:05:07 +0000 (-0500) Subject: sget(): handle failures of register_shrinker() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ac4dc9f1af33538ba475484b1dcb95bbbcef41a6;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git sget(): handle failures of register_shrinker() [ Upstream commit 9ee332d99e4d5a97548943b81c54668450ce641b ] Signed-off-by: Al Viro Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/super.c b/fs/super.c index 994db21f59bf..79d7fc5e0ddd 100644 --- a/fs/super.c +++ b/fs/super.c @@ -522,7 +522,11 @@ retry: hlist_add_head(&s->s_instances, &type->fs_supers); spin_unlock(&sb_lock); get_filesystem(type); - register_shrinker(&s->s_shrink); + err = register_shrinker(&s->s_shrink); + if (err) { + deactivate_locked_super(s); + s = ERR_PTR(err); + } return s; }