]> git.karo-electronics.de Git - karo-tx-linux.git/commit
kernel/resource.c: fix stack overflow in __reserve_region_with_split()
authorT Makphaibulchoke <tmac@hp.com>
Wed, 26 Sep 2012 01:35:05 +0000 (11:35 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 27 Sep 2012 07:29:10 +0000 (17:29 +1000)
commitfe0277256583258493ebc1e8a9b932e763c29a22
treed86d610ffe6bf01c41ae42874bd145800f7bf1b2
parentc499a55e8fb69002f02b93c43d425ce35950ba51
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