From: Greg Kroah-Hartman Date: Sat, 4 Jan 2020 08:54:45 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v4.4.208~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=675895daa995d5f23ca1db3d8d92b84b60bd96a1;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: mm-hugetlbfs-fix-for_each_hstate-loop-in-init_hugetlbfs_fs.patch --- diff --git a/queue-5.4/mm-hugetlbfs-fix-for_each_hstate-loop-in-init_hugetlbfs_fs.patch b/queue-5.4/mm-hugetlbfs-fix-for_each_hstate-loop-in-init_hugetlbfs_fs.patch new file mode 100644 index 00000000000..c7ec62496b1 --- /dev/null +++ b/queue-5.4/mm-hugetlbfs-fix-for_each_hstate-loop-in-init_hugetlbfs_fs.patch @@ -0,0 +1,40 @@ +From 15f0ec941f4f908fefa23a30ded8358977cc1cc0 Mon Sep 17 00:00:00 2001 +From: Jan Stancek +Date: Fri, 3 Jan 2020 18:37:18 +0100 +Subject: mm/hugetlbfs: fix for_each_hstate() loop in init_hugetlbfs_fs() + +From: Jan Stancek + +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 +Reviewed-by: Mike Kravetz +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/hugetlbfs/inode.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- 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)) diff --git a/queue-5.4/series b/queue-5.4/series index af66483e33e..6f9f07ede06 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -189,3 +189,4 @@ net-ena-fix-napi-handler-misbehavior-when-the-napi-budget-is-zero.patch vhost-vsock-accept-only-packets-with-the-right-dst_cid.patch mmc-sdhci-of-esdhc-fix-up-erratum-a-008171-workaroun.patch mmc-sdhci-of-esdhc-re-implement-erratum-a-009204-wor.patch +mm-hugetlbfs-fix-for_each_hstate-loop-in-init_hugetlbfs_fs.patch