Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1068330ybl; Wed, 14 Aug 2019 10:11:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwM7J13nytdT20MMfCBYvt43BCkzgcbJpG3mk9AbFONxQye+DjrDAxE1JgQApWeHTCLSQSj X-Received: by 2002:a17:90a:feb:: with SMTP id 98mr673297pjz.55.1565802684107; Wed, 14 Aug 2019 10:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802684; cv=none; d=google.com; s=arc-20160816; b=GN/Pu+6ZVPBfp8b1qdZz2gvl6SI/QkJ4TN9+bibn5Q70XrtgrIRVXA1YA6C2NPnu0r PWSrUMHDIc+ROCnNyCcDR/wTSFFNPzHHOAMm6mbTKBeC4cXj6Ro6MiHPABlPTflQYON7 8kyuOlOANm1nu3nmxCKCiYbcuzNUBHqJzrdk5lmtpv7aoXf9T4GFYvCWHCRQy2fuOUlc JVHo9LYPXa7WKJvjqSD/8BECCrx5o73EUarV1M9Lh8sShkE5D3iyjTl0p2U005tZ9AkZ FrDoWMtFMVXGggziBsxrOVaDkdPtlIgJuGAMxrIlmjMremY7RptiTteqclFrtX/om/Ko a3mw== 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=BoGZYn9QM8fQdFWL8sd4YrjKw1OkxDB052TqXxce8fo=; b=P7J33KRmzuzmaMxhATi6BHmlI+OcJYweJvY/5l7XtDgn4+OkX0pAcDHNqEXNQIEaWK SQewRXbDZ80s+6D3z2A7kraofloOaZKnApCJCM7lABJdlEkbO/rvhwXFpC56kTIIozKG Qr3q2OJK7IuwP3CdFfNDEFE4uGMB6Aw08+HJx41XNm6hyj5PhGmmkbFzlAis6c0b9zQj LkYmxQQw1P/MQRfCzDvUPO8AkToVyLM2Mg3Tb1x2po8NY9zVyWt2Paiec/8HA14ePMlN rayIsxl40x09wmgESq/ROu++/zY/jbHObXMN2OcBVwCSoBhskPLd8QrOLnPljxVR6Xm9 t5oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mu2qXQo9; 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 q10si84655pfc.85.2019.08.14.10.11.08; Wed, 14 Aug 2019 10:11:24 -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=mu2qXQo9; 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 S1729107AbfHNRKd (ORCPT + 99 others); Wed, 14 Aug 2019 13:10:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:33268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730485AbfHNRK3 (ORCPT ); Wed, 14 Aug 2019 13:10:29 -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 430B62084D; Wed, 14 Aug 2019 17:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802628; bh=thcy6Q/Hz7EBbae/VkotyQuplx0sNcmIZID/r/im+pU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mu2qXQo9vuYmary0325Vi0NCRTBuSYuMmJFkoh3UU8I9quRI1DwUgrH5yjFYcl7xF CrZKLG72G3tb3kK+s0HV5T8N+ES8EeAAE+5ixvJa9knNai2XNjnjFPgZYdtD5RwpQc NYJMvQ6s2I506sSYrxY0OLySxuQ+fWbcOCfiGtGY= 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.19 55/91] ALSA: compress: Be more restrictive about when a drain is allowed Date: Wed, 14 Aug 2019 19:01:18 +0200 Message-Id: <20190814165751.931921514@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165748.991235624@linuxfoundation.org> References: <20190814165748.991235624@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 9c1684f01aca0..516ec35873256 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