Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17940211ybl; Thu, 2 Jan 2020 15:13:11 -0800 (PST) X-Google-Smtp-Source: APXvYqxmtx4tb2iNBTMxWqzHfo8GGJEab3OPvz0HLegLJVgr8dVkH4GE6AEZKX5eEd39oaC4NCJd X-Received: by 2002:a05:6830:1e37:: with SMTP id t23mr9446865otr.16.1578006791084; Thu, 02 Jan 2020 15:13:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578006791; cv=none; d=google.com; s=arc-20160816; b=bUhGLYs+d7B1FdpXo3YI+524Fn3u97G//8VQvQtvn/v2CH5hCxFX3d0v+gYv9AOmj8 I24E2qKHY355iFXUyLlwSoS37o2BtVv/XLqVCQDA/VzOJxN4lg2UN9eDifAGyLSxPB3R UrGu4v3T5WZ88GyOMKyXvTzoiUTUH04oIBs8PkYHODKr2FfNp2wrY2G2EeVzo9J3cBKP hku5MD3wVbM6Qu9Ig6dL15nXX8e3ayRCanWKZM1yOpxSDWGKECuNwnvCVJ1JyGpyg9a+ Sbg49tQ2WmSQf7d5v2qaxBYQsOx9LrMbSt6ixnTXCxIZ/Xoh9LfvxsIYvLN2h3Y/SUfM TeZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5XliO+rRBkq/V7aNastmTNwLQV0QdQlFivnd7I486Dw=; b=YDjTlePpJ6a6hALgkzYvVY/V8nZr9e6+/9We+hMEjtl+DUgom6QBW+x3WTkf8C4ZRB ijxpYXTX2D1gaDLma/l03gAoRqBjxzC0fve+1PaGUtIaRDPm6UGAnMagaX9UvrIWlFTa 9Sc4E/yIJZ+C0p0gV3C214ZTk/fRz1G4Ac/eNQkWabhvJ50Wo+r0ibkMLnzCQOaGNXOM PS2uIeDxsQihSvPJCgCYClasuISC5LKdNdrq08IVBFH40wKasNt72d+jQi+Fsai0fNjn S2JP7j2unIqzeEfrnBSkgb3xcmFEcO7R4CvU5SsFEFP/XBgU1xtfeF4N8CyAl532406I RzSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Lmjfm03A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b25si27560911otp.212.2020.01.02.15.12.59; Thu, 02 Jan 2020 15:13:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Lmjfm03A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730221AbgABWqQ (ORCPT + 99 others); Thu, 2 Jan 2020 17:46:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:35934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730246AbgABWbI (ORCPT ); Thu, 2 Jan 2020 17:31:08 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4968C20863; Thu, 2 Jan 2020 22:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004267; bh=zCDTEKqulQ5WWoR3gp/l+LFyviaRUjMFPWj8HUFfsl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lmjfm03A7ReXDLAjsauJIRTo+GOHrZ6v5zLQ0rWkIDAjWGb2EQSuKZFtaaweakme7 aC/XDkhfwJ4p1ldfiUAkgaw0/XaA/4hueXRyEwh5T5DvrFPgDxV9ZYD2qnvle0Xq8Q UR85oWbT7mSyzKVBcKRFsdyKLvR4I1f3eywPbJOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman Subject: [PATCH 4.9 108/171] powerpc/irq: fix stack overflow verification Date: Thu, 2 Jan 2020 23:07:19 +0100 Message-Id: <20200102220602.146773569@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.960200039@linuxfoundation.org> References: <20200102220546.960200039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy commit 099bc4812f09155da77eeb960a983470249c9ce1 upstream. Before commit 0366a1c70b89 ("powerpc/irq: Run softirqs off the top of the irq stack"), check_stack_overflow() was called by do_IRQ(), before switching to the irq stack. In that commit, do_IRQ() was renamed __do_irq(), and is now executing on the irq stack, so check_stack_overflow() has just become almost useless. Move check_stack_overflow() call in do_IRQ() to do the check while still on the current stack. Fixes: 0366a1c70b89 ("powerpc/irq: Run softirqs off the top of the irq stack") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/e033aa8116ab12b7ca9a9c75189ad0741e3b9b5f.1575872340.git.christophe.leroy@c-s.fr Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -527,8 +527,6 @@ void __do_irq(struct pt_regs *regs) trace_irq_entry(regs); - check_stack_overflow(); - /* * Query the platform PIC for the interrupt & ack it. * @@ -560,6 +558,8 @@ void do_IRQ(struct pt_regs *regs) irqtp = hardirq_ctx[raw_smp_processor_id()]; sirqtp = softirq_ctx[raw_smp_processor_id()]; + check_stack_overflow(); + /* Already there ? */ if (unlikely(curtp == irqtp || curtp == sirqtp)) { __do_irq(regs);