Skip to content

Commit 2bee017

Browse files
Sebastian Andrzej Siewiorpetrpavlu
authored andcommitted
module: Use RCU in __is_module_percpu_address().
The modules list can be accessed under RCU assumption. Use RCU protection instead preempt_disable(). Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20250108090457.512198-12-bigeasy@linutronix.de Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
1 parent 2ff49f8 commit 2bee017

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

kernel/module/main.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,7 @@ bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr)
450450
struct module *mod;
451451
unsigned int cpu;
452452

453-
preempt_disable();
454-
453+
guard(rcu)();
455454
list_for_each_entry_rcu(mod, &modules, list) {
456455
if (mod->state == MODULE_STATE_UNFORMED)
457456
continue;
@@ -468,13 +467,10 @@ bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr)
468467
per_cpu_ptr(mod->percpu,
469468
get_boot_cpu_id());
470469
}
471-
preempt_enable();
472470
return true;
473471
}
474472
}
475473
}
476-
477-
preempt_enable();
478474
return false;
479475
}
480476

0 commit comments

Comments
 (0)