From patchwork Thu Sep 23 12:26:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 12512733 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 DB785C433FE for ; Thu, 23 Sep 2021 12:27:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5B0BD6115A for ; Thu, 23 Sep 2021 12:27:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5B0BD6115A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id B7AA56B006C; Thu, 23 Sep 2021 08:27:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B28F26B0071; Thu, 23 Sep 2021 08:27:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3EAC6B0072; Thu, 23 Sep 2021 08:27:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id 960666B006C for ; Thu, 23 Sep 2021 08:27:10 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 019A21837DCA3 for ; Thu, 23 Sep 2021 12:27:10 +0000 (UTC) X-FDA: 78618763020.40.5FD55AC Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf22.hostedemail.com (Postfix) with ESMTP id 2F4B01903 for ; Thu, 23 Sep 2021 12:27:09 +0000 (UTC) Received: by mail-pj1-f49.google.com with SMTP id me1so4320203pjb.4 for ; Thu, 23 Sep 2021 05:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EG/jIsXsinDHEREmGQKFYzsvt6qH7E+P5K9bH6Rw3k8=; b=q5UmY5hkt8KCJWcDURo1rVUITu5vDqRjhzC2FLP1HxC286Ha0Desx0hRoXfA4lO04k 8VvhbkS1w8vAUH1kNaIahccythth+fllOS4kgzzkFl0cxTiW5cz56sOirLwo600qnn1y 4qivyYm31m5W8QPS0MY2YEwpAohzDOI6u2KNbmLOzZbmPuU+9tsTrf9C5/WAhcL7i4EK L5fpEOhom/HOp5jKj+Zm1l0vfZO6oo/rDdUMXS/rZ4+x0eJok8fRkfJTPu5ShVy6FxVh 8qfw5riRS7825a7f1rANAWs63FWzTnTE0fyPz+iet7b61SAVUWrld98ygtD5sampl5f9 EFlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EG/jIsXsinDHEREmGQKFYzsvt6qH7E+P5K9bH6Rw3k8=; b=M8qWW4brcvLaWIf5dG/qj20PfI8Q2LVBJ+qyzMlb0sA6HvHMBIjv7jwpc7ZHj0GQfX hEfPQ1ZjXe73EBjiEnyN76EiNKY9gb5S/RPqTgSmU/gBlriRxEpITD1tpCFqa1gdIstf zRCU+QojJRsFjiXp49FiOCLUVxJEbdyz51SHeH85GqVSSfwgOPEP3/egm2vWd20MMIJ8 dp7TJiYX9kRvagnh/YUdvXXUpCKN9HzgWme7u7ySPcjTcq/+bS5sRJbgsx+q9pL9Nb+F 3U6ABYLOCiZgDsdAFSTJB8FgGLXoxwCiUIylpK33iOCccQ+5i4/Webgudb8MqTeaEA1J KN0w== X-Gm-Message-State: AOAM531NjGjK3Ch1VUTsXLJmkDqnQK2jPnCU1JE7K2M5QZp3BKIA24Vt a4r0xGYrquW/lBMtoh7bwi8VTw== X-Google-Smtp-Source: ABdhPJzJumf/vq3brjK1T9CHdxiVtqzRbHdGtmE9hicDTx8of0VoCMMYIv4czr5pNaYXuHBtnyEL8Q== X-Received: by 2002:a17:90b:1e09:: with SMTP id pg9mr17562608pjb.73.1632400027804; Thu, 23 Sep 2021 05:27:07 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.249]) by smtp.gmail.com with ESMTPSA id y5sm5561401pfb.207.2021.09.23.05.27.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Sep 2021 05:27:07 -0700 (PDT) From: Qi Zheng To: naoya.horiguchi@nec.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, songmuchun@bytedance.com, Qi Zheng Subject: [PATCH] mm/memory_failure: Fix the missing pte_unmap() call Date: Thu, 23 Sep 2021 20:26:42 +0800 Message-Id: <20210923122642.4999-1-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=q5UmY5hk; spf=pass (imf22.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.49 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 2F4B01903 X-Stat-Signature: 89mrf13qzo69jpma4bo7huuzfqacth36 X-HE-Tag: 1632400029-741186 X-Bogosity: Ham, tests=bogofilter, spamicity=0.002168, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The paired pte_unmap() call is missing before the dev_pagemap_mapping_shift() returns. So fix it. Signed-off-by: Qi Zheng Reviewed-by: David Hildenbrand Acked-by: Naoya Horiguchi --- mm/memory-failure.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index e2984c123e7e..4e5419f16fd4 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -306,6 +306,7 @@ static unsigned long dev_pagemap_mapping_shift(struct page *page, struct vm_area_struct *vma) { unsigned long address = vma_address(page, vma); + unsigned long ret = 0; pgd_t *pgd; p4d_t *p4d; pud_t *pud; @@ -330,10 +331,12 @@ static unsigned long dev_pagemap_mapping_shift(struct page *page, return PMD_SHIFT; pte = pte_offset_map(pmd, address); if (!pte_present(*pte)) - return 0; + goto unmap; if (pte_devmap(*pte)) - return PAGE_SHIFT; - return 0; + ret = PAGE_SHIFT; +unmap: + pte_unmap(pte); + return ret; } /*