toolbox/modprobe: Fix failure due to blocklist

When a module is blocklisted, LoadWithAliases() will return an error
indicating the module failed to load. When the blocklist is requested
(via the -b parameter), let's not return an error if a blocklisted
module fails to load.

Test: verified lsmod on pixel 6
Bug: 324018983
Change-Id: I68f7d46bf9fd99e4b4e51ef92ea71686907f1125
This commit is contained in:
Will McVicker 2024-03-07 11:15:37 -08:00
parent 2d3658a421
commit b9dead1a75

View file

@ -257,6 +257,7 @@ extern "C" int modprobe_main(int argc, char** argv) {
switch (mode) {
case AddModulesMode:
if (!m.LoadWithAliases(module, true, module_parameters)) {
if (m.IsBlocklisted(module)) continue;
PLOG(ERROR) << "Failed to load module " << module;
rv = EXIT_FAILURE;
}