summaryrefslogtreecommitdiff
path: root/crypto/algif_aead.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2020-05-30 00:23:49 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-21 13:05:30 +0200
commit60259e04cf61df7c7696e7e9e3855488faf6638c (patch)
treed636f803c42aa8ad11aee57d266f868745aab08a /crypto/algif_aead.c
parent0f6c859f12a81750654641faf064a9faa8cf58ac (diff)
downloadlinux-crypto-60259e04cf61df7c7696e7e9e3855488faf6638c.tar.gz
linux-crypto-60259e04cf61df7c7696e7e9e3855488faf6638c.zip
crypto: algif_aead - Only wake up when ctx->more is zero
[ Upstream commit a52eb0489f96f7318fce6b1afe1cabd46c750746 ] AEAD does not support partial requests so we must not wake up while ctx->more is set. In order to distinguish between the case of no data sent yet and a zero-length request, a new init flag has been added to ctx. SKCIPHER has also been modified to ensure that at least a block of data is available if there is more data to come. Fixes: c1b1fa586429 ("crypto: af_alg - consolidation of...") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'crypto/algif_aead.c')
-rw-r--r--crypto/algif_aead.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c
index 0ae000a6..d48d2156 100644
--- a/crypto/algif_aead.c
+++ b/crypto/algif_aead.c
@@ -106,8 +106,8 @@ static int _aead_recvmsg(struct socket *sock, struct msghdr *msg,
size_t usedpages = 0; /* [in] RX bufs to be used from user */
size_t processed = 0; /* [in] TX bufs to be consumed */
- if (!ctx->used) {
- err = af_alg_wait_for_data(sk, flags);
+ if (!ctx->init || ctx->more) {
+ err = af_alg_wait_for_data(sk, flags, 0);
if (err)
return err;
}