crypto: iaa - Fix async_disable descriptor leak
authorTom Zanussi <tom.zanussi@linux.intel.com>
Sun, 25 Feb 2024 20:11:33 +0000 (14:11 -0600)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 1 Mar 2024 10:35:40 +0000 (18:35 +0800)
The disable_async paths of iaa_compress/decompress() don't free idxd
descriptors in the async_disable case. Currently this only happens in
the testcases where req->dst is set to null. Add a test to free them
in those paths.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/intel/iaa/iaa_crypto_main.c

index 39a5fc905c4dc2e81edbcaa7344f7273e61d1e11..85ee4c965ccf68ee3a43a2e18a392edd55498452 100644 (file)
@@ -1222,7 +1222,7 @@ static int iaa_compress(struct crypto_tfm *tfm,   struct acomp_req *req,
 
        *compression_crc = idxd_desc->iax_completion->crc;
 
-       if (!ctx->async_mode)
+       if (!ctx->async_mode || disable_async)
                idxd_free_desc(wq, idxd_desc);
 out:
        return ret;
@@ -1468,7 +1468,7 @@ static int iaa_decompress(struct crypto_tfm *tfm, struct acomp_req *req,
 
        *dlen = req->dlen;
 
-       if (!ctx->async_mode)
+       if (!ctx->async_mode || disable_async)
                idxd_free_desc(wq, idxd_desc);
 
        /* Update stats */