Skip to content

Commit

Permalink
crypto: qat - do not offload zero length requests
Browse files Browse the repository at this point in the history
If a zero length request is submitted through the skcipher api,
do not offload it and return success.

Reviewed-by: Conor Mcloughlin <conor.mcloughlin@intel.com>
Tested-by: Sergey Portnoy <sergey.portnoy@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Giovanni Cabiddu authored and Herbert Xu committed May 23, 2019
1 parent 96ee111 commit a3af113
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/crypto/qat/qat_common/qat_algs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,9 @@ static int qat_alg_ablkcipher_encrypt(struct ablkcipher_request *req)
struct device *dev = &GET_DEV(ctx->inst->accel_dev);
int ret, ctr = 0;

if (req->nbytes == 0)
return 0;

qat_req->iv = dma_alloc_coherent(dev, AES_BLOCK_SIZE,
&qat_req->iv_paddr, GFP_ATOMIC);
if (!qat_req->iv)
Expand Down Expand Up @@ -1115,6 +1118,9 @@ static int qat_alg_ablkcipher_decrypt(struct ablkcipher_request *req)
struct device *dev = &GET_DEV(ctx->inst->accel_dev);
int ret, ctr = 0;

if (req->nbytes == 0)
return 0;

qat_req->iv = dma_alloc_coherent(dev, AES_BLOCK_SIZE,
&qat_req->iv_paddr, GFP_ATOMIC);
if (!qat_req->iv)
Expand Down

0 comments on commit a3af113

Please sign in to comment.