alistair23-linux/drivers/dma
Prarit Bhargava 4ff2fd839c dmaengine: ioatdma: fix dma mapping errors
Several systems are showing the following stack trace:

WARNING: CPU: 0 PID: 2352 at lib/dma-debug.c:1140 check_unmap+0x4ee/0x9e0()
ioatdma 0000:00:04.0: DMA-API: device driver failed to check map error[device address=0x0000000465bad000] [size=4096 bytes] [mapped as page]
Modules linked in: ioatdma(E+) nfsv3 rpcsec_gss_krb5 nfsv4 dns_resolver nfs fscache cfg80211 rfkill x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm crct10dif_pclmul crc32_pclmul crc32c_intel cdc_ether ses ghash_clmulni_intel usbnet mii enclosure aesni_intel lrw gf128mul glue_helper iTCO_wdt shpchp ablk_helper iTCO_vendor_support cryptd pcspkr ipmi_devintf sb_edac lpc_ich edac_core mfd_core ipmi_si i2c_i801 wmi ipmi_msghandler nfsd auth_rpcgss nfs_acl lockd sunrpc xfs libcrc32c sd_mod crc_t10dif crct10dif_common mgag200 syscopyarea sysfillrect sysimgblt drm_kms_helper ttm igb drm ptp pps_core dca i2c_algo_bit i2ccore megaraid_sas dm_mirror dm_region_hash dm_log dm_mod [last unloaded: ioatdma]
CPU: 0 PID: 2352 Comm: insmod Tainted: G            E  3.17.0-rc4+ #14
Hardware name: HP ProLiant m300 Server Cartridge/, BIOS H02 01/30/2014
 0000000000000009 ffff88007994b7d8 ffffffff816e7225 ffff88007994b820
 ffff88007994b810 ffffffff8107e51d ffff88045fc56c00 ffff88046643ee90
 ffffffff8338ccd0 0000000000000286 ffffffff81956629 ffff88007994b870
Call Trace:
 [<ffffffff816e7225>] dump_stack+0x4d/0x66
 [<ffffffff8107e51d>] warn_slowpath_common+0x7d/0xa0
 [<ffffffff8107e58c>] warn_slowpath_fmt+0x4c/0x50
 [<ffffffff81381e6e>] check_unmap+0x4ee/0x9e0
 [<ffffffff813823bf>] debug_dma_unmap_page+0x5f/0x70
 [<ffffffffa04546d8>] ioat_xor_val_self_test+0x498/0xcf0 [ioatdma]
 [<ffffffff81204f0a>] ? kfree+0xda/0x2b0
 [<ffffffffa044d510>] ? ioat_dma_setup_interrupts+0x120/0x2d0 [ioatdma]
 [<ffffffffa0454f4e>] ioat3_dma_self_test+0x1e/0x30 [ioatdma]
 [<ffffffffa044f904>] ioat_probe+0xf4/0x110 [ioatdma]
 [<ffffffffa04550f8>] ioat3_dma_probe+0x198/0x3a0 [ioatdma]
 [<ffffffffa044d18e>] ioat_pci_probe+0x11e/0x1b0 [ioatdma]
 [<ffffffff81393a15>] local_pci_probe+0x45/0xa0
 [<ffffffff81394be5>] ? pci_match_device+0xe5/0x110
 [<ffffffff81394d29>] pci_device_probe+0xd9/0x130
 [<ffffffff81462860>] driver_probe_device+0x90/0x3c0
 [<ffffffff81462c63>] __driver_attach+0x93/0xa0
 [<ffffffff81462bd0>] ? __device_attach+0x40/0x40
 [<ffffffff8146080b>] bus_for_each_dev+0x6b/0xb0
 [<ffffffff814622ce>] driver_attach+0x1e/0x20
 [<ffffffff81461ed8>] bus_add_driver+0x188/0x260
 [<ffffffffa0423000>] ? 0xffffffffa0423000
 [<ffffffff81463734>] driver_register+0x64/0xf0
 [<ffffffff813933a0>] __pci_register_driver+0x60/0x70
 [<ffffffffa0423089>] ioat_init_module+0x89/0x1000 [ioatdma]
 [<ffffffff8100212c>] do_one_initcall+0xbc/0x200
 [<ffffffff811e8b22>] ? __vunmap+0xd2/0x120
 [<ffffffff8111e73c>] load_module+0x14ec/0x1b50
 [<ffffffff81119970>] ? store_uevent+0x40/0x40
 [<ffffffff8111ef36>] SyS_finit_module+0x86/0xb0
 [<ffffffff816f1469>] system_call_fastpath+0x16/0x1b
---[ end trace 1052ccbbc3db4d08 ]---
Mapped at:
 [<ffffffff81380be1>] debug_dma_map_page+0x91/0x140
 [<ffffffffa045440e>] ioat_xor_val_self_test+0x1ce/0xcf0 [ioatdma]
 [<ffffffffa0454f4e>] ioat3_dma_self_test+0x1e/0x30 [ioatdma]
 [<ffffffffa044f904>] ioat_probe+0xf4/0x110 [ioatdma]
 [<ffffffffa04550f8>] ioat3_dma_probe+0x198/0x3a0 [ioatdma]

This happens because the current ioatdma DMA test code does not check the return
value of dma_map_page() calls with dma_mapping_error().  In addition, it was
noticed that mapping for the variable dest_dma is free'd before the last use.

This patch fixes these errors by initializing the dma_srcs[] array and checking
the returns with dma_mapping_error().

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-12-09 14:52:05 +05:30
..
bestcomm
dw dmaengine: dw: export probe()/remove() and Co to users 2014-10-15 20:31:05 +05:30
ioat dmaengine: ioatdma: fix dma mapping errors 2014-12-09 14:52:05 +05:30
ipu dmaengine: ipu: use return value of request_irq 2014-07-25 15:39:50 +05:30
ppc4xx
sh dmaengine: shdma: fix a race condition in __ld_cleanup() 2014-11-17 13:50:42 +05:30
xilinx dmaengine: xilinx: vdma: icg should be difference of stride and hsize 2014-11-06 13:11:47 +05:30
acpi-dma.c
amba-pl08x.c dmaengine: pl08x: Remove chancnt affectations 2014-11-06 11:32:44 +05:30
at_hdmac.c dma: at_hdmac: fix invalid remaining bytes detection 2014-08-07 21:52:27 +05:30
at_hdmac_regs.h
at_xdmac.c dmaengine: at_xdmac: Add DMA_PRIVATE 2014-11-17 14:07:21 +05:30
bcm2835-dma.c dmaengine: Remove .owner field for driver 2014-11-06 11:54:18 +05:30
coh901318.c dmaengine: coh901318: use dmaengine_terminate_all() API 2014-10-15 21:30:59 +05:30
coh901318.h
coh901318_lli.c
cppi41.c dma: cppi41: add a delay while setting the TD bit 2014-12-09 14:45:41 +05:30
dma-jz4740.c dmaengine: Remove .owner field for driver 2014-11-06 11:54:18 +05:30
dmaengine.c dmaengine-3.17 2014-10-07 20:39:25 -04:00
dmaengine.h
dmatest.c dmaengine-3.17 2014-10-07 20:39:25 -04:00
edma.c dmaengine: edma: check for echan->edesc => NULL in edma_dma_pause() 2014-10-15 20:55:04 +05:30
ep93xx_dma.c dmaengine: Remove the context argument to the prep_dma_cyclic operation 2014-08-04 13:41:50 +05:30
fsl-edma.c dmaengine: fsl-edma: fixup reg offset and hw S/G support in big-endian model 2014-12-09 14:41:58 +05:30
fsldma.c dmaengine: fsldma: Remove chancnt affectations 2014-11-06 11:32:45 +05:30
fsldma.h dmaengine: Freescale: change descriptor release process for supporting async_tx 2014-07-14 21:32:18 +05:30
imx-dma.c dmaengine: Remove the context argument to the prep_dma_cyclic operation 2014-08-04 13:41:50 +05:30
imx-sdma.c dma: imx-sdma: clarify about firmware not found error 2014-12-05 23:18:53 +05:30
intel_mid_dma.c
intel_mid_dma_regs.h
iop-adma.c dmaengine: Remove .owner field for driver 2014-11-06 11:54:18 +05:30
k3dma.c dmaengine: k3dma: Add CONFIG_PM_SLEEP to suspend/resume functions 2014-11-17 13:50:45 +05:30
Kconfig Merge branch 'topic/at_xdmac' into for-linus 2014-12-05 19:31:32 +05:30
Makefile dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver 2014-11-06 11:00:08 +05:30
mic_x100_dma.c dma: MIC X100 DMA Driver 2014-07-12 09:57:42 -07:00
mic_x100_dma.h dma: MIC X100 DMA Driver 2014-07-12 09:57:42 -07:00
mmp_pdma.c dmaengine: Remove .owner field for driver 2014-11-06 11:54:18 +05:30
mmp_tdma.c dmaengine: Remove .owner field for driver 2014-11-06 11:54:18 +05:30
moxart-dma.c
mpc512x_dma.c dmaengine: Remove .owner field for driver 2014-11-06 11:54:18 +05:30
mv_xor.c Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2014-10-18 18:11:04 -07:00
mv_xor.h dma: mv_xor: Add support for DMA_INTERRUPT 2014-09-23 20:17:01 +05:30
mxs-dma.c dmaengine: Remove the context argument to the prep_dma_cyclic operation 2014-08-04 13:41:50 +05:30
nbpfaxi.c dmaengine: Remove .owner field for driver 2014-11-06 11:54:18 +05:30
of-dma.c dmaengine: of: add common xlate function for matching by channel id 2014-07-26 00:21:41 +05:30
omap-dma.c dmaengine: omap: Remove chancnt affectations 2014-11-06 11:32:45 +05:30
pch_dma.c drivers/dma/pch_dma: declare pch_dma_id_table as static 2014-12-05 23:28:30 +05:30
pl330.c dmaengine: pl330: update author info 2014-12-05 21:04:22 +05:30
qcom_bam_dma.c dmaengine: qcom_bam_dma: Add BAM v1.3.0 support 2014-11-17 13:50:40 +05:30
s3c24xx-dma.c dmaengine: Remove .owner field for driver 2014-11-06 11:54:18 +05:30
sa11x0-dma.c dmaengine: sa11x0: Remove chancnt affectations 2014-11-06 11:32:45 +05:30
sirf-dma.c dmaengine: sirf: Add CONFIG_PM_SLEEP to suspend/resume functions 2014-11-17 13:50:44 +05:30
ste_dma40.c dmaengine: ste_dma40: fix error return code 2014-12-05 23:25:48 +05:30
ste_dma40_ll.c
ste_dma40_ll.h
sun6i-dma.c dmaengine: sun6i: Add support for Allwinner A23 (sun8i) variant 2014-11-17 13:50:37 +05:30
tegra20-apb-dma.c dmaengine: Remove .owner field for driver 2014-11-06 11:54:18 +05:30
timb_dma.c dmaengine: Remove .owner field for driver 2014-11-06 11:54:18 +05:30
TODO dmaengine: dw: don't perform DMA when dmaengine_submit is called 2014-07-15 22:14:30 +05:30
txx9dmac.c
txx9dmac.h
virt-dma.c
virt-dma.h