]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: caam - fix RNG buffer cache alignment
authorSteve Cornelius <steve.cornelius@freescale.com>
Mon, 15 Jun 2015 23:52:59 +0000 (16:52 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 16 Jun 2015 06:20:38 +0000 (14:20 +0800)
commit0072c94d0c226293c4831fad9793453f2856ccf1
tree9c3fdce06977b37ace84d7f154ead430a00a43da
parente3347b38f6b63dc45321de8f83828eb3d6c42ce0
crypto: caam - fix RNG buffer cache alignment

The hwrng output buffers (2) are cast inside of a a struct (caam_rng_ctx)
allocated in one DMA-tagged region. While the kernel's heap allocator
should place the overall struct on a cacheline aligned boundary, the 2
buffers contained within may not necessarily align. Consenquently, the ends
of unaligned buffers may not fully flush, and if so, stale data will be left
behind, resulting in small repeating patterns.

This fix aligns the buffers inside the struct.

Note that not all of the data inside caam_rng_ctx necessarily needs to be
DMA-tagged, only the buffers themselves require this. However, a fix would
incur the expense of error-handling bloat in the case of allocation failure.

Cc: stable@vger.kernel.org
Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com>
Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/caam/caamrng.c