Skip to content

Commit

Permalink
s390/crypt: fix missing unlock in ctr_paes_crypt on error path
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Martin Schwidefsky committed Mar 1, 2017
1 parent 2d6be4a commit e7c95ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arch/s390/crypto/paes_s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e7c95ef

Please sign in to comment.