Return-Path: Received: from imap1.codethink.co.uk ([176.9.8.82]:38329 "EHLO imap1.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753940AbeCGCQy (ORCPT ); Tue, 6 Mar 2018 21:16:54 -0500 Message-ID: <1520389011.23626.24.camel@codethink.co.uk> Subject: Re: [PATCH 4.4 06/34] sget(): handle failures of register_shrinker() From: Ben Hutchings To: Al Viro Cc: stable@vger.kernel.org, Sasha Levin , Greg Kroah-Hartman , LKML Date: Wed, 07 Mar 2018 02:16:51 +0000 In-Reply-To: <20180302084436.414587775@linuxfoundation.org> References: <20180302084435.842679610@linuxfoundation.org> <20180302084436.414587775@linuxfoundation.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: On Fri, 2018-03-02 at 09:51 +0100, Greg Kroah-Hartman wrote: > 4.4-stable review patch.  If anyone has any objections, please let me know. > > ------------------ > > From: Al Viro > > > [ Upstream commit 9ee332d99e4d5a97548943b81c54668450ce641b ] > > Signed-off-by: Al Viro > Signed-off-by: Sasha Levin > Signed-off-by: Greg Kroah-Hartman > --- >  fs/super.c |    6 +++++- >  1 file changed, 5 insertions(+), 1 deletion(-) > > --- a/fs/super.c > +++ b/fs/super.c > @@ -497,7 +497,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); But deactivate_locked_super() will call unregister_shrinker(), which doesn't look safe if register_shrinker() failed. Ben. > + s = ERR_PTR(err); > + } >   return s; >  } >   > > > -- Ben Hutchings Software Developer, Codethink Ltd.