stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Steve Cornelius <steve.cornelius@freescale.com>,
	Victoria Milhoan <vicki.milhoan@freescale.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: [PATCH 3.10 1/5] crypto: caam - fix RNG buffer cache alignment
Date: Fri, 26 Jun 2015 18:08:24 -0700	[thread overview]
Message-ID: <20150627010806.397630010@linuxfoundation.org> (raw)
In-Reply-To: <20150627010806.352473049@linuxfoundation.org>

3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Steve Cornelius <steve.cornelius@freescale.com>

commit 412c98c1bef65fe7589f1300e93735d96130307c upstream.

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.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/crypto/caam/caamrng.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/crypto/caam/caamrng.c
+++ b/drivers/crypto/caam/caamrng.c
@@ -56,7 +56,7 @@
 
 /* Buffer, its dma address and lock */
 struct buf_data {
-	u8 buf[RN_BUF_SIZE];
+	u8 buf[RN_BUF_SIZE] ____cacheline_aligned;
 	dma_addr_t addr;
 	struct completion filled;
 	u32 hw_desc[DESC_JOB_O_LEN];



  reply	other threads:[~2015-06-27  1:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-27  1:08 [PATCH 3.10 0/5] 3.10.82-stable review Greg Kroah-Hartman
2015-06-27  1:08 ` Greg Kroah-Hartman [this message]
2015-06-27  1:08 ` [PATCH 3.10 2/5] tracing: Have filter check for balanced ops Greg Kroah-Hartman
2015-06-27  1:08 ` [PATCH 3.10 3/5] drm/mgag200: Reject non-character-cell-aligned mode widths Greg Kroah-Hartman
2015-06-27  1:08 ` [PATCH 3.10 4/5] pipe: iovec: Fix memory corruption when retrying atomic copy as non-atomic Greg Kroah-Hartman
2015-06-27  1:08 ` [PATCH 3.10 5/5] lpfc: Add iotag memory barrier Greg Kroah-Hartman
2015-06-27  3:12 ` [PATCH 3.10 0/5] 3.10.82-stable review Shuah Khan
2015-06-27  5:40 ` Guenter Roeck
2015-06-27  9:40 ` Sudip Mukherjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150627010806.397630010@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=steve.cornelius@freescale.com \
    --cc=vicki.milhoan@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).