Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: dmatest: Abort test in case of mapping error

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 <dan.j.williams@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Andy Shevchenko and committed by
Vinod Koul
6454368a 6d66c8d1

+14 -18
+14 -18
drivers/dma/dmatest.c
··· 711 711 srcs[i] = um->addr[i] + src_off; 712 712 ret = dma_mapping_error(dev->dev, um->addr[i]); 713 713 if (ret) { 714 - dmaengine_unmap_put(um); 715 714 result("src mapping error", total_tests, 716 715 src_off, dst_off, len, ret); 717 - failed_tests++; 718 - continue; 716 + goto error_unmap_continue; 719 717 } 720 718 um->to_cnt++; 721 719 } ··· 728 730 DMA_BIDIRECTIONAL); 729 731 ret = dma_mapping_error(dev->dev, dsts[i]); 730 732 if (ret) { 731 - dmaengine_unmap_put(um); 732 733 result("dst mapping error", total_tests, 733 734 src_off, dst_off, len, ret); 734 - failed_tests++; 735 - continue; 735 + goto error_unmap_continue; 736 736 } 737 737 um->bidi_cnt++; 738 738 } ··· 758 762 } 759 763 760 764 if (!tx) { 761 - dmaengine_unmap_put(um); 762 765 result("prep error", total_tests, src_off, 763 766 dst_off, len, ret); 764 767 msleep(100); 765 - failed_tests++; 766 - continue; 768 + goto error_unmap_continue; 767 769 } 768 770 769 771 done->done = false; ··· 770 776 cookie = tx->tx_submit(tx); 771 777 772 778 if (dma_submit_error(cookie)) { 773 - dmaengine_unmap_put(um); 774 779 result("submit error", total_tests, src_off, 775 780 dst_off, len, ret); 776 781 msleep(100); 777 - failed_tests++; 778 - continue; 782 + goto error_unmap_continue; 779 783 } 780 784 dma_async_issue_pending(chan); 781 785 ··· 782 790 783 791 status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); 784 792 785 - dmaengine_unmap_put(um); 786 - 787 793 if (!done->done) { 788 794 result("test timed out", total_tests, src_off, dst_off, 789 795 len, 0); 790 - failed_tests++; 791 - continue; 796 + goto error_unmap_continue; 792 797 } else if (status != DMA_COMPLETE) { 793 798 result(status == DMA_ERROR ? 794 799 "completion error status" : 795 800 "completion busy status", total_tests, src_off, 796 801 dst_off, len, ret); 797 - failed_tests++; 798 - continue; 802 + goto error_unmap_continue; 799 803 } 804 + 805 + dmaengine_unmap_put(um); 800 806 801 807 if (params->noverify) { 802 808 verbose_result("test passed", total_tests, src_off, ··· 836 846 verbose_result("test passed", total_tests, src_off, 837 847 dst_off, len, 0); 838 848 } 849 + 850 + continue; 851 + 852 + error_unmap_continue: 853 + dmaengine_unmap_put(um); 854 + failed_tests++; 839 855 } 840 856 ktime = ktime_sub(ktime_get(), ktime); 841 857 ktime = ktime_sub(ktime, comparetime);