diff options
author | Harinarayan Bhatta <hbhatta@nvidia.com> | 2021-09-16 22:04:02 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2021-09-24 09:24:54 -0400 |
commit | 8eaae7f5c8647821846c217b5c8a8c6c0a10d1ee (patch) | |
tree | 248eee4dad244566fe2aba5a6a27095904c1c050 | |
parent | bacf198b8676adcb49b7b1e7fc98ceb0e7e33830 (diff) |
crypto: tegra: return error upon wait timeout
Return an error value from process_crypt_req if
wait_for_completion_timeout returns 0 in case of a timeout waiting
for crypto operation to complete.
Bug 200771660
Change-Id: Ie7597a053274cace6b930895e3f969622a813d76
Signed-off-by: Harinarayan Bhatta <hbhatta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/#/c/linux-nvidia/+/2596050
(cherry picked from commit f62687d53e0437b6138c02a4463acee21361cd26)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2599867
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Phoenix Jung <pjung@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r-- | drivers/crypto/tegra-cryptodev.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/crypto/tegra-cryptodev.c b/drivers/crypto/tegra-cryptodev.c index e9bc70cdb..43a060535 100644 --- a/drivers/crypto/tegra-cryptodev.c +++ b/drivers/crypto/tegra-cryptodev.c | |||
@@ -357,16 +357,22 @@ static int process_crypt_req(struct file *filp, struct tegra_crypto_ctx *ctx, | |||
357 | /* crypto driver is asynchronous */ | 357 | /* crypto driver is asynchronous */ |
358 | ret = wait_for_completion_timeout(&tcrypt_complete.restart, | 358 | ret = wait_for_completion_timeout(&tcrypt_complete.restart, |
359 | msecs_to_jiffies(5000)); | 359 | msecs_to_jiffies(5000)); |
360 | if (ret == 0) | 360 | if (ret == 0) { |
361 | pr_err("%scrypt timed out\n", | ||
362 | crypt_req->encrypt ? "en" : "de"); | ||
363 | ret = -ENODATA; | ||
361 | goto process_req_buf_out; | 364 | goto process_req_buf_out; |
365 | } | ||
362 | 366 | ||
363 | if (tcrypt_complete.req_err < 0) { | 367 | if (tcrypt_complete.req_err < 0) { |
364 | ret = tcrypt_complete.req_err; | 368 | ret = tcrypt_complete.req_err; |
369 | pr_err("%scrypt failed (%d)\n", | ||
370 | crypt_req->encrypt ? "en" : "de", ret); | ||
365 | goto process_req_buf_out; | 371 | goto process_req_buf_out; |
366 | } | 372 | } |
367 | } else if (ret < 0) { | 373 | } else if (ret < 0) { |
368 | pr_debug("%scrypt failed (%d)\n", | 374 | pr_err("%scrypt failed (%d)\n", |
369 | crypt_req->encrypt ? "en" : "de", ret); | 375 | crypt_req->encrypt ? "en" : "de", ret); |
370 | goto process_req_buf_out; | 376 | goto process_req_buf_out; |
371 | } | 377 | } |
372 | 378 | ||