summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2016-01-19 21:23:57 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2016-01-20 21:15:45 +0800
commit823be10916d86ed4ef1995bbddb4b0ee6571143a (patch)
treed9f2ccedbf0560133bdc4018632c412436cc986e
parent0a9e44e9ab8d7640b9792ac6bebe640cc607318b (diff)
downloadlinux-crypto-823be10916d86ed4ef1995bbddb4b0ee6571143a.tar.gz
linux-crypto-823be10916d86ed4ef1995bbddb4b0ee6571143a.zip
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: a57d5b404077 ("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>
-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 df86fb47..a81c10fa 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,
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);