Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2525383rwb; Mon, 3 Oct 2022 01:57:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM400Gjh9uiuK4WHoBND0kqEHZPkijlwW4pP/wxIL/7H9PXkbTX6RRuVrILZUqTPob5lhfuk X-Received: by 2002:a17:90a:c7d3:b0:20a:68a1:85cb with SMTP id gf19-20020a17090ac7d300b0020a68a185cbmr11211017pjb.138.1664787468680; Mon, 03 Oct 2022 01:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664787468; cv=none; d=google.com; s=arc-20160816; b=q8hAm4pzZPpS5XM4/fXslXzYhcZTyJybMUBjTsf2019OIUFmJN3Pfi5j0JtaTRuEPd HgZN+qOXpnohM8h1kCIZNC0pBMmc9JGRp3rx9KCECcZU427YpAxqYQJUmvO+bFVQccqu YdE4atG60NND+c3DdttSdgR4/qXMM0MtXYNAFKxCAQiBT6HZc+3gqZ3rdmTM3iJ292qs fPIoIHrrWkxSvKzqm6E1Ytts5/gtDGW60+nvXoFBeyylxeYNBs6DFSviE7Db0BoSO4O9 npwB9DJwullomp/I4cdbdKV+6R1zwqc70tNVEuPib/nRR6eNedRvmmmCA8tq9hfdqzPC I5Cw== 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=jOx0TC3MYQR6Q8evMU4p8rDcncH+oh/HWk6ysTjfYAM=; b=ba+GG6HPfQ247qJhAULZRAKwXwc+h2vHhltvAcG7Jn99+4HEF+e6021Z7An5tLFYya WAYkvZdwCBqZBwwqMMIJIlee0OxLiJ9e4wZwaSgwQ6OqH93j73WjZE0Gf4hUF7cFZCim wxmdGk3P5NIUfnzQp7kn7/V+CZqBgjP8ADQATtW0GAgzynOwJIZOmjPCxY6cK8Qxtgl2 kxV6HlsjnEfN1q23lhzklaC/Nc5q9g6iSzYs+FDhDuT6G/RjmPpRPiZfomLFyjVs9YT1 AZMCD/HWFau3cg5sIX7d/9kwhGtvmjeZ6sA4/0xwe7cu4gKkkONNdAjwvHtQzXwZm48m gHYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hIvuVArn; 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 j14-20020aa783ce000000b00536c7c210d3si9137253pfn.171.2022.10.03.01.57.36; Mon, 03 Oct 2022 01:57: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=hIvuVArn; 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 S230506AbiJCHbz (ORCPT + 99 others); Mon, 3 Oct 2022 03:31:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231279AbiJCHau (ORCPT ); Mon, 3 Oct 2022 03:30:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86F5B1FCFF; Mon, 3 Oct 2022 00:20:14 -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 E605E60FA4; Mon, 3 Oct 2022 07:18:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0555BC433C1; Mon, 3 Oct 2022 07:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781513; bh=bzT6vyxwK9l/S/M9haD835cIwl5EwhBCeG4yOlarAWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hIvuVArnBGtYhRlBdb8PaLOkGbV6C7VU3UKCtkuR/kIxMBN9pAFio/52Pdh+OUJQu QcyQrlmBfoGTX6ldiQWFM+FqUOWLfhecKlDwFgtu03drspX9b9tFUWNhArFbMnEb/s st31KjQMIKMmQAcw7bqH8nOTzc4ErqapPr7t1H7Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.15 47/83] ASoC: imx-card: Fix refcount issue with of_node_put Date: Mon, 3 Oct 2022 09:11:12 +0200 Message-Id: <20221003070723.175841129@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@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 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: Shengjiu Wang [ Upstream commit d56ba9a04d7548d4149c46ec86a0e3cc41a70f4a ] imx_card_parse_of will search all the node with loop, if there is defer probe happen in the middle of loop, the previous released codec node will be released twice, then cause refcount issue. Here assign NULL to pointer of released nodes to fix the issue. Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1663059601-29259-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/fsl/imx-card.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index 593d69b96523..d59f5efbf7ed 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -698,6 +698,10 @@ static int imx_card_parse_of(struct imx_card_data *data) of_node_put(cpu); of_node_put(codec); of_node_put(platform); + + cpu = NULL; + codec = NULL; + platform = NULL; } return 0; -- 2.35.1