From f1d48e52373301b0f579d3925734bc36655f5caa Mon Sep 17 00:00:00 2001 From: Tang Yizhou Date: Sat, 30 Oct 2021 11:09:54 +0800 Subject: [PATCH] share_pool: Fix missing semaphore operation in error branch ascend inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4EUVI CVE: NA ------------------------------------------------- Increase the value of sp_stat_sem when failed. Signed-off-by: Tang Yizhou Reviewed-by: Ding Tianhong Reviewed-by: Weilong Chen Signed-off-by: Yang Yingliang --- mm/share_pool.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/share_pool.c b/mm/share_pool.c index ebc2d04c0114..607a5f0097a4 100644 --- a/mm/share_pool.c +++ b/mm/share_pool.c @@ -135,6 +135,7 @@ static struct sp_proc_stat *sp_init_proc_stat(struct task_struct *tsk, up_write(&sp_stat_sem); return stat; } else { + up_write(&sp_stat_sem); /* if enter this branch, that's our mistake */ pr_err_ratelimited("share pool: proc stat invalid id %d\n", id); return ERR_PTR(-EBUSY); -- GitLab