Commit d59421b4 authored by Maxime Méré's avatar Maxime Méré Committed by Huang Xiaojia
Browse files

crypto: stm32/cryp - call finalize with bh disabled

stable inclusion
from stable-v6.6.50
commit d93a2f86b0a998aa1f0870c85a2a60a0771ef89a
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAVU3C
CVE: CVE-2024-47658

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d93a2f86b0a998aa1f0870c85a2a60a0771ef89a



--------------------------------

[ Upstream commit 56ddb9aa3b324c2d9645b5a7343e46010cf3f6ce ]

The finalize operation in interrupt mode produce a produces a spinlock
recursion warning. The reason is the fact that BH must be disabled
during this process.

Signed-off-by: default avatarMaxime Méré <maxime.mere@foss.st.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarHuang Xiaojia <huangxiaojia2@huawei.com>
parent 30113d28
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <crypto/internal/des.h>
#include <crypto/internal/skcipher.h>
#include <crypto/scatterwalk.h>
#include <linux/bottom_half.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/err.h>
@@ -1665,8 +1666,11 @@ static irqreturn_t stm32_cryp_irq_thread(int irq, void *arg)
		it_mask &= ~IMSCR_OUT;
	stm32_cryp_write(cryp, cryp->caps->imsc, it_mask);

	if (!cryp->payload_in && !cryp->header_in && !cryp->payload_out)
	if (!cryp->payload_in && !cryp->header_in && !cryp->payload_out) {
		local_bh_disable();
		stm32_cryp_finish_req(cryp, 0);
		local_bh_enable();
	}

	return IRQ_HANDLED;
}