cryptodev: Use wait_for_completion_timeout for async calls
Debarshi Dutta [Tue, 3 Oct 2017 09:00:47 +0000 (14:00 +0530)]
AES operations are asynchronous and when waiting for them
to complete, don't allow tasks to be interruptible.

Bug 200327042
Bug 200292436

Change-Id: I17305f601543d349e60cd986df3e949b7439e971
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1572379
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Tested-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>

drivers/misc/tegra-cryptodev.c

index acc893c..3b89504 100644 (file)
@@ -234,9 +234,10 @@ static int process_crypt_req(struct file *filp, struct tegra_crypto_ctx *ctx,
                        crypto_ablkcipher_decrypt(req);
                if ((ret == -EINPROGRESS) || (ret == -EBUSY)) {
                        /* crypto driver is asynchronous */
-                       ret = wait_for_completion_interruptible(&tcrypt_complete.restart);
+                       ret = wait_for_completion_timeout(&tcrypt_complete.restart,
+                                               msecs_to_jiffies(5000));
 
-                       if (ret < 0)
+                       if (ret == 0)
                                goto process_req_buf_out;
 
                        if (tcrypt_complete.req_err < 0) {