From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 BF89D4E01FB; Thu, 17 Sep 2026 15:36:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789659405; cv=none; b=ju/L9ejaz4NagC4AyCcdz7/QX8ShkYVqqsYjB1rDcJV8HT7n6ZTRamLnmqvcYIC+I46X19DilR6I8nh8Y4S12fMuNNS65+YqBVbbQWi9iv/qyYYcnGHUF37MwCRQ4H43llNAhZpb1eynk22A4hUw8J27T1VqiXT6D5Yu3UbD7sU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789659405; c=relaxed/simple; bh=3nKT5tKknRJC4F+CcpkeahiG6JOqfjguhADEUxI+7PA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qLSjSPVu7zXC+KifgU05KPoiBOzfs2wZ/REWU77NjdyhIXZa/i0fILqqsQMVGCYTe2WTsJBgJiZQnr1VwdF1qctIkeQJ0KX9gq2KglPrgFGhlAFyPrrsXquM3l7eddaN8jjpD2WctuJaXNi75Zz8K/qylPTukVa6DiVEYFRfssg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BUhaIqfs; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BUhaIqfs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 856AB1F0089A; Thu, 17 Sep 2026 15:36:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789659392; bh=8eph49TetxKJCjvjhyPZJ/bJ1FCmnm/NshPoRdr9to4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BUhaIqfsHomu3A9rncEE4a/L+rv1o/AYCaRufIihgEHpTa3fYQP39CS4IRzYZzfJC jl2VDnKDHCxgg3LCLEHFO8uYWY1DVZkrqF2YBHDbaVS8xQuyFT1cMMkB10/HnPAE/O 2eEa1XHTWaRFTdE0bRehJp7KgAyZTKd5vVHY9erk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= , Cezary Rojewski , Mark Brown , Sasha Levin Subject: [PATCH 7.2 240/733] ASoC: Intel: avs: Clean up streams if their initialization fails Date: Thu, 17 Sep 2026 16:09:08 +0100 Message-ID: <20260917151357.238809771@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151350.597953846@linuxfoundation.org> References: <20260917151350.597953846@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 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Cezary Rojewski [ Upstream commit f4ba00bb56a8511bafbd19826501d27157141c6d ] When streams are being initialized the memory allocation may fail. Have an error path and return early if that is the case. Fixes: 1affc44ea5dd ("ASoC: Intel: avs: PCI driver implementation") Co-developed-by: Amadeusz Sławiński Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski Link: https://patch.msgid.link/20260902081814.1590883-6-cezary.rojewski@intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/intel/avs/core.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c index a6b877f41e8b2..29e67c0502e8c 100644 --- a/sound/soc/intel/avs/core.c +++ b/sound/soc/intel/avs/core.c @@ -91,16 +91,28 @@ static int avs_hdac_bus_init_streams(struct hdac_bus *bus) { unsigned int cp_streams, pb_streams; unsigned int gcap; + int ret; gcap = snd_hdac_chip_readw(bus, GCAP); cp_streams = (gcap >> 8) & 0x0F; pb_streams = (gcap >> 12) & 0x0F; bus->num_streams = cp_streams + pb_streams; - snd_hdac_ext_stream_init_all(bus, 0, cp_streams, SNDRV_PCM_STREAM_CAPTURE); - snd_hdac_ext_stream_init_all(bus, cp_streams, pb_streams, SNDRV_PCM_STREAM_PLAYBACK); + ret = snd_hdac_ext_stream_init_all(bus, 0, cp_streams, SNDRV_PCM_STREAM_CAPTURE); + if (ret) + return ret; + ret = snd_hdac_ext_stream_init_all(bus, cp_streams, pb_streams, SNDRV_PCM_STREAM_PLAYBACK); + if (ret) + goto err; + + ret = snd_hdac_bus_alloc_stream_pages(bus); + if (ret) + goto err; - return snd_hdac_bus_alloc_stream_pages(bus); + return 0; +err: + snd_hdac_ext_stream_free_all(bus); + return ret; } static bool avs_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset) -- 2.53.0