dhugetlb: use rcu lock to protect hpool
hulk inclusion category: bugfix bugzilla: 46904, https://gitee.com/openeuler/kernel/issues/IA5JXN -------------------------------- In freeing process, set memcg->hpool or dpool_global_hpool to NULL and then freeing it. To avoid UAF problem of hpool, we have to make sure the users that already hold pointer to hpool don't use the pointer after freeing hpool. The freeing of hpool should block until make sure all such users don't use hpool. Since anyone who want to use hpool have to increase its refcount at first. Use rcu_read_lock() and synchronize_rcu() to guarantee all such users failed to get hpool before freeing hpool. Fixes: 0bc0d0d5 ("dhugetlb: backport dynamic hugetlb feature") Signed-off-by:Liu Shixin <liushixin2@huawei.com>
Loading
Please sign in to comment