提交 5703c826 编写于 作者: S Stephan Mueller 提交者: Herbert Xu

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: NStephan Mueller <smueller@chronox.de>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 5060ffc9
...@@ -791,9 +791,11 @@ static int aead_recvmsg(struct socket *sock, struct msghdr *msg, ...@@ -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 * only handle one AIO request. If the caller wants to have
* multiple AIO requests in parallel, he must make multiple * multiple AIO requests in parallel, he must make multiple
* separate AIO calls. * separate AIO calls.
*
* Also return the error if no data has been processed so far.
*/ */
if (err <= 0) { if (err <= 0) {
if (err == -EIOCBQUEUED || err == -EBADMSG) if (err == -EIOCBQUEUED || err == -EBADMSG || !ret)
ret = err; ret = err;
goto out; goto out;
} }
......
...@@ -714,9 +714,11 @@ static int skcipher_recvmsg(struct socket *sock, struct msghdr *msg, ...@@ -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 * only handle one AIO request. If the caller wants to have
* multiple AIO requests in parallel, he must make multiple * multiple AIO requests in parallel, he must make multiple
* separate AIO calls. * separate AIO calls.
*
* Also return the error if no data has been processed so far.
*/ */
if (err <= 0) { if (err <= 0) {
if (err == -EIOCBQUEUED) if (err == -EIOCBQUEUED || !ret)
ret = err; ret = err;
goto out; goto out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册