Skip to content

Commit 49c0266

Browse files
herbertxgregkh
authored andcommitted
crypto: tegra - Disable softirqs before finalizing request
[ Upstream commit 2aeec9a ] Softirqs must be disabled when calling the finalization fucntion on a request. Reported-by: Guangwu Zhang <guazhang@redhat.com> Fixes: 0880bb3 ("crypto: tegra - Add Tegra Security Engine driver") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9a0ed69 commit 49c0266

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

drivers/crypto/tegra/tegra-se-aes.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Crypto driver to handle block cipher algorithms using NVIDIA Security Engine.
55
*/
66

7+
#include <linux/bottom_half.h>
78
#include <linux/clk.h>
89
#include <linux/dma-mapping.h>
910
#include <linux/module.h>
@@ -333,7 +334,9 @@ static int tegra_aes_do_one_req(struct crypto_engine *engine, void *areq)
333334
tegra_key_invalidate_reserved(ctx->se, key2_id, ctx->alg);
334335

335336
out_finalize:
337+
local_bh_disable();
336338
crypto_finalize_skcipher_request(se->engine, req, ret);
339+
local_bh_enable();
337340

338341
return 0;
339342
}
@@ -1262,7 +1265,9 @@ static int tegra_ccm_do_one_req(struct crypto_engine *engine, void *areq)
12621265
tegra_key_invalidate_reserved(ctx->se, rctx->key_id, ctx->alg);
12631266

12641267
out_finalize:
1268+
local_bh_disable();
12651269
crypto_finalize_aead_request(ctx->se->engine, req, ret);
1270+
local_bh_enable();
12661271

12671272
return 0;
12681273
}
@@ -1348,7 +1353,9 @@ static int tegra_gcm_do_one_req(struct crypto_engine *engine, void *areq)
13481353
tegra_key_invalidate_reserved(ctx->se, rctx->key_id, ctx->alg);
13491354

13501355
out_finalize:
1356+
local_bh_disable();
13511357
crypto_finalize_aead_request(ctx->se->engine, req, ret);
1358+
local_bh_enable();
13521359

13531360
return 0;
13541361
}
@@ -1746,7 +1753,9 @@ static int tegra_cmac_do_one_req(struct crypto_engine *engine, void *areq)
17461753
if (tegra_key_is_reserved(rctx->key_id))
17471754
tegra_key_invalidate_reserved(ctx->se, rctx->key_id, ctx->alg);
17481755

1756+
local_bh_disable();
17491757
crypto_finalize_hash_request(se->engine, req, ret);
1758+
local_bh_enable();
17501759

17511760
return 0;
17521761
}

drivers/crypto/tegra/tegra-se-hash.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Crypto driver to handle HASH algorithms using NVIDIA Security Engine.
55
*/
66

7+
#include <linux/bottom_half.h>
78
#include <linux/clk.h>
89
#include <linux/dma-mapping.h>
910
#include <linux/module.h>
@@ -498,7 +499,9 @@ static int tegra_sha_do_one_req(struct crypto_engine *engine, void *areq)
498499
}
499500

500501
out:
502+
local_bh_disable();
501503
crypto_finalize_hash_request(se->engine, req, ret);
504+
local_bh_enable();
502505

503506
return 0;
504507
}

0 commit comments

Comments
 (0)