Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1069761ybl; Wed, 14 Aug 2019 10:12:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyj1e/UoCZogoqiOBFBaktKzsdSbP4+1MF1lZXD/gwOqiEwDbhoevniitz8o0RB4p2u/Nay X-Received: by 2002:a63:e14d:: with SMTP id h13mr163946pgk.431.1565802752776; Wed, 14 Aug 2019 10:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802752; cv=none; d=google.com; s=arc-20160816; b=E3h6Td/OQVEFkDP7TtgoU7qih1cemJ4q+SKBdGsfuyEWSkuue6KbaMyU4HfUFr4eaw TVtcCX0W43f3CEEjanrpk1EZj6fHFdsqJO7jFOXyB1VZ++uszxcyzG6phYFzPYh8Obdm 42+YP2F28jsFV+BqnoFOwqNI0C8qr+dj5UR7zb7OkFpFxEXc8xs2fnDkgRaSxOxSF2RH nc/UZIsHMJTfsTvaEq6I99jVjBveYTpSy9B316lMxFl0DKFd4L+3XsaoCI2EyY+l8gIU ZpgNNv96vFJOva31jakDolHxnRgpivySLdFddLuXyakjXV+i++fe8Pt4DFsypGLIJJZF UQMw== 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=BEWGZK20nRRKz2S5ctc90vFy8NNcfLwRbqlFGg9qyu8=; b=WAodBNnsjhsnAI7L1wn0ll16C/ZQ/RFvqFB5AKemtciE6bmTF7i5GbasVi9ZHxfUsa KXQ2v5ehW+q+xWKVgJgVhNVbXplmokuzpko9Z1l2i7cWcchX838ayaZ9K+VffDklogbQ QxG1ep0UwyggW6G8zMsNmIaSpjwX/Y/oQAbZwYOGqtqkAeaLKeOrjWW3qH1YiRAwIux5 1+sC4iGw2VVDwwdJ1XnL4jao4s9huOSKI0shvm2L7VbrtyKXZ2oi/JHa12xSdTYGIUKd CR+3mBNAmt9WbgKi9Ef6LiA5VXnzEvZVWWigfJYKubmkI8Lk1mYek122jIz7pJsnzv17 yHyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="KfW8zu/Y"; 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 x12si180623pgq.220.2019.08.14.10.12.16; Wed, 14 Aug 2019 10:12:32 -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="KfW8zu/Y"; 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 S1729341AbfHNRK3 (ORCPT + 99 others); Wed, 14 Aug 2019 13:10:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:33208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730481AbfHNRK1 (ORCPT ); Wed, 14 Aug 2019 13:10:27 -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 A71F9208C2; Wed, 14 Aug 2019 17:10:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802626; bh=KndO6B65yvVUQnrXfFuyhPn4dfia5yRGl9PLHDG1aHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KfW8zu/YE7C1VbzyIEQG2kDdjueo/8JSAaGyYpnXculQ6EvbyZmnHw71VXADrZAct z8etynszDwFLx+4VoNrIr4i0vWZoXYp5agp7epy/koHjOMq1yXPD5BlW2WzOJCoP9p fdKH6zJi48IcDZHG4N70p5RklB6Zk5VZMjUs/ekA= 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 54/91] ALSA: compress: Dont allow paritial drain operations on capture streams Date: Wed, 14 Aug 2019 19:01:17 +0200 Message-Id: <20190814165751.897366594@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 a70ab8a8645083f3700814e757f2940a88b7ef88 ] Partial drain and next track are intended for gapless playback and don't really have an obvious interpretation for a capture stream, so makes sense to not allow those operations on capture streams. Signed-off-by: Charles Keepax Acked-by: Vinod Koul Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/compress_offload.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 5e74f518bd598..9c1684f01aca0 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -835,6 +835,10 @@ static int snd_compr_next_track(struct snd_compr_stream *stream) if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING) return -EPERM; + /* next track doesn't have any meaning for capture streams */ + if (stream->direction == SND_COMPRESS_CAPTURE) + return -EPERM; + /* you can signal next track if this is intended to be a gapless stream * and current track metadata is set */ @@ -862,6 +866,10 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream) break; } + /* partial drain doesn't have any meaning for capture streams */ + if (stream->direction == SND_COMPRESS_CAPTURE) + return -EPERM; + /* stream can be drained only when next track has been signalled */ if (stream->next_track == false) return -EPERM; -- 2.20.1