]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Gerald Schaefer <geraldsc@de.ibm.com> |
2 | Subject: kernel: don't check for pfn_valid() in uaccess_pt.c | |
3 | References: bnc#484767,LTC#52175 | |
4 | ||
5 | Symptom: Access to xip mappings fails (-EFAULT). | |
6 | Problem: pfn_valid() actually checks for a valid struct page and | |
7 | not for a valid pfn. Using xip mappings w/o struct pages, | |
8 | this will result in -EFAULT returned by the (page table | |
9 | walk) user copy functions, even though there is valid memory. | |
10 | Solution: Those user copy functions don't need a struct page, so this | |
11 | patch just removes the pfn_valid() check. | |
12 | ||
13 | Acked-by: John Jolly <jjolly@suse.de> | |
14 | --- | |
15 | arch/s390/lib/uaccess_pt.c | 18 ------------------ | |
16 | 1 file changed, 18 deletions(-) | |
17 | ||
18 | Index: linux-sles11/arch/s390/lib/uaccess_pt.c | |
19 | =================================================================== | |
20 | --- linux-sles11.orig/arch/s390/lib/uaccess_pt.c | |
21 | +++ linux-sles11/arch/s390/lib/uaccess_pt.c | |
22 | @@ -119,8 +119,6 @@ retry: | |
23 | goto fault; | |
24 | ||
25 | pfn = pte_pfn(*pte); | |
26 | - if (!pfn_valid(pfn)) | |
27 | - goto out; | |
28 | ||
29 | offset = uaddr & (PAGE_SIZE - 1); | |
30 | size = min(n - done, PAGE_SIZE - offset); | |
31 | @@ -135,7 +133,6 @@ retry: | |
32 | done += size; | |
33 | uaddr += size; | |
34 | } while (done < n); | |
35 | -out: | |
36 | spin_unlock(&mm->page_table_lock); | |
37 | return n - done; | |
38 | fault: | |
39 | @@ -163,9 +160,6 @@ retry: | |
40 | goto fault; | |
41 | ||
42 | pfn = pte_pfn(*pte); | |
43 | - if (!pfn_valid(pfn)) | |
44 | - goto out; | |
45 | - | |
46 | ret = (pfn << PAGE_SHIFT) + (uaddr & (PAGE_SIZE - 1)); | |
47 | out: | |
48 | return ret; | |
49 | @@ -244,11 +238,6 @@ retry: | |
50 | goto fault; | |
51 | ||
52 | pfn = pte_pfn(*pte); | |
53 | - if (!pfn_valid(pfn)) { | |
54 | - done = -1; | |
55 | - goto out; | |
56 | - } | |
57 | - | |
58 | offset = uaddr & (PAGE_SIZE-1); | |
59 | addr = (char *)(pfn << PAGE_SHIFT) + offset; | |
60 | len = min(count - done, PAGE_SIZE - offset); | |
61 | @@ -256,7 +245,6 @@ retry: | |
62 | done += len_str; | |
63 | uaddr += len_str; | |
64 | } while ((len_str == len) && (done < count)); | |
65 | -out: | |
66 | spin_unlock(&mm->page_table_lock); | |
67 | return done + 1; | |
68 | fault: | |
69 | @@ -325,12 +313,7 @@ retry: | |
70 | } | |
71 | ||
72 | pfn_from = pte_pfn(*pte_from); | |
73 | - if (!pfn_valid(pfn_from)) | |
74 | - goto out; | |
75 | pfn_to = pte_pfn(*pte_to); | |
76 | - if (!pfn_valid(pfn_to)) | |
77 | - goto out; | |
78 | - | |
79 | offset_from = uaddr_from & (PAGE_SIZE-1); | |
80 | offset_to = uaddr_from & (PAGE_SIZE-1); | |
81 | offset_max = max(offset_from, offset_to); | |
82 | @@ -342,7 +325,6 @@ retry: | |
83 | uaddr_from += size; | |
84 | uaddr_to += size; | |
85 | } while (done < n); | |
86 | -out: | |
87 | spin_unlock(&mm->page_table_lock); | |
88 | return n - done; | |
89 | fault: |