mirror of
https://github.com/torvalds/linux.git
synced 2026-09-13 15:40:03 +02:00
crypto: af_alg - Stop after finding name in allowlist
If the algorithm name is found in the allowlist and the privilege check doesn't pass, there's no need to consider remaining entries since the list contains (and is intended to contain) at most one entry per name. Signed-off-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
185c67edbb
commit
68554337b4
|
|
@ -145,10 +145,13 @@ int af_alg_check_restriction(const char *name,
|
|||
if (level == 1) {
|
||||
for (const struct af_alg_allowlist_entry *ent = allowlist;
|
||||
ent->name; ent++) {
|
||||
if (strcmp(name, ent->name) == 0 &&
|
||||
((ent->flags & AF_ALG_UNPRIVILEGED) ||
|
||||
af_alg_capable()))
|
||||
return 0;
|
||||
if (strcmp(name, ent->name) == 0) {
|
||||
if ((ent->flags & AF_ALG_UNPRIVILEGED) ||
|
||||
af_alg_capable())
|
||||
return 0;
|
||||
/* List contains at most one entry per name. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user