From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Marczykowski Subject: [PATCH] libxl: do not try to detach pci device when none attached Date: Fri, 10 Jun 2011 01:33:28 +0200 Message-ID: <88f67b423c89f4bd6048.1307662408@devel14> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: marmarek@mimuw.edu.pl List-Id: xen-devel@lists.xenproject.org # HG changeset patch # User Marek Marczykowski # Date 1307662302 -7200 # Node ID 88f67b423c89f4bd604837b9eae2483dad5ebb0d # Parent 4b392511ae0840fba66c40aa2788dc1ff402b6e8 libxl: do not try to detach pci device when none attached Fixes SEGV on domain destroy Signed-off-by: Marek Marczykowski diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -1039,6 +1039,8 @@ int libxl_device_pci_shutdown(libxl_ctx rc = libxl_device_pci_list_assigned(ctx, &pcidevs, domid, &num); if ( rc ) return rc; + if ( num == 0 ) + return 0; for (i = 0; i < num; i++) { /* Force remove on shutdown since, on HVM, qemu will not always * respond to SCI interrupt because the guest kernel has shut down the