summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2016-01-19 08:23:57 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2016-01-20 08:15:45 -0500
commit202736d99b7f29279db9da61587f11a08a04a9c6 (patch)
tree7ec8d1d32fc795eb30a473580d861398454c3a26 /crypto
parentfd7f6727102a1ccf6b4c1dfcc631f9b546526b26 (diff)
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: 0f477b655a52 ("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>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/algif_skcipher.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index df86fb47c3ae..a81c10faf9c4 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -392,7 +392,8 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg,
392 392
393 sgl = list_entry(ctx->tsgl.prev, struct skcipher_sg_list, list); 393 sgl = list_entry(ctx->tsgl.prev, struct skcipher_sg_list, list);
394 sg = sgl->sg; 394 sg = sgl->sg;
395 sg_unmark_end(sg + sgl->cur); 395 if (sgl->cur)
396 sg_unmark_end(sg + sgl->cur - 1);
396 do { 397 do {
397 i = sgl->cur; 398 i = sgl->cur;
398 plen = min_t(size_t, len, PAGE_SIZE); 399 plen = min_t(size_t, len, PAGE_SIZE);