Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1557947

Re: [PATCH] PCI: iproc: fix kernel crash if dev->of_node not defined

From Florian Fainelli <florian.fainelli@broadcom.com>
Newsgroups linux.kernel
Subject Re: [PATCH] PCI: iproc: fix kernel crash if dev->of_node not defined
Date 2017-01-13 02:30 +0100
Message-ID <sYYQO-2T4-3@gated-at.bofh.it> (permalink)
References <sYXUK-2kB-9@gated-at.bofh.it> <sYXUK-2kB-7@gated-at.bofh.it> <sYYe6-2r3-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01/12/2017 04:48 PM, Ray Jui wrote:
> Hi Florian,
> 
> On 1/12/2017 4:22 PM, Florian Fainelli wrote:
>> On 01/12/2017 04:20 PM, Abylay Ospan wrote:
>>> pcie->dev->of_node not always defined (NULL) and can cause crash:
>>>
>>> [   19.053195] Unable to handle kernel NULL pointer dereference at
>>> virtual address 00000020
>>> [<c0b0370c>] (of_n_addr_cells) from [<c06599c4>]
>>> (iproc_pcie_setup+0x30c/0xce0)
>>>
>>> this patch adds sanity check to prevent crash.
>>
>> Humm, how can it not be defined based on your earlier comment that you
>> are using this on NSP which is Device Tree exclusively? I would agree if
>> this was seen on e.g: MIPS/BCMA (47xx).
> 
> I thought Abylay mentioned:
> 
> "Tested on Broadcom NorthStar machine ('Edgecore ECW7220-L') with two
> PCIe wifi
> adapters (b43 BCM4331 and ath10k QCA988X)."
> 
> That is a NorthStar device which is BCMA based?

Still, upstream Linux support for Northstar is Device Tree, and BCMA bus
should fill in of_nodes accordingly, if not, that's a bug that must be
fixed at the BCMA layer.

> 
>>
>>>
>>> Signed-off-by: Abylay Ospan <aospan@netup.ru>
>>> ---
>>>  drivers/pci/host/pcie-iproc.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
>>> index 3ebc025..f2836a9 100644
>>> --- a/drivers/pci/host/pcie-iproc.c
>>> +++ b/drivers/pci/host/pcie-iproc.c
>>> @@ -952,6 +952,9 @@ static int pci_dma_range_parser_init(struct of_pci_range_parser *parser,
>>>  	const int na = 3, ns = 2;
>>>  	int rlen;
>>>  
>>> +	if (!node)
>>> +		return -ENOENT;
>>> +
>>>  	parser->node = node;
>>>  	parser->pna = of_n_addr_cells(node);
>>>  	parser->np = parser->pna + na + ns;
>>>
>>
>>


-- 
Florian

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] PCI: iproc: fix kernel crash if dev->of_node not defined Florian Fainelli <f.fainelli@gmail.com> - 2017-01-13 01:30 +0100
  Re: [PATCH] PCI: iproc: fix kernel crash if dev->of_node not defined Ray Jui <ray.jui@broadcom.com> - 2017-01-13 01:50 +0100
    Re: [PATCH] PCI: iproc: fix kernel crash if dev->of_node not defined Florian Fainelli <florian.fainelli@broadcom.com> - 2017-01-13 02:30 +0100
      Re: [PATCH] PCI: iproc: fix kernel crash if dev->of_node not defined Abylay Ospan <aospan@netup.ru> - 2017-01-13 06:40 +0100
  Re: [PATCH] PCI: iproc: fix kernel crash if dev->of_node not defined Abylay Ospan <aospan@netup.ru> - 2017-01-13 07:00 +0100

csiph-web