Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2797189yba; Mon, 22 Apr 2019 13:09:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTKqyFA3SugxtHueQZ6cJwgaVhJsOeuelriuB+4Vu4lpsmeDHkoymtHNCBkV25vYFVFzSj X-Received: by 2002:a63:224b:: with SMTP id t11mr4042283pgm.161.1555963795343; Mon, 22 Apr 2019 13:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555963795; cv=none; d=google.com; s=arc-20160816; b=KwCCwI8jSJxnlwSQje8naHesCgi25sbgGajAu3Mpqi98GFrlJRIsPYkM6o6eKaKjrr 7QmRq7KkrvuADOJf6hitkdqkMAuaiTqj4abtT58DRX9UVgmam1yjF9dXXrYY9m/2hVoj IdFjNMgkYCA/LYq5g4uy9m7H6ya2k2WsCCohaJ+1Pvu60WncJSCjDJ5OURXJpKC7WolO ayYC+YDPUDTGiNRrSdr65vTJEYiSR4zYycTHuzA5H9tVPY6KMNWrsBFcXrMFErGbwd8G 8BFJBhOCG1hg1mhFGxtUqUr7sUtHEfnYQ7fLAYfhcSIL/skEIRuswfo6GHeH6lB+VKPE pmgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ydf1pG1d/w484dH1rmNe12DPV/in3DWW2yX40ad0bdw=; b=cOP0dL4CHTW5sTdFubVZ/ktLQ93PJM4CMp8g1jX26Tvpf6Q9c9lfb7kml6ChLSgFYP t/h4INHoU0cLz24mcveSfVQAJJeFLrm2EJHdGwn3ARCB5foRyQKi7rZELH7rJKZvC7jS Xh2/CwTfW4xMx7UYiS3Y3dOOk9HvcqM5r2eaTQdyynjl5SbFyUjimXbiRqjIUrbhkbIE D/sF3l9TQehJ+FbowGdQdJLpbu892h28BLOJ1PrW8rOvp6Jk7e8rE/aNjyIp5sHGDEdU fjYpG+j3UOmOKWhyQ+WJngF09HlvxtkxLSGUYHrp+t6jyYgDFx95t7huF2JO9WjllYNJ MOBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GxI6D+Dc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c17si14171719pls.23.2019.04.22.13.09.39; Mon, 22 Apr 2019 13:09: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; dkim=pass header.i=@kernel.org header.s=default header.b=GxI6D+Dc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732447AbfDVUIa (ORCPT + 99 others); Mon, 22 Apr 2019 16:08:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:44602 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729289AbfDVTnx (ORCPT ); Mon, 22 Apr 2019 15:43:53 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 339F4218B0; Mon, 22 Apr 2019 19:43:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962233; bh=yK4vAa+m2IRRV23BfQirRkIQ8E74H/kqOpyG8IAntcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GxI6D+DclZEbGod9P0urm4PEoMN4JrTJy6NWUzOlStDEPE/PkRbduEQ/Q0iGp2t1A Bdz65ePVJaUo35IOfglwmCqqVyNKgGbl4fhYNsL89FXs1WFgDaBc9AoJmCJNh12Gx5 PXeMfM/JFmGUNijGK5paITCevGi9a7I05FIIrepw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wen Yang , Wingman Kwok , Murali Karicheri , "David S. Miller" , netdev@vger.kernel.org, Sasha Levin Subject: [PATCH AUTOSEL 5.0 53/98] net: ethernet: ti: fix possible object reference leak Date: Mon, 22 Apr 2019 15:41:20 -0400 Message-Id: <20190422194205.10404-53-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194205.10404-1-sashal@kernel.org> References: <20190422194205.10404-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wen Yang [ Upstream commit 75eac7b5f68b0a0671e795ac636457ee27cc11d8 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin (Microsoft) --- 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 5174d318901e..0a920c5936b2 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.19.1