]> git.baikalelectronics.ru Git - kernel.git/commit
hugetlb: check the return value of string conversion in sysctl handler
authorMichal Hocko <mhocko@suse.cz>
Thu, 13 Jan 2011 23:47:26 +0000 (15:47 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 14 Jan 2011 01:32:49 +0000 (17:32 -0800)
commit3ebfd9ff6a669be1e18ad34820dde3712f7f1b9f
treea3bfdee153157acd502452635aa33f842c0f97eb
parent39d64d3652e26bc3d5b31eb3a1b41d2551d09614
hugetlb: check the return value of string conversion in sysctl handler

proc_doulongvec_minmax may fail if the given buffer doesn't represent a
valid number.  If we provide something invalid we will initialize the
resulting value (nr_overcommit_huge_pages in this case) to a random value
from the stack.

The issue was introduced by 6a434ac5 when the default handler has been
replaced by the helper function where we do not check the return value.

Reproducer:
echo "" > /proc/sys/vm/nr_overcommit_hugepages

[akpm@linux-foundation.org: correctly propagate proc_doulongvec_minmax return code]
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Cc: CAI Qian <caiqian@redhat.com>
Cc: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/hugetlb.c