]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
kernel/resource.c: fix stack overflow in __reserve_region_with_split()
authorT Makphaibulchoke <tmac@hp.com>
Fri, 28 Sep 2012 00:22:28 +0000 (10:22 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Oct 2012 05:04:09 +0000 (15:04 +1000)
commit7dc31f62f69e0ae0f23be4234dcb5ee8be95e1cc
treefe4e5bed015a57741dc0cfd4fdf71a2a2d95ce34
parent57d46aa0fc9692332359ae22ee609a6fd4615638
kernel/resource.c: fix stack overflow in __reserve_region_with_split()

Using a recurvise call add a non-conflicting region in
__reserve_region_with_split() could result in a stack overflow in the case
that the recursive calls are too deep.  Convert the recursive calls to an
iterative loop to avoid the problem.

Tested on a machine containing 135 regions.  The kernel no longer panicked
with stack overflow.

Also tested with code arbitrarily adding regions with no conflict,
embedding two consecutive conflicts and embedding two non-consecutive
conflicts.

Signed-off-by: T Makphaibulchoke <tmac@hp.com>
Reviewed-by: Ram Pai <linuxram@us.ibm.com>
Cc: Paul Gortmaker <paul.gortmaker@gmail.com>
Cc: Wei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/resource.c