summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2025-04-01 13:57:30 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2025-04-03 19:04:33 +0800
commit12e0b15b1986736af8c64b920efad00c655a3c79 (patch)
treefbe924e485b3f08aae31144b067188d71e361a26
parent9764d5b0cd0ea4846fd46c7d0b4238ea122075a9 (diff)
downloadlinux-12e0b15b1986736af8c64b920efad00c655a3c79.tar.gz
linux-12e0b15b1986736af8c64b920efad00c655a3c79.tar.bz2
linux-12e0b15b1986736af8c64b920efad00c655a3c79.zip
crypto: inside-secure/eip93 - acquire lock on eip93_put_descriptor hash
In the EIP93 HASH functions, the eip93_put_descriptor is called without acquiring lock. This is problematic when multiple thread execute hash operations. Correctly acquire ring write lock on calling eip93_put_descriptor to prevent concurrent access and mess with the ring pointers. Fixes: 9739f5f93b78 ("crypto: eip93 - Add Inside Secure SafeXcel EIP-93 crypto engine support") Reported-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/inside-secure/eip93/eip93-hash.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/crypto/inside-secure/eip93/eip93-hash.c b/drivers/crypto/inside-secure/eip93/eip93-hash.c
index 5e9627467a42..df1b05ac5a57 100644
--- a/drivers/crypto/inside-secure/eip93/eip93-hash.c
+++ b/drivers/crypto/inside-secure/eip93/eip93-hash.c
@@ -260,7 +260,8 @@ static int eip93_send_hash_req(struct crypto_async_request *async, u8 *data,
}
again:
- ret = eip93_put_descriptor(eip93, &cdesc);
+ scoped_guard(spinlock_irqsave, &eip93->ring->write_lock)
+ ret = eip93_put_descriptor(eip93, &cdesc);
if (ret) {
usleep_range(EIP93_RING_BUSY_DELAY,
EIP93_RING_BUSY_DELAY * 2);