Skip to content

Commit e51a363

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fix from Herbert Xu: "This fixes a the crash in the newly added algif_aead interface when it tries to link SG lists" * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: algif_aead - fix invalid sgl linking
2 parents 3d85412 + 7b2a18e commit e51a363

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

crypto/algif_aead.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct aead_ctx {
3333
/*
3434
* RSGL_MAX_ENTRIES is an artificial limit where user space at maximum
3535
* can cause the kernel to allocate RSGL_MAX_ENTRIES * ALG_MAX_PAGES
36-
* bytes
36+
* pages
3737
*/
3838
#define RSGL_MAX_ENTRIES ALG_MAX_PAGES
3939
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,
435435
if (err < 0)
436436
goto unlock;
437437
usedpages += err;
438-
/* chain the new scatterlist with initial list */
438+
/* chain the new scatterlist with previous one */
439439
if (cnt)
440-
scatterwalk_crypto_chain(ctx->rsgl[0].sg,
441-
ctx->rsgl[cnt].sg, 1,
442-
sg_nents(ctx->rsgl[cnt-1].sg));
440+
af_alg_link_sg(&ctx->rsgl[cnt-1], &ctx->rsgl[cnt]);
441+
443442
/* we do not need more iovecs as we have sufficient memory */
444443
if (outlen <= usedpages)
445444
break;

0 commit comments

Comments
 (0)