diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2022-05-04 17:07:36 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-14 18:11:41 +0200 |
commit | dd8c886953dba44b747c28feb2396ad2f5f8a0bf (patch) | |
tree | 4ff940e23b1a3a103f5a2068b454228efaea6379 /crypto/drbg.c | |
parent | 4fab6773c7bc4a6f51e81cfb590ae77513fcbb79 (diff) | |
download | linux-crypto-dd8c886953dba44b747c28feb2396ad2f5f8a0bf.tar.gz linux-crypto-dd8c886953dba44b747c28feb2396ad2f5f8a0bf.zip |
crypto: cryptd - Protect per-CPU resource by disabling BH.
[ Upstream commit 91e8bcd7b4da182e09ea19a2c73167345fe14c98 ]
The access to cryptd_queue::cpu_queue is synchronized by disabling
preemption in cryptd_enqueue_request() and disabling BH in
cryptd_queue_worker(). This implies that access is allowed from BH.
If cryptd_enqueue_request() is invoked from preemptible context _and_
soft interrupt then this can lead to list corruption since
cryptd_enqueue_request() is not protected against access from
soft interrupt.
Replace get_cpu() in cryptd_enqueue_request() with local_bh_disable()
to ensure BH is always disabled.
Remove preempt_disable() from cryptd_queue_worker() since it is not
needed because local_bh_disable() ensures synchronisation.
Fixes: a045a18f0207 ("crypto: cryptd - Per-CPU thread implementation...")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions