]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
module: Remove duplicate freeing of lockdep classes
authorPetr Pavlu <petr.pavlu@suse.com>
Wed, 7 Jan 2026 12:22:57 +0000 (13:22 +0100)
committerSami Tolvanen <samitolvanen@google.com>
Mon, 23 Feb 2026 17:44:54 +0000 (17:44 +0000)
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>
kernel/module/main.c

index 2bac4c7cd019a1ec1014678f358e645d2d50771d..eec6c9cf8dbb3d38d0d1f7560d4933fb440043f0 100644 (file)
@@ -3544,12 +3544,6 @@ static int load_module(struct load_info *info, const char __user *uargs,
        mutex_unlock(&module_mutex);
  free_module:
        mod_stat_bump_invalid(info, flags);
-       /* Free lock-classes; relies on the preceding sync_rcu() */
-       for_class_mod_mem_type(type, core_data) {
-               lockdep_free_key_range(mod->mem[type].base,
-                                      mod->mem[type].size);
-       }
-
        module_memory_restore_rox(mod);
        module_deallocate(mod, info);
  free_copy: