Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3094959rwb; Mon, 15 Aug 2022 18:00:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR7QmNiTSdLJu3Cnkeli5M8LoEEOlBNJTUjKnX797s2wNztLLN7xwlI4CtcI1/FuSyboc0/0 X-Received: by 2002:a05:6402:11cd:b0:43d:7862:7c25 with SMTP id j13-20020a05640211cd00b0043d78627c25mr16955379edw.96.1660611633102; Mon, 15 Aug 2022 18:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611633; cv=none; d=google.com; s=arc-20160816; b=EfMVUgES837RkZKMRqnhqk5faBGXmu1yk4zDphPF5Si61zI0T++0W6WnJ1ArrQLZCT 5F022QZ0poJR3ZbztCMP3g3+2qZZYrJURByqFBNtm9JeHBMjakpc9HK914gmlgnY6YX+ 2DbY3XU/p78cGPZhHpeyKmxrNGHxvozdZETLECAqxwmf4c09KKPYND8HIMKfaonB1IoV ADekKwqgIVxoJws9MiafNX2Lxq0PGM6qw3Ker7mXf0xJSHHbaCNtK7fyINyrxNomtzEY 1FAqm3GfDfCzxxBZTnyBLMsVTWzd8dv7zM3x6iaqqNIUcwWKGAYKO33urj9HSYrZ/YTn QF2Q== 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=z0a/jZlJOmvkz8w4sVINIaps/HtwdrHGsPqTuzYDJn8L+ZxAh/K2gF+J1lwGZVN/pT 96Do6JCyflk+1L/2Ljdqlx5Bdxth2R5wjC5XRZyvCuii7N/cvkQaBycg5ccHnlN+uUDZ gZEnkC/wLNAejHrP98nCoWMfsdSIweXOdN11JV6lDGy+q+o+8TQ+6aAxWEYJeM21pGW2 i8mszQdQikV3WsKUdZ5qDw8Z30ogYuZ8r4KV9gwSsVDj2GjUcMRa4T6JP3X+860Y0O6x D2NfjLl0hlGsw1MIzJA9DMUVGfs1no3+0JzKFngUy6u9c/ywPdlrltRjGeQ1wLNp15rT bL5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yZZzifyb; 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 u8-20020a50eac8000000b0043e6a16bca1si8449217edp.475.2022.08.15.18.00.07; Mon, 15 Aug 2022 18:00:33 -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=yZZzifyb; 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 S1352375AbiHPA3Q (ORCPT + 99 others); Mon, 15 Aug 2022 20:29:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357561AbiHPA1Q (ORCPT ); Mon, 15 Aug 2022 20:27:16 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2B91180B5E; Mon, 15 Aug 2022 13:34:54 -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 sin.source.kernel.org (Postfix) with ESMTPS id DC698CE12C4; Mon, 15 Aug 2022 20:34:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E924BC433C1; Mon, 15 Aug 2022 20:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595653; bh=4Qx3TpTzRNC8GP0eSyB6JcW988m841SDnRGg73iCp10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yZZzifybzRxrYJ8U1l+2ZlthsMs9DYo6osGP/rYBubxxKT4rNIbSRaBghrEkGHiFA 0Dg4NTaSR32DmRtfCwD7IqcwXfdHJ8xngF44WboA4p2gTbZszP7/aJTdQYXhawhdIU sMvDAI79eRRMKs86H71ei2VY1JRdrHOTojCRtgJo= 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.19 0800/1157] of: device: Fix missing of_node_put() in of_dma_set_restricted_buffer Date: Mon, 15 Aug 2022 20:02:36 +0200 Message-Id: <20220815180511.486332585@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: 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