diff options
Diffstat (limited to 'drivers/crypto/nx/nx-aes-gcm.c')
-rw-r--r-- | drivers/crypto/nx/nx-aes-gcm.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/crypto/nx/nx-aes-gcm.c b/drivers/crypto/nx/nx-aes-gcm.c index 6cca6c392b00..df90d03afc10 100644 --- a/drivers/crypto/nx/nx-aes-gcm.c +++ b/drivers/crypto/nx/nx-aes-gcm.c @@ -166,8 +166,11 @@ static int gcm_aes_nx_crypt(struct aead_request *req, int enc) struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; struct blkcipher_desc desc; unsigned int nbytes = req->cryptlen; + unsigned long irq_flags; int rc = -EINVAL; + spin_lock_irqsave(&nx_ctx->lock, irq_flags); + if (nbytes > nx_ctx->ap->databytelen) goto out; @@ -255,6 +258,7 @@ static int gcm_aes_nx_crypt(struct aead_request *req, int enc) -EBADMSG : 0; } out: + spin_unlock_irqrestore(&nx_ctx->lock, irq_flags); return rc; } |