Skip to content

Commit

Permalink
mm/migrate.c: fix potential indeterminate pte entry in migrate_vma_in…
Browse files Browse the repository at this point in the history
…sert_page()

[ Upstream commit 34f5e9b ]

If the zone device page does not belong to un-addressable device memory,
the variable entry will be uninitialized and lead to indeterminate pte
entry ultimately.  Fix this unexpected case and warn about it.

Link: https://lkml.kernel.org/r/20210325131524.48181-4-linmiaohe@huawei.com
Fixes: df6ad69 ("mm/device-public-memory: device memory cache coherent with CPU")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Rafael Aquini <aquini@redhat.com>
Cc: Yang Shi <shy828301@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
MiaoheLin authored and gregkh committed May 19, 2021
1 parent 9639a75 commit aa0d6d1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mm/migrate.c
Expand Up @@ -2914,6 +2914,13 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate,

swp_entry = make_device_private_entry(page, vma->vm_flags & VM_WRITE);
entry = swp_entry_to_pte(swp_entry);
} else {
/*
* For now we only support migrating to un-addressable
* device memory.
*/
pr_warn_once("Unsupported ZONE_DEVICE page type.\n");
goto abort;
}
} else {
entry = mk_pte(page, vma->vm_page_prot);
Expand Down

0 comments on commit aa0d6d1

Please sign in to comment.