From patchwork Thu Nov 10 14:13:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 623798 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD54FC4332F for ; Thu, 10 Nov 2022 13:57:50 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E44F61673; Thu, 10 Nov 2022 14:56:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E44F61673 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668088669; bh=STHsnurNCeZ4coLDpSrI00qVwfgQXzk+lwQOM8qU86g=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BAonbdk96iTKv7J2OiVg6G6IVoGj/X82PQDby9Il/oufrXjfkvkg3Eo0GaLuVDrtv E5KLTJW+7apnj6N5ZIu/LY7ZPDKnIaYC9q1lX9WYo2VCXp6SwNtO3iE+ddzEwFnGjy T6E+AsZEYUi5Exk/jyzHyEARK1ExFtpw7TyQPCcA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 50D5CF802E8; Thu, 10 Nov 2022 14:56:36 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A4838F804FB; Thu, 10 Nov 2022 14:56:34 +0100 (CET) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id F335CF80114 for ; Thu, 10 Nov 2022 14:56:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F335CF80114 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Z5ugRPGj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668088589; x=1699624589; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=STHsnurNCeZ4coLDpSrI00qVwfgQXzk+lwQOM8qU86g=; b=Z5ugRPGjRCqW7wX+7dACBkHhUcHWsMMEDA4tWBr5SqZ9hdYlTb1LD1lG SxDLxhjszkDFcsEgvSTLuocP1ylF2yGPwDoAOg4q8jH8oNYwlITWuffsn MrEZLJ1NBocR1Wcc2XQtF9tJ1A4cZwwSTvl1UGDr6/xOo6IMsoUATkbyD CoU5BltR+r/jRxc4gjo9FYUgw2NdQ3hOKbFKlxSjeO1rKNbJbbLE2k7HQ L/TLBcy2jE6+oCOgU0tqQ8WElNms7t8bNywDQv5xQb7bjd9jkjiDeZkPn kFbuZMjfOLNHQlikRZNJ44B/qa3MOYwUIvP5UJS3om1z+yl068yoOwIHV w==; X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="373431544" X-IronPort-AV: E=Sophos;i="5.96,153,1665471600"; d="scan'208";a="373431544" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 05:56:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="966414999" X-IronPort-AV: E=Sophos;i="5.96,153,1665471600"; d="scan'208";a="966414999" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga005.fm.intel.com with ESMTP; 10 Nov 2022 05:56:22 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 1/2] ASoC: Intel: avs: Lock substream before snd_pcm_stop() Date: Thu, 10 Nov 2022 15:13:29 +0100 Message-Id: <20221110141330.740916-2-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221110141330.740916-1-cezary.rojewski@intel.com> References: <20221110141330.740916-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" snd_pcm_stop() shall be called with stream lock held to prevent any races between nonatomic streaming operations. Fixes: 2f1f570cd730 ("ASoC: Intel: avs: Coredump and recovery flow") Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/ipc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/intel/avs/ipc.c b/sound/soc/intel/avs/ipc.c index 152f8d0bdf8e..07655298b6c7 100644 --- a/sound/soc/intel/avs/ipc.c +++ b/sound/soc/intel/avs/ipc.c @@ -123,7 +123,9 @@ static void avs_dsp_recovery(struct avs_dev *adev) if (!substream || !substream->runtime) continue; + snd_pcm_stream_lock(substream); snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED); + snd_pcm_stream_unlock(substream); } } }