Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 646d87b4 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

anon_vma: clone the anon_vma chain in the right order



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: default avatarRik van Riel <riel@redhat.com>
Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Tested-by: Borislav Petkov <bp@alien8.de> [ "No, it still oopses" ]
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 287d97ac
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -182,7 +182,7 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src)
{
{
	struct anon_vma_chain *avc, *pavc;
	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();
		avc = anon_vma_chain_alloc();
		if (!avc)
		if (!avc)
			goto enomem_failure;
			goto enomem_failure;