Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3115664pxj; Mon, 17 May 2021 18:10:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxk7PM3ar8VkFONo93Ex2aSbSWOjMwJOWfNAGsRxwKM/49zb9jswi+bzUICYDyTg0CtdLnX X-Received: by 2002:a17:906:5211:: with SMTP id g17mr3058111ejm.281.1621300223957; Mon, 17 May 2021 18:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621300223; cv=none; d=google.com; s=arc-20160816; b=dYLwKUik0AzH4Xb5FfcihykB0gvd+risn8t5avzHQnAR67EOLHt8mHpA7IxexQTVgr t7PH4OmGHEn14OQvY6141ljltBRZEmUBBBi07I9b70Ft2FDUtWap/gQajo8ToviGsZUE BeJVQkWF/3+cMp6PJTnijyDuaQl/Z+FBklifGROtIQ+7ch5e71FNp7NAB5IbiX0728qN FpwRzQ0YSkz8xIv6oJn7b8rn65xVmu8laPE4OnrK45GJBwt8UvYVL4HhdXrdSqTKvZUO PK4M7DkYIlQlHOe554vvuvPBPo1V3+Rym6S9lQ5IKr8jxqMRHZFZJd3YuGg6d4RAYYKP 66uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/RsgtRUlXEITtz2h5Stiins2Tc5HwkXEFVfN45iqI1w=; b=uDbU0CUXYt7MWwJpSoNGV+c3v0V0TykrKjCfjW4Spimh2KtNFVt1cql6BVuDYlwq+Z oXY1YhyhrkCrBrazfIL6W3x9KI05mjYaQkqOdzX4QKZG/KYuRkAXrSottFDWxr60kAH6 GiUnJkflhEkY2Q3tcfiY1aPbll3u5Ht4pZGuiP0UIlCZjZS+ieEQOrJ2WaxMp24UVjPH 4Pw9MYNfXGwg3/u2f4wPDEWmbbO6Jd2ysMQQC5fzJRpZjXAaZN6Smc4MljvnYy9cevUc 1JdE7KtcGt6O5S3mMyLJDZpVGd6eL5YNdA/VKKeEmDVgsyEAYzFMDPuAnSWehtbNMA/v fpkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RgLR3ePa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jw3si681781ejc.279.2021.05.17.18.10.01; Mon, 17 May 2021 18:10:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RgLR3ePa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239825AbhEQOdB (ORCPT + 99 others); Mon, 17 May 2021 10:33:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:53200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239173AbhEQO2K (ORCPT ); Mon, 17 May 2021 10:28:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 353F361613; Mon, 17 May 2021 14:14:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260843; bh=8GpjL861nW8p/QuZ1v4SwYY5mHfItd02U0CdjZFA9i0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RgLR3ePa3hKXDO17KyXoPzPr86sjTEVD8p8JjO/yJyMtTMKcgQH8lKY3Fv66dZuZa /DfQdD2LpfPr/R5LxsdR2ejJKdkzAGjKmVDLXM8im3qpRHsbPww7oGOEgk+SrxDIRz Zjk2AGI5vgLUbKMr2NOemk5gJC+3t62k5WrPmSrE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , David Hildenbrand , Alistair Popple , Jerome Glisse , Rafael Aquini , Yang Shi , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.12 219/363] mm/migrate.c: fix potential indeterminate pte entry in migrate_vma_insert_page() Date: Mon, 17 May 2021 16:01:25 +0200 Message-Id: <20210517140309.996317570@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaohe Lin [ Upstream commit 34f5e9b9d1990d286199084efa752530ee3d8297 ] 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 Reviewed-by: David Hildenbrand Cc: Alistair Popple Cc: Jerome Glisse Cc: Rafael Aquini Cc: Yang Shi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/migrate.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/migrate.c b/mm/migrate.c index 62b81d5257aa..773622cffe77 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2973,6 +2973,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); -- 2.30.2