[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180528100332.819628897@linuxfoundation.org>
Date: Mon, 28 May 2018 12:01:34 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Maninder Singh <maninder1.s@...sung.com>,
Vaneet Narang <v.narang@...sung.com>,
Vlastimil Babka <vbabka@...e.cz>,
Michal Hocko <mhocko@...e.com>,
Oscar Salvador <osalvador@...hadventures.net>,
Ayush Mittal <ayush.m@...sung.com>,
Prakash Gupta <guptap@...eaurora.org>,
Vinayak Menon <vinmenon@...eaurora.org>,
Vasyl Gomonovych <gomonovych@...il.com>,
Amit Sahrawat <a.sahrawat@...sung.com>, pankaj.m@...sung.com,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Sasha Levin <alexander.levin@...rosoft.com>
Subject: [PATCH 4.14 309/496] mm/page_owner: fix recursion bug after changing skip entries
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maninder Singh <maninder1.s@...sung.com>
[ Upstream commit 299815a4fba9f3c7a81434dba0072148f1690608 ]
This patch fixes commit 5f48f0bd4e36 ("mm, page_owner: skip unnecessary
stack_trace entries").
Because if we skip first two entries then logic of checking count value
as 2 for recursion is broken and code will go in one depth recursion.
so we need to check only one call of _RET_IP(__set_page_owner) while
checking for recursion.
Current Backtrace while checking for recursion:-
(save_stack) from (__set_page_owner) // (But recursion returns true here)
(__set_page_owner) from (get_page_from_freelist)
(get_page_from_freelist) from (__alloc_pages_nodemask)
(__alloc_pages_nodemask) from (depot_save_stack)
(depot_save_stack) from (save_stack) // recursion should return true here
(save_stack) from (__set_page_owner)
(__set_page_owner) from (get_page_from_freelist)
(get_page_from_freelist) from (__alloc_pages_nodemask+)
(__alloc_pages_nodemask) from (depot_save_stack)
(depot_save_stack) from (save_stack)
(save_stack) from (__set_page_owner)
(__set_page_owner) from (get_page_from_freelist)
Correct Backtrace with fix:
(save_stack) from (__set_page_owner) // recursion returned true here
(__set_page_owner) from (get_page_from_freelist)
(get_page_from_freelist) from (__alloc_pages_nodemask+)
(__alloc_pages_nodemask) from (depot_save_stack)
(depot_save_stack) from (save_stack)
(save_stack) from (__set_page_owner)
(__set_page_owner) from (get_page_from_freelist)
Link: http://lkml.kernel.org/r/1521607043-34670-1-git-send-email-maninder1.s@samsung.com
Fixes: 5f48f0bd4e36 ("mm, page_owner: skip unnecessary stack_trace entries")
Signed-off-by: Maninder Singh <maninder1.s@...sung.com>
Signed-off-by: Vaneet Narang <v.narang@...sung.com>
Acked-by: Vlastimil Babka <vbabka@...e.cz>
Cc: Michal Hocko <mhocko@...e.com>
Cc: Oscar Salvador <osalvador@...hadventures.net>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Ayush Mittal <ayush.m@...sung.com>
Cc: Prakash Gupta <guptap@...eaurora.org>
Cc: Vinayak Menon <vinmenon@...eaurora.org>
Cc: Vasyl Gomonovych <gomonovych@...il.com>
Cc: Amit Sahrawat <a.sahrawat@...sung.com>
Cc: <pankaj.m@...sung.com>
Cc: Vaneet Narang <v.narang@...sung.com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Sasha Levin <alexander.levin@...rosoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
mm/page_owner.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -123,13 +123,13 @@ void __reset_page_owner(struct page *pag
static inline bool check_recursive_alloc(struct stack_trace *trace,
unsigned long ip)
{
- int i, count;
+ int i;
if (!trace->nr_entries)
return false;
- for (i = 0, count = 0; i < trace->nr_entries; i++) {
- if (trace->entries[i] == ip && ++count == 2)
+ for (i = 0; i < trace->nr_entries; i++) {
+ if (trace->entries[i] == ip)
return true;
}
Powered by blists - more mailing lists