Commit 41db4d6d authored by Ding Tianhong's avatar Ding Tianhong Committed by Yang Yingliang
Browse files

ascend/share pool: bugfix, sp exit is not atomic

ascend inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4EUVI


CVE: NA

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

When mmput is called concurrently, the judgment of "mm_users == 2"
in sp_group_exit is not atomic with atomic_dec_and_test in mmput.
The judgment of "mm_users == 2" may never be valid. As a result,
mm leakage occurs.

For example, in a typical scenario, a process has two threads, with
the mmget is performed in sp_group_add_task. In this case, mm_users
is 3. When two threads exit at the same time, the judgment of
"mm_users == 2" fail.

Therefore, the judgment and atomic_dec_and_test are put in the spg
rw_lock to ensure the serialization of the whole process.

Signed-off-by: default avatarDing Tianhong <dingtianhong@huawei.com>
Signed-off-by: default avatarZhou Guanghui <zhouguanghui1@huawei.com>
Reviewed-by: default avatarWeilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 67c0af6a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment