Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp263159ybl; Fri, 23 Aug 2019 00:05:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3NTnogzpks3ztpfwbMRUfjjjfbA70t1EIcfxUCxP6m9JN5GkjFczJQcnOjwfqMQEn02Q6 X-Received: by 2002:a17:902:6b81:: with SMTP id p1mr3029012plk.91.1566543937421; Fri, 23 Aug 2019 00:05:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566543937; cv=none; d=google.com; s=arc-20160816; b=bBaPK2MbSp9kH8TvKNPAT2qiCAZbNikNySybZr+v2K0y0xwUxtKxdgkKyMB3T1wBcw W4Pf+7hHWJmrHqEtKOTiZm4nwwjuU4Ax2ckKHZLchZcfRxbY/5zxGPgr6abQwaJHo3/w LDs1fm807ymf3vt5UlQWJljs8hGiLpU0B9spPEHkZ6PU2XkkiEt/HD+j22GJXSLA6SCF zC/e5tV7FbzFBxceJ9sRfcVUiBXR/G6W8GlRrT3MQduf7FDNvdyrn3tglU/kkptoKfDX Yo+08ndl3yL2re71tAyFmxz2rnLnHs3VmJDMAMNSivRtIBVf1WOy8DOvbDyVEOvwTrou L0TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lJv51wWqpFiGTxVYrZr5hTu9h6Wzil2SVI99pbAswWg=; b=sar7v9u0r+RG6olsg4zCG0qm7yRGAX0nugf6pPUqobbLV9KkIlaVCRw9T6ddZdPTO/ n+VTXxr9vidrgGa+6tY4BDEkEok9i4xitt0XjaLCSIA27FTE/0SpAjphgY5q8Bxxk6m1 zabLmtm38kSZaAOa2wDO1m8ZFHGRSplio1fmDM2Qlmg5Haqol08a/rOo0/MDDpHiJHQ+ QeIqIoMTNJEXAStfK/OBT909fAIHMx3mnU2yRjMuUmhtBOScqDPJ3xcVPdIxeP/Wgmw+ p/XgKkkQtinKBXm6y2PLB2fL1fo7zhX5QZos4NbitQd61bovi8All9D0xf5FnqcCAkXb iMkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fHE6UUMB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si1243874pgl.386.2019.08.23.00.05.21; Fri, 23 Aug 2019 00:05:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fHE6UUMB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393342AbfHVRtE (ORCPT + 99 others); Thu, 22 Aug 2019 13:49:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:40008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389884AbfHVRWS (ORCPT ); Thu, 22 Aug 2019 13:22:18 -0400 Received: from localhost (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A5F7F233FC; Thu, 22 Aug 2019 17:22:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566494537; bh=RDbTLskwpQBZpN6cKRNg14/3KcnmdNXMHCAJABzMeoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fHE6UUMBb731m84LTPwHCKSlr+xMyrfXqwKbnp+1ccC3zcWSLWnAcL0wukEdupsMB xyOFCTRlrM3olvxw2iWSIfTh1xc4Qi9mp4sTgmNn4Vo9k+LoAccWvgmxmMtuU4PWFL JlsEA6UaqEuCOEXNdGs+kH9laT0RlvjSlpbmIk6g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Vinod Koul , Takashi Iwai , Sasha Levin Subject: [PATCH 4.4 17/78] ALSA: compress: Be more restrictive about when a drain is allowed Date: Thu, 22 Aug 2019 10:18:21 -0700 Message-Id: <20190822171832.543568472@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190822171832.012773482@linuxfoundation.org> References: <20190822171832.012773482@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 3b8179944cb0dd53e5223996966746cdc8a60657 ] Draining makes little sense in the situation of hardware overrun, as the hardware will have consumed all its available samples. Additionally, draining whilst the stream is paused would presumably get stuck as no data is being consumed on the DSP side. Signed-off-by: Charles Keepax Acked-by: Vinod Koul Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/compress_offload.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index d0a21a5867673..771d7b334ad87 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -749,7 +749,10 @@ static int snd_compr_drain(struct snd_compr_stream *stream) case SNDRV_PCM_STATE_OPEN: case SNDRV_PCM_STATE_SETUP: case SNDRV_PCM_STATE_PREPARED: + case SNDRV_PCM_STATE_PAUSED: return -EPERM; + case SNDRV_PCM_STATE_XRUN: + return -EPIPE; default: break; } @@ -794,7 +797,10 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream) case SNDRV_PCM_STATE_OPEN: case SNDRV_PCM_STATE_SETUP: case SNDRV_PCM_STATE_PREPARED: + case SNDRV_PCM_STATE_PAUSED: return -EPERM; + case SNDRV_PCM_STATE_XRUN: + return -EPIPE; default: break; } -- 2.20.1