Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp274698img; Thu, 21 Mar 2019 20:09:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLOH41mnycblYjzlbx0VsUulULQEaAfQMIUgpkLOAJlhHdFxHm5kbKK0cKt8IWcfaolbVQ X-Received: by 2002:a63:784e:: with SMTP id t75mr6674773pgc.326.1553224181720; Thu, 21 Mar 2019 20:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553224181; cv=none; d=google.com; s=arc-20160816; b=d719pzYzhz9/MAPswtpQF7P9pE4gOyPeX8RfFu7Cjpp1ZL55RPrETImo4aWbladVP9 SkMSPNolGF1SZ6mP2tdQA8vKcBMUcwYULgB23ySp2fmqDITk3/T2V3sBSaMRuxuLgk14 gZ7WVEqv0DLMIA4FvXFPOQUmueL83bZ79RfJ2DOzzIv0x9IId6yjNhe8HqZvX5P2b3nk hmJa0YtkAeBM5v2vs9rd2uXMNuN0igwSKWvirb4GNILF6uZ1/Z/xLKgHOxgTygdMUU3C 8OJh17iFkM+rJKfunyslct8TOw+UtemSKgp3598j4pOtIbv9rRyBXzLEtGATR2QQ/k/5 P6ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=IfwoyFdtk1HL272An+ZZFf4tw1MuwUh0qzNJytTxpkY=; b=lmO/LNcD032gOYe9lnria36g+0zxEtTqb3X8Q8sCYjFAKdDFZZX7ng1L2xjjOEuiOR r6c1jSOPW8Ta3ZQrQswfequsuYgEEYyqcHzzdqOSOsDXZ048Xb1iwmnFUTE/MQFx/HBg fYmsndm0TY23GY/3GAiPKIWT6aodGA/Vay8VVJkrWMhzAD+XqqnsSR73QeA+a7cFVJWV FYzwjqgfr3D9dPP/8XbGuyG25VWoQuRK4S0Y/4I1rlECj7F7bxGvOY2RxTmyJ3J+yrbV r2zU3ix/Q0ypDfrqB2NWw0mhIBRchy8Acx2ccKBn11auORccfccuxD8Lp9UfmztWRB3l snlw== 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 x20si5423459pfm.282.2019.03.21.20.09.27; Thu, 21 Mar 2019 20:09:41 -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 S1727701AbfCVDHW (ORCPT + 99 others); Thu, 21 Mar 2019 23:07:22 -0400 Received: from mxhk.zte.com.cn ([63.217.80.70]:39324 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727632AbfCVDHU (ORCPT ); Thu, 21 Mar 2019 23:07:20 -0400 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 1BB09FFA91ACC6101192; Fri, 22 Mar 2019 11:07:18 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x2M35nZB078076; Fri, 22 Mar 2019 11:05:49 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019032211062570-5922974 ; Fri, 22 Mar 2019 11:06:25 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Cc: wang.yi59@zte.com.cn, Wen Yang , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Nicholas Piggin , Mike Rapoport , Andrew Morton , Mahesh Salgaonkar , Haren Myneni , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 3/5] powerpc/powernv: fix possible object reference leak Date: Fri, 22 Mar 2019 11:05:53 +0800 Message-Id: <1553223955-7350-3-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1553223955-7350-1-git-send-email-wen.yang99@zte.com.cn> References: <1553223955-7350-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-03-22 11:06:25, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-22 11:05:34, Serialize complete at 2019-03-22 11:05:34 X-MAIL: mse01.zte.com.cn x2M35nZB078076 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The call to of_find_node_by_path returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/powerpc/platforms/powernv/opal.c:741:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 733, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Mike Rapoport Cc: Andrew Morton Cc: Mahesh Salgaonkar Cc: Haren Myneni Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org --- arch/powerpc/platforms/powernv/opal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 2b0eca1..d7736a5 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -738,6 +738,7 @@ static void opal_export_attrs(void) kobj = kobject_create_and_add("exports", opal_kobj); if (!kobj) { pr_warn("kobject_create_and_add() of exports failed\n"); + of_node_put(np); return; } -- 2.9.5