From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Kangjie Lu <kjlu@umn.edu>
Cc: Simon Horman <horms@verge.net.au>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] pci: pcie-rcar: fix a potential NULL pointer dereference
Date: Fri, 29 Mar 2019 16:22:17 +0000 [thread overview]
Message-ID: <20190329162217.GA7138@e107981-ln.cambridge.arm.com> (raw)
In-Reply-To: <20190315072943.22923-1-kjlu@umn.edu>
On Fri, Mar 15, 2019 at 02:29:43AM -0500, Kangjie Lu wrote:
> In case __get_free_pages fails and returns NULL, the fix returns
> -ENOMEM and releases resources to avoid NULL pointer dereference.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> ---
> V2 removes the error message.
> ---
> drivers/pci/controller/pcie-rcar.c | 4 ++++
> 1 file changed, 4 insertions(+)
Applied to pci/rcar for v5.2, thanks.
Lorenzo
> diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
> index c8febb009454..71e55995c058 100644
> --- a/drivers/pci/controller/pcie-rcar.c
> +++ b/drivers/pci/controller/pcie-rcar.c
> @@ -929,6 +929,10 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>
> /* setup MSI data target */
> msi->pages = __get_free_pages(GFP_KERNEL, 0);
> + if (!msi->pages) {
> + err = -ENOMEM;
> + goto err;
> + }
> base = virt_to_phys((void *)msi->pages);
>
> rcar_pci_write_reg(pcie, base | MSIFE, PCIEMSIALR);
> --
> 2.17.1
>
prev parent reply other threads:[~2019-03-29 16:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-14 5:56 [PATCH] " Kangjie Lu
2019-03-14 7:30 ` Geert Uytterhoeven
2019-03-14 8:07 ` [PATCH v2] " Kangjie Lu
2019-03-14 8:10 ` Geert Uytterhoeven
2019-03-15 7:27 ` [PATCH v2] tty: atmel_serial: fix a " Kangjie Lu
2019-03-15 8:22 ` Richard Genoud
2019-03-15 17:16 ` [PATCH] " Kangjie Lu
2019-03-18 7:28 ` Richard Genoud
2019-03-15 7:29 ` [PATCH v2] pci: pcie-rcar: fix a potential " Kangjie Lu
2019-03-15 10:07 ` Ulrich Hecht
2019-03-15 11:54 ` Simon Horman
2019-03-29 16:22 ` Lorenzo Pieralisi [this message]
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=20190329162217.GA7138@e107981-ln.cambridge.arm.com \
--to=lorenzo.pieralisi@arm.com \
--cc=bhelgaas@google.com \
--cc=horms@verge.net.au \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
/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
all inboxes | Powered by JetHome®