2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-19 02:34:01 +08:00

crypto: hisilicon - Bugfixed tfm leak

1.Fixed the bug of software tfm leakage.
2.Update HW error log message.

Signed-off-by: Zaibo Xu <xuzaibo@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Zaibo Xu 2020-01-11 16:58:15 +08:00 committed by Herbert Xu
parent 2f072d75d1
commit dfee9955ab
2 changed files with 18 additions and 13 deletions

View File

@ -1043,6 +1043,7 @@ static unsigned int hpre_rsa_max_size(struct crypto_akcipher *tfm)
static int hpre_rsa_init_tfm(struct crypto_akcipher *tfm)
{
struct hpre_ctx *ctx = akcipher_tfm_ctx(tfm);
int ret;
ctx->rsa.soft_tfm = crypto_alloc_akcipher("rsa-generic", 0, 0);
if (IS_ERR(ctx->rsa.soft_tfm)) {
@ -1050,7 +1051,11 @@ static int hpre_rsa_init_tfm(struct crypto_akcipher *tfm)
return PTR_ERR(ctx->rsa.soft_tfm);
}
return hpre_ctx_init(ctx);
ret = hpre_ctx_init(ctx);
if (ret)
crypto_free_akcipher(ctx->rsa.soft_tfm);
return ret;
}
static void hpre_rsa_exit_tfm(struct crypto_akcipher *tfm)

View File

@ -106,18 +106,18 @@ static const char * const hpre_debug_file_name[] = {
};
static const struct hpre_hw_error hpre_hw_errors[] = {
{ .int_msk = BIT(0), .msg = "hpre_ecc_1bitt_err" },
{ .int_msk = BIT(1), .msg = "hpre_ecc_2bit_err" },
{ .int_msk = BIT(2), .msg = "hpre_data_wr_err" },
{ .int_msk = BIT(3), .msg = "hpre_data_rd_err" },
{ .int_msk = BIT(4), .msg = "hpre_bd_rd_err" },
{ .int_msk = BIT(5), .msg = "hpre_ooo_2bit_ecc_err" },
{ .int_msk = BIT(6), .msg = "hpre_cltr1_htbt_tm_out_err" },
{ .int_msk = BIT(7), .msg = "hpre_cltr2_htbt_tm_out_err" },
{ .int_msk = BIT(8), .msg = "hpre_cltr3_htbt_tm_out_err" },
{ .int_msk = BIT(9), .msg = "hpre_cltr4_htbt_tm_out_err" },
{ .int_msk = GENMASK(15, 10), .msg = "hpre_ooo_rdrsp_err" },
{ .int_msk = GENMASK(21, 16), .msg = "hpre_ooo_wrrsp_err" },
{ .int_msk = BIT(0), .msg = "core_ecc_1bit_err_int_set" },
{ .int_msk = BIT(1), .msg = "core_ecc_2bit_err_int_set" },
{ .int_msk = BIT(2), .msg = "dat_wb_poison_int_set" },
{ .int_msk = BIT(3), .msg = "dat_rd_poison_int_set" },
{ .int_msk = BIT(4), .msg = "bd_rd_poison_int_set" },
{ .int_msk = BIT(5), .msg = "ooo_ecc_2bit_err_int_set" },
{ .int_msk = BIT(6), .msg = "cluster1_shb_timeout_int_set" },
{ .int_msk = BIT(7), .msg = "cluster2_shb_timeout_int_set" },
{ .int_msk = BIT(8), .msg = "cluster3_shb_timeout_int_set" },
{ .int_msk = BIT(9), .msg = "cluster4_shb_timeout_int_set" },
{ .int_msk = GENMASK(15, 10), .msg = "ooo_rdrsp_err_int_set" },
{ .int_msk = GENMASK(21, 16), .msg = "ooo_wrrsp_err_int_set" },
{ /* sentinel */ }
};