mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
module: make module_address_lookup safe
module_address_lookup releases preemption then returns a pointer into the module space. The only user (kallsyms) copies the result, so just do that under the preempt disable. Signed-off-by: Rusty Russell <[email protected]>
This commit is contained in:
parent
bb9d3d56e7
commit
6dd06c9fbe
3 changed files with 30 additions and 25 deletions
|
|
@ -233,10 +233,11 @@ static unsigned long get_symbol_pos(unsigned long addr,
|
|||
int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize,
|
||||
unsigned long *offset)
|
||||
{
|
||||
char namebuf[KSYM_NAME_LEN];
|
||||
if (is_ksym_addr(addr))
|
||||
return !!get_symbol_pos(addr, symbolsize, offset);
|
||||
|
||||
return !!module_address_lookup(addr, symbolsize, offset, NULL);
|
||||
return !!module_address_lookup(addr, symbolsize, offset, NULL, namebuf);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -251,8 +252,6 @@ const char *kallsyms_lookup(unsigned long addr,
|
|||
unsigned long *offset,
|
||||
char **modname, char *namebuf)
|
||||
{
|
||||
const char *msym;
|
||||
|
||||
namebuf[KSYM_NAME_LEN - 1] = 0;
|
||||
namebuf[0] = 0;
|
||||
|
||||
|
|
@ -268,10 +267,8 @@ const char *kallsyms_lookup(unsigned long addr,
|
|||
}
|
||||
|
||||
/* see if it's in a module */
|
||||
msym = module_address_lookup(addr, symbolsize, offset, modname);
|
||||
if (msym)
|
||||
return strncpy(namebuf, msym, KSYM_NAME_LEN - 1);
|
||||
|
||||
return module_address_lookup(addr, symbolsize, offset, modname,
|
||||
namebuf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue