Skip to content

Commit

Permalink
crypto: algif_skcipher - sendmsg SG marking is off by one
Browse files Browse the repository at this point in the history
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: [email protected]
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Jan 20, 2016
1 parent fd7f672 commit 202736d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/algif_skcipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg,

sgl = list_entry(ctx->tsgl.prev, struct skcipher_sg_list, list);
sg = sgl->sg;
sg_unmark_end(sg + sgl->cur);
if (sgl->cur)
sg_unmark_end(sg + sgl->cur - 1);
do {
i = sgl->cur;
plen = min_t(size_t, len, PAGE_SIZE);
Expand Down

0 comments on commit 202736d

Please sign in to comment.