Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3547759pxb; Mon, 24 Jan 2022 11:57:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSE0o43KlrVtM1m2eStu353MUo/WHUC3SJcZS2WAdORNhUCVM2sgk3/HOinoD5kfIz1HrU X-Received: by 2002:a17:90b:1e06:: with SMTP id pg6mr3457335pjb.178.1643054263713; Mon, 24 Jan 2022 11:57:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054263; cv=none; d=google.com; s=arc-20160816; b=xleUnKpe9JTrpFPJX04AbKReHlb+wppW9ck47rhOhfO52PxLlnBayruo6+SNGpVcDT GKJWAp7K22Ghu4mHmGIiHDQJBQAQ8/0F6I8QlHNQR+CVUSPJr9YeVCxv86q1Ce5N/+4r srVa1NmhzSlJLbXWkR2Q/lbHq+GtPaCIWkd+jIuSlBD9JeuvTfBpNK/q5E8z2n4metXg /Q/QKhJ5w6DY1dQ+fVJILG1bMEqSHrwPxFXyE79Fs8iHlMBb4DelEX/QPbzs4j42Zn2G CsCFPCDG+OeI8a1hgyNRiW7XLzOgaFYmJZS2hHr8eJrsC0ZI1OHdQ0/sRbt2HSi3Yxaa oZJQ== 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=nocY9IK+6ZYutuI0Z56r7kybSShzk4WemQKGSmJBU6Q=; b=Poz3gjixbtzVaAleeldv1BPOwFDJW8sWv8/P70OyXxaR2p+lZE8TjusJKQ+gN0sVb1 4JdMmhk30Cqd/qIg5Zmr9Se3U2Lw89jtywba79VDEUIwYjc9mAzXgcZjDuqJWAinqmVP CBeBjO9Pk/yiqqjF0vUUFxQ+YHArR8VrsrFZCaz+6NsyRI7OutO05AviCayNfvClvZgJ cVZ2UHR46Dy9gNeky7XUkYMcXHypRfYiZRSO/72UnyLqm5UX1x5bwg59a3nPV4gOWl35 e30+9JOByDIedOmK9hR60yKzswsZDhyByKNh1H3Hggmv4XDCpXZOjGWF4tW6V2LP4s2K dzmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="mG2A3L/i"; 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 6si12592258pgi.55.2022.01.24.11.57.31; Mon, 24 Jan 2022 11:57:43 -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="mG2A3L/i"; 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 S1344273AbiAXSyI (ORCPT + 99 others); Mon, 24 Jan 2022 13:54:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343611AbiAXSwZ (ORCPT ); Mon, 24 Jan 2022 13:52:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B21EC0617A6; Mon, 24 Jan 2022 10:52:14 -0800 (PST) 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 A7E5FB81227; Mon, 24 Jan 2022 18:52:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C708BC340E5; Mon, 24 Jan 2022 18:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050332; bh=nF1g3TlmBQAjvdwYb0PgfScODMcjqpRH4mw4fHaeTBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mG2A3L/i/p0+bxE92vI63bV153IeD/X+bklsBH3IE0QJYIFXXwIrnO0jctyXYogKm xLwpIpz9J9z+dxEY0QwsCYb+tqqrd1vM5J4kEQSpIFRylB11O4d3fFcCWEPDRI+ER0 Gq3vWpf+gmr1qoFs36WlwO9sefhio+70XhKApE/w= 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.4 083/114] parisc: Avoid calling faulthandler_disabled() twice Date: Mon, 24 Jan 2022 19:42:58 +0100 Message-Id: <20220124183929.673037481@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183927.095545464@linuxfoundation.org> References: <20220124183927.095545464@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 6f61a17e2485a..55e7ba06511df 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c @@ -796,7 +796,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