From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755654AbbJ1Iee (ORCPT ); Wed, 28 Oct 2015 04:34:34 -0400 Received: from mga03.intel.com ([134.134.136.65]:39867 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755616AbbJ1Ie3 (ORCPT ); Wed, 28 Oct 2015 04:34:29 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,209,1444719600"; d="scan'208";a="836891595" Message-ID: <1446021265.2443.3.camel@loki> Subject: Re: [PATCH] ASoC: dpcm: Make BE prepare possible in suspend state From: Liam Girdwood To: Koro Chen Cc: broonie@kernel.org, tiwai@suse.de, srv_heupstream@mediatek.com, linux-mediatek@lists.infradead.org, s.hauer@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Date: Wed, 28 Oct 2015 08:34:25 +0000 In-Reply-To: <1445998534-38246-1-git-send-email-koro.chen@mediatek.com> References: <1445998534-38246-1-git-send-email-koro.chen@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2015-10-28 at 10:15 +0800, Koro Chen wrote: > During suspend/resume, there is a flow that if a driver does not support > SNDRV_PCM_INFO_RESUME, it will fail at snd_pcm_resume(), and user space > can then issue SNDRV_PCM_IOCTL_PREPARE to let audio continue to play. > > However, in dpcm_be_dai_prepare() it only allows BEs to be prepared > in state SND_SOC_DPCM_STATE_HW_PARAMS or SND_SOC_DPCM_STATE_STOP. > The BE state will then stay in SND_SOC_DPCM_STATE_SUSPEND, consequently > dpcm_be_dai_shutdown() is skipped in the end of playback and > be_substream->runtime is not cleared while this runtime is actually freed > by snd_pcm_detach_substream(). If another suspend comes, a NULL pointer > dereference will happen in snd_pcm_suspend() when accessing > BE substream's runtime. > > Signed-off-by: Koro Chen Acked-by: Liam Girdwood