aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/memory.c8
-rw-r--r--mm/nommu.c6
-rw-r--r--mm/util.c5
3 files changed, 8 insertions, 11 deletions
diff --git a/mm/memory.c b/mm/memory.c
index bac2d994850e..e18c57bdc75c 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3951,20 +3951,16 @@ int access_remote_vm(struct mm_struct *mm, unsigned long addr,
3951 * Do not walk the page table directly, use get_user_pages 3951 * Do not walk the page table directly, use get_user_pages
3952 */ 3952 */
3953int access_process_vm(struct task_struct *tsk, unsigned long addr, 3953int access_process_vm(struct task_struct *tsk, unsigned long addr,
3954 void *buf, int len, int write) 3954 void *buf, int len, unsigned int gup_flags)
3955{ 3955{
3956 struct mm_struct *mm; 3956 struct mm_struct *mm;
3957 int ret; 3957 int ret;
3958 unsigned int flags = FOLL_FORCE;
3959 3958
3960 mm = get_task_mm(tsk); 3959 mm = get_task_mm(tsk);
3961 if (!mm) 3960 if (!mm)
3962 return 0; 3961 return 0;
3963 3962
3964 if (write) 3963 ret = __access_remote_vm(tsk, mm, addr, buf, len, gup_flags);
3965 flags |= FOLL_WRITE;
3966
3967 ret = __access_remote_vm(tsk, mm, addr, buf, len, flags);
3968 3964
3969 mmput(mm); 3965 mmput(mm);
3970 3966
diff --git a/mm/nommu.c b/mm/nommu.c
index 93d5bb53fc63..db5fd1795298 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1861,7 +1861,8 @@ int access_remote_vm(struct mm_struct *mm, unsigned long addr,
1861 * Access another process' address space. 1861 * Access another process' address space.
1862 * - source/target buffer must be kernel space 1862 * - source/target buffer must be kernel space
1863 */ 1863 */
1864int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write) 1864int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len,
1865 unsigned int gup_flags)
1865{ 1866{
1866 struct mm_struct *mm; 1867 struct mm_struct *mm;
1867 1868
@@ -1872,8 +1873,7 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
1872 if (!mm) 1873 if (!mm)
1873 return 0; 1874 return 0;
1874 1875
1875 len = __access_remote_vm(tsk, mm, addr, buf, len, 1876 len = __access_remote_vm(tsk, mm, addr, buf, len, gup_flags);
1876 write ? FOLL_WRITE : 0);
1877 1877
1878 mmput(mm); 1878 mmput(mm);
1879 return len; 1879 return len;
diff --git a/mm/util.c b/mm/util.c
index 4c685bde5ebc..952cbe7ad7b7 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -624,7 +624,7 @@ int get_cmdline(struct task_struct *task, char *buffer, int buflen)
624 if (len > buflen) 624 if (len > buflen)
625 len = buflen; 625 len = buflen;
626 626
627 res = access_process_vm(task, arg_start, buffer, len, 0); 627 res = access_process_vm(task, arg_start, buffer, len, FOLL_FORCE);
628 628
629 /* 629 /*
630 * If the nul at the end of args has been overwritten, then 630 * If the nul at the end of args has been overwritten, then
@@ -639,7 +639,8 @@ int get_cmdline(struct task_struct *task, char *buffer, int buflen)
639 if (len > buflen - res) 639 if (len > buflen - res)
640 len = buflen - res; 640 len = buflen - res;
641 res += access_process_vm(task, env_start, 641 res += access_process_vm(task, env_start,
642 buffer+res, len, 0); 642 buffer+res, len,
643 FOLL_FORCE);
643 res = strnlen(buffer, res); 644 res = strnlen(buffer, res);
644 } 645 }
645 } 646 }