PCI / PM: check all fields in pci_set_platform_pm()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 6 Jun 2016 14:25:33 +0000 (17:25 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 21 Jul 2016 20:55:53 +0000 (22:55 +0200)
When assign new PCI platform PM operations check for all mandatory fields to
prevent NULL pointer dereference.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/pci/pci.c

index c8b4dbdd1bddae95c214e92b52492b82364afcaf..badbddc683f006fc0510c6e609a01772fc0ba4f8 100644 (file)
@@ -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;