From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87ADD30DD1D; Mon, 13 Apr 2026 16:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776097365; cv=none; b=LR3c5lJYffQ8c94QgU8so5sFhPwgyYoajbfX3rVsAKwD/G2Qize46E/W1n0QYs3BM/oc7CbSIufhBSuNRzxgLaEy2KNaMDnOwAsdCajY6CeBZkkZbLei1EY2bnOPyV3pa02uBufrnhNNCadz1/tmF3MO32ZuEWWSPf6zxW+AJTY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776097365; c=relaxed/simple; bh=NiCkg0lm5EicZQ0spCRk/zdQb14QeUiVhxpL/fHNTzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s2J1rgJ8y2AF7nP4C62vZ+2TpQuQqOrPp9lxow650OnmXcx3Et1SCDLK2VI5zGeRTt4oBoLKuic9Vf/8VNBijs2vvuGqrzIF+TI/KRU77QjkymHP4NDSKSpoOkssb+vfMgjB9mLPlW967tgVgFQ2XZ/Zo+FISTRy0Vsp6DZVsFg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UzZOZfZb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UzZOZfZb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D1DAC2BCAF; Mon, 13 Apr 2026 16:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776097365; bh=NiCkg0lm5EicZQ0spCRk/zdQb14QeUiVhxpL/fHNTzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UzZOZfZblgFIExUEVXQocs09I2DsrSeUK1ykilpNLEmDLBB6w09oWom8owptQreYN 1PPxp+Cm6BxstoAYOQwhTWzHAxMB9Lze1nejZLY03iHCm/CwVRx8BTFCbwKCUdcp4Q gN+FC0L23ag24D9YWRuxx+vdQX0WmmBW1Njg5DwU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Cezary Rojewski , =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= , Mark Brown , Sasha Levin Subject: [PATCH 5.15 108/570] ASoC: core: Exit all links before removing their components Date: Mon, 13 Apr 2026 17:53:59 +0200 Message-ID: <20260413155834.488677929@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260413155830.386096114@linuxfoundation.org> References: <20260413155830.386096114@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Cezary Rojewski [ Upstream commit c7eb967d70446971413061effca3226578cb4dab ] Flows leading to link->init() and link->exit() are not symmetric. Currently the relevant part of card probe sequence goes as: for_each_card_rtds(card, rtd) for_each_rtd_components(rtd, i, component) component->probe() for_each_card_rtds(card, rtd) for_each_rtd_dais(rtd, i, dai) dai->probe() for_each_card_rtds(card, rtd) rtd->init() On the other side, equivalent remove sequence goes as: for_each_card_rtds(card, rtd) for_each_rtd_dais(rtd, i, dai) dai->remove() for_each_card_rtds(card, rtd) for_each_rtd_components(rtd, i, component) component->remove() for_each_card_rtds(card, rtd) rtd->exit() what can lead to errors as link->exit() may still operate on resources owned by its components despite the probability of them being freed during the component->remove(). This change modifies the remove sequence to: for_each_card_rtds(card, rtd) rtd->exit() for_each_card_rtds(card, rtd) for_each_rtd_dais(rtd, i, dai) dai->remove() for_each_card_rtds(card, rtd) for_each_rtd_components(rtd, i, component) component->remove() so code found in link->exit() is safe to touch any component stuff as component->remove() has not been called yet. Signed-off-by: Cezary Rojewski Reviewed-by: Amadeusz Sławiński Link: https://lore.kernel.org/r/20221027085840.1562698-1-cezary.rojewski@intel.com Signed-off-by: Mark Brown Stable-dep-of: 95bc5c225513 ("ASoC: soc-core: flush delayed work before removing DAIs and widgets") Signed-off-by: Sasha Levin --- sound/soc/soc-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a00b944be9977..286bdc33274ba 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -963,9 +963,6 @@ void snd_soc_remove_pcm_runtime(struct snd_soc_card *card, lockdep_assert_held(&client_mutex); - /* release machine specific resources */ - snd_soc_link_exit(rtd); - /* * Notify the machine driver for extra destruction */ @@ -1923,6 +1920,9 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card) snd_soc_dapm_shutdown(card); + /* release machine specific resources */ + for_each_card_rtds(card, rtd) + snd_soc_link_exit(rtd); /* remove and free each DAI */ soc_remove_link_dais(card); soc_remove_link_components(card); -- 2.51.0