diff options
author | Huang Shijie <shijie8@gmail.com> | 2010-10-27 18:34:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-27 21:03:18 -0400 |
commit | 5de1cb2d0f1c1e5475d2bedf65b76828f8cdde22 (patch) | |
tree | 2f3dbb20f08bfbbdd1f4da144f9c18fec9cce7aa | |
parent | 144ecf310eb52d9df607b9b7eeb096743e232a96 (diff) |
kernel/resource.c: handle reinsertion of an already-inserted resource
If the same resource is inserted to the resource tree (maybe not on
purpose), a dead loop will be created. In this situation, The kernel does
not report any warning or error :(
The command below will show a endless print.
#cat /proc/iomem
[akpm@linux-foundation.org: add WARN_ON()]
Signed-off-by: Huang Shijie <shijie8@gmail.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/resource.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/resource.c b/kernel/resource.c index 7b36976e5dea..9c9841cb6902 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -453,6 +453,8 @@ static struct resource * __insert_resource(struct resource *parent, struct resou | |||
453 | 453 | ||
454 | if (first == parent) | 454 | if (first == parent) |
455 | return first; | 455 | return first; |
456 | if (WARN_ON(first == new)) /* duplicated insertion */ | ||
457 | return first; | ||
456 | 458 | ||
457 | if ((first->start > new->start) || (first->end < new->end)) | 459 | if ((first->start > new->start) || (first->end < new->end)) |
458 | break; | 460 | break; |