From patchwork Wed May 10 04:49:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 91853 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3365097vqo; Tue, 9 May 2023 21:53:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4z1q1fSvHlwHUuKywpGUEZy4P/IgBVkCSSQvaBrthYMYOmGqtBO5bzSFZ1VeAqO9tDeGw6 X-Received: by 2002:a17:903:2349:b0:1ac:a88a:70b6 with SMTP id c9-20020a170903234900b001aca88a70b6mr3782402plh.31.1683694430441; Tue, 09 May 2023 21:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683694430; cv=none; d=google.com; s=arc-20160816; b=bp4hZeRWYPj7KGodtlylRpgW/DF3aN8Rxn3r8gPylhKnQREp6OuvlBJasJQDgCfCUB MxiQ8MbhTogtHRXNGAZ8WBE/kyotTM4msPKYx5gzbcRQtrqUh2L68994PZ9L9C2vwjqM l5/IpvHuPIhPPB7JpN24EEzzVSbgMaCqrTgbQxEwHkivuyQ3saskos6pVoA9aYmXk8+X vfiMpFE7nCcY1+w1g2GUxYjvYUL4tnRTnIvrg3Zxqsa6UsjDvyU/V0w1lN149gKAsDUl h71juNLlnSLkTl9IEMzcVqJjDZUmlppW9DN4uUhG+vh2nrroEOXbDB6BLQb8tt+h1RHz eRbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=fUQgmWpeb8XZ+Q95Ceu0Qoh2H5+Z0fgN6mScmqt4vh8=; b=gjDkagAfpEuC98uz6++cPdFvg3CZLhKw1gtvmLHCE1YxP5h9KRIHYgQU4VvAiK/XaX b36A4b6SbajltbFbsohohLsW7vu17TlVyU18keUCgbvGKSZ4mJAqdFwBqplHj8EqNIaS W9YfqzCWcmbxSfhv/iAL4n8nz+BCCuOg9ZsD9CyCGJ2kNF+d1dABPWxzDpBjGPNlahrF Dz7FuFVWEBspdbQR3zPbpJCPXpz1aR4UTxHnYSEbKlKrDGku0b3NhHiJ6N0639z9zikL +hbnjwuLi3ynUTPiQdPrkmJUR1ZfNyiuLoDnnG0+RY2xVSWM5DN8cmSZBFJzgoKUboa0 IpoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=UYgN7SHJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g67-20020a636b46000000b005030006a2desi3039935pgc.182.2023.05.09.21.53.37; Tue, 09 May 2023 21:53:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=UYgN7SHJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235579AbjEJEty (ORCPT + 99 others); Wed, 10 May 2023 00:49:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235595AbjEJEt3 (ORCPT ); Wed, 10 May 2023 00:49:29 -0400 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD0CF49D9 for ; Tue, 9 May 2023 21:49:27 -0700 (PDT) Received: by mail-yb1-xb2d.google.com with SMTP id 3f1490d57ef6-b9a6eec8611so34126248276.0 for ; Tue, 09 May 2023 21:49:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683694167; x=1686286167; 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=UYgN7SHJ+Kw138ag8h0xP8PheSyb+TyI5VHSIDjj4n9RShp4GncXL3XJ5EHxhXiibK bWM2WA341yCPavofD2L+dwTh/k8wbtnqGHGh+6b5/c/SY6HIHVlS/8x1ncbIt6FJFxer ySWLGEH9EXtIKdzeP4dp9W7nQnr+88zaaLX+AbAlYcn/Ke5bUTdA+Amtpc+UhTK8ZOe6 nlHKHHzGDYa0yETI6dqk3ia7Fkbq7SWABYpcMHvXrsQB+4fKcTN3DFHn/90Y6UPXvP9F JN8mOaRS8n0XqBndVMSP+yTIoj8bABXUPMMg0RRYx7fWa70GyDb3jL+GXnDzUgXw6flR jauA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683694167; x=1686286167; 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=Mtf6Veu4sEJz8PXvm01B0KvmL7PCzK2g55a2BO8WKbVrMuH+f1Lq2TOiBREVU9WdfH 8z52W0fpriESZyBDN5suG5Euf+F5xV+j9HMTHfEhD9ufrjuln/hUvbzeMOQXX9mi15ua g7BdWjL/45fYX5B172OUxsDMqY4U0GfLdsjHeJeenwRf6wDg1Offoi++Fas+qMMYy+MB MbS2P42gXEIq3c1vX5fTZxWnoprfsH3Sp3PUJBby56Re1XG3UdO7KiAQiAcY4VPHqlqu phxKTYfzQYD/SY4/79vUotSXkTOqnO+7S1FzxPzu1x3DqjDHJR/9dKrnFnE8DHBG2UDz 3BGQ== X-Gm-Message-State: AC+VfDzDjPV/EZhFlTlraSD15ovV/OGy0C8OwU432KbHRftNf525SWcl lN0+JbF37JVPhkOKi8kuvPY+/Q== X-Received: by 2002:a0d:c604:0:b0:55a:3502:d2ca with SMTP id i4-20020a0dc604000000b0055a3502d2camr16180522ywd.13.1683694166794; Tue, 09 May 2023 21:49:26 -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 h67-20020a0df746000000b0054601a8399csm18738ywf.119.2023.05.09.21.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 21:49:26 -0700 (PDT) Date: Tue, 9 May 2023 21:49:22 -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 , 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 , 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 06/23] microblaze: allow pte_offset_map() to fail In-Reply-To: <77a5d8c-406b-7068-4f17-23b7ac53bc83@google.com> Message-ID: <12141321-df3-a8bf-18e-e27d13f24b74@google.com> References: <77a5d8c-406b-7068-4f17-23b7ac53bc83@google.com> MIME-Version: 1.0 X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765481570979500282?= X-GMAIL-MSGID: =?utf-8?q?1765481570979500282?= 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;