From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: [PATCH 4 of 6] xend: Don't crash due to weird PCI devices Date: Sat, 24 Mar 2012 13:41:45 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xensource.com, keir.fraser@eu.citrix.com, Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com Cc: konrad.wilk@oracle.com List-Id: xen-devel@lists.xenproject.org # HG changeset patch # User Konrad Rzeszutek Wilk # Date 1332610898 14400 # Node ID d42921da3931026ecf5da7c0e5bb86074e77cf71 # Parent 75798a472b1a9121adda166b6fd05ba8473a44f0 xend: Don't crash due to weird PCI devices This fixes Red Hat BZ 767742 where a user had some truly weird PCI devices: $ lspci -vvv -xxx -s 0000:01:00.0 01:00.0 VGA compatible controller: nVidia Corporation GT218 [NVS 3100M] (rev ff) (prog-if ff) !!! Unknown header type 7f 00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff And xend would report: ERROR (pci:1272) Caught 'Looped capability chain: 0000:01:00.0' This fixes it. Signed-off-by: Konrad Rzeszutek Wilk diff -r 75798a472b1a -r d42921da3931 tools/python/xen/util/pci.py --- a/tools/python/xen/util/pci.py Sat Mar 24 13:41:38 2012 -0400 +++ b/tools/python/xen/util/pci.py Sat Mar 24 13:41:38 2012 -0400 @@ -1268,7 +1268,12 @@ class PciDevice: pass def get_info_from_sysfs(self): - self.find_capability(0x11) + try: + self.find_capability(0x11) + except PciDeviceParseError, err: + log.error("Caught '%s'" % err) + return False + sysfs_mnt = find_sysfs_mnt() if sysfs_mnt == None: return False