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-devel

Re: [Xen-devel] [PATCH] libxl: do not try to detach pci device when none

To: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libxl: do not try to detach pci device when none attached
From: Marek Marczykowski <marmarek@xxxxxxxxxxxx>
Date: Fri, 10 Jun 2011 12:48:21 +0200
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 10 Jun 2011 03:49:02 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.1106101138210.12963@kaball-desktop>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <88f67b423c89f4bd6048.1307662408@devel14> <alpine.DEB.2.00.1106101138210.12963@kaball-desktop>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Thunderbird/3.1.10
On 10.06.2011 12:44, Stefano Stabellini wrote:
> On Fri, 10 Jun 2011, Marek Marczykowski wrote:
>> # HG changeset patch
>> # User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
>> # 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 <marmarek@xxxxxxxxxxxx>
>>
>> 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
> 
> Is the problem here that num is 0 and pcidevs is uninitialized?
> If so, would this patch solve the problem you are seeing?

No, when there is no PCI devs, libxl_device_pci_list_assigned exists
earlier - before allocating memory for pcidevs.

> diff -r 37c77bacb52a tools/libxl/libxl_pci.c
> --- a/tools/libxl/libxl_pci.c Mon May 23 17:38:28 2011 +0100
> +++ b/tools/libxl/libxl_pci.c Fri Jun 10 10:39:05 2011 +0000
> @@ -1022,8 +1022,7 @@ int libxl_device_pci_list_assigned(libxl
>              } while ((p = strtok_r(NULL, ",=", &saveptr)) != NULL);
>          }
>      }
> -    if ( *num )
> -        *list = pcidevs;
> +    *list = pcidevs;
>      libxl__free_all(&gc);
>      return 0;
>  }


-- 
Pozdrawiam / Best Regards,
Marek Marczykowski         | RLU #390519
marmarek at mimuw edu pl   | xmpp:marmarek at staszic waw pl

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

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