mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Huang Shijie <shijie8@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Huang Shijie <shijie8@gmail.com>
Subject: [PATCH] avoiding the same resource to be inserted
Date: Mon, 16 Aug 2010 23:55:38 +0800	[thread overview]
Message-ID: <1281974138-5553-1-git-send-email-shijie8@gmail.com> (raw)

  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

  So, adding the check for the same resource is needed for the stability
and reliability of the kernel.

Signed-off-by: Huang Shijie <shijie8@gmail.com>
---
 kernel/resource.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index 7b36976..60daab4 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -451,7 +451,7 @@ static struct resource * __insert_resource(struct resource *parent, struct resou
 		if (!first)
 			return first;
 
-		if (first == parent)
+		if (first == parent || first == new)
 			return first;
 
 		if ((first->start > new->start) || (first->end < new->end))
-- 
1.6.6.1


             reply	other threads:[~2010-08-16 15:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-16 15:55 Huang Shijie [this message]
2010-08-24 23:46 ` Andrew Morton
2010-08-25  4:31   ` Huang Shijie
2010-08-25 15:17     ` Bjorn Helgaas
2010-08-25  5:03   ` Huang Shijie
2010-08-25  6:41     ` Andrew Morton
2010-08-25  7:01       ` Huang Shijie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1281974138-5553-1-git-send-email-shijie8@gmail.com \
    --to=shijie8@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®