WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-4.1-testing] drivers/passthrough: fix error paths i

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.1-testing] drivers/passthrough: fix error paths in pci_add_device*()
From: Xen patchbot-4.1-testing <patchbot@xxxxxxx>
Date: Thu, 26 May 2011 00:05:38 +0100
Delivery-date: Wed, 25 May 2011 16:08:43 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxx>
# Date 1306221579 -3600
# Node ID 61336bbb0002aaf8bbe7accd0d5b55e70fce2f3a
# Parent  a0ed85c8ddcfeb0da7134d177d2ec6389fef95c7
drivers/passthrough: fix error paths in pci_add_device*()

When a device can't be allocated to dom0 by the IOMMU, don't leave
dom0 in the "domain" field.  It causes pci_remove_device()
to crash trying to remove the dev from the domain's list of devices
(and was probably the wrong thing to do anyway).

Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
xen-unstable changeset:   23371:4326bcd88b33
xen-unstable date:        Mon May 23 18:35:32 2011 +0100

drivers/passthrough: Revert 23352:ea48976517af -- incorrect bugfix.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
xen-unstable changeset:   23370:2e6719425265
xen-unstable date:        Mon May 23 18:35:04 2011 +0100
---


diff -r a0ed85c8ddcf -r 61336bbb0002 xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c     Tue May 24 08:18:42 2011 +0100
+++ b/xen/drivers/passthrough/pci.c     Tue May 24 08:19:39 2011 +0100
@@ -158,7 +158,10 @@
         pdev->domain = dom0;
         ret = iommu_add_device(pdev);
         if ( ret )
+        {
+            pdev->domain = NULL;
             goto out;
+        }
 
         list_add(&pdev->domain_list, &dom0->arch.pdev_list);
         pci_enable_acs(pdev);
@@ -173,11 +176,11 @@
 
 int pci_remove_device(u8 bus, u8 devfn)
 {
-    struct pci_dev *pdev, *tmp;
+    struct pci_dev *pdev;
     int ret = -ENODEV;
 
     spin_lock(&pcidevs_lock);
-    list_for_each_entry_safe ( pdev, tmp, &alldevs_list, alldevs_list )
+    list_for_each_entry ( pdev, &alldevs_list, alldevs_list )
         if ( pdev->bus == bus && pdev->devfn == devfn )
         {
             ret = iommu_remove_device(pdev);
@@ -222,7 +225,10 @@
         pdev->domain = dom0;
         ret = iommu_add_device(pdev);
         if ( ret )
+        {
+            pdev->domain = NULL;
             goto out;
+        }
 
         list_add(&pdev->domain_list, &dom0->arch.pdev_list);
         pci_enable_acs(pdev);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.1-testing] drivers/passthrough: fix error paths in pci_add_device*(), Xen patchbot-4 . 1-testing <=