提交 32622f4c 编写于 作者: Z Zhou Guanghui 提交者: Yang Yingliang

share pool: Solve processing errors

of some abnormal branches

ascend inclusion
category: feature
bugzilla: NA
CVE: NA

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

1. sp_group_add_task: when spg invalid, low 32bits of
pointer spg will be returned. This will be considered
a correct spg id.

2.sp_alloc: The error branch goto out, then sp_mutex
will be unlocked incorrectly(since not be locked).
Signed-off-by: NZhou Guanghui <zhouguanghui1@huawei.com>
Signed-off-by: NTang Yizhou <tangyizhou@huawei.com>
Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 a4ea2941
......@@ -516,10 +516,15 @@ int sp_group_add_task(int pid, int spg_id)
goto out_unlock;
spg = find_or_alloc_sp_group(spg_id);
if (IS_ERR(spg) || !spg_valid(spg)) {
if (IS_ERR(spg)) {
ret = PTR_ERR(spg);
goto out_put_task;
}
if (!spg_valid(spg)) {
ret = -ENODEV;
goto out_put_task;
}
atomic_inc(&spg->use_count);
/* access control permission check */
......@@ -1191,8 +1196,7 @@ void *sp_alloc(unsigned long size, unsigned long sp_flags, int spg_id)
if (ret < 0 && (ret != -EEXIST)) {
pr_err("share pool: allocation failed due to add group error %d in DVPP pass through scenario",
ret);
p = ERR_PTR(ret);
goto out;
return ERR_PTR(ret);
}
mutex_lock(&sp_mutex);
spg = current->mm->sp_group;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册