From: Andy Shevchenko Date: Mon, 6 Jun 2016 14:25:33 +0000 (+0300) Subject: PCI / PM: check all fields in pci_set_platform_pm() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6ec39cf5cd6f77e3ff9ff1da75b758a47f939888;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: Andy Shevchenko Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index c8b4dbdd1bdd..badbddc683f0 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -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;