xen/pciback: Check if the device is found instead of blindly assuming so.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 29 Sep 2011 17:12:43 +0000 (13:12 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 19 Oct 2011 21:01:10 +0000 (17:01 -0400)
Just in case it is not found, don't try to dereference it.

[v1: Added WARN_ON, suggested by Jan Beulich <JBeulich@suse.com>]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/xen/xen-pciback/pci_stub.c

index 3cc3fbe5bf8d7eb6b2729602f15662fca9ba009a..8f06e1ed028c9ab737ca61136754ae2c707d43e2 100644 (file)
@@ -220,6 +220,8 @@ void pcistub_put_pci_dev(struct pci_dev *dev)
        }
 
        spin_unlock_irqrestore(&pcistub_devices_lock, flags);
+       if (WARN_ON(!found_psdev))
+               return;
 
        /*hold this lock for avoiding breaking link between
        * pcistub and xen_pcibk when AER is in processing