From: Lijun Fang fanglijun3@huawei.com
ascend inclusion category: bugfix bugzilla: NA CVE: NA
------------
The nr_pages in unpin_memory calculate not agree with pin_memory, so it will cause unpin_memory failed.
Signed-off-by: Lijun Fang fanglijun3@huawei.com Reviewed-by: Li Zefan lizefan@huawei.com Reviewed-by: Hanjun Guo guohanjun@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/char/svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/svm.c b/drivers/char/svm.c index 2a61a4c..d57d179 100644 --- a/drivers/char/svm.c +++ b/drivers/char/svm.c @@ -493,9 +493,9 @@ static int svm_unpin_memory(unsigned long __user *arg) if (!asid) return -ENOSPC;
- addr &= PAGE_MASK; nr_pages = (PAGE_ALIGN(size + addr) >> PAGE_SHIFT) - ((addr & PAGE_MASK) >> PAGE_SHIFT); + addr &= PAGE_MASK;
mutex_lock(&svm_process_mutex); process = find_svm_process(asid);