From: Tim Deegan Subject: [PATCH] Re: pci_remove_device: fix linked list discipline Date: Mon, 23 May 2011 13:54:23 +0100 Message-ID: <20110523125423.GE12801@whitby.uk.xensource.com> References: <7b12c46b18777655c8a5.1305708795@whitby.uk.xensource.com> <4DD6A7E302000078000428AA@vpn.id2.novell.com> <20110523095554.GA12801@whitby.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="cmJC7u66zC7hs+87" Return-path: Content-Disposition: inline In-Reply-To: <20110523095554.GA12801@whitby.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich , Keir Fraser Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --cmJC7u66zC7hs+87 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline At 10:55 +0100 on 23 May (1306148154), Tim Deegan wrote: > > Somehow I overlooked this patch when it was sent - looking at the > > code it modifies I can't see why the ..._safe() variant is necessary > > here, as there's a break statement following the list deletion. > > Ah - good point. I'll go back to the crash report I thought this fixed > and take another look. :) The attached patch is a more likely candidate. That will teach me to debug crash reports without getting hold of proper debug symbols. :) Keir, can you apply this and revert 23352:ea48976517af ? Cheers, Tim. -- Tim Deegan Principal Software Engineer, Xen Platform Team Citrix Systems UK Ltd. (Company #02937203, SL9 0BG) --cmJC7u66zC7hs+87 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: attachment; filename="x" # HG changeset patch # User Tim Deegan # Date 1306154800 -3600 # Node ID d585903eb8bce83d7d365a4c94bbf0176283c3e9 # Parent 0f670f5146c858ffdc743176d4e22aef4bfe12da 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 diff -r 0f670f5146c8 -r d585903eb8bc xen/drivers/passthrough/pci.c --- a/xen/drivers/passthrough/pci.c Sat May 21 07:55:46 2011 +0100 +++ b/xen/drivers/passthrough/pci.c Mon May 23 13:46:40 2011 +0100 @@ -158,7 +158,10 @@ int pci_add_device(u8 bus, u8 devfn) 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); @@ -222,7 +225,10 @@ int pci_add_device_ext(u8 bus, u8 devfn, 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); --cmJC7u66zC7hs+87 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --cmJC7u66zC7hs+87--