hugetlb: do not allow pagesize >= MAX_ORDER pool adjustment
hugetlb: do not allow pagesize >= MAX_ORDER pool adjustment

Huge pages with order >= MAX_ORDER must be allocated at boot via the
kernel command line, they cannot be allocated or freed once the kernel is
up and running.  Currently we allow values to be written to the sysfs and
sysctl files controling pool size for these huge page sizes.  This patch
makes the store functions for nr_hugepages and nr_overcommit_hugepages
return -EINVAL when the pool for a page size >= MAX_ORDER is changed.

[5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org: avoid multiple return paths in nr_hugepages_store_common()]
[d61c4fe1e8d2f0a8cae6c6ab21f226a195fe060a@redhat.com: add checking in hugetlb_overcommit_handler()]
Signed-off-by: Eric B Munson <51d9dbd4ea8b7943d3deb397de3f8cbc23693656@mgebm.net>
Reported-by: CAI Qian <d61c4fe1e8d2f0a8cae6c6ab21f226a195fe060a@redhat.com>
Cc: Andrea Arcangeli <6cb163d975a8c4c46420677e0054b55c39bdb339@redhat.com>
Cc: Michal Hocko <829500b200af6c2a0eca4dfd5c388e6b8fbe8dc6@suse.cz>
Cc: Nishanth Aravamudan <32d5d7104760c6969dbcc939b04e64f225673f91@us.ibm.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs