Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1709013ybl; Sat, 11 Jan 2020 01:08:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzNbNaF0hkq1gj1cDumijIpns2oVceZldbNQUHXT4txmbS50/VJqYwwS/c4zbp/RxfTN6xF X-Received: by 2002:a9d:21f4:: with SMTP id s107mr6497639otb.102.1578733682049; Sat, 11 Jan 2020 01:08:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578733682; cv=none; d=google.com; s=arc-20160816; b=axuIhxyHkDVPb2lWGwD6BNq1IJOeWa6pYP0EYNrX3F4uL6zikckftkEZHoACp/sIN2 nkwe+qDZFgannjX6EYHE2/ytQ2gBKRjvwwvghWS4mYV4yOqHI5Bt2QDQezXKCBFbb7m6 hd+XeD6gZSPQZyuWo471LsfVfR6mdYHM99YgTIuG6IlKY3AQpgIgtyUSbSV1+vQHnZda ockawPhPA4qPrieLtY8yGDLu+2LtY01LugoxbSOyNJYSiaNUvVoAMQg1ptpSK6zqXDz9 /Qqe/EcaiU2dM9ZLInoqfW9X3M4I4CiyN5sOjUShwpgJRT7dezj/n9p5Zlv4JZisr76o ow5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=zCZgtFHZL1NJFgaJZrk/etH57cvf7ey+S5mNVEh2rCg=; b=oKGpenGbNMMV1AjqVo8Nx1sYXS5HXuog3lZqEOoPBBSlzwDJfA8dw49T+P500fSUve ru3kgv7q/Dtz3B9Jn8du23tW8k9Dymc9+OntP7EjJj871jrijSc9OceJoojeTlElnrmD RyFljxVD2kAv3/LJ6irxwnPrD/qQgT/IN93A1FxsprJJNNsnVSsJjsoCc9ZI/+rUFQ2Q BCWbKyMApk1W0h8izQwfsgboDoaFcME/6nMnE3fOKLMwR/IfFIKKCFFr1hRBb35R097J ZWu1TaNwazQoSc9MBUy7OGwvO1QfEje7MmVWb230STUu/KUftHKQUqNIlbXbe8h4rlZc C+Kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o13si3382565otp.27.2020.01.11.01.07.33; Sat, 11 Jan 2020 01:08:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728027AbgAKJCO (ORCPT + 99 others); Sat, 11 Jan 2020 04:02:14 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8697 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728417AbgAKJCO (ORCPT ); Sat, 11 Jan 2020 04:02:14 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id DEBE2DB374B07D05D707; Sat, 11 Jan 2020 17:02:11 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.439.0; Sat, 11 Jan 2020 17:02:04 +0800 From: Zaibo Xu To: , CC: , , , , , , , , , Subject: [PATCH 1/4] crypto: hisilicon - Bugfixed tfm leak Date: Sat, 11 Jan 2020 16:58:15 +0800 Message-ID: <1578733098-13863-2-git-send-email-xuzaibo@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1578733098-13863-1-git-send-email-xuzaibo@huawei.com> References: <1578733098-13863-1-git-send-email-xuzaibo@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 1.Fixed the bug of software tfm leakage. 2.Update HW error log message. Signed-off-by: Zaibo Xu --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 7 ++++++- drivers/crypto/hisilicon/hpre/hpre_main.c | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b/drivers/crypto/hisilicon/hpre/hpre_crypto.c index 98f037e..d8b0152 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_crypto.c +++ b/drivers/crypto/hisilicon/hpre/hpre_crypto.c @@ -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) diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c index 711f5d1..753e43d 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_main.c +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c @@ -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 */ } }; -- 2.8.1