On 31/01/2019 16:51, Lorenzo Pieralisi wrote: > [+Marc, for his information] > > On Wed, Jan 16, 2019 at 11:14:22AM +0100, Gustavo Pimentel wrote: >> Add pcie port pointer validation to avoid a potencial crash accessing a >> null pointer reported by coverity scan. > > s/potencial/potential > s/null/NULL > >> Warning generated by coverity: "Dereferencing a pointer that might be >> null "data" when calling "irq_data_get_irq_chip_data". > > s/null/NULL > >> Signed-off-by: Gustavo Pimentel <gustavo.pimentel@xxxxxxxxxxxx> >> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx> >> Cc: Joao Pinto <jpinto@xxxxxxxxxxxx> >> Cc: Jingoo Han <jingoohan1@xxxxxxxxx> >> --- >> drivers/pci/controller/dwc/pcie-designware-host.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c >> index 45ff5e4..419a56b 100644 >> --- a/drivers/pci/controller/dwc/pcie-designware-host.c >> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c >> @@ -256,9 +256,14 @@ static void dw_pcie_irq_domain_free(struct irq_domain *domain, >> unsigned int virq, unsigned int nr_irqs) >> { >> struct irq_data *d = irq_domain_get_irq_data(domain, virq); >> - struct pcie_port *pp = irq_data_get_irq_chip_data(d); >> + struct pcie_port *pp; >> unsigned long flags; >> >> + if (!d) >> + return; >> + >> + pp = irq_data_get_irq_chip_data(d); > > Well, we do not validate pp either and I wonder whether coverity trips > over this code path but that's just a false positive. > > If we have to actually patch it there are other code paths in the kernel > to be updated too. Ok, I can drop this patch. Gustavo > > Lorenzo > >> + >> raw_spin_lock_irqsave(&pp->lock, flags); >> >> bitmap_release_region(pp->msi_irq_in_use, d->hwirq, >> -- >> 2.7.4 >>