diff options
author | Jan Stancek <jstancek@redhat.com> | 2020-01-03 18:37:18 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-01-04 19:19:19 +0100 |
commit | 1cab43eb6137928106364340a5287b29ce3552f1 (patch) | |
tree | 26a81f05f0879a247d2af294673c260f98f3f416 /fs/hugetlbfs | |
parent | 596180c2110c1848fe2ccf885245745658d98079 (diff) | |
download | linux-stable-1cab43eb6137928106364340a5287b29ce3552f1.tar.gz linux-stable-1cab43eb6137928106364340a5287b29ce3552f1.tar.bz2 linux-stable-1cab43eb6137928106364340a5287b29ce3552f1.zip |
mm/hugetlbfs: fix for_each_hstate() loop in init_hugetlbfs_fs()
commit 15f0ec941f4f908fefa23a30ded8358977cc1cc0 upstream.
LTP memfd_create04 started failing for some huge page sizes
after v5.4-10135-gc3bfc5dd73c6.
The problem is the check introduced to for_each_hstate() loop that
should skip default_hstate_idx. Since it doesn't update 'i' counter,
all subsequent huge page sizes are skipped as well.
Fixes: 8fc312b32b25 ("mm/hugetlbfs: fix error handling when setting up mounts")
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/hugetlbfs')
-rw-r--r-- | fs/hugetlbfs/inode.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 26e3906c18fe..40306c1eab07 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1478,8 +1478,10 @@ static int __init init_hugetlbfs_fs(void) /* other hstates are optional */ i = 0; for_each_hstate(h) { - if (i == default_hstate_idx) + if (i == default_hstate_idx) { + i++; continue; + } mnt = mount_one_hugetlbfs(h); if (IS_ERR(mnt)) |