Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ec39cf5 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Rafael J. Wysocki
Browse files

PCI / PM: check all fields in pci_set_platform_pm()



When assign new PCI platform PM operations check for all mandatory fields to
prevent NULL pointer dereference.

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 92d21ac7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -530,8 +530,8 @@ static const struct pci_platform_pm_ops *pci_platform_pm;

int pci_set_platform_pm(const struct pci_platform_pm_ops *ops)
{
	if (!ops->is_manageable || !ops->set_state || !ops->choose_state
	    || !ops->sleep_wake)
	if (!ops->is_manageable || !ops->set_state || !ops->choose_state ||
	    !ops->sleep_wake || !ops->run_wake || !ops->need_resume)
		return -EINVAL;
	pci_platform_pm = ops;
	return 0;