linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] unlink_anon_vmas in __split_vma in case of error
@ 2010-09-15 17:18 Andrea Arcangeli
  2010-09-15 19:51 ` Hugh Dickins
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrea Arcangeli @ 2010-09-15 17:18 UTC (permalink / raw)
  To: linux-mm
  Cc: Andrew Morton, Johannes Weiner, Rik van Riel, Hugh Dickins,
	Marcelo Tosatti

From: Andrea Arcangeli <aarcange@redhat.com>

If __split_vma fails because of an out of memory condition the
anon_vma_chain isn't teardown and freed potentially leading to rmap
walks accessing freed vma information plus there's a memleak.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
---

diff --git a/mm/mmap.c b/mm/mmap.c
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2014,6 +2014,7 @@ static int __split_vma(struct mm_struct 
 			removed_exe_file_vma(mm);
 		fput(new->vm_file);
 	}
+	unlink_anon_vmas(new);
  out_free_mpol:
 	mpol_put(pol);
  out_free_vma:

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] unlink_anon_vmas in __split_vma in case of error
  2010-09-15 17:18 [PATCH] unlink_anon_vmas in __split_vma in case of error Andrea Arcangeli
@ 2010-09-15 19:51 ` Hugh Dickins
  2010-09-15 20:07 ` Johannes Weiner
  2010-09-15 20:38 ` Rik van Riel
  2 siblings, 0 replies; 4+ messages in thread
From: Hugh Dickins @ 2010-09-15 19:51 UTC (permalink / raw)
  To: Andrea Arcangeli
  Cc: linux-mm, Andrew Morton, Johannes Weiner, Rik van Riel,
	Marcelo Tosatti

On Wed, 15 Sep 2010, Andrea Arcangeli wrote:

> From: Andrea Arcangeli <aarcange@redhat.com>
> 
> If __split_vma fails because of an out of memory condition the
> anon_vma_chain isn't teardown and freed potentially leading to rmap
> walks accessing freed vma information plus there's a memleak.
> 
> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>

Acked-by: Hugh Dickins <hughd@google.com>

and I'm glad to see Andrew already added Cc: stable@kernel.org

> ---
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2014,6 +2014,7 @@ static int __split_vma(struct mm_struct 
>  			removed_exe_file_vma(mm);
>  		fput(new->vm_file);
>  	}
> +	unlink_anon_vmas(new);
>   out_free_mpol:
>  	mpol_put(pol);
>   out_free_vma:

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] unlink_anon_vmas in __split_vma in case of error
  2010-09-15 17:18 [PATCH] unlink_anon_vmas in __split_vma in case of error Andrea Arcangeli
  2010-09-15 19:51 ` Hugh Dickins
@ 2010-09-15 20:07 ` Johannes Weiner
  2010-09-15 20:38 ` Rik van Riel
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Weiner @ 2010-09-15 20:07 UTC (permalink / raw)
  To: Andrea Arcangeli
  Cc: linux-mm, Andrew Morton, Rik van Riel, Hugh Dickins,
	Marcelo Tosatti

On Wed, Sep 15, 2010 at 07:18:16PM +0200, Andrea Arcangeli wrote:
> From: Andrea Arcangeli <aarcange@redhat.com>
> 
> If __split_vma fails because of an out of memory condition the
> anon_vma_chain isn't teardown and freed potentially leading to rmap
> walks accessing freed vma information plus there's a memleak.
> 
> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>

Acked-by: Johannes Weiner <jweiner@redhat.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] unlink_anon_vmas in __split_vma in case of error
  2010-09-15 17:18 [PATCH] unlink_anon_vmas in __split_vma in case of error Andrea Arcangeli
  2010-09-15 19:51 ` Hugh Dickins
  2010-09-15 20:07 ` Johannes Weiner
@ 2010-09-15 20:38 ` Rik van Riel
  2 siblings, 0 replies; 4+ messages in thread
From: Rik van Riel @ 2010-09-15 20:38 UTC (permalink / raw)
  To: Andrea Arcangeli
  Cc: linux-mm, Andrew Morton, Johannes Weiner, Hugh Dickins,
	Marcelo Tosatti

On 09/15/2010 01:18 PM, Andrea Arcangeli wrote:
> From: Andrea Arcangeli<aarcange@redhat.com>
>
> If __split_vma fails because of an out of memory condition the
> anon_vma_chain isn't teardown and freed potentially leading to rmap
> walks accessing freed vma information plus there's a memleak.
>
> Signed-off-by: Andrea Arcangeli<aarcange@redhat.com>

Acked-by: Rik van Riel <riel@redhat.com>

-- 
All rights reversed

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-15 20:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15 17:18 [PATCH] unlink_anon_vmas in __split_vma in case of error Andrea Arcangeli
2010-09-15 19:51 ` Hugh Dickins
2010-09-15 20:07 ` Johannes Weiner
2010-09-15 20:38 ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).