[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1701181331030.133727@chino.kir.corp.google.com>
Date: Wed, 18 Jan 2017 13:34:55 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: Vlastimil Babka <vbabka@...e.cz>
cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org,
"Aneesh Kumar K . V" <aneesh.kumar@...ux.vnet.ibm.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Andrea Arcangeli <aarcange@...hat.com>
Subject: Re: [PATCH] mm/mempolicy.c: do not put mempolicy before using its
nodemask
On Wed, 18 Jan 2017, Vlastimil Babka wrote:
> Since commit be97a41b291e ("mm/mempolicy.c: merge alloc_hugepage_vma to
> alloc_pages_vma") alloc_pages_vma() can potentially free a mempolicy by
> mpol_cond_put() before accessing the embedded nodemask by
> __alloc_pages_nodemask(). The commit log says it's so "we can use a single
> exit path within the function" but that's clearly wrong. We can still do that
> when doing mpol_cond_put() after the allocation attempt.
>
> Make sure the mempolicy is not freed prematurely, otherwise
> __alloc_pages_nodemask() can end up using a bogus nodemask, which could lead
> e.g. to premature OOM.
>
> Fixes: be97a41b291e ("mm/mempolicy.c: merge alloc_hugepage_vma to alloc_pages_vma")
> Signed-off-by: Vlastimil Babka <vbabka@...e.cz>
> Cc: stable@...r.kernel.org
> Cc: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Cc: David Rientjes <rientjes@...gle.com>
> Cc: Andrea Arcangeli <aarcange@...hat.com>
Acked-by: David Rientjes <rientjes@...gle.com>
I think this deserves Cc: stable@...r.kernel.org [4.0+]
Powered by blists - more mailing lists