From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 541F7C169C4 for ; Thu, 31 Jan 2019 17:43:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1200B218AF for ; Thu, 31 Jan 2019 17:43:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="UZc52xKk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725775AbfAaRn1 (ORCPT ); Thu, 31 Jan 2019 12:43:27 -0500 Received: from smtprelay.synopsys.com ([198.182.47.9]:52706 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725298AbfAaRn1 (ORCPT ); Thu, 31 Jan 2019 12:43:27 -0500 Received: from mailhost.synopsys.com (dc2-mailhost2.synopsys.com [10.12.135.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 896A624E16CD; Thu, 31 Jan 2019 09:43:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1548956605; bh=WeTrYTVGTJ09KT5AL4GJ3yJOBjdMcIMum3ZIJvqc1j0=; h=Subject:To:CC:References:From:Date:In-Reply-To:From; b=UZc52xKk4V5lw/xE2tYg+8puOx8m0HD8jESafHHsG12NZY4GSNu0tbT478aD0ZFZR cjPZgLrL8KzO7dXv+IufLRY3bP0mQmc2RV3s3GXRIjGYozvRfPdel4AXpCYDfdqjmV 8lkmJ6tasn82LWHEqS4xlxehhA12rzjOxLmuMCeE9kxOA8H9IU7Qtvfc6BM2ybGsBW Jbs7fdfu6riC6Y0KH6TURqRDMsld8e+tjd8uM3hKUDgQ/zvTBgzkDiyFrOov1kj9Zh qRXYqM9f5aef0EMFJ4YBK/Y1WI0ERzbJlaBo2nAnNTMZsfqwcm0+Y6edgq91xIAP4h WYiVRroOkj30Q== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 7A085A0093; Thu, 31 Jan 2019 17:43:19 +0000 (UTC) Received: from DE02WEHTCB.internal.synopsys.com (10.225.19.94) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 31 Jan 2019 09:42:04 -0800 Received: from DE02WEHTCA.internal.synopsys.com (10.225.19.92) by DE02WEHTCB.internal.synopsys.com (10.225.19.94) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 31 Jan 2019 18:42:02 +0100 Received: from [10.225.2.145] (10.225.2.145) by DE02WEHTCA.internal.synopsys.com (10.225.19.80) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 31 Jan 2019 18:42:02 +0100 Subject: Re: [PATCH 9/9] PCI: dwc: Add pcie port pointer validation To: Lorenzo Pieralisi , Gustavo Pimentel CC: "linux-pci@vger.kernel.org" , Joao Pinto , Jingoo Han , "marc.zyngier@arm.com" References: <0164f622c6d16755d006ae090fba65cff24cfeb2.1547631485.git.gustavo.pimentel@synopsys.com> <20190131165104.GC28941@e107981-ln.cambridge.arm.com> From: Gustavo Pimentel Message-ID: <1591cc65-82b2-3910-ab4d-730f7d2fc6a4@synopsys.com> Date: Thu, 31 Jan 2019 17:37:04 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190131165104.GC28941@e107981-ln.cambridge.arm.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.225.2.145] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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 >> Cc: Lorenzo Pieralisi >> Cc: Joao Pinto >> Cc: Jingoo Han >> --- >> 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 >>