Return-Path: Received: from omzsmtpe01.verizonbusiness.com ([199.249.25.210]:43024 "EHLO omzsmtpe01.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752263AbdLMBzm (ORCPT ); Tue, 12 Dec 2017 20:55:42 -0500 From: alexander.levin@verizon.com Cc: Christophe Jaillet , Herbert Xu , alexander.levin@verizon.com To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.14 09/60] crypto: lrw - Fix an error handling path in 'create()' Date: Wed, 13 Dec 2017 01:55:12 +0000 Message-ID: <20171213015455.6455-9-alexander.levin@verizon.com> References: <20171213015455.6455-1-alexander.levin@verizon.com> In-Reply-To: <20171213015455.6455-1-alexander.levin@verizon.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: Christophe Jaillet [ Upstream commit 616129cc6e75fb4da6681c16c981fa82dfe5e4c7 ] All error handling paths 'goto err_drop_spawn' except this one. In order to avoid some resources leak, we should do it as well here. Fixes: 700cb3f5fe75 ("crypto: lrw - Convert to skcipher") Signed-off-by: Christophe JAILLET Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- crypto/lrw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crypto/lrw.c b/crypto/lrw.c index a8bfae4451bf..eb681e9fe574 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c @@ -610,8 +610,10 @@ static int create(struct crypto_template *tmpl, struct= rtattr **tb) ecb_name[len - 1] =3D 0; =20 if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME, - "lrw(%s)", ecb_name) >=3D CRYPTO_MAX_ALG_NAME) - return -ENAMETOOLONG; + "lrw(%s)", ecb_name) >=3D CRYPTO_MAX_ALG_NAME) { + err =3D -ENAMETOOLONG; + goto err_drop_spawn; + } } =20 inst->alg.base.cra_flags =3D alg->base.cra_flags & CRYPTO_ALG_ASYNC; --=20 2.11.0