提交 7d1d16e4 编写于 作者: R Rusty Russell 提交者: Linus Torvalds

module: fix BUG_ON() for powerpc (and other function descriptor archs)

The rarely-used symbol_put_addr() needs to use dereference_function_descriptor
on powerpc.
Reported-by: NPaul Mackerras <paulus@samba.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au.
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 0a80fb10
...@@ -909,16 +909,18 @@ void __symbol_put(const char *symbol) ...@@ -909,16 +909,18 @@ void __symbol_put(const char *symbol)
} }
EXPORT_SYMBOL(__symbol_put); EXPORT_SYMBOL(__symbol_put);
/* Note this assumes addr is a function, which it currently always is. */
void symbol_put_addr(void *addr) void symbol_put_addr(void *addr)
{ {
struct module *modaddr; struct module *modaddr;
unsigned long a = (unsigned long)dereference_function_descriptor(addr);
if (core_kernel_text((unsigned long)addr)) if (core_kernel_text(a))
return; return;
/* module_text_address is safe here: we're supposed to have reference /* module_text_address is safe here: we're supposed to have reference
* to module from symbol_get, so it can't go away. */ * to module from symbol_get, so it can't go away. */
modaddr = __module_text_address((unsigned long)addr); modaddr = __module_text_address(a);
BUG_ON(!modaddr); BUG_ON(!modaddr);
module_put(modaddr); module_put(modaddr);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册