From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17C702E8DEB; Sat, 17 Oct 2026 16:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792253436; cv=none; b=cUGPMCDuXrHFx915jnMkeTPuS4JI6dM8Ky0iuXO5HEMgK38AD9jHsYnDeCSv8bQqd6jp3hpIg1+N+rJx1GvmNU2+UTPJUZPg1WMMujoVTM1eBwr2wa0pnS/UdXYr8V+37Hg/1119Asd9JV4+tCmXwGV6l0lw3oae4XhbGkzocNk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792253436; c=relaxed/simple; bh=ILiGXp1Sp7SdTj48LS2/HifYQJYYCWozqhBhLe1IUXI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dNhSDko9nBxcDDr6kbzQzRVfb5siEfNJ0dksdX5IGEWVHjmfv9jMkEe4lg3mo6/rVPpEfePLhvz9CbqjRstDpFQkpx3hFXTVk1TRhs9BXQaAcV3d5izxAZfyFAotmygxXhbUBbXhsGDvXa9R1UOQgSfg2sUiiDHnhSYWnnLDEgc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kbVHKutx; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="kbVHKutx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65D571F000C4; Sat, 17 Oct 2026 16:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792253435; bh=xVqxxct19EMQnMGQkYqGr3UKdTZRao9jb7Fo46NJZVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kbVHKutxjTtG/3KHvtvpAg06fFmKPZ/2viCulvwDln1FI7tYGZcx4vkWsnTq2U4cX DdFCe32qx9SeT2f05sA6cBEKGeX2mjtD8sFvr0hMpNNLUnkwt8AW6+5U4Rt5yu1Tdx cwMvxYu4zb28e7ZieX26RVYofM/Geen0oUD91R0M= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Biggers , Herbert Xu , Sasha Levin Subject: [PATCH 6.12 110/869] crypto: x86/aegis - Fix sleeping when disallowed on PREEMPT_RT Date: Sat, 17 Oct 2026 17:49:11 +0200 Message-ID: <20261017160039.857660653@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160036.979869304@linuxfoundation.org> References: <20261017160036.979869304@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Biggers [ Upstream commit c7f49dadfcdf27e1f747442e874e9baa52ab7674 ] skcipher_walk_done() can call kfree(), which takes a spinlock, which makes it incorrect to call while preemption is disabled on PREEMPT_RT. Therefore, end the kernel-mode FPU section before calling skcipher_walk_done(), and restart it afterwards. Moreover, pass atomic=false to skcipher_walk_aead_encrypt() instead of atomic=true. The point of atomic=true was to make skcipher_walk_done() safe to call while in a kernel-mode FPU section, but that does not actually work. So just use the usual atomic=false. Fixes: 1d373d4e8e15 ("crypto: x86 - Add optimized AEGIS implementations") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers Signed-off-by: Herbert Xu Stable-dep-of: 3d9eb180fbe8 ("crypto: x86/aegis - Add missing error checks") Signed-off-by: Sasha Levin --- arch/x86/crypto/aegis128-aesni-glue.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/crypto/aegis128-aesni-glue.c b/arch/x86/crypto/aegis128-aesni-glue.c index e7a28ccf273bf..de0aab6997d41 100644 --- a/arch/x86/crypto/aegis128-aesni-glue.c +++ b/arch/x86/crypto/aegis128-aesni-glue.c @@ -123,7 +123,9 @@ crypto_aegis128_aesni_process_crypt(struct aegis_state *state, walk->dst.virt.addr, round_down(walk->nbytes, AEGIS128_BLOCK_SIZE)); + kernel_fpu_end(); skcipher_walk_done(walk, walk->nbytes % AEGIS128_BLOCK_SIZE); + kernel_fpu_begin(); } if (walk->nbytes) { @@ -135,7 +137,9 @@ crypto_aegis128_aesni_process_crypt(struct aegis_state *state, aegis128_aesni_dec_tail(state, walk->src.virt.addr, walk->dst.virt.addr, walk->nbytes); + kernel_fpu_end(); skcipher_walk_done(walk, 0); + kernel_fpu_begin(); } } @@ -180,9 +184,9 @@ crypto_aegis128_aesni_crypt(struct aead_request *req, struct aegis_state state; if (enc) - skcipher_walk_aead_encrypt(&walk, req, true); + skcipher_walk_aead_encrypt(&walk, req, false); else - skcipher_walk_aead_decrypt(&walk, req, true); + skcipher_walk_aead_decrypt(&walk, req, false); kernel_fpu_begin(); -- 2.53.0