Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3808997img; Mon, 25 Mar 2019 19:07:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwF0ohaqnm3to3lLIb2Ysh7NxL6SuPolfhZ9q02SjrxwNPt/7oVMD5fol97xpc2VsYQeDIv X-Received: by 2002:a17:902:8ec1:: with SMTP id x1mr17306059plo.328.1553566034984; Mon, 25 Mar 2019 19:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553566034; cv=none; d=google.com; s=arc-20160816; b=oIjaR+iFMj4LF8YA+VtxQYWsQX/5eyug2/jkZ90yw7VmQdL+SfUh7/9h7T9oeVBmwc hZeqACEoj+zXW0sVPdJdsaY8eDScyTjbc58wCNUvwGwMlUl6b30ZqCeiKhmQ2EKwgY6K O7z7/XrnHBnFIq1MZv6jTBUOK7TS13/jfJ2fxxyGCbjZv87teU+N1pvT5bl6I4aChoRH WQb4l2fNZR+Ae5xrGQyfOQtqgYIsULQMGCl6sWfq85vyI8DLV4mZVyNADHirM6BNeaiW s4K4tUlb4jrkoc3cye26msjWsQ1zqqY3q+ThwDYsf4VWfPG47TMtgN5WOE7SyRfvmZsx TE0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=BdxuWo+IQY6JC5wGgx/VrV2OnAqPqeFUzpvpHeYmCGM=; b=JraQhAyG+iz5bfX7x5/DgjrksDzaA/8+AVfd+WzL2PspVm6ROS0bBxGKcHzqwd/hCN 3ySwBrJXMnDV2wyAa4hzNIGRWjeTlGn8ICp38Z6ANlen4TGCLe6pVmftW09leq8uJ+pA wPmMzGWxLYUHDyH10xvZmFkjA+fUZ/9DT/8h8vqdt7/rs4zGh41mHOCOYpoRSGjOAY7a d9NXe9N8Yhyc4luK4Eb3E/4TAGFSiiAGXb11t4+KvumVaBW1/7V2K58PWtcyj8csr36q fQuou8O/nu/BI3n5DlOeOR/lvhKbisbP1rNTbhDQFmH1DwxSyxyq7/WMhMCndVGUKN+z cQ9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d3si9701148pgh.238.2019.03.25.19.06.58; Mon, 25 Mar 2019 19:07:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730747AbfCZCGX (ORCPT + 99 others); Mon, 25 Mar 2019 22:06:23 -0400 Received: from mxhk.zte.com.cn ([63.217.80.70]:25282 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730625AbfCZCGW (ORCPT ); Mon, 25 Mar 2019 22:06:22 -0400 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 0883A20E516B7CDD5874; Tue, 26 Mar 2019 10:06:20 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x2Q26EuC083217; Tue, 26 Mar 2019 10:06:14 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019032610062610-6321346 ; Tue, 26 Mar 2019 10:06:26 +0800 From: Peng Hao To: vitb@kernel.crashing.org, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, christophe.leroy@c-s.fr Cc: Wen Yang , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] powerpc/8xx: fix possible object reference leak Date: Tue, 26 Mar 2019 18:29:51 +0800 Message-Id: <1553596191-78889-1-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-26 10:06:26, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-26 10:06:10, Serialize complete at 2019-03-26 10:06:10 X-MAIL: mse01.zte.com.cn x2Q26EuC083217 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wen Yang The call to of_find_compatible_node 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: ./arch/powerpc/platforms/8xx/pic.c:158:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 136, but without a corresponding object release within this function. Fixes: a8db8cf0d894 ("irq_domain: Replace irq_alloc_host() with revmap-specific initializers") Signed-off-by: Wen Yang Suggested-by: Christophe Leroy Suggested-by: Michael Ellerman Reviewed-by: Peng Hao Reviewed-by: Christophe Leroy Cc: Vitaly Bordug Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org --- v3->v2: set ret to zero explicitly. v2->v1: add a Fixes tag. arch/powerpc/platforms/8xx/pic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/8xx/pic.c b/arch/powerpc/platforms/8xx/pic.c index 8d5a25d..9993998 100644 --- a/arch/powerpc/platforms/8xx/pic.c +++ b/arch/powerpc/platforms/8xx/pic.c @@ -153,9 +153,9 @@ int mpc8xx_pic_init(void) if (mpc8xx_pic_host == NULL) { printk(KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n"); ret = -ENOMEM; - goto out; } - return 0; + + ret = 0; out: of_node_put(np); -- 2.9.5