Skip to content

Commit

Permalink
anon_vma: clone the anon_vma chain in the right order
Browse files Browse the repository at this point in the history
We want to walk the chain in reverse order when cloning it, so that the
order of the result chain will be the same as the order in the source
chain.  When we add entries to the chain, they go at the head of the
chain, so we want to add the source head last.

Reviewed-by: Rik van Riel <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Tested-by: Borislav Petkov <[email protected]> [ "No, it still oopses" ]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed Apr 13, 2010
1 parent 287d97a commit 646d87b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/rmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src)
{
struct anon_vma_chain *avc, *pavc;

list_for_each_entry(pavc, &src->anon_vma_chain, same_vma) {
list_for_each_entry_reverse(pavc, &src->anon_vma_chain, same_vma) {
avc = anon_vma_chain_alloc();
if (!avc)
goto enomem_failure;
Expand Down

0 comments on commit 646d87b

Please sign in to comment.