ANDROID: fips140: check for errors from initcalls
Check for errors when executing the initcalls so that we can't fail to register some algorithms without noticing. Bug: 153614920 Bug: 188620248 Change-Id: I8e55de3d7624c6700f161c92705d0f6f874476d8 Signed-off-by: Eric Biggers <ebiggers@google.com>
This commit is contained in:

committed by
Ard Biesheuvel

parent
92de53472e
commit
0af06624ea
@@ -539,8 +539,17 @@ fips140_init(void)
|
|||||||
initcall < &__initcall_end_marker;
|
initcall < &__initcall_end_marker;
|
||||||
initcall++) {
|
initcall++) {
|
||||||
int (*init)(void) = offset_to_ptr(initcall);
|
int (*init)(void) = offset_to_ptr(initcall);
|
||||||
|
int err = init();
|
||||||
|
|
||||||
init();
|
/*
|
||||||
|
* ENODEV is expected from initcalls that only register
|
||||||
|
* algorithms that depend on non-present CPU features. Besides
|
||||||
|
* that, errors aren't expected here.
|
||||||
|
*/
|
||||||
|
if (err && err != -ENODEV) {
|
||||||
|
pr_err("initcall %ps() failed: %d\n", init, err);
|
||||||
|
goto panic;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!update_live_fips140_algos())
|
if (!update_live_fips140_algos())
|
||||||
|
Reference in New Issue
Block a user