Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xen/pciback: Check dev_data before using it

If pcistub_init_device fails, the release function will be called with
dev_data set to NULL. Check it before using it to avoid a NULL pointer
dereference.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

authored by

Ross Lagerwall and committed by
Boris Ostrovsky
1669907e bf9445a3

+2 -1
+2 -1
drivers/xen/xen-pciback/pci_stub.c
··· 106 106 * is called from "unbind" which takes a device_lock mutex. 107 107 */ 108 108 __pci_reset_function_locked(dev); 109 - if (pci_load_and_free_saved_state(dev, &dev_data->pci_saved_state)) 109 + if (dev_data && 110 + pci_load_and_free_saved_state(dev, &dev_data->pci_saved_state)) 110 111 dev_info(&dev->dev, "Could not reload PCI state\n"); 111 112 else 112 113 pci_restore_state(dev);