Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp884814pxb; Wed, 6 Apr 2022 03:11:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5FFMDGhK6Gl12NMnZ3gBUO7oggsI4RDqMs6zEZFL5U27UolbV2CbBJxJq7IMJJ6Boe0Nd X-Received: by 2002:a17:902:7c08:b0:156:b9fe:b865 with SMTP id x8-20020a1709027c0800b00156b9feb865mr7547517pll.164.1649239910133; Wed, 06 Apr 2022 03:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649239910; cv=none; d=google.com; s=arc-20160816; b=fNNji7QuRjU8GUzp3DShtgEkxbMM6DlgwjJvu4tqQBFeyJI1trYxoT7gklXci8yReC T6uQIQQA459ELMKfsgYKwONZbblQeD+4S2EERYydn+cBGYfPcUX2tvab2mI2dts2DuCV tlkIl5rlT6eagOGwQ5jpReRlaQuZ3zvKdTIa13MPiyys3nQ7sTYanrGBSMWYba1ScNea ywNIjOi9eWP2MoOm1pXmpOxn6cLLQbvVjdMyK4EzxQqYE/2v+R6pAMURQg07ccTYnGfB IM7JPKbvSzGm1nBsfU/gIvxdJDzGUgCng//Lmt/xddhIS+n9ZxKBrObeWTbB+5IYn5Wa iuIg== 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=jwe3uCeJxxkNpIoWPsyUdw29uH5pNzPWwfnxaUYRkmk=; b=YekEsgx8mQ66KXvvAxj4UdyRyg6Q+k5jazRipgBz4nlyBw+OkDq0/QJ/Ct3QDNfr5R Jtxl3FNewejDUZJnv60PulS3JPyzrkh5DdGvmvhZTgFUju9BQjdb7A4FazZxhDb/wFHU KIbqfOiFjII3Ox+353hOuQiBTStrIw1BGFMrP9wt6LIzsqB0FVqv2mj9myBzIGag8LRe JYUnbPqNK4JjubxWR9tSO70qTBy+M+ecx/npkQSLo8HM3mdsYV4i4KqmtgrIA5ypwcqF 0DmldXSs6tu3qwifpWJU1DI9MXdUt583mN4KyUkOx+WtY02hy2Po8129CNUqCSPIuokC e26Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B2jBlvnk; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h10-20020a170902704a00b001544764a235si13940599plt.522.2022.04.06.03.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 03:11:50 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B2jBlvnk; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 679943598E6; Wed, 6 Apr 2022 01:37:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377554AbiDEMwe (ORCPT + 99 others); Tue, 5 Apr 2022 08:52:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243720AbiDEJJN (ORCPT ); Tue, 5 Apr 2022 05:09:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C853C9B4E; Tue, 5 Apr 2022 01:58:29 -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 54B16615E3; Tue, 5 Apr 2022 08:58:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D1B5C385A8; Tue, 5 Apr 2022 08:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149108; bh=u8PxMLCYo4rYp2EXONipyGluuU3I5q0QkRQTH2Ha+LM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B2jBlvnkG/OBhNQz3/mJXYIhDymcMlvhzRkGyL8Y4arWmSvkId2hZ4Nn03XJFcyOY tJiRZVoxu2QFMSkkf/20spx4AlfLH695XVls6a+MpbFCYie1E+2z5XvoEaHmJM0HJv YjFsoHw+bMU09yd2TqG54MegxGFktjM7iCTKOfDc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Jeff Johnson , Kalle Valo , Sasha Levin Subject: [PATCH 5.16 0590/1017] ath10k: Fix error handling in ath10k_setup_msa_resources Date: Tue, 5 Apr 2022 09:25:03 +0200 Message-Id: <20220405070411.792477692@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 9747a78d5f758a5284751a10aee13c30d02bd5f1 ] The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done. This function only calls of_node_put() in the regular path. And it will cause refcount leak in error path. Fixes: 727fec790ead ("ath10k: Setup the msa resources before qmi init") Signed-off-by: Miaoqian Lin Reviewed-by: Jeff Johnson Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220308070238.19295-1-linmq006@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/snoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index 9513ab696fff..f79dd9a71690 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -1556,11 +1556,11 @@ static int ath10k_setup_msa_resources(struct ath10k *ar, u32 msa_size) node = of_parse_phandle(dev->of_node, "memory-region", 0); if (node) { ret = of_address_to_resource(node, 0, &r); + of_node_put(node); if (ret) { dev_err(dev, "failed to resolve msa fixed region\n"); return ret; } - of_node_put(node); ar->msa.paddr = r.start; ar->msa.mem_size = resource_size(&r); -- 2.34.1