aboutsummaryrefslogtreecommitdiff
path: root/lib/mpi/mpi-bit.c
diff options
context:
space:
mode:
authorJohannes Weiner <[email protected]>2013-06-12 14:05:09 -0700
committerLinus Torvalds <[email protected]>2013-06-12 16:29:46 -0700
commit89dc991f0f5272c307c746fdd57d0bff382b1ba2 (patch)
treef0d71da8f791864e38819b9e576b7fd5ddb217bc /lib/mpi/mpi-bit.c
parent7b57976da48e60b66fdbb9e97f5711b5382a49d7 (diff)
mm: memcontrol: fix lockless reclaim hierarchy iterator
The lockless reclaim hierarchy iterator currently has a misplaced barrier that can lead to use-after-free crashes. The reclaim hierarchy iterator consist of a sequence count and a position pointer that are read and written locklessly, with memory barriers enforcing ordering. The write side sets the position pointer first, then updates the sequence count to "publish" the new position. Likewise, the read side must read the sequence count first, then the position. If the sequence count is up to date, it's guaranteed that the position is up to date as well: writer: reader: iter->position = position if iter->sequence == expected: smp_wmb() smp_rmb() iter->sequence = sequence position = iter->position However, the read side barrier is currently misplaced, which can lead to dereferencing stale position pointers that no longer point to valid memory. Fix this. Signed-off-by: Johannes Weiner <[email protected]> Reported-by: Tejun Heo <[email protected]> Reviewed-by: Tejun Heo <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: KAMEZAWA Hiroyuki <[email protected]> Cc: Glauber Costa <[email protected]> Cc: <[email protected]> [3.10+] Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-bit.c')
0 files changed, 0 insertions, 0 deletions