Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9132403pxu; Mon, 28 Dec 2020 07:25:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+AXi1kpFh7m6XeQ3oTQ4BchIOogahh68QPAfA+r+FIM4gI8wihZ/OEOtMBDssl/86RGxg X-Received: by 2002:a17:906:16da:: with SMTP id t26mr41653996ejd.478.1609169119026; Mon, 28 Dec 2020 07:25:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609169119; cv=none; d=google.com; s=arc-20160816; b=Mu4KZlBvQQ2A7wyoqAjRr1NzM/SA1tQQ88EkAc+97tRVzGjiLJNL/ZymISDxMT1brN 0QqgawnMCzIuoHCRbwPN70m1GrWpg3Ptt7pSeWndMCUNFrmrygAAU9KHS+ERpCP9BT46 nUIhO7jX3/LWKdtjzgxTpWR2UZVJyjl1I1gaJGHSopft/ueHCRx0AZOmUb/p7o1eMDF3 0GccG1s5NgfRKj8R3OWg2wUo5cOzSVe1zmVDxpuztQqgCS7WI6HLIEhOKzDhS6Z980+y qHTRaBTMn5bvyd+aOjgV7At9wflc3YwOo7Ds9WL0Oxl4J0ZbooWOEtZjDAsIarcBOjdM XyMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ESsqLxgWRum2EKKQWR5pM4mSEYktpvkOj0eX0U75unQ=; b=T8kqRL3ukCngKy80ZR9ztlkthVcoF+yl3Tb1eqEZUA2ywd0bVvw+ZTThC8Fhbowl4C CXXji8oy0qyEg+aB+EbOF2KNZdOBBgZ1UqJX4Q8t1TKuIoC2bQ5lNAcJ4BnhxDng8jvY JHekU02Fx6G9RUJQkJ7GV7BPLhyPZPz4k03r7u66tHntAQPksNTGnwML/JiHne+t+jiC 0yELrlW/mO/bDJVaCA1YcafE32ikPI9nelPq3u9Dgwr0JZ3AS6tyHSp/k2Wrqc6yWStF cy8cxQPAao4j9F5eZ3q6gVKD9kyGDXEpLtg7chq/OX9yYvco2GatDTgvTEifxYopAV6O 5ibw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lqfikORF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q12si20407336edb.395.2020.12.28.07.24.54; Mon, 28 Dec 2020 07:25:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lqfikORF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408193AbgL1PWO (ORCPT + 99 others); Mon, 28 Dec 2020 10:22:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:35988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436802AbgL1OCL (ORCPT ); Mon, 28 Dec 2020 09:02:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 79A5C2063A; Mon, 28 Dec 2020 14:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164091; bh=TEEd7bTuM56HNa5on8CU/w48O/UpN0M1Aj2uOPamqOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lqfikORFXV8Nn4Vfev/w9bcN6bktYc3PUvbm2mfITKhVGtRYBr+tk9MWe6T4QV7GD 0UAWmRQnIRYLVMdiqGXmyeddeZ3Q+vE5itZSJ+Km2Uc2/y1OvIk2AncHILvRvTC8vP EodDOZxLY/VFRN/V+gUroH+6sMLxqnSLPJIZ7WQo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Horia=20Geant=C4=83?= , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 057/717] crypto: arm/aes-neonbs - fix usage of cbc(aes) fallback Date: Mon, 28 Dec 2020 13:40:55 +0100 Message-Id: <20201228125023.727162921@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Horia Geantă [ Upstream commit a2715fbdc6fc387e85211df917a4778761ec693d ] Loading the module deadlocks since: -local cbc(aes) implementation needs a fallback and -crypto API tries to find one but the request_module() resolves back to the same module Fix this by changing the module alias for cbc(aes) and using the NEED_FALLBACK flag when requesting for a fallback algorithm. Fixes: 00b99ad2bac2 ("crypto: arm/aes-neonbs - Use generic cbc encryption path") Signed-off-by: Horia Geantă Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- arch/arm/crypto/aes-neonbs-glue.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/arm/crypto/aes-neonbs-glue.c b/arch/arm/crypto/aes-neonbs-glue.c index bda8bf17631e1..f70af1d0514b9 100644 --- a/arch/arm/crypto/aes-neonbs-glue.c +++ b/arch/arm/crypto/aes-neonbs-glue.c @@ -19,7 +19,7 @@ MODULE_AUTHOR("Ard Biesheuvel "); MODULE_LICENSE("GPL v2"); MODULE_ALIAS_CRYPTO("ecb(aes)"); -MODULE_ALIAS_CRYPTO("cbc(aes)"); +MODULE_ALIAS_CRYPTO("cbc(aes)-all"); MODULE_ALIAS_CRYPTO("ctr(aes)"); MODULE_ALIAS_CRYPTO("xts(aes)"); @@ -191,7 +191,8 @@ static int cbc_init(struct crypto_skcipher *tfm) struct aesbs_cbc_ctx *ctx = crypto_skcipher_ctx(tfm); unsigned int reqsize; - ctx->enc_tfm = crypto_alloc_skcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); + ctx->enc_tfm = crypto_alloc_skcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC | + CRYPTO_ALG_NEED_FALLBACK); if (IS_ERR(ctx->enc_tfm)) return PTR_ERR(ctx->enc_tfm); @@ -441,7 +442,8 @@ static struct skcipher_alg aes_algs[] = { { .base.cra_blocksize = AES_BLOCK_SIZE, .base.cra_ctxsize = sizeof(struct aesbs_cbc_ctx), .base.cra_module = THIS_MODULE, - .base.cra_flags = CRYPTO_ALG_INTERNAL, + .base.cra_flags = CRYPTO_ALG_INTERNAL | + CRYPTO_ALG_NEED_FALLBACK, .min_keysize = AES_MIN_KEY_SIZE, .max_keysize = AES_MAX_KEY_SIZE, -- 2.27.0