aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDave Hansen <dave.hansen@linux.intel.com>2016-02-12 16:01:56 -0500
committerIngo Molnar <mingo@kernel.org>2016-02-16 04:11:12 -0500
commitd4edcf0d56958db0aca0196314ca38a5e730ea92 (patch)
treecf22f82e4768f9db3b7b59491c5188e3d725ff9a /arch
parentcde70140fed8429acf7a14e2e2cbd3e329036653 (diff)
mm/gup: Switch all callers of get_user_pages() to not pass tsk/mm
We will soon modify the vanilla get_user_pages() so it can no longer be used on mm/tasks other than 'current/current->mm', which is by far the most common way it is called. For now, we allow the old-style calls, but warn when they are used. (implemented in previous patch) This patch switches all callers of: get_user_pages() get_user_pages_unlocked() get_user_pages_locked() to stop passing tsk/mm so they will no longer see the warnings. Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Dave Hansen <dave@sr71.net> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rik van Riel <riel@redhat.com> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: jack@suse.cz Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/20160212210156.113E9407@viggo.jf.intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/cris/arch-v32/drivers/cryptocop.c8
-rw-r--r--arch/ia64/kernel/err_inject.c3
-rw-r--r--arch/mips/mm/gup.c3
-rw-r--r--arch/s390/mm/gup.c4
-rw-r--r--arch/sh/mm/gup.c2
-rw-r--r--arch/sparc/mm/gup.c2
-rw-r--r--arch/x86/mm/gup.c2
-rw-r--r--arch/x86/mm/mpx.c4
8 files changed, 10 insertions, 18 deletions
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index 877da1908234..617645d21b20 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -2719,9 +2719,7 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig
2719 /* Acquire the mm page semaphore. */ 2719 /* Acquire the mm page semaphore. */
2720 down_read(&current->mm->mmap_sem); 2720 down_read(&current->mm->mmap_sem);
2721 2721
2722 err = get_user_pages(current, 2722 err = get_user_pages((unsigned long int)(oper.indata + prev_ix),
2723 current->mm,
2724 (unsigned long int)(oper.indata + prev_ix),
2725 noinpages, 2723 noinpages,
2726 0, /* read access only for in data */ 2724 0, /* read access only for in data */
2727 0, /* no force */ 2725 0, /* no force */
@@ -2736,9 +2734,7 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig
2736 } 2734 }
2737 noinpages = err; 2735 noinpages = err;
2738 if (oper.do_cipher){ 2736 if (oper.do_cipher){
2739 err = get_user_pages(current, 2737 err = get_user_pages((unsigned long int)oper.cipher_outdata,
2740 current->mm,
2741 (unsigned long int)oper.cipher_outdata,
2742 nooutpages, 2738 nooutpages,
2743 1, /* write access for out data */ 2739 1, /* write access for out data */
2744 0, /* no force */ 2740 0, /* no force */
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
index 0c161ed6d18e..09f845793d12 100644
--- a/arch/ia64/kernel/err_inject.c
+++ b/arch/ia64/kernel/err_inject.c
@@ -142,8 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
142 u64 virt_addr=simple_strtoull(buf, NULL, 16); 142 u64 virt_addr=simple_strtoull(buf, NULL, 16);
143 int ret; 143 int ret;
144 144
145 ret = get_user_pages(current, current->mm, virt_addr, 145 ret = get_user_pages(virt_addr, 1, VM_READ, 0, NULL, NULL);
146 1, VM_READ, 0, NULL, NULL);
147 if (ret<=0) { 146 if (ret<=0) {
148#ifdef ERR_INJ_DEBUG 147#ifdef ERR_INJ_DEBUG
149 printk("Virtual address %lx is not existing.\n",virt_addr); 148 printk("Virtual address %lx is not existing.\n",virt_addr);
diff --git a/arch/mips/mm/gup.c b/arch/mips/mm/gup.c
index 1afd87c999b0..982e83f9d11f 100644
--- a/arch/mips/mm/gup.c
+++ b/arch/mips/mm/gup.c
@@ -286,8 +286,7 @@ slow_irqon:
286 start += nr << PAGE_SHIFT; 286 start += nr << PAGE_SHIFT;
287 pages += nr; 287 pages += nr;
288 288
289 ret = get_user_pages_unlocked(current, mm, start, 289 ret = get_user_pages_unlocked(start, (end - start) >> PAGE_SHIFT,
290 (end - start) >> PAGE_SHIFT,
291 write, 0, pages); 290 write, 0, pages);
292 291
293 /* Have to be a bit careful with return values */ 292 /* Have to be a bit careful with return values */
diff --git a/arch/s390/mm/gup.c b/arch/s390/mm/gup.c
index 13dab0c1645c..49a1c84ed266 100644
--- a/arch/s390/mm/gup.c
+++ b/arch/s390/mm/gup.c
@@ -210,7 +210,6 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
210int get_user_pages_fast(unsigned long start, int nr_pages, int write, 210int get_user_pages_fast(unsigned long start, int nr_pages, int write,
211 struct page **pages) 211 struct page **pages)
212{ 212{
213 struct mm_struct *mm = current->mm;
214 int nr, ret; 213 int nr, ret;
215 214
216 might_sleep(); 215 might_sleep();
@@ -222,8 +221,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
222 /* Try to get the remaining pages with get_user_pages */ 221 /* Try to get the remaining pages with get_user_pages */
223 start += nr << PAGE_SHIFT; 222 start += nr << PAGE_SHIFT;
224 pages += nr; 223 pages += nr;
225 ret = get_user_pages_unlocked(current, mm, start, 224 ret = get_user_pages_unlocked(start, nr_pages - nr, write, 0, pages);
226 nr_pages - nr, write, 0, pages);
227 /* Have to be a bit careful with return values */ 225 /* Have to be a bit careful with return values */
228 if (nr > 0) 226 if (nr > 0)
229 ret = (ret < 0) ? nr : ret + nr; 227 ret = (ret < 0) ? nr : ret + nr;
diff --git a/arch/sh/mm/gup.c b/arch/sh/mm/gup.c
index e7af6a65baab..40fa6c8adc43 100644
--- a/arch/sh/mm/gup.c
+++ b/arch/sh/mm/gup.c
@@ -257,7 +257,7 @@ slow_irqon:
257 start += nr << PAGE_SHIFT; 257 start += nr << PAGE_SHIFT;
258 pages += nr; 258 pages += nr;
259 259
260 ret = get_user_pages_unlocked(current, mm, start, 260 ret = get_user_pages_unlocked(start,
261 (end - start) >> PAGE_SHIFT, write, 0, pages); 261 (end - start) >> PAGE_SHIFT, write, 0, pages);
262 262
263 /* Have to be a bit careful with return values */ 263 /* Have to be a bit careful with return values */
diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c
index eb3d8e8ebc6b..4e06750a5d29 100644
--- a/arch/sparc/mm/gup.c
+++ b/arch/sparc/mm/gup.c
@@ -237,7 +237,7 @@ slow:
237 start += nr << PAGE_SHIFT; 237 start += nr << PAGE_SHIFT;
238 pages += nr; 238 pages += nr;
239 239
240 ret = get_user_pages_unlocked(current, mm, start, 240 ret = get_user_pages_unlocked(start,
241 (end - start) >> PAGE_SHIFT, write, 0, pages); 241 (end - start) >> PAGE_SHIFT, write, 0, pages);
242 242
243 /* Have to be a bit careful with return values */ 243 /* Have to be a bit careful with return values */
diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
index 6d5eb5900372..ce5e4545203b 100644
--- a/arch/x86/mm/gup.c
+++ b/arch/x86/mm/gup.c
@@ -422,7 +422,7 @@ slow_irqon:
422 start += nr << PAGE_SHIFT; 422 start += nr << PAGE_SHIFT;
423 pages += nr; 423 pages += nr;
424 424
425 ret = get_user_pages_unlocked(current, mm, start, 425 ret = get_user_pages_unlocked(start,
426 (end - start) >> PAGE_SHIFT, 426 (end - start) >> PAGE_SHIFT,
427 write, 0, pages); 427 write, 0, pages);
428 428
diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c
index b2fd67da1701..84fa4a482c78 100644
--- a/arch/x86/mm/mpx.c
+++ b/arch/x86/mm/mpx.c
@@ -546,8 +546,8 @@ static int mpx_resolve_fault(long __user *addr, int write)
546 int nr_pages = 1; 546 int nr_pages = 1;
547 int force = 0; 547 int force = 0;
548 548
549 gup_ret = get_user_pages(current, current->mm, (unsigned long)addr, 549 gup_ret = get_user_pages((unsigned long)addr, nr_pages, write,
550 nr_pages, write, force, NULL, NULL); 550 force, NULL, NULL);
551 /* 551 /*
552 * get_user_pages() returns number of pages gotten. 552 * get_user_pages() returns number of pages gotten.
553 * 0 means we failed to fault in and get anything, 553 * 0 means we failed to fault in and get anything,