From: Aditya Pakki <pakki001@umn.edu> To: pakki001@umn.edu Cc: kjlu@umn.edu, Will Deacon <will.deacon@arm.com>, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>, Bjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] PCI: Fix to avoid potential NULL pointer dereference Date: Mon, 18 Mar 2019 19:26:30 -0500 [thread overview] Message-ID: <20190319002630.12485-1-pakki001@umn.edu> (raw) In gen_pci_probe, of_match_node can return a NULL pointer in case of failure. The patch avoids a NULL pointer dereference in such a scenario. Signed-off-by: Aditya Pakki <pakki001@umn.edu> --- drivers/pci/controller/pci-host-generic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/controller/pci-host-generic.c b/drivers/pci/controller/pci-host-generic.c index dea3ec7592a2..85f473f50e96 100644 --- a/drivers/pci/controller/pci-host-generic.c +++ b/drivers/pci/controller/pci-host-generic.c @@ -83,6 +83,8 @@ static int gen_pci_probe(struct platform_device *pdev) struct pci_ecam_ops *ops; of_id = of_match_node(gen_pci_of_match, pdev->dev.of_node); + if (!of_id) + return -ENXIO; ops = (struct pci_ecam_ops *)of_id->data; return pci_host_common_probe(pdev, ops); -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Aditya Pakki <pakki001@umn.edu> To: pakki001@umn.edu Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>, kjlu@umn.edu, Will Deacon <will.deacon@arm.com>, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>, linux-arm-kernel@lists.infradead.org Subject: [PATCH] PCI: Fix to avoid potential NULL pointer dereference Date: Mon, 18 Mar 2019 19:26:30 -0500 [thread overview] Message-ID: <20190319002630.12485-1-pakki001@umn.edu> (raw) In gen_pci_probe, of_match_node can return a NULL pointer in case of failure. The patch avoids a NULL pointer dereference in such a scenario. Signed-off-by: Aditya Pakki <pakki001@umn.edu> --- drivers/pci/controller/pci-host-generic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/controller/pci-host-generic.c b/drivers/pci/controller/pci-host-generic.c index dea3ec7592a2..85f473f50e96 100644 --- a/drivers/pci/controller/pci-host-generic.c +++ b/drivers/pci/controller/pci-host-generic.c @@ -83,6 +83,8 @@ static int gen_pci_probe(struct platform_device *pdev) struct pci_ecam_ops *ops; of_id = of_match_node(gen_pci_of_match, pdev->dev.of_node); + if (!of_id) + return -ENXIO; ops = (struct pci_ecam_ops *)of_id->data; return pci_host_common_probe(pdev, ops); -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2019-03-19 0:26 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-03-19 0:26 Aditya Pakki [this message] 2019-03-19 0:26 ` [PATCH] PCI: Fix to avoid potential NULL pointer dereference Aditya Pakki 2019-03-19 5:36 ` Jisheng Zhang 2019-03-19 5:36 ` Jisheng Zhang
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=20190319002630.12485-1-pakki001@umn.edu \ --to=pakki001@umn.edu \ --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=will.deacon@arm.com \ /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: linkBe 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.