Linus Torvalds 5336377d62 modules: Fix module_bug_list list corruption race
With all the recent module loading cleanups, we've minimized the code
that sits under module_mutex, fixing various deadlocks and making it
possible to do most of the module loading in parallel.

However, that whole conversion totally missed the rather obscure code
that adds a new module to the list for BUG() handling.  That code was
doubly obscure because (a) the code itself lives in lib/bugs.c (for
dubious reasons) and (b) it gets called from the architecture-specific
"module_finalize()" rather than from generic code.

Calling it from arch-specific code makes no sense what-so-ever to begin
with, and is now actively wrong since that code isn't protected by the
module loading lock any more.

So this commit moves the "module_bug_{finalize,cleanup}()" calls away
from the arch-specific code, and into the generic code - and in the
process protects it with the module_mutex so that the list operations
are now safe.

Future fixups:
 - move the module list handling code into kernel/module.c where it
   belongs.
 - get rid of 'module_bug_list' and just use the regular list of modules
   (called 'modules' - imagine that) that we already create and maintain
   for other reasons.

Reported-and-tested-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Adrian Bunk <bunk@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-10-05 11:29:27 -07:00
..
2005-10-18 08:26:15 -07:00
2007-05-11 05:38:25 -04:00
2008-07-24 10:47:33 -07:00
2008-06-06 11:29:10 -07:00
2007-07-16 09:05:50 -07:00
2009-11-03 16:06:53 +01:00
2007-07-17 10:23:04 -07:00
2006-06-25 10:01:20 -07:00
2005-04-16 15:20:36 -07:00
2006-06-25 10:01:20 -07:00
2007-05-10 18:24:13 +02:00
2010-07-11 22:16:32 +02:00
2005-04-16 15:20:36 -07:00
2009-01-01 10:12:19 +10:30
2008-04-29 08:11:16 -07:00
2009-06-18 13:04:05 -07:00
2010-05-25 08:07:06 -07:00
2005-04-16 15:20:36 -07:00
2010-04-06 15:52:11 -07:00
2006-06-20 20:24:58 -07:00
2008-07-26 12:00:07 -07:00
2010-08-09 20:45:05 -07:00
2006-10-06 08:53:40 -07:00
2009-12-14 23:55:33 +01:00
2010-05-21 09:37:29 -07:00
2009-10-01 21:17:49 +02:00
2009-12-15 08:53:33 -08:00
2005-04-16 15:20:36 -07:00
2010-06-16 18:08:13 +02:00
2010-01-11 09:34:05 -08:00
2010-03-06 11:26:35 -08:00
2008-07-26 12:00:10 -07:00
2010-05-19 22:40:47 -04:00