Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp842859imu; Tue, 11 Dec 2018 08:23:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/ULvIg12dywVDHAIH6VfVn6bvutEXu5s9f6Urk8jO7BiPf2Y2wJTF4i+qmMAjYNxeh/sgso X-Received: by 2002:a17:902:31a4:: with SMTP id x33mr16290804plb.41.1544545403453; Tue, 11 Dec 2018 08:23:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544545403; cv=none; d=google.com; s=arc-20160816; b=NSAEuBZuN3t+PKCXZnLz6J08rjvRAiRw7Vvm0mvjzsKspn5V5e3DgRUYi8wKlf5h3a aAOzV9ew9PlH4DaVl91U2ty/5wBnmNAmSQnmzjfZneC6f+Q0HB0Y0sONwOsahjSPkOfR KjCw3QYZxtWvmD4HEvpU3Vx4AkMOd9BaXtJg4dmoHojpKbTaMXT15h4WAX3hLPrvpjP4 2SoXQNs+pQE0HP4AdgF95Uys5VcQUrqbOIFkxyUG57DdCTK5ZroJzFOhI1sHM+PObSEh 3efFgZzAtee1WRA1fgL2h0yzHOZSgn9lql9eZ/ZPyspp3MsZdPwr2728Cqf89mkyhqDQ oQCg== 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=BB6v/SKboD+dG3PHCoNrYqNpF0414frKB92RyGPhYUo=; b=UOyuVL/otnkR8JR2xl9/ymKUlIbGPbfr4tGrvTLQle9JIdEtzccs/n4W0Tg9rR2+WV wT5lgOffaqJvT7FBsFebUqbZoS0YCwemDCsYjFTT9rtOfOOD/y/2BBwb97ZMet+mgwmP G/lXUYKNoJAiC5nKhV9sWWQVfeM/FwcwuJFwuyGwmx0EgGf1jrKgNsIyng7vlVTvmVdt xtmm7DbC0K4cgr0nANx4c7QuXW8+spXWRKzQ5ggMV58/Hb95F0He6ZDg+LtE6IKookgw 1oIpW2p0aRyLr7lLiU6eazf+OQNVteIwlZoELh6KhRme4hpSASNWBThnTiCFpwNExIx4 86fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KHCBvG57; 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 b24si11895069pgi.308.2018.12.11.08.23.08; Tue, 11 Dec 2018 08:23:23 -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; dkim=pass header.i=@kernel.org header.s=default header.b=KHCBvG57; 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 S1728581AbeLKQV3 (ORCPT + 99 others); Tue, 11 Dec 2018 11:21:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:32874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727202AbeLKPo3 (ORCPT ); Tue, 11 Dec 2018 10:44:29 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 88C872087F; Tue, 11 Dec 2018 15:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543069; bh=QnE5S8SbxaNWnqYXaQh0ZHg8Y3u8WEtubD5nuXvvz6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KHCBvG57hoKVcb1l0WqqVrX7H75RkfcVXPfZ9jqvPN2IhxwqLWW8DBTNuseMDPQr+ DdzUwllP3CIEIG26qHdUbYxjkZB7dcxee3b+w7wLa8n/w3YGaiiljnNssRwDUuGdWi kUxx3h41A5GGK8RbZUHVJdpzFztB9DM6bBrhrcNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bin Liu , Peter Ujfalusi , Vinod Koul Subject: [PATCH 3.18 48/54] dmaengine: cppi41: delete channel from pending list when stop channel Date: Tue, 11 Dec 2018 16:41:36 +0100 Message-Id: <20181211151548.757658735@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151546.010073210@linuxfoundation.org> References: <20181211151546.010073210@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bin Liu commit 59861547ec9a9736e7882f6fb0c096a720ff811a upstream. The driver defines three states for a cppi channel. - idle: .chan_busy == 0 && not in .pending list - pending: .chan_busy == 0 && in .pending list - busy: .chan_busy == 1 && not in .pending list There are cases in which the cppi channel could be in the pending state when cppi41_dma_issue_pending() is called after cppi41_runtime_suspend() is called. cppi41_stop_chan() has a bug for these cases to set channels to idle state. It only checks the .chan_busy flag, but not the .pending list, then later when cppi41_runtime_resume() is called the channels in .pending list will be transitioned to busy state. Removing channels from the .pending list solves the problem. Fixes: 975faaeb9985 ("dma: cppi41: start tear down only if channel is busy") Cc: stable@vger.kernel.org # v3.15+ Signed-off-by: Bin Liu Reviewed-by: Peter Ujfalusi Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/cppi41.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -629,8 +629,22 @@ static int cppi41_stop_chan(struct dma_c desc_phys = lower_32_bits(c->desc_phys); desc_num = (desc_phys - cdd->descs_phys) / sizeof(struct cppi41_desc); - if (!cdd->chan_busy[desc_num]) + if (!cdd->chan_busy[desc_num]) { + struct cppi41_channel *cc, *_ct; + + /* + * channels might still be in the pendling list if + * cppi41_dma_issue_pending() is called after + * cppi41_runtime_suspend() is called + */ + list_for_each_entry_safe(cc, _ct, &cdd->pending, node) { + if (cc != c) + continue; + list_del(&cc->node); + break; + } return 0; + } ret = cppi41_tear_down_chan(c); if (ret)