Re: [patch] mm: fix anon_vma races

Nick Piggin
2008-10-18T02:35:06Z

On Saturday 18 October 2008 13:25, Nick Piggin wrote:

> @@ -171,6 +181,10 @@ static struct anon_vma *page_lock_anon_v
>
> anon_vma = (struct anon_vma *) (anon_mapping - PAGE_MAPPING_ANON);
> spin_lock(&anon_vma->lock);
> +
> + if (anon_mapping != (unsigned long)page->mapping)
> + goto out;
> +
> return anon_vma;
> out:
> rcu_read_unlock();

Err, that should probably be another check for page_mapped(), because
I think page->mapping probably won't get cleared until after anon_vma
may have been freed and reused...