]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
crypto: algif - return error code when no data was processed
authorStephan Mueller <smueller@chronox.de>
Sun, 30 Jul 2017 12:31:18 +0000 (14:31 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 9 Aug 2017 12:17:50 +0000 (20:17 +0800)
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>
crypto/algif_aead.c
crypto/algif_skcipher.c

index 9755aac0fe26fea1634979b1a38f3e346d69bcc4..2de056c3139cf81be8d9dc2f5406d2ebf9fa8798 100644 (file)
@@ -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;
                }
index 968d094f0bcc03722ec8a9cd404aeced184e8529..ce3b5fba2279911f07ba68869dfe1ba1bdaa3beb 100644 (file)
@@ -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;
                }