Skip to content

Commit

Permalink
kernel/resource.c: handle reinsertion of an already-inserted resource
Browse files Browse the repository at this point in the history
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

[[email protected]: add WARN_ON()]
Signed-off-by: Huang Shijie <[email protected]>
Cc: Jesse Barnes <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
zyzii authored and torvalds committed Oct 28, 2010
1 parent 144ecf3 commit 5de1cb2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ static struct resource * __insert_resource(struct resource *parent, struct resou

if (first == parent)
return first;
if (WARN_ON(first == new)) /* duplicated insertion */
return first;

if ((first->start > new->start) || (first->end < new->end))
break;
Expand Down

0 comments on commit 5de1cb2

Please sign in to comment.