Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1075709ybl; Wed, 14 Aug 2019 10:18:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVGhYGFU4mTJTNJB7RmEDxAXneMBmw4f50DutW+4pBp/suoY81O/wjBpq+bjA8og4KhMo0 X-Received: by 2002:a65:6288:: with SMTP id f8mr231367pgv.292.1565803082921; Wed, 14 Aug 2019 10:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803082; cv=none; d=google.com; s=arc-20160816; b=usS8Cz+8QXps4RSEP8+XY+1hdmCkeWia59ZQqEKsaGsWHKCaw90Enulk4W9/fCdzSY T5Qp9NBxwiNgJsczJSUksRy5faMktw7dDAVUUgn/2ekr/aLhPI25ry7Bd98s9rWn6pyG jbkJCA4KSlR5mYJoxbE257dTYK2dm8RXo6lnoF66XB9A/p8mzvsxn2F9UoYt0Z+lWixM j+eaNRR6G0BmrhAmljZE43jSQQGt+ROhiKX7xip4/4tgJQB7z7qtWapAOSpnn5L5BHK1 KKFz0uXuI2wr/6zkIFE7ElsBi1ZaZS/Z1TA649VNl6iKVpnB2+j8sx9ICd3O32fJA7SI mP5w== 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=eY1L110du6Swgno+5pz/pKMnrauXEnETpqJCkqIssEo=; b=vnfvbDDIf8vRfQ0nCJAbCr+2HysgGIUL/gZ9quPcYUiLxjBdPuKhrPNuG8CQraiyMI 8icpC9Ly0LXsU8tBds6vq4GRnJhZc3Y8w88RwMC8dqykvDk5onGkb3Z+iSvmjLV/aHp/ RDY0H/etauWdwihs6DxSxgaMnT6pGyGrIeOyDT4WhvOC3GwF25ZfvmYGZ7fs18HkBBdE CTvPpuhm8R+snC+d5TVblwKxmYrCn8pP+CrLWglSQ0leP8LoAMXvectBJ79u3g0lItzc +7EfQLV99ZjdUqc+HFEtsb4N8EjEAEUnbdgEk8jc6xNDAk+zYDvXYfxhgyVCNOhatja8 f4YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pRTXCm1f; 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 cm21si190495pjb.63.2019.08.14.10.17.47; Wed, 14 Aug 2019 10:18:02 -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=pRTXCm1f; 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 S1730936AbfHNRNn (ORCPT + 99 others); Wed, 14 Aug 2019 13:13:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:37992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728433AbfHNRNl (ORCPT ); Wed, 14 Aug 2019 13:13:41 -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 3349920665; Wed, 14 Aug 2019 17:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802820; bh=3cjpLCQ8fn6p6DHotHg4R+SHQOC6BSFZW4EWspyAYNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pRTXCm1f9RO/vXt1N1AB1ae9b9pV8cfUxB+SYKUW3MwHp2VZtdSD/LsKc132ZzqKx DreZajpwymN+3KGOKKLLQM2AEdjzcQmODvxR2hUjlnxCOgkpU42ZNuSpWAAZseSdrY QDeD9XfLhZ9VEgDIJq27Ouzsy3E/HzYBCRPvw2co= 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 38/69] ALSA: compress: Dont allow paritial drain operations on capture streams Date: Wed, 14 Aug 2019 19:01:36 +0200 Message-Id: <20190814165748.056978822@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 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 1538fbc7562b8..b4f1536b17cb5 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