* [PATCH] PCI: layerscape: Fix kernel panic on accessing NULL pointer
@ 2016-10-17 21:44 Li Yang
2016-10-17 21:58 ` Roy Zang
2016-10-21 15:37 ` Bjorn Helgaas
0 siblings, 2 replies; 4+ messages in thread
From: Li Yang @ 2016-10-17 21:44 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] PCI: layerscape: Fix kernel panic on accessing NULL pointer
2016-10-17 21:44 [PATCH] PCI: layerscape: Fix kernel panic on accessing NULL pointer Li Yang
@ 2016-10-17 21:58 ` Roy Zang
2016-10-21 15:37 ` Bjorn Helgaas
1 sibling, 0 replies; 4+ messages in thread
From: Roy Zang @ 2016-10-17 21:58 UTC (permalink / raw)
To: linux-arm-kernel
On 10/17/2016 04:50 PM, Li Yang wrote:
> 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>
> ---
Acked-by: Roy Zang <roy.zang@nxp.com>
Roy
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] PCI: layerscape: Fix kernel panic on accessing NULL pointer
2016-10-17 21:44 [PATCH] PCI: layerscape: Fix kernel panic on accessing NULL pointer Li Yang
2016-10-17 21:58 ` Roy Zang
@ 2016-10-21 15:37 ` Bjorn Helgaas
2016-10-21 16:05 ` Leo Li
1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2016-10-21 15:37 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Oct 17, 2016 at 04:44:06PM -0500, Li Yang wrote:
> 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>
I applied Marc Zyngier's identical patch to for-linus for v4.9. I don't
know which was posted first, but I saw Marc's first. Sorry I didn't at
least credit you when I applied it.
> ---
> 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 at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] PCI: layerscape: Fix kernel panic on accessing NULL pointer
2016-10-21 15:37 ` Bjorn Helgaas
@ 2016-10-21 16:05 ` Leo Li
0 siblings, 0 replies; 4+ messages in thread
From: Leo Li @ 2016-10-21 16:05 UTC (permalink / raw)
To: linux-arm-kernel
> -----Original Message-----
> From: Bjorn Helgaas [mailto:helgaas at kernel.org]
> Sent: Friday, October 21, 2016 10:37 AM
> To: Leo Li <leoyang.li@nxp.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>; Minghuan Lian
> <minghuan.Lian@freescale.com>; Mingkai Hu <mingkai.hu@freescale.com>;
> Roy Zang <tie-fei.zang@freescale.com>; linux-pci at vger.kernel.org; linux-
> kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; Stuart Yoder
> <stuart.yoder@nxp.com>
> Subject: Re: [PATCH] PCI: layerscape: Fix kernel panic on accessing NULL pointer
>
> On Mon, Oct 17, 2016 at 04:44:06PM -0500, Li Yang wrote:
> > 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>
>
> I applied Marc Zyngier's identical patch to for-linus for v4.9. I don't know which
> was posted first, but I saw Marc's first. Sorry I didn't at least credit you when I
> applied it.
It's ok. Seems Marc sent the patch earlier and I didn't notice his patch. There is no difference as long as the problem is addressed. :)
Regards,
Leo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-21 16:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-17 21:44 [PATCH] PCI: layerscape: Fix kernel panic on accessing NULL pointer Li Yang
2016-10-17 21:58 ` Roy Zang
2016-10-21 15:37 ` Bjorn Helgaas
2016-10-21 16:05 ` Leo Li
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).