diff options
author | Kim Phillips <kim.phillips@freescale.com> | 2011-05-25 23:30:34 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2011-06-29 19:43:27 -0400 |
commit | a18b989a5c12ca82ed37f94279273ddbc073758a (patch) | |
tree | 496c4c043d7712a52691cadf5df8025ab32a63c9 /drivers/crypto | |
parent | 258e43fdb00c73d424b114ae3850accd55b27cbb (diff) |
crypto: caam - fix operator precedence in shared descriptor allocation
setkey allocates 16 bytes (CAAM_CMD_SZ *
DESC_AEAD_SHARED_TEXT_LEN) shy of what is needed to
store the shared descriptor, resulting in memory
corruption. Fix this.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/caam/caamalg.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index d0e65d6ddc7..676d957c22b 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c | |||
@@ -238,9 +238,9 @@ static int build_sh_desc_ipsec(struct caam_ctx *ctx) | |||
238 | 238 | ||
239 | /* build shared descriptor for this session */ | 239 | /* build shared descriptor for this session */ |
240 | sh_desc = kmalloc(CAAM_CMD_SZ * DESC_AEAD_SHARED_TEXT_LEN + | 240 | sh_desc = kmalloc(CAAM_CMD_SZ * DESC_AEAD_SHARED_TEXT_LEN + |
241 | keys_fit_inline ? | 241 | (keys_fit_inline ? |
242 | ctx->split_key_pad_len + ctx->enckeylen : | 242 | ctx->split_key_pad_len + ctx->enckeylen : |
243 | CAAM_PTR_SZ * 2, GFP_DMA | GFP_KERNEL); | 243 | CAAM_PTR_SZ * 2), GFP_DMA | GFP_KERNEL); |
244 | if (!sh_desc) { | 244 | if (!sh_desc) { |
245 | dev_err(jrdev, "could not allocate shared descriptor\n"); | 245 | dev_err(jrdev, "could not allocate shared descriptor\n"); |
246 | return -ENOMEM; | 246 | return -ENOMEM; |