Skip to content

Commit

Permalink
crypto: hisilicon/hpre - HPRE_OVERTIME_THRHLD can be written by debugfs
Browse files Browse the repository at this point in the history
Registers in "hpre_dfx_files" can only be cleaned to zero but
HPRE_OVERTIME_THRHLD, which can be written as any number.

Fixes: 64a6301("crypto: hisilicon/hpre - add debugfs for ...")
Signed-off-by: Hui Tang <[email protected]>
Signed-off-by: Meng Yu <[email protected]>
Reviewed-by: Zaibo Xu <[email protected]>
Reviewed-by: Zhou Wang <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
Hui Tang authored and herbertx committed Jul 16, 2020
1 parent d7ba2c0 commit 6bc937b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/crypto/hisilicon/hpre/hpre_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,13 +548,15 @@ static int hpre_debugfs_atomic64_get(void *data, u64 *val)
static int hpre_debugfs_atomic64_set(void *data, u64 val)
{
struct hpre_dfx *dfx_item = data;
struct hpre_dfx *hpre_dfx = dfx_item - HPRE_OVERTIME_THRHLD;
struct hpre_dfx *hpre_dfx = NULL;

if (val)
if (dfx_item->type == HPRE_OVERTIME_THRHLD) {
hpre_dfx = dfx_item - HPRE_OVERTIME_THRHLD;
atomic64_set(&hpre_dfx[HPRE_OVER_THRHLD_CNT].value, 0);
} else if (val) {
return -EINVAL;
}

if (dfx_item->type == HPRE_OVERTIME_THRHLD)
atomic64_set(&hpre_dfx[HPRE_OVER_THRHLD_CNT].value, 0);
atomic64_set(&dfx_item->value, val);

return 0;
Expand Down

0 comments on commit 6bc937b

Please sign in to comment.