Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp578871img; Fri, 22 Mar 2019 04:26:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqw49Go6xRLzDXaLBhAJKs+4N12FCulTiuB9Mi2bDIzb8Ju2zhMR0Lgjt6cmSm09goT2gPcv X-Received: by 2002:a63:2106:: with SMTP id h6mr8309404pgh.441.1553253992285; Fri, 22 Mar 2019 04:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553253992; cv=none; d=google.com; s=arc-20160816; b=gvh7puTashUr7B8qkmA9NuDqTZxMrkq067gq/s9+Lrtx1JWSMDhU9kzTZobedTw9uA Vri+RuTtZeNLU9Ghy8zoXhCZBfmUCU043ddRdWQIuj1R3ZzBwNNypHqJKruYyLGBIY7G Bg6ci0tmZlyc8EeRn72yhBZcfts4iaQisfpcAlIEf/EcIH6fVvOy9/8Io8e9LNZEwCfL 8odiUciXSKF/lFgcFEN/DemkRm5Yg5wEwzO9WD+9tpWv5N+AcvPDra7PT5Taq1wB24oC hzmjAYSNRtkoFhpedwbewchMcZ1D6rxSoWHCq5PNp0GiFGUfX+Do1PolClGdjPrQaK7+ Xt8Q== 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=W2sVw4056j5UqnCskNEv0qG+mZSHAm7SEsahTtSL9ro=; b=EKOU8FRo0HcUdZFEF8HZ8pRE49bOH+CjH8ROOoJ/yDw2w9LKbAYoccR2F9k7khHgHv ja8DNSn/K6zGO7MM+K2dQxtIVU0lXZBEYe7H2Lo/UbGKUURToySF9gLyVxj5Wa/yj73e go0lkxqebdim4qV2JfS4PdF2hZdBAr3iTiOklAmIxT24SmnP+7DmxalFxjfn70mVMUOd 0Fh6APA7USVrEfHTsTU24noKRpaOhEmoLxauwL0P5lJlNIG3JwjxWdIifMc/mirQvJNC 55suF12sz6e22Gyovus/1lnnfTQxFokQZF0Wfximysu4iAEdHkqUyh5ZMXtxVY1HQ7IK IrmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Wdn9GsMe; 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 d11si6394229pgh.447.2019.03.22.04.26.14; Fri, 22 Mar 2019 04:26:32 -0700 (PDT) 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=Wdn9GsMe; 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 S1728393AbfCVLXT (ORCPT + 99 others); Fri, 22 Mar 2019 07:23:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:50164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728940AbfCVLXQ (ORCPT ); Fri, 22 Mar 2019 07:23:16 -0400 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 A670D21916; Fri, 22 Mar 2019 11:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253795; bh=3sd3lSGBDROPHNZyet3RDjUY0CSmmlX8kdF/Ugmvbao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wdn9GsMehEExPBNHr8fY4XvtuMjNRegxcb6tdedqn1ni+2VqMyGzao2Q6BzsqfYyL DevSkxBO3MOnqDPYZh9KGxLDzM5z8/iutEokr45Es6GrDYRs5s9cR07OwfIPyA7nep 2xbR/EnV5rLyzo/pX7GKAtIsz2X254leQNewVNQI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Williams , Andy Shevchenko , Vinod Koul , Sasha Levin Subject: [PATCH 3.18 074/134] dmaengine: dmatest: Abort test in case of mapping error Date: Fri, 22 Mar 2019 12:14:47 +0100 Message-Id: <20190322111215.431183917@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@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. ------------------ [ Upstream commit 6454368a804c4955ccd116236037536f81e5b1f1 ] In case of mapping error the DMA addresses are invalid and continuing will screw system memory or potentially something else. [ 222.480310] dmatest: dma0chan7-copy0: summary 1 tests, 3 failures 6 iops 349 KB/s (0) ... [ 240.912725] check: Corrupted low memory at 00000000c7c75ac9 (2940 phys) = 5656000000000000 [ 240.921998] check: Corrupted low memory at 000000005715a1cd (2948 phys) = 279f2aca5595ab2b [ 240.931280] check: Corrupted low memory at 000000002f4024c0 (2950 phys) = 5e5624f349e793cf ... Abort any test if mapping failed. Fixes: 4076e755dbec ("dmatest: convert to dmaengine_unmap_data") Cc: Dan Williams Signed-off-by: Andy Shevchenko Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/dmatest.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index a8d7809e2f4c..5495ba6cf452 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -548,11 +548,9 @@ static int dmatest_func(void *data) srcs[i] = um->addr[i] + src_off; ret = dma_mapping_error(dev->dev, um->addr[i]); if (ret) { - dmaengine_unmap_put(um); result("src mapping error", total_tests, src_off, dst_off, len, ret); - failed_tests++; - continue; + goto error_unmap_continue; } um->to_cnt++; } @@ -567,11 +565,9 @@ static int dmatest_func(void *data) DMA_BIDIRECTIONAL); ret = dma_mapping_error(dev->dev, dsts[i]); if (ret) { - dmaengine_unmap_put(um); result("dst mapping error", total_tests, src_off, dst_off, len, ret); - failed_tests++; - continue; + goto error_unmap_continue; } um->bidi_cnt++; } @@ -596,12 +592,10 @@ static int dmatest_func(void *data) } if (!tx) { - dmaengine_unmap_put(um); result("prep error", total_tests, src_off, dst_off, len, ret); msleep(100); - failed_tests++; - continue; + goto error_unmap_continue; } done.done = false; @@ -610,12 +604,10 @@ static int dmatest_func(void *data) cookie = tx->tx_submit(tx); if (dma_submit_error(cookie)) { - dmaengine_unmap_put(um); result("submit error", total_tests, src_off, dst_off, len, ret); msleep(100); - failed_tests++; - continue; + goto error_unmap_continue; } dma_async_issue_pending(chan); @@ -636,16 +628,14 @@ static int dmatest_func(void *data) dmaengine_unmap_put(um); result("test timed out", total_tests, src_off, dst_off, len, 0); - failed_tests++; - continue; + goto error_unmap_continue; } else if (status != DMA_COMPLETE) { dmaengine_unmap_put(um); result(status == DMA_ERROR ? "completion error status" : "completion busy status", total_tests, src_off, dst_off, len, ret); - failed_tests++; - continue; + goto error_unmap_continue; } dmaengine_unmap_put(um); @@ -684,6 +674,12 @@ static int dmatest_func(void *data) verbose_result("test passed", total_tests, src_off, dst_off, len, 0); } + + continue; + +error_unmap_continue: + dmaengine_unmap_put(um); + failed_tests++; } runtime = ktime_us_delta(ktime_get(), ktime); -- 2.19.1