[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090603144723.GC30426@random.random>
Date: Wed, 3 Jun 2009 16:47:23 +0200
From: Andrea Arcangeli <aarcange@...hat.com>
To: akpm@...ux-foundation.org
Cc: hugh@...itas.com, linux-kernel@...r.kernel.org,
Izik Eidus <ieidus@...hat.com>, nickpiggin@...oo.com.au,
chrisw@...hat.com, linux-mm@...ck.org, riel@...hat.com
Subject: [PATCH] ksm: fix losing visibility of part of rmap_item->next list
From: Andrea Arcangeli <aarcange@...hat.com>
The tree_item->rmap_item is the head of the list and as such it must
not be overwritten except in the case that the element we removed
(rmap_item) was the previous head of the list, in which case it would
also have rmap_item->prev set to null.
Signed-off-by: Andrea Arcangeli <aarcange@...hat.com>
---
diff --git a/mm/ksm.c b/mm/ksm.c
index 74d921b..6d8dfee 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -397,10 +397,10 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
free_tree_item(tree_item);
nnodes_stable_tree--;
} else if (!rmap_item->prev) {
+ BUG_ON(tree_item->rmap_item != rmap_item);
tree_item->rmap_item = rmap_item->next;
- } else {
- tree_item->rmap_item = rmap_item->prev;
- }
+ } else
+ BUG_ON(tree_item->rmap_item == rmap_item);
} else {
/*
* We dont rb_erase(&tree_item->node) here, beacuse
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists