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: 105099 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp494024vqr; Thu, 8 Jun 2023 12:24:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ73YHr/RhnHaoX7+VzMziRMxBfV9fh2KUkphclEiF5yqRE7SQ+GZz0fvLFwSH/VLJIImmBx X-Received: by 2002:a05:6a20:9388:b0:114:6993:5a3b with SMTP id x8-20020a056a20938800b0011469935a3bmr6442156pzh.13.1686252276139; Thu, 08 Jun 2023 12:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686252276; cv=none; d=google.com; s=arc-20160816; b=tS57G1VODS5YBvy1X0iu2Tw6UkostEMPQj6LLzYxYIYXVxH/TJS9iSWUSs1zXnyCQ6 kbMM0N1aBv5KiktMtcSUV+2onqngQ6T2wGb/yz09Yp+g4bpJdacyUM5wCsS7LE/gUOyC lV8VvI8esBz/aHOukUS+C/H49BkRy2fLj60qr87yUWTmcaEsJtO2JdJcYbiAhLzO8BrQ fJno/ek4fUxxp6sfGgIk3LwmLYFGtI1FFXqqUJBuyzIDNIsihkidV4W7apwxNHp4ZFy8 teyH/XJfMV2DdFMyUqQ+4pdSTKdy5R/WAPp8IDvj5ucqGxffDic5DAng31JiEqb/OIdz q+qg== 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=rkLbgr1Xh7HXW3bjd7srICM3/FvawiBIyy23ov/U3X9716/IuG/246BBcZlu1cRDbT AOUHuZKwLlpOXLAmi+kuX6UqoxRTpjoDsBay9NDfzbiRfRXZWhjxKUNyiIe9pUOhQ13P jB6qqls+PMoOPX4tWMyNPfM7Y+9U5fzIjuPxtK7oOX10FPt9TtuVDxILxZQR4yj96UNa IwZ92cFtPVUxi3UFyrvnjGearsuphe7RLlG6lSXRZiZjwW15ql2yU4wCxGN74NRm0CKS C0kMSrx6SkYdkRta9fgKVyjXDLWck9l5u+7ItJ6icUyk9TfD1BnmBJ0EAN2AGq07IfWp 8TJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=Xts+xHOk; 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 i133-20020a639d8b000000b005030a59a81dsi1367069pgd.159.2023.06.08.12.24.23; Thu, 08 Jun 2023 12:24:36 -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=Xts+xHOk; 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 S236511AbjFHTRo (ORCPT + 99 others); Thu, 8 Jun 2023 15:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbjFHTRm (ORCPT ); Thu, 8 Jun 2023 15:17:42 -0400 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 454872D70 for ; Thu, 8 Jun 2023 12:17:09 -0700 (PDT) Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-390723f815fso27245b6e.3 for ; Thu, 08 Jun 2023 12:17:09 -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=hclkyaL3BXUJ5LXP4UNqZAiib4mZdReVkJ63xSnzB2qjYuGmWVtJg5tboSIiY/DCoM fCYqAMf4hdkkZSREZ1yfsmfCBzlTnFJntV329aQxppVkClhmg8DRcK2T/X7lcoJiQC1J cVxHqUET0mHIVzE3qmlsq9zsoVaeFZA28w4RDm+JXiJnuv7Dr8tTzPjyF9wWEYIT5MAg p+ZFsTKzhe1l9TMOPXCFjkeHKzmukN6lgXHrR4xyYAeJxNk1jcH9oQs3pxOCNpA25BR7 o9sB/Kgy2Kixv3SvKzJPJoOIRrBRW2z1/Q6gRZqeEcFPbNc84+zyfjfEt6W28bJno/g1 AeaQ== X-Gm-Message-State: AC+VfDzgxdtN+JUaXLUY6PBZ+855umOKTjsx2lC6uVnXAOMNsDE5evHK KPuBnXKLlY9rvX+/eMNZQOQ5yg== 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-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=ham 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?1768163666426220209?= X-GMAIL-MSGID: =?utf-8?q?1768163666426220209?= 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;