Received: by 10.223.185.116 with SMTP id b49csp2184581wrg; Thu, 15 Feb 2018 07:47:13 -0800 (PST) X-Google-Smtp-Source: AH8x224KPFEHGblKbtteYhq1wRmGsTu0yQ6QzPTudYZ1fxdjrYWmjXAjgedqVYsK8Q5iqF1vSQxi X-Received: by 10.167.130.193 with SMTP id f1mr2977185pfn.241.1518709633235; Thu, 15 Feb 2018 07:47:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518709633; cv=none; d=google.com; s=arc-20160816; b=g1Pm4kpIAxemYkZSBa1otkFXPcwE8UGONwL+4+w33s+4S/efX4cH9LNzUMUGCv31zR 9QxfOKZyLt0Q/C2zddSBcxnEHXEDC7TNCnUI2tZGCinEeOFd8JZrjyZ/3YrLy3P2JQJZ 5c6P5emc2xBGqSssuJ5bSjbXyrfi2TJrfm8jTLMlCV1X4VB+tNP7Lz7PAD9h0oJwk6gs QZY1agGs6ZfSto15UrRlnIXr19H2JFhpjzkbimOZBprjPVHU0eMTFekq5ZHFN3syi1QG EMTofZd1XNhAMs0wI/OAhaEifDY/ngPzCuv5B8o9rA45G8cQ2bWLU2/c0boYLPsbHXMz sRJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=/rHwnfegQDxwooiDjPkL3L3NpQqet5xELdzfPGOVQFk=; b=xtwF5sII7suT/HdejmBYYrzvoU5BWcT9vwy5/6tnEYtG8Ry/yxno1Xy6hF3/JiS/Bp eFt8IyHFrkyVH/M7N/T+LQCLGJ9UE/VANrlr6uLTFw0SbFq2xiEPRxQp0PKx/17lUWfY AgmjG+G2y6fBCRVkM1mqb142VtehX6Hb/LL7QJwP6UCjSjxM9HfdmrGiX2Kf4sQqQKSB ILJxokZ8/MgFLkZvBMpnkWNHaDBsheBBwCutu/O7cijlCC0FCOQeDUN4qPR8pSNMFoON Jiwc57GdZcFXvCHM2QnHvyEMVmnKoJFJEUQaRbmVaC+rGkhOHpK7Vahejbt6wFt0c2ux 37cQ== ARC-Authentication-Results: i=1; mx.google.com; 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 l6-v6si2277733pls.65.2018.02.15.07.46.58; Thu, 15 Feb 2018 07:47:13 -0800 (PST) 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; 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 S1424385AbeBOPpD (ORCPT + 99 others); Thu, 15 Feb 2018 10:45:03 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34766 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424368AbeBOPo7 (ORCPT ); Thu, 15 Feb 2018 10:44:59 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C3D3611B5; Thu, 15 Feb 2018 15:44:58 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown Subject: [PATCH 4.15 140/202] ASoC: compress: Correct handling of copy callback Date: Thu, 15 Feb 2018 16:17:20 +0100 Message-Id: <20180215151720.407230886@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Charles Keepax commit 290df4d3ab192821b66857c05346b23056ee9545 upstream. The soc_compr_copy callback is currently broken. Since the changes to move the compr_ops over to the component the return value is not correctly propagated, always returning zero on success rather than the number of bytes copied. This causes user-space to stall continuously reading as it does not believe it has received any data. Furthermore, the changes to move the compr_ops over to the component iterate through the list of components and will call the copy callback for any that have compressed ops. There isn't currently any consensus on the mechanism to combine the results of multiple copy callbacks. To fix this issue for now halt searching the component list when we locate a copy callback and return the result of that single callback. Additional work should probably be done to look at the other ops, tidy things up, and work out if we want to support multiple components on a single compressed, but this is the only fix required to get things working again. Fixes: 9e7e3738ab0e ("ASoC: snd_soc_component_driver has snd_compr_ops") Signed-off-by: Charles Keepax Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/soc-compress.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -944,7 +944,7 @@ static int soc_compr_copy(struct snd_com struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; - int ret = 0, __ret; + int ret = 0; mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); @@ -965,10 +965,10 @@ static int soc_compr_copy(struct snd_com !component->driver->compr_ops->copy) continue; - __ret = component->driver->compr_ops->copy(cstream, buf, count); - if (__ret < 0) - ret = __ret; + ret = component->driver->compr_ops->copy(cstream, buf, count); + break; } + err: mutex_unlock(&rtd->pcm_mutex); return ret;