From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 034DFC2BABC for ; Tue, 7 Apr 2020 06:04:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C79B02080C for ; Tue, 7 Apr 2020 06:04:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586239454; bh=cESVjNv8wDERqvJRgrWmpES3qp0fDrI8i1y53OkBYME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wtTctYuFH0yUx5KsqtKlIw6Z7JREaEW6xSxeW24hFRwyWoUfYcvg6UxseA5LT8jXW YZNKOuLmKIFL6AbuONbMD2caqIkeUqY+a9VTFiaPM01zXKhrB1UNRhFhKtNod5O0Z5 aOBWqMlc9x1wReHEiyxQBbAC+YnWQ3Dg3zmhy6Dg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726687AbgDGGEO (ORCPT ); Tue, 7 Apr 2020 02:04:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:34576 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725802AbgDGGEO (ORCPT ); Tue, 7 Apr 2020 02:04:14 -0400 Received: from sol.hsd1.ca.comcast.net (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4A1D72051A; Tue, 7 Apr 2020 06:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586239453; bh=cESVjNv8wDERqvJRgrWmpES3qp0fDrI8i1y53OkBYME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RPMDrS76dTeN3ibl4UBkEAH9iQzmcoFewH0QZtcCPI3A0TBk1bHgrH0ddnwZoGoYZ JsY+QUGXwlA5jHXrf/wmYPzzAF4yFEfBp6BdReDfG/UQ5FzexdbWkyr3eQ7sCr05DI 3re4wuLS45eiicgrcvZWTats1nCxHEEIWlYXB30A= From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: stable@vger.kernel.org, "Martin K . Petersen" Subject: [PATCH v2] crypto: algapi - Avoid spurious modprobe on LOADED Date: Mon, 6 Apr 2020 23:02:40 -0700 Message-Id: <20200407060240.175837-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200407051744.GA13037@gondor.apana.org.au> References: <20200407051744.GA13037@gondor.apana.org.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Eric Biggers Currently after any algorithm is registered and tested, there's an unnecessary request_module("cryptomgr") even if it's already loaded. Also, CRYPTO_MSG_ALG_LOADED is sent twice, and thus if the algorithm is "crct10dif", lib/crc-t10dif.c replaces the tfm twice rather than once. This occurs because CRYPTO_MSG_ALG_LOADED is sent using crypto_probing_notify(), which tries to load "cryptomgr" if the notification is not handled (NOTIFY_DONE). This doesn't make sense because "cryptomgr" doesn't handle this notification. Fix this by using crypto_notify() instead of crypto_probing_notify(). Fixes: dd8b083f9a5e ("crypto: api - Introduce notifier for new crypto algorithms") Cc: # v4.20+ Cc: Martin K. Petersen Signed-off-by: Eric Biggers --- crypto/algapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/algapi.c b/crypto/algapi.c index 69605e21af92..849254d7e627 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -403,7 +403,7 @@ static void crypto_wait_for_test(struct crypto_larval *larval) err = wait_for_completion_killable(&larval->completion); WARN_ON(err); if (!err) - crypto_probing_notify(CRYPTO_MSG_ALG_LOADED, larval); + crypto_notify(CRYPTO_MSG_ALG_LOADED, larval); out: crypto_larval_kill(&larval->alg); -- 2.26.0