Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9e131f5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "libmodprobe: Fail when modules.dep lacks colon" am: 8013cc3d

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1465891

Change-Id: Ib8e7cb4ced83098cadf0e125079f91104ea86727
parents 502fe521 8013cc3d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ bool Modprobe::ParseDepCallback(const std::string& base_path,
        deps.emplace_back(prefix + args[0].substr(0, pos));
    } else {
        LOG(ERROR) << "dependency lines must start with name followed by ':'";
        return false;
    }

    // Remaining items are dependencies of our module
+13 −0
Original line number Diff line number Diff line
@@ -179,3 +179,16 @@ TEST(libmodprobe, Test) {
    m.EnableBlocklist(true);
    EXPECT_FALSE(m.LoadWithAliases("test4", true));
}

TEST(libmodprobe, ModuleDepLineWithoutColonIsSkipped) {
    TemporaryDir dir;
    auto dir_path = std::string(dir.path);
    ASSERT_TRUE(android::base::WriteStringToFile(
            "no_colon.ko no_colon.ko\n", dir_path + "/modules.dep", 0600, getuid(), getgid()));

    kernel_cmdline = "";
    test_modules = {dir_path + "/no_colon.ko"};

    Modprobe m({dir.path});
    EXPECT_FALSE(m.LoadWithAliases("no_colon", true));
}