Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2874083rwb; Mon, 15 Aug 2022 13:04:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR5q9AxKKLuZ6g9aZD3bM8LuRhV7jG9i03/pfudAnd7E+9OtAXJ3UG6jdEs6abMdWwrz3N1J X-Received: by 2002:aa7:c946:0:b0:43d:3038:1381 with SMTP id h6-20020aa7c946000000b0043d30381381mr16196972edt.354.1660593884781; Mon, 15 Aug 2022 13:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660593884; cv=none; d=google.com; s=arc-20160816; b=lZltDY4IFYqn3vD37z07rc3M8tYLGgM5I0M99NkzQgXZ6ADoNVPJjNzZt3jFQ5reqx sC7gNxmaSrOzzPRGEAsUwYbvJGXJi7Bnf2+vF8n0KjSxjpcLcOVv0+wC/ANDm/7V/zvw uAvqVj+kYAfo5jNyYJOXUNqWVOhc6ylZyfrSRCGqd6RBpReJSO18zk2q2RqVnKX7qvZK P4xz9MxyESTcF34mQrMTgpmTaX95HBH2MOJRFP0i3ipGVBsJdN2FrdLocedqhFslghmo vuBb24dHY+CkqU50ojA/tVeqKKEDXK1ejIxQg6Dq4VfxlCrrN0G6rfi2Q/OfW8Jtzibe zjmw== 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=PXFMiAVgui8j77DpTsX+wlWyCz1dk9TkrAtwxmBbAe0=; b=0SATxOVDjFUYff+uQEIdD42En53p9sIhDeU00Kp9QyVbRkGifLwEfKfo7X7Cg3Hib4 TLm2O2rspGYq7gx0MgHROM/t0xUgb+divJeNa94oBWbw50Fa4AAvaMy7+dj71brkz798 5MQgvEOvgYKBVNRyW32bTNRHIldm9tFUUaALOhF1+O/pZ3TCyKeMME5Lj1oQac2fzZuj FBqs3ypvyTInSjeZST/TonssgMbbP5mtC8MYxQbuDw2wIv5AG05EjdgEf59xlJmYstWc mS0a8Ez+MIqtNUiYrh0bf90QEWVIiMnjihsryhHrD4jmXatFEZDUn+0FZEe0qIYFP+ZW sFng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eMAFsiCm; 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 he32-20020a1709073da000b007314b427e96si9695349ejc.633.2022.08.15.13.04.19; Mon, 15 Aug 2022 13:04:44 -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=eMAFsiCm; 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 S244802AbiHOTcq (ORCPT + 99 others); Mon, 15 Aug 2022 15:32:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344864AbiHOT1V (ORCPT ); Mon, 15 Aug 2022 15:27:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BAB95B06E; Mon, 15 Aug 2022 11:43:12 -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 05EB5B8105D; Mon, 15 Aug 2022 18:43:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46F1FC433D7; Mon, 15 Aug 2022 18:43:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588989; bh=nUtCaeffMCvmWQbyHKlf7NyVMga44HMxbZ1Rwk1aclw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eMAFsiCmDTmwgD1QEmCokH18MJuv4tURi1BfJBaxGDpBh23eQ2nuH8Wl6+XC+vE71 pJuGlFRFUxwi3N6yhkujzbdkljweHA0nc2hq1Y0Kq8N/IwLj+lokcJhJjCDcOt6fSj +vTNtyuJ3DVAkdAJ2+x6WpHcPZntBQRIyqbOVBsA= 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.15 578/779] remoteproc: imx_rproc: Fix refcount leak in imx_rproc_addr_init Date: Mon, 15 Aug 2022 20:03:42 +0200 Message-Id: <20220815180402.041792259@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 59eae605ad59..e8a170ad43c1 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -586,16 +586,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