提交 c2e74688 编写于 作者: S shenxiangwei 提交者: Zheng Zengkai

ima: bugfix for digest lists importing

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4XHBM
CVE: NA

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

The check for control character shouldn't be added when import a
binary digest list.
Signed-off-by: Nshenxiangwei <shenxiangwei1@huawei.com>
Reviewed-by: NLu Huaxin <luhuaxin1@huawei.com>
Reviewed-by: NRoberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 d5872851
...@@ -389,19 +389,21 @@ static ssize_t ima_write_data(struct file *file, const char __user *buf, ...@@ -389,19 +389,21 @@ static ssize_t ima_write_data(struct file *file, const char __user *buf,
goto out_free; goto out_free;
data[datalen] = '\0'; data[datalen] = '\0';
for (i = 0; data[i] != '\n' && data[i] != '\0'; i++) {
if (iscntrl(data[i])) {
pr_err_once("invalid path (control characters are not allowed)\n");
result = -EINVAL;
goto out_free;
}
}
result = mutex_lock_interruptible(&ima_write_mutex); result = mutex_lock_interruptible(&ima_write_mutex);
if (result < 0) if (result < 0)
goto out_free; goto out_free;
if (data[0] == '/') { if (data[0] == '/') {
for (i = 0; data[i] != '\n' && data[i] != '\0'; i++) {
if (iscntrl(data[i])) {
pr_err_once("invalid path (control characters are not allowed)\n");
result = -EINVAL;
mutex_unlock(&ima_write_mutex);
goto out_free;
}
}
result = ima_read_file(data, dentry); result = ima_read_file(data, dentry);
} else if (dentry == ima_policy) { } else if (dentry == ima_policy) {
if (ima_appraise & IMA_APPRAISE_POLICY) { if (ima_appraise & IMA_APPRAISE_POLICY) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册