From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f196.google.com ([209.85.208.196]:37534 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727445AbeK0Lnf (ORCPT ); Tue, 27 Nov 2018 06:43:35 -0500 Received: by mail-lj1-f196.google.com with SMTP id e5-v6so18458624lja.4 for ; Mon, 26 Nov 2018 16:47:33 -0800 (PST) From: Max Filippov To: linux-xtensa@linux-xtensa.org Cc: Chris Zankel , Max Filippov , stable@vger.kernel.org Subject: [PATCH] xtensa: don't clear cpenable unconditionally on release Date: Mon, 26 Nov 2018 16:47:21 -0800 Message-Id: <20181127004721.27244-1-jcmvbkbc@gmail.com> Sender: stable-owner@vger.kernel.org List-ID: fast_coprocessor exception handler expects that the coprocessor owner task never gets the "coprocessor disabled" exception for a coprocessor that is marked as enabled in the thread_info::cpenable. If that happens it will reload potentially outdated context from the thread_info structure into the coprocessor registers. Only call coprocessor_clear_cpenable from the coprocessor_release_all if the latter is called for the current task. Cc: stable@vger.kernel.org Signed-off-by: Max Filippov --- arch/xtensa/kernel/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c index 3fa0c440f664..6c7c80106f60 100644 --- a/arch/xtensa/kernel/process.c +++ b/arch/xtensa/kernel/process.c @@ -87,7 +87,8 @@ void coprocessor_release_all(struct thread_info *ti) } ti->cpenable = cpenable; - coprocessor_clear_cpenable(); + if (ti == current_thread_info()) + coprocessor_clear_cpenable(); preempt_enable(); } -- 2.11.0