From: Bjorn Helgaas <helgaas@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
linux-pm@vger.kernel.org
Subject: Re: [PATCH v1 1/1] PCI / PM: check all fields in pci_set_platform_pm()
Date: Tue, 19 Jul 2016 16:37:51 -0500 [thread overview]
Message-ID: <20160719213751.GA18635@localhost> (raw)
In-Reply-To: <1465223133-73532-1-git-send-email-andriy.shevchenko@linux.intel.com>
On Mon, Jun 06, 2016 at 05:25:33PM +0300, 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>
> ---
> 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;
This looks OK to me. platform_pci_run_wake() and
platform_pci_need_resume() assume that if pci_platform_pm is set,
pci_platform_pm->run_wake and pci_platform_pm->need_resume are valid
function pointers. This is analogous to what we already do for
ops->is_manageable, etc.
Rafael, do you want to take this or should I?
> pci_platform_pm = ops;
> return 0;
> --
> 2.8.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-07-19 21:37 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
2016-07-19 21:37 ` Bjorn Helgaas [this message]
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=20160719213751.GA18635@localhost \
--to=helgaas@kernel.org \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.