From: Li Yang <leoyang.li@nxp.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
Minghuan Lian <minghuan.Lian@freescale.com>,
Mingkai Hu <mingkai.hu@freescale.com>,
Roy Zang <tie-fei.zang@freescale.com>
Cc: linux-pci@vger.kernel.org, Li Yang <leoyang.li@nxp.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Stuart Yoder <stuart.yoder@nxp.com>
Subject: [PATCH] PCI: layerscape: Fix kernel panic on accessing NULL pointer
Date: Mon, 17 Oct 2016 16:44:06 -0500 [thread overview]
Message-ID: <1476740647-11155-1-git-send-email-leoyang.li@nxp.com> (raw)
Commit fefe6733e added reference to the pcie->drvdata before it is
initialized which causes a kernel panic. Fix the problem by
initializing the pcie->drvdata earlier before it is used.
Reported-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
---
drivers/pci/host/pci-layerscape.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/host/pci-layerscape.c b/drivers/pci/host/pci-layerscape.c
index 2cb7315..958187f 100644
--- a/drivers/pci/host/pci-layerscape.c
+++ b/drivers/pci/host/pci-layerscape.c
@@ -245,6 +245,7 @@ static int __init ls_pcie_probe(struct platform_device *pdev)
if (!pcie)
return -ENOMEM;
+ pcie->drvdata = match->data;
pp = &pcie->pp;
pp->dev = dev;
pp->ops = pcie->drvdata->ops;
@@ -256,7 +257,6 @@ static int __init ls_pcie_probe(struct platform_device *pdev)
return PTR_ERR(pcie->pp.dbi_base);
}
- pcie->drvdata = match->data;
pcie->lut = pcie->pp.dbi_base + pcie->drvdata->lut_offset;
if (!ls_pcie_is_bridge(pcie))
--
1.9.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2016-10-17 21:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-17 21:44 Li Yang [this message]
2016-10-17 21:58 ` [PATCH] PCI: layerscape: Fix kernel panic on accessing NULL pointer Roy Zang
2016-10-21 15:37 ` Bjorn Helgaas
2016-10-21 16:05 ` Leo Li
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=1476740647-11155-1-git-send-email-leoyang.li@nxp.com \
--to=leoyang.li@nxp.com \
--cc=bhelgaas@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=minghuan.Lian@freescale.com \
--cc=mingkai.hu@freescale.com \
--cc=stuart.yoder@nxp.com \
--cc=tie-fei.zang@freescale.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: 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).