Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3724496pxb; Mon, 24 Jan 2022 16:23:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMTTLr5IWujEiyqioLCCqSSnwAHovkqiZ7fnfrimb6LXPh74tU8Q9xft0A2IJLIHg0OMBS X-Received: by 2002:a17:90b:1d8d:: with SMTP id pf13mr583414pjb.229.1643070210437; Mon, 24 Jan 2022 16:23:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643070210; cv=none; d=google.com; s=arc-20160816; b=HV9a0DZzRXdKrNZCPjUJghE0usbRvCeQ//GAZEIihwyWrK1BJPsj5QSQIMMU1mOpdQ zYCvOafu9DJak6kLa10BfoftHaZN8sAtXpti0GrUq8BqcmPDSpRnFXZOqXIdl0rZgI0T hBxxnJgSgsAcXFs4GgHVa+0MsQD89WGfEJSiysA7eSpGS/KB7zlXQeToSu2hv01RVY2o LWzmGYqoVmH+pFz+6a9fAgYKh4bwrGDHk3b7iXXt8m7UlND2+dQRDVtzEr3NPlmR0URy 6zNQ0seby6If9qNwph6K3D9izeDRYo+luPfVNYTsVbEMKFy/Jp8ja0PpXTMhKZyehQYx ylMQ== 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=CzhmP+cXzf98c+rNsIfnG/ISEiJV0Xaq4koeVoT1F80=; b=bjTw4INxo7kLlmwIRDGHWccdsINFG7cs5ai+U+kcid+Lc48sZwDmbdT3HA+d/NZ99k gExIQQ5qHi4J/4VD8RiyIcdvdCoeg+u0Hiwq7XPsqiF6pQM4sK/Uigdz0KVXhwNE/xfh SblYqzlm1waDNsDFQO1gY8qQIQ9zc87k+znjFGJBWbrsXNZUGncPU0Izt8mHzx13f40a Uet021H5hRr6d4scjj5m8arI7CtIslVljnJl+HofeYLyxxuEeLpDkqX6XmeECb4Y6ECN W4g8p//R2W8fieYXRRsJiyAzlaYRn4xUBCDZPorQU3nE4jQlnevpCoE5daThyXfUj0Sy if0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BMk23j49; 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 z3si2507029pfe.355.2022.01.24.16.23.18; Mon, 24 Jan 2022 16:23:30 -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=BMk23j49; 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 S2374606AbiAYARc (ORCPT + 99 others); Mon, 24 Jan 2022 19:17:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356245AbiAXX2B (ORCPT ); Mon, 24 Jan 2022 18:28:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F578C01D7EA; Mon, 24 Jan 2022 13:30:49 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 2C07E614E1; Mon, 24 Jan 2022 21:30:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13E06C340E4; Mon, 24 Jan 2022 21:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059848; bh=G82Q4cPxhw81sOqVHOtuTQNejvoexVwt2CxtmuQC0No=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BMk23j49+M25zpb1nZbDz2RrMhlBclyk19FOHtoGkDKllBECsPvvDZ77RTqUf7WGB ZWNDoHMaAapDTYlAHpFJxp9Q/DpKwixVCN06d1GxPTK9imWxWlXIxA2YB0oJuhlWo6 sW8ZwVN58eiX5GnmJEyyJVe7u03wTCLpIDbXomZc= 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 5.16 0727/1039] parisc: Avoid calling faulthandler_disabled() twice Date: Mon, 24 Jan 2022 19:41:56 +0100 Message-Id: <20220124184149.768356308@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 892b7fc8f3c45..eb41fece19104 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c @@ -785,7 +785,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