summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorMiaohe Lin <linmiaohe@huawei.com>2021-05-05 03:37:10 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2021-05-05 20:27:24 +0200
commit34f5e9b9d1990d286199084efa752530ee3d8297 (patch)
treec96e57aff6271963cb84a2e5954af7f49dff41e6 /mm
parentmm/migrate.c: remove unnecessary rc != MIGRATEPAGE_SUCCESS check in 'else' case (diff)
downloadlinux-34f5e9b9d1990d286199084efa752530ee3d8297.tar.xz
linux-34f5e9b9d1990d286199084efa752530ee3d8297.zip
mm/migrate.c: fix potential indeterminate pte entry in migrate_vma_insert_page()
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: df6ad69838fc ("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>
Diffstat (limited to 'mm')
-rw-r--r--mm/migrate.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/migrate.c b/mm/migrate.c
index 896e9cd49ecc..c40075d48ef9 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -2947,6 +2947,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);