From: Herbert Xu herbert@gondor.apana.org.au
mainline inclusion from mainline-v5.9-rc1 commit 662bb52f50bca16a74fe92b487a14d7dccb85e1a category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I991GQ CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
Some user-space programs rely on crypto requests that have no control metadata. This broke when a check was added to require the presence of control metadata with the ctx->init flag.
This patch fixes the regression by setting ctx->init as long as one sendmsg(2) has been made, with or without a control message.
Reported-by: Sachin Sant sachinp@linux.vnet.ibm.com Reported-by: Naresh Kamboju naresh.kamboju@linaro.org Fixes: f3c802a1f300 ("crypto: algif_aead - Only wake up when...") Signed-off-by: Herbert Xu herbert@gondor.apana.org.au Signed-off-by: GUO Zihua guozihua@huawei.com --- crypto/af_alg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crypto/af_alg.c b/crypto/af_alg.c index 4a116f8ca842..4486db4c869a 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -868,6 +868,7 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size, err = -EINVAL; goto unlock; } + ctx->init = true;
if (init) { ctx->enc = enc; @@ -875,7 +876,6 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size, memcpy(ctx->iv, con.iv->iv, ivsize);
ctx->aead_assoclen = con.aead_assoclen; - ctx->init = true; }
while (size) {