Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp940168imu; Tue, 11 Dec 2018 09:53:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/UEEW976NY8Z9t/zLAo0Plu+VzzQizehqbrSoTj1cAL9JwSH7hQ/z90t4kQpgZIe/bZi9Ri X-Received: by 2002:a17:902:9f89:: with SMTP id g9mr17045612plq.214.1544550839064; Tue, 11 Dec 2018 09:53:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544550839; cv=none; d=google.com; s=arc-20160816; b=m7fHJoYMxLYRcxkKGn6/cWifeqYxl+GiFDju+ibO1dfuOYQTMHz4Lz6VR+uvNX54GK 7DpUOZ23Pq6JVt20t82vhXq7PkSuSQTRLNgRyjjgmxGWdyX/fVM+aq7FIJVAF+uX8FX8 e8FMzaTjDUoiSCAb10s0u68GlmVSddrZGnP9ze+GuRK9nOx2ezoq1kdZpkbVqgSZGMGI FSZ9VJbSWnP+1tR9+7S2HAMdGVy80RhUI6a9ImkZIWsLOkYIEnXTAI21JCDWKOz8urEe Nc+Ty+BruXuLKQgRKyyuBdKvaEKsTTI/tyce6tG1hBu6tj5gOv8+gEKI1O3S3mTXOZvq 8LxQ== 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=vWVGp+InM8hKIABJzoiHzUsXQhcDNqiUnXIB9G9XwiU=; b=g0R4pN28Lj96EBxLvhNle1r69Pe3+mgNKNXVYQ393zicHJNi1d9zJDxrQJ0PWhK4rS rRC4FSBc9chWZw7nVtgK5AAXQDG4Cbb79p4W5FSpYg3CyZTqr20gZzn+FmNjRk3XN+bw K7CVn4t/v1oXMQISp/ejRWuxSUyv73ixAGTS0wIsL/F/EzIt/is8TLfQ1bAobNvnrFVB zvLp+GiJazovWvmyGOWYIAh/sc6ZaycqZ4HCp8L56RmjziDcmVLNh4VoAQn0Do0dzveA LHCDbzEEZ2O18YvuwRCuDk6+Xn8NcmXWvndIktT4r8BuERAcnbh+DMEICY9693CWb83E ezsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rggSmMzC; 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 y73si11935725pgd.478.2018.12.11.09.53.43; Tue, 11 Dec 2018 09:53:59 -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=rggSmMzC; 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 S1730811AbeLKP53 (ORCPT + 99 others); Tue, 11 Dec 2018 10:57:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:46446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730804AbeLKP50 (ORCPT ); Tue, 11 Dec 2018 10:57:26 -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 99554205C9; Tue, 11 Dec 2018 15:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543845; bh=mfmXeQ9V203s1wYaBVecf59+FMX6X5+BWLxGjccwS0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rggSmMzCSwdAOjWfTIWBzsZUzMyafAdw+KcjGlVLC+eogEo3Eczb38LhYhMkDbgEi hbEnFnoKsfEuOK/0zNXL1xv7MWNDwLNe3N80pmYg4M6nfD/SVrzyeDuBz6/F72gRJo iSy8hX7FxTYHCqRqfTMtWcab6hRkrbmitmPBLD9E= 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.19 087/118] dmaengine: cppi41: delete channel from pending list when stop channel Date: Tue, 11 Dec 2018 16:41:46 +0100 Message-Id: <20181211151647.780446772@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151644.216668863@linuxfoundation.org> References: <20181211151644.216668863@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.19-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/ti/cppi41.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) --- a/drivers/dma/ti/cppi41.c +++ b/drivers/dma/ti/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)