aboutsummaryrefslogtreecommitdiffstats
path: root/mm/compaction.c
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2012-10-08 16:29:17 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-13 05:28:14 +0900
commitcedd186e31dacfb400ec74e0cdd59b02c3d55da8 (patch)
treef81727afeda15c946225d73e771a349953e0c54b /mm/compaction.c
parente12681ffb14f5c3bcd25ace39b9fac3941ad6961 (diff)
downloadkernel_samsung_crespo-cedd186e31dacfb400ec74e0cdd59b02c3d55da8.zip
kernel_samsung_crespo-cedd186e31dacfb400ec74e0cdd59b02c3d55da8.tar.gz
kernel_samsung_crespo-cedd186e31dacfb400ec74e0cdd59b02c3d55da8.tar.bz2
mempolicy: fix a race in shared_policy_replace()
commit b22d127a39ddd10d93deee3d96e643657ad53a49 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>
Diffstat (limited to 'mm/compaction.c')
0 files changed, 0 insertions, 0 deletions