Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6238302ybe; Tue, 17 Sep 2019 23:34:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhcAw9snAmyS+J1agjSyzFcajfL68chdXjdvboZj2bGsvOx093DHND7ks2Lnz2Oqr2MY6W X-Received: by 2002:a17:906:8287:: with SMTP id h7mr656202ejx.61.1568788479390; Tue, 17 Sep 2019 23:34:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568788479; cv=none; d=google.com; s=arc-20160816; b=KgpnV2APmJ5MaIKHHnqSn2XszVG1o3E/y7ejMQuBXbsBTjYqJPlVm/ZO3WonnWWeeI hI5CR3z5AWdIilnDjRnTWDsyxRpfLoiGKvB3+0/nCMdtwFdP0L5C6Gi9L5mWlZRGy00a 14l259qU5/Zd2Yay70uhMZ55ZhIPBYoc69N9kKUU8Ln7iAhMHYjnv253cyPm7OUoDAsy 52eZXSn5mR5S3DDGlgNUJOzEWTErBSbnWwrGvf2kg5q9HJBN0/Uu2z32BFUzKGxU1QyJ ofiLjPIYxmYcWpQjaE/PzSp7oLgIPcJiGo9M5QsL+faiqS/IkL63rsO7+FE8YlPe5PuF M/7g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ccQShBAVf0NXCgTwmu3UUyjag05ZbHsUMgv/RJZ4q2I=; b=BB+OzfPpNg/UUUh4I71E3RHYMDnr/PJgpLb0oIwwVaYptuOUKEVA4OgYU11cGfhudu xyD7YkTYpCdo+ml53IhSVbackqzsRA7R3L49S8VUEp4FcNDQf/agBU2r6XDBnF4YEpqs BCudRpAP01g5nLRG6+AXGo1hNJweTSTO4AngokYBewlbtWVMl0XC24SLJDRDbMIeCEY7 YmnouECh/SvKVG7SL9MYp/qCrYwEfeqA6CL5mdx3AeSK1h4XA6T7isLtujtaj7qww2hQ yX3XSb0MTZttQMyDnZYO6JBQYfrcio33ADiOi250GTi5Idf995nWdysSGnPIKebQdVYj tMiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zXdcSuCe; 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 16si2271292ejw.317.2019.09.17.23.34.16; Tue, 17 Sep 2019 23:34:39 -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=zXdcSuCe; 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 S1729642AbfIRGXb (ORCPT + 99 others); Wed, 18 Sep 2019 02:23:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:43698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729616AbfIRGX2 (ORCPT ); Wed, 18 Sep 2019 02:23:28 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A7F1421920; Wed, 18 Sep 2019 06:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568787808; bh=syF/NkzhqfS112J6XOsusEe1N3OzXqgGHojgwJ3CdSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zXdcSuCeLw40gsigEBvKbc6F2LgMvxbocLcxReUPSwlhJvLXE5SGYyiMH3QMnLTQm 1RWVVcaeC8puibihYQ05+D3WB1/BXNFs48h8zF30oMAKxnAFYrK6gWGVr5oDyBzzXY U1dcadwOqiX1YuThXIc7sk1KBrIXUDCQRyDByB0I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nishka Dasgupta , CK Hu Subject: [PATCH 4.19 42/50] drm/mediatek: mtk_drm_drv.c: Add of_node_put() before goto Date: Wed, 18 Sep 2019 08:19:25 +0200 Message-Id: <20190918061227.875064172@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190918061223.116178343@linuxfoundation.org> References: <20190918061223.116178343@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nishka Dasgupta commit 165d42c012be69900f0e2f8545626cb9e7d4a832 upstream. Each iteration of for_each_child_of_node puts the previous node, but in the case of a goto from the middle of the loop, there is no put, thus causing a memory leak. Hence add an of_node_put before the goto in two places. Issue found with Coccinelle. Fixes: 119f5173628a (drm/mediatek: Add DRM Driver for Mediatek SoC MT8173) Signed-off-by: Nishka Dasgupta Signed-off-by: CK Hu Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -566,12 +566,15 @@ static int mtk_drm_probe(struct platform comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL); if (!comp) { ret = -ENOMEM; + of_node_put(node); goto err_node; } ret = mtk_ddp_comp_init(dev, node, comp, comp_id, NULL); - if (ret) + if (ret) { + of_node_put(node); goto err_node; + } private->ddp_comp[comp_id] = comp; }