From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF6C0C433FF for ; Wed, 14 Aug 2019 17:17:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C243206C2 for ; Wed, 14 Aug 2019 17:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565803024; bh=xr41tJqVxe692GCkDD5OSJBDIWj3pT8XZ1dJgTZ0/7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PpEVbio0f+pKgDFfYcQs5JsSuD7XkVEsv5HXeDjhULt8r02DnqWil01hmAgf6D39S fw5O3eE2/9mxhh3lVC0oAMotae1FIhBRDRyIg6T4gl4dWBsaI4IHxJbep7HDdTfGzu kYu/Y0U1Ay3eD+NVYQy2uPNsJyseBk5Hw3r+AvxY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730942AbfHNRNo (ORCPT ); Wed, 14 Aug 2019 13:13:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:38044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729421AbfHNRNo (ORCPT ); Wed, 14 Aug 2019 13:13:44 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 B02DA20665; Wed, 14 Aug 2019 17:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802823; bh=xr41tJqVxe692GCkDD5OSJBDIWj3pT8XZ1dJgTZ0/7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1anqviyHvn6Gnxg/21mgREMwqA6gVJoRQdcuiNvXutug/3HEhX7pm+FpcAaZiSYfw 7/XZ22/wQpQ17ztbJ1InGnWnOeHgoewF459u9QVim14fq20H3Gtoo+G3NOH3dDE3tW vX6ch/tKHYNHfa7u/yVqWLFZYV6HcIW7yHZIKM+Q= 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.14 39/69] ALSA: compress: Be more restrictive about when a drain is allowed Date: Wed, 14 Aug 2019 19:01:37 +0200 Message-Id: <20190814165748.117130109@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165744.822314328@linuxfoundation.org> References: <20190814165744.822314328@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 b4f1536b17cb5..2e2d184684911 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -812,7 +812,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; } @@ -861,7 +864,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