mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 01:51:39 +00:00
module: weaken locking assertion for oops path.
We don't actually hold the module_mutex when calling find_module_all
from module_kallsyms_lookup_name: that's because it's used by the oops
code and we don't want to deadlock.
However, access to the list read-only is safe if preempt is disabled,
so we can weaken the assertion. Keep a strong version for external
callers though.
Fixes: 0be964be0d
("module: Sanitize RCU usage and locking")
Reported-by: He Kuang <hekuang@huawei.com>
Cc: stable@kernel.org
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
d61be4b3f2
commit
fe0d34d242
1 changed files with 6 additions and 2 deletions
|
@ -602,13 +602,16 @@ const struct kernel_symbol *find_symbol(const char *name,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(find_symbol);
|
EXPORT_SYMBOL_GPL(find_symbol);
|
||||||
|
|
||||||
/* Search for module by name: must hold module_mutex. */
|
/*
|
||||||
|
* Search for module by name: must hold module_mutex (or preempt disabled
|
||||||
|
* for read-only access).
|
||||||
|
*/
|
||||||
static struct module *find_module_all(const char *name, size_t len,
|
static struct module *find_module_all(const char *name, size_t len,
|
||||||
bool even_unformed)
|
bool even_unformed)
|
||||||
{
|
{
|
||||||
struct module *mod;
|
struct module *mod;
|
||||||
|
|
||||||
module_assert_mutex();
|
module_assert_mutex_or_preempt();
|
||||||
|
|
||||||
list_for_each_entry(mod, &modules, list) {
|
list_for_each_entry(mod, &modules, list) {
|
||||||
if (!even_unformed && mod->state == MODULE_STATE_UNFORMED)
|
if (!even_unformed && mod->state == MODULE_STATE_UNFORMED)
|
||||||
|
@ -621,6 +624,7 @@ static struct module *find_module_all(const char *name, size_t len,
|
||||||
|
|
||||||
struct module *find_module(const char *name)
|
struct module *find_module(const char *name)
|
||||||
{
|
{
|
||||||
|
module_assert_mutex();
|
||||||
return find_module_all(name, strlen(name), false);
|
return find_module_all(name, strlen(name), false);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(find_module);
|
EXPORT_SYMBOL_GPL(find_module);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue