diff mbox

PCI, x86: clear initial value for root info resources

Message ID 1347670122-25824-3-git-send-email-yinghai@kernel.org
State Changes Requested
Headers show

Commit Message

Yinghai Lu Sept. 15, 2012, 12:48 a.m. UTC
Found one system one root bus hot remove get panic.
Panic happens when try to release hostbridge resource.

It turns out that resource get reject during put into resource tree
because of conflicts.
Also that resource parent pointer have random value.

That invalid value cause it pass through check __release_pci_root_info
and panic in release_resource.

Try to use kzalloc instead.

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

---
 arch/x86/pci/acpi.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Bjorn Helgaas Sept. 18, 2012, 10:46 p.m. UTC | #1
On Fri, Sep 14, 2012 at 6:48 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> Found one system one root bus hot remove get panic.
> Panic happens when try to release hostbridge resource.
>
> It turns out that resource get reject during put into resource tree
> because of conflicts.
> Also that resource parent pointer have random value.
>
> That invalid value cause it pass through check __release_pci_root_info
> and panic in release_resource.
>
> Try to use kzalloc instead.

Don't we need the same fix for ia64 in pci_acpi_scan_root()?  Here's
what it does:

        if (windows) {
                controller->window =
                        kmalloc_node(sizeof(*controller->window) * windows,
                                     GFP_KERNEL, controller->node);


> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Cc: x86@kernel.org
>
> ---
>  arch/x86/pci/acpi.c |    3 +--
>  1 file changed, 1 insertion(+), 2 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
> @@ -305,7 +305,6 @@ setup_resource(struct acpi_resource *acp
>         res->flags = flags;
>         res->start = start;
>         res->end = end;
> -       res->child = NULL;
>
>         if (!pci_use_crs) {
>                 dev_printk(KERN_DEBUG, &info->bridge->dev,
> @@ -434,7 +433,7 @@ probe_pci_root_info(struct pci_root_info
>
>         size = sizeof(*info->res) * info->res_num;
>         info->res_num = 0;
> -       info->res = kmalloc(size, GFP_KERNEL);
> +       info->res = kzalloc(size, GFP_KERNEL);
>         if (!info->res)
>                 return;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yinghai Lu Sept. 18, 2012, 11:49 p.m. UTC | #2
On Tue, Sep 18, 2012 at 3:46 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> On Fri, Sep 14, 2012 at 6:48 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>> Found one system one root bus hot remove get panic.
>> Panic happens when try to release hostbridge resource.
>>
>> It turns out that resource get reject during put into resource tree
>> because of conflicts.
>> Also that resource parent pointer have random value.
>>
>> That invalid value cause it pass through check __release_pci_root_info
>> and panic in release_resource.
>>
>> Try to use kzalloc instead.
>
> Don't we need the same fix for ia64 in pci_acpi_scan_root()?  Here's
> what it does:
>
>         if (windows) {
>                 controller->window =
>                         kmalloc_node(sizeof(*controller->window) * windows,
>                                      GFP_KERNEL, controller->node);
>


yes, but they don't support pci_set_host_bridge_release yet. so they
should not meet this problem yet.

Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bjorn Helgaas Sept. 19, 2012, 1:12 p.m. UTC | #3
On Tue, Sep 18, 2012 at 5:49 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Tue, Sep 18, 2012 at 3:46 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>> On Fri, Sep 14, 2012 at 6:48 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>>> Found one system one root bus hot remove get panic.
>>> Panic happens when try to release hostbridge resource.
>>>
>>> It turns out that resource get reject during put into resource tree
>>> because of conflicts.
>>> Also that resource parent pointer have random value.
>>>
>>> That invalid value cause it pass through check __release_pci_root_info
>>> and panic in release_resource.
>>>
>>> Try to use kzalloc instead.
>>
>> Don't we need the same fix for ia64 in pci_acpi_scan_root()?  Here's
>> what it does:
>>
>>         if (windows) {
>>                 controller->window =
>>                         kmalloc_node(sizeof(*controller->window) * windows,
>>                                      GFP_KERNEL, controller->node);
>>
>
>
> yes, but they don't support pci_set_host_bridge_release yet. so they
> should not meet this problem yet.

Why should we wait to fix that bug until later?  I'm not interested in
debugging this in the future.  If you fix a bug, you should always try
to fix other occurrences of the same bug at the same time.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiang Liu Sept. 19, 2012, 3:34 p.m. UTC | #4
On 09/19/2012 07:49 AM, Yinghai Lu wrote:
> On Tue, Sep 18, 2012 at 3:46 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>> On Fri, Sep 14, 2012 at 6:48 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>>> Found one system one root bus hot remove get panic.
>>> Panic happens when try to release hostbridge resource.
>>>
>>> It turns out that resource get reject during put into resource tree
>>> because of conflicts.
>>> Also that resource parent pointer have random value.
>>>
>>> That invalid value cause it pass through check __release_pci_root_info
>>> and panic in release_resource.
>>>
>>> Try to use kzalloc instead.
>>
>> Don't we need the same fix for ia64 in pci_acpi_scan_root()?  Here's
>> what it does:
>>
>>         if (windows) {
>>                 controller->window =
>>                         kmalloc_node(sizeof(*controller->window) * windows,
>>                                      GFP_KERNEL, controller->node);
>>
> 
> 
> yes, but they don't support pci_set_host_bridge_release yet. so they
> should not meet this problem yet.
Hi Yinghai,
	We are trying to add pci_set_host_bridge_release() for IA64, so would
appreciate it if you could help to fix IA64 too.
	--Gerry

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yinghai Lu Sept. 19, 2012, 5:17 p.m. UTC | #5
On Wed, Sep 19, 2012 at 6:12 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>> yes, but they don't support pci_set_host_bridge_release yet. so they
>> should not meet this problem yet.
>
> Why should we wait to fix that bug until later?  I'm not interested in
> debugging this in the future.  If you fix a bug, you should always try
> to fix other occurrences of the same bug at the same time.

ok, will update the patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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
@@ -305,7 +305,6 @@  setup_resource(struct acpi_resource *acp
 	res->flags = flags;
 	res->start = start;
 	res->end = end;
-	res->child = NULL;
 
 	if (!pci_use_crs) {
 		dev_printk(KERN_DEBUG, &info->bridge->dev,
@@ -434,7 +433,7 @@  probe_pci_root_info(struct pci_root_info
 
 	size = sizeof(*info->res) * info->res_num;
 	info->res_num = 0;
-	info->res = kmalloc(size, GFP_KERNEL);
+	info->res = kzalloc(size, GFP_KERNEL);
 	if (!info->res)
 		return;