From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E11ACCA9EAF for ; Sun, 27 Oct 2019 13:41:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A861020717 for ; Sun, 27 Oct 2019 13:41:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572183695; bh=DMiEvCNA19twgC4427WehPKvZ5AQ7GUl8X3GR67ahog=; h=Subject:To:Cc:From:Date:List-ID:From; b=a8ZkjuBJ9vVXr7rZl5mrEemwU7/HdQbIAi5lHlGcjaGojyMXQnUFEcSeLyJTnr7uA 9nvpSQnpR9K3ptvazgX1psmhQgA25YQekiiO0oLk12J8URvRVnErDmtwwEVbJ0/2Bx 6uqEl/RW/S6lCJM2y4zD/SrpRT3VUIFmGBw/xoSQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbfJ0Nlf (ORCPT ); Sun, 27 Oct 2019 09:41:35 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:57221 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbfJ0Nlf (ORCPT ); Sun, 27 Oct 2019 09:41:35 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 8CC6D21AD2; Sun, 27 Oct 2019 09:41:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 27 Oct 2019 09:41:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=oLTYxs 8f9a3m0pl6OW8lstc2KEyFK29AG+wsQFrodBc=; b=UXa8i86Y/kOxk+5nI6MElA YOCAyeYP7AWDDUVWbzh3XNK9Tda+jUKEPrObPXlUILGIg8HLhMtlmUMfSnOTqHrc gWu617XWp8OR2e3gki8VIa/NDklyGOS/17LcBnDwO3JwmiR0CkBDSwjaNURmV5+P 207wd/aZB2VH8d42sAGgr6MZCCzRwet/44A7e8BTHRDUOchXfZaM0knVUz+0mv96 TQy6adnQi/Ba7RM6U0LIT+r3qmwcysyEH+4TPjJdO5FIgYGS4k/7c8FSxaRyAR6U zpc0ogunxCxTmThI6d+tWLYrJazpKOGSVyQIiexZMAWQ4gq6sWrqQUNPNd7hWMAQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrleejgdehjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvhfffkfggtgfgsehtkeertddttd flnecuhfhrohhmpeeoghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhg qeenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecukfhppeejjedrvdeguddrvddvle drvdefvdenucfrrghrrghmpehmrghilhhfrhhomhepghhrvghgsehkrhhorghhrdgtohhm necuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (unknown [77.241.229.232]) by mail.messagingengine.com (Postfix) with ESMTPA id 05502D60057; Sun, 27 Oct 2019 09:41:32 -0400 (EDT) Subject: FAILED: patch "[PATCH] mm/memory-failure.c: don't access uninitialized memmaps in" failed to apply to 4.14-stable tree To: david@redhat.com, akpm@linux-foundation.org, mhocko@kernel.org, n-horiguchi@ah.jp.nec.com, stable@vger.kernel.org, torvalds@linux-foundation.org Cc: From: Date: Sun, 27 Oct 2019 14:41:31 +0100 Message-ID: <1572183691251118@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.14-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 96c804a6ae8c59a9092b3d5dd581198472063184 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Fri, 18 Oct 2019 20:19:23 -0700 Subject: [PATCH] mm/memory-failure.c: don't access uninitialized memmaps in memory_failure() We should check for pfn_to_online_page() to not access uninitialized memmaps. Reshuffle the code so we don't have to duplicate the error message. Link: http://lkml.kernel.org/r/20191009142435.3975-3-david@redhat.com Signed-off-by: David Hildenbrand Fixes: f1dd2cd13c4b ("mm, memory_hotplug: do not associate hotadded memory to zones until online") [visible after d0dc12e86b319] Acked-by: Naoya Horiguchi Cc: Michal Hocko Cc: [4.13+] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 0ae72b6acee7..3151c87dff73 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1257,17 +1257,19 @@ int memory_failure(unsigned long pfn, int flags) if (!sysctl_memory_failure_recovery) panic("Memory failure on page %lx", pfn); - if (!pfn_valid(pfn)) { + p = pfn_to_online_page(pfn); + if (!p) { + if (pfn_valid(pfn)) { + pgmap = get_dev_pagemap(pfn, NULL); + if (pgmap) + return memory_failure_dev_pagemap(pfn, flags, + pgmap); + } pr_err("Memory failure: %#lx: memory outside kernel control\n", pfn); return -ENXIO; } - pgmap = get_dev_pagemap(pfn, NULL); - if (pgmap) - return memory_failure_dev_pagemap(pfn, flags, pgmap); - - p = pfn_to_page(pfn); if (PageHuge(p)) return memory_failure_hugetlb(pfn, flags); if (TestSetPageHWPoison(p)) {