Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3125098rwb; Mon, 15 Aug 2022 18:45:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR6wTHAyVpAnpM8S+oGUF5xVbYgrhOT7xPUAeljMxBabq0mLk0i66vDEd3/AJZJczHLJVF4s X-Received: by 2002:a63:e217:0:b0:41a:69b1:a68e with SMTP id q23-20020a63e217000000b0041a69b1a68emr15561020pgh.428.1660614315167; Mon, 15 Aug 2022 18:45:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660614315; cv=none; d=google.com; s=arc-20160816; b=G5gxKP1w0ttBNwQQQg7590MXu9QOWP6x0tK33GyqAeHaopArPwfFbfZZ+qDqINhTPZ Zf63nx19CqpAaMVtVsSUsmp7tHGgL6rmON19t0RZB2POH70dDZW5NSZF1zDxTMuI/RWg ocXvu7GJ09JaiJe6nEKgcYYDVHki7Gce9X8DSc3m3nsQ6wLvKqHZuhHz7b3bpkKagMIh ZdfYUqrScmrgr0GK2ul9IaZitciHWW4tUYCKwYqmzgSwsqwsB3Dy4grpg0dQbSsgnWCz d69tk6PWvaVijlsQuNSQ3cbi8H+jagzXjpXfJaNrCXd/woUzu+f4JIAsWqfMZWo8vZrQ ze0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e3z0R3qE2wmiNOA9vE4mTG+/N4ra0cTF3jj1CVjQwpI=; b=JrmdOoolCMbvBwMdskwhHwzuU4MJLYN6Kinzy6+2gxMsoWDGDyx0OzLJVILB/I5XSU 02Dd24NP+uEWfe+8Q9D+ee7u1Bq1eKXMjSvSeJgJvMCeqP5Pp1hp+4NcHqgIpwnfnxJy AYUie8DyDf86b78dhdSsKhDjFUVSudfbPYWMA9dfGpxUCM3l+mgsnyi6rNZimp2Znu5q L0gZWQd92GBUXqo+hs9+XL+NPhDjKRtBdevzZsxB8i4nk6GgkQQrkSii6IMxnopoKXio XREPfsukNi+lPlL4qIpf3x4iBdFfRuHQV9zL3tuL0N33D5pFcjHL+LYJtNfQvIL8Guwk dfHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xOm5Tyl9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a170903228300b001708e1bb3b8si13234874plh.335.2022.08.15.18.45.04; Mon, 15 Aug 2022 18:45:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xOm5Tyl9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244783AbiHPAkL (ORCPT + 99 others); Mon, 15 Aug 2022 20:40:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231926AbiHPAjK (ORCPT ); Mon, 15 Aug 2022 20:39:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1391B18C448; Mon, 15 Aug 2022 13:38:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 24DB5B8113E; Mon, 15 Aug 2022 20:38:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 807F2C433C1; Mon, 15 Aug 2022 20:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595903; bh=ghjEO81YxhS+YcEx3ZVuMYMBB8QFw8LKdN+f42pXj9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xOm5Tyl9qET/C+AZL93JMO8fx1j9a4EjvWQIPXVCn5Pr1S7ySQsQnGOsDnrWFsHy4 c8hvKk4sXBg7Xfpa4Fv/UT80dczEcG6UwJs9pk73IbDe22jln9TNiGQde0TDY58a2D JEHJa2rrt2k0MQdRU5wcdUHxCBDmotRoktoPtg6s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.19 0912/1157] remoteproc: imx_rproc: Fix refcount leak in imx_rproc_addr_init Date: Mon, 15 Aug 2022 20:04:28 +0200 Message-Id: <20220815180515.940303460@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaoqian Lin [ Upstream commit 61afafe8b938bc74841cf4b1a73dd08b9d287c5a ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not needed anymore. This function has two paths missing of_node_put(). Fixes: 6e962bfe56b9 ("remoteproc: imx_rproc: add missing of_node_put") Fixes: a0ff4aa6f010 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220512045558.7142-1-linmq006@gmail.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin --- drivers/remoteproc/imx_rproc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 4a3352821b1d..38383e7de3c1 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -594,16 +594,17 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, node = of_parse_phandle(np, "memory-region", a); /* Not map vdevbuffer, vdevring region */ - if (!strncmp(node->name, "vdev", strlen("vdev"))) + if (!strncmp(node->name, "vdev", strlen("vdev"))) { + of_node_put(node); continue; + } err = of_address_to_resource(node, 0, &res); + of_node_put(node); if (err) { dev_err(dev, "unable to resolve memory region\n"); return err; } - of_node_put(node); - if (b >= IMX_RPROC_MEM_MAX) break; -- 2.35.1