diff options
| author | Ross Lagerwall <ross.lagerwall@citrix.com> | 2018-12-14 07:55:45 -0500 |
|---|---|---|
| committer | Boris Ostrovsky <boris.ostrovsky@oracle.com> | 2018-12-17 10:29:50 -0500 |
| commit | 1669907e3d1abfa3f7586e2d55dbbc117b5adba2 (patch) | |
| tree | 623ecc6144a0983d5a7d0bc13f1abfa14207e819 | |
| parent | bf9445a33ae6ac2f0822d2f1ce1365408387d568 (diff) | |
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>
| -rw-r--r-- | drivers/xen/xen-pciback/pci_stub.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c index 59661db144e5..097410a7cdb7 100644 --- a/drivers/xen/xen-pciback/pci_stub.c +++ b/drivers/xen/xen-pciback/pci_stub.c | |||
| @@ -106,7 +106,8 @@ static void pcistub_device_release(struct kref *kref) | |||
| 106 | * is called from "unbind" which takes a device_lock mutex. | 106 | * is called from "unbind" which takes a device_lock mutex. |
| 107 | */ | 107 | */ |
| 108 | __pci_reset_function_locked(dev); | 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 | dev_info(&dev->dev, "Could not reload PCI state\n"); | 111 | dev_info(&dev->dev, "Could not reload PCI state\n"); |
| 111 | else | 112 | else |
| 112 | pci_restore_state(dev); | 113 | pci_restore_state(dev); |
