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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 17 Oct 2019 17:08:21 -0700
From:   Mike Kravetz <mike.kravetz@...cle.com>
To:     Chengguang Xu <cgxu519@...ernel.net>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hugetlbfs: fix error handling in init_hugetlbfs_fs()

Cc: David
On 10/17/19 3:38 AM, Chengguang Xu wrote:
> In order to avoid using incorrect mnt, we should set
> mnt to NULL when we get error from mount_one_hugetlbfs().
> 
> Signed-off-by: Chengguang Xu <cgxu519@...ernel.net>
> ---
>  fs/hugetlbfs/inode.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index a478df035651..427d845e7706 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -1470,9 +1470,12 @@ static int __init init_hugetlbfs_fs(void)
>  	i = 0;
>  	for_each_hstate(h) {
>  		mnt = mount_one_hugetlbfs(h);
> -		if (IS_ERR(mnt) && i == 0) {
> -			error = PTR_ERR(mnt);
> -			goto out;
> +		if (IS_ERR(mnt)) {
> +			if (i == 0) {
> +				error = PTR_ERR(mnt);
> +				goto out;
> +			}
> +			mnt = NULL;
>  		}
>  		hugetlbfs_vfsmount[i] = mnt;
>  		i++;

Thanks!

That should be fixed.  It was introduced with commit 32021982a324 ("hugetlbfs:
Convert to fs_context").  

That commit also changed the condition for which init_hugetlbfs_fs() would
'error' and remove the inode cache.  Previously, it would do that if there
was an error creating a mount for the default_hstate_idx hstate.  It now does
that for the '0' hstate, and 0 is not always equal to default_hstate_idx.

David was that intentional or an oversight?  I can fix up, just wanted to
make sure there was not some reason for the change.

-- 
Mike Kravetz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ