Re: crypto: algboss - Avoid spurious modprobe on LOADED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 07, 2020 at 01:00:03PM +1000, Herbert Xu wrote:
> As it stands when any algorithm finishes testing a notification
> is generated which triggers an unnecessary modprobe because algboss
> returns NOTIFY_DONE instead of NOTIFY_OK (this denotes an event
> that is not handled properly).
> 
> This patch changes the return value in algboss so that we don't
> do an unnecessary modprobe.
> 
> Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

Needs a Fixes tag?

Fixes: dd8b083f9a5e ("crypto: api - Introduce notifier for new crypto algorithms")
Cc: <stable@xxxxxxxxxxxxxxx> # v4.20+

> 
> diff --git a/crypto/algboss.c b/crypto/algboss.c
> index 527b44d0af21..01feb8234053 100644
> --- a/crypto/algboss.c
> +++ b/crypto/algboss.c
> @@ -275,7 +275,7 @@ static int cryptomgr_notify(struct notifier_block *this, unsigned long msg,
>  	case CRYPTO_MSG_ALG_REGISTER:
>  		return cryptomgr_schedule_test(data);
>  	case CRYPTO_MSG_ALG_LOADED:
> -		break;
> +		return NOTIFY_OK;
>  	}
>  
>  	return NOTIFY_DONE;

It's hard to remember the difference between NOTIFY_OK and NOTIFY_DONE.  Isn't
it wrong to call request_module() in the first place for a message that
"cryptomgr" doesn't care about?  Wouldn't the following make more sense?:

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);



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux