linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] PCI / PM: check all fields in pci_set_platform_pm()
@ 2016-06-06 14:25 Andy Shevchenko
  2016-06-08  0:17 ` Rafael J. Wysocki
  2016-07-19 21:37 ` Bjorn Helgaas
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2016-06-06 14:25 UTC (permalink / raw)
  To: linux-pci, Bjorn Helgaas, Rafael J. Wysocki, linux-pm; +Cc: Andy Shevchenko

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>
---
 drivers/pci/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c8b4dbd..badbddc 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;
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-19 22:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-06 14:25 [PATCH v1 1/1] PCI / PM: check all fields in pci_set_platform_pm() Andy Shevchenko
2016-06-08  0:17 ` Rafael J. Wysocki
2016-06-08  9:04   ` Andy Shevchenko
2016-07-19 21:37 ` Bjorn Helgaas
2016-07-19 22:04   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).