提交 15f0ec94 编写于 作者: J Jan Stancek 提交者: Linus Torvalds

mm/hugetlbfs: fix for_each_hstate() loop in init_hugetlbfs_fs()

LTP memfd_create04 started failing for some huge page sizes
after v5.4-10135-gc3bfc5dd.

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: 8fc312b3 ("mm/hugetlbfs: fix error handling when setting up mounts")
Signed-off-by: NJan Stancek <jstancek@redhat.com>
Reviewed-by: NMike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 7ca4ad5b
...@@ -1498,8 +1498,10 @@ static int __init init_hugetlbfs_fs(void) ...@@ -1498,8 +1498,10 @@ static int __init init_hugetlbfs_fs(void)
/* other hstates are optional */ /* other hstates are optional */
i = 0; i = 0;
for_each_hstate(h) { for_each_hstate(h) {
if (i == default_hstate_idx) if (i == default_hstate_idx) {
i++;
continue; continue;
}
mnt = mount_one_hugetlbfs(h); mnt = mount_one_hugetlbfs(h);
if (IS_ERR(mnt)) if (IS_ERR(mnt))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册