Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1557931 > unrolled thread
| Started by | Abylay Ospan <aospan@netup.ru> |
|---|---|
| First post | 2017-01-13 01:30 +0100 |
| Last post | 2017-01-13 01:50 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] PCI: iproc: fix kernel crash if dev->of_node not defined Abylay Ospan <aospan@netup.ru> - 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
| From | Abylay Ospan <aospan@netup.ru> |
|---|---|
| Date | 2017-01-13 01:30 +0100 |
| Subject | [PATCH] PCI: iproc: fix kernel crash if dev->of_node not defined |
| Message-ID | <sYXUK-2kB-9@gated-at.bofh.it> |
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. 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; -- 2.7.4
[toc] | [next] | [standalone]
| From | Ray Jui <ray.jui@broadcom.com> |
|---|---|
| Date | 2017-01-13 01:50 +0100 |
| Message-ID | <sYYe6-2r3-9@gated-at.bofh.it> |
| In reply to | #1557931 |
On 1/12/2017 4:20 PM, Abylay Ospan wrote: > pcie->dev->of_node not always defined (NULL) and can cause crash: Ah I guess this can happen with the BCMA based platforms that do not use device tree for PCIe? > > [ 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. > > 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; > + Looks like a valid check to me. Acked-by: Ray Jui <ray.jui@broadcom.com> > parser->node = node; > parser->pna = of_n_addr_cells(node); > parser->np = parser->pna + na + ns; >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web