linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: algif_skcipher - Cap recv SG list at ctx->used
@ 2020-05-29  4:54 Herbert Xu
  2020-05-29  6:06 ` Stephan Mueller
  2020-05-29 12:40 ` [PATCH] crypto: algif_skcipher - Do not perform zero-length ops Herbert Xu
  0 siblings, 2 replies; 5+ messages in thread
From: Herbert Xu @ 2020-05-29  4:54 UTC (permalink / raw)
  To: Linux Crypto Mailing List, Stephan Mueller

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: 2d97591ef43d ("crypto: af_alg - consolidation of...")
Cc: <stable@vger.kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index e2c8ab408bed..4c3bdffe0c3a 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.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-29 14:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29  4:54 [PATCH] crypto: algif_skcipher - Cap recv SG list at ctx->used Herbert Xu
2020-05-29  6:06 ` Stephan Mueller
2020-05-29 12:40 ` [PATCH] crypto: algif_skcipher - Do not perform zero-length ops Herbert Xu
2020-05-29 13:18   ` [PATCH] crypto: algif_aead - Only wake up when ctx->more is zero Herbert Xu
2020-05-29 14:23     ` [v2 PATCH] " Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).