Skip to content

Commit a7b4bc0

Browse files
petrpavlusamitolvanen
authored andcommitted
module: Remove duplicate freeing of lockdep classes
In the error path of load_module(), under the free_module label, the code calls lockdep_free_key_range() to release lock classes associated with the MOD_DATA, MOD_RODATA and MOD_RO_AFTER_INIT module regions, and subsequently invokes module_deallocate(). Since commit ac3b432 ("module: replace module_layout with module_memory"), the module_deallocate() function calls free_mod_mem(), which releases the lock classes as well and considers all module regions. Attempting to free these classes twice is unnecessary. Remove the redundant code in load_module(). Fixes: ac3b432 ("module: replace module_layout with module_memory") Signed-off-by: Petr Pavlu <[email protected]> Reviewed-by: Daniel Gomez <[email protected]> Reviewed-by: Aaron Tomlin <[email protected]> Acked-by: Song Liu <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Sami Tolvanen <[email protected]>
1 parent 6de23f8 commit a7b4bc0

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

kernel/module/main.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3544,12 +3544,6 @@ static int load_module(struct load_info *info, const char __user *uargs,
35443544
mutex_unlock(&module_mutex);
35453545
free_module:
35463546
mod_stat_bump_invalid(info, flags);
3547-
/* Free lock-classes; relies on the preceding sync_rcu() */
3548-
for_class_mod_mem_type(type, core_data) {
3549-
lockdep_free_key_range(mod->mem[type].base,
3550-
mod->mem[type].size);
3551-
}
3552-
35533547
module_memory_restore_rox(mod);
35543548
module_deallocate(mod, info);
35553549
free_copy:

0 commit comments

Comments
 (0)