From: Steven Price <steven.price@arm.com>
To: Kangjie Lu <kjlu@umn.edu>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
linux-pci@vger.kernel.org, Michal Simek <michal.simek@xilinx.com>,
linux-kernel@vger.kernel.org, pakki001@umn.edu,
Bjorn Helgaas <bhelgaas@google.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] pci: pcie-xilinx: fix a missing-check bug for __get_free_pages
Date: Fri, 22 Mar 2019 16:26:29 +0000 [thread overview]
Message-ID: <d0aa29e9-54c6-bc8b-4827-0562b277265f@arm.com> (raw)
In-Reply-To: <20190314055851.6884-1-kjlu@umn.edu>
On 14/03/2019 05:58, Kangjie Lu wrote:
> In case __get_free_pages fail, the fix returns to avoid NULL
> pointer dereference.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> drivers/pci/controller/pcie-xilinx.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/pci/controller/pcie-xilinx.c b/drivers/pci/controller/pcie-xilinx.c
> index 9bd1a35cd5d8..b7083e995c45 100644
> --- a/drivers/pci/controller/pcie-xilinx.c
> +++ b/drivers/pci/controller/pcie-xilinx.c
> @@ -341,6 +341,9 @@ static void xilinx_pcie_enable_msi(struct xilinx_pcie_port *port)
> phys_addr_t msg_addr;
>
> port->msi_pages = __get_free_pages(GFP_KERNEL, 0);
> + if (unlikely(!port->msi_pages))
> + return;
Shouldn't the function return an error code for the calling function to
see? With this change the caller (xilinx_pcie_init_irq_domain) will
think that MSIs were enabled, but actually they weren't.
Steve
> +
> msg_addr = virt_to_phys((void *)port->msi_pages);
> pcie_write(port, 0x0, XILINX_PCIE_REG_MSIBASE1);
> pcie_write(port, msg_addr, XILINX_PCIE_REG_MSIBASE2);
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-03-22 16:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-14 5:58 [PATCH] pci: pcie-xilinx: fix a missing-check bug for __get_free_pages Kangjie Lu
2019-03-22 16:26 ` Steven Price [this message]
2019-03-25 21:31 ` [PATCH v2] " Kangjie Lu
2019-03-25 21:51 ` Bjorn Helgaas
2019-03-25 22:19 ` [PATCH v3] PCI: xilinx: Check for __get_free_pages() failure Kangjie Lu
2019-03-26 11:40 ` Steven Price
2019-03-27 13:36 ` Mukesh Ojha
2019-03-29 16:36 ` Lorenzo Pieralisi
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=d0aa29e9-54c6-bc8b-4827-0562b277265f@arm.com \
--to=steven.price@arm.com \
--cc=bhelgaas@google.com \
--cc=kjlu@umn.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=michal.simek@xilinx.com \
--cc=pakki001@umn.edu \
/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).