From 5703c826b758e0b33c998739af093879979315b8 Mon Sep 17 00:00:00 2001 From: Stephan Mueller Date: Sun, 30 Jul 2017 14:31:18 +0200 Subject: 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 Signed-off-by: Herbert Xu --- crypto/algif_skcipher.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crypto/algif_skcipher.c') 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; } -- cgit v1.2.3-70-g09d2