* [merged] mm-mempolicyc-do-not-put-mempolicy-before-using-its-nodemask.patch removed from -mm tree
@ 2017-01-25 22:04 akpm
0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2017-01-25 22:04 UTC (permalink / raw)
To: vbabka, aarcange, aneesh.kumar, kirill.shutemov, mhocko,
rientjes, stable, mm-commits
The patch titled
Subject: mm/mempolicy.c: do not put mempolicy before using its nodemask
has been removed from the -mm tree. Its filename was
mm-mempolicyc-do-not-put-mempolicy-before-using-its-nodemask.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Vlastimil Babka <vbabka@suse.cz>
Subject: mm/mempolicy.c: do not put mempolicy before using its nodemask
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")
Link: http://lkml.kernel.org/r/20170118141124.8345-1-vbabka@suse.cz
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: <stable@vger.kernel.org> [4.0+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/mempolicy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -puN mm/mempolicy.c~mm-mempolicyc-do-not-put-mempolicy-before-using-its-nodemask mm/mempolicy.c
--- a/mm/mempolicy.c~mm-mempolicyc-do-not-put-mempolicy-before-using-its-nodemask
+++ a/mm/mempolicy.c
@@ -2017,8 +2017,8 @@ retry_cpuset:
nmask = policy_nodemask(gfp, pol);
zl = policy_zonelist(gfp, pol, node);
- mpol_cond_put(pol);
page = __alloc_pages_nodemask(gfp, order, zl, nmask);
+ mpol_cond_put(pol);
out:
if (unlikely(!page && read_mems_allowed_retry(cpuset_mems_cookie)))
goto retry_cpuset;
_
Patches currently in -mm which might be from vbabka@suse.cz are
mm-page_alloc-dont-convert-pfn-to-idx-when-merging.patch
mm-page_alloc-avoid-page_to_pfn-when-merging-buddies.patch
mm-page_alloc-remove-redundant-checks-from-alloc-fastpath.patch
mm-page_alloc-dont-check-cpuset-allowed-twice-in-fast-path.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
* [merged] mm-mempolicyc-do-not-put-mempolicy-before-using-its-nodemask.patch removed from -mm tree
@ 2017-01-25 22:04 akpm
0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2017-01-25 22:04 UTC (permalink / raw)
To: vbabka, aarcange, aneesh.kumar, kirill.shutemov, mhocko,
rientjes, stable, mm-commits
The patch titled
Subject: mm/mempolicy.c: do not put mempolicy before using its nodemask
has been removed from the -mm tree. Its filename was
mm-mempolicyc-do-not-put-mempolicy-before-using-its-nodemask.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Vlastimil Babka <vbabka@suse.cz>
Subject: mm/mempolicy.c: do not put mempolicy before using its nodemask
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")
Link: http://lkml.kernel.org/r/20170118141124.8345-1-vbabka@suse.cz
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: <stable@vger.kernel.org> [4.0+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/mempolicy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -puN mm/mempolicy.c~mm-mempolicyc-do-not-put-mempolicy-before-using-its-nodemask mm/mempolicy.c
--- a/mm/mempolicy.c~mm-mempolicyc-do-not-put-mempolicy-before-using-its-nodemask
+++ a/mm/mempolicy.c
@@ -2017,8 +2017,8 @@ retry_cpuset:
nmask = policy_nodemask(gfp, pol);
zl = policy_zonelist(gfp, pol, node);
- mpol_cond_put(pol);
page = __alloc_pages_nodemask(gfp, order, zl, nmask);
+ mpol_cond_put(pol);
out:
if (unlikely(!page && read_mems_allowed_retry(cpuset_mems_cookie)))
goto retry_cpuset;
_
Patches currently in -mm which might be from vbabka@suse.cz are
mm-page_alloc-dont-convert-pfn-to-idx-when-merging.patch
mm-page_alloc-avoid-page_to_pfn-when-merging-buddies.patch
mm-page_alloc-remove-redundant-checks-from-alloc-fastpath.patch
mm-page_alloc-dont-check-cpuset-allowed-twice-in-fast-path.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-25 22:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-25 22:04 [merged] mm-mempolicyc-do-not-put-mempolicy-before-using-its-nodemask.patch removed from -mm tree akpm
-- strict thread matches above, loose matches on Subject: below --
2017-01-25 22:04 akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.