Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1071980ybl; Wed, 14 Aug 2019 10:14:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHMuRw3ZCE2/RdfYkr2RAVVW5+92FfLeP3RXgi11MFvpoSFo+P6t3UDpJwYnd2mP20JxrN X-Received: by 2002:a17:902:e311:: with SMTP id cg17mr397988plb.183.1565802873864; Wed, 14 Aug 2019 10:14:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802873; cv=none; d=google.com; s=arc-20160816; b=VM88Ghrgj3LImu4xD7UPkF8HvqjOa4+gopP0vmhGpH62eJRHZ/wdQTS8BCN8C0fJPc emhJdVTAcGl9zBjf/0IG37Xbd4jXMGyREhrxHK77PbIfYv1p6Rr0WSPLNbkhZ3Vdo6xD nNgQU3i15iq6Jk5YN6JLVb/LmsHo74c5to+GEFxmjJ4lTfVAND/ceQSo496TUVKyB9Qz iGeRaE6l5+G3ATfwPvxr6sLikjUmvKYf+NX0gb4lV/JhEGrEvHT2sIH8ociRmTzCZyRJ ZZP7bWcVCyNL5sFvaxDzxJrX7F3+zZofVhunyZXsSumNbRXlZ1tyxCven5Yu6yF9tGua 1WVQ== 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=6vxelxz/am9Hkrk1hU2fQdi1etWPOn01fZGLT0dihLE=; b=HnIKcRediNgVl8QuFtNQ9dvGgYYnGIWOLEGk7sSNEG+gzljMB9RywfBeVw9b09ODQ3 nlAtRiGvTHIZtJ0xrHH4eInFJgJpc7hG9bA7NbzK3Bmh+6dN9fzhfZ+EFRW2spjaiZWi xT0+/iCAAYWuamXR+ZmaQ9nVba5aACS3AEWBBjvqcl1YZ3uMALcWWoIu/9hHfmkyaEKU I2P4aDWOdaF+aiaXHKusEdwqSddv+mEr/bjAU0uo5Bmkf67L9yNeUtcXzK/wnWPJXvUl 24QFyNVj9/V2Gkf48iJnFPeo8xSYw4NqcUkE65YgN616Q6icGn2Bn5tg/OIha6MkLR1A oj+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1anqviyH; 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 y1si160345pgg.490.2019.08.14.10.14.18; Wed, 14 Aug 2019 10:14:33 -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=1anqviyH; 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 S1730947AbfHNRNp (ORCPT + 99 others); Wed, 14 Aug 2019 13:13:45 -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: 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 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