Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2838868rwb; Mon, 15 Aug 2022 12:20:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR71AhJNcm9ql80PLHDvSHusl9B9J6wQ9z3JgV6QmoFMeDBD7dnQNTtiQduFNLfpL+hJqlqh X-Received: by 2002:a05:6402:2386:b0:43d:a74:cd44 with SMTP id j6-20020a056402238600b0043d0a74cd44mr15288073eda.280.1660591248397; Mon, 15 Aug 2022 12:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660591248; cv=none; d=google.com; s=arc-20160816; b=HDd9mG5H35gAwvNmlu6swhemo0+ojOEO5iw8vReBpnSVsx31ymEFwy8xMZCm3V+jP/ F/yiJFO6h6ccGmy8J6RD0iFttJ0G15UsJwSzra7Z8xMx112P8gmjIUxNgc/KsGa0yhcH 7fAvJ94wSkv+Y9F4H7QuZAn+IF1kwhjMoP68boBKMSQd9iSCddGY8rwH5Yllx/ujPY/Q 8iHqm4GWnDmwvVXyEV3spxGaYDii5muoU20IYztDFBVDyD12BgA99tDDuvibrXT35STk zE9RCGCmcuyWa4P2U1ipd+/tC9BnNQOFFilZ0E3bRkwO27Qs3EZQaFeBMrX113c3SEsZ kQHg== 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=sGkb/m4nYagzew5JTrt7BNWBhqyy/4AgloBfqd5uAPw=; b=ruC+SQuJfqDxILXXEEc6V7RtO03IJMZXdYNnfBSCP69xokcz8DafC1QYRP3hTkk+56 uwF39O98dgJlvMDj+ZWoocwhLjIBY9wnbBJwWa/Wvftbccf2QRzS+hR4Omm+xOebEaji cqYnvbh4RV1yJwdU63SFEokv6MsglmgIw04uQmPX9dLcEhZU5ptUsO8QacwQPS4Ow+Ff OnHW55IdtIdG5ZsGJ4N+ndRex7SXg5dtOAV1Kf/E6wLtD0JdwXc+4XUoZKVvuIv5gRlY V961Jui4nG7Ec7JZ3QkrAZ1M/jDsemIu6i6Q870cenib3Iz5VSAK+Rj1qUo7XG/Aejtf fJjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K+8nLpS3; 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 cr20-20020a170906d55400b0072f0f088ed7si5106619ejc.712.2022.08.15.12.20.21; Mon, 15 Aug 2022 12:20:48 -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=K+8nLpS3; 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 S244082AbiHOTSx (ORCPT + 99 others); Mon, 15 Aug 2022 15:18:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344307AbiHOTQU (ORCPT ); Mon, 15 Aug 2022 15:16:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A54752FD5; Mon, 15 Aug 2022 11:38:07 -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 dfw.source.kernel.org (Postfix) with ESMTPS id B972161143; Mon, 15 Aug 2022 18:38:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBFC6C433D6; Mon, 15 Aug 2022 18:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588685; bh=drjjw1OcmSZKyXWnDea21kgHQ4W665P0NdF114hFKv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+8nLpS3NJEymhs4GQb7goDIIG1z7kYnGfMSVwqNoGKLC52L3Mrdz65TzM/WqUXdZ 9/avVJUHR080yk3ZdLQErnOx2bMCT0QmKSO3SqpJdkv18CY+J+pzZ5Bl3nnzt/nI4T riPracJA9cfjLv5JYif2JIS/u6LZi0HHWTBTFx78= 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.15 482/779] of: device: Fix missing of_node_put() in of_dma_set_restricted_buffer Date: Mon, 15 Aug 2022 20:02:06 +0200 Message-Id: <20220815180357.856053649@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: 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 b0800c260f64..45335fe523f7 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