r8169: Avoid memcpy() over-reading of ETH_SS_STATS
[linux-2.6-microblaze.git] / mm / ksm.c
index e2ba4eb..2f3aaeb 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -459,7 +459,7 @@ static inline bool ksm_test_exit(struct mm_struct *mm)
  * but taking great care only to touch a ksm page, in a VM_MERGEABLE vma,
  * in case the application has unmapped and remapped mm,addr meanwhile.
  * Could a ksm page appear anywhere else?  Actually yes, in a VM_PFNMAP
- * mmap of /dev/mem or /dev/kmem, where we would not want to touch it.
+ * mmap of /dev/mem, where we would not want to touch it.
  *
  * FAULT_FLAG/FOLL_REMOTE are because we do this outside the context
  * of the process that owns 'vma'.  We also do not want to enforce
@@ -776,11 +776,12 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
                struct page *page;
 
                stable_node = rmap_item->head;
-               page = get_ksm_page(stable_node, GET_KSM_PAGE_NOLOCK);
+               page = get_ksm_page(stable_node, GET_KSM_PAGE_LOCK);
                if (!page)
                        goto out;
 
                hlist_del(&rmap_item->hlist);
+               unlock_page(page);
                put_page(page);
 
                if (!hlist_empty(&stable_node->hlist))
@@ -815,8 +816,7 @@ out:
        cond_resched();         /* we're called from many long loops */
 }
 
-static void remove_trailing_rmap_items(struct mm_slot *mm_slot,
-                                      struct rmap_item **rmap_list)
+static void remove_trailing_rmap_items(struct rmap_item **rmap_list)
 {
        while (*rmap_list) {
                struct rmap_item *rmap_item = *rmap_list;
@@ -987,7 +987,7 @@ static int unmerge_and_remove_all_rmap_items(void)
                                goto error;
                }
 
-               remove_trailing_rmap_items(mm_slot, &mm_slot->rmap_list);
+               remove_trailing_rmap_items(&mm_slot->rmap_list);
                mmap_read_unlock(mm);
 
                spin_lock(&ksm_mmlist_lock);
@@ -1066,7 +1066,7 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page,
                /*
                 * Ok this is tricky, when get_user_pages_fast() run it doesn't
                 * take any lock, therefore the check that we are going to make
-                * with the pagecount against the mapcount is racey and
+                * with the pagecount against the mapcount is racy and
                 * O_DIRECT can happen right after the check.
                 * So we clear the pte and flush the tlb before the check
                 * this assure us that no O_DIRECT can happen after the check
@@ -1436,7 +1436,7 @@ static struct page *stable_node_dup(struct stable_node **_stable_node_dup,
                         */
                        *_stable_node = found;
                        /*
-                        * Just for robustneess as stable_node is
+                        * Just for robustness, as stable_node is
                         * otherwise left as a stable pointer, the
                         * compiler shall optimize it away at build
                         * time.
@@ -2333,7 +2333,7 @@ next_mm:
         * Nuke all the rmap_items that are above this current rmap:
         * because there were no VM_MERGEABLE vmas with such addresses.
         */
-       remove_trailing_rmap_items(slot, ksm_scan.rmap_list);
+       remove_trailing_rmap_items(ksm_scan.rmap_list);
 
        spin_lock(&ksm_mmlist_lock);
        ksm_scan.mm_slot = list_entry(slot->mm_list.next,