Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp274270img; Thu, 21 Mar 2019 20:08:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSxR9uwJYxkv7jljUyFy0gN7cUDaCKrTT2cs03E46VtisDVMgSskS/PcgVzmNkpt0A8VBc X-Received: by 2002:a17:902:7794:: with SMTP id o20mr7371866pll.28.1553224135949; Thu, 21 Mar 2019 20:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553224135; cv=none; d=google.com; s=arc-20160816; b=v1Ih2cFNe+rejGQrmE0l1hBYBA/R618rxW/CqTLFt6m1227jqiZTWsNDDmBWHoR4BY 9azI8wvzi6NsxK0CSRuyR8b+xOZRCVNHm6rGSdvDzvFoi6i5/I9WCyUcPokmYce/wInt 1UQLqc2VBG4WSN40r16WcO66VrxdFfKOF51sQFdWXUtVMaa+hGLicOkSYtSw23EyYO9O 35ZZ6F/Bz56KM709AoBqeX4qHcm+g7bZ1ywcS0Udb7HGE5SkrBGB6aQt3QpCmPoqyIRR KAg9dnJKnyPuPsA/ywCzdXnmvPTJwTYW0ztOdp4aLa36bBqrDNHpD0Pu4cpLkAreZfaI X0RA== 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=IPfQr/1sf+47LMJARe3GVHt7u0Um7FfJEUtTbJItg4c=; b=Lns7MB6eB8TzHTyG6nayL76wC8ld9nmRDVTPJe/cHz/RcMJh7t4/xhmaLyqxrTxK0a hwV71LsfKxz8RgoxzQZdMLoTVgLj/jqzYduogjnKD5LcaCQc+ssmYXOQ+429MKaIWG3e nr1mjwN8uAaXKdq6XwnXWcG+ppbZ6Evo01Uj+R9jJa+hRGEMXj+7iCVzn+ekoyXawov9 Q6IpqDfX2n9T5OzezLBf0aE0l3Zkq8C8SV3y0ZghKTVYWq3f5pwoCPiS9i0wZcThlydp MxQVN8BL7QW4r1jgZ/KhANMr0mopJy4wlypLvWC9ZzkLc0MCAy5I6yDoSS9yx24dLdtv JXbA== 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 p10si5555392pgb.222.2019.03.21.20.08.38; Thu, 21 Mar 2019 20:08:55 -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 S1727630AbfCVDF4 (ORCPT + 99 others); Thu, 21 Mar 2019 23:05:56 -0400 Received: from mxhk.zte.com.cn ([63.217.80.70]:37592 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727415AbfCVDF4 (ORCPT ); Thu, 21 Mar 2019 23:05:56 -0400 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id D719F5A81AB6C9609765; Fri, 22 Mar 2019 11:05:53 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x2M346W9071537; Fri, 22 Mar 2019 11:04:06 +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 2019032211044244-5922626 ; Fri, 22 Mar 2019 11:04:42 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Cc: wang.yi59@zte.com.cn, Wen Yang , Wingman Kwok , Murali Karicheri , "David S. Miller" , netdev@vger.kernel.org Subject: [PATCH 3/3] net: ethernet: ti: fix possible object reference leak Date: Fri, 22 Mar 2019 11:04:09 +0800 Message-Id: <1553223849-7143-3-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1553223849-7143-1-git-send-email-wen.yang99@zte.com.cn> References: <1553223849-7143-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:04:42, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-03-22 11:03:51, Serialize complete at 2019-03-22 11:03:51 X-MAIL: mse01.zte.com.cn x2M346W9071537 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The call to of_get_child_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./drivers/net/ethernet/ti/netcp_ethss.c:3661:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3654, but without a corresponding object release within this function. ./drivers/net/ethernet/ti/netcp_ethss.c:3665:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3654, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Wingman Kwok Cc: Murali Karicheri Cc: "David S. Miller" Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/net/ethernet/ti/netcp_ethss.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index 5174d31..0a920c5 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -3657,12 +3657,16 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev, ret = netcp_txpipe_init(&gbe_dev->tx_pipe, netcp_device, gbe_dev->dma_chan_name, gbe_dev->tx_queue_id); - if (ret) + if (ret) { + of_node_put(interfaces); return ret; + } ret = netcp_txpipe_open(&gbe_dev->tx_pipe); - if (ret) + if (ret) { + of_node_put(interfaces); return ret; + } /* Create network interfaces */ INIT_LIST_HEAD(&gbe_dev->gbe_intf_head); -- 2.9.5