summaryrefslogtreecommitdiff
path: root/arch/s390/crypto
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2017-02-28 07:05:59 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2017-03-01 09:59:27 +0100
commite7c95effcd3a7a0c9535c809141ca499fede2c31 (patch)
tree443ed774218ce8d1f3b8b1dcf5bc12d84827f593 /arch/s390/crypto
parent2d6be4abf514fc26c83d239c7f31da1f95e4a31d (diff)
downloadlinux-exynos-e7c95effcd3a7a0c9535c809141ca499fede2c31.tar.gz
linux-exynos-e7c95effcd3a7a0c9535c809141ca499fede2c31.tar.bz2
linux-exynos-e7c95effcd3a7a0c9535c809141ca499fede2c31.zip
s390/crypt: fix missing unlock in ctr_paes_crypt on error path
The ctr mode of protected key aes uses the ctrblk page if the ctrblk_lock could be acquired. If the protected key has to be reestablished and this operation fails the unlock for the ctrblk_lock is missing. Add it. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/crypto')
-rw-r--r--arch/s390/crypto/paes_s390.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/s390/crypto/paes_s390.c b/arch/s390/crypto/paes_s390.c
index d69ea495c4d7..716b17238599 100644
--- a/arch/s390/crypto/paes_s390.c
+++ b/arch/s390/crypto/paes_s390.c
@@ -474,8 +474,11 @@ static int ctr_paes_crypt(struct blkcipher_desc *desc, unsigned long modifier,
ret = blkcipher_walk_done(desc, walk, nbytes - n);
}
if (k < n) {
- if (__ctr_paes_set_key(ctx) != 0)
+ if (__ctr_paes_set_key(ctx) != 0) {
+ if (locked)
+ spin_unlock(&ctrblk_lock);
return blkcipher_walk_done(desc, walk, -EIO);
+ }
}
}
if (locked)