lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7a5b5bb6-ef61-fad6-055a-cf026d0059ec@suse.com>
Date:   Sat, 1 Apr 2017 12:11:17 +0300
From:   Nikolay Borisov <nborisov@...e.com>
To:     Al Viro <viro@...iv.linux.org.uk>
Cc:     Dmitry Vyukov <dvyukov@...gle.com>, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org, syzkaller@...glegroups.com
Subject: Re: [PATCHv2] fs: Handle register_shrinker failure



On 24.03.2017 10:25, Nikolay Borisov wrote:
> register_shrinker allocates dynamic memory and thus is susceptible to failures
> under low-memory situation. Currently,get_userns ignores the return value of
> register_shrinker, potentially exposing not fully initialised object. This
> can lead to a NULL-ptr deref everytime shrinker->nr_deferred is referenced.
> 
> Fix this by failing to register the filesystem in case there is not enough
> memory to fully construct the shrinker object.
> 
> Signed-off-by: Nikolay Borisov <nborisov@...e.com>
> Fixes: 1d3d4437eae1 ("vmscan: per-node deferred work")
> Link: lkml.kernel.org/r/CACT4Y+b-purC3HHbw=SctmS3MA8FKqtNYZUS_KCo2WMctTwyNA@...l.gmail.com
> ---

PING, Al is there something bothering you with this patch that needs
fixing before it's merged? Also I think it should be tagged stable.

> 
> Add Fixes and Link tags for better traceability
> 
>  fs/super.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/super.c b/fs/super.c
> index b8b6a086c03b..964b18447c92 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -518,7 +518,19 @@ struct super_block *sget_userns(struct file_system_type *type,
>  	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) {
> +		spin_lock(&sb_lock);
> +		list_del(&s->s_list);
> +		hlist_del(&s->s_instances);
> +		spin_unlock(&sb_lock);
> +
> +		up_write(&s->s_umount);
> +		destroy_super(s);
> +		put_filesystem(type);
> +		return ERR_PTR(err);
> +	}
> +
>  	return s;
>  }
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ