Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1166200ybf; Thu, 27 Feb 2020 06:12:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwXKwso1gpkkLxegKOUXldlH1HclhZkVMUhtneolkTH2sTH4rofjqA4yQOCdDRLvJqGwh2H X-Received: by 2002:a05:6830:c7:: with SMTP id x7mr3385658oto.272.1582812759809; Thu, 27 Feb 2020 06:12:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582812759; cv=none; d=google.com; s=arc-20160816; b=nVCtFDS0O/NgkPxWEkFC3f1LHne4Muky+3+bUpctwhvFQL4Xu5G5C4wnR9xIero96S QG+ISPoNoWed2qRBfNrp4Yj/regyJJS+GqYet2y6g9gSJaKf5KzLi2y9Qc9YsP6FKLiG TAQ8TXzpJ+emeak0zCVgf4z9+tACHkYyBbCOz65ZmeQCh5so/SJ12oj3DTMz8VAJ0DwQ WGN7cJkOsx3pzLzohWKZCf8j+FEesVHntv78EScOAonj4agkt2u3yQvKzpuPxpvJlfKA mD2k/KRC0UNjmwrzPax7srAFNnOz/+hIzYmH5njkMnqTUKvlFlqcTEPsXSB1vw5YN/Jv PB5Q== 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=bsfk9JsCI7doO4e0XuyhF44bqWfUVbdDuIcfMyvBYoA=; b=o1XKM0cydaAikXdyqfSMNvBnxmTjoWAw/iRhyre7DJvxLh6lI+h4MmO00NAp9LIqmx 8un1/yUsRqAZhscoKQtjiZpzUmvdBc1CtChR0lFQ1O4NSHkIa5RNjRix2JrTGJoXRKac EkmAl0UTgUaMJ0/31w1Wb2XxXse1F5dAt3RNSQkVqgf1jz6ydLZHW1sARaENhU8OgYfH HTqm6o80I3hJNcce0d4RmmOiJDzbFoZpgW4ZJC7/G2tCzJo8+Z4oI81/ZDrvczsHJw/l cveXXlDyWMW5l8eIjngfS7I00yGkZk89PphIKSc1YOFIZc7mRW0Iv5MDwzErqMr66eV+ R9WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D+gZfRGB; 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 185si1427872oie.52.2020.02.27.06.12.27; Thu, 27 Feb 2020 06:12:39 -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=D+gZfRGB; 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 S2388621AbgB0OK7 (ORCPT + 99 others); Thu, 27 Feb 2020 09:10:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:49224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388278AbgB0OK4 (ORCPT ); Thu, 27 Feb 2020 09:10:56 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 2AEEA20714; Thu, 27 Feb 2020 14:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582812655; bh=RxtQpwXVCZ8kuPzuL7XmZtmGwiwVZKSh7yis6FrdueQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D+gZfRGBdEjcD5VhGQqgcEs+uFh6yycdWOcG0HzBQIIPGJheh+47Y1TtmlhQHvuTu XGo/W97CWRTT5wU1rntGBh5RrJ9SIkiVqOPeNcsd1ht3AFg1lzavLyxO+DkV3OQZ8K HUCkvmY8W/K/yg4I190Tmm+PKVPgIYm4Ptl3wr64= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Tobler , Sascha Hauer , Robin Gong , Vinod Koul , Sasha Levin Subject: [PATCH 5.4 100/135] Revert "dmaengine: imx-sdma: Fix memory leak" Date: Thu, 27 Feb 2020 14:37:20 +0100 Message-Id: <20200227132244.250294381@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132228.710492098@linuxfoundation.org> References: <20200227132228.710492098@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Greg Kroah-Hartman This reverts commit 8a7aa4feeaeabc12181e1997a298eb73d2ed2d65 which is commit 02939cd167095f16328a1bd5cab5a90b550606df upstream. Andreas writes: This patch breaks our imx6 board with the attached trace. Reverting the patch makes it boot again. Reported-by: Andreas Tobler Cc: Sascha Hauer Cc: Robin Gong Cc: Vinod Koul Cc: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/dma/imx-sdma.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -760,8 +760,12 @@ static void sdma_start_desc(struct sdma_ return; } sdmac->desc = desc = to_sdma_desc(&vd->tx); - - list_del(&vd->node); + /* + * Do not delete the node in desc_issued list in cyclic mode, otherwise + * the desc allocated will never be freed in vchan_dma_desc_free_list + */ + if (!(sdmac->flags & IMX_DMA_SG_LOOP)) + list_del(&vd->node); sdma->channel_control[channel].base_bd_ptr = desc->bd_phys; sdma->channel_control[channel].current_bd_ptr = desc->bd_phys; @@ -1067,6 +1071,7 @@ static void sdma_channel_terminate_work( spin_lock_irqsave(&sdmac->vc.lock, flags); vchan_get_all_descriptors(&sdmac->vc, &head); + sdmac->desc = NULL; spin_unlock_irqrestore(&sdmac->vc.lock, flags); vchan_dma_desc_free_list(&sdmac->vc, &head); sdmac->context_loaded = false; @@ -1075,19 +1080,11 @@ static void sdma_channel_terminate_work( static int sdma_disable_channel_async(struct dma_chan *chan) { struct sdma_channel *sdmac = to_sdma_chan(chan); - unsigned long flags; - - spin_lock_irqsave(&sdmac->vc.lock, flags); sdma_disable_channel(chan); - if (sdmac->desc) { - vchan_terminate_vdesc(&sdmac->desc->vd); - sdmac->desc = NULL; + if (sdmac->desc) schedule_work(&sdmac->terminate_worker); - } - - spin_unlock_irqrestore(&sdmac->vc.lock, flags); return 0; }