From: Wang Wensheng <wangwensheng4@huawei.com> hulk inclusion category: feature bugzilla: NA ---------------------------------------- This is used to indecate that the caller is free sp_area allocated by other process. This is allowed as long as the caller is in the same group. But the current->mm is NULL in do_exit() and we cannot judge wheather the caller is in the group or not. We return error in this case before and change it in this patch. Because if the process is killed with SIGKILL, the driver can free the sharepool memory only in the release hook of xsmem device file, which is called in do_exit(). Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com> --- mm/share_pool.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mm/share_pool.c b/mm/share_pool.c index 58aede9b3325..5cd4efce8f68 100644 --- a/mm/share_pool.c +++ b/mm/share_pool.c @@ -1942,12 +1942,9 @@ static int sp_free_inner(unsigned long addr, int spg_id, bool is_sp_free) goto drop_spa; } - if (!current->mm && spa->applier != current->tgid) { - ret = -EPERM; - pr_err("%s, free a spa allocated by other process(%d), current(%d)\n", + if (!current->mm && spa->applier != current->tgid) + pr_warn_ratelimited("%s, free a spa allocated by other process(%d), current(%d)\n", str, spa->applier, current->tgid); - goto drop_spa; - } __sp_free(spa, NULL); if (spa->type == SPA_TYPE_ALLOC) -- 2.43.0