Commit 7b2a18e0 authored by Tadeusz Struk's avatar Tadeusz Struk Committed by Herbert Xu

crypto: algif_aead - fix invalid sgl linking

This patch fixes it.
Also minor updates to comments.
Signed-off-by: default avatarTadeusz Struk <tadeusz.struk@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent ec59a65d
...@@ -33,7 +33,7 @@ struct aead_ctx { ...@@ -33,7 +33,7 @@ struct aead_ctx {
/* /*
* RSGL_MAX_ENTRIES is an artificial limit where user space at maximum * RSGL_MAX_ENTRIES is an artificial limit where user space at maximum
* can cause the kernel to allocate RSGL_MAX_ENTRIES * ALG_MAX_PAGES * can cause the kernel to allocate RSGL_MAX_ENTRIES * ALG_MAX_PAGES
* bytes * pages
*/ */
#define RSGL_MAX_ENTRIES ALG_MAX_PAGES #define RSGL_MAX_ENTRIES ALG_MAX_PAGES
struct af_alg_sgl rsgl[RSGL_MAX_ENTRIES]; struct af_alg_sgl rsgl[RSGL_MAX_ENTRIES];
...@@ -435,11 +435,10 @@ static int aead_recvmsg(struct socket *sock, struct msghdr *msg, size_t ignored, ...@@ -435,11 +435,10 @@ static int aead_recvmsg(struct socket *sock, struct msghdr *msg, size_t ignored,
if (err < 0) if (err < 0)
goto unlock; goto unlock;
usedpages += err; usedpages += err;
/* chain the new scatterlist with initial list */ /* chain the new scatterlist with previous one */
if (cnt) if (cnt)
scatterwalk_crypto_chain(ctx->rsgl[0].sg, af_alg_link_sg(&ctx->rsgl[cnt-1], &ctx->rsgl[cnt]);
ctx->rsgl[cnt].sg, 1,
sg_nents(ctx->rsgl[cnt-1].sg));
/* we do not need more iovecs as we have sufficient memory */ /* we do not need more iovecs as we have sufficient memory */
if (outlen <= usedpages) if (outlen <= usedpages)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment