From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934987AbcJUPhI (ORCPT ); Fri, 21 Oct 2016 11:37:08 -0400 Received: from mail.kernel.org ([198.145.29.136]:40282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934311AbcJUPhH (ORCPT ); Fri, 21 Oct 2016 11:37:07 -0400 Date: Fri, 21 Oct 2016 10:37:01 -0500 From: Bjorn Helgaas To: Li Yang Cc: Bjorn Helgaas , Minghuan Lian , Mingkai Hu , Roy Zang , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stuart Yoder Subject: Re: [PATCH] PCI: layerscape: Fix kernel panic on accessing NULL pointer Message-ID: <20161021153701.GC9007@localhost> References: <1476740647-11155-1-git-send-email-leoyang.li@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1476740647-11155-1-git-send-email-leoyang.li@nxp.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Li Yang 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@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel