Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 ac3b43283923 ("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: ac3b43283923 ("module: replace module_layout with module_memory")
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
Reviewed-by: Daniel Gomez <da.gomez@samsung.com>
Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
Acked-by: Song Liu <song@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>

authored by

Petr Pavlu and committed by
Sami Tolvanen
a7b4bc09 6de23f81

-6
-6
kernel/module/main.c
··· 3544 3544 mutex_unlock(&module_mutex); 3545 3545 free_module: 3546 3546 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 - 3553 3547 module_memory_restore_rox(mod); 3554 3548 module_deallocate(mod, info); 3555 3549 free_copy: