public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Ingo Molnar <mingo@elte.hu>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	Gary Hade <garyhade@us.ibm.com>, Matthew Wilcox <matthew@wil.cx>,
	Larry Finger <Larry.Finger@lwfinger.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-pci@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jaswinder Singh Rajput <jaswinder@kernel.org>
Subject: Re: [PATCH] x86: fix _CRS resources return handling
Date: Wed, 24 Jun 2009 14:46:35 -0700	[thread overview]
Message-ID: <4A429EBB.5010209@kernel.org> (raw)
In-Reply-To: <20090624145119.GA12664@elte.hu>

please check this one

[PATCH] x86/pci: fix boundary checking for root res

don't touch info->res_num if we are out of space

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/pci/acpi.c |   27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

Index: linux-2.6/arch/x86/pci/acpi.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/acpi.c
+++ linux-2.6/arch/x86/pci/acpi.c
@@ -68,6 +68,10 @@ setup_resource(struct acpi_resource *acp
 	unsigned long flags;
 	struct resource *root;
 	int max_root_bus_resources = PCI_BUS_NUM_RESOURCES;
+	u64 start, end;
+
+	if (bus_has_transparent_bridge(info->bus))
+		max_root_bus_resources -= 3;
 
 	status = resource_to_addr(acpi_res, &addr);
 	if (!ACPI_SUCCESS(status))
@@ -84,25 +88,24 @@ setup_resource(struct acpi_resource *acp
 	} else
 		return AE_OK;
 
-	res = &info->res[info->res_num];
-	res->name = info->name;
-	res->flags = flags;
-	res->start = addr.minimum + addr.translation_offset;
-	res->end = res->start + addr.address_length - 1;
-	res->child = NULL;
-
-	if (bus_has_transparent_bridge(info->bus))
-		max_root_bus_resources -= 3;
+	start = addr.minimum + addr.translation_offset;
+	end = start + addr.address_length - 1;
 	if (info->res_num >= max_root_bus_resources) {
 		printk(KERN_WARNING "PCI: Failed to allocate 0x%lx-0x%lx "
 			"from %s for %s due to _CRS returning more than "
-			"%d resource descriptors\n", (unsigned long) res->start,
-			(unsigned long) res->end, root->name, info->name,
+			"%d resource descriptors\n", (unsigned long) start,
+			(unsigned long) end, root->name, info->name,
 			max_root_bus_resources);
-		info->res_num++;
 		return AE_OK;
 	}
 
+	res = &info->res[info->res_num];
+	res->name = info->name;
+	res->flags = flags;
+	res->start = start;
+	res->end = end;
+	res->child = NULL;
+
 	if (insert_resource(root, res)) {
 		printk(KERN_ERR "PCI: Failed to allocate 0x%lx-0x%lx "
 			"from %s for %s\n", (unsigned long) res->start,



       reply	other threads:[~2009-06-24 21:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090624122433.GA24781@elte.hu>
     [not found] ` <20090624145119.GA12664@elte.hu>
2009-06-24 21:46   ` Yinghai Lu [this message]
2009-06-24 21:48     ` [PATCH] x86/pci: get root CRS before scan child -v2 Yinghai Lu
2009-06-24 22:37       ` Jesse Barnes
2009-06-25  0:03         ` Yinghai
2009-06-24 22:58     ` [PATCH] x86/pci: don't use crs for root if we only have one root bus Yinghai Lu
2009-06-24 23:09       ` Linus Torvalds
2009-06-24 23:21         ` Linus Torvalds
2009-06-24 23:37           ` Jesse Barnes
2009-06-24 23:54             ` Linus Torvalds
2009-06-25  0:01               ` Jesse Barnes
2009-06-25  7:03                 ` Ingo Molnar
2009-06-25  7:28                   ` Jaswinder Singh Rajput
2009-06-25 16:28                   ` Jesse Barnes
2009-06-25  0:00         ` Gary Hade
2009-06-25  2:01     ` [PATCH 1/3] x86/pci: fix boundary checking when using root CRS Yinghai Lu
2009-06-25  2:02       ` [PATCH 2/3] x86/pci: get root CRS before scan childs -v3 Yinghai Lu
2009-06-25  3:00         ` [PATCH 2/3] x86/pci: get root CRS before scan childs -v4 Yinghai Lu
2009-06-30  1:16       ` [PATCH 1/3] x86/pci: fix boundary checking when using root CRS Jesse Barnes
2009-06-30 18:04         ` Gary Hade
2009-06-30 21:00           ` Jesse Barnes

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=4A429EBB.5010209@kernel.org \
    --to=yinghai@kernel.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=akpm@linux-foundation.org \
    --cc=garyhade@us.ibm.com \
    --cc=jaswinder@kernel.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.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