From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
linux-pm@vger.kernel.org
Subject: Re: [PATCH v1 1/1] PCI / PM: check all fields in pci_set_platform_pm()
Date: Wed, 08 Jun 2016 12:04:06 +0300 [thread overview]
Message-ID: <1465376646.1767.114.camel@linux.intel.com> (raw)
In-Reply-To: <2053744.vokaYxPbf2@vostro.rjw.lan>
On Wed, 2016-06-08 at 02:17 +0200, Rafael J. Wysocki wrote:
> On Monday, June 06, 2016 05:25:33 PM Andy Shevchenko wrote:
> > 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>
>
> OK in principle, but what's the motivation?
I didn't investigate the guts of the core code, but I'm about to add new
module which will use these facilities. Since the module is slightly
based on existing code for older kernels I noticed those new callbacks.
To prevent potential NULL pointer dereference.
> > ---
> > 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;
> >
>
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2016-06-08 9:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2016-07-19 21:37 ` Bjorn Helgaas
2016-07-19 22:04 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1465376646.1767.114.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).