When memory-hotplugged, new memblock nodes will be added by using standard Linux kernel API:
*add_memory_driver_managed() -> add_memory_resource() -> memblock_add_node() -> memblock_add_range(&memblock.memory, base, size, nid, flags) -> memblock_insert_region(&memblock.memory)*
At this time dm_verity driver, which allocates/uses memory, have to check if its allocated memory is valid or not by using standard Linux kernel API:
* verity_work() -> sg_init_one() -> sg_set_buf() -> virt_addr_valid() -> pfn_is_map_memory() -> memblock_is_map_memory() -> memblock_search(&memblock.memory, addr);*
Due to the competition for memblock, there will trigger BUG_ON
in "sg_set_buf()"
of dm_verity
driver.
Is this a kenel mainline problem or is add_memory_driver_managed
used incorrectly?
Find the root cause.