From patchwork Thu Jun 8 19:16:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13272724 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF42EC7EE23 for ; Thu, 8 Jun 2023 19:16:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 589298E0002; Thu, 8 Jun 2023 15:16:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5129F8E0001; Thu, 8 Jun 2023 15:16:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38C688E0002; Thu, 8 Jun 2023 15:16:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2605F8E0001 for ; Thu, 8 Jun 2023 15:16:22 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EF6E9120461 for ; Thu, 8 Jun 2023 19:16:21 +0000 (UTC) X-FDA: 80880536562.18.8C667F8 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) by imf29.hostedemail.com (Postfix) with ESMTP id 289F3120024 for ; Thu, 8 Jun 2023 19:16:19 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=Xts+xHOk; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf29.hostedemail.com: domain of hughd@google.com designates 209.85.167.179 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686251780; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fUQgmWpeb8XZ+Q95Ceu0Qoh2H5+Z0fgN6mScmqt4vh8=; b=kuY+sWvkW86rfRj2roSMY7+shYQzgOeIgu/9WVBsSuUFSaFk76fCl9o9+rIBXTCMPhczjg yvtohvUvADY6qMM9zN8A2cOUKXIqEdVUBxJEm+XyhIRnEIw1DLXaDzUQTfkVybhuC/HcYD U9/d6vP3g0ZX3C5kFHkmU6LwjD8BT3Q= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=Xts+xHOk; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf29.hostedemail.com: domain of hughd@google.com designates 209.85.167.179 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686251780; a=rsa-sha256; cv=none; b=UHNBtljGVlr7iHZXwU96kCZiv7Hb60fuvu0V6N6wae7Ll91xT6sYqa5hmpxcPzRBN3hNTf zt6GSuDzYYW2j6huxNsdjmiAcb+dAbEtXo6liIp1VPI2FYBxqgB6j/pKSjoCTsWvKGTNpJ 8XSXVmZA4wL5FRjAKijlyuwesoI7x1c= Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-390723f815fso27250b6e.3 for ; Thu, 08 Jun 2023 12:16:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686251779; x=1688843779; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=fUQgmWpeb8XZ+Q95Ceu0Qoh2H5+Z0fgN6mScmqt4vh8=; b=Xts+xHOkrh/u1lklJ9jF3D7S9f/kLV8GPG892l7zD8MlHgN8wPrMqgrCwto/Q1X+Pk W1+dBhBpd/nxZGkRw7Je76Rv8ScIxWS7YhmGg7SCpWHyKB1Cka/5vVCHo+mJDQWdRl3m u500Id80G1EkjsXNB0mtCuxFaZBYzNUs8Dvvd2LdfZ44ADa4Y8aQBNX2j9WdcdQ881QF GqyzpCVHN9rDUPFg5SeHYjmoNQ/CJXz81UrJdT3zX813tHx7kBAl3bNlJp8cLIqFQaDy L3QDpbP/aGZ6VEQHFKJzDm28XHlRNu1JajJiE2WmrxtPA9CVcv6EWsa+OLyEs2Vz0giA l8jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686251779; x=1688843779; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fUQgmWpeb8XZ+Q95Ceu0Qoh2H5+Z0fgN6mScmqt4vh8=; b=b3Hqbvjl92Fg8MFsEMt8OzecKyLzONyO/BOzy5kS7MA9kysIq0clj2z9Y6Xxg2SdYe 2VcPib0Ni/lFN50kSILsgdXj6kyyR+5Y9f111mK/wFRCIAwrNZqp0GSvhiQWMJnf9Gq7 9eIf78oPfi4xW+1Jl6kW43s/FUzhs69LkgtAzdAai9EdewyLmWx0upV0SRnmL51OX9a+ vW17LQVbJ8g5Tndf8NyMHuxYZjn2u7CmDOm5Cp76XYIPp19ZD4VXlkF9/7Xcrw1r999I bCJVFEymHVAuQY5/HyK21hqCxnk6kH/l2uA6Qkopz8GF3AyL2Jbs1UglR+BZGQbiyvo5 a5dA== X-Gm-Message-State: AC+VfDwHDdEitItsqFb7Hb2TYfXRnkjISzGOt/5Fy1fGqYbt8H1vmpZH xG0OkgTVtlKZ4+I8jqvCXLpRzQ== X-Google-Smtp-Source: ACHHUZ7LNWBjev2z0u+SFnM7tyBRgdoNXbEUc0/f74NGgApbHQPTQerveZROpTXi1Z/8SDXbKzu99A== X-Received: by 2002:aca:650c:0:b0:39b:da91:8749 with SMTP id m12-20020aca650c000000b0039bda918749mr6427430oim.50.1686251778936; Thu, 08 Jun 2023 12:16:18 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id h200-20020a816cd1000000b0055aafcef659sm120593ywc.5.2023.06.08.12.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 12:16:18 -0700 (PDT) Date: Thu, 8 Jun 2023 12:16:14 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Peter Zijlstra , Russell King , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Greg Ungerer , Michal Simek , Thomas Bogendoerfer , Helge Deller , John David Anglin , "Aneesh Kumar K.V" , Michael Ellerman , Alexandre Ghiti , Palmer Dabbelt , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , Alexander Gordeev , John Paul Adrian Glaubitz , "David S. Miller" , Chris Zankel , Max Filippov , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 06/23] microblaze: allow pte_offset_map() to fail In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 289F3120024 X-Stat-Signature: urs8x3mc6zmddk5rfisquojorzd9ijs1 X-Rspam-User: X-HE-Tag: 1686251779-619073 X-HE-Meta: U2FsdGVkX1/eimBfRvy1d5rWI5AW95D3Mechjgbh78fjRoi4v17MXifkWNbxSEgKo5f/XQ6ph0rzgHJU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eyWL8bU68DrZeMhw2wSXK8pfqn9etZwDaIXXDyWmn1TQdrqdvqsHSW3+5/ggOIrnkyYlI6lMOo+w1CiwBtfaanl/8WjHsOllz+TcVaWNPVP3tavAS7DGsHiRItNM6CmVgyOthFaXWETP1ZnNIYnGRslof4v8Rv9DSkkFsJL7pWVYo8HzVzQ8z90R2/U55sTtNTkwHMB9thlXY1WHGJ+w1tvit5in6fmoDriig75U3RSE9oPUpfNB8wdGtneyrcEW5HE1lt9eivsI+R9FuChNAs+27w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: In rare transient cases, not yet made possible, pte_offset_map() and pte_offset_map_lock() may not find a page table: handle appropriately. Signed-off-by: Hugh Dickins --- arch/microblaze/kernel/signal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c index c3aebec71c0c..c78a0ff48066 100644 --- a/arch/microblaze/kernel/signal.c +++ b/arch/microblaze/kernel/signal.c @@ -194,7 +194,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, preempt_disable(); ptep = pte_offset_map(pmdp, address); - if (pte_present(*ptep)) { + if (ptep && pte_present(*ptep)) { address = (unsigned long) page_address(pte_page(*ptep)); /* MS: I need add offset in page */ address += ((unsigned long)frame->tramp) & ~PAGE_MASK; @@ -203,7 +203,8 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, invalidate_icache_range(address, address + 8); flush_dcache_range(address, address + 8); } - pte_unmap(ptep); + if (ptep) + pte_unmap(ptep); preempt_enable(); if (err) return -EFAULT;