提交 d042e603 编写于 作者: Z ZhangPeng 提交者: Ma Wupeng

userswap: add user mode check for swap-out VA

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I6CAIM

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

Add user mode check for swap-out VA to make sure that swap-out VA is
user mode address.
Signed-off-by: NZhangPeng <zhangpeng362@huawei.com>
上级 790b46fa
......@@ -367,7 +367,8 @@ unsigned long uswap_mremap(unsigned long old_addr, unsigned long old_len,
offset_in_page(new_addr) || (len % PAGE_SIZE))
return ret;
if (new_len > TASK_SIZE || new_addr > TASK_SIZE - new_len)
if (new_len > TASK_SIZE || new_addr > TASK_SIZE - new_len ||
old_addr > TASK_SIZE - old_len)
return ret;
/* Ensure the old/new locations do not overlap */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册