Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp825540imu; Tue, 11 Dec 2018 08:09:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/UceH/jjWJmt3RkqVrakhYg7H74+L1SKNXauNy3x+7aVi56YsdVOB9W08yZReFc9rotFC/p X-Received: by 2002:a62:3c1:: with SMTP id 184mr17039610pfd.56.1544544557161; Tue, 11 Dec 2018 08:09:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544544557; cv=none; d=google.com; s=arc-20160816; b=bSreTNfBwbvxxgM1LuWGf4F1dyOfoWV11Tpb4yUXIZ4CnKGEm1Y+W63mx1DOD2iDfi 8XSH4zRkwJXFfUIrMHgHBblT4mqTN+kWV3s/f56m8Mn9drMocmYeT00uiyv42cLyGOVg 4XDqMDAT3nKU6hsfeMIDKkqjO3JEhSeM822PjqeR7fr1iItGz51sDpcC4nzENC5SmnYm XiyRYGx8afr3ixM1hkD47K6T204HWQnXuvgKLgb/kGzA+NRFpyXuB5btdxREKX7KgUr4 25wCEC68ew1BGyoCgEDbMXv6tDNoZkmvNuZL5OrfU7D01wLP9H848UaiH2ZAWzjrRdUB rfqg== 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=/hmKyBNhgWkSvj/jsT6qQez/z0wqwiM/Ui15anQH20M=; b=C7rSdjTTU6d1hvMYNFLWzscmWCfqNDo+WsZnnA6CgGzhQgr8TOahe/C+LTRokA7b0l 9zsVxUQGW6kY6e0OR8YtBeUpoDteF4PxKXO7puzUxoyfGDKh5Js2W4eYk1RttWN7fAZk B4fgMzQdfn8vxIqVYF1HaK20nApX/2/uOCkJKWdAHnxx6dNCqGwGyG5u9hKjcrxVhKnA nn0pm/L9Ba1cT3S4Zfwxoj8w0b8lnCxBJ26KujJFFsJueXAeLyMAX1Drrw1DteVnKiyW GphF94jerdDXPrLwy2nNwPw2s2sl/vuumN+jvCTOxG/U++o7LoEJp6QGGmlss+MCaSqC cU4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oVTiJKSl; 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 c3si10627556pgi.370.2018.12.11.08.09.02; Tue, 11 Dec 2018 08:09:17 -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=oVTiJKSl; 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 S1730049AbeLKPyC (ORCPT + 99 others); Tue, 11 Dec 2018 10:54:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:42636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728117AbeLKPx7 (ORCPT ); Tue, 11 Dec 2018 10:53:59 -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 75CF320855; Tue, 11 Dec 2018 15:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543638; bh=8zTbsHwHUCj8Jm9rml+fBhopPS8d+Jj545p2/dKMaQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oVTiJKSlwcwfKwJs+byzKXyi/k5py0RPzdWKiz06UxZOvEdFv66OC/SiBhpalPmul oOOpYconF2IW1wDh01Edf3taTXGaLia5uhTb+qyDTQ9ZxZdqXx1qlV+/pUYI/5putf Z5vZd3GdlTBAnyyByea5CcJItfft/haGxEoq08Ao= 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 4.14 45/67] dmaengine: cppi41: delete channel from pending list when stop channel Date: Tue, 11 Dec 2018 16:41:45 +0100 Message-Id: <20181211151632.665406751@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151630.378216233@linuxfoundation.org> References: <20181211151630.378216233@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 4.14-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 @@ -723,8 +723,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)