Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1562192

Re: [PATCH] mm/mempolicy.c: do not put mempolicy before using its nodemask

From David Rientjes <rientjes@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH] mm/mempolicy.c: do not put mempolicy before using its nodemask
Date 2017-01-18 22:40 +0100
Message-ID <t167v-YB-9@gated-at.bofh.it> (permalink)
References <t0ZfI-594-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@suse.cz>
> Cc: stable@vger.kernel.org
> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Andrea Arcangeli <aarcange@redhat.com>

Acked-by: David Rientjes <rientjes@google.com>

I think this deserves Cc: stable@vger.kernel.org [4.0+]

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] mm/mempolicy.c: do not put mempolicy before using its nodemask Vlastimil Babka <vbabka@suse.cz> - 2017-01-18 15:20 +0100
  Re: [PATCH] mm/mempolicy.c: do not put mempolicy before using its  nodemask "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-01-18 18:20 +0100
  Re: [PATCH] mm/mempolicy.c: do not put mempolicy before using its  nodemask Michal Hocko <mhocko@kernel.org> - 2017-01-18 20:30 +0100
  Re: [PATCH] mm/mempolicy.c: do not put mempolicy before using its  nodemask David Rientjes <rientjes@google.com> - 2017-01-18 22:40 +0100

csiph-web