Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3558531pxb; Mon, 24 Jan 2022 12:11:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyRnKIciz1cSlaJPPOw7ueJE79dXx5oaXWWnk+dVgxAtncypirq3ScaRZj5wiNoXkvfGjN2 X-Received: by 2002:a17:902:d883:b0:149:8429:88a7 with SMTP id b3-20020a170902d88300b00149842988a7mr15299004plz.165.1643055093224; Mon, 24 Jan 2022 12:11:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055093; cv=none; d=google.com; s=arc-20160816; b=fFPd4nXs5seTbYaFEva6YaGfReo4U7DLhEGQDUNR02dpnHIqjIbTFRtR7m7GCuX+WF ipIWRx4Iql3+4QKRgQL2ijjZyvc+29AcSmpppzQ6VZRHBehf9VMlEMyQCxO6ky41ou41 acrdFut4t28gM+qLAPxQMXkm4ITdYE9Fo3xJENO9SuI8dS+DnZLBaIaoZGYQ8r/od7No JUQrItXi5NplCbuP0vj13W0kZmbFCbQfyt6VoD+bcecvpu8xs58q6ylJzVKV3BUJXonF jPCeK3ig0fvRfOemCxjBX97okfYpViYxw/VjN9o6F0VBhtok8A6v4zD5pZppDqOShYg9 KUuQ== 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=yCC5EfquONib/TSRzg66c1ETIC/KPNKLpXWSCpvzz8A=; b=IeFCFxR0PvVuHdquES5oKQx4ajO11ZXHmT8bKHbGWIX1v874pPXpmXoAzZIyYUANnG mWA9PAm2Co8KN0+qz97kpqyKXj3SP95XVfetFMXxNOycHhzZjkYy1G4trVOsxLMoNFlS I37p1mWzUaD8uvKZMnoRJ+mD8+TecCunTbC8//AdlbnoXvlwuAbJGqG3sw2f5fT/Btzk fiKRcxnbuHY1SrwRSn+FM9szkGAajo4scHrIroGZqi//Ix+CHoiNGNXxB45UB4os+7za s0l1/MrTLH6JX68NNXk/8gyXXC+ntPpWOs+YbXlswyHkGdVc/BV2SU7g0NlG6wxrx04V zVrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="qOvJWEn/"; 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 x22si12289817pln.400.2022.01.24.12.11.18; Mon, 24 Jan 2022 12:11:33 -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="qOvJWEn/"; 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 S1347860AbiAXTNS (ORCPT + 99 others); Mon, 24 Jan 2022 14:13:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346088AbiAXTFD (ORCPT ); Mon, 24 Jan 2022 14:05:03 -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 1EA67C0604FD; Mon, 24 Jan 2022 10:59:25 -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 DB8EDB8122C; Mon, 24 Jan 2022 18:59:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F21BC340E5; Mon, 24 Jan 2022 18:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050762; bh=bgNt8tan3HJNugIA65XVudB9fyuaNnnmV3HhitjxRuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qOvJWEn/tAmqC7/MM0moTbTgUDeNUYKM7YIkLQrulRXWnyX6lnpwmRu2WZxhemBZo OfZxykkoeGg0xOKy89EVIl0ZfSvz7MnsGd7DGPLJvYQqoT9KcQG4zitrdmTQRGFzb3 JnfIjfht1onWAyZ/Mw6IvXVzYLpd6UUSb4dxa/DQ= 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.9 104/157] parisc: Avoid calling faulthandler_disabled() twice Date: Mon, 24 Jan 2022 19:43:14 +0100 Message-Id: <20220124183936.063719333@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183932.787526760@linuxfoundation.org> References: <20220124183932.787526760@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 11c91697d5f9e..5b41779de2337 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c @@ -793,7 +793,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