summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2020-05-29 14:54:43 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-24 17:50:51 +0200
commit0eb6df1d44eff8edba3e1337ddab90e43e27a960 (patch)
tree87f6413d30526565694bd5780183b82ef408aa14
parentd448489e03a53a86a6c5c0fc4c0a282b3874e455 (diff)
downloadlinux-crypto-0eb6df1d44eff8edba3e1337ddab90e43e27a960.tar.gz
linux-crypto-0eb6df1d44eff8edba3e1337ddab90e43e27a960.zip
crypto: algif_skcipher - Cap recv SG list at ctx->used
commit 4c636c1916324c5e8d13479b52f21f5152af2742 upstream. Somewhere along the line the cap on the SG list length for receive was lost. This patch restores it and removes the subsequent test which is now redundant. Fixes: c1b1fa586429 ("crypto: af_alg - consolidation of...") Cc: <stable@vger.kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Reviewed-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--crypto/algif_skcipher.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index e2c8ab40..4c3bdffe 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -74,14 +74,10 @@ static int _skcipher_recvmsg(struct socket *sock, struct msghdr *msg,
return PTR_ERR(areq);
/* convert iovecs of output buffers into RX SGL */
- err = af_alg_get_rsgl(sk, msg, flags, areq, -1, &len);
+ err = af_alg_get_rsgl(sk, msg, flags, areq, ctx->used, &len);
if (err)
goto free;
- /* Process only as much RX buffers for which we have TX data */
- if (len > ctx->used)
- len = ctx->used;
-
/*
* If more buffers are to be expected to be processed, process only
* full block size buffers.