Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3560412pxb; Mon, 24 Jan 2022 12:13:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDzHoLH0V8YirsUBf+km2TQ+fR4Tq81Ybs/fhogX3RYOGMlP5tNncfH3aehH7+cfcyPxx5 X-Received: by 2002:a17:902:bb83:b0:14a:30c5:4176 with SMTP id m3-20020a170902bb8300b0014a30c54176mr15448928pls.67.1643055237795; Mon, 24 Jan 2022 12:13:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055237; cv=none; d=google.com; s=arc-20160816; b=Xo4giw7sPBuVkPVlWB4mzpLKJNQmOfRt07nPzsy3WeXaFlChz7ZoQVvD/7TVnhEMfu ir1vnkRe3weK5M0iPPGyOa02ZXkxY4pIYscAg6SX/PiN7nVKM5RuJ2/D8x6YH64Sk8no Sh4Owr95IrAwPWL5HXXkOCfxbq2ymaTWfJWDgcCB4SSXf1jztZ+GISmZFcHWO6PGEfT6 uye8IfcsdxhASOLt9NnW064pIM2GPgBHgKiUv6HkJcebkn+js82G5vCWW4hcBJYauKfB laUZ8UCcIv3XOqXhNbIRskjfOaPAtjuAQWjIA5yl7fXSJzuQdg2Sfsg9H3s9VPFWozj6 T8yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eA+FygoSN8221VPZsrNV3e2/yQY8E9RZcQZJ5vqVr4g=; b=rSOq3053L52qun1hUNbCt1wfdSulVAktaNuOWrziip8O93zI14lXhHVKP4LTrxxtXo 7roV8MAlFiLW/SeoNDIJa0Nl4FINwCY99LQcBMtWppMAEdKhjbxDTRTnv3BSbtXq9xIB ooptzEMTxcw5cIEuIXcJTtYAj3gO32G0/fyxDTTe8GH8QTdMRC7J53/AvkFS/p7mQBsU IfQ04mjYIRmSBuXf3QBeliFiijUV8zGCtnrHPECQsq5BxzlzvLZBQsMP72XIwZxWObta VBCHnCFU2qRifg3Bd8THs6G35wqMAjnjER1MnC7f+onU7RRWp6NFe0tDvCXQ9qX6kXAf dGmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TP02YYYT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p42si13555929pfw.142.2022.01.24.12.13.45; Mon, 24 Jan 2022 12:13:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TP02YYYT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347189AbiAXTRF (ORCPT + 99 others); Mon, 24 Jan 2022 14:17:05 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:36368 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346886AbiAXTJI (ORCPT ); Mon, 24 Jan 2022 14:09:08 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 10DD6B811FC; Mon, 24 Jan 2022 19:09:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7194CC340E5; Mon, 24 Jan 2022 19:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051343; bh=qbuJzMLstbf2L54xjwrmp0834IdyaWQYNr1ugUCfyB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TP02YYYTqq3fkpz6XoYa/UdxLTMxMo8p+FMr94cbK2dDlmFJkzWA3ucXP1r1x1lFq Y37jRMukH9eVk2/r78Os1f6Fxxe8RwU2aMkWx0+ovEpUsc5RhVH8a07Sy4Rr7blhFQ RbRYMgUf8NiceG4S1o8JIDmv4tC/5vq371Bw1G4M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John David Anglin , Helge Deller , Sasha Levin Subject: [PATCH 4.14 131/186] parisc: Avoid calling faulthandler_disabled() twice Date: Mon, 24 Jan 2022 19:43:26 +0100 Message-Id: <20220124183941.326282967@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John David Anglin [ Upstream commit 9e9d4b460f23bab61672eae397417d03917d116c ] In handle_interruption(), we call faulthandler_disabled() to check whether the fault handler is not disabled. If the fault handler is disabled, we immediately call do_page_fault(). It then calls faulthandler_disabled(). If disabled, do_page_fault() attempts to fixup the exception by jumping to no_context: no_context: if (!user_mode(regs) && fixup_exception(regs)) { return; } parisc_terminate("Bad Address (null pointer deref?)", regs, code, address); Apart from the error messages, the two blocks of code perform the same function. We can avoid two calls to faulthandler_disabled() by a simple revision to the code in handle_interruption(). Note: I didn't try to fix the formatting of this code block. Signed-off-by: John David Anglin Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- arch/parisc/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c index 9a898d68f4a0d..346456c43aa0b 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c @@ -795,7 +795,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs) * unless pagefault_disable() was called before. */ - if (fault_space == 0 && !faulthandler_disabled()) + if (faulthandler_disabled() || fault_space == 0) { /* Clean up and return if in exception table. */ if (fixup_exception(regs)) -- 2.34.1