Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp802907imu; Tue, 11 Dec 2018 07:50:05 -0800 (PST) X-Google-Smtp-Source: AFSGD/XfZPzGSFOpQ/yE4TjBwgHpr5VS8i0kZsrepVsdNydRIcWdrtLwQ9n4pKYUbqIT4ux+mgi9 X-Received: by 2002:a63:d005:: with SMTP id z5mr15097452pgf.64.1544543405343; Tue, 11 Dec 2018 07:50:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544543405; cv=none; d=google.com; s=arc-20160816; b=IvF+UfPTi8f9IyxBu/wJ2L1nRoE08SloMH1arrdYrbhKy0yhmInaunytSWLMZaRX0S PP8jggA2yq1rcGw54IRs4uHw+QeQTedG8pL2Da2rEvynTpKPKJlXAcsTFQgXgp/OjHma nkR9v+wD37QCnH6q4dwqZrAW5NX/kacJ/CggLUEb0/nEKKTvE2FYKOBhtyODmV6drREc 8TUtHNxNabKfTm9iAwLwm/iAQJuH2oxOdzgXu+gcgPndmPiIXxTv6kn0pTGbeDS1Krvd X/POr+L5lcbrZwiPdO6P6QABQQ7VO0FoSsasc8GpWQlLR16dM8QlOt8BTHwPf7KBBrxW h1Bg== 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=StLqRULtw98jTBAdnnXUTqGGL1wcehPOlozbb0CNSjQ=; b=y62V5BDkByFDYL4avsMulZRSoDCt7RWIfZJZiVMxD1a/mSZlHBWejjhd5LdrTkIAoX ufx8uikoCj7jZdjGiEmVhHAfNnKVGSVuPhh8sTCwn+JqCowjSPtncLCJRY2gldnBFt1X 563+i5mjnlwytiEhHVLAvSlhsQDjthIHI21E6GN99bSywD8pWJWkldr18BCpGD4KJZmN 0J2cOxFhgNHwbfFKwKB4Bw6cURP2f6zmCJQKLBtV1/tGYgd/sCsjecz+SfsQAPrtpw86 VxEaOZq/kcJy4OF0ORU6djCuZwZ/sI/IxNz7dVqCTOzkiQbcNogLfDN669hAXr/8E/Oz 2/Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pGPmnsOH; 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 q25si11812152pgv.541.2018.12.11.07.49.50; Tue, 11 Dec 2018 07:50:05 -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=pGPmnsOH; 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 S1728735AbeLKPsH (ORCPT + 99 others); Tue, 11 Dec 2018 10:48:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:36430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728704AbeLKPsD (ORCPT ); Tue, 11 Dec 2018 10:48:03 -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 38E0B20989; Tue, 11 Dec 2018 15:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543282; bh=Kz3+WUAT4gCSf3elBhma4r/rs7IpNZINdIYZJ25Q12U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pGPmnsOHYxGcFoQYkIM6uGoF85p6VuIgrL2R8cLzEMSd0CbeoAfgvgM0eK4eCJu1Y h+eA/AvmzkwZXUmwqHfY9BDDTLYLlViDEcZezAodmeps02o/3sPKZqMYRKb0iE01QZ g9m7tDcMLgdTxV+DvpjRsyhrDuFF/9dejkKDMnxk= 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.4 81/91] dmaengine: cppi41: delete channel from pending list when stop channel Date: Tue, 11 Dec 2018 16:41:40 +0100 Message-Id: <20181211151613.281713570@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151606.026852373@linuxfoundation.org> References: <20181211151606.026852373@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.4-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 @@ -628,8 +628,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)