Skip to content

Commit

Permalink
crypto: caam - fix operator precedence in shared descriptor allocation
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
kimphill authored and herbertx committed Jun 29, 2011
1 parent 258e43f commit a18b989
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/crypto/caam/caamalg.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ static int build_sh_desc_ipsec(struct caam_ctx *ctx)

/* build shared descriptor for this session */
sh_desc = kmalloc(CAAM_CMD_SZ * DESC_AEAD_SHARED_TEXT_LEN +
keys_fit_inline ?
ctx->split_key_pad_len + ctx->enckeylen :
CAAM_PTR_SZ * 2, GFP_DMA | GFP_KERNEL);
(keys_fit_inline ?
ctx->split_key_pad_len + ctx->enckeylen :
CAAM_PTR_SZ * 2), GFP_DMA | GFP_KERNEL);
if (!sh_desc) {
dev_err(jrdev, "could not allocate shared descriptor\n");
return -ENOMEM;
Expand Down

0 comments on commit a18b989

Please sign in to comment.