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=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=unavailable 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 0419AC10F05 for ; Mon, 1 Apr 2019 10:03:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE4FE2086C for ; Mon, 1 Apr 2019 10:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726600AbfDAKD1 (ORCPT ); Mon, 1 Apr 2019 06:03:27 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59782 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725868AbfDAKD1 (ORCPT ); Mon, 1 Apr 2019 06:03:27 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7F7E6A78; Mon, 1 Apr 2019 03:03:26 -0700 (PDT) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.197.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CCC163F690; Mon, 1 Apr 2019 03:03:21 -0700 (PDT) Date: Mon, 1 Apr 2019 11:03:18 +0100 From: Lorenzo Pieralisi To: Wen Yang Cc: benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, tyreld@linux.vnet.ibm.com, bhelgaas@google.com, linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ryder.lee@mediatek.com, matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, rjui@broadcom.com, sbranden@broadcom.com, bcm-kernel-feedback-list@broadcom.com, thomas.petazzoni@bootlin.com, shawn.lin@rock-chips.com, heiko@sntech.de, linux-rockchip@lists.infradead.org, minghuan.Lian@nxp.com, mingkai.hu@nxp.com, roy.zang@nxp.com, hayashi.kunihiko@socionext.com, yamada.masahiro@socionext.com, kishon@ti.com, linux-omap@vger.kernel.org, wang.yi59@zte.com.cn Subject: Re: [PATCH 1/8] PCI: dwc: pci-dra7xx: fix a leaked reference by adding missing of_node_put Message-ID: <20190401100318.GB30501@e107981-ln.cambridge.arm.com> References: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 27, 2019 at 12:40:36PM +0800, Wen Yang wrote: > The call to of_get_next_child returns a node pointer with refcount > incremented thus it must be explicitly decremented after the last > usage. > irq_domain_add_linear also calls of_node_get to increase refcount, > so irq_domain will not be affected when it is released. > > Detected by coccinelle with the following warnings: > ./drivers/pci/controller/dwc/pci-dra7xx.c:252:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. > ./drivers/pci/controller/dwc/pci-dra7xx.c:255:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. > > Signed-off-by: Wen Yang > Cc: Kishon Vijay Abraham I > Cc: Lorenzo Pieralisi > Cc: Bjorn Helgaas > Cc: linux-omap@vger.kernel.org > Cc: linux-pci@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > --- > drivers/pci/controller/dwc/pci-dra7xx.c | 1 + > 1 file changed, 1 insertion(+) Applied the series to pci/misc for v5.2, thanks. Lorenzo > diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c > index ae84a69..627c91d 100644 > --- a/drivers/pci/controller/dwc/pci-dra7xx.c > +++ b/drivers/pci/controller/dwc/pci-dra7xx.c > @@ -247,6 +247,7 @@ static int dra7xx_pcie_init_irq_domain(struct pcie_port *pp) > > dra7xx->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, > &intx_domain_ops, pp); > + of_node_put(pcie_intc_node); > if (!dra7xx->irq_domain) { > dev_err(dev, "Failed to get a INTx IRQ domain\n"); > return -ENODEV; > -- > 2.9.5 > 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=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=unavailable 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 34592C43381 for ; Mon, 1 Apr 2019 10:05:00 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B16712086C for ; Mon, 1 Apr 2019 10:04:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B16712086C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44XnyK49pYzDqFK for ; Mon, 1 Apr 2019 21:04:57 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=arm.com (client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=lorenzo.pieralisi@arm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by lists.ozlabs.org (Postfix) with ESMTP id 44Xnwj3lR7zDq5W for ; Mon, 1 Apr 2019 21:03:28 +1100 (AEDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7F7E6A78; Mon, 1 Apr 2019 03:03:26 -0700 (PDT) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.197.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CCC163F690; Mon, 1 Apr 2019 03:03:21 -0700 (PDT) Date: Mon, 1 Apr 2019 11:03:18 +0100 From: Lorenzo Pieralisi To: Wen Yang Subject: Re: [PATCH 1/8] PCI: dwc: pci-dra7xx: fix a leaked reference by adding missing of_node_put Message-ID: <20190401100318.GB30501@e107981-ln.cambridge.arm.com> References: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, hayashi.kunihiko@socionext.com, shawn.lin@rock-chips.com, minghuan.Lian@nxp.com, paulus@samba.org, thomas.petazzoni@bootlin.com, ryder.lee@mediatek.com, kishon@ti.com, linux-rockchip@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, wang.yi59@zte.com.cn, rjui@broadcom.com, linux-mediatek@lists.infradead.org, tyreld@linux.vnet.ibm.com, matthias.bgg@gmail.com, linux-omap@vger.kernel.org, mingkai.hu@nxp.com, roy.zang@nxp.com, sbranden@broadcom.com, yamada.masahiro@socionext.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, bhelgaas@google.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, Feb 27, 2019 at 12:40:36PM +0800, Wen Yang wrote: > The call to of_get_next_child returns a node pointer with refcount > incremented thus it must be explicitly decremented after the last > usage. > irq_domain_add_linear also calls of_node_get to increase refcount, > so irq_domain will not be affected when it is released. > > Detected by coccinelle with the following warnings: > ./drivers/pci/controller/dwc/pci-dra7xx.c:252:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. > ./drivers/pci/controller/dwc/pci-dra7xx.c:255:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. > > Signed-off-by: Wen Yang > Cc: Kishon Vijay Abraham I > Cc: Lorenzo Pieralisi > Cc: Bjorn Helgaas > Cc: linux-omap@vger.kernel.org > Cc: linux-pci@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > --- > drivers/pci/controller/dwc/pci-dra7xx.c | 1 + > 1 file changed, 1 insertion(+) Applied the series to pci/misc for v5.2, thanks. Lorenzo > diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c > index ae84a69..627c91d 100644 > --- a/drivers/pci/controller/dwc/pci-dra7xx.c > +++ b/drivers/pci/controller/dwc/pci-dra7xx.c > @@ -247,6 +247,7 @@ static int dra7xx_pcie_init_irq_domain(struct pcie_port *pp) > > dra7xx->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, > &intx_domain_ops, pp); > + of_node_put(pcie_intc_node); > if (!dra7xx->irq_domain) { > dev_err(dev, "Failed to get a INTx IRQ domain\n"); > return -ENODEV; > -- > 2.9.5 > 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=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT 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 ED946C43381 for ; Mon, 1 Apr 2019 10:03:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BD13F2087F for ; Mon, 1 Apr 2019 10:03:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="u1T4t0w1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD13F2087F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=r52FtuJpQd/dwEASiaIl+hoZsgIA8bF+2LT/HjWKiqY=; b=u1T4t0w1cuWjZz kp4nPuYj32s4S5EeRoaECjnm7ettkBzGjBXSGkeEtcXMzcwRiu633BLm4HKr37PPKEBY5lX0y9/wz CvN0+nzvrF0po7St1bsiIosNSUjGL/vNDzqwc5QOHs4VSFSNcoU77N5Dl8nOVSZtnUeQCmtBBcV/B wbo8agSD8UsZsB6+uLIemqxOkyHF+WlzaaAz5KshEQWTg4LrR8bKFq7tiJ8+l3PbVi2emjC6RGbmk 0K7Myqk2NjnLDo0YcoD95iHwIoRxCHP8RRFg2gkhnWQm6cUv2/KD/NnhSvLtwLHn8lKRi4+YSksAl Z2iy2QoHFJk/1kQfQ4uA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAtmu-0007EM-6h; Mon, 01 Apr 2019 10:03:32 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAtmq-0007DO-Qt; Mon, 01 Apr 2019 10:03:30 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7F7E6A78; Mon, 1 Apr 2019 03:03:26 -0700 (PDT) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.197.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CCC163F690; Mon, 1 Apr 2019 03:03:21 -0700 (PDT) Date: Mon, 1 Apr 2019 11:03:18 +0100 From: Lorenzo Pieralisi To: Wen Yang Subject: Re: [PATCH 1/8] PCI: dwc: pci-dra7xx: fix a leaked reference by adding missing of_node_put Message-ID: <20190401100318.GB30501@e107981-ln.cambridge.arm.com> References: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1551242443-27300-1-git-send-email-wen.yang99@zte.com.cn> User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_030328_877498_71D719E1 X-CRM114-Status: GOOD ( 17.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, hayashi.kunihiko@socionext.com, benh@kernel.crashing.org, shawn.lin@rock-chips.com, minghuan.Lian@nxp.com, paulus@samba.org, thomas.petazzoni@bootlin.com, ryder.lee@mediatek.com, mpe@ellerman.id.au, kishon@ti.com, linux-rockchip@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, wang.yi59@zte.com.cn, rjui@broadcom.com, linux-mediatek@lists.infradead.org, tyreld@linux.vnet.ibm.com, matthias.bgg@gmail.com, linux-omap@vger.kernel.org, mingkai.hu@nxp.com, roy.zang@nxp.com, sbranden@broadcom.com, yamada.masahiro@socionext.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, bhelgaas@google.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 27, 2019 at 12:40:36PM +0800, Wen Yang wrote: > The call to of_get_next_child returns a node pointer with refcount > incremented thus it must be explicitly decremented after the last > usage. > irq_domain_add_linear also calls of_node_get to increase refcount, > so irq_domain will not be affected when it is released. > > Detected by coccinelle with the following warnings: > ./drivers/pci/controller/dwc/pci-dra7xx.c:252:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. > ./drivers/pci/controller/dwc/pci-dra7xx.c:255:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function. > > Signed-off-by: Wen Yang > Cc: Kishon Vijay Abraham I > Cc: Lorenzo Pieralisi > Cc: Bjorn Helgaas > Cc: linux-omap@vger.kernel.org > Cc: linux-pci@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > --- > drivers/pci/controller/dwc/pci-dra7xx.c | 1 + > 1 file changed, 1 insertion(+) Applied the series to pci/misc for v5.2, thanks. Lorenzo > diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c > index ae84a69..627c91d 100644 > --- a/drivers/pci/controller/dwc/pci-dra7xx.c > +++ b/drivers/pci/controller/dwc/pci-dra7xx.c > @@ -247,6 +247,7 @@ static int dra7xx_pcie_init_irq_domain(struct pcie_port *pp) > > dra7xx->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, > &intx_domain_ops, pp); > + of_node_put(pcie_intc_node); > if (!dra7xx->irq_domain) { > dev_err(dev, "Failed to get a INTx IRQ domain\n"); > return -ENODEV; > -- > 2.9.5 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel