]> 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, 21 Sep 2012 01:03:36 +0000 (11:03 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 24 Sep 2012 13:45:40 +0000 (23:45 +1000)
commitfe2dfe0eb6c069fcaa24aa9ce13ca9f086bada68
treedc8935cbed5fea0c1710e93e3057b31aa2a02d40
parent5742a74eeca43aa8d1b253ef8c17470835bff216
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