Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1066509ybl; Wed, 14 Aug 2019 10:09:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMLBQP3K6ZcCFg8w5InsuPSESC76P2uR5TowbXKFY6K+S35QIdnPR43fiTiqHcJxYD6Gff X-Received: by 2002:a62:8246:: with SMTP id w67mr1017217pfd.226.1565802593101; Wed, 14 Aug 2019 10:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802593; cv=none; d=google.com; s=arc-20160816; b=otegiJIswcz981ozyIAmVWZ/XSpP+n60HVXz8dFNHT8jcs5IVOWv/2kxhc9KoEqR7Q 9l+rmPrBG6jD+zlsjGD7Yup44zAY6zPgtjBmoc4ONaU1Nsr30llasgGFjRhiIjNntwgp Ww7rBSbmdAfYPXXfldhcSLUXMAChncTH3I7eoXSBnF9kU2VotMxWhoQ9oJTvOElfruBU 8HgBHEFn5jS+O2gwav3URAYrNfsQI0+Sx6JDf+zB4Qa5cChLbaFpHH3wJkKd5ZbRteRv ORBzRp9eGUzgF8RkEJ4bd9JU44+4KcG0yLQu4Yg9SEJqVvnMM75CRjehRNpisAfoIqnl +Kpg== 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=SCMIBSSpKgsohfU/S6ROpDdXoQCacFd7vpMEP5I+odY=; b=HpuubP6ee5RlLVDoqmKwB/4+CBtT+97SkVeyLxOyPJ+VzHHQHSuWDRgtsqjvsuNK7p F55uOv4mTkS6CHLheiE2r4p3kdZr5oJfVq3xiQEfBKCE6GHrE6dXH3U2+XuEWSCcVEFs 8XP44NiyKoCFnijjWuzj7Uocx6VN2eXNw853ubXxe0zvp10nH23uva/+6Kwd0GXediDn 65RYPrYh1frIWRg6SbbUTDTtK9u+DiL4N5B3RdF2f3e9gLztimii+lAyalV1oZdbJw7d uRQIVJ/Eefm3g9Tlg5J+DvovUHApWiZiHforyJt7boqqezdO2yWTpT6KuYVNJO8+o6Wk EaYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zrDSZ7Kl; 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 f1si264076pld.12.2019.08.14.10.09.36; Wed, 14 Aug 2019 10:09:53 -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=zrDSZ7Kl; 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 S1728764AbfHNRHI (ORCPT + 99 others); Wed, 14 Aug 2019 13:07:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:56430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728673AbfHNRHF (ORCPT ); Wed, 14 Aug 2019 13:07:05 -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 C74EC214DA; Wed, 14 Aug 2019 17:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802424; bh=CWxr3WGRiYKO8jNmPWHHP1v10oSJ3qpN97evaq9D0zg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zrDSZ7KltRK30z/U/mu6A54jYPsM+imMw+IGsRiKuaTu6mAV0LVOFjWFKOfhwhYbt ChbhXEq4G5ZyZNM/uS0r5MY5x+BbCHFCU8R+Z5zVA8ecHOO6Ko3LSBAG3LmmMyfGO7 ZgQDk4hGJ8FR1rg7zffhhsIrVayIlUa4e76/YnZw= 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 094/144] ALSA: compress: Dont allow paritial drain operations on capture streams Date: Wed, 14 Aug 2019 19:00:50 +0200 Message-Id: <20190814165803.810549781@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 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 40dae723c59db..6cf5b8440cf30 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -834,6 +834,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 */ @@ -861,6 +865,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