diff options
author | Stephan Mueller <smueller@chronox.de> | 2017-07-30 15:31:18 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-08-09 15:17:50 +0300 |
commit | 5703c826b758e0b33c998739af093879979315b8 (patch) | |
tree | 71296be72e8bcae1f539da6c212cdb24fbb98668 | |
parent | 5060ffc97bc6fdd31595b3ecbc027b0a8df94b5c (diff) | |
download | linux-5703c826b758e0b33c998739af093879979315b8.tar.xz |
crypto: algif - 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.
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/algif_aead.c | 4 | ||||
-rw-r--r-- | crypto/algif_skcipher.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c index 9755aac0fe26..2de056c3139c 100644 --- a/crypto/algif_aead.c +++ b/crypto/algif_aead.c @@ -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; } diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c index 968d094f0bcc..ce3b5fba2279 100644 --- a/crypto/algif_skcipher.c +++ b/crypto/algif_skcipher.c @@ -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; } |