Skip to content

Commit 202736d

Browse files
committed
crypto: algif_skcipher - sendmsg SG marking is off by one
We mark the end of the SG list in sendmsg and sendpage and unmark it on the next send call. Unfortunately the unmarking in sendmsg is off-by-one, leading to an SG list that is too short. Fixes: 0f477b6 ("crypto: algif - Mark sgl end at the end of data") Cc: stable@vger.kernel.org Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent fd7f672 commit 202736d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎crypto/algif_skcipher.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,8 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg,
392392

393393
sgl = list_entry(ctx->tsgl.prev, struct skcipher_sg_list, list);
394394
sg = sgl->sg;
395-
sg_unmark_end(sg + sgl->cur);
395+
if (sgl->cur)
396+
sg_unmark_end(sg + sgl->cur - 1);
396397
do {
397398
i = sgl->cur;
398399
plen = min_t(size_t, len, PAGE_SIZE);

0 commit comments

Comments
 (0)