The patch titled hugetlb: fix handling of parse errors in sysfs has been added to the -mm tree. Its filename is hugetlb-fix-handling-of-parse-errors-in-sysfs.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: hugetlb: fix handling of parse errors in sysfs From: Eric B Munson <emunson@xxxxxxxxx> When parsing changes to the huge page pool sizes made from userspace via the sysfs interface, bogus input values are being covered up by nr_hugepages_store_common and nr_overcommit_hugepages_store returning 0 when strict_strtoul returns an error. This can cause an infinite loop in the nr_hugepages_store code. This patch changes the return value for these functions to -EINVAL when strict_strtoul returns an error. Signed-off-by: Eric B Munson <emunson@xxxxxxxxx> Reported-by: CAI Qian <caiqian@xxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Eric B Munson <emunson@xxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxx> Cc: Nishanth Aravamudan <nacc@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff -puN mm/hugetlb.c~hugetlb-fix-handling-of-parse-errors-in-sysfs mm/hugetlb.c --- a/mm/hugetlb.c~hugetlb-fix-handling-of-parse-errors-in-sysfs +++ a/mm/hugetlb.c @@ -1375,10 +1375,8 @@ static ssize_t nr_hugepages_store_common NODEMASK_ALLOC(nodemask_t, nodes_allowed, GFP_KERNEL | __GFP_NORETRY); err = strict_strtoul(buf, 10, &count); - if (err) { - err = 0; /* This seems wrong */ + if (err) goto out; - } h = kobj_to_hstate(kobj, &nid); if (h->order >= MAX_ORDER) { @@ -1468,7 +1466,7 @@ static ssize_t nr_overcommit_hugepages_s err = strict_strtoul(buf, 10, &input); if (err) - return 0; + return err; spin_lock(&hugetlb_lock); h->nr_overcommit_huge_pages = input; _ Patches currently in -mm which might be from emunson@xxxxxxxxx are mm-kswapd-stop-high-order-balancing-when-any-suitable-zone-is-balanced.patch mm-kswapd-keep-kswapd-awake-for-high-order-allocations-until-a-percentage-of-the-node-is-balanced.patch mm-kswapd-use-the-order-that-kswapd-was-reclaiming-at-for-sleeping_prematurely.patch mm-kswapd-reset-kswapd_max_order-and-classzone_idx-after-reading.patch mm-kswapd-treat-zone-all_unreclaimable-in-sleeping_prematurely-similar-to-balance_pgdat.patch mm-kswapd-use-the-classzone-idx-that-kswapd-was-using-for-sleeping_prematurely.patch hugetlb-do-not-allow-pagesize-=-max_order-pool-adjustment.patch hugetlb-do-not-allow-pagesize-=-max_order-pool-adjustment-fix.patch hugetlb-fix-handling-of-parse-errors-in-sysfs.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html