* [PATCH] crypto: avoid module request when lookup crypto larval of template
@ 2014-03-10 9:22 Lee, Chun-Yi
2014-03-10 11:57 ` Herbert Xu
0 siblings, 1 reply; 3+ messages in thread
From: Lee, Chun-Yi @ 2014-03-10 9:22 UTC (permalink / raw)
To: Herbert Xu, David S. Miller; +Cc: linux-crypto, linux-kernel, Lee, Chun-Yi
When allocate crypto algorithms, e.g. crypto_alloc_shash(), using
template model will run into the path that call module_request().
But there have no any module alias that match with the template name.
e.g.
Enable the module_request tracing event then run "modprobe tcrypt
mode=10" to test, it produces module_request event:
[...]
modprobe-4965 [000] .... 123.504690: module_request: ecb(aes)
wait=1 call_site=crypto_larval_lookup
modprobe-4965 [002] .... 123.506826: module_request:
ecb(aes)-all wait=1 call_site=crypto_larval_lookup
cryptomgr_probe-4970 [003] .... 123.509007: module_request: ecb
wait=1 call_site=crypto_lookup_template
Here should not call module_request() for ecb(aes) because the template
name doesn't match with any driver's alias.
This patch add the name checking in crypto_larval_lookup() to
filter out the template before request kernel module.
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
---
crypto/api.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/crypto/api.c b/crypto/api.c
index a2b39c5..9aac892 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -215,7 +215,7 @@ struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask)
type &= mask;
alg = crypto_alg_lookup(name, type, mask);
- if (!alg) {
+ if (!alg && !strchr(name, '(')) {
request_module("%s", name);
if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask &
--
1.6.4.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: avoid module request when lookup crypto larval of template
2014-03-10 9:22 [PATCH] crypto: avoid module request when lookup crypto larval of template Lee, Chun-Yi
@ 2014-03-10 11:57 ` Herbert Xu
2014-03-11 14:02 ` joeyli
0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2014-03-10 11:57 UTC (permalink / raw)
To: Lee, Chun-Yi; +Cc: David S. Miller, linux-crypto, linux-kernel, Lee, Chun-Yi
On Mon, Mar 10, 2014 at 05:22:51PM +0800, Lee, Chun-Yi wrote:
> When allocate crypto algorithms, e.g. crypto_alloc_shash(), using
> template model will run into the path that call module_request().
> But there have no any module alias that match with the template name.
There aren't any but there could be. For example, as it is
all direct implementations of cbc(aes) rely on the fact that
they also happen to provide aes to autoload themselves.
We may well have a case where it makes sense for a module to
provide just cbc(aes) for example, in which case it would need
such an alias for it to be loaded automatically.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: avoid module request when lookup crypto larval of template
2014-03-10 11:57 ` Herbert Xu
@ 2014-03-11 14:02 ` joeyli
0 siblings, 0 replies; 3+ messages in thread
From: joeyli @ 2014-03-11 14:02 UTC (permalink / raw)
To: Herbert Xu; +Cc: David S. Miller, linux-crypto, linux-kernel
Hi Herbert,
於 一,2014-03-10 於 19:57 +0800,Herbert Xu 提到:
> On Mon, Mar 10, 2014 at 05:22:51PM +0800, Lee, Chun-Yi wrote:
> > When allocate crypto algorithms, e.g. crypto_alloc_shash(), using
> > template model will run into the path that call module_request().
> > But there have no any module alias that match with the template name.
>
> There aren't any but there could be. For example, as it is
> all direct implementations of cbc(aes) rely on the fact that
> they also happen to provide aes to autoload themselves.
>
> We may well have a case where it makes sense for a module to
> provide just cbc(aes) for example, in which case it would need
> such an alias for it to be loaded automatically.
>
> Thanks,
Thanks for your quick explanation!
Joey Lee
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-11 14:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-10 9:22 [PATCH] crypto: avoid module request when lookup crypto larval of template Lee, Chun-Yi
2014-03-10 11:57 ` Herbert Xu
2014-03-11 14:02 ` joeyli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).