[Devel] [PATCH RHEL7 COMMIT] mm/tcache: fix rcu_read_lock()/rcu_read_unlock() imbalance
Konstantin Khorenko
khorenko at virtuozzo.com
Wed May 23 11:05:13 MSK 2018
The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.50.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.50.1
------>
commit 9a42139df623af5b801c44bc88ffe5093f5349a6
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date: Wed May 23 11:05:13 2018 +0300
mm/tcache: fix rcu_read_lock()/rcu_read_unlock() imbalance
tcache_detach_page()
rcu_read_lock();
repeat:
.....
rcu_read_unlock();
if (page) {
...
page = tcache_page_tree_delete(node, index, page);
....
if (!page)
goto repeat; // <- will cause rcu_read_unlock() without lock
Take rcu lock before the last 'goto repeat;' in tcache_detach_page().
https://jira.sw.ru/browse/PSBM-81731
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
Acked-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
mm/tcache.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/tcache.c b/mm/tcache.c
index 02fde409e691..9fc7cbf1c40b 100644
--- a/mm/tcache.c
+++ b/mm/tcache.c
@@ -864,8 +864,10 @@ static struct page *tcache_detach_page(struct tcache_node *node, pgoff_t index,
* in __tcache_page_tree_delete() fails, and
* we have to repeat the cycle.
*/
- if (!page)
+ if (!page) {
+ rcu_read_lock();
goto repeat;
+ }
}
return page;
More information about the Devel
mailing list