Skip to contentSkip to conversation

crypto: AF_ALG - return error code when no data was processed

PATCH In review Stephan Müller 2 participants 2 messages Jul 30, 2017 – Aug 9, 2017 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: AF_ALG - return error code when no data was processed

If no data has been processed during recvmsg, return the error code. This covers all errors received during non-AIO operations.

If any error occurs during a synchronous operation in addition to -EIOCBQUEUED or -EBADMSG (like -ENOMEM), it should be relayed to the caller.

---
 crypto/algif_aead.c     | 4 +++-
 crypto/algif_skcipher.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
crypto/algif_aead.c +3 -1
index 9755aac0fe26..2de056c3139c 100644
@@ -791,9 +791,11 @@ static int aead_recvmsg(struct socket *sock, struct msghdr *msg,
 		 * only handle one AIO request. If the caller wants to have
 		 * multiple AIO requests in parallel, he must make multiple
 		 * separate AIO calls.
+		 *
+		 * Also return the error if no data has been processed so far.
 		 */
 		if (err <= 0) {
-			if (err == -EIOCBQUEUED || err == -EBADMSG)
+			if (err == -EIOCBQUEUED || err == -EBADMSG || !ret)
 				ret = err;
 			goto out;
 		}
crypto/algif_skcipher.c +3 -1
index 968d094f0bcc..ce3b5fba2279 100644
@@ -714,9 +714,11 @@ static int skcipher_recvmsg(struct socket *sock, struct msghdr *msg,
 		 * only handle one AIO request. If the caller wants to have
 		 * multiple AIO requests in parallel, he must make multiple
 		 * separate AIO calls.
+		 *
+		 * Also return the error if no data has been processed so far.
 		 */
 		if (err <= 0) {
-			if (err == -EIOCBQUEUED)
+			if (err == -EIOCBQUEUED || !ret)
 				ret = err;
 			goto out;
 		}
Signature · 1 line
2.13.3
maintainer
#1 lore raw
Quoted 8 lines · Stephan Müller

If no data has been processed during recvmsg, return the error code. This covers all errors received during non-AIO operations.

If any error occurs during a synchronous operation in addition to -EIOCBQUEUED or -EBADMSG (like -ENOMEM), it should be relayed to the caller.

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt