From: Konrad Rzeszutek Wilk Date: Thu, 29 Sep 2011 17:12:43 +0000 (-0400) Subject: xen/pciback: Check if the device is found instead of blindly assuming so. X-Git-Tag: firefly_0821_release~3680^2~4336^3 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4645bf306746106f805d2afa5330bf31df381626;p=firefly-linux-kernel-4.4.55.git xen/pciback: Check if the device is found instead of blindly assuming so. Just in case it is not found, don't try to dereference it. [v1: Added WARN_ON, suggested by Jan Beulich ] Signed-off-by: Konrad Rzeszutek Wilk --- diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c index 3cc3fbe5bf8d..8f06e1ed028c 100644 --- a/drivers/xen/xen-pciback/pci_stub.c +++ b/drivers/xen/xen-pciback/pci_stub.c @@ -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