Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2679791imj; Mon, 11 Feb 2019 06:56:40 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib5xkLY8jPprLUFDBYDFR9D1I+Chz0TLms4RLIZGbxuzW+WUtKwg1DLlN5tm4/V8bS638Mj X-Received: by 2002:a63:f412:: with SMTP id g18mr34050306pgi.262.1549897000778; Mon, 11 Feb 2019 06:56:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897000; cv=none; d=google.com; s=arc-20160816; b=fvLF34Z4a76rKh6lTHXyJn63Q+bxmydzUBJhWkLOEd8gntMYN6oRjSVEDpON27Z761 KvNDi3JHgtX5OHclUQj4Cx3Io4aVyPgKwbWad6WkxxAHR7G5p+OswEufdnDf1r4+upzs TvdwanGkrxu6Tzm3R2A0BebvgFbrJMD3uJ1ExNxCVJ+br1SlATwRYW5gEr5XMibKZniq yFfXZwAtkrPOZ5aqfau57HLr6jl+98IJY6qTiLkFeikFipkctymo3evjDPtfpWi3mWz8 umy8d+I5q+9U1Ngxmvi2DHPFmK+aksfFBpBr0OkN108jUK7U+8tSpQgPQ6KpJHzKjyQa aDkA== 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=vnzlKoXGfGWC/FDi3Zf682ElOHRLdAYlrOPHux3RqOE=; b=m9bcLoWiYFnIevBerAc6KGXUsbnx8OkQcXVnQNPE6ZHD1hsqcYK874Nc9yYPeigI3a mGy4geLEVMzjQCgvNpTHyMvbBLw88uZNsLs1PCcVlVgxAL3dM8BRqkP3rd7brkjuPYgl QvjIqHc5UCSlI6RBPG+JzaCdVaqwAdWebYo7DSn0vTpzHcU/1Uv3A2uOprZmYfqbTWyh CJNKm6rahfgu/LXJQPAy0mBTz8l2IvnbAj8vTouDfwYT+2AA9QvlNJsJMBZV2PnZhzyw olUyBFByn+ZP0SrtoYZh8GMdlJbXyTaCNhBRtBQWxM+J1yr/FWS3yhSfwI1J/KrGy8C2 YblQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TG8VDcIa; 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 g8si3545695plb.146.2019.02.11.06.56.24; Mon, 11 Feb 2019 06:56:40 -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=TG8VDcIa; 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 S2388968AbfBKOzZ (ORCPT + 99 others); Mon, 11 Feb 2019 09:55:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:42424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388957AbfBKOzX (ORCPT ); Mon, 11 Feb 2019 09:55:23 -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 7DB4820700; Mon, 11 Feb 2019 14:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896923; bh=bjofYlftpkxrbfio0nJsXjD9lBG5Mi9IwOKP7DEbywA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TG8VDcIayXpGGh9y46OdGdDclj7FSxFkJCstM3o6+XvrEBCsHmZ3W0sYAmNbQxOd6 A/kSCG0kjclkZZesvjJnA2XBlvL9hMYIdA8FQKrE5AHSd2h7QrtC0LJob/icKAg6gB yZ7EL99ZaI6NqaGc2jxVfQiTurmgcN0w0moYglpA= 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.14 033/205] media: mtk-vcodec: Release device nodes in mtk_vcodec_init_enc_pm() Date: Mon, 11 Feb 2019 15:17:11 +0100 Message-Id: <20190211141830.035140258@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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