Commit 2418c65c authored by Chenghai Huang's avatar Chenghai Huang Committed by 白凤
Browse files

crypto: hisilicon/debugfs - Fix the processing logic issue in the debugfs creation

maillist inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9GMIW
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev.git/commit/?id=3b7db97e60ac



----------------------------------------------------------------------

There is a scenario where the file directory is created but the
file attribute is not set. In this case, if a user accesses the
file, an error occurs.

So adjust the processing logic in the debugfs creation to
prevent the file from being accessed before the file attributes
such as the index are set.

Fixes: 4507a150 ("crypto: hisilicon/debugfs - Fix the processing logic issue in the debugfs creation")
Signed-off-by: default avatarChenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarJangShui Yang <yangjiangshui@h-partners.com>
Signed-off-by: default avatarXiaoFeng Ma <maxiaofeng14@h-partners.com>
parent f7983f99
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1090,12 +1090,12 @@ static void qm_create_debugfs_file(struct hisi_qm *qm, struct dentry *dir,
{
	struct debugfs_file *file = qm->debug.files + index;

	debugfs_create_file(qm_debug_file_name[index], 0600, dir, file,
			    &qm_debug_fops);

	file->index = index;
	mutex_init(&file->lock);
	file->debug = &qm->debug;

	debugfs_create_file(qm_debug_file_name[index], 0600, dir, file,
			    &qm_debug_fops);
}

static int qm_debugfs_atomic64_set(void *data, u64 val)