Skip to content

Commit

Permalink
module: fix BUG_ON() for powerpc (and other function descriptor archs)
Browse files Browse the repository at this point in the history
The rarely-used symbol_put_addr() needs to use dereference_function_descriptor
on powerpc.

Reported-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
rustyrussell authored and torvalds committed Aug 27, 2009
1 parent 0a80fb1 commit 7d1d16e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel/module.c
Expand Up @@ -909,16 +909,18 @@ void __symbol_put(const char *symbol)
}
EXPORT_SYMBOL(__symbol_put);

/* Note this assumes addr is a function, which it currently always is. */
void symbol_put_addr(void *addr)
{
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;

/* module_text_address is safe here: we're supposed to have reference
* 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);
module_put(modaddr);
}
Expand Down

0 comments on commit 7d1d16e

Please sign in to comment.