Files
Mel Gorman 04a30bd9dc mempolicy: fix a race in shared_policy_replace()
commit b22d127a39 upstream.

shared_policy_replace() use of sp_alloc() is unsafe.  1) sp_node cannot
be dereferenced if sp->lock is not held and 2) another thread can modify
sp_node between spin_unlock for allocating a new sp node and next
spin_lock.  The bug was introduced before 2.6.12-rc2.

Kosaki's original patch for this problem was to allocate an sp node and
policy within shared_policy_replace and initialise it when the lock is
reacquired.  I was not keen on this approach because it partially
duplicates sp_alloc().  As the paths were sp->lock is taken are not that
performance critical this patch converts sp->lock to sp->mutex so it can
sleep when calling sp_alloc().

[kosaki.motohiro@jp.fujitsu.com: Original patch]
Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
Cc: Josh Boyer <jwboyer@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-13 05:38:56 +09:00
..
2012-04-23 14:23:32 +03:00
2012-04-27 11:03:38 -06:00
2012-04-30 15:30:18 -07:00
2012-04-12 12:57:08 +02:00
2012-04-27 10:46:45 +08:00
2012-10-02 10:30:35 -07:00
2012-08-15 08:10:29 -07:00
2012-07-19 08:59:00 -07:00
2012-10-02 10:30:05 -07:00
2012-08-09 08:31:30 -07:00
2012-08-15 08:10:29 -07:00
2012-10-02 10:30:35 -07:00
2012-07-16 09:03:48 -07:00
2012-07-16 09:04:42 -07:00
2012-04-10 22:39:17 -06:00
2012-04-11 09:36:00 +01:00