mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
xen/pciback: Check dev_data before using it
[ Upstream commit 1669907e3d
]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e8113c362a
commit
e50bf6849f
1 changed files with 2 additions and 1 deletions
|
@ -106,7 +106,8 @@ static void pcistub_device_release(struct kref *kref)
|
|||
* is called from "unbind" which takes a device_lock mutex.
|
||||
*/
|
||||
__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");
|
||||
else
|
||||
pci_restore_state(dev);
|
||||
|
|
Loading…
Reference in a new issue