summaryrefslogtreecommitdiff
path: root/arch/s390/crypto/des_s390.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-31 10:49:25 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-31 10:49:25 -0700
commit27a03b1a71b9adfa7f4ef3f61452fb3bc5b195b1 (patch)
tree3c2ce43bc1a82c2213139858be600d57cbd18e38 /arch/s390/crypto/des_s390.c
parent702c31e8564c386dd5e304e46cf22fcaa40b1a66 (diff)
parent674459be116955e025d6a5e6142e2d500103de8e (diff)
Merge tag 's390-5.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fixes from Heiko Carstens: - Farewell Martin Schwidefsky: add Martin to CREDITS and remove him from MAINTAINERS - Vasily Gorbik and Christian Borntraeger join as maintainers for s390 - Fix locking bug in ctr(aes) and ctr(des) s390 specific ciphers - A rather large patch which fixes gcm-aes-s390 scatter gather handling - Fix zcrypt wrong dispatching for control domain CPRBs - Fix assignment of bus resources in PCI code - Fix structure definition for set PCI function - Fix one compile error and one compile warning seen when CONFIG_OPTIMIZE_INLINING is enabled * tag 's390-5.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: MAINTAINERS: add Vasily Gorbik and Christian Borntraeger for s390 MAINTAINERS: Farewell Martin Schwidefsky s390/crypto: fix possible sleep during spinlock aquired s390/crypto: fix gcm-aes-s390 selftest failures s390/zcrypt: Fix wrong dispatching for control domain CPRBs s390/pci: fix assignment of bus resources s390/pci: fix struct definition for set PCI function s390: mark __cpacf_check_opcode() and cpacf_query_func() as __always_inline s390: add unreachable() to dump_fault_info() to fix -Wmaybe-uninitialized
Diffstat (limited to 'arch/s390/crypto/des_s390.c')
-rw-r--r--arch/s390/crypto/des_s390.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
index 1f9ab24dc048..374b42fc7637 100644
--- a/arch/s390/crypto/des_s390.c
+++ b/arch/s390/crypto/des_s390.c
@@ -14,6 +14,7 @@
#include <linux/cpufeature.h>
#include <linux/crypto.h>
#include <linux/fips.h>
+#include <linux/mutex.h>
#include <crypto/algapi.h>
#include <crypto/des.h>
#include <asm/cpacf.h>
@@ -21,7 +22,7 @@
#define DES3_KEY_SIZE (3 * DES_KEY_SIZE)
static u8 *ctrblk;
-static DEFINE_SPINLOCK(ctrblk_lock);
+static DEFINE_MUTEX(ctrblk_lock);
static cpacf_mask_t km_functions, kmc_functions, kmctr_functions;
@@ -374,7 +375,7 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, unsigned long fc,
unsigned int n, nbytes;
int ret, locked;
- locked = spin_trylock(&ctrblk_lock);
+ locked = mutex_trylock(&ctrblk_lock);
ret = blkcipher_walk_virt_block(desc, walk, DES_BLOCK_SIZE);
while ((nbytes = walk->nbytes) >= DES_BLOCK_SIZE) {
@@ -391,7 +392,7 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, unsigned long fc,
ret = blkcipher_walk_done(desc, walk, nbytes - n);
}
if (locked)
- spin_unlock(&ctrblk_lock);
+ mutex_unlock(&ctrblk_lock);
/* final block may be < DES_BLOCK_SIZE, copy only nbytes */
if (nbytes) {
cpacf_kmctr(fc, ctx->key, buf, walk->src.virt.addr,