Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3088528rwb; Mon, 15 Aug 2022 17:50:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR6rk5y8PHse+PSjvoCUv5wXgimP8gGy9cYLxT0io6tsPd6mpgeGZhZD2dLUK1zGZtvYT36y X-Received: by 2002:aa7:c2c5:0:b0:443:9d64:58a0 with SMTP id m5-20020aa7c2c5000000b004439d6458a0mr8117584edp.112.1660611055164; Mon, 15 Aug 2022 17:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611055; cv=none; d=google.com; s=arc-20160816; b=KtTzrLlxCMqCeLmClr1/g0aawWc9XCs3aHmREuZT/9ATIHdfIP7rPSEkrN6rPbh4ff +FblGhsvSnkePeXX14cjrmRTfcfb+O+KemFw8V8HwrhnYtFqTEHzr8GMSZE0y5e+oXsV QOeV+a1ouxZUzJPxv+JISwuNZ6ugePt+QHsAjqwppdUyn++AyRR9ybniJQHAtVMOU7Fi 9B784qRUKDa7P/4e7/HBZ6EEzIx9cnuxXpacdeG3HGvYUrB7RzGwHyYAII0JvKM/tC97 WCcuadJkEcVTRO8CIo1ZHvZ5qSh8IFd1Q6hRg8g3XWDCjmNqc4qGvlFx19rbjpr7+nuZ BrsA== 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=aJXGN8zYHGmp5y6gh2GiANJhIHRuTN4E3AhPVrverh8=; b=l2Cns5KQWvYQnxgXtpVEe8B4lqrL3fkI36uRrpZM+i0m8FOUpGaxdJVxvQlEIH97Up SkuiigPqJhJbtAfxnV89Xo3vHYSpvNFBlSlkb5YkOlnRhpo2cdWqgamdnmHGSC8uesuB FCxxK+T0akUhSicDAlYDzVhuAT9L340SK+kBIjXtxJYs9xSzpHWD+OwyzH6zfYzYMHvL Wf5kvP56WJLB0O+z3PamHWysYCuQwEYbmUTB1wcZoXkoABhymna67MdOib1sbyed13gR NTzBGTTMf9aWvtl90YpPqwjm6vfLuj2UPK4+uJk42Pwaxd3AVLe/I0sUNQ1tLg7dfffB Uo1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kiU9NHuQ; 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 hb20-20020a170907161400b0071200866b78si10781518ejc.689.2022.08.15.17.50.29; Mon, 15 Aug 2022 17:50:55 -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=kiU9NHuQ; 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 S241729AbiHOWGn (ORCPT + 99 others); Mon, 15 Aug 2022 18:06:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350354AbiHOWCD (ORCPT ); Mon, 15 Aug 2022 18:02:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36A51E8E; Mon, 15 Aug 2022 12:36:23 -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 D9D42B80EA9; Mon, 15 Aug 2022 19:36:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42DB3C433D6; Mon, 15 Aug 2022 19:36:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592180; bh=4Qx3TpTzRNC8GP0eSyB6JcW988m841SDnRGg73iCp10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kiU9NHuQksr8P+RI1nVwhwWdnU1WPcW0p5uc4rbaITaMaz1FEW+Lq0q9MfPBVHrzo sk1irWzpVUFcgWRbAzh25nCkqXkErZ77gVicmG2kqiG7kQcJ0OuxsPr+Tn7fxMHbbW kGjHgCHez94YcVttJxtKggsNtCNY5iCZX+mHKf/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Rob Herring , Sasha Levin , Miaoqian Lin Subject: [PATCH 5.18 0746/1095] of: device: Fix missing of_node_put() in of_dma_set_restricted_buffer Date: Mon, 15 Aug 2022 20:02:25 +0200 Message-Id: <20220815180500.216731535@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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: Liang He [ Upstream commit d17e37c41b7ed38459957a5d2968ba61516fd5c2 ] We should use of_node_put() for the reference 'node' returned by of_parse_phandle() which will increase the refcount. Fixes: fec9b625095f ("of: Add plumbing for restricted DMA pool") Co-authored-by: Miaoqian Lin Signed-off-by: Liang He Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20220702014449.263772-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/of/device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index 874f031442dc..75b6cbffa755 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -81,8 +81,11 @@ of_dma_set_restricted_buffer(struct device *dev, struct device_node *np) * restricted-dma-pool region is allowed. */ if (of_device_is_compatible(node, "restricted-dma-pool") && - of_device_is_available(node)) + of_device_is_available(node)) { + of_node_put(node); break; + } + of_node_put(node); } /* -- 2.35.1