Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1065236ybl; Wed, 14 Aug 2019 10:08:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwD1abLl7s/B7qWDLfnbYlZ5s8zYs5BG6WUNQRv3xeYdABFH8FV3x2MUoUIJgoU6fvRWf0E X-Received: by 2002:a62:1858:: with SMTP id 85mr1020792pfy.120.1565802530617; Wed, 14 Aug 2019 10:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802530; cv=none; d=google.com; s=arc-20160816; b=vqtpQ0TdZXM9QAAwxQ8RuZeNdBhpYVcmYfZC+BmFI4ByUQ82w4oQGt0OkJwB2Ll/1U clcwaIHyUF4Ry4LtKGYodp2y54OR8I9J/qwLvoUiH4CnWRSpHyoqb3I0ZVQy3vDSZMBK GZWn7k5cMXMF5vYhZHsv/tGPgaUWa6QsrXRJ2ijnCCqD5LRjdz5szKxUGd+V9tsURbuS OKExl95HqcKLt/x7s/nI5iGtks33nGMNjFryGl3mMHP32LgNPQfmnHDJKAa+TVGQ2gXv zOStD/Mlku5GD6jbtuWhKYgEcXdKeNhDFj2d54+1wmmeFF+7SEQEaBeFV0smi1T6XX8z 0TuA== 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=NkQpGPKVRfNz6Hs0blSABVTzEIZg+AdFuIA/Lh7eayc=; b=ga9VI2wukmxhBF9PWnSVrmm7utz6schlhEmYIwuhAP7u52bLWGAuyP7jBCTGVTv+bl XaaS8ETFJoIsYA4Yxa/oIbFJU0YZpsmrxnE4MG08r0yXaw7bmbB9BkxGLLYHrOiMp7D+ z4zFHcOF5hCIiX5OtE587hiktvHqYGNxSApugxICKZBMxm0/CXedpzbvzNXYyaFyeg81 nKb07vbsbtaJZv00vqUe5A6Sgp97JTscea2oEIEZ2xnL915bRiYpny8uVn12YbLNez4W 9kZYfZoxJ3jZGrTl5oL6BF9U+/Ihda5cJ1DRXv6uLwH1T+ujIzHKJBvW83zXRvfj48oT 3XUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eCfUtYGc; 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 r139si60320pfc.276.2019.08.14.10.08.34; Wed, 14 Aug 2019 10:08:50 -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=eCfUtYGc; 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 S1728911AbfHNRGB (ORCPT + 99 others); Wed, 14 Aug 2019 13:06:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:55006 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729552AbfHNRF7 (ORCPT ); Wed, 14 Aug 2019 13:05:59 -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 E83322173B; Wed, 14 Aug 2019 17:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802358; bh=AXa9RRJ/hRrng5SKmQ9KKNzrj/K4RQNNYJG4yJbTRHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eCfUtYGcYeMGCmn/rmkhpSJuiQH9PDI+hX4CUl2IzELc5QHg2hjFTDEwbVZyql3u4 xgXwxsITFDxs+54GlHzLqHOHqt3/vKcoHxOuQANCvzNIBLvcPyU2hgndv6eiD7QW1+ UaxIM/z3xdyZVuR+79JIxaTr5iIA7QRGPOHgzcwg= 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 5.2 095/144] ALSA: compress: Be more restrictive about when a drain is allowed Date: Wed, 14 Aug 2019 19:00:51 +0200 Message-Id: <20190814165803.856907290@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@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 6cf5b8440cf30..41905afada63f 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -811,7 +811,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; } @@ -860,7 +863,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