Return-Path: Received: from mail-by2nam01on0139.outbound.protection.outlook.com ([104.47.34.139]:60384 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754793AbeARVA3 (ORCPT ); Thu, 18 Jan 2018 16:00:29 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: "Wang, Rui Y" , Herbert Xu , Sasha Levin Subject: [added to the 4.1 stable tree] crypto: cryptd - Assign statesize properly Date: Thu, 18 Jan 2018 20:59:50 +0000 Message-ID: <20180118205908.3220-51-alexander.levin@microsoft.com> References: <20180118205908.3220-1-alexander.levin@microsoft.com> In-Reply-To: <20180118205908.3220-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: "Wang, Rui Y" This patch has been added to the stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 1a07834024dfca5c4bed5de8f8714306e0a11836 ] cryptd_create_hash() fails by returning -EINVAL. It is because after 8996eafdc ("crypto: ahash - ensure statesize is non-zero") all ahash drivers must have a non-zero statesize. This patch fixes the problem by properly assigning the statesize. Signed-off-by: Rui Wang Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- crypto/cryptd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/crypto/cryptd.c b/crypto/cryptd.c index 34e4dfafb94f..66c9e8262572 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c @@ -633,6 +633,7 @@ static int cryptd_create_hash(struct crypto_template *t= mpl, struct rtattr **tb, inst->alg.halg.base.cra_flags =3D type; =20 inst->alg.halg.digestsize =3D salg->digestsize; + inst->alg.halg.statesize =3D salg->statesize; inst->alg.halg.base.cra_ctxsize =3D sizeof(struct cryptd_hash_ctx); =20 inst->alg.halg.base.cra_init =3D cryptd_hash_init_tfm; --=20 2.11.0