From nobody Fri Oct 23 03:30:46 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 C1785568FB3; Thu, 15 Oct 2026 18:55:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792090540; cv=none; b=TMFaaDyuYJnvb1YsImwy6Q85sfVrIcUr8w2jiXeXEvAJLOaRmPIR7BQs8kS6mEZOXf5QTCfNMy8G5TXHd2RxQEZdYnyWGOH9e4tUNAJlPP7yOmtNECe3k7npZT6tqhp0PytSU8rCxr44Z7/WOjVOd17iM/z1uzh0RLDb6d9W6FU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792090540; c=relaxed/simple; bh=cbmGhbtKpv1gaoLM5Ui024oSq91uMa/GRcRggwQYUtk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nQXFy5Gw+Efu+X5GdSV51x42RSLdv0Gg/AD19TNayH+otqXCXnubhdy1PmQG+ypeD9Vt2XubNKyY+4PlVhXy1SYHjt/KUOEdnNCkrAIlcswUyHPf6SAsvO/D9opSfolVN6C+RAUX7OEYFNXfc5zlHWEMtVvGwJJgF0d9luSzvag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=frSvwZ73; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="frSvwZ73" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1792090538; x=1823626538; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cbmGhbtKpv1gaoLM5Ui024oSq91uMa/GRcRggwQYUtk=; b=frSvwZ73Q16n0wvD/Fr4IdRiA38sKIiSEFREUUkg8QL1KTqyaxkBtDxC yaAKZ8JqjLq09O35BFXE4AzJ3kM+XedE13Ciq/OwqyiatzI6wmTPS1cYb 6Ns98hn5C6aAKwB1M4WHmwwTAkGcDoI2f9+t/CHtNUNnNEFPYRaavhM9b RTicZLrICPOOC595MTxK8Sl9pg5nuPTTOlZDZq2RO8zO9HyjvUlVDueZV WNPLZ556sRCK/rJ/Hwr63Z+FWJHbgupAtdtQ+498ZjgZwFkA0bdtl6Ied AiCjhfpdKNMK21RZFskUuSy5//MSLld+i/jOttTNgFa2Q+daIq9DQsqub Q==; X-CSE-ConnectionGUID: TormF6YuRaOfA0NQFkB+8A== X-CSE-MsgGUID: bqoHpssNRQGd0g5hMlYXkg== X-IronPort-AV: E=McAfee;i="6800,10657,11936"; a="764312" X-IronPort-AV: E=Sophos;i="6.27,160,1787036400"; d="scan'208";a="764312" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2026 11:55:37 -0700 X-CSE-ConnectionGUID: 7atxUFwFQii/+i+8q9ixdw== X-CSE-MsgGUID: vuadB4tZQfG5eVXmwMOSoA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,160,1787036400"; d="scan'208";a="1742201" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.0]) by orviesa001.jf.intel.com with ESMTP; 15 Oct 2026 11:55:36 -0700 From: Cezary Rojewski To: broonie@kernel.org, linux-sound@vger.kernel.org Cc: tiwai@suse.com, perex@perex.cz, amade@asmblr.net, linux-kernel@vger.kernel.org, Cezary Rojewski Subject: [PATCH 1/3] ASoC: Intel: avs: Unprepare a stream when recovery occurs Date: Thu, 15 Oct 2026 21:02:38 +0200 Message-Id: <20261015190240.729793-2-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261015190240.729793-1-cezary.rojewski@intel.com> References: <20261015190240.729793-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Recovery on alsa-lib side is handled with either: 1) snd_pcm_prepare(state=3DXRUN) 2) snd_pcm_drop/drain() -> snd_pcm_prepare(state=3DSETUP) before starting the PCM anew. Relying solely on state=3DXRUN leaves 2) unaccounted for. sound/core/pcm_native.c ensures correctness of the state machine so plain state!=3DPREPARED check suffices. This is the BE equivalent of job done previously for FE side only with commit cfca1637bc2b ("ASoC: Intel: avs: Unprepare a stream when XRUN occurs") and its follow up titled: ("ASoC: Intel: avs: Reset the stream unless it is already prepared"). Link: https://lore.kernel.org/linux-sound/20261010103753.16969-1-stiraspo@g= mail.com/T/ Fixes: d070002a20fc ("ASoC: Intel: avs: HDA PCM BE operations") Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/pcm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c index 3cf455e8b879..a0a0d645ea33 100644 --- a/sound/soc/intel/avs/pcm.c +++ b/sound/soc/intel/avs/pcm.c @@ -461,6 +461,8 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substr= eam *substream, struct sn link_stream =3D data->link_stream; p =3D &be->dpcm[substream->stream].hw_params; =20 + if (substream->runtime->state !=3D SNDRV_PCM_STATE_PREPARED) + link_stream->link_prepared =3D false; if (link_stream->link_prepared) return 0; =20 --=20 2.34.1 From nobody Fri Oct 23 03:30:46 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 67F74563280; Thu, 15 Oct 2026 18:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792090544; cv=none; b=Mb2O2T/IFNcyM/VjNEfxEckezasdl/Us2O3LPWDZnfev2RwNDjK7a4xYmAbNePRwbHiTS8L70LIqqE7KjBfNmYGRyzI39raaOePnbhi7a1rS1XuHTcOQDDNbOJUBQnYZ1cQ9MUcBc6yDT0lGVY8W3I7SSZfqefs9gb88plDCWYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792090544; c=relaxed/simple; bh=XWCUS0e+e5W0dUSXQA++xYnQb7HpJP7/AEysPBbn54c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ansncPQJY1xcQY0ZOS8jwyXDqnUiWXFPIcZi2XDjp+HgiEK2wNKIw0MlZgmaUxAxN32hhBTrQ+qIiq2dQdahDzcSPMkk/LvIB8SxyTabYCOb+WBWRkip1zSzGKVL3SxTQr8G3pqpVXJ8VN+BwvY8CoJ2VjsaHaidI7xRPf6zgyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YaamRYG8; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YaamRYG8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1792090539; x=1823626539; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XWCUS0e+e5W0dUSXQA++xYnQb7HpJP7/AEysPBbn54c=; b=YaamRYG8MJOhB9/eGu/ExMYo5uMQCjSmbOc6hkDSAe96zi+3doyANXrQ OBB70qSoQ+bMwfpYD6J9kbEESgSCqrhDhosg7wh3LTtHhstfFVHsX5RTx 1qDBJC9PUK63uO2CshTylUuZ/hePET+wcHInhdC7guKU+UwKsK+ncNQSN PjK7TcFmUcvogbAv4OkKqJXmWkEXpGam5qNLuKVmdvob6IbfYAKjpQpJq 7cGwDsadUVg5yoa/W1y5MBbyrybf0bc/zqLwuUyvAnx7BxWDelpm9k3c4 7d773Ggb+HRSwcnH1kiZxl+KUku51WOPvzhichSRn/g9NkRGA8trLxkQs Q==; X-CSE-ConnectionGUID: /fl7b9vvQtGWb9xrrHPWUA== X-CSE-MsgGUID: A0KtviSZSdiQ3ERayX4JVg== X-IronPort-AV: E=McAfee;i="6800,10657,11936"; a="764318" X-IronPort-AV: E=Sophos;i="6.27,160,1787036400"; d="scan'208";a="764318" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2026 11:55:38 -0700 X-CSE-ConnectionGUID: os8SnSbjSa+KFTCD99xu4w== X-CSE-MsgGUID: iNzSGbIMSDa8AQrPFJRWIg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,160,1787036400"; d="scan'208";a="1742213" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.0]) by orviesa001.jf.intel.com with ESMTP; 15 Oct 2026 11:55:37 -0700 From: Cezary Rojewski To: broonie@kernel.org, linux-sound@vger.kernel.org Cc: tiwai@suse.com, perex@perex.cz, amade@asmblr.net, linux-kernel@vger.kernel.org, Cezary Rojewski Subject: [PATCH 2/3] ASoC: Intel: avs: Verify sizes of configs coming from topology Date: Thu, 15 Oct 2026 21:02:39 +0200 Message-Id: <20261015190240.729793-3-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261015190240.729793-1-cezary.rojewski@intel.com> References: <20261015190240.729793-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Before operating on the init_config or NHLT-blob entries check whether their sizes are within bounds of the block being parsed. Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/topology.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/intel/avs/topology.c b/sound/soc/intel/avs/topology.c index 1085090d5a9c..e81401bb6dbd 100644 --- a/sound/soc/intel/avs/topology.c +++ b/sound/soc/intel/avs/topology.c @@ -1720,6 +1720,10 @@ static int avs_tplg_parse_initial_configs(struct snd= _soc_component *comp, AVS_TKN_INIT_CONFIG_ID_U32, mod_init_config_parsers, ARRAY_SIZE(mod_init_config_parsers)); + if (ret) + return ret; + if (config->length > block_size) + return -EINVAL; =20 block_size -=3D esize; =20 @@ -1790,6 +1794,8 @@ static int avs_tplg_parse_nhlt_configs(struct snd_soc= _component *comp, /* With tuples parsed, the blob shall be allocated. */ if (!config->blob) return -EINVAL; + if (config->blob->capabilities_size > block_size) + return -EINVAL; =20 /* Consume the raw data and move to the next entry. */ memcpy(config->blob->capabilities, (u8 *)tuples + esize, --=20 2.34.1 From nobody Fri Oct 23 03:30:46 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 046D6568FA8; Thu, 15 Oct 2026 18:55:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792090546; cv=none; b=bYL8p3qdFqBzytWqg9lh/on/uIpUyemhpkwtJTqECdirXPZUP30CxWL3E8s7lRbZ+jKCU1dv6O3VKKgAr3roBm55kUOfhpQtjaX4T11wTCcnXPVRvlHEw6MDIzEpkYglpoVfSX/s2umbJfW7Ud1UNsRz1bt/gAA68DRkHGpAT6o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792090546; c=relaxed/simple; bh=pqrJIUBpl5mAuKbRO7+hTZQ1iqORTIG4pfl/Yx+rYbo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GWMi1F80CN97icRnkbwZ4howYx8owKP+9w5xzwI2WUzNl3CiYOvDH1tRoW3HcMVHAnyXvXQDKUDeE4qdKf89YUaTgRnxpKdwWHQPMBCQ3r0oAL1ozwKS8A1VsIGUF9embJX3Tz1yl9APa4020pL4NJuatTwht5vbnU+4afzSFBo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=C2BA7Lv4; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="C2BA7Lv4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1792090541; x=1823626541; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pqrJIUBpl5mAuKbRO7+hTZQ1iqORTIG4pfl/Yx+rYbo=; b=C2BA7Lv4M7ONkZBcDwqlC4UcePJl455v91kYtPlDMVnAEGTMsUBX0pXn GMKkhUI09RWViRcaBB+ih8eYHNV7ChVQK3WYti0L1LhfZ71OXr7T1Dw1Z 5cx6RqMO5myThFVlWcRaMHmr00yvvy1NB4e44Qd4hxVtjpwIlo1XSFvw5 KBWBa0ZyfSjM1W9WLQgqdLt32C2C5740hmUzAd93zQNXqXqMGTrLRclH5 jJazSjFkA2M/LPFlguYFoYjUM9KDXEfhIJBls/ldY+3Blxu/QHZvYPny2 wQcieQKIlKFeP7BgqFVl5GGDxUtpjj8kdIzSogY3EzC1Xk180m4fsQ7DI w==; X-CSE-ConnectionGUID: pO0KRYgIQ2+DEmFqIaQUwg== X-CSE-MsgGUID: n4zwU+wAS56+knc5IUYLmA== X-IronPort-AV: E=McAfee;i="6800,10657,11936"; a="764325" X-IronPort-AV: E=Sophos;i="6.27,160,1787036400"; d="scan'208";a="764325" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2026 11:55:40 -0700 X-CSE-ConnectionGUID: Ba45tiOnSvSwPkoqeXdMeQ== X-CSE-MsgGUID: 3EmYBhwZRGejLuZUEkv7bg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,160,1787036400"; d="scan'208";a="1742217" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.0]) by orviesa001.jf.intel.com with ESMTP; 15 Oct 2026 11:55:39 -0700 From: Cezary Rojewski To: broonie@kernel.org, linux-sound@vger.kernel.org Cc: tiwai@suse.com, perex@perex.cz, amade@asmblr.net, linux-kernel@vger.kernel.org, Cezary Rojewski Subject: [PATCH 3/3] ASoC: Intel: avs: Prevent module info underflow Date: Thu, 15 Oct 2026 21:02:40 +0200 Message-Id: <20261015190240.729793-4-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261015190240.729793-1-cezary.rojewski@intel.com> References: <20261015190240.729793-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Typically modules information is first initialized when loading the base AudioDSP base firmware and then expanded when loadable DSP modules are requested by platform-components, see avs_component_load_libraries(). While theoretically not possible in a production scenario, there is no reason to continue the IDAs preparation if an event caused the newly obtained module information to be smaller or equal than the existing information. Fixes: c1a427e8da93 ("ASoC: Intel: avs: Firmware resources management utili= ties") Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/avs/utils.c b/sound/soc/intel/avs/utils.c index ea14ec173855..f19a62e7e8b5 100644 --- a/sound/soc/intel/avs/utils.c +++ b/sound/soc/intel/avs/utils.c @@ -116,9 +116,11 @@ avs_module_ida_alloc(struct avs_dev *adev, struct avs_= mods_info *newinfo, bool p int i; =20 if (!purge && oldinfo) { - if (oldinfo->count >=3D newinfo->count) - dev_warn(adev->dev, "refreshing %d modules info with %d\n", + if (oldinfo->count >=3D newinfo->count) { + dev_warn(adev->dev, "modules info underflow, old: %d, new: %d\n", oldinfo->count, newinfo->count); + return -EPROTO; + } tocopy_count =3D oldinfo->count; } =20 --=20 2.34.1