Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2648943imj; Mon, 11 Feb 2019 06:27:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IbaWK6TYAEd+KspFUFKPrbsSxfooAUC4MHCmpyIWc0aQKsF8bKQ3jUjbCrbbcJzebiOTSDZ X-Received: by 2002:a63:554b:: with SMTP id f11mr18931176pgm.37.1549895241112; Mon, 11 Feb 2019 06:27:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895241; cv=none; d=google.com; s=arc-20160816; b=pxm0MOv2CaPgZJfmhaSKzXrAT1MAQAvNuZ4IervTVcrpVtp/ExCYiDosJCIkWdiRjP 7y2+V7b4Wo6FYvPEUXmONu7MBQC9XHsdnLAxXHIbYtxcGw7104o//VE1deSGpR6YxUtZ z/64yQ6BG0hIIEnA6wX4E5eXedfLy1ZaC4WQLHOCq1WmqcJSUc5GNn2iCn5JVHweCtE3 ph7vVUQp3/IaJehoNNIuaAlt7DmBQhbX1lA9f4YTZc+8jyDu4qYLAU7tHGU9w6VZqqdG g0i21xJA3n6a4fpuciH+tKrPUCU/AacvNG8als+pa3EascbwHepkYsC/4bWhGKr24iJq Y7pw== 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=MnSFkyG8fJXxr4Acb/goL0Tp0N3zafoGbNYNaRltZPA=; b=Jce+91hkJsodF1kyxjQnZ0t1orVwe0cpFxty9MvwJ0/QLs9gWXdmdcyDZ3k8UsMZt9 JXkboRyH0/95B8v/2U60eSJuBAXmcOng3qPf5Gc6hFDe42IT9Hiv0w9ENEHnge82tvne suE7F7zr7wuN8I8h1SOm4vGZ1phFvWQ7U/OCjkw5z4f7U/2kPsMGggqTY/V32Oj9jc9N vS21q5EUazPBqd2bBnO92hjRptLAguB5ao+c5LJP+Xws1/abdF5fFx7kk6QC5fkSqOQn xGEoKvoIjMhMna9vkcZ81gTkfjOAagIh8LrJVqqZc7Wx/Irhym+WCl/iaSLnz4NpPd9Y vXdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="M40A/5tU"; 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 t27si9604103pga.3.2019.02.11.06.27.05; Mon, 11 Feb 2019 06:27:21 -0800 (PST) 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="M40A/5tU"; 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 S1728991AbfBKOXZ (ORCPT + 99 others); Mon, 11 Feb 2019 09:23:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:56384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbfBKOXW (ORCPT ); Mon, 11 Feb 2019 09:23:22 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 720B8222A1; Mon, 11 Feb 2019 14:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895001; bh=rXhsxc6fyXU1MtFiHX81q6sMdDVNOF9BYNThxgYJ++M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M40A/5tUVICLC6ybCnh4uxuWN8wDnKZuwVKDQajw3b7mh3+u1qMgi9GPvCOHFYPKO K4XIUPvFmu79QlLJ033uZ2vfM0URAsodHb2tbH7Eh9uJASvDADFLMpYZL6v2d6hRq5 pHvAzs+NTZCf5QCIO9jun+gBjUcBXz5Pq2pciHVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Khoroshilov , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.20 059/352] media: mtk-vcodec: Release device nodes in mtk_vcodec_init_enc_pm() Date: Mon, 11 Feb 2019 15:14:46 +0100 Message-Id: <20190211141849.897615482@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 8ea0f2ba0fa3f91ea1b8d823a54b042026ada6b3 ] of_parse_phandle() returns the device node with refcount incremented. There are two nodes that are used temporary in mtk_vcodec_init_enc_pm(), but their refcounts are not decremented. The patch adds one of_node_put() and fixes returning error codes. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c index 3e73e9db781f..7c025045ea90 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c @@ -41,25 +41,27 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) node = of_parse_phandle(dev->of_node, "mediatek,larb", 0); if (!node) { mtk_v4l2_err("no mediatek,larb found"); - return -1; + return -ENODEV; } pdev = of_find_device_by_node(node); + of_node_put(node); if (!pdev) { mtk_v4l2_err("no mediatek,larb device found"); - return -1; + return -ENODEV; } pm->larbvenc = &pdev->dev; node = of_parse_phandle(dev->of_node, "mediatek,larb", 1); if (!node) { mtk_v4l2_err("no mediatek,larb found"); - return -1; + return -ENODEV; } pdev = of_find_device_by_node(node); + of_node_put(node); if (!pdev) { mtk_v4l2_err("no mediatek,larb device found"); - return -1; + return -ENODEV; } pm->larbvenclt = &pdev->dev; -- 2.19.1