Commit 73c1ca2d authored by Ross Lagerwall's avatar Ross Lagerwall Committed by Greg Kroah-Hartman

xen/pciback: Check dev_data before using it

[ Upstream commit 1669907e ]

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: default avatarRoss Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 24d992bc
...@@ -106,7 +106,8 @@ static void pcistub_device_release(struct kref *kref) ...@@ -106,7 +106,8 @@ static void pcistub_device_release(struct kref *kref)
* is called from "unbind" which takes a device_lock mutex. * is called from "unbind" which takes a device_lock mutex.
*/ */
__pci_reset_function_locked(dev); __pci_reset_function_locked(dev);
if (pci_load_and_free_saved_state(dev, &dev_data->pci_saved_state)) if (dev_data &&
pci_load_and_free_saved_state(dev, &dev_data->pci_saved_state))
dev_info(&dev->dev, "Could not reload PCI state\n"); dev_info(&dev->dev, "Could not reload PCI state\n");
else else
pci_restore_state(dev); pci_restore_state(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment