Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp547431pxj; Tue, 18 May 2021 09:01:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbiBMfwEKYIwuJ+zka8M9TjnZRzv888pdFyUwNiqZaVKN/oPAbR1z839zlmACF0sA/Hwl4 X-Received: by 2002:aa7:dac8:: with SMTP id x8mr7834953eds.118.1621353704887; Tue, 18 May 2021 09:01:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621353704; cv=none; d=google.com; s=arc-20160816; b=Dc6Msn1PMouc5tf1MrFCxuEi577aA7YAr7P3eKduGy53UpcBjP4BB/VZsqzF7Kp0pL 2fNzBaBqsNDGk7TnAe/J9wBT6+AVSdpa65+RImFMs/y7GOQRBT5bxY62Vvwv/7bjvoNW 0zupP3vCk+gCGk6xvm7IdtJ99dEcgMXNYyO8KYPfk+bwe2l4EMah0nY43WjCDmqYpIJz 9/B2K11JROGPsKeZNriI/m0c9Tw1bsQB0rQOx5iKDHWTYKsq3C4MlHpztYwJFE6WnYiN ZFtx+4Icl5Y9rRJpA0aJeGMwJs134eD3Qc5+gMlJ4KDcFRx0y5XQ6sLlPg0yHr9cO7nL gDJw== 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=SLqjWXKgOtLxr2JpNzLGedR2FDswKwlU8uUwyurCkrU=; b=LnbRk8UK/x648WuwG2DjCNK57t6n+SoxzdtmrYziXhs3LIi2ArpStlJsKNp5ZTQ1xj Bamf7Jy8B8L16g86p5FrhpGgudm5aKa7+bHM98GC/HQZAF3N4EvQNTTkK+C4QiOJ7RiE TzLln1B8J77wdH85Ric1crRUN6AXg9UI2516kvIYaPPIWu5eP3qbikofGMZG1N66V16D 0d8Db7emOMCYFRWvPisFQAh7Ubd9IXH50F1SzmfSd7Tw1n4MEtUnetOPn5JmOMEhnihC ltQCOVhP6EIExh1S+7hGHuXdQT6tdwFHFgSOjslaRCMwvCwHi4mG7YarQ1BHYvzcAEgr PCDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0LVXAZUO; 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 w3si2735423ejn.357.2021.05.18.09.00.57; Tue, 18 May 2021 09:01:44 -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=0LVXAZUO; 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 S1344464AbhEQP7Z (ORCPT + 99 others); Mon, 17 May 2021 11:59:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:51560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343541AbhEQPjo (ORCPT ); Mon, 17 May 2021 11:39:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C7BD261D0B; Mon, 17 May 2021 14:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262490; bh=d6rSoUnYLFYbSJaq57HcQ3fkkd2+SwgTFbxGW7T4YhU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0LVXAZUO13GrQ5NR39pdMu3S5rdMLcR7FlRBrxNdGtBWJO3ZQoefGAEkPwp/fOyKy 4RT5pK1hdCjpynbqOWPqS4oTIg2M56GI09SMb6fcOvFCTJFDk1SFxHHYN4BgQPgelm BlYZLX7TtMYaguFw2X/VuuoBFdKJxfr+Y4Lfta0Q= 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.10 168/289] mm/migrate.c: fix potential indeterminate pte entry in migrate_vma_insert_page() Date: Mon, 17 May 2021 16:01:33 +0200 Message-Id: <20210517140310.779039880@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 9d7ca1bd7f4b..7982256a5125 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -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); -- 2.30.2