Horia Geantă 944c3d4dca crypto: caam - fix state buffer DMA (un)mapping
If we register the DMA API debug notification chain to
receive platform bus events:
    dma_debug_add_bus(&platform_bus_type);
we start receiving warnings after a simple test like "modprobe caam_jr &&
modprobe caamhash && modprobe -r caamhash && modprobe -r caam_jr":
platform ffe301000.jr: DMA-API: device driver has pending DMA allocations while released from device [count=1938]
One of leaked entries details: [device address=0x0000000173fda090] [size=63 bytes] [mapped with DMA_TO_DEVICE] [mapped as single]

It turns out there are several issues with handling buf_dma (mapping of buffer
holding the previous chunk smaller than hash block size):
-detection of buf_dma mapping failure occurs too late, after a job descriptor
using that value has been submitted for execution
-dma mapping leak - unmapping is not performed in all places: for e.g.
in ahash_export or in most ahash_fin* callbacks (due to current back-to-back
implementation of buf_dma unmapping/mapping)

Fix these by:
-calling dma_mapping_error() on buf_dma right after the mapping and providing
an error code if needed
-unmapping buf_dma during the "job done" (ahash_done_*) callbacks

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2017-02-15 13:23:43 +08:00
..
2016-12-25 17:21:22 +01:00
2016-12-25 10:47:44 +01:00
2017-01-06 14:34:52 +01:00
2016-12-18 15:49:10 -08:00
2016-12-25 17:21:22 +01:00
2016-12-14 11:14:28 -08:00
2017-01-04 16:38:39 +01:00
2016-12-19 08:16:26 -08:00
2017-01-06 11:19:03 -08:00
2016-12-25 17:21:22 +01:00
2017-01-06 10:49:36 -08:00
2016-12-25 10:47:44 +01:00
2016-12-25 17:21:22 +01:00
2016-12-25 17:21:22 +01:00
2016-12-19 08:16:26 -08:00
2017-02-03 18:16:15 +08:00
2016-12-18 15:49:10 -08:00
2016-12-15 12:46:48 -08:00
2016-12-25 17:21:22 +01:00
2016-12-25 10:47:44 +01:00
2016-12-14 10:49:33 -08:00
2016-12-25 17:21:22 +01:00
2016-12-15 11:45:13 -08:00
2016-12-19 08:16:26 -08:00
2016-12-15 16:03:25 -08:00
2016-12-13 08:52:45 -08:00
2016-12-25 17:21:22 +01:00
2016-12-25 17:21:22 +01:00
2016-12-16 09:26:42 -08:00
2016-12-14 20:42:45 -08:00
2016-12-24 11:27:45 -08:00