1 |
Author: mpagano |
2 |
Date: 2014-05-03 23:13:49 +0000 (Sat, 03 May 2014) |
3 |
New Revision: 2769 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/3.2/1057_linux-3.2.58.patch |
7 |
Modified: |
8 |
genpatches-2.6/trunk/3.2/0000_README |
9 |
Log: |
10 |
Linux patch 3.2.58 |
11 |
|
12 |
Modified: genpatches-2.6/trunk/3.2/0000_README |
13 |
=================================================================== |
14 |
--- genpatches-2.6/trunk/3.2/0000_README 2014-04-28 12:34:20 UTC (rev 2768) |
15 |
+++ genpatches-2.6/trunk/3.2/0000_README 2014-05-03 23:13:49 UTC (rev 2769) |
16 |
@@ -268,6 +268,10 @@ |
17 |
From: http://www.kernel.org |
18 |
Desc: Linux 3.2.57 |
19 |
|
20 |
+Patch: 1057_linux-3.2.58.patch |
21 |
+From: http://www.kernel.org |
22 |
+Desc: Linux 3.2.58 |
23 |
+ |
24 |
Patch: 1500_XATTR_USER_PREFIX.patch |
25 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
26 |
Desc: Support for namespace user.pax.* on tmpfs. |
27 |
|
28 |
Added: genpatches-2.6/trunk/3.2/1057_linux-3.2.58.patch |
29 |
=================================================================== |
30 |
--- genpatches-2.6/trunk/3.2/1057_linux-3.2.58.patch (rev 0) |
31 |
+++ genpatches-2.6/trunk/3.2/1057_linux-3.2.58.patch 2014-05-03 23:13:49 UTC (rev 2769) |
32 |
@@ -0,0 +1,3567 @@ |
33 |
+diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt |
34 |
+index b15e29f31121..90aae8564eda 100644 |
35 |
+--- a/Documentation/video4linux/gspca.txt |
36 |
++++ b/Documentation/video4linux/gspca.txt |
37 |
+@@ -55,6 +55,7 @@ zc3xx 0458:700f Genius VideoCam Web V2 |
38 |
+ sonixj 0458:7025 Genius Eye 311Q |
39 |
+ sn9c20x 0458:7029 Genius Look 320s |
40 |
+ sonixj 0458:702e Genius Slim 310 NB |
41 |
++sn9c20x 0458:7045 Genius Look 1320 V2 |
42 |
+ sn9c20x 0458:704a Genius Slim 1320 |
43 |
+ sn9c20x 0458:704c Genius i-Look 1321 |
44 |
+ sn9c20x 045e:00f4 LifeCam VX-6000 (SN9C20x + OV9650) |
45 |
+diff --git a/Makefile b/Makefile |
46 |
+index c92db9b51a97..d59b394ba6cd 100644 |
47 |
+--- a/Makefile |
48 |
++++ b/Makefile |
49 |
+@@ -1,6 +1,6 @@ |
50 |
+ VERSION = 3 |
51 |
+ PATCHLEVEL = 2 |
52 |
+-SUBLEVEL = 57 |
53 |
++SUBLEVEL = 58 |
54 |
+ EXTRAVERSION = |
55 |
+ NAME = Saber-toothed Squirrel |
56 |
+ |
57 |
+diff --git a/arch/alpha/lib/csum_partial_copy.c b/arch/alpha/lib/csum_partial_copy.c |
58 |
+index 1d2ef5a3fc84..40736da9bea8 100644 |
59 |
+--- a/arch/alpha/lib/csum_partial_copy.c |
60 |
++++ b/arch/alpha/lib/csum_partial_copy.c |
61 |
+@@ -373,11 +373,6 @@ csum_partial_copy_from_user(const void __user *src, void *dst, int len, |
62 |
+ __wsum |
63 |
+ csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) |
64 |
+ { |
65 |
+- __wsum checksum; |
66 |
+- mm_segment_t oldfs = get_fs(); |
67 |
+- set_fs(KERNEL_DS); |
68 |
+- checksum = csum_partial_copy_from_user((__force const void __user *)src, |
69 |
+- dst, len, sum, NULL); |
70 |
+- set_fs(oldfs); |
71 |
+- return checksum; |
72 |
++ return csum_partial_copy_from_user((__force const void __user *)src, |
73 |
++ dst, len, sum, NULL); |
74 |
+ } |
75 |
+diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h |
76 |
+index 253cc86318bf..aefd4594c9bf 100644 |
77 |
+--- a/arch/arm/include/asm/futex.h |
78 |
++++ b/arch/arm/include/asm/futex.h |
79 |
+@@ -3,11 +3,6 @@ |
80 |
+ |
81 |
+ #ifdef __KERNEL__ |
82 |
+ |
83 |
+-#if defined(CONFIG_CPU_USE_DOMAINS) && defined(CONFIG_SMP) |
84 |
+-/* ARM doesn't provide unprivileged exclusive memory accessors */ |
85 |
+-#include <asm-generic/futex.h> |
86 |
+-#else |
87 |
+- |
88 |
+ #include <linux/futex.h> |
89 |
+ #include <linux/uaccess.h> |
90 |
+ #include <asm/errno.h> |
91 |
+@@ -163,6 +158,5 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) |
92 |
+ return ret; |
93 |
+ } |
94 |
+ |
95 |
+-#endif /* !(CPU_USE_DOMAINS && SMP) */ |
96 |
+ #endif /* __KERNEL__ */ |
97 |
+ #endif /* _ASM_ARM_FUTEX_H */ |
98 |
+diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h |
99 |
+index 470457e1cfc5..1cb80c4627e4 100644 |
100 |
+--- a/arch/arm/include/asm/pgtable-2level.h |
101 |
++++ b/arch/arm/include/asm/pgtable-2level.h |
102 |
+@@ -123,6 +123,7 @@ |
103 |
+ #define L_PTE_USER (_AT(pteval_t, 1) << 8) |
104 |
+ #define L_PTE_XN (_AT(pteval_t, 1) << 9) |
105 |
+ #define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */ |
106 |
++#define L_PTE_NONE (_AT(pteval_t, 1) << 11) |
107 |
+ |
108 |
+ /* |
109 |
+ * These are the memory types, defined to be compatible with |
110 |
+@@ -138,6 +139,7 @@ |
111 |
+ #define L_PTE_MT_DEV_NONSHARED (_AT(pteval_t, 0x0c) << 2) /* 1100 */ |
112 |
+ #define L_PTE_MT_DEV_WC (_AT(pteval_t, 0x09) << 2) /* 1001 */ |
113 |
+ #define L_PTE_MT_DEV_CACHED (_AT(pteval_t, 0x0b) << 2) /* 1011 */ |
114 |
++#define L_PTE_MT_VECTORS (_AT(pteval_t, 0x0f) << 2) /* 1111 */ |
115 |
+ #define L_PTE_MT_MASK (_AT(pteval_t, 0x0f) << 2) |
116 |
+ |
117 |
+ #endif /* _ASM_PGTABLE_2LEVEL_H */ |
118 |
+diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h |
119 |
+index 9b419abd1334..fcbac3c50b52 100644 |
120 |
+--- a/arch/arm/include/asm/pgtable.h |
121 |
++++ b/arch/arm/include/asm/pgtable.h |
122 |
+@@ -74,7 +74,7 @@ extern pgprot_t pgprot_kernel; |
123 |
+ |
124 |
+ #define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b)) |
125 |
+ |
126 |
+-#define PAGE_NONE _MOD_PROT(pgprot_user, L_PTE_XN | L_PTE_RDONLY) |
127 |
++#define PAGE_NONE _MOD_PROT(pgprot_user, L_PTE_XN | L_PTE_RDONLY | L_PTE_NONE) |
128 |
+ #define PAGE_SHARED _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_XN) |
129 |
+ #define PAGE_SHARED_EXEC _MOD_PROT(pgprot_user, L_PTE_USER) |
130 |
+ #define PAGE_COPY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN) |
131 |
+@@ -84,7 +84,7 @@ extern pgprot_t pgprot_kernel; |
132 |
+ #define PAGE_KERNEL _MOD_PROT(pgprot_kernel, L_PTE_XN) |
133 |
+ #define PAGE_KERNEL_EXEC pgprot_kernel |
134 |
+ |
135 |
+-#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN) |
136 |
++#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN | L_PTE_NONE) |
137 |
+ #define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN) |
138 |
+ #define __PAGE_SHARED_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER) |
139 |
+ #define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN) |
140 |
+@@ -279,7 +279,7 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; } |
141 |
+ |
142 |
+ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
143 |
+ { |
144 |
+- const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER; |
145 |
++ const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER | L_PTE_NONE; |
146 |
+ pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); |
147 |
+ return pte; |
148 |
+ } |
149 |
+diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig |
150 |
+index 67f75a0b66d6..4e1ef6edb489 100644 |
151 |
+--- a/arch/arm/mm/Kconfig |
152 |
++++ b/arch/arm/mm/Kconfig |
153 |
+@@ -458,7 +458,6 @@ config CPU_32v5 |
154 |
+ config CPU_32v6 |
155 |
+ bool |
156 |
+ select TLS_REG_EMUL if !CPU_32v6K && !MMU |
157 |
+- select CPU_USE_DOMAINS if CPU_V6 && MMU |
158 |
+ |
159 |
+ config CPU_32v6K |
160 |
+ bool |
161 |
+@@ -652,7 +651,7 @@ config ARM_THUMBEE |
162 |
+ |
163 |
+ config SWP_EMULATE |
164 |
+ bool "Emulate SWP/SWPB instructions" |
165 |
+- depends on !CPU_USE_DOMAINS && CPU_V7 |
166 |
++ depends on CPU_V7 |
167 |
+ select HAVE_PROC_CPU if PROC_FS |
168 |
+ default y if SMP |
169 |
+ help |
170 |
+diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c |
171 |
+index 9e28fdb1c739..082fa18b2583 100644 |
172 |
+--- a/arch/arm/mm/mmu.c |
173 |
++++ b/arch/arm/mm/mmu.c |
174 |
+@@ -426,6 +426,14 @@ static void __init build_mem_type_table(void) |
175 |
+ mem_types[MT_MEMORY_NONCACHED].prot_pte |= L_PTE_SHARED; |
176 |
+ } |
177 |
+ /* |
178 |
++ * We don't use domains on ARMv6 (since this causes problems with |
179 |
++ * v6/v7 kernels), so we must use a separate memory type for user |
180 |
++ * r/o, kernel r/w to map the vectors page. |
181 |
++ */ |
182 |
++ if (cpu_arch == CPU_ARCH_ARMv6) |
183 |
++ vecs_pgprot |= L_PTE_MT_VECTORS; |
184 |
++ |
185 |
++ /* |
186 |
+ * ARMv6 and above have extended page tables. |
187 |
+ */ |
188 |
+ if (cpu_arch >= CPU_ARCH_ARMv6 && (cr & CR_XP)) { |
189 |
+diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S |
190 |
+index 307a4def8d3a..8a3edd4a3e48 100644 |
191 |
+--- a/arch/arm/mm/proc-macros.S |
192 |
++++ b/arch/arm/mm/proc-macros.S |
193 |
+@@ -106,13 +106,9 @@ |
194 |
+ * 100x 1 0 1 r/o no acc |
195 |
+ * 10x0 1 0 1 r/o no acc |
196 |
+ * 1011 0 0 1 r/w no acc |
197 |
+- * 110x 0 1 0 r/w r/o |
198 |
+- * 11x0 0 1 0 r/w r/o |
199 |
+- * 1111 0 1 1 r/w r/w |
200 |
+- * |
201 |
+- * If !CONFIG_CPU_USE_DOMAINS, the following permissions are changed: |
202 |
+ * 110x 1 1 1 r/o r/o |
203 |
+ * 11x0 1 1 1 r/o r/o |
204 |
++ * 1111 0 1 1 r/w r/w |
205 |
+ */ |
206 |
+ .macro armv6_mt_table pfx |
207 |
+ \pfx\()_mt_table: |
208 |
+@@ -131,7 +127,7 @@ |
209 |
+ .long PTE_EXT_TEX(2) @ L_PTE_MT_DEV_NONSHARED |
210 |
+ .long 0x00 @ unused |
211 |
+ .long 0x00 @ unused |
212 |
+- .long 0x00 @ unused |
213 |
++ .long PTE_CACHEABLE | PTE_BUFFERABLE | PTE_EXT_APX @ L_PTE_MT_VECTORS |
214 |
+ .endm |
215 |
+ |
216 |
+ .macro armv6_set_pte_ext pfx |
217 |
+@@ -152,20 +148,21 @@ |
218 |
+ |
219 |
+ tst r1, #L_PTE_USER |
220 |
+ orrne r3, r3, #PTE_EXT_AP1 |
221 |
+-#ifdef CONFIG_CPU_USE_DOMAINS |
222 |
+- @ allow kernel read/write access to read-only user pages |
223 |
+ tstne r3, #PTE_EXT_APX |
224 |
+- bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0 |
225 |
+-#endif |
226 |
++ |
227 |
++ @ user read-only -> kernel read-only |
228 |
++ bicne r3, r3, #PTE_EXT_AP0 |
229 |
+ |
230 |
+ tst r1, #L_PTE_XN |
231 |
+ orrne r3, r3, #PTE_EXT_XN |
232 |
+ |
233 |
+- orr r3, r3, r2 |
234 |
++ eor r3, r3, r2 |
235 |
+ |
236 |
+ tst r1, #L_PTE_YOUNG |
237 |
+ tstne r1, #L_PTE_PRESENT |
238 |
+ moveq r3, #0 |
239 |
++ tstne r1, #L_PTE_NONE |
240 |
++ movne r3, #0 |
241 |
+ |
242 |
+ str r3, [r0] |
243 |
+ mcr p15, 0, r0, c7, c10, 1 @ flush_pte |
244 |
+diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S |
245 |
+index 19d21ff27b0e..43c69815de69 100644 |
246 |
+--- a/arch/arm/mm/proc-v7.S |
247 |
++++ b/arch/arm/mm/proc-v7.S |
248 |
+@@ -160,17 +160,14 @@ ENTRY(cpu_v7_set_pte_ext) |
249 |
+ |
250 |
+ tst r1, #L_PTE_USER |
251 |
+ orrne r3, r3, #PTE_EXT_AP1 |
252 |
+-#ifdef CONFIG_CPU_USE_DOMAINS |
253 |
+- @ allow kernel read/write access to read-only user pages |
254 |
+- tstne r3, #PTE_EXT_APX |
255 |
+- bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0 |
256 |
+-#endif |
257 |
+ |
258 |
+ tst r1, #L_PTE_XN |
259 |
+ orrne r3, r3, #PTE_EXT_XN |
260 |
+ |
261 |
+ tst r1, #L_PTE_YOUNG |
262 |
+ tstne r1, #L_PTE_PRESENT |
263 |
++ eorne r1, r1, #L_PTE_NONE |
264 |
++ tstne r1, #L_PTE_NONE |
265 |
+ moveq r3, #0 |
266 |
+ |
267 |
+ ARM( str r3, [r0, #2048]! ) |
268 |
+diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S |
269 |
+index f8a751c03282..5bf34ec89669 100644 |
270 |
+--- a/arch/mips/power/hibernate.S |
271 |
++++ b/arch/mips/power/hibernate.S |
272 |
+@@ -44,6 +44,7 @@ LEAF(swsusp_arch_resume) |
273 |
+ bne t1, t3, 1b |
274 |
+ PTR_L t0, PBE_NEXT(t0) |
275 |
+ bnez t0, 0b |
276 |
++ jal local_flush_tlb_all /* Avoid TLB mismatch after kernel resume */ |
277 |
+ PTR_LA t0, saved_regs |
278 |
+ PTR_L ra, PT_R31(t0) |
279 |
+ PTR_L sp, PT_R29(t0) |
280 |
+diff --git a/arch/sh/kernel/dumpstack.c b/arch/sh/kernel/dumpstack.c |
281 |
+index 694158b9a50f..3a6528c1b1cd 100644 |
282 |
+--- a/arch/sh/kernel/dumpstack.c |
283 |
++++ b/arch/sh/kernel/dumpstack.c |
284 |
+@@ -80,7 +80,7 @@ static int print_trace_stack(void *data, char *name) |
285 |
+ */ |
286 |
+ static void print_trace_address(void *data, unsigned long addr, int reliable) |
287 |
+ { |
288 |
+- printk(data); |
289 |
++ printk("%s", (char *)data); |
290 |
+ printk_address(addr, reliable); |
291 |
+ } |
292 |
+ |
293 |
+diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig |
294 |
+index 87537e208445..88d442d49acb 100644 |
295 |
+--- a/arch/sparc/Kconfig |
296 |
++++ b/arch/sparc/Kconfig |
297 |
+@@ -24,7 +24,7 @@ config SPARC |
298 |
+ select HAVE_IRQ_WORK |
299 |
+ select HAVE_DMA_ATTRS |
300 |
+ select HAVE_DMA_API_DEBUG |
301 |
+- select HAVE_ARCH_JUMP_LABEL |
302 |
++ select HAVE_ARCH_JUMP_LABEL if SPARC64 |
303 |
+ select HAVE_GENERIC_HARDIRQS |
304 |
+ select GENERIC_IRQ_SHOW |
305 |
+ select USE_GENERIC_SMP_HELPERS if SMP |
306 |
+diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h |
307 |
+index 3e1449f07798..6d6c7317d4c7 100644 |
308 |
+--- a/arch/sparc/include/asm/uaccess_64.h |
309 |
++++ b/arch/sparc/include/asm/uaccess_64.h |
310 |
+@@ -267,8 +267,8 @@ extern long __strnlen_user(const char __user *, long len); |
311 |
+ |
312 |
+ #define strlen_user __strlen_user |
313 |
+ #define strnlen_user __strnlen_user |
314 |
+-#define __copy_to_user_inatomic ___copy_to_user |
315 |
+-#define __copy_from_user_inatomic ___copy_from_user |
316 |
++#define __copy_to_user_inatomic __copy_to_user |
317 |
++#define __copy_from_user_inatomic __copy_from_user |
318 |
+ |
319 |
+ #endif /* __ASSEMBLY__ */ |
320 |
+ |
321 |
+diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c |
322 |
+index 31111e35281e..656b5b604936 100644 |
323 |
+--- a/arch/sparc/kernel/pci.c |
324 |
++++ b/arch/sparc/kernel/pci.c |
325 |
+@@ -487,8 +487,8 @@ static void __devinit apb_fake_ranges(struct pci_dev *dev, |
326 |
+ pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map); |
327 |
+ apb_calc_first_last(map, &first, &last); |
328 |
+ res = bus->resource[1]; |
329 |
+- res->start = (first << 21); |
330 |
+- res->end = (last << 21) + ((1 << 21) - 1); |
331 |
++ res->start = (first << 29); |
332 |
++ res->end = (last << 29) + ((1 << 29) - 1); |
333 |
+ res->flags = IORESOURCE_MEM; |
334 |
+ pci_resource_adjust(res, &pbm->mem_space); |
335 |
+ } |
336 |
+diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S |
337 |
+index 817187d42777..557212cfa0f2 100644 |
338 |
+--- a/arch/sparc/kernel/syscalls.S |
339 |
++++ b/arch/sparc/kernel/syscalls.S |
340 |
+@@ -184,7 +184,8 @@ linux_sparc_syscall32: |
341 |
+ mov %i0, %l5 ! IEU1 |
342 |
+ 5: call %l7 ! CTI Group brk forced |
343 |
+ srl %i5, 0, %o5 ! IEU1 |
344 |
+- ba,a,pt %xcc, 3f |
345 |
++ ba,pt %xcc, 3f |
346 |
++ sra %o0, 0, %o0 |
347 |
+ |
348 |
+ /* Linux native system calls enter here... */ |
349 |
+ .align 32 |
350 |
+@@ -212,7 +213,6 @@ linux_sparc_syscall: |
351 |
+ 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] |
352 |
+ ret_sys_call: |
353 |
+ ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 |
354 |
+- sra %o0, 0, %o0 |
355 |
+ mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2 |
356 |
+ sllx %g2, 32, %g2 |
357 |
+ |
358 |
+diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c |
359 |
+index 646d192b18a2..1a3cf6e5720c 100644 |
360 |
+--- a/arch/x86/kernel/cpu/mshyperv.c |
361 |
++++ b/arch/x86/kernel/cpu/mshyperv.c |
362 |
+@@ -18,6 +18,7 @@ |
363 |
+ #include <asm/hypervisor.h> |
364 |
+ #include <asm/hyperv.h> |
365 |
+ #include <asm/mshyperv.h> |
366 |
++#include <asm/timer.h> |
367 |
+ |
368 |
+ struct ms_hyperv_info ms_hyperv; |
369 |
+ EXPORT_SYMBOL_GPL(ms_hyperv); |
370 |
+@@ -70,6 +71,11 @@ static void __init ms_hyperv_init_platform(void) |
371 |
+ |
372 |
+ if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE) |
373 |
+ clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100); |
374 |
++ |
375 |
++#ifdef CONFIG_X86_IO_APIC |
376 |
++ no_timer_check = 1; |
377 |
++#endif |
378 |
++ |
379 |
+ } |
380 |
+ |
381 |
+ const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { |
382 |
+diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c |
383 |
+index ea697263b373..4ac453114d7e 100644 |
384 |
+--- a/arch/x86/kernel/ldt.c |
385 |
++++ b/arch/x86/kernel/ldt.c |
386 |
+@@ -230,6 +230,17 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode) |
387 |
+ } |
388 |
+ } |
389 |
+ |
390 |
++ /* |
391 |
++ * On x86-64 we do not support 16-bit segments due to |
392 |
++ * IRET leaking the high bits of the kernel stack address. |
393 |
++ */ |
394 |
++#ifdef CONFIG_X86_64 |
395 |
++ if (!ldt_info.seg_32bit) { |
396 |
++ error = -EINVAL; |
397 |
++ goto out_unlock; |
398 |
++ } |
399 |
++#endif |
400 |
++ |
401 |
+ fill_ldt(&ldt, &ldt_info); |
402 |
+ if (oldmode) |
403 |
+ ldt.avl = 0; |
404 |
+diff --git a/block/blk-core.c b/block/blk-core.c |
405 |
+index a219c8914daa..ec494ff6d244 100644 |
406 |
+--- a/block/blk-core.c |
407 |
++++ b/block/blk-core.c |
408 |
+@@ -2077,7 +2077,7 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes) |
409 |
+ if (!req->bio) |
410 |
+ return false; |
411 |
+ |
412 |
+- trace_block_rq_complete(req->q, req); |
413 |
++ trace_block_rq_complete(req->q, req, nr_bytes); |
414 |
+ |
415 |
+ /* |
416 |
+ * For fs requests, rq is just carrier of independent bio's |
417 |
+diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c |
418 |
+index 92ce30268826..263f899e66e9 100644 |
419 |
+--- a/drivers/char/ipmi/ipmi_bt_sm.c |
420 |
++++ b/drivers/char/ipmi/ipmi_bt_sm.c |
421 |
+@@ -352,7 +352,7 @@ static inline void write_all_bytes(struct si_sm_data *bt) |
422 |
+ |
423 |
+ static inline int read_all_bytes(struct si_sm_data *bt) |
424 |
+ { |
425 |
+- unsigned char i; |
426 |
++ unsigned int i; |
427 |
+ |
428 |
+ /* |
429 |
+ * length is "framing info", minimum = 4: NetFn, Seq, Cmd, cCode. |
430 |
+diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c |
431 |
+index b3379d6a5c57..2c6b671bde8e 100644 |
432 |
+--- a/drivers/cpufreq/powernow-k6.c |
433 |
++++ b/drivers/cpufreq/powernow-k6.c |
434 |
+@@ -25,41 +25,108 @@ |
435 |
+ static unsigned int busfreq; /* FSB, in 10 kHz */ |
436 |
+ static unsigned int max_multiplier; |
437 |
+ |
438 |
++static unsigned int param_busfreq = 0; |
439 |
++static unsigned int param_max_multiplier = 0; |
440 |
++ |
441 |
++module_param_named(max_multiplier, param_max_multiplier, uint, S_IRUGO); |
442 |
++MODULE_PARM_DESC(max_multiplier, "Maximum multiplier (allowed values: 20 30 35 40 45 50 55 60)"); |
443 |
++ |
444 |
++module_param_named(bus_frequency, param_busfreq, uint, S_IRUGO); |
445 |
++MODULE_PARM_DESC(bus_frequency, "Bus frequency in kHz"); |
446 |
+ |
447 |
+ /* Clock ratio multiplied by 10 - see table 27 in AMD#23446 */ |
448 |
+ static struct cpufreq_frequency_table clock_ratio[] = { |
449 |
+- {45, /* 000 -> 4.5x */ 0}, |
450 |
++ {60, /* 110 -> 6.0x */ 0}, |
451 |
++ {55, /* 011 -> 5.5x */ 0}, |
452 |
+ {50, /* 001 -> 5.0x */ 0}, |
453 |
++ {45, /* 000 -> 4.5x */ 0}, |
454 |
+ {40, /* 010 -> 4.0x */ 0}, |
455 |
+- {55, /* 011 -> 5.5x */ 0}, |
456 |
+- {20, /* 100 -> 2.0x */ 0}, |
457 |
+- {30, /* 101 -> 3.0x */ 0}, |
458 |
+- {60, /* 110 -> 6.0x */ 0}, |
459 |
+ {35, /* 111 -> 3.5x */ 0}, |
460 |
++ {30, /* 101 -> 3.0x */ 0}, |
461 |
++ {20, /* 100 -> 2.0x */ 0}, |
462 |
+ {0, CPUFREQ_TABLE_END} |
463 |
+ }; |
464 |
+ |
465 |
++static const u8 index_to_register[8] = { 6, 3, 1, 0, 2, 7, 5, 4 }; |
466 |
++static const u8 register_to_index[8] = { 3, 2, 4, 1, 7, 6, 0, 5 }; |
467 |
++ |
468 |
++static const struct { |
469 |
++ unsigned freq; |
470 |
++ unsigned mult; |
471 |
++} usual_frequency_table[] = { |
472 |
++ { 400000, 40 }, // 100 * 4 |
473 |
++ { 450000, 45 }, // 100 * 4.5 |
474 |
++ { 475000, 50 }, // 95 * 5 |
475 |
++ { 500000, 50 }, // 100 * 5 |
476 |
++ { 506250, 45 }, // 112.5 * 4.5 |
477 |
++ { 533500, 55 }, // 97 * 5.5 |
478 |
++ { 550000, 55 }, // 100 * 5.5 |
479 |
++ { 562500, 50 }, // 112.5 * 5 |
480 |
++ { 570000, 60 }, // 95 * 6 |
481 |
++ { 600000, 60 }, // 100 * 6 |
482 |
++ { 618750, 55 }, // 112.5 * 5.5 |
483 |
++ { 660000, 55 }, // 120 * 5.5 |
484 |
++ { 675000, 60 }, // 112.5 * 6 |
485 |
++ { 720000, 60 }, // 120 * 6 |
486 |
++}; |
487 |
++ |
488 |
++#define FREQ_RANGE 3000 |
489 |
+ |
490 |
+ /** |
491 |
+ * powernow_k6_get_cpu_multiplier - returns the current FSB multiplier |
492 |
+ * |
493 |
+- * Returns the current setting of the frequency multiplier. Core clock |
494 |
++ * Returns the current setting of the frequency multiplier. Core clock |
495 |
+ * speed is frequency of the Front-Side Bus multiplied with this value. |
496 |
+ */ |
497 |
+ static int powernow_k6_get_cpu_multiplier(void) |
498 |
+ { |
499 |
+- u64 invalue = 0; |
500 |
++ unsigned long invalue = 0; |
501 |
+ u32 msrval; |
502 |
+ |
503 |
++ local_irq_disable(); |
504 |
++ |
505 |
+ msrval = POWERNOW_IOPORT + 0x1; |
506 |
+ wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */ |
507 |
+ invalue = inl(POWERNOW_IOPORT + 0x8); |
508 |
+ msrval = POWERNOW_IOPORT + 0x0; |
509 |
+ wrmsr(MSR_K6_EPMR, msrval, 0); /* disable it again */ |
510 |
+ |
511 |
+- return clock_ratio[(invalue >> 5)&7].index; |
512 |
++ local_irq_enable(); |
513 |
++ |
514 |
++ return clock_ratio[register_to_index[(invalue >> 5)&7]].index; |
515 |
+ } |
516 |
+ |
517 |
++static void powernow_k6_set_cpu_multiplier(unsigned int best_i) |
518 |
++{ |
519 |
++ unsigned long outvalue, invalue; |
520 |
++ unsigned long msrval; |
521 |
++ unsigned long cr0; |
522 |
++ |
523 |
++ /* we now need to transform best_i to the BVC format, see AMD#23446 */ |
524 |
++ |
525 |
++ /* |
526 |
++ * The processor doesn't respond to inquiry cycles while changing the |
527 |
++ * frequency, so we must disable cache. |
528 |
++ */ |
529 |
++ local_irq_disable(); |
530 |
++ cr0 = read_cr0(); |
531 |
++ write_cr0(cr0 | X86_CR0_CD); |
532 |
++ wbinvd(); |
533 |
++ |
534 |
++ outvalue = (1<<12) | (1<<10) | (1<<9) | (index_to_register[best_i]<<5); |
535 |
++ |
536 |
++ msrval = POWERNOW_IOPORT + 0x1; |
537 |
++ wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */ |
538 |
++ invalue = inl(POWERNOW_IOPORT + 0x8); |
539 |
++ invalue = invalue & 0x1f; |
540 |
++ outvalue = outvalue | invalue; |
541 |
++ outl(outvalue, (POWERNOW_IOPORT + 0x8)); |
542 |
++ msrval = POWERNOW_IOPORT + 0x0; |
543 |
++ wrmsr(MSR_K6_EPMR, msrval, 0); /* disable it again */ |
544 |
++ |
545 |
++ write_cr0(cr0); |
546 |
++ local_irq_enable(); |
547 |
++} |
548 |
+ |
549 |
+ /** |
550 |
+ * powernow_k6_set_state - set the PowerNow! multiplier |
551 |
+@@ -69,8 +136,6 @@ static int powernow_k6_get_cpu_multiplier(void) |
552 |
+ */ |
553 |
+ static void powernow_k6_set_state(unsigned int best_i) |
554 |
+ { |
555 |
+- unsigned long outvalue = 0, invalue = 0; |
556 |
+- unsigned long msrval; |
557 |
+ struct cpufreq_freqs freqs; |
558 |
+ |
559 |
+ if (clock_ratio[best_i].index > max_multiplier) { |
560 |
+@@ -84,18 +149,7 @@ static void powernow_k6_set_state(unsigned int best_i) |
561 |
+ |
562 |
+ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); |
563 |
+ |
564 |
+- /* we now need to transform best_i to the BVC format, see AMD#23446 */ |
565 |
+- |
566 |
+- outvalue = (1<<12) | (1<<10) | (1<<9) | (best_i<<5); |
567 |
+- |
568 |
+- msrval = POWERNOW_IOPORT + 0x1; |
569 |
+- wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */ |
570 |
+- invalue = inl(POWERNOW_IOPORT + 0x8); |
571 |
+- invalue = invalue & 0xf; |
572 |
+- outvalue = outvalue | invalue; |
573 |
+- outl(outvalue , (POWERNOW_IOPORT + 0x8)); |
574 |
+- msrval = POWERNOW_IOPORT + 0x0; |
575 |
+- wrmsr(MSR_K6_EPMR, msrval, 0); /* disable it again */ |
576 |
++ powernow_k6_set_cpu_multiplier(best_i); |
577 |
+ |
578 |
+ cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
579 |
+ |
580 |
+@@ -140,18 +194,57 @@ static int powernow_k6_target(struct cpufreq_policy *policy, |
581 |
+ return 0; |
582 |
+ } |
583 |
+ |
584 |
+- |
585 |
+ static int powernow_k6_cpu_init(struct cpufreq_policy *policy) |
586 |
+ { |
587 |
+ unsigned int i, f; |
588 |
+ int result; |
589 |
++ unsigned khz; |
590 |
+ |
591 |
+ if (policy->cpu != 0) |
592 |
+ return -ENODEV; |
593 |
+ |
594 |
+- /* get frequencies */ |
595 |
+- max_multiplier = powernow_k6_get_cpu_multiplier(); |
596 |
+- busfreq = cpu_khz / max_multiplier; |
597 |
++ max_multiplier = 0; |
598 |
++ khz = cpu_khz; |
599 |
++ for (i = 0; i < ARRAY_SIZE(usual_frequency_table); i++) { |
600 |
++ if (khz >= usual_frequency_table[i].freq - FREQ_RANGE && |
601 |
++ khz <= usual_frequency_table[i].freq + FREQ_RANGE) { |
602 |
++ khz = usual_frequency_table[i].freq; |
603 |
++ max_multiplier = usual_frequency_table[i].mult; |
604 |
++ break; |
605 |
++ } |
606 |
++ } |
607 |
++ if (param_max_multiplier) { |
608 |
++ for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) { |
609 |
++ if (clock_ratio[i].index == param_max_multiplier) { |
610 |
++ max_multiplier = param_max_multiplier; |
611 |
++ goto have_max_multiplier; |
612 |
++ } |
613 |
++ } |
614 |
++ printk(KERN_ERR "powernow-k6: invalid max_multiplier parameter, valid parameters 20, 30, 35, 40, 45, 50, 55, 60\n"); |
615 |
++ return -EINVAL; |
616 |
++ } |
617 |
++ |
618 |
++ if (!max_multiplier) { |
619 |
++ printk(KERN_WARNING "powernow-k6: unknown frequency %u, cannot determine current multiplier\n", khz); |
620 |
++ printk(KERN_WARNING "powernow-k6: use module parameters max_multiplier and bus_frequency\n"); |
621 |
++ return -EOPNOTSUPP; |
622 |
++ } |
623 |
++ |
624 |
++have_max_multiplier: |
625 |
++ param_max_multiplier = max_multiplier; |
626 |
++ |
627 |
++ if (param_busfreq) { |
628 |
++ if (param_busfreq >= 50000 && param_busfreq <= 150000) { |
629 |
++ busfreq = param_busfreq / 10; |
630 |
++ goto have_busfreq; |
631 |
++ } |
632 |
++ printk(KERN_ERR "powernow-k6: invalid bus_frequency parameter, allowed range 50000 - 150000 kHz\n"); |
633 |
++ return -EINVAL; |
634 |
++ } |
635 |
++ |
636 |
++ busfreq = khz / max_multiplier; |
637 |
++have_busfreq: |
638 |
++ param_busfreq = busfreq * 10; |
639 |
+ |
640 |
+ /* table init */ |
641 |
+ for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) { |
642 |
+@@ -163,7 +256,7 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy) |
643 |
+ } |
644 |
+ |
645 |
+ /* cpuinfo and default policy values */ |
646 |
+- policy->cpuinfo.transition_latency = 200000; |
647 |
++ policy->cpuinfo.transition_latency = 500000; |
648 |
+ policy->cur = busfreq * max_multiplier; |
649 |
+ |
650 |
+ result = cpufreq_frequency_table_cpuinfo(policy, clock_ratio); |
651 |
+diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c |
652 |
+index 385c58e8405b..0f8114de0877 100644 |
653 |
+--- a/drivers/gpio/gpio-mxs.c |
654 |
++++ b/drivers/gpio/gpio-mxs.c |
655 |
+@@ -167,7 +167,8 @@ static void __init mxs_gpio_init_gc(struct mxs_gpio_port *port) |
656 |
+ ct->regs.ack = PINCTRL_IRQSTAT(port->id) + MXS_CLR; |
657 |
+ ct->regs.mask = PINCTRL_IRQEN(port->id); |
658 |
+ |
659 |
+- irq_setup_generic_chip(gc, IRQ_MSK(32), 0, IRQ_NOREQUEST, 0); |
660 |
++ irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_NESTED_LOCK, |
661 |
++ IRQ_NOREQUEST, 0); |
662 |
+ } |
663 |
+ |
664 |
+ static int mxs_gpio_to_irq(struct gpio_chip *gc, unsigned offset) |
665 |
+diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
666 |
+index 2ea8a96e0f14..27999d990da8 100644 |
667 |
+--- a/drivers/gpu/drm/i915/intel_display.c |
668 |
++++ b/drivers/gpu/drm/i915/intel_display.c |
669 |
+@@ -8946,6 +8946,12 @@ struct intel_quirk intel_quirks[] = { |
670 |
+ /* Acer/Packard Bell NCL20 */ |
671 |
+ { 0x2a42, 0x1025, 0x034b, quirk_invert_brightness }, |
672 |
+ |
673 |
++ /* Acer Aspire 4736Z */ |
674 |
++ { 0x2a42, 0x1025, 0x0260, quirk_invert_brightness }, |
675 |
++ |
676 |
++ /* Acer Aspire 5336 */ |
677 |
++ { 0x2a42, 0x1025, 0x048a, quirk_invert_brightness }, |
678 |
++ |
679 |
+ /* Dell XPS13 HD Sandy Bridge */ |
680 |
+ { 0x0116, 0x1028, 0x052e, quirk_no_pcm_pwm_enable }, |
681 |
+ /* Dell XPS13 HD and XPS13 FHD Ivy Bridge */ |
682 |
+diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c |
683 |
+index 12041fa6dca8..b221f2b6305f 100644 |
684 |
+--- a/drivers/gpu/drm/i915/intel_tv.c |
685 |
++++ b/drivers/gpu/drm/i915/intel_tv.c |
686 |
+@@ -1599,9 +1599,14 @@ static int tv_is_present_in_vbt(struct drm_device *dev) |
687 |
+ /* |
688 |
+ * If the device type is not TV, continue. |
689 |
+ */ |
690 |
+- if (p_child->device_type != DEVICE_TYPE_INT_TV && |
691 |
+- p_child->device_type != DEVICE_TYPE_TV) |
692 |
++ switch (p_child->device_type) { |
693 |
++ case DEVICE_TYPE_INT_TV: |
694 |
++ case DEVICE_TYPE_TV: |
695 |
++ case DEVICE_TYPE_TV_SVIDEO_COMPOSITE: |
696 |
++ break; |
697 |
++ default: |
698 |
+ continue; |
699 |
++ } |
700 |
+ /* Only when the addin_offset is non-zero, it is regarded |
701 |
+ * as present. |
702 |
+ */ |
703 |
+diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c |
704 |
+index 63e714307c8e..3291ab8e8f84 100644 |
705 |
+--- a/drivers/gpu/drm/radeon/radeon_display.c |
706 |
++++ b/drivers/gpu/drm/radeon/radeon_display.c |
707 |
+@@ -738,6 +738,7 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) |
708 |
+ if (radeon_connector->edid) { |
709 |
+ drm_mode_connector_update_edid_property(&radeon_connector->base, radeon_connector->edid); |
710 |
+ ret = drm_add_edid_modes(&radeon_connector->base, radeon_connector->edid); |
711 |
++ drm_edid_to_eld(&radeon_connector->base, radeon_connector->edid); |
712 |
+ return ret; |
713 |
+ } |
714 |
+ drm_mode_connector_update_edid_property(&radeon_connector->base, NULL); |
715 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c |
716 |
+index 34e51a1695b8..907c26ff17a5 100644 |
717 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c |
718 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c |
719 |
+@@ -147,7 +147,7 @@ static int vmw_fb_check_var(struct fb_var_screeninfo *var, |
720 |
+ } |
721 |
+ |
722 |
+ if (!vmw_kms_validate_mode_vram(vmw_priv, |
723 |
+- info->fix.line_length, |
724 |
++ var->xres * var->bits_per_pixel/8, |
725 |
+ var->yoffset + var->yres)) { |
726 |
+ DRM_ERROR("Requested geom can not fit in framebuffer\n"); |
727 |
+ return -EINVAL; |
728 |
+@@ -162,6 +162,8 @@ static int vmw_fb_set_par(struct fb_info *info) |
729 |
+ struct vmw_private *vmw_priv = par->vmw_priv; |
730 |
+ int ret; |
731 |
+ |
732 |
++ info->fix.line_length = info->var.xres * info->var.bits_per_pixel/8; |
733 |
++ |
734 |
+ ret = vmw_kms_write_svga(vmw_priv, info->var.xres, info->var.yres, |
735 |
+ info->fix.line_length, |
736 |
+ par->bpp, par->depth); |
737 |
+@@ -177,6 +179,7 @@ static int vmw_fb_set_par(struct fb_info *info) |
738 |
+ vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset); |
739 |
+ vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres); |
740 |
+ vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres); |
741 |
++ vmw_write(vmw_priv, SVGA_REG_BYTES_PER_LINE, info->fix.line_length); |
742 |
+ vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); |
743 |
+ } |
744 |
+ |
745 |
+diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c |
746 |
+index 810658e8211a..d01edf3c7b28 100644 |
747 |
+--- a/drivers/hv/ring_buffer.c |
748 |
++++ b/drivers/hv/ring_buffer.c |
749 |
+@@ -485,7 +485,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer, |
750 |
+ /* Make sure all reads are done before we update the read index since */ |
751 |
+ /* the writer may start writing to the read area once the read index */ |
752 |
+ /*is updated */ |
753 |
+- smp_mb(); |
754 |
++ mb(); |
755 |
+ |
756 |
+ /* Update the read index */ |
757 |
+ hv_set_next_read_location(inring_info, next_read_location); |
758 |
+diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c |
759 |
+index d9b0ebcb67d7..6eeb84d6e5cf 100644 |
760 |
+--- a/drivers/infiniband/hw/ehca/ehca_cq.c |
761 |
++++ b/drivers/infiniband/hw/ehca/ehca_cq.c |
762 |
+@@ -296,6 +296,7 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector, |
763 |
+ (my_cq->galpas.user.fw_handle & (PAGE_SIZE - 1)); |
764 |
+ if (ib_copy_to_udata(udata, &resp, sizeof(resp))) { |
765 |
+ ehca_err(device, "Copy to udata failed."); |
766 |
++ cq = ERR_PTR(-EFAULT); |
767 |
+ goto create_cq_exit4; |
768 |
+ } |
769 |
+ } |
770 |
+diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c |
771 |
+index 714293b78518..e2f9a51f4a38 100644 |
772 |
+--- a/drivers/infiniband/hw/ipath/ipath_diag.c |
773 |
++++ b/drivers/infiniband/hw/ipath/ipath_diag.c |
774 |
+@@ -326,7 +326,7 @@ static ssize_t ipath_diagpkt_write(struct file *fp, |
775 |
+ size_t count, loff_t *off) |
776 |
+ { |
777 |
+ u32 __iomem *piobuf; |
778 |
+- u32 plen, clen, pbufn; |
779 |
++ u32 plen, pbufn, maxlen_reserve; |
780 |
+ struct ipath_diag_pkt odp; |
781 |
+ struct ipath_diag_xpkt dp; |
782 |
+ u32 *tmpbuf = NULL; |
783 |
+@@ -335,51 +335,29 @@ static ssize_t ipath_diagpkt_write(struct file *fp, |
784 |
+ u64 val; |
785 |
+ u32 l_state, lt_state; /* LinkState, LinkTrainingState */ |
786 |
+ |
787 |
+- if (count < sizeof(odp)) { |
788 |
+- ret = -EINVAL; |
789 |
+- goto bail; |
790 |
+- } |
791 |
+ |
792 |
+ if (count == sizeof(dp)) { |
793 |
+ if (copy_from_user(&dp, data, sizeof(dp))) { |
794 |
+ ret = -EFAULT; |
795 |
+ goto bail; |
796 |
+ } |
797 |
+- } else if (copy_from_user(&odp, data, sizeof(odp))) { |
798 |
+- ret = -EFAULT; |
799 |
++ } else if (count == sizeof(odp)) { |
800 |
++ if (copy_from_user(&odp, data, sizeof(odp))) { |
801 |
++ ret = -EFAULT; |
802 |
++ goto bail; |
803 |
++ } |
804 |
++ } else { |
805 |
++ ret = -EINVAL; |
806 |
+ goto bail; |
807 |
+ } |
808 |
+ |
809 |
+- /* |
810 |
+- * Due to padding/alignment issues (lessened with new struct) |
811 |
+- * the old and new structs are the same length. We need to |
812 |
+- * disambiguate them, which we can do because odp.len has never |
813 |
+- * been less than the total of LRH+BTH+DETH so far, while |
814 |
+- * dp.unit (same offset) unit is unlikely to get that high. |
815 |
+- * Similarly, dp.data, the pointer to user at the same offset |
816 |
+- * as odp.unit, is almost certainly at least one (512byte)page |
817 |
+- * "above" NULL. The if-block below can be omitted if compatibility |
818 |
+- * between a new driver and older diagnostic code is unimportant. |
819 |
+- * compatibility the other direction (new diags, old driver) is |
820 |
+- * handled in the diagnostic code, with a warning. |
821 |
+- */ |
822 |
+- if (dp.unit >= 20 && dp.data < 512) { |
823 |
+- /* very probable version mismatch. Fix it up */ |
824 |
+- memcpy(&odp, &dp, sizeof(odp)); |
825 |
+- /* We got a legacy dp, copy elements to dp */ |
826 |
+- dp.unit = odp.unit; |
827 |
+- dp.data = odp.data; |
828 |
+- dp.len = odp.len; |
829 |
+- dp.pbc_wd = 0; /* Indicate we need to compute PBC wd */ |
830 |
+- } |
831 |
+- |
832 |
+ /* send count must be an exact number of dwords */ |
833 |
+ if (dp.len & 3) { |
834 |
+ ret = -EINVAL; |
835 |
+ goto bail; |
836 |
+ } |
837 |
+ |
838 |
+- clen = dp.len >> 2; |
839 |
++ plen = dp.len >> 2; |
840 |
+ |
841 |
+ dd = ipath_lookup(dp.unit); |
842 |
+ if (!dd || !(dd->ipath_flags & IPATH_PRESENT) || |
843 |
+@@ -422,16 +400,22 @@ static ssize_t ipath_diagpkt_write(struct file *fp, |
844 |
+ goto bail; |
845 |
+ } |
846 |
+ |
847 |
+- /* need total length before first word written */ |
848 |
+- /* +1 word is for the qword padding */ |
849 |
+- plen = sizeof(u32) + dp.len; |
850 |
+- |
851 |
+- if ((plen + 4) > dd->ipath_ibmaxlen) { |
852 |
++ /* |
853 |
++ * need total length before first word written, plus 2 Dwords. One Dword |
854 |
++ * is for padding so we get the full user data when not aligned on |
855 |
++ * a word boundary. The other Dword is to make sure we have room for the |
856 |
++ * ICRC which gets tacked on later. |
857 |
++ */ |
858 |
++ maxlen_reserve = 2 * sizeof(u32); |
859 |
++ if (dp.len > dd->ipath_ibmaxlen - maxlen_reserve) { |
860 |
+ ipath_dbg("Pkt len 0x%x > ibmaxlen %x\n", |
861 |
+- plen - 4, dd->ipath_ibmaxlen); |
862 |
++ dp.len, dd->ipath_ibmaxlen); |
863 |
+ ret = -EINVAL; |
864 |
+- goto bail; /* before writing pbc */ |
865 |
++ goto bail; |
866 |
+ } |
867 |
++ |
868 |
++ plen = sizeof(u32) + dp.len; |
869 |
++ |
870 |
+ tmpbuf = vmalloc(plen); |
871 |
+ if (!tmpbuf) { |
872 |
+ dev_info(&dd->pcidev->dev, "Unable to allocate tmp buffer, " |
873 |
+@@ -473,11 +457,11 @@ static ssize_t ipath_diagpkt_write(struct file *fp, |
874 |
+ */ |
875 |
+ if (dd->ipath_flags & IPATH_PIO_FLUSH_WC) { |
876 |
+ ipath_flush_wc(); |
877 |
+- __iowrite32_copy(piobuf + 2, tmpbuf, clen - 1); |
878 |
++ __iowrite32_copy(piobuf + 2, tmpbuf, plen - 1); |
879 |
+ ipath_flush_wc(); |
880 |
+- __raw_writel(tmpbuf[clen - 1], piobuf + clen + 1); |
881 |
++ __raw_writel(tmpbuf[plen - 1], piobuf + plen + 1); |
882 |
+ } else |
883 |
+- __iowrite32_copy(piobuf + 2, tmpbuf, clen); |
884 |
++ __iowrite32_copy(piobuf + 2, tmpbuf, plen); |
885 |
+ |
886 |
+ ipath_flush_wc(); |
887 |
+ |
888 |
+diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c |
889 |
+index 5b71d43bd89c..42dde06fdb91 100644 |
890 |
+--- a/drivers/infiniband/hw/mthca/mthca_provider.c |
891 |
++++ b/drivers/infiniband/hw/mthca/mthca_provider.c |
892 |
+@@ -695,6 +695,7 @@ static struct ib_cq *mthca_create_cq(struct ib_device *ibdev, int entries, |
893 |
+ |
894 |
+ if (context && ib_copy_to_udata(udata, &cq->cqn, sizeof (__u32))) { |
895 |
+ mthca_free_cq(to_mdev(ibdev), cq); |
896 |
++ err = -EFAULT; |
897 |
+ goto err_free; |
898 |
+ } |
899 |
+ |
900 |
+diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c |
901 |
+index b0471b4237a7..330eb6e1652f 100644 |
902 |
+--- a/drivers/infiniband/hw/nes/nes_verbs.c |
903 |
++++ b/drivers/infiniband/hw/nes/nes_verbs.c |
904 |
+@@ -1183,7 +1183,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd, |
905 |
+ nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); |
906 |
+ kfree(nesqp->allocated_buffer); |
907 |
+ nes_debug(NES_DBG_QP, "ib_copy_from_udata() Failed \n"); |
908 |
+- return NULL; |
909 |
++ return ERR_PTR(-EFAULT); |
910 |
+ } |
911 |
+ if (req.user_wqe_buffers) { |
912 |
+ virt_wqs = 1; |
913 |
+diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c |
914 |
+index 4df80fb7a314..75ca5d27c834 100644 |
915 |
+--- a/drivers/isdn/isdnloop/isdnloop.c |
916 |
++++ b/drivers/isdn/isdnloop/isdnloop.c |
917 |
+@@ -518,9 +518,9 @@ static isdnloop_stat isdnloop_cmd_table[] = |
918 |
+ static void |
919 |
+ isdnloop_fake_err(isdnloop_card * card) |
920 |
+ { |
921 |
+- char buf[60]; |
922 |
++ char buf[64]; |
923 |
+ |
924 |
+- sprintf(buf, "E%s", card->omsg); |
925 |
++ snprintf(buf, sizeof(buf), "E%s", card->omsg); |
926 |
+ isdnloop_fake(card, buf, -1); |
927 |
+ isdnloop_fake(card, "NAK", -1); |
928 |
+ } |
929 |
+@@ -903,6 +903,8 @@ isdnloop_parse_cmd(isdnloop_card * card) |
930 |
+ case 7: |
931 |
+ /* 0x;EAZ */ |
932 |
+ p += 3; |
933 |
++ if (strlen(p) >= sizeof(card->eazlist[0])) |
934 |
++ break; |
935 |
+ strcpy(card->eazlist[ch - 1], p); |
936 |
+ break; |
937 |
+ case 8: |
938 |
+@@ -1070,6 +1072,12 @@ isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp) |
939 |
+ return -EBUSY; |
940 |
+ if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef))) |
941 |
+ return -EFAULT; |
942 |
++ |
943 |
++ for (i = 0; i < 3; i++) { |
944 |
++ if (!memchr(sdef.num[i], 0, sizeof(sdef.num[i]))) |
945 |
++ return -EINVAL; |
946 |
++ } |
947 |
++ |
948 |
+ spin_lock_irqsave(&card->isdnloop_lock, flags); |
949 |
+ switch (sdef.ptype) { |
950 |
+ case ISDN_PTYPE_EURO: |
951 |
+@@ -1127,7 +1135,7 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card) |
952 |
+ { |
953 |
+ ulong a; |
954 |
+ int i; |
955 |
+- char cbuf[60]; |
956 |
++ char cbuf[80]; |
957 |
+ isdn_ctrl cmd; |
958 |
+ isdnloop_cdef cdef; |
959 |
+ |
960 |
+@@ -1192,7 +1200,6 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card) |
961 |
+ break; |
962 |
+ if ((c->arg & 255) < ISDNLOOP_BCH) { |
963 |
+ char *p; |
964 |
+- char dial[50]; |
965 |
+ char dcode[4]; |
966 |
+ |
967 |
+ a = c->arg; |
968 |
+@@ -1204,10 +1211,10 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card) |
969 |
+ } else |
970 |
+ /* Normal Dial */ |
971 |
+ strcpy(dcode, "CAL"); |
972 |
+- strcpy(dial, p); |
973 |
+- sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1), |
974 |
+- dcode, dial, c->parm.setup.si1, |
975 |
+- c->parm.setup.si2, c->parm.setup.eazmsn); |
976 |
++ snprintf(cbuf, sizeof(cbuf), |
977 |
++ "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1), |
978 |
++ dcode, p, c->parm.setup.si1, |
979 |
++ c->parm.setup.si2, c->parm.setup.eazmsn); |
980 |
+ i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); |
981 |
+ } |
982 |
+ break; |
983 |
+diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c |
984 |
+index 2c9dd2c94889..80f8bd5e38ee 100644 |
985 |
+--- a/drivers/md/dm-thin.c |
986 |
++++ b/drivers/md/dm-thin.c |
987 |
+@@ -1298,9 +1298,9 @@ static void process_deferred_bios(struct pool *pool) |
988 |
+ */ |
989 |
+ if (ensure_next_mapping(pool)) { |
990 |
+ spin_lock_irqsave(&pool->lock, flags); |
991 |
++ bio_list_add(&pool->deferred_bios, bio); |
992 |
+ bio_list_merge(&pool->deferred_bios, &bios); |
993 |
+ spin_unlock_irqrestore(&pool->lock, flags); |
994 |
+- |
995 |
+ break; |
996 |
+ } |
997 |
+ process_bio(tc, bio); |
998 |
+diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c |
999 |
+index 86e07a139a16..509e2026790e 100644 |
1000 |
+--- a/drivers/media/video/gspca/sn9c20x.c |
1001 |
++++ b/drivers/media/video/gspca/sn9c20x.c |
1002 |
+@@ -2521,6 +2521,7 @@ static const struct usb_device_id device_table[] = { |
1003 |
+ {USB_DEVICE(0x045e, 0x00f4), SN9C20X(OV9650, 0x30, 0)}, |
1004 |
+ {USB_DEVICE(0x145f, 0x013d), SN9C20X(OV7660, 0x21, 0)}, |
1005 |
+ {USB_DEVICE(0x0458, 0x7029), SN9C20X(HV7131R, 0x11, 0)}, |
1006 |
++ {USB_DEVICE(0x0458, 0x7045), SN9C20X(MT9M112, 0x5d, LED_REVERSE)}, |
1007 |
+ {USB_DEVICE(0x0458, 0x704a), SN9C20X(MT9M112, 0x5d, 0)}, |
1008 |
+ {USB_DEVICE(0x0458, 0x704c), SN9C20X(MT9M112, 0x5d, 0)}, |
1009 |
+ {USB_DEVICE(0xa168, 0x0610), SN9C20X(HV7131R, 0x11, 0)}, |
1010 |
+diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c |
1011 |
+index b015e8e5e8b0..af5c0401ed76 100644 |
1012 |
+--- a/drivers/media/video/uvc/uvc_video.c |
1013 |
++++ b/drivers/media/video/uvc/uvc_video.c |
1014 |
+@@ -1267,7 +1267,25 @@ int uvc_video_enable(struct uvc_streaming *stream, int enable) |
1015 |
+ |
1016 |
+ if (!enable) { |
1017 |
+ uvc_uninit_video(stream, 1); |
1018 |
+- usb_set_interface(stream->dev->udev, stream->intfnum, 0); |
1019 |
++ if (stream->intf->num_altsetting > 1) { |
1020 |
++ usb_set_interface(stream->dev->udev, |
1021 |
++ stream->intfnum, 0); |
1022 |
++ } else { |
1023 |
++ /* UVC doesn't specify how to inform a bulk-based device |
1024 |
++ * when the video stream is stopped. Windows sends a |
1025 |
++ * CLEAR_FEATURE(HALT) request to the video streaming |
1026 |
++ * bulk endpoint, mimic the same behaviour. |
1027 |
++ */ |
1028 |
++ unsigned int epnum = stream->header.bEndpointAddress |
1029 |
++ & USB_ENDPOINT_NUMBER_MASK; |
1030 |
++ unsigned int dir = stream->header.bEndpointAddress |
1031 |
++ & USB_ENDPOINT_DIR_MASK; |
1032 |
++ unsigned int pipe; |
1033 |
++ |
1034 |
++ pipe = usb_sndbulkpipe(stream->dev->udev, epnum) | dir; |
1035 |
++ usb_clear_halt(stream->dev->udev, pipe); |
1036 |
++ } |
1037 |
++ |
1038 |
+ uvc_queue_enable(&stream->queue, 0); |
1039 |
+ return 0; |
1040 |
+ } |
1041 |
+diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c |
1042 |
+index e017dc88622a..f035dd3c7a09 100644 |
1043 |
+--- a/drivers/mfd/88pm860x-i2c.c |
1044 |
++++ b/drivers/mfd/88pm860x-i2c.c |
1045 |
+@@ -290,6 +290,12 @@ static int __devinit pm860x_probe(struct i2c_client *client, |
1046 |
+ chip->companion_addr = pdata->companion_addr; |
1047 |
+ chip->companion = i2c_new_dummy(chip->client->adapter, |
1048 |
+ chip->companion_addr); |
1049 |
++ if (!chip->companion) { |
1050 |
++ dev_err(&client->dev, |
1051 |
++ "Failed to allocate I2C companion device\n"); |
1052 |
++ kfree(chip); |
1053 |
++ return -ENODEV; |
1054 |
++ } |
1055 |
+ i2c_set_clientdata(chip->companion, chip); |
1056 |
+ } |
1057 |
+ |
1058 |
+diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig |
1059 |
+index f1391c21ef26..b2b69167b068 100644 |
1060 |
+--- a/drivers/mfd/Kconfig |
1061 |
++++ b/drivers/mfd/Kconfig |
1062 |
+@@ -772,9 +772,6 @@ config MFD_INTEL_MSIC |
1063 |
+ Passage) chip. This chip embeds audio, battery, GPIO, etc. |
1064 |
+ devices used in Intel Medfield platforms. |
1065 |
+ |
1066 |
+-endmenu |
1067 |
+-endif |
1068 |
+- |
1069 |
+ menu "Multimedia Capabilities Port drivers" |
1070 |
+ depends on ARCH_SA1100 |
1071 |
+ |
1072 |
+@@ -797,3 +794,6 @@ config MCP_UCB1200_TS |
1073 |
+ depends on MCP_UCB1200 && INPUT |
1074 |
+ |
1075 |
+ endmenu |
1076 |
++ |
1077 |
++endmenu |
1078 |
++endif |
1079 |
+diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c |
1080 |
+index 0219115e00c7..90b450c676fe 100644 |
1081 |
+--- a/drivers/mfd/max8925-i2c.c |
1082 |
++++ b/drivers/mfd/max8925-i2c.c |
1083 |
+@@ -156,9 +156,18 @@ static int __devinit max8925_probe(struct i2c_client *client, |
1084 |
+ mutex_init(&chip->io_lock); |
1085 |
+ |
1086 |
+ chip->rtc = i2c_new_dummy(chip->i2c->adapter, RTC_I2C_ADDR); |
1087 |
++ if (!chip->rtc) { |
1088 |
++ dev_err(chip->dev, "Failed to allocate I2C device for RTC\n"); |
1089 |
++ return -ENODEV; |
1090 |
++ } |
1091 |
+ i2c_set_clientdata(chip->rtc, chip); |
1092 |
+ |
1093 |
+ chip->adc = i2c_new_dummy(chip->i2c->adapter, ADC_I2C_ADDR); |
1094 |
++ if (!chip->adc) { |
1095 |
++ dev_err(chip->dev, "Failed to allocate I2C device for ADC\n"); |
1096 |
++ i2c_unregister_device(chip->rtc); |
1097 |
++ return -ENODEV; |
1098 |
++ } |
1099 |
+ i2c_set_clientdata(chip->adc, chip); |
1100 |
+ |
1101 |
+ max8925_device_init(chip, pdata); |
1102 |
+diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c |
1103 |
+index 5be53ae9b61c..1926a54f4bd0 100644 |
1104 |
+--- a/drivers/mfd/max8997.c |
1105 |
++++ b/drivers/mfd/max8997.c |
1106 |
+@@ -148,10 +148,26 @@ static int max8997_i2c_probe(struct i2c_client *i2c, |
1107 |
+ mutex_init(&max8997->iolock); |
1108 |
+ |
1109 |
+ max8997->rtc = i2c_new_dummy(i2c->adapter, I2C_ADDR_RTC); |
1110 |
++ if (!max8997->rtc) { |
1111 |
++ dev_err(max8997->dev, "Failed to allocate I2C device for RTC\n"); |
1112 |
++ return -ENODEV; |
1113 |
++ } |
1114 |
+ i2c_set_clientdata(max8997->rtc, max8997); |
1115 |
++ |
1116 |
+ max8997->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); |
1117 |
++ if (!max8997->haptic) { |
1118 |
++ dev_err(max8997->dev, "Failed to allocate I2C device for Haptic\n"); |
1119 |
++ ret = -ENODEV; |
1120 |
++ goto err_i2c_haptic; |
1121 |
++ } |
1122 |
+ i2c_set_clientdata(max8997->haptic, max8997); |
1123 |
++ |
1124 |
+ max8997->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC); |
1125 |
++ if (!max8997->muic) { |
1126 |
++ dev_err(max8997->dev, "Failed to allocate I2C device for MUIC\n"); |
1127 |
++ ret = -ENODEV; |
1128 |
++ goto err_i2c_muic; |
1129 |
++ } |
1130 |
+ i2c_set_clientdata(max8997->muic, max8997); |
1131 |
+ |
1132 |
+ pm_runtime_set_active(max8997->dev); |
1133 |
+@@ -178,7 +194,9 @@ static int max8997_i2c_probe(struct i2c_client *i2c, |
1134 |
+ err_mfd: |
1135 |
+ mfd_remove_devices(max8997->dev); |
1136 |
+ i2c_unregister_device(max8997->muic); |
1137 |
++err_i2c_muic: |
1138 |
+ i2c_unregister_device(max8997->haptic); |
1139 |
++err_i2c_haptic: |
1140 |
+ i2c_unregister_device(max8997->rtc); |
1141 |
+ err: |
1142 |
+ kfree(max8997); |
1143 |
+diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c |
1144 |
+index de4096aee248..2fa6a28d3a99 100644 |
1145 |
+--- a/drivers/mfd/max8998.c |
1146 |
++++ b/drivers/mfd/max8998.c |
1147 |
+@@ -152,6 +152,10 @@ static int max8998_i2c_probe(struct i2c_client *i2c, |
1148 |
+ mutex_init(&max8998->iolock); |
1149 |
+ |
1150 |
+ max8998->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR); |
1151 |
++ if (!max8998->rtc) { |
1152 |
++ dev_err(&i2c->dev, "Failed to allocate I2C device for RTC\n"); |
1153 |
++ return -ENODEV; |
1154 |
++ } |
1155 |
+ i2c_set_clientdata(max8998->rtc, max8998); |
1156 |
+ |
1157 |
+ max8998_irq_init(max8998); |
1158 |
+diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c |
1159 |
+index 2e88af13293e..a0ba5ac299c2 100644 |
1160 |
+--- a/drivers/net/wireless/ath/ath9k/xmit.c |
1161 |
++++ b/drivers/net/wireless/ath/ath9k/xmit.c |
1162 |
+@@ -1390,7 +1390,7 @@ int ath_cabq_update(struct ath_softc *sc) |
1163 |
+ else if (sc->config.cabqReadytime > ATH9K_READY_TIME_HI_BOUND) |
1164 |
+ sc->config.cabqReadytime = ATH9K_READY_TIME_HI_BOUND; |
1165 |
+ |
1166 |
+- qi.tqi_readyTime = (cur_conf->beacon_interval * |
1167 |
++ qi.tqi_readyTime = (TU_TO_USEC(cur_conf->beacon_interval) * |
1168 |
+ sc->config.cabqReadytime) / 100; |
1169 |
+ ath_txq_update(sc, qnum, &qi); |
1170 |
+ |
1171 |
+diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c |
1172 |
+index b17d9b6c33a5..0490c7c9c455 100644 |
1173 |
+--- a/drivers/net/wireless/b43/phy_n.c |
1174 |
++++ b/drivers/net/wireless/b43/phy_n.c |
1175 |
+@@ -3937,22 +3937,22 @@ static void b43_nphy_channel_setup(struct b43_wldev *dev, |
1176 |
+ struct b43_phy_n *nphy = dev->phy.n; |
1177 |
+ |
1178 |
+ u16 old_band_5ghz; |
1179 |
+- u32 tmp32; |
1180 |
++ u16 tmp16; |
1181 |
+ |
1182 |
+ old_band_5ghz = |
1183 |
+ b43_phy_read(dev, B43_NPHY_BANDCTL) & B43_NPHY_BANDCTL_5GHZ; |
1184 |
+ if (new_channel->band == IEEE80211_BAND_5GHZ && !old_band_5ghz) { |
1185 |
+- tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR); |
1186 |
+- b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4); |
1187 |
++ tmp16 = b43_read16(dev, B43_MMIO_PSM_PHY_HDR); |
1188 |
++ b43_write16(dev, B43_MMIO_PSM_PHY_HDR, tmp16 | 4); |
1189 |
+ b43_phy_set(dev, B43_PHY_B_BBCFG, 0xC000); |
1190 |
+- b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32); |
1191 |
++ b43_write16(dev, B43_MMIO_PSM_PHY_HDR, tmp16); |
1192 |
+ b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ); |
1193 |
+ } else if (new_channel->band == IEEE80211_BAND_2GHZ && old_band_5ghz) { |
1194 |
+ b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ); |
1195 |
+- tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR); |
1196 |
+- b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4); |
1197 |
++ tmp16 = b43_read16(dev, B43_MMIO_PSM_PHY_HDR); |
1198 |
++ b43_write16(dev, B43_MMIO_PSM_PHY_HDR, tmp16 | 4); |
1199 |
+ b43_phy_mask(dev, B43_PHY_B_BBCFG, 0x3FFF); |
1200 |
+- b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32); |
1201 |
++ b43_write16(dev, B43_MMIO_PSM_PHY_HDR, tmp16); |
1202 |
+ } |
1203 |
+ |
1204 |
+ b43_chantab_phy_upload(dev, e); |
1205 |
+diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c |
1206 |
+index 94d35ad910c4..4a369732bf89 100644 |
1207 |
+--- a/drivers/net/wireless/iwlwifi/iwl-agn.c |
1208 |
++++ b/drivers/net/wireless/iwlwifi/iwl-agn.c |
1209 |
+@@ -246,13 +246,17 @@ static void iwl_bg_bt_runtime_config(struct work_struct *work) |
1210 |
+ struct iwl_priv *priv = |
1211 |
+ container_of(work, struct iwl_priv, bt_runtime_config); |
1212 |
+ |
1213 |
++ mutex_lock(&priv->shrd->mutex); |
1214 |
+ if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) |
1215 |
+- return; |
1216 |
++ goto out; |
1217 |
+ |
1218 |
+ /* dont send host command if rf-kill is on */ |
1219 |
+ if (!iwl_is_ready_rf(priv->shrd)) |
1220 |
+- return; |
1221 |
++ goto out; |
1222 |
++ |
1223 |
+ iwlagn_send_advance_bt_config(priv); |
1224 |
++out: |
1225 |
++ mutex_unlock(&priv->shrd->mutex); |
1226 |
+ } |
1227 |
+ |
1228 |
+ static void iwl_bg_bt_full_concurrency(struct work_struct *work) |
1229 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c |
1230 |
+index c474486e3911..503c1608270a 100644 |
1231 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c |
1232 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c |
1233 |
+@@ -924,7 +924,7 @@ int rtl92se_hw_init(struct ieee80211_hw *hw) |
1234 |
+ struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
1235 |
+ struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
1236 |
+ u8 tmp_byte = 0; |
1237 |
+- |
1238 |
++ unsigned long flags; |
1239 |
+ bool rtstatus = true; |
1240 |
+ u8 tmp_u1b; |
1241 |
+ int err = false; |
1242 |
+@@ -936,6 +936,16 @@ int rtl92se_hw_init(struct ieee80211_hw *hw) |
1243 |
+ |
1244 |
+ rtlpci->being_init_adapter = true; |
1245 |
+ |
1246 |
++ /* As this function can take a very long time (up to 350 ms) |
1247 |
++ * and can be called with irqs disabled, reenable the irqs |
1248 |
++ * to let the other devices continue being serviced. |
1249 |
++ * |
1250 |
++ * It is safe doing so since our own interrupts will only be enabled |
1251 |
++ * in a subsequent step. |
1252 |
++ */ |
1253 |
++ local_save_flags(flags); |
1254 |
++ local_irq_enable(); |
1255 |
++ |
1256 |
+ rtlpriv->intf_ops->disable_aspm(hw); |
1257 |
+ |
1258 |
+ /* 1. MAC Initialize */ |
1259 |
+@@ -969,7 +979,8 @@ int rtl92se_hw_init(struct ieee80211_hw *hw) |
1260 |
+ /* 3. Initialize MAC/PHY Config by MACPHY_reg.txt */ |
1261 |
+ if (rtl92s_phy_mac_config(hw) != true) { |
1262 |
+ RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("MAC Config failed\n")); |
1263 |
+- return rtstatus; |
1264 |
++ err = rtstatus; |
1265 |
++ goto exit; |
1266 |
+ } |
1267 |
+ |
1268 |
+ /* Make sure BB/RF write OK. We should prevent enter IPS. radio off. */ |
1269 |
+@@ -979,7 +990,8 @@ int rtl92se_hw_init(struct ieee80211_hw *hw) |
1270 |
+ /* 4. Initialize BB After MAC Config PHY_reg.txt, AGC_Tab.txt */ |
1271 |
+ if (rtl92s_phy_bb_config(hw) != true) { |
1272 |
+ RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, ("BB Config failed\n")); |
1273 |
+- return rtstatus; |
1274 |
++ err = rtstatus; |
1275 |
++ goto exit; |
1276 |
+ } |
1277 |
+ |
1278 |
+ /* 5. Initiailze RF RAIO_A.txt RF RAIO_B.txt */ |
1279 |
+@@ -1015,7 +1027,8 @@ int rtl92se_hw_init(struct ieee80211_hw *hw) |
1280 |
+ |
1281 |
+ if (rtl92s_phy_rf_config(hw) != true) { |
1282 |
+ RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("RF Config failed\n")); |
1283 |
+- return rtstatus; |
1284 |
++ err = rtstatus; |
1285 |
++ goto exit; |
1286 |
+ } |
1287 |
+ |
1288 |
+ /* After read predefined TXT, we must set BB/MAC/RF |
1289 |
+@@ -1089,8 +1102,9 @@ int rtl92se_hw_init(struct ieee80211_hw *hw) |
1290 |
+ |
1291 |
+ rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_ON); |
1292 |
+ rtl92s_dm_init(hw); |
1293 |
++exit: |
1294 |
++ local_irq_restore(flags); |
1295 |
+ rtlpci->being_init_adapter = false; |
1296 |
+- |
1297 |
+ return err; |
1298 |
+ } |
1299 |
+ |
1300 |
+diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c |
1301 |
+index 9a4626c35f5a..b2528f638031 100644 |
1302 |
+--- a/drivers/net/xen-netback/netback.c |
1303 |
++++ b/drivers/net/xen-netback/netback.c |
1304 |
+@@ -346,8 +346,8 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head) |
1305 |
+ * into multiple copies tend to give large frags their |
1306 |
+ * own buffers as before. |
1307 |
+ */ |
1308 |
+- if ((offset + size > MAX_BUFFER_OFFSET) && |
1309 |
+- (size <= MAX_BUFFER_OFFSET) && offset && !head) |
1310 |
++ BUG_ON(size > MAX_BUFFER_OFFSET); |
1311 |
++ if ((offset + size > MAX_BUFFER_OFFSET) && offset && !head) |
1312 |
+ return true; |
1313 |
+ |
1314 |
+ return false; |
1315 |
+diff --git a/drivers/scsi/isci/port_config.c b/drivers/scsi/isci/port_config.c |
1316 |
+index 21a676931a27..38a99d281141 100644 |
1317 |
+--- a/drivers/scsi/isci/port_config.c |
1318 |
++++ b/drivers/scsi/isci/port_config.c |
1319 |
+@@ -610,6 +610,13 @@ static void sci_apc_agent_link_up(struct isci_host *ihost, |
1320 |
+ sci_apc_agent_configure_ports(ihost, port_agent, iphy, true); |
1321 |
+ } else { |
1322 |
+ /* the phy is already the part of the port */ |
1323 |
++ u32 port_state = iport->sm.current_state_id; |
1324 |
++ |
1325 |
++ /* if the PORT'S state is resetting then the link up is from |
1326 |
++ * port hard reset in this case, we need to tell the port |
1327 |
++ * that link up is recieved |
1328 |
++ */ |
1329 |
++ BUG_ON(port_state != SCI_PORT_RESETTING); |
1330 |
+ port_agent->phy_ready_mask |= 1 << phy_index; |
1331 |
+ sci_port_link_up(iport, iphy); |
1332 |
+ } |
1333 |
+diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c |
1334 |
+index 60a530fd5f03..e294d118d89c 100644 |
1335 |
+--- a/drivers/scsi/isci/task.c |
1336 |
++++ b/drivers/scsi/isci/task.c |
1337 |
+@@ -1390,7 +1390,7 @@ int isci_task_I_T_nexus_reset(struct domain_device *dev) |
1338 |
+ spin_unlock_irqrestore(&ihost->scic_lock, flags); |
1339 |
+ |
1340 |
+ if (!idev || !test_bit(IDEV_EH, &idev->flags)) { |
1341 |
+- ret = -ENODEV; |
1342 |
++ ret = TMF_RESP_FUNC_COMPLETE; |
1343 |
+ goto out; |
1344 |
+ } |
1345 |
+ |
1346 |
+diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c |
1347 |
+index c44e41af2880..c2731cafb473 100644 |
1348 |
+--- a/drivers/staging/serqt_usb2/serqt_usb2.c |
1349 |
++++ b/drivers/staging/serqt_usb2/serqt_usb2.c |
1350 |
+@@ -772,7 +772,7 @@ static int qt_startup(struct usb_serial *serial) |
1351 |
+ goto startup_error; |
1352 |
+ } |
1353 |
+ |
1354 |
+- switch (serial->dev->descriptor.idProduct) { |
1355 |
++ switch (le16_to_cpu(serial->dev->descriptor.idProduct)) { |
1356 |
+ case QUATECH_DSU100: |
1357 |
+ case QUATECH_QSU100: |
1358 |
+ case QUATECH_ESU100A: |
1359 |
+diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
1360 |
+index 4a88eea158ab..ab5dd1655c14 100644 |
1361 |
+--- a/drivers/target/iscsi/iscsi_target.c |
1362 |
++++ b/drivers/target/iscsi/iscsi_target.c |
1363 |
+@@ -2358,6 +2358,7 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn) |
1364 |
+ { |
1365 |
+ struct iscsi_cmd *cmd; |
1366 |
+ struct iscsi_conn *conn_p; |
1367 |
++ bool found = false; |
1368 |
+ |
1369 |
+ /* |
1370 |
+ * Only send a Asynchronous Message on connections whos network |
1371 |
+@@ -2366,11 +2367,12 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn) |
1372 |
+ list_for_each_entry(conn_p, &conn->sess->sess_conn_list, conn_list) { |
1373 |
+ if (conn_p->conn_state == TARG_CONN_STATE_LOGGED_IN) { |
1374 |
+ iscsit_inc_conn_usage_count(conn_p); |
1375 |
++ found = true; |
1376 |
+ break; |
1377 |
+ } |
1378 |
+ } |
1379 |
+ |
1380 |
+- if (!conn_p) |
1381 |
++ if (!found) |
1382 |
+ return; |
1383 |
+ |
1384 |
+ cmd = iscsit_allocate_cmd(conn_p, GFP_ATOMIC); |
1385 |
+diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c |
1386 |
+index ab0a3fa634ac..b3280114659c 100644 |
1387 |
+--- a/drivers/target/tcm_fc/tfc_sess.c |
1388 |
++++ b/drivers/target/tcm_fc/tfc_sess.c |
1389 |
+@@ -72,6 +72,7 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport) |
1390 |
+ |
1391 |
+ if (tport) { |
1392 |
+ tport->tpg = tpg; |
1393 |
++ tpg->tport = tport; |
1394 |
+ return tport; |
1395 |
+ } |
1396 |
+ |
1397 |
+diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c |
1398 |
+index b6b2d18fa38d..7b97e7e3ede4 100644 |
1399 |
+--- a/drivers/tty/hvc/hvc_console.c |
1400 |
++++ b/drivers/tty/hvc/hvc_console.c |
1401 |
+@@ -31,6 +31,7 @@ |
1402 |
+ #include <linux/list.h> |
1403 |
+ #include <linux/module.h> |
1404 |
+ #include <linux/major.h> |
1405 |
++#include <linux/atomic.h> |
1406 |
+ #include <linux/sysrq.h> |
1407 |
+ #include <linux/tty.h> |
1408 |
+ #include <linux/tty_flip.h> |
1409 |
+@@ -70,6 +71,9 @@ static struct task_struct *hvc_task; |
1410 |
+ /* Picks up late kicks after list walk but before schedule() */ |
1411 |
+ static int hvc_kicked; |
1412 |
+ |
1413 |
++/* hvc_init is triggered from hvc_alloc, i.e. only when actually used */ |
1414 |
++static atomic_t hvc_needs_init __read_mostly = ATOMIC_INIT(-1); |
1415 |
++ |
1416 |
+ static int hvc_init(void); |
1417 |
+ |
1418 |
+ #ifdef CONFIG_MAGIC_SYSRQ |
1419 |
+@@ -825,7 +829,7 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data, |
1420 |
+ int i; |
1421 |
+ |
1422 |
+ /* We wait until a driver actually comes along */ |
1423 |
+- if (!hvc_driver) { |
1424 |
++ if (atomic_inc_not_zero(&hvc_needs_init)) { |
1425 |
+ int err = hvc_init(); |
1426 |
+ if (err) |
1427 |
+ return ERR_PTR(err); |
1428 |
+diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
1429 |
+index 3f35e42cd120..446df6b39d30 100644 |
1430 |
+--- a/drivers/tty/tty_io.c |
1431 |
++++ b/drivers/tty/tty_io.c |
1432 |
+@@ -1222,9 +1222,9 @@ static void pty_line_name(struct tty_driver *driver, int index, char *p) |
1433 |
+ * |
1434 |
+ * Locking: None |
1435 |
+ */ |
1436 |
+-static void tty_line_name(struct tty_driver *driver, int index, char *p) |
1437 |
++static ssize_t tty_line_name(struct tty_driver *driver, int index, char *p) |
1438 |
+ { |
1439 |
+- sprintf(p, "%s%d", driver->name, index + driver->name_base); |
1440 |
++ return sprintf(p, "%s%d", driver->name, index + driver->name_base); |
1441 |
+ } |
1442 |
+ |
1443 |
+ /** |
1444 |
+@@ -3321,9 +3321,19 @@ static ssize_t show_cons_active(struct device *dev, |
1445 |
+ if (i >= ARRAY_SIZE(cs)) |
1446 |
+ break; |
1447 |
+ } |
1448 |
+- while (i--) |
1449 |
+- count += sprintf(buf + count, "%s%d%c", |
1450 |
+- cs[i]->name, cs[i]->index, i ? ' ':'\n'); |
1451 |
++ while (i--) { |
1452 |
++ int index = cs[i]->index; |
1453 |
++ struct tty_driver *drv = cs[i]->device(cs[i], &index); |
1454 |
++ |
1455 |
++ /* don't resolve tty0 as some programs depend on it */ |
1456 |
++ if (drv && (cs[i]->index > 0 || drv->major != TTY_MAJOR)) |
1457 |
++ count += tty_line_name(drv, index, buf + count); |
1458 |
++ else |
1459 |
++ count += sprintf(buf + count, "%s%d", |
1460 |
++ cs[i]->name, cs[i]->index); |
1461 |
++ |
1462 |
++ count += sprintf(buf + count, "%c", i ? ' ':'\n'); |
1463 |
++ } |
1464 |
+ console_unlock(); |
1465 |
+ |
1466 |
+ return count; |
1467 |
+diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h |
1468 |
+index 4795c0c9a6eb..ae2b763650d8 100644 |
1469 |
+--- a/drivers/usb/dwc3/core.h |
1470 |
++++ b/drivers/usb/dwc3/core.h |
1471 |
+@@ -716,15 +716,15 @@ struct dwc3_event_depevt { |
1472 |
+ * 12 - VndrDevTstRcved |
1473 |
+ * @reserved15_12: Reserved, not used |
1474 |
+ * @event_info: Information about this event |
1475 |
+- * @reserved31_24: Reserved, not used |
1476 |
++ * @reserved31_25: Reserved, not used |
1477 |
+ */ |
1478 |
+ struct dwc3_event_devt { |
1479 |
+ u32 one_bit:1; |
1480 |
+ u32 device_event:7; |
1481 |
+ u32 type:4; |
1482 |
+ u32 reserved15_12:4; |
1483 |
+- u32 event_info:8; |
1484 |
+- u32 reserved31_24:8; |
1485 |
++ u32 event_info:9; |
1486 |
++ u32 reserved31_25:7; |
1487 |
+ } __packed; |
1488 |
+ |
1489 |
+ /** |
1490 |
+diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c |
1491 |
+index 271a9d873608..b299c328f51a 100644 |
1492 |
+--- a/drivers/usb/gadget/atmel_usba_udc.c |
1493 |
++++ b/drivers/usb/gadget/atmel_usba_udc.c |
1494 |
+@@ -1875,12 +1875,13 @@ static int atmel_usba_stop(struct usb_gadget_driver *driver) |
1495 |
+ |
1496 |
+ driver->unbind(&udc->gadget); |
1497 |
+ udc->gadget.dev.driver = NULL; |
1498 |
+- udc->driver = NULL; |
1499 |
+ |
1500 |
+ clk_disable(udc->hclk); |
1501 |
+ clk_disable(udc->pclk); |
1502 |
+ |
1503 |
+- DBG(DBG_GADGET, "unregistered driver `%s'\n", driver->driver.name); |
1504 |
++ DBG(DBG_GADGET, "unregistered driver `%s'\n", udc->driver->driver.name); |
1505 |
++ |
1506 |
++ udc->driver = NULL; |
1507 |
+ |
1508 |
+ return 0; |
1509 |
+ } |
1510 |
+diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c |
1511 |
+index 5c5812860ec9..7ef84c11453d 100644 |
1512 |
+--- a/drivers/vhost/net.c |
1513 |
++++ b/drivers/vhost/net.c |
1514 |
+@@ -319,9 +319,13 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, |
1515 |
+ r = -ENOBUFS; |
1516 |
+ goto err; |
1517 |
+ } |
1518 |
+- d = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg, |
1519 |
++ r = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg, |
1520 |
+ ARRAY_SIZE(vq->iov) - seg, &out, |
1521 |
+ &in, log, log_num); |
1522 |
++ if (unlikely(r < 0)) |
1523 |
++ goto err; |
1524 |
++ |
1525 |
++ d = r; |
1526 |
+ if (d == vq->num) { |
1527 |
+ r = 0; |
1528 |
+ goto err; |
1529 |
+@@ -346,6 +350,12 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, |
1530 |
+ *iovcount = seg; |
1531 |
+ if (unlikely(log)) |
1532 |
+ *log_num = nlogs; |
1533 |
++ |
1534 |
++ /* Detect overrun */ |
1535 |
++ if (unlikely(datalen > 0)) { |
1536 |
++ r = UIO_MAXIOV + 1; |
1537 |
++ goto err; |
1538 |
++ } |
1539 |
+ return headcount; |
1540 |
+ err: |
1541 |
+ vhost_discard_vq_desc(vq, headcount); |
1542 |
+@@ -400,6 +410,14 @@ static void handle_rx(struct vhost_net *net) |
1543 |
+ /* On error, stop handling until the next kick. */ |
1544 |
+ if (unlikely(headcount < 0)) |
1545 |
+ break; |
1546 |
++ /* On overrun, truncate and discard */ |
1547 |
++ if (unlikely(headcount > UIO_MAXIOV)) { |
1548 |
++ msg.msg_iovlen = 1; |
1549 |
++ err = sock->ops->recvmsg(NULL, sock, &msg, |
1550 |
++ 1, MSG_DONTWAIT | MSG_TRUNC); |
1551 |
++ pr_debug("Discarded rx packet: len %zd\n", sock_len); |
1552 |
++ continue; |
1553 |
++ } |
1554 |
+ /* OK, now we need to know about added descriptors. */ |
1555 |
+ if (!headcount) { |
1556 |
+ if (unlikely(vhost_enable_notify(&net->dev, vq))) { |
1557 |
+diff --git a/drivers/video/aty/mach64_accel.c b/drivers/video/aty/mach64_accel.c |
1558 |
+index e45833ce975b..182bd680141f 100644 |
1559 |
+--- a/drivers/video/aty/mach64_accel.c |
1560 |
++++ b/drivers/video/aty/mach64_accel.c |
1561 |
+@@ -4,6 +4,7 @@ |
1562 |
+ */ |
1563 |
+ |
1564 |
+ #include <linux/delay.h> |
1565 |
++#include <asm/unaligned.h> |
1566 |
+ #include <linux/fb.h> |
1567 |
+ #include <video/mach64.h> |
1568 |
+ #include "atyfb.h" |
1569 |
+@@ -419,7 +420,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
1570 |
+ u32 *pbitmap, dwords = (src_bytes + 3) / 4; |
1571 |
+ for (pbitmap = (u32*)(image->data); dwords; dwords--, pbitmap++) { |
1572 |
+ wait_for_fifo(1, par); |
1573 |
+- aty_st_le32(HOST_DATA0, le32_to_cpup(pbitmap), par); |
1574 |
++ aty_st_le32(HOST_DATA0, get_unaligned_le32(pbitmap), par); |
1575 |
+ } |
1576 |
+ } |
1577 |
+ |
1578 |
+diff --git a/drivers/video/aty/mach64_cursor.c b/drivers/video/aty/mach64_cursor.c |
1579 |
+index 46f72ed53510..4b87318dcf44 100644 |
1580 |
+--- a/drivers/video/aty/mach64_cursor.c |
1581 |
++++ b/drivers/video/aty/mach64_cursor.c |
1582 |
+@@ -5,6 +5,7 @@ |
1583 |
+ #include <linux/fb.h> |
1584 |
+ #include <linux/init.h> |
1585 |
+ #include <linux/string.h> |
1586 |
++#include "../fb_draw.h" |
1587 |
+ |
1588 |
+ #include <asm/io.h> |
1589 |
+ |
1590 |
+@@ -157,24 +158,33 @@ static int atyfb_cursor(struct fb_info *info, struct fb_cursor *cursor) |
1591 |
+ |
1592 |
+ for (i = 0; i < height; i++) { |
1593 |
+ for (j = 0; j < width; j++) { |
1594 |
++ u16 l = 0xaaaa; |
1595 |
+ b = *src++; |
1596 |
+ m = *msk++; |
1597 |
+ switch (cursor->rop) { |
1598 |
+ case ROP_XOR: |
1599 |
+ // Upper 4 bits of mask data |
1600 |
+- fb_writeb(cursor_bits_lookup[(b ^ m) >> 4], dst++); |
1601 |
++ l = cursor_bits_lookup[(b ^ m) >> 4] | |
1602 |
+ // Lower 4 bits of mask |
1603 |
+- fb_writeb(cursor_bits_lookup[(b ^ m) & 0x0f], |
1604 |
+- dst++); |
1605 |
++ (cursor_bits_lookup[(b ^ m) & 0x0f] << 8); |
1606 |
+ break; |
1607 |
+ case ROP_COPY: |
1608 |
+ // Upper 4 bits of mask data |
1609 |
+- fb_writeb(cursor_bits_lookup[(b & m) >> 4], dst++); |
1610 |
++ l = cursor_bits_lookup[(b & m) >> 4] | |
1611 |
+ // Lower 4 bits of mask |
1612 |
+- fb_writeb(cursor_bits_lookup[(b & m) & 0x0f], |
1613 |
+- dst++); |
1614 |
++ (cursor_bits_lookup[(b & m) & 0x0f] << 8); |
1615 |
+ break; |
1616 |
+ } |
1617 |
++ /* |
1618 |
++ * If cursor size is not a multiple of 8 characters |
1619 |
++ * we must pad it with transparent pattern (0xaaaa). |
1620 |
++ */ |
1621 |
++ if ((j + 1) * 8 > cursor->image.width) { |
1622 |
++ l = comp(l, 0xaaaa, |
1623 |
++ (1 << ((cursor->image.width & 7) * 2)) - 1); |
1624 |
++ } |
1625 |
++ fb_writeb(l & 0xff, dst++); |
1626 |
++ fb_writeb(l >> 8, dst++); |
1627 |
+ } |
1628 |
+ dst += offset; |
1629 |
+ } |
1630 |
+diff --git a/drivers/video/cfbcopyarea.c b/drivers/video/cfbcopyarea.c |
1631 |
+index bb5a96b1645d..bcb57235fcc7 100644 |
1632 |
+--- a/drivers/video/cfbcopyarea.c |
1633 |
++++ b/drivers/video/cfbcopyarea.c |
1634 |
+@@ -43,13 +43,22 @@ |
1635 |
+ */ |
1636 |
+ |
1637 |
+ static void |
1638 |
+-bitcpy(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
1639 |
+- const unsigned long __iomem *src, int src_idx, int bits, |
1640 |
++bitcpy(struct fb_info *p, unsigned long __iomem *dst, unsigned dst_idx, |
1641 |
++ const unsigned long __iomem *src, unsigned src_idx, int bits, |
1642 |
+ unsigned n, u32 bswapmask) |
1643 |
+ { |
1644 |
+ unsigned long first, last; |
1645 |
+ int const shift = dst_idx-src_idx; |
1646 |
+- int left, right; |
1647 |
++ |
1648 |
++#if 0 |
1649 |
++ /* |
1650 |
++ * If you suspect bug in this function, compare it with this simple |
1651 |
++ * memmove implementation. |
1652 |
++ */ |
1653 |
++ fb_memmove((char *)dst + ((dst_idx & (bits - 1))) / 8, |
1654 |
++ (char *)src + ((src_idx & (bits - 1))) / 8, n / 8); |
1655 |
++ return; |
1656 |
++#endif |
1657 |
+ |
1658 |
+ first = fb_shifted_pixels_mask_long(p, dst_idx, bswapmask); |
1659 |
+ last = ~fb_shifted_pixels_mask_long(p, (dst_idx+n) % bits, bswapmask); |
1660 |
+@@ -98,9 +107,8 @@ bitcpy(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
1661 |
+ unsigned long d0, d1; |
1662 |
+ int m; |
1663 |
+ |
1664 |
+- right = shift & (bits - 1); |
1665 |
+- left = -shift & (bits - 1); |
1666 |
+- bswapmask &= shift; |
1667 |
++ int const left = shift & (bits - 1); |
1668 |
++ int const right = -shift & (bits - 1); |
1669 |
+ |
1670 |
+ if (dst_idx+n <= bits) { |
1671 |
+ // Single destination word |
1672 |
+@@ -110,15 +118,15 @@ bitcpy(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
1673 |
+ d0 = fb_rev_pixels_in_long(d0, bswapmask); |
1674 |
+ if (shift > 0) { |
1675 |
+ // Single source word |
1676 |
+- d0 >>= right; |
1677 |
++ d0 <<= left; |
1678 |
+ } else if (src_idx+n <= bits) { |
1679 |
+ // Single source word |
1680 |
+- d0 <<= left; |
1681 |
++ d0 >>= right; |
1682 |
+ } else { |
1683 |
+ // 2 source words |
1684 |
+ d1 = FB_READL(src + 1); |
1685 |
+ d1 = fb_rev_pixels_in_long(d1, bswapmask); |
1686 |
+- d0 = d0<<left | d1>>right; |
1687 |
++ d0 = d0 >> right | d1 << left; |
1688 |
+ } |
1689 |
+ d0 = fb_rev_pixels_in_long(d0, bswapmask); |
1690 |
+ FB_WRITEL(comp(d0, FB_READL(dst), first), dst); |
1691 |
+@@ -135,60 +143,59 @@ bitcpy(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
1692 |
+ if (shift > 0) { |
1693 |
+ // Single source word |
1694 |
+ d1 = d0; |
1695 |
+- d0 >>= right; |
1696 |
+- dst++; |
1697 |
++ d0 <<= left; |
1698 |
+ n -= bits - dst_idx; |
1699 |
+ } else { |
1700 |
+ // 2 source words |
1701 |
+ d1 = FB_READL(src++); |
1702 |
+ d1 = fb_rev_pixels_in_long(d1, bswapmask); |
1703 |
+ |
1704 |
+- d0 = d0<<left | d1>>right; |
1705 |
+- dst++; |
1706 |
++ d0 = d0 >> right | d1 << left; |
1707 |
+ n -= bits - dst_idx; |
1708 |
+ } |
1709 |
+ d0 = fb_rev_pixels_in_long(d0, bswapmask); |
1710 |
+ FB_WRITEL(comp(d0, FB_READL(dst), first), dst); |
1711 |
+ d0 = d1; |
1712 |
++ dst++; |
1713 |
+ |
1714 |
+ // Main chunk |
1715 |
+ m = n % bits; |
1716 |
+ n /= bits; |
1717 |
+ while ((n >= 4) && !bswapmask) { |
1718 |
+ d1 = FB_READL(src++); |
1719 |
+- FB_WRITEL(d0 << left | d1 >> right, dst++); |
1720 |
++ FB_WRITEL(d0 >> right | d1 << left, dst++); |
1721 |
+ d0 = d1; |
1722 |
+ d1 = FB_READL(src++); |
1723 |
+- FB_WRITEL(d0 << left | d1 >> right, dst++); |
1724 |
++ FB_WRITEL(d0 >> right | d1 << left, dst++); |
1725 |
+ d0 = d1; |
1726 |
+ d1 = FB_READL(src++); |
1727 |
+- FB_WRITEL(d0 << left | d1 >> right, dst++); |
1728 |
++ FB_WRITEL(d0 >> right | d1 << left, dst++); |
1729 |
+ d0 = d1; |
1730 |
+ d1 = FB_READL(src++); |
1731 |
+- FB_WRITEL(d0 << left | d1 >> right, dst++); |
1732 |
++ FB_WRITEL(d0 >> right | d1 << left, dst++); |
1733 |
+ d0 = d1; |
1734 |
+ n -= 4; |
1735 |
+ } |
1736 |
+ while (n--) { |
1737 |
+ d1 = FB_READL(src++); |
1738 |
+ d1 = fb_rev_pixels_in_long(d1, bswapmask); |
1739 |
+- d0 = d0 << left | d1 >> right; |
1740 |
++ d0 = d0 >> right | d1 << left; |
1741 |
+ d0 = fb_rev_pixels_in_long(d0, bswapmask); |
1742 |
+ FB_WRITEL(d0, dst++); |
1743 |
+ d0 = d1; |
1744 |
+ } |
1745 |
+ |
1746 |
+ // Trailing bits |
1747 |
+- if (last) { |
1748 |
+- if (m <= right) { |
1749 |
++ if (m) { |
1750 |
++ if (m <= bits - right) { |
1751 |
+ // Single source word |
1752 |
+- d0 <<= left; |
1753 |
++ d0 >>= right; |
1754 |
+ } else { |
1755 |
+ // 2 source words |
1756 |
+ d1 = FB_READL(src); |
1757 |
+ d1 = fb_rev_pixels_in_long(d1, |
1758 |
+ bswapmask); |
1759 |
+- d0 = d0<<left | d1>>right; |
1760 |
++ d0 = d0 >> right | d1 << left; |
1761 |
+ } |
1762 |
+ d0 = fb_rev_pixels_in_long(d0, bswapmask); |
1763 |
+ FB_WRITEL(comp(d0, FB_READL(dst), last), dst); |
1764 |
+@@ -202,43 +209,46 @@ bitcpy(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
1765 |
+ */ |
1766 |
+ |
1767 |
+ static void |
1768 |
+-bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
1769 |
+- const unsigned long __iomem *src, int src_idx, int bits, |
1770 |
++bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, unsigned dst_idx, |
1771 |
++ const unsigned long __iomem *src, unsigned src_idx, int bits, |
1772 |
+ unsigned n, u32 bswapmask) |
1773 |
+ { |
1774 |
+ unsigned long first, last; |
1775 |
+ int shift; |
1776 |
+ |
1777 |
+- dst += (n-1)/bits; |
1778 |
+- src += (n-1)/bits; |
1779 |
+- if ((n-1) % bits) { |
1780 |
+- dst_idx += (n-1) % bits; |
1781 |
+- dst += dst_idx >> (ffs(bits) - 1); |
1782 |
+- dst_idx &= bits - 1; |
1783 |
+- src_idx += (n-1) % bits; |
1784 |
+- src += src_idx >> (ffs(bits) - 1); |
1785 |
+- src_idx &= bits - 1; |
1786 |
+- } |
1787 |
++#if 0 |
1788 |
++ /* |
1789 |
++ * If you suspect bug in this function, compare it with this simple |
1790 |
++ * memmove implementation. |
1791 |
++ */ |
1792 |
++ fb_memmove((char *)dst + ((dst_idx & (bits - 1))) / 8, |
1793 |
++ (char *)src + ((src_idx & (bits - 1))) / 8, n / 8); |
1794 |
++ return; |
1795 |
++#endif |
1796 |
++ |
1797 |
++ dst += (dst_idx + n - 1) / bits; |
1798 |
++ src += (src_idx + n - 1) / bits; |
1799 |
++ dst_idx = (dst_idx + n - 1) % bits; |
1800 |
++ src_idx = (src_idx + n - 1) % bits; |
1801 |
+ |
1802 |
+ shift = dst_idx-src_idx; |
1803 |
+ |
1804 |
+- first = fb_shifted_pixels_mask_long(p, bits - 1 - dst_idx, bswapmask); |
1805 |
+- last = ~fb_shifted_pixels_mask_long(p, bits - 1 - ((dst_idx-n) % bits), |
1806 |
+- bswapmask); |
1807 |
++ first = ~fb_shifted_pixels_mask_long(p, (dst_idx + 1) % bits, bswapmask); |
1808 |
++ last = fb_shifted_pixels_mask_long(p, (bits + dst_idx + 1 - n) % bits, bswapmask); |
1809 |
+ |
1810 |
+ if (!shift) { |
1811 |
+ // Same alignment for source and dest |
1812 |
+ |
1813 |
+ if ((unsigned long)dst_idx+1 >= n) { |
1814 |
+ // Single word |
1815 |
+- if (last) |
1816 |
+- first &= last; |
1817 |
+- FB_WRITEL( comp( FB_READL(src), FB_READL(dst), first), dst); |
1818 |
++ if (first) |
1819 |
++ last &= first; |
1820 |
++ FB_WRITEL( comp( FB_READL(src), FB_READL(dst), last), dst); |
1821 |
+ } else { |
1822 |
+ // Multiple destination words |
1823 |
+ |
1824 |
+ // Leading bits |
1825 |
+- if (first != ~0UL) { |
1826 |
++ if (first) { |
1827 |
+ FB_WRITEL( comp( FB_READL(src), FB_READL(dst), first), dst); |
1828 |
+ dst--; |
1829 |
+ src--; |
1830 |
+@@ -262,7 +272,7 @@ bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
1831 |
+ FB_WRITEL(FB_READL(src--), dst--); |
1832 |
+ |
1833 |
+ // Trailing bits |
1834 |
+- if (last) |
1835 |
++ if (last != -1UL) |
1836 |
+ FB_WRITEL( comp( FB_READL(src), FB_READL(dst), last), dst); |
1837 |
+ } |
1838 |
+ } else { |
1839 |
+@@ -270,29 +280,28 @@ bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
1840 |
+ unsigned long d0, d1; |
1841 |
+ int m; |
1842 |
+ |
1843 |
+- int const left = -shift & (bits-1); |
1844 |
+- int const right = shift & (bits-1); |
1845 |
+- bswapmask &= shift; |
1846 |
++ int const left = shift & (bits-1); |
1847 |
++ int const right = -shift & (bits-1); |
1848 |
+ |
1849 |
+ if ((unsigned long)dst_idx+1 >= n) { |
1850 |
+ // Single destination word |
1851 |
+- if (last) |
1852 |
+- first &= last; |
1853 |
++ if (first) |
1854 |
++ last &= first; |
1855 |
+ d0 = FB_READL(src); |
1856 |
+ if (shift < 0) { |
1857 |
+ // Single source word |
1858 |
+- d0 <<= left; |
1859 |
++ d0 >>= right; |
1860 |
+ } else if (1+(unsigned long)src_idx >= n) { |
1861 |
+ // Single source word |
1862 |
+- d0 >>= right; |
1863 |
++ d0 <<= left; |
1864 |
+ } else { |
1865 |
+ // 2 source words |
1866 |
+ d1 = FB_READL(src - 1); |
1867 |
+ d1 = fb_rev_pixels_in_long(d1, bswapmask); |
1868 |
+- d0 = d0>>right | d1<<left; |
1869 |
++ d0 = d0 << left | d1 >> right; |
1870 |
+ } |
1871 |
+ d0 = fb_rev_pixels_in_long(d0, bswapmask); |
1872 |
+- FB_WRITEL(comp(d0, FB_READL(dst), first), dst); |
1873 |
++ FB_WRITEL(comp(d0, FB_READL(dst), last), dst); |
1874 |
+ } else { |
1875 |
+ // Multiple destination words |
1876 |
+ /** We must always remember the last value read, because in case |
1877 |
+@@ -307,12 +316,12 @@ bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
1878 |
+ if (shift < 0) { |
1879 |
+ // Single source word |
1880 |
+ d1 = d0; |
1881 |
+- d0 <<= left; |
1882 |
++ d0 >>= right; |
1883 |
+ } else { |
1884 |
+ // 2 source words |
1885 |
+ d1 = FB_READL(src--); |
1886 |
+ d1 = fb_rev_pixels_in_long(d1, bswapmask); |
1887 |
+- d0 = d0>>right | d1<<left; |
1888 |
++ d0 = d0 << left | d1 >> right; |
1889 |
+ } |
1890 |
+ d0 = fb_rev_pixels_in_long(d0, bswapmask); |
1891 |
+ FB_WRITEL(comp(d0, FB_READL(dst), first), dst); |
1892 |
+@@ -325,39 +334,39 @@ bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
1893 |
+ n /= bits; |
1894 |
+ while ((n >= 4) && !bswapmask) { |
1895 |
+ d1 = FB_READL(src--); |
1896 |
+- FB_WRITEL(d0 >> right | d1 << left, dst--); |
1897 |
++ FB_WRITEL(d0 << left | d1 >> right, dst--); |
1898 |
+ d0 = d1; |
1899 |
+ d1 = FB_READL(src--); |
1900 |
+- FB_WRITEL(d0 >> right | d1 << left, dst--); |
1901 |
++ FB_WRITEL(d0 << left | d1 >> right, dst--); |
1902 |
+ d0 = d1; |
1903 |
+ d1 = FB_READL(src--); |
1904 |
+- FB_WRITEL(d0 >> right | d1 << left, dst--); |
1905 |
++ FB_WRITEL(d0 << left | d1 >> right, dst--); |
1906 |
+ d0 = d1; |
1907 |
+ d1 = FB_READL(src--); |
1908 |
+- FB_WRITEL(d0 >> right | d1 << left, dst--); |
1909 |
++ FB_WRITEL(d0 << left | d1 >> right, dst--); |
1910 |
+ d0 = d1; |
1911 |
+ n -= 4; |
1912 |
+ } |
1913 |
+ while (n--) { |
1914 |
+ d1 = FB_READL(src--); |
1915 |
+ d1 = fb_rev_pixels_in_long(d1, bswapmask); |
1916 |
+- d0 = d0 >> right | d1 << left; |
1917 |
++ d0 = d0 << left | d1 >> right; |
1918 |
+ d0 = fb_rev_pixels_in_long(d0, bswapmask); |
1919 |
+ FB_WRITEL(d0, dst--); |
1920 |
+ d0 = d1; |
1921 |
+ } |
1922 |
+ |
1923 |
+ // Trailing bits |
1924 |
+- if (last) { |
1925 |
+- if (m <= left) { |
1926 |
++ if (m) { |
1927 |
++ if (m <= bits - left) { |
1928 |
+ // Single source word |
1929 |
+- d0 >>= right; |
1930 |
++ d0 <<= left; |
1931 |
+ } else { |
1932 |
+ // 2 source words |
1933 |
+ d1 = FB_READL(src); |
1934 |
+ d1 = fb_rev_pixels_in_long(d1, |
1935 |
+ bswapmask); |
1936 |
+- d0 = d0>>right | d1<<left; |
1937 |
++ d0 = d0 << left | d1 >> right; |
1938 |
+ } |
1939 |
+ d0 = fb_rev_pixels_in_long(d0, bswapmask); |
1940 |
+ FB_WRITEL(comp(d0, FB_READL(dst), last), dst); |
1941 |
+@@ -371,9 +380,9 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) |
1942 |
+ u32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy; |
1943 |
+ u32 height = area->height, width = area->width; |
1944 |
+ unsigned long const bits_per_line = p->fix.line_length*8u; |
1945 |
+- unsigned long __iomem *dst = NULL, *src = NULL; |
1946 |
++ unsigned long __iomem *base = NULL; |
1947 |
+ int bits = BITS_PER_LONG, bytes = bits >> 3; |
1948 |
+- int dst_idx = 0, src_idx = 0, rev_copy = 0; |
1949 |
++ unsigned dst_idx = 0, src_idx = 0, rev_copy = 0; |
1950 |
+ u32 bswapmask = fb_compute_bswapmask(p); |
1951 |
+ |
1952 |
+ if (p->state != FBINFO_STATE_RUNNING) |
1953 |
+@@ -389,7 +398,7 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) |
1954 |
+ |
1955 |
+ // split the base of the framebuffer into a long-aligned address and the |
1956 |
+ // index of the first bit |
1957 |
+- dst = src = (unsigned long __iomem *)((unsigned long)p->screen_base & ~(bytes-1)); |
1958 |
++ base = (unsigned long __iomem *)((unsigned long)p->screen_base & ~(bytes-1)); |
1959 |
+ dst_idx = src_idx = 8*((unsigned long)p->screen_base & (bytes-1)); |
1960 |
+ // add offset of source and target area |
1961 |
+ dst_idx += dy*bits_per_line + dx*p->var.bits_per_pixel; |
1962 |
+@@ -402,20 +411,14 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) |
1963 |
+ while (height--) { |
1964 |
+ dst_idx -= bits_per_line; |
1965 |
+ src_idx -= bits_per_line; |
1966 |
+- dst += dst_idx >> (ffs(bits) - 1); |
1967 |
+- dst_idx &= (bytes - 1); |
1968 |
+- src += src_idx >> (ffs(bits) - 1); |
1969 |
+- src_idx &= (bytes - 1); |
1970 |
+- bitcpy_rev(p, dst, dst_idx, src, src_idx, bits, |
1971 |
++ bitcpy_rev(p, base + (dst_idx / bits), dst_idx % bits, |
1972 |
++ base + (src_idx / bits), src_idx % bits, bits, |
1973 |
+ width*p->var.bits_per_pixel, bswapmask); |
1974 |
+ } |
1975 |
+ } else { |
1976 |
+ while (height--) { |
1977 |
+- dst += dst_idx >> (ffs(bits) - 1); |
1978 |
+- dst_idx &= (bytes - 1); |
1979 |
+- src += src_idx >> (ffs(bits) - 1); |
1980 |
+- src_idx &= (bytes - 1); |
1981 |
+- bitcpy(p, dst, dst_idx, src, src_idx, bits, |
1982 |
++ bitcpy(p, base + (dst_idx / bits), dst_idx % bits, |
1983 |
++ base + (src_idx / bits), src_idx % bits, bits, |
1984 |
+ width*p->var.bits_per_pixel, bswapmask); |
1985 |
+ dst_idx += bits_per_line; |
1986 |
+ src_idx += bits_per_line; |
1987 |
+diff --git a/drivers/video/matrox/matroxfb_accel.c b/drivers/video/matrox/matroxfb_accel.c |
1988 |
+index 8335a6fe303e..0d5cb85d071a 100644 |
1989 |
+--- a/drivers/video/matrox/matroxfb_accel.c |
1990 |
++++ b/drivers/video/matrox/matroxfb_accel.c |
1991 |
+@@ -192,10 +192,18 @@ void matrox_cfbX_init(struct matrox_fb_info *minfo) |
1992 |
+ minfo->accel.m_dwg_rect = M_DWG_TRAP | M_DWG_SOLID | M_DWG_ARZERO | M_DWG_SGNZERO | M_DWG_SHIFTZERO; |
1993 |
+ if (isMilleniumII(minfo)) minfo->accel.m_dwg_rect |= M_DWG_TRANSC; |
1994 |
+ minfo->accel.m_opmode = mopmode; |
1995 |
++ minfo->accel.m_access = maccess; |
1996 |
++ minfo->accel.m_pitch = mpitch; |
1997 |
+ } |
1998 |
+ |
1999 |
+ EXPORT_SYMBOL(matrox_cfbX_init); |
2000 |
+ |
2001 |
++static void matrox_accel_restore_maccess(struct matrox_fb_info *minfo) |
2002 |
++{ |
2003 |
++ mga_outl(M_MACCESS, minfo->accel.m_access); |
2004 |
++ mga_outl(M_PITCH, minfo->accel.m_pitch); |
2005 |
++} |
2006 |
++ |
2007 |
+ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, |
2008 |
+ int sx, int dy, int dx, int height, int width) |
2009 |
+ { |
2010 |
+@@ -207,7 +215,8 @@ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, |
2011 |
+ CRITBEGIN |
2012 |
+ |
2013 |
+ if ((dy < sy) || ((dy == sy) && (dx <= sx))) { |
2014 |
+- mga_fifo(2); |
2015 |
++ mga_fifo(4); |
2016 |
++ matrox_accel_restore_maccess(minfo); |
2017 |
+ mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO | |
2018 |
+ M_DWG_BFCOL | M_DWG_REPLACE); |
2019 |
+ mga_outl(M_AR5, vxres); |
2020 |
+@@ -215,7 +224,8 @@ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, |
2021 |
+ start = sy*vxres+sx+curr_ydstorg(minfo); |
2022 |
+ end = start+width; |
2023 |
+ } else { |
2024 |
+- mga_fifo(3); |
2025 |
++ mga_fifo(5); |
2026 |
++ matrox_accel_restore_maccess(minfo); |
2027 |
+ mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_BFCOL | M_DWG_REPLACE); |
2028 |
+ mga_outl(M_SGN, 5); |
2029 |
+ mga_outl(M_AR5, -vxres); |
2030 |
+@@ -224,7 +234,8 @@ static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy, |
2031 |
+ start = end+width; |
2032 |
+ dy += height-1; |
2033 |
+ } |
2034 |
+- mga_fifo(4); |
2035 |
++ mga_fifo(6); |
2036 |
++ matrox_accel_restore_maccess(minfo); |
2037 |
+ mga_outl(M_AR0, end); |
2038 |
+ mga_outl(M_AR3, start); |
2039 |
+ mga_outl(M_FXBNDRY, ((dx+width)<<16) | dx); |
2040 |
+@@ -246,7 +257,8 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres, |
2041 |
+ CRITBEGIN |
2042 |
+ |
2043 |
+ if ((dy < sy) || ((dy == sy) && (dx <= sx))) { |
2044 |
+- mga_fifo(2); |
2045 |
++ mga_fifo(4); |
2046 |
++ matrox_accel_restore_maccess(minfo); |
2047 |
+ mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO | |
2048 |
+ M_DWG_BFCOL | M_DWG_REPLACE); |
2049 |
+ mga_outl(M_AR5, vxres); |
2050 |
+@@ -254,7 +266,8 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres, |
2051 |
+ start = sy*vxres+sx+curr_ydstorg(minfo); |
2052 |
+ end = start+width; |
2053 |
+ } else { |
2054 |
+- mga_fifo(3); |
2055 |
++ mga_fifo(5); |
2056 |
++ matrox_accel_restore_maccess(minfo); |
2057 |
+ mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_BFCOL | M_DWG_REPLACE); |
2058 |
+ mga_outl(M_SGN, 5); |
2059 |
+ mga_outl(M_AR5, -vxres); |
2060 |
+@@ -263,7 +276,8 @@ static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres, |
2061 |
+ start = end+width; |
2062 |
+ dy += height-1; |
2063 |
+ } |
2064 |
+- mga_fifo(5); |
2065 |
++ mga_fifo(7); |
2066 |
++ matrox_accel_restore_maccess(minfo); |
2067 |
+ mga_outl(M_AR0, end); |
2068 |
+ mga_outl(M_AR3, start); |
2069 |
+ mga_outl(M_FXBNDRY, ((dx+width)<<16) | dx); |
2070 |
+@@ -298,7 +312,8 @@ static void matroxfb_accel_clear(struct matrox_fb_info *minfo, u_int32_t color, |
2071 |
+ |
2072 |
+ CRITBEGIN |
2073 |
+ |
2074 |
+- mga_fifo(5); |
2075 |
++ mga_fifo(7); |
2076 |
++ matrox_accel_restore_maccess(minfo); |
2077 |
+ mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE); |
2078 |
+ mga_outl(M_FCOL, color); |
2079 |
+ mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx); |
2080 |
+@@ -341,7 +356,8 @@ static void matroxfb_cfb4_clear(struct matrox_fb_info *minfo, u_int32_t bgx, |
2081 |
+ width >>= 1; |
2082 |
+ sx >>= 1; |
2083 |
+ if (width) { |
2084 |
+- mga_fifo(5); |
2085 |
++ mga_fifo(7); |
2086 |
++ matrox_accel_restore_maccess(minfo); |
2087 |
+ mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE2); |
2088 |
+ mga_outl(M_FCOL, bgx); |
2089 |
+ mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx); |
2090 |
+@@ -415,7 +431,8 @@ static void matroxfb_1bpp_imageblit(struct matrox_fb_info *minfo, u_int32_t fgx, |
2091 |
+ |
2092 |
+ CRITBEGIN |
2093 |
+ |
2094 |
+- mga_fifo(3); |
2095 |
++ mga_fifo(5); |
2096 |
++ matrox_accel_restore_maccess(minfo); |
2097 |
+ if (easy) |
2098 |
+ mga_outl(M_DWGCTL, M_DWG_ILOAD | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_LINEAR | M_DWG_REPLACE); |
2099 |
+ else |
2100 |
+@@ -425,7 +442,8 @@ static void matroxfb_1bpp_imageblit(struct matrox_fb_info *minfo, u_int32_t fgx, |
2101 |
+ fxbndry = ((xx + width - 1) << 16) | xx; |
2102 |
+ mmio = minfo->mmio.vbase; |
2103 |
+ |
2104 |
+- mga_fifo(6); |
2105 |
++ mga_fifo(8); |
2106 |
++ matrox_accel_restore_maccess(minfo); |
2107 |
+ mga_writel(mmio, M_FXBNDRY, fxbndry); |
2108 |
+ mga_writel(mmio, M_AR0, ar0); |
2109 |
+ mga_writel(mmio, M_AR3, 0); |
2110 |
+diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h |
2111 |
+index 11ed57bb704e..556d96ce40bf 100644 |
2112 |
+--- a/drivers/video/matrox/matroxfb_base.h |
2113 |
++++ b/drivers/video/matrox/matroxfb_base.h |
2114 |
+@@ -307,6 +307,8 @@ struct matrox_accel_data { |
2115 |
+ #endif |
2116 |
+ u_int32_t m_dwg_rect; |
2117 |
+ u_int32_t m_opmode; |
2118 |
++ u_int32_t m_access; |
2119 |
++ u_int32_t m_pitch; |
2120 |
+ }; |
2121 |
+ |
2122 |
+ struct v4l2_queryctrl; |
2123 |
+diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c |
2124 |
+index aba7686b1a32..ac2cf6dcc598 100644 |
2125 |
+--- a/drivers/video/tgafb.c |
2126 |
++++ b/drivers/video/tgafb.c |
2127 |
+@@ -1146,222 +1146,57 @@ copyarea_line_32bpp(struct fb_info *info, u32 dy, u32 sy, |
2128 |
+ __raw_writel(TGA_MODE_SBM_24BPP|TGA_MODE_SIMPLE, tga_regs+TGA_MODE_REG); |
2129 |
+ } |
2130 |
+ |
2131 |
+-/* The general case of forward copy in 8bpp mode. */ |
2132 |
++/* The (almost) general case of backward copy in 8bpp mode. */ |
2133 |
+ static inline void |
2134 |
+-copyarea_foreward_8bpp(struct fb_info *info, u32 dx, u32 dy, u32 sx, u32 sy, |
2135 |
+- u32 height, u32 width, u32 line_length) |
2136 |
++copyarea_8bpp(struct fb_info *info, u32 dx, u32 dy, u32 sx, u32 sy, |
2137 |
++ u32 height, u32 width, u32 line_length, |
2138 |
++ const struct fb_copyarea *area) |
2139 |
+ { |
2140 |
+ struct tga_par *par = (struct tga_par *) info->par; |
2141 |
+- unsigned long i, copied, left; |
2142 |
+- unsigned long dpos, spos, dalign, salign, yincr; |
2143 |
+- u32 smask_first, dmask_first, dmask_last; |
2144 |
+- int pixel_shift, need_prime, need_second; |
2145 |
+- unsigned long n64, n32, xincr_first; |
2146 |
++ unsigned i, yincr; |
2147 |
++ int depos, sepos, backward, last_step, step; |
2148 |
++ u32 mask_last; |
2149 |
++ unsigned n32; |
2150 |
+ void __iomem *tga_regs; |
2151 |
+ void __iomem *tga_fb; |
2152 |
+ |
2153 |
+- yincr = line_length; |
2154 |
+- if (dy > sy) { |
2155 |
+- dy += height - 1; |
2156 |
+- sy += height - 1; |
2157 |
+- yincr = -yincr; |
2158 |
+- } |
2159 |
+- |
2160 |
+- /* Compute the offsets and alignments in the frame buffer. |
2161 |
+- More than anything else, these control how we do copies. */ |
2162 |
+- dpos = dy * line_length + dx; |
2163 |
+- spos = sy * line_length + sx; |
2164 |
+- dalign = dpos & 7; |
2165 |
+- salign = spos & 7; |
2166 |
+- dpos &= -8; |
2167 |
+- spos &= -8; |
2168 |
+- |
2169 |
+- /* Compute the value for the PIXELSHIFT register. This controls |
2170 |
+- both non-co-aligned source and destination and copy direction. */ |
2171 |
+- if (dalign >= salign) |
2172 |
+- pixel_shift = dalign - salign; |
2173 |
+- else |
2174 |
+- pixel_shift = 8 - (salign - dalign); |
2175 |
+- |
2176 |
+- /* Figure out if we need an additional priming step for the |
2177 |
+- residue register. */ |
2178 |
+- need_prime = (salign > dalign); |
2179 |
+- if (need_prime) |
2180 |
+- dpos -= 8; |
2181 |
+- |
2182 |
+- /* Begin by copying the leading unaligned destination. Copy enough |
2183 |
+- to make the next destination address 32-byte aligned. */ |
2184 |
+- copied = 32 - (dalign + (dpos & 31)); |
2185 |
+- if (copied == 32) |
2186 |
+- copied = 0; |
2187 |
+- xincr_first = (copied + 7) & -8; |
2188 |
+- smask_first = dmask_first = (1ul << copied) - 1; |
2189 |
+- smask_first <<= salign; |
2190 |
+- dmask_first <<= dalign + need_prime*8; |
2191 |
+- if (need_prime && copied > 24) |
2192 |
+- copied -= 8; |
2193 |
+- left = width - copied; |
2194 |
+- |
2195 |
+- /* Care for small copies. */ |
2196 |
+- if (copied > width) { |
2197 |
+- u32 t; |
2198 |
+- t = (1ul << width) - 1; |
2199 |
+- t <<= dalign + need_prime*8; |
2200 |
+- dmask_first &= t; |
2201 |
+- left = 0; |
2202 |
+- } |
2203 |
+- |
2204 |
+- /* Attempt to use 64-byte copies. This is only possible if the |
2205 |
+- source and destination are co-aligned at 64 bytes. */ |
2206 |
+- n64 = need_second = 0; |
2207 |
+- if ((dpos & 63) == (spos & 63) |
2208 |
+- && (height == 1 || line_length % 64 == 0)) { |
2209 |
+- /* We may need a 32-byte copy to ensure 64 byte alignment. */ |
2210 |
+- need_second = (dpos + xincr_first) & 63; |
2211 |
+- if ((need_second & 32) != need_second) |
2212 |
+- printk(KERN_ERR "tgafb: need_second wrong\n"); |
2213 |
+- if (left >= need_second + 64) { |
2214 |
+- left -= need_second; |
2215 |
+- n64 = left / 64; |
2216 |
+- left %= 64; |
2217 |
+- } else |
2218 |
+- need_second = 0; |
2219 |
+- } |
2220 |
+- |
2221 |
+- /* Copy trailing full 32-byte sections. This will be the main |
2222 |
+- loop if the 64 byte loop can't be used. */ |
2223 |
+- n32 = left / 32; |
2224 |
+- left %= 32; |
2225 |
+- |
2226 |
+- /* Copy the trailing unaligned destination. */ |
2227 |
+- dmask_last = (1ul << left) - 1; |
2228 |
+- |
2229 |
+- tga_regs = par->tga_regs_base; |
2230 |
+- tga_fb = par->tga_fb_base; |
2231 |
+- |
2232 |
+- /* Set up the MODE and PIXELSHIFT registers. */ |
2233 |
+- __raw_writel(TGA_MODE_SBM_8BPP|TGA_MODE_COPY, tga_regs+TGA_MODE_REG); |
2234 |
+- __raw_writel(pixel_shift, tga_regs+TGA_PIXELSHIFT_REG); |
2235 |
+- wmb(); |
2236 |
+- |
2237 |
+- for (i = 0; i < height; ++i) { |
2238 |
+- unsigned long j; |
2239 |
+- void __iomem *sfb; |
2240 |
+- void __iomem *dfb; |
2241 |
+- |
2242 |
+- sfb = tga_fb + spos; |
2243 |
+- dfb = tga_fb + dpos; |
2244 |
+- if (dmask_first) { |
2245 |
+- __raw_writel(smask_first, sfb); |
2246 |
+- wmb(); |
2247 |
+- __raw_writel(dmask_first, dfb); |
2248 |
+- wmb(); |
2249 |
+- sfb += xincr_first; |
2250 |
+- dfb += xincr_first; |
2251 |
+- } |
2252 |
+- |
2253 |
+- if (need_second) { |
2254 |
+- __raw_writel(0xffffffff, sfb); |
2255 |
+- wmb(); |
2256 |
+- __raw_writel(0xffffffff, dfb); |
2257 |
+- wmb(); |
2258 |
+- sfb += 32; |
2259 |
+- dfb += 32; |
2260 |
+- } |
2261 |
+- |
2262 |
+- if (n64 && (((unsigned long)sfb | (unsigned long)dfb) & 63)) |
2263 |
+- printk(KERN_ERR |
2264 |
+- "tgafb: misaligned copy64 (s:%p, d:%p)\n", |
2265 |
+- sfb, dfb); |
2266 |
+- |
2267 |
+- for (j = 0; j < n64; ++j) { |
2268 |
+- __raw_writel(sfb - tga_fb, tga_regs+TGA_COPY64_SRC); |
2269 |
+- wmb(); |
2270 |
+- __raw_writel(dfb - tga_fb, tga_regs+TGA_COPY64_DST); |
2271 |
+- wmb(); |
2272 |
+- sfb += 64; |
2273 |
+- dfb += 64; |
2274 |
+- } |
2275 |
+- |
2276 |
+- for (j = 0; j < n32; ++j) { |
2277 |
+- __raw_writel(0xffffffff, sfb); |
2278 |
+- wmb(); |
2279 |
+- __raw_writel(0xffffffff, dfb); |
2280 |
+- wmb(); |
2281 |
+- sfb += 32; |
2282 |
+- dfb += 32; |
2283 |
+- } |
2284 |
+- |
2285 |
+- if (dmask_last) { |
2286 |
+- __raw_writel(0xffffffff, sfb); |
2287 |
+- wmb(); |
2288 |
+- __raw_writel(dmask_last, dfb); |
2289 |
+- wmb(); |
2290 |
+- } |
2291 |
+- |
2292 |
+- spos += yincr; |
2293 |
+- dpos += yincr; |
2294 |
++ /* Do acceleration only if we are aligned on 8 pixels */ |
2295 |
++ if ((dx | sx | width) & 7) { |
2296 |
++ cfb_copyarea(info, area); |
2297 |
++ return; |
2298 |
+ } |
2299 |
+ |
2300 |
+- /* Reset the MODE register to normal. */ |
2301 |
+- __raw_writel(TGA_MODE_SBM_8BPP|TGA_MODE_SIMPLE, tga_regs+TGA_MODE_REG); |
2302 |
+-} |
2303 |
+- |
2304 |
+-/* The (almost) general case of backward copy in 8bpp mode. */ |
2305 |
+-static inline void |
2306 |
+-copyarea_backward_8bpp(struct fb_info *info, u32 dx, u32 dy, u32 sx, u32 sy, |
2307 |
+- u32 height, u32 width, u32 line_length, |
2308 |
+- const struct fb_copyarea *area) |
2309 |
+-{ |
2310 |
+- struct tga_par *par = (struct tga_par *) info->par; |
2311 |
+- unsigned long i, left, yincr; |
2312 |
+- unsigned long depos, sepos, dealign, sealign; |
2313 |
+- u32 mask_first, mask_last; |
2314 |
+- unsigned long n32; |
2315 |
+- void __iomem *tga_regs; |
2316 |
+- void __iomem *tga_fb; |
2317 |
+- |
2318 |
+ yincr = line_length; |
2319 |
+ if (dy > sy) { |
2320 |
+ dy += height - 1; |
2321 |
+ sy += height - 1; |
2322 |
+ yincr = -yincr; |
2323 |
+ } |
2324 |
++ backward = dy == sy && dx > sx && dx < sx + width; |
2325 |
+ |
2326 |
+ /* Compute the offsets and alignments in the frame buffer. |
2327 |
+ More than anything else, these control how we do copies. */ |
2328 |
+- depos = dy * line_length + dx + width; |
2329 |
+- sepos = sy * line_length + sx + width; |
2330 |
+- dealign = depos & 7; |
2331 |
+- sealign = sepos & 7; |
2332 |
+- |
2333 |
+- /* ??? The documentation appears to be incorrect (or very |
2334 |
+- misleading) wrt how pixel shifting works in backward copy |
2335 |
+- mode, i.e. when PIXELSHIFT is negative. I give up for now. |
2336 |
+- Do handle the common case of co-aligned backward copies, |
2337 |
+- but frob everything else back on generic code. */ |
2338 |
+- if (dealign != sealign) { |
2339 |
+- cfb_copyarea(info, area); |
2340 |
+- return; |
2341 |
+- } |
2342 |
+- |
2343 |
+- /* We begin the copy with the trailing pixels of the |
2344 |
+- unaligned destination. */ |
2345 |
+- mask_first = (1ul << dealign) - 1; |
2346 |
+- left = width - dealign; |
2347 |
+- |
2348 |
+- /* Care for small copies. */ |
2349 |
+- if (dealign > width) { |
2350 |
+- mask_first ^= (1ul << (dealign - width)) - 1; |
2351 |
+- left = 0; |
2352 |
+- } |
2353 |
++ depos = dy * line_length + dx; |
2354 |
++ sepos = sy * line_length + sx; |
2355 |
++ if (backward) |
2356 |
++ depos += width, sepos += width; |
2357 |
+ |
2358 |
+ /* Next copy full words at a time. */ |
2359 |
+- n32 = left / 32; |
2360 |
+- left %= 32; |
2361 |
++ n32 = width / 32; |
2362 |
++ last_step = width % 32; |
2363 |
+ |
2364 |
+ /* Finally copy the unaligned head of the span. */ |
2365 |
+- mask_last = -1 << (32 - left); |
2366 |
++ mask_last = (1ul << last_step) - 1; |
2367 |
++ |
2368 |
++ if (!backward) { |
2369 |
++ step = 32; |
2370 |
++ last_step = 32; |
2371 |
++ } else { |
2372 |
++ step = -32; |
2373 |
++ last_step = -last_step; |
2374 |
++ sepos -= 32; |
2375 |
++ depos -= 32; |
2376 |
++ } |
2377 |
+ |
2378 |
+ tga_regs = par->tga_regs_base; |
2379 |
+ tga_fb = par->tga_fb_base; |
2380 |
+@@ -1378,25 +1213,33 @@ copyarea_backward_8bpp(struct fb_info *info, u32 dx, u32 dy, u32 sx, u32 sy, |
2381 |
+ |
2382 |
+ sfb = tga_fb + sepos; |
2383 |
+ dfb = tga_fb + depos; |
2384 |
+- if (mask_first) { |
2385 |
+- __raw_writel(mask_first, sfb); |
2386 |
+- wmb(); |
2387 |
+- __raw_writel(mask_first, dfb); |
2388 |
+- wmb(); |
2389 |
+- } |
2390 |
+ |
2391 |
+- for (j = 0; j < n32; ++j) { |
2392 |
+- sfb -= 32; |
2393 |
+- dfb -= 32; |
2394 |
++ for (j = 0; j < n32; j++) { |
2395 |
++ if (j < 2 && j + 1 < n32 && !backward && |
2396 |
++ !(((unsigned long)sfb | (unsigned long)dfb) & 63)) { |
2397 |
++ do { |
2398 |
++ __raw_writel(sfb - tga_fb, tga_regs+TGA_COPY64_SRC); |
2399 |
++ wmb(); |
2400 |
++ __raw_writel(dfb - tga_fb, tga_regs+TGA_COPY64_DST); |
2401 |
++ wmb(); |
2402 |
++ sfb += 64; |
2403 |
++ dfb += 64; |
2404 |
++ j += 2; |
2405 |
++ } while (j + 1 < n32); |
2406 |
++ j--; |
2407 |
++ continue; |
2408 |
++ } |
2409 |
+ __raw_writel(0xffffffff, sfb); |
2410 |
+ wmb(); |
2411 |
+ __raw_writel(0xffffffff, dfb); |
2412 |
+ wmb(); |
2413 |
++ sfb += step; |
2414 |
++ dfb += step; |
2415 |
+ } |
2416 |
+ |
2417 |
+ if (mask_last) { |
2418 |
+- sfb -= 32; |
2419 |
+- dfb -= 32; |
2420 |
++ sfb += last_step - step; |
2421 |
++ dfb += last_step - step; |
2422 |
+ __raw_writel(mask_last, sfb); |
2423 |
+ wmb(); |
2424 |
+ __raw_writel(mask_last, dfb); |
2425 |
+@@ -1457,14 +1300,9 @@ tgafb_copyarea(struct fb_info *info, const struct fb_copyarea *area) |
2426 |
+ else if (bpp == 32) |
2427 |
+ cfb_copyarea(info, area); |
2428 |
+ |
2429 |
+- /* Detect overlapping source and destination that requires |
2430 |
+- a backward copy. */ |
2431 |
+- else if (dy == sy && dx > sx && dx < sx + width) |
2432 |
+- copyarea_backward_8bpp(info, dx, dy, sx, sy, height, |
2433 |
+- width, line_length, area); |
2434 |
+ else |
2435 |
+- copyarea_foreward_8bpp(info, dx, dy, sx, sy, height, |
2436 |
+- width, line_length); |
2437 |
++ copyarea_8bpp(info, dx, dy, sx, sy, height, |
2438 |
++ width, line_length, area); |
2439 |
+ } |
2440 |
+ |
2441 |
+ |
2442 |
+diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c |
2443 |
+index 94fd738a7741..28153fb2225d 100644 |
2444 |
+--- a/drivers/virtio/virtio_balloon.c |
2445 |
++++ b/drivers/virtio/virtio_balloon.c |
2446 |
+@@ -271,6 +271,12 @@ static int balloon(void *_vballoon) |
2447 |
+ else if (diff < 0) |
2448 |
+ leak_balloon(vb, -diff); |
2449 |
+ update_balloon_size(vb); |
2450 |
++ |
2451 |
++ /* |
2452 |
++ * For large balloon changes, we could spend a lot of time |
2453 |
++ * and always have work to do. Be nice if preempt disabled. |
2454 |
++ */ |
2455 |
++ cond_resched(); |
2456 |
+ } |
2457 |
+ return 0; |
2458 |
+ } |
2459 |
+diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c |
2460 |
+index 40788c925d1c..73705aff53cb 100644 |
2461 |
+--- a/drivers/w1/w1_netlink.c |
2462 |
++++ b/drivers/w1/w1_netlink.c |
2463 |
+@@ -54,28 +54,29 @@ static void w1_send_slave(struct w1_master *dev, u64 rn) |
2464 |
+ struct w1_netlink_msg *hdr = (struct w1_netlink_msg *)(msg + 1); |
2465 |
+ struct w1_netlink_cmd *cmd = (struct w1_netlink_cmd *)(hdr + 1); |
2466 |
+ int avail; |
2467 |
++ u64 *data; |
2468 |
+ |
2469 |
+ /* update kernel slave list */ |
2470 |
+ w1_slave_found(dev, rn); |
2471 |
+ |
2472 |
+ avail = dev->priv_size - cmd->len; |
2473 |
+ |
2474 |
+- if (avail > 8) { |
2475 |
+- u64 *data = (void *)(cmd + 1) + cmd->len; |
2476 |
++ if (avail < 8) { |
2477 |
++ msg->ack++; |
2478 |
++ cn_netlink_send(msg, 0, GFP_KERNEL); |
2479 |
+ |
2480 |
+- *data = rn; |
2481 |
+- cmd->len += 8; |
2482 |
+- hdr->len += 8; |
2483 |
+- msg->len += 8; |
2484 |
+- return; |
2485 |
++ msg->len = sizeof(struct w1_netlink_msg) + |
2486 |
++ sizeof(struct w1_netlink_cmd); |
2487 |
++ hdr->len = sizeof(struct w1_netlink_cmd); |
2488 |
++ cmd->len = 0; |
2489 |
+ } |
2490 |
+ |
2491 |
+- msg->ack++; |
2492 |
+- cn_netlink_send(msg, 0, GFP_KERNEL); |
2493 |
++ data = (void *)(cmd + 1) + cmd->len; |
2494 |
+ |
2495 |
+- msg->len = sizeof(struct w1_netlink_msg) + sizeof(struct w1_netlink_cmd); |
2496 |
+- hdr->len = sizeof(struct w1_netlink_cmd); |
2497 |
+- cmd->len = 0; |
2498 |
++ *data = rn; |
2499 |
++ cmd->len += 8; |
2500 |
++ hdr->len += 8; |
2501 |
++ msg->len += 8; |
2502 |
+ } |
2503 |
+ |
2504 |
+ static int w1_process_search_command(struct w1_master *dev, struct cn_msg *msg, |
2505 |
+diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
2506 |
+index 6b2a7248ca8b..cfdf6feec104 100644 |
2507 |
+--- a/fs/btrfs/disk-io.c |
2508 |
++++ b/fs/btrfs/disk-io.c |
2509 |
+@@ -2731,6 +2731,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info) |
2510 |
+ /* send down all the barriers */ |
2511 |
+ head = &info->fs_devices->devices; |
2512 |
+ list_for_each_entry_rcu(dev, head, dev_list) { |
2513 |
++ if (dev->missing) |
2514 |
++ continue; |
2515 |
+ if (!dev->bdev) { |
2516 |
+ errors++; |
2517 |
+ continue; |
2518 |
+@@ -2745,6 +2747,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info) |
2519 |
+ |
2520 |
+ /* wait for all the barriers */ |
2521 |
+ list_for_each_entry_rcu(dev, head, dev_list) { |
2522 |
++ if (dev->missing) |
2523 |
++ continue; |
2524 |
+ if (!dev->bdev) { |
2525 |
+ errors++; |
2526 |
+ continue; |
2527 |
+diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c |
2528 |
+index 81376d94cd3c..292e847f4193 100644 |
2529 |
+--- a/fs/btrfs/transaction.c |
2530 |
++++ b/fs/btrfs/transaction.c |
2531 |
+@@ -460,7 +460,8 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, |
2532 |
+ struct btrfs_fs_info *info = root->fs_info; |
2533 |
+ int count = 0; |
2534 |
+ |
2535 |
+- if (--trans->use_count) { |
2536 |
++ if (trans->use_count > 1) { |
2537 |
++ trans->use_count--; |
2538 |
+ trans->block_rsv = trans->orig_rsv; |
2539 |
+ return 0; |
2540 |
+ } |
2541 |
+@@ -494,17 +495,10 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, |
2542 |
+ } |
2543 |
+ |
2544 |
+ if (lock && cur_trans->blocked && !cur_trans->in_commit) { |
2545 |
+- if (throttle) { |
2546 |
+- /* |
2547 |
+- * We may race with somebody else here so end up having |
2548 |
+- * to call end_transaction on ourselves again, so inc |
2549 |
+- * our use_count. |
2550 |
+- */ |
2551 |
+- trans->use_count++; |
2552 |
++ if (throttle) |
2553 |
+ return btrfs_commit_transaction(trans, root); |
2554 |
+- } else { |
2555 |
++ else |
2556 |
+ wake_up_process(info->transaction_kthread); |
2557 |
+- } |
2558 |
+ } |
2559 |
+ |
2560 |
+ WARN_ON(cur_trans != info->running_transaction); |
2561 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
2562 |
+index bf35fe01a83f..834d9a19e379 100644 |
2563 |
+--- a/fs/ext4/extents.c |
2564 |
++++ b/fs/ext4/extents.c |
2565 |
+@@ -2372,6 +2372,27 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, |
2566 |
+ ex_ee_block = le32_to_cpu(ex->ee_block); |
2567 |
+ ex_ee_len = ext4_ext_get_actual_len(ex); |
2568 |
+ |
2569 |
++ /* |
2570 |
++ * If we're starting with an extent other than the last one in the |
2571 |
++ * node, we need to see if it shares a cluster with the extent to |
2572 |
++ * the right (towards the end of the file). If its leftmost cluster |
2573 |
++ * is this extent's rightmost cluster and it is not cluster aligned, |
2574 |
++ * we'll mark it as a partial that is not to be deallocated. |
2575 |
++ */ |
2576 |
++ |
2577 |
++ if (ex != EXT_LAST_EXTENT(eh)) { |
2578 |
++ ext4_fsblk_t current_pblk, right_pblk; |
2579 |
++ long long current_cluster, right_cluster; |
2580 |
++ |
2581 |
++ current_pblk = ext4_ext_pblock(ex) + ex_ee_len - 1; |
2582 |
++ current_cluster = (long long)EXT4_B2C(sbi, current_pblk); |
2583 |
++ right_pblk = ext4_ext_pblock(ex + 1); |
2584 |
++ right_cluster = (long long)EXT4_B2C(sbi, right_pblk); |
2585 |
++ if (current_cluster == right_cluster && |
2586 |
++ EXT4_PBLK_COFF(sbi, right_pblk)) |
2587 |
++ *partial_cluster = -right_cluster; |
2588 |
++ } |
2589 |
++ |
2590 |
+ trace_ext4_ext_rm_leaf(inode, start, ex, *partial_cluster); |
2591 |
+ |
2592 |
+ while (ex >= EXT_FIRST_EXTENT(eh) && |
2593 |
+diff --git a/fs/jffs2/compr_rtime.c b/fs/jffs2/compr_rtime.c |
2594 |
+index 16a5047903a6..406d9cc84ba8 100644 |
2595 |
+--- a/fs/jffs2/compr_rtime.c |
2596 |
++++ b/fs/jffs2/compr_rtime.c |
2597 |
+@@ -33,7 +33,7 @@ static int jffs2_rtime_compress(unsigned char *data_in, |
2598 |
+ unsigned char *cpage_out, |
2599 |
+ uint32_t *sourcelen, uint32_t *dstlen) |
2600 |
+ { |
2601 |
+- short positions[256]; |
2602 |
++ unsigned short positions[256]; |
2603 |
+ int outpos = 0; |
2604 |
+ int pos=0; |
2605 |
+ |
2606 |
+@@ -74,7 +74,7 @@ static int jffs2_rtime_decompress(unsigned char *data_in, |
2607 |
+ unsigned char *cpage_out, |
2608 |
+ uint32_t srclen, uint32_t destlen) |
2609 |
+ { |
2610 |
+- short positions[256]; |
2611 |
++ unsigned short positions[256]; |
2612 |
+ int outpos = 0; |
2613 |
+ int pos=0; |
2614 |
+ |
2615 |
+diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h |
2616 |
+index e4619b00f7c5..fa35ff79ab35 100644 |
2617 |
+--- a/fs/jffs2/nodelist.h |
2618 |
++++ b/fs/jffs2/nodelist.h |
2619 |
+@@ -231,7 +231,7 @@ struct jffs2_tmp_dnode_info |
2620 |
+ uint32_t version; |
2621 |
+ uint32_t data_crc; |
2622 |
+ uint32_t partial_crc; |
2623 |
+- uint16_t csize; |
2624 |
++ uint32_t csize; |
2625 |
+ uint16_t overlapped; |
2626 |
+ }; |
2627 |
+ |
2628 |
+diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c |
2629 |
+index 694aa5b03505..145ba39227ab 100644 |
2630 |
+--- a/fs/jffs2/nodemgmt.c |
2631 |
++++ b/fs/jffs2/nodemgmt.c |
2632 |
+@@ -128,6 +128,7 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, |
2633 |
+ spin_unlock(&c->erase_completion_lock); |
2634 |
+ |
2635 |
+ schedule(); |
2636 |
++ remove_wait_queue(&c->erase_wait, &wait); |
2637 |
+ } else |
2638 |
+ spin_unlock(&c->erase_completion_lock); |
2639 |
+ } else if (ret) |
2640 |
+@@ -158,19 +159,24 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, |
2641 |
+ int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, |
2642 |
+ uint32_t *len, uint32_t sumsize) |
2643 |
+ { |
2644 |
+- int ret = -EAGAIN; |
2645 |
++ int ret; |
2646 |
+ minsize = PAD(minsize); |
2647 |
+ |
2648 |
+ D1(printk(KERN_DEBUG "jffs2_reserve_space_gc(): Requested 0x%x bytes\n", minsize)); |
2649 |
+ |
2650 |
+- spin_lock(&c->erase_completion_lock); |
2651 |
+- while(ret == -EAGAIN) { |
2652 |
++ while (true) { |
2653 |
++ spin_lock(&c->erase_completion_lock); |
2654 |
+ ret = jffs2_do_reserve_space(c, minsize, len, sumsize); |
2655 |
+ if (ret) { |
2656 |
+ D1(printk(KERN_DEBUG "jffs2_reserve_space_gc: looping, ret is %d\n", ret)); |
2657 |
+ } |
2658 |
++ spin_unlock(&c->erase_completion_lock); |
2659 |
++ |
2660 |
++ if (ret == -EAGAIN) |
2661 |
++ cond_resched(); |
2662 |
++ else |
2663 |
++ break; |
2664 |
+ } |
2665 |
+- spin_unlock(&c->erase_completion_lock); |
2666 |
+ if (!ret) |
2667 |
+ ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, 1); |
2668 |
+ |
2669 |
+diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c |
2670 |
+index e065497c45ae..315a1ba47178 100644 |
2671 |
+--- a/fs/nfsd/nfs4proc.c |
2672 |
++++ b/fs/nfsd/nfs4proc.c |
2673 |
+@@ -1224,6 +1224,12 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, |
2674 |
+ /* If op is non-idempotent */ |
2675 |
+ if (opdesc->op_flags & OP_MODIFIES_SOMETHING) { |
2676 |
+ plen = opdesc->op_rsize_bop(rqstp, op); |
2677 |
++ /* |
2678 |
++ * If there's still another operation, make sure |
2679 |
++ * we'll have space to at least encode an error: |
2680 |
++ */ |
2681 |
++ if (resp->opcnt < args->opcnt) |
2682 |
++ plen += COMPOUND_ERR_SLACK_SPACE; |
2683 |
+ op->status = nfsd4_check_resp_size(resp, plen); |
2684 |
+ } |
2685 |
+ |
2686 |
+@@ -1381,7 +1387,8 @@ static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *o |
2687 |
+ |
2688 |
+ static inline u32 nfsd4_setclientid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) |
2689 |
+ { |
2690 |
+- return (op_encode_hdr_size + 2 + 1024) * sizeof(__be32); |
2691 |
++ return (op_encode_hdr_size + 2 + XDR_QUADLEN(NFS4_VERIFIER_SIZE)) * |
2692 |
++ sizeof(__be32); |
2693 |
+ } |
2694 |
+ |
2695 |
+ static inline u32 nfsd4_write_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) |
2696 |
+diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c |
2697 |
+index ade5316d0cf5..4835b90d4180 100644 |
2698 |
+--- a/fs/nfsd/nfs4xdr.c |
2699 |
++++ b/fs/nfsd/nfs4xdr.c |
2700 |
+@@ -2413,6 +2413,8 @@ out_acl: |
2701 |
+ WRITE64(stat.ino); |
2702 |
+ } |
2703 |
+ if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) { |
2704 |
++ if ((buflen -= 16) < 0) |
2705 |
++ goto out_resource; |
2706 |
+ WRITE32(3); |
2707 |
+ WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD0); |
2708 |
+ WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD1); |
2709 |
+diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c |
2710 |
+index 6a66fc08546d..11e1888e20e5 100644 |
2711 |
+--- a/fs/nfsd/vfs.c |
2712 |
++++ b/fs/nfsd/vfs.c |
2713 |
+@@ -406,6 +406,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, |
2714 |
+ int ftype = 0; |
2715 |
+ __be32 err; |
2716 |
+ int host_err; |
2717 |
++ bool get_write_count; |
2718 |
+ int size_change = 0; |
2719 |
+ |
2720 |
+ if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) |
2721 |
+@@ -413,10 +414,18 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, |
2722 |
+ if (iap->ia_valid & ATTR_SIZE) |
2723 |
+ ftype = S_IFREG; |
2724 |
+ |
2725 |
++ /* Callers that do fh_verify should do the fh_want_write: */ |
2726 |
++ get_write_count = !fhp->fh_dentry; |
2727 |
++ |
2728 |
+ /* Get inode */ |
2729 |
+ err = fh_verify(rqstp, fhp, ftype, accmode); |
2730 |
+ if (err) |
2731 |
+ goto out; |
2732 |
++ if (get_write_count) { |
2733 |
++ host_err = fh_want_write(fhp); |
2734 |
++ if (host_err) |
2735 |
++ return nfserrno(host_err); |
2736 |
++ } |
2737 |
+ |
2738 |
+ dentry = fhp->fh_dentry; |
2739 |
+ inode = dentry->d_inode; |
2740 |
+diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h |
2741 |
+index 85d4d422458a..c7fe96233bd7 100644 |
2742 |
+--- a/fs/nfsd/vfs.h |
2743 |
++++ b/fs/nfsd/vfs.h |
2744 |
+@@ -108,4 +108,14 @@ struct posix_acl *nfsd_get_posix_acl(struct svc_fh *, int); |
2745 |
+ int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); |
2746 |
+ #endif |
2747 |
+ |
2748 |
++static inline int fh_want_write(struct svc_fh *fh) |
2749 |
++{ |
2750 |
++ return mnt_want_write(fh->fh_export->ex_path.mnt); |
2751 |
++} |
2752 |
++ |
2753 |
++static inline void fh_drop_write(struct svc_fh *fh) |
2754 |
++{ |
2755 |
++ mnt_drop_write(fh->fh_export->ex_path.mnt); |
2756 |
++} |
2757 |
++ |
2758 |
+ #endif /* LINUX_NFSD_VFS_H */ |
2759 |
+diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c |
2760 |
+index 5d18ad10c27f..4f66e007dae1 100644 |
2761 |
+--- a/fs/ocfs2/buffer_head_io.c |
2762 |
++++ b/fs/ocfs2/buffer_head_io.c |
2763 |
+@@ -90,7 +90,6 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, |
2764 |
+ * information for this bh as it's not marked locally |
2765 |
+ * uptodate. */ |
2766 |
+ ret = -EIO; |
2767 |
+- put_bh(bh); |
2768 |
+ mlog_errno(ret); |
2769 |
+ } |
2770 |
+ |
2771 |
+@@ -420,7 +419,6 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb, |
2772 |
+ |
2773 |
+ if (!buffer_uptodate(bh)) { |
2774 |
+ ret = -EIO; |
2775 |
+- put_bh(bh); |
2776 |
+ mlog_errno(ret); |
2777 |
+ } |
2778 |
+ |
2779 |
+diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c |
2780 |
+index 01ebfd0bdad7..d15b0714ee3e 100644 |
2781 |
+--- a/fs/ocfs2/dlm/dlmrecovery.c |
2782 |
++++ b/fs/ocfs2/dlm/dlmrecovery.c |
2783 |
+@@ -540,7 +540,10 @@ master_here: |
2784 |
+ /* success! see if any other nodes need recovery */ |
2785 |
+ mlog(0, "DONE mastering recovery of %s:%u here(this=%u)!\n", |
2786 |
+ dlm->name, dlm->reco.dead_node, dlm->node_num); |
2787 |
+- dlm_reset_recovery(dlm); |
2788 |
++ spin_lock(&dlm->spinlock); |
2789 |
++ __dlm_reset_recovery(dlm); |
2790 |
++ dlm->reco.state &= ~DLM_RECO_STATE_FINALIZE; |
2791 |
++ spin_unlock(&dlm->spinlock); |
2792 |
+ } |
2793 |
+ dlm_end_recovery(dlm); |
2794 |
+ |
2795 |
+@@ -698,6 +701,14 @@ static int dlm_remaster_locks(struct dlm_ctxt *dlm, u8 dead_node) |
2796 |
+ if (all_nodes_done) { |
2797 |
+ int ret; |
2798 |
+ |
2799 |
++ /* Set this flag on recovery master to avoid |
2800 |
++ * a new recovery for another dead node start |
2801 |
++ * before the recovery is not done. That may |
2802 |
++ * cause recovery hung.*/ |
2803 |
++ spin_lock(&dlm->spinlock); |
2804 |
++ dlm->reco.state |= DLM_RECO_STATE_FINALIZE; |
2805 |
++ spin_unlock(&dlm->spinlock); |
2806 |
++ |
2807 |
+ /* all nodes are now in DLM_RECO_NODE_DATA_DONE state |
2808 |
+ * just send a finalize message to everyone and |
2809 |
+ * clean up */ |
2810 |
+@@ -1752,13 +1763,13 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm, |
2811 |
+ struct dlm_migratable_lockres *mres) |
2812 |
+ { |
2813 |
+ struct dlm_migratable_lock *ml; |
2814 |
+- struct list_head *queue; |
2815 |
++ struct list_head *queue, *iter; |
2816 |
+ struct list_head *tmpq = NULL; |
2817 |
+ struct dlm_lock *newlock = NULL; |
2818 |
+ struct dlm_lockstatus *lksb = NULL; |
2819 |
+ int ret = 0; |
2820 |
+ int i, j, bad; |
2821 |
+- struct dlm_lock *lock = NULL; |
2822 |
++ struct dlm_lock *lock; |
2823 |
+ u8 from = O2NM_MAX_NODES; |
2824 |
+ unsigned int added = 0; |
2825 |
+ __be64 c; |
2826 |
+@@ -1793,14 +1804,16 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm, |
2827 |
+ /* MIGRATION ONLY! */ |
2828 |
+ BUG_ON(!(mres->flags & DLM_MRES_MIGRATION)); |
2829 |
+ |
2830 |
++ lock = NULL; |
2831 |
+ spin_lock(&res->spinlock); |
2832 |
+ for (j = DLM_GRANTED_LIST; j <= DLM_BLOCKED_LIST; j++) { |
2833 |
+ tmpq = dlm_list_idx_to_ptr(res, j); |
2834 |
+- list_for_each_entry(lock, tmpq, list) { |
2835 |
+- if (lock->ml.cookie != ml->cookie) |
2836 |
+- lock = NULL; |
2837 |
+- else |
2838 |
++ list_for_each(iter, tmpq) { |
2839 |
++ lock = list_entry(iter, |
2840 |
++ struct dlm_lock, list); |
2841 |
++ if (lock->ml.cookie == ml->cookie) |
2842 |
+ break; |
2843 |
++ lock = NULL; |
2844 |
+ } |
2845 |
+ if (lock) |
2846 |
+ break; |
2847 |
+@@ -2870,8 +2883,8 @@ int dlm_finalize_reco_handler(struct o2net_msg *msg, u32 len, void *data, |
2848 |
+ BUG(); |
2849 |
+ } |
2850 |
+ dlm->reco.state &= ~DLM_RECO_STATE_FINALIZE; |
2851 |
++ __dlm_reset_recovery(dlm); |
2852 |
+ spin_unlock(&dlm->spinlock); |
2853 |
+- dlm_reset_recovery(dlm); |
2854 |
+ dlm_kick_recovery_thread(dlm); |
2855 |
+ break; |
2856 |
+ default: |
2857 |
+diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c |
2858 |
+index 133e9355dc6f..8048eea5955b 100644 |
2859 |
+--- a/fs/reiserfs/dir.c |
2860 |
++++ b/fs/reiserfs/dir.c |
2861 |
+@@ -128,6 +128,7 @@ int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent, |
2862 |
+ char *d_name; |
2863 |
+ off_t d_off; |
2864 |
+ ino_t d_ino; |
2865 |
++ loff_t cur_pos = deh_offset(deh); |
2866 |
+ |
2867 |
+ if (!de_visible(deh)) |
2868 |
+ /* it is hidden entry */ |
2869 |
+@@ -200,8 +201,9 @@ int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent, |
2870 |
+ if (local_buf != small_buf) { |
2871 |
+ kfree(local_buf); |
2872 |
+ } |
2873 |
+- // next entry should be looked for with such offset |
2874 |
+- next_pos = deh_offset(deh) + 1; |
2875 |
++ |
2876 |
++ /* deh_offset(deh) may be invalid now. */ |
2877 |
++ next_pos = cur_pos + 1; |
2878 |
+ |
2879 |
+ if (item_moved(&tmp_ih, &path_to_entry)) { |
2880 |
+ goto research; |
2881 |
+diff --git a/include/linux/sched.h b/include/linux/sched.h |
2882 |
+index c17fdfbd323f..cb34ff42e4c3 100644 |
2883 |
+--- a/include/linux/sched.h |
2884 |
++++ b/include/linux/sched.h |
2885 |
+@@ -1690,6 +1690,24 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk) |
2886 |
+ } |
2887 |
+ |
2888 |
+ |
2889 |
++static int pid_alive(const struct task_struct *p); |
2890 |
++static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns) |
2891 |
++{ |
2892 |
++ pid_t pid = 0; |
2893 |
++ |
2894 |
++ rcu_read_lock(); |
2895 |
++ if (pid_alive(tsk)) |
2896 |
++ pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns); |
2897 |
++ rcu_read_unlock(); |
2898 |
++ |
2899 |
++ return pid; |
2900 |
++} |
2901 |
++ |
2902 |
++static inline pid_t task_ppid_nr(const struct task_struct *tsk) |
2903 |
++{ |
2904 |
++ return task_ppid_nr_ns(tsk, &init_pid_ns); |
2905 |
++} |
2906 |
++ |
2907 |
+ static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, |
2908 |
+ struct pid_namespace *ns) |
2909 |
+ { |
2910 |
+@@ -1727,7 +1745,7 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk) |
2911 |
+ * If pid_alive fails, then pointers within the task structure |
2912 |
+ * can be stale and must not be dereferenced. |
2913 |
+ */ |
2914 |
+-static inline int pid_alive(struct task_struct *p) |
2915 |
++static inline int pid_alive(const struct task_struct *p) |
2916 |
+ { |
2917 |
+ return p->pids[PIDTYPE_PID].pid != NULL; |
2918 |
+ } |
2919 |
+diff --git a/include/trace/events/block.h b/include/trace/events/block.h |
2920 |
+index 05c5e61f0a7c..048e2658d895 100644 |
2921 |
+--- a/include/trace/events/block.h |
2922 |
++++ b/include/trace/events/block.h |
2923 |
+@@ -81,6 +81,7 @@ DEFINE_EVENT(block_rq_with_error, block_rq_requeue, |
2924 |
+ * block_rq_complete - block IO operation completed by device driver |
2925 |
+ * @q: queue containing the block operation request |
2926 |
+ * @rq: block operations request |
2927 |
++ * @nr_bytes: number of completed bytes |
2928 |
+ * |
2929 |
+ * The block_rq_complete tracepoint event indicates that some portion |
2930 |
+ * of operation request has been completed by the device driver. If |
2931 |
+@@ -88,11 +89,37 @@ DEFINE_EVENT(block_rq_with_error, block_rq_requeue, |
2932 |
+ * do for the request. If @rq->bio is non-NULL then there is |
2933 |
+ * additional work required to complete the request. |
2934 |
+ */ |
2935 |
+-DEFINE_EVENT(block_rq_with_error, block_rq_complete, |
2936 |
++TRACE_EVENT(block_rq_complete, |
2937 |
+ |
2938 |
+- TP_PROTO(struct request_queue *q, struct request *rq), |
2939 |
++ TP_PROTO(struct request_queue *q, struct request *rq, |
2940 |
++ unsigned int nr_bytes), |
2941 |
+ |
2942 |
+- TP_ARGS(q, rq) |
2943 |
++ TP_ARGS(q, rq, nr_bytes), |
2944 |
++ |
2945 |
++ TP_STRUCT__entry( |
2946 |
++ __field( dev_t, dev ) |
2947 |
++ __field( sector_t, sector ) |
2948 |
++ __field( unsigned int, nr_sector ) |
2949 |
++ __field( int, errors ) |
2950 |
++ __array( char, rwbs, RWBS_LEN ) |
2951 |
++ __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) |
2952 |
++ ), |
2953 |
++ |
2954 |
++ TP_fast_assign( |
2955 |
++ __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; |
2956 |
++ __entry->sector = blk_rq_pos(rq); |
2957 |
++ __entry->nr_sector = nr_bytes >> 9; |
2958 |
++ __entry->errors = rq->errors; |
2959 |
++ |
2960 |
++ blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, nr_bytes); |
2961 |
++ blk_dump_cmd(__get_str(cmd), rq); |
2962 |
++ ), |
2963 |
++ |
2964 |
++ TP_printk("%d,%d %s (%s) %llu + %u [%d]", |
2965 |
++ MAJOR(__entry->dev), MINOR(__entry->dev), |
2966 |
++ __entry->rwbs, __get_str(cmd), |
2967 |
++ (unsigned long long)__entry->sector, |
2968 |
++ __entry->nr_sector, __entry->errors) |
2969 |
+ ); |
2970 |
+ |
2971 |
+ DECLARE_EVENT_CLASS(block_rq, |
2972 |
+diff --git a/kernel/auditsc.c b/kernel/auditsc.c |
2973 |
+index 47b7fc1ea893..aeac7cccd5e9 100644 |
2974 |
+--- a/kernel/auditsc.c |
2975 |
++++ b/kernel/auditsc.c |
2976 |
+@@ -473,7 +473,7 @@ static int audit_filter_rules(struct task_struct *tsk, |
2977 |
+ case AUDIT_PPID: |
2978 |
+ if (ctx) { |
2979 |
+ if (!ctx->ppid) |
2980 |
+- ctx->ppid = sys_getppid(); |
2981 |
++ ctx->ppid = task_ppid_nr(tsk); |
2982 |
+ result = audit_comparator(ctx->ppid, f->op, f->val); |
2983 |
+ } |
2984 |
+ break; |
2985 |
+@@ -1335,7 +1335,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts |
2986 |
+ /* tsk == current */ |
2987 |
+ context->pid = tsk->pid; |
2988 |
+ if (!context->ppid) |
2989 |
+- context->ppid = sys_getppid(); |
2990 |
++ context->ppid = task_ppid_nr(tsk); |
2991 |
+ cred = current_cred(); |
2992 |
+ context->uid = cred->uid; |
2993 |
+ context->gid = cred->gid; |
2994 |
+diff --git a/kernel/exit.c b/kernel/exit.c |
2995 |
+index 234e152c609e..fde15f96b158 100644 |
2996 |
+--- a/kernel/exit.c |
2997 |
++++ b/kernel/exit.c |
2998 |
+@@ -734,9 +734,6 @@ static void reparent_leader(struct task_struct *father, struct task_struct *p, |
2999 |
+ struct list_head *dead) |
3000 |
+ { |
3001 |
+ list_move_tail(&p->sibling, &p->real_parent->children); |
3002 |
+- |
3003 |
+- if (p->exit_state == EXIT_DEAD) |
3004 |
+- return; |
3005 |
+ /* |
3006 |
+ * If this is a threaded reparent there is no need to |
3007 |
+ * notify anyone anything has happened. |
3008 |
+@@ -744,9 +741,19 @@ static void reparent_leader(struct task_struct *father, struct task_struct *p, |
3009 |
+ if (same_thread_group(p->real_parent, father)) |
3010 |
+ return; |
3011 |
+ |
3012 |
+- /* We don't want people slaying init. */ |
3013 |
++ /* |
3014 |
++ * We don't want people slaying init. |
3015 |
++ * |
3016 |
++ * Note: we do this even if it is EXIT_DEAD, wait_task_zombie() |
3017 |
++ * can change ->exit_state to EXIT_ZOMBIE. If this is the final |
3018 |
++ * state, do_notify_parent() was already called and ->exit_signal |
3019 |
++ * doesn't matter. |
3020 |
++ */ |
3021 |
+ p->exit_signal = SIGCHLD; |
3022 |
+ |
3023 |
++ if (p->exit_state == EXIT_DEAD) |
3024 |
++ return; |
3025 |
++ |
3026 |
+ /* If it has exited notify the new parent about this child's death. */ |
3027 |
+ if (!p->ptrace && |
3028 |
+ p->exit_state == EXIT_ZOMBIE && thread_group_empty(p)) { |
3029 |
+diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c |
3030 |
+index 16fc34a0806f..92cac05aa7d1 100644 |
3031 |
+--- a/kernel/trace/blktrace.c |
3032 |
++++ b/kernel/trace/blktrace.c |
3033 |
+@@ -699,6 +699,7 @@ void blk_trace_shutdown(struct request_queue *q) |
3034 |
+ * blk_add_trace_rq - Add a trace for a request oriented action |
3035 |
+ * @q: queue the io is for |
3036 |
+ * @rq: the source request |
3037 |
++ * @nr_bytes: number of completed bytes |
3038 |
+ * @what: the action |
3039 |
+ * |
3040 |
+ * Description: |
3041 |
+@@ -706,7 +707,7 @@ void blk_trace_shutdown(struct request_queue *q) |
3042 |
+ * |
3043 |
+ **/ |
3044 |
+ static void blk_add_trace_rq(struct request_queue *q, struct request *rq, |
3045 |
+- u32 what) |
3046 |
++ unsigned int nr_bytes, u32 what) |
3047 |
+ { |
3048 |
+ struct blk_trace *bt = q->blk_trace; |
3049 |
+ |
3050 |
+@@ -715,11 +716,11 @@ static void blk_add_trace_rq(struct request_queue *q, struct request *rq, |
3051 |
+ |
3052 |
+ if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
3053 |
+ what |= BLK_TC_ACT(BLK_TC_PC); |
3054 |
+- __blk_add_trace(bt, 0, blk_rq_bytes(rq), rq->cmd_flags, |
3055 |
++ __blk_add_trace(bt, 0, nr_bytes, rq->cmd_flags, |
3056 |
+ what, rq->errors, rq->cmd_len, rq->cmd); |
3057 |
+ } else { |
3058 |
+ what |= BLK_TC_ACT(BLK_TC_FS); |
3059 |
+- __blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq), |
3060 |
++ __blk_add_trace(bt, blk_rq_pos(rq), nr_bytes, |
3061 |
+ rq->cmd_flags, what, rq->errors, 0, NULL); |
3062 |
+ } |
3063 |
+ } |
3064 |
+@@ -727,33 +728,34 @@ static void blk_add_trace_rq(struct request_queue *q, struct request *rq, |
3065 |
+ static void blk_add_trace_rq_abort(void *ignore, |
3066 |
+ struct request_queue *q, struct request *rq) |
3067 |
+ { |
3068 |
+- blk_add_trace_rq(q, rq, BLK_TA_ABORT); |
3069 |
++ blk_add_trace_rq(q, rq, blk_rq_bytes(rq), BLK_TA_ABORT); |
3070 |
+ } |
3071 |
+ |
3072 |
+ static void blk_add_trace_rq_insert(void *ignore, |
3073 |
+ struct request_queue *q, struct request *rq) |
3074 |
+ { |
3075 |
+- blk_add_trace_rq(q, rq, BLK_TA_INSERT); |
3076 |
++ blk_add_trace_rq(q, rq, blk_rq_bytes(rq), BLK_TA_INSERT); |
3077 |
+ } |
3078 |
+ |
3079 |
+ static void blk_add_trace_rq_issue(void *ignore, |
3080 |
+ struct request_queue *q, struct request *rq) |
3081 |
+ { |
3082 |
+- blk_add_trace_rq(q, rq, BLK_TA_ISSUE); |
3083 |
++ blk_add_trace_rq(q, rq, blk_rq_bytes(rq), BLK_TA_ISSUE); |
3084 |
+ } |
3085 |
+ |
3086 |
+ static void blk_add_trace_rq_requeue(void *ignore, |
3087 |
+ struct request_queue *q, |
3088 |
+ struct request *rq) |
3089 |
+ { |
3090 |
+- blk_add_trace_rq(q, rq, BLK_TA_REQUEUE); |
3091 |
++ blk_add_trace_rq(q, rq, blk_rq_bytes(rq), BLK_TA_REQUEUE); |
3092 |
+ } |
3093 |
+ |
3094 |
+ static void blk_add_trace_rq_complete(void *ignore, |
3095 |
+ struct request_queue *q, |
3096 |
+- struct request *rq) |
3097 |
++ struct request *rq, |
3098 |
++ unsigned int nr_bytes) |
3099 |
+ { |
3100 |
+- blk_add_trace_rq(q, rq, BLK_TA_COMPLETE); |
3101 |
++ blk_add_trace_rq(q, rq, nr_bytes, BLK_TA_COMPLETE); |
3102 |
+ } |
3103 |
+ |
3104 |
+ /** |
3105 |
+diff --git a/lib/nlattr.c b/lib/nlattr.c |
3106 |
+index a8408b6cacdf..190ae10126b0 100644 |
3107 |
+--- a/lib/nlattr.c |
3108 |
++++ b/lib/nlattr.c |
3109 |
+@@ -299,9 +299,15 @@ int nla_memcmp(const struct nlattr *nla, const void *data, |
3110 |
+ */ |
3111 |
+ int nla_strcmp(const struct nlattr *nla, const char *str) |
3112 |
+ { |
3113 |
+- int len = strlen(str) + 1; |
3114 |
+- int d = nla_len(nla) - len; |
3115 |
++ int len = strlen(str); |
3116 |
++ char *buf = nla_data(nla); |
3117 |
++ int attrlen = nla_len(nla); |
3118 |
++ int d; |
3119 |
+ |
3120 |
++ if (attrlen > 0 && buf[attrlen - 1] == '\0') |
3121 |
++ attrlen--; |
3122 |
++ |
3123 |
++ d = attrlen - len; |
3124 |
+ if (d == 0) |
3125 |
+ d = memcmp(nla_data(nla), str, len); |
3126 |
+ |
3127 |
+diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c |
3128 |
+index f8a3f1a829b8..33459e0b8bea 100644 |
3129 |
+--- a/lib/percpu_counter.c |
3130 |
++++ b/lib/percpu_counter.c |
3131 |
+@@ -166,7 +166,7 @@ static int __cpuinit percpu_counter_hotcpu_callback(struct notifier_block *nb, |
3132 |
+ struct percpu_counter *fbc; |
3133 |
+ |
3134 |
+ compute_batch_value(); |
3135 |
+- if (action != CPU_DEAD) |
3136 |
++ if (action != CPU_DEAD && action != CPU_DEAD_FROZEN) |
3137 |
+ return NOTIFY_OK; |
3138 |
+ |
3139 |
+ cpu = (unsigned long)hcpu; |
3140 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
3141 |
+index 3a5aae2d6ee7..d399f5ff5d9c 100644 |
3142 |
+--- a/mm/hugetlb.c |
3143 |
++++ b/mm/hugetlb.c |
3144 |
+@@ -1447,6 +1447,7 @@ static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count, |
3145 |
+ while (min_count < persistent_huge_pages(h)) { |
3146 |
+ if (!free_pool_huge_page(h, nodes_allowed, 0)) |
3147 |
+ break; |
3148 |
++ cond_resched_lock(&hugetlb_lock); |
3149 |
+ } |
3150 |
+ while (count < persistent_huge_pages(h)) { |
3151 |
+ if (!adjust_pool_surplus(h, nodes_allowed, 1)) |
3152 |
+diff --git a/mm/mlock.c b/mm/mlock.c |
3153 |
+index 4f4f53bdc65d..39b3a7d4bd84 100644 |
3154 |
+--- a/mm/mlock.c |
3155 |
++++ b/mm/mlock.c |
3156 |
+@@ -78,6 +78,7 @@ void __clear_page_mlock(struct page *page) |
3157 |
+ */ |
3158 |
+ void mlock_vma_page(struct page *page) |
3159 |
+ { |
3160 |
++ /* Serialize with page migration */ |
3161 |
+ BUG_ON(!PageLocked(page)); |
3162 |
+ |
3163 |
+ if (!TestSetPageMlocked(page)) { |
3164 |
+@@ -105,6 +106,7 @@ void mlock_vma_page(struct page *page) |
3165 |
+ */ |
3166 |
+ void munlock_vma_page(struct page *page) |
3167 |
+ { |
3168 |
++ /* For try_to_munlock() and to serialize with page migration */ |
3169 |
+ BUG_ON(!PageLocked(page)); |
3170 |
+ |
3171 |
+ if (TestClearPageMlocked(page)) { |
3172 |
+diff --git a/mm/rmap.c b/mm/rmap.c |
3173 |
+index 52a2f364f087..9ac405ba91df 100644 |
3174 |
+--- a/mm/rmap.c |
3175 |
++++ b/mm/rmap.c |
3176 |
+@@ -1385,9 +1385,19 @@ static int try_to_unmap_cluster(unsigned long cursor, unsigned int *mapcount, |
3177 |
+ BUG_ON(!page || PageAnon(page)); |
3178 |
+ |
3179 |
+ if (locked_vma) { |
3180 |
+- mlock_vma_page(page); /* no-op if already mlocked */ |
3181 |
+- if (page == check_page) |
3182 |
++ if (page == check_page) { |
3183 |
++ /* we know we have check_page locked */ |
3184 |
++ mlock_vma_page(page); |
3185 |
+ ret = SWAP_MLOCK; |
3186 |
++ } else if (trylock_page(page)) { |
3187 |
++ /* |
3188 |
++ * If we can lock the page, perform mlock. |
3189 |
++ * Otherwise leave the page alone, it will be |
3190 |
++ * eventually encountered again later. |
3191 |
++ */ |
3192 |
++ mlock_vma_page(page); |
3193 |
++ unlock_page(page); |
3194 |
++ } |
3195 |
+ continue; /* don't unmap */ |
3196 |
+ } |
3197 |
+ |
3198 |
+diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c |
3199 |
+index 48a62d89f8ae..c43a788b11df 100644 |
3200 |
+--- a/net/8021q/vlan_dev.c |
3201 |
++++ b/net/8021q/vlan_dev.c |
3202 |
+@@ -529,6 +529,9 @@ static int vlan_passthru_hard_header(struct sk_buff *skb, struct net_device *dev |
3203 |
+ { |
3204 |
+ struct net_device *real_dev = vlan_dev_info(dev)->real_dev; |
3205 |
+ |
3206 |
++ if (saddr == NULL) |
3207 |
++ saddr = dev->dev_addr; |
3208 |
++ |
3209 |
+ return dev_hard_header(skb, real_dev, type, daddr, saddr, len); |
3210 |
+ } |
3211 |
+ |
3212 |
+diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c |
3213 |
+index 2157984a9eb9..398a2973179d 100644 |
3214 |
+--- a/net/bridge/br_multicast.c |
3215 |
++++ b/net/bridge/br_multicast.c |
3216 |
+@@ -1138,6 +1138,12 @@ static int br_ip6_multicast_query(struct net_bridge *br, |
3217 |
+ |
3218 |
+ br_multicast_query_received(br, port, !ipv6_addr_any(&ip6h->saddr)); |
3219 |
+ |
3220 |
++ /* RFC2710+RFC3810 (MLDv1+MLDv2) require link-local source addresses */ |
3221 |
++ if (!(ipv6_addr_type(&ip6h->saddr) & IPV6_ADDR_LINKLOCAL)) { |
3222 |
++ err = -EINVAL; |
3223 |
++ goto out; |
3224 |
++ } |
3225 |
++ |
3226 |
+ if (skb->len == sizeof(*mld)) { |
3227 |
+ if (!pskb_may_pull(skb, sizeof(*mld))) { |
3228 |
+ err = -EINVAL; |
3229 |
+diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
3230 |
+index 5d41293a6005..b9edff0bbc2c 100644 |
3231 |
+--- a/net/ipv6/addrconf.c |
3232 |
++++ b/net/ipv6/addrconf.c |
3233 |
+@@ -900,8 +900,11 @@ retry: |
3234 |
+ * Lifetime is greater than REGEN_ADVANCE time units. In particular, |
3235 |
+ * an implementation must not create a temporary address with a zero |
3236 |
+ * Preferred Lifetime. |
3237 |
++ * Use age calculation as in addrconf_verify to avoid unnecessary |
3238 |
++ * temporary addresses being generated. |
3239 |
+ */ |
3240 |
+- if (tmp_prefered_lft <= regen_advance) { |
3241 |
++ age = (now - tmp_tstamp + ADDRCONF_TIMER_FUZZ_MINUS) / HZ; |
3242 |
++ if (tmp_prefered_lft <= regen_advance + age) { |
3243 |
+ in6_ifa_put(ifp); |
3244 |
+ in6_dev_put(idev); |
3245 |
+ ret = -1; |
3246 |
+diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c |
3247 |
+index d50545371b55..ceced6774354 100644 |
3248 |
+--- a/net/ipv6/icmp.c |
3249 |
++++ b/net/ipv6/icmp.c |
3250 |
+@@ -499,7 +499,7 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info) |
3251 |
+ np->tclass, NULL, &fl6, (struct rt6_info*)dst, |
3252 |
+ MSG_DONTWAIT, np->dontfrag); |
3253 |
+ if (err) { |
3254 |
+- ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTERRORS); |
3255 |
++ ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS); |
3256 |
+ ip6_flush_pending_frames(sk); |
3257 |
+ } else { |
3258 |
+ err = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr, |
3259 |
+diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c |
3260 |
+index cd4b529fbf98..7871cc65d99c 100644 |
3261 |
+--- a/net/ipv6/ip6_output.c |
3262 |
++++ b/net/ipv6/ip6_output.c |
3263 |
+@@ -1191,21 +1191,19 @@ static void ip6_append_data_mtu(unsigned int *mtu, |
3264 |
+ unsigned int fragheaderlen, |
3265 |
+ struct sk_buff *skb, |
3266 |
+ struct rt6_info *rt, |
3267 |
+- bool pmtuprobe) |
3268 |
++ unsigned int orig_mtu) |
3269 |
+ { |
3270 |
+ if (!(rt->dst.flags & DST_XFRM_TUNNEL)) { |
3271 |
+ if (skb == NULL) { |
3272 |
+ /* first fragment, reserve header_len */ |
3273 |
+- *mtu = *mtu - rt->dst.header_len; |
3274 |
++ *mtu = orig_mtu - rt->dst.header_len; |
3275 |
+ |
3276 |
+ } else { |
3277 |
+ /* |
3278 |
+ * this fragment is not first, the headers |
3279 |
+ * space is regarded as data space. |
3280 |
+ */ |
3281 |
+- *mtu = min(*mtu, pmtuprobe ? |
3282 |
+- rt->dst.dev->mtu : |
3283 |
+- dst_mtu(rt->dst.path)); |
3284 |
++ *mtu = orig_mtu; |
3285 |
+ } |
3286 |
+ *maxfraglen = ((*mtu - fragheaderlen) & ~7) |
3287 |
+ + fragheaderlen - sizeof(struct frag_hdr); |
3288 |
+@@ -1222,7 +1220,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, |
3289 |
+ struct ipv6_pinfo *np = inet6_sk(sk); |
3290 |
+ struct inet_cork *cork; |
3291 |
+ struct sk_buff *skb, *skb_prev = NULL; |
3292 |
+- unsigned int maxfraglen, fragheaderlen, mtu; |
3293 |
++ unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu; |
3294 |
+ int exthdrlen; |
3295 |
+ int dst_exthdrlen; |
3296 |
+ int hh_len; |
3297 |
+@@ -1307,6 +1305,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, |
3298 |
+ dst_exthdrlen = 0; |
3299 |
+ mtu = cork->fragsize; |
3300 |
+ } |
3301 |
++ orig_mtu = mtu; |
3302 |
+ |
3303 |
+ hh_len = LL_RESERVED_SPACE(rt->dst.dev); |
3304 |
+ |
3305 |
+@@ -1389,8 +1388,7 @@ alloc_new_skb: |
3306 |
+ if (skb == NULL || skb_prev == NULL) |
3307 |
+ ip6_append_data_mtu(&mtu, &maxfraglen, |
3308 |
+ fragheaderlen, skb, rt, |
3309 |
+- np->pmtudisc == |
3310 |
+- IPV6_PMTUDISC_PROBE); |
3311 |
++ orig_mtu); |
3312 |
+ |
3313 |
+ skb_prev = skb; |
3314 |
+ |
3315 |
+@@ -1660,8 +1658,8 @@ int ip6_push_pending_frames(struct sock *sk) |
3316 |
+ if (proto == IPPROTO_ICMPV6) { |
3317 |
+ struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb)); |
3318 |
+ |
3319 |
+- ICMP6MSGOUT_INC_STATS_BH(net, idev, icmp6_hdr(skb)->icmp6_type); |
3320 |
+- ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS); |
3321 |
++ ICMP6MSGOUT_INC_STATS(net, idev, icmp6_hdr(skb)->icmp6_type); |
3322 |
++ ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS); |
3323 |
+ } |
3324 |
+ |
3325 |
+ err = ip6_local_out(skb); |
3326 |
+diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c |
3327 |
+index d20a9be8334e..4f12b660045d 100644 |
3328 |
+--- a/net/ipv6/mcast.c |
3329 |
++++ b/net/ipv6/mcast.c |
3330 |
+@@ -1435,11 +1435,12 @@ static void mld_sendpack(struct sk_buff *skb) |
3331 |
+ dst_output); |
3332 |
+ out: |
3333 |
+ if (!err) { |
3334 |
+- ICMP6MSGOUT_INC_STATS_BH(net, idev, ICMPV6_MLD2_REPORT); |
3335 |
+- ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS); |
3336 |
+- IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUTMCAST, payload_len); |
3337 |
+- } else |
3338 |
+- IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTDISCARDS); |
3339 |
++ ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT); |
3340 |
++ ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS); |
3341 |
++ IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, payload_len); |
3342 |
++ } else { |
3343 |
++ IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS); |
3344 |
++ } |
3345 |
+ |
3346 |
+ rcu_read_unlock(); |
3347 |
+ return; |
3348 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
3349 |
+index 9a4f4377ce92..39e11f923a73 100644 |
3350 |
+--- a/net/ipv6/route.c |
3351 |
++++ b/net/ipv6/route.c |
3352 |
+@@ -1250,7 +1250,7 @@ int ip6_route_add(struct fib6_config *cfg) |
3353 |
+ goto out; |
3354 |
+ } |
3355 |
+ |
3356 |
+- rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, NULL, DST_NOCOUNT); |
3357 |
++ rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, NULL, (cfg->fc_flags & RTF_ADDRCONF) ? 0 : DST_NOCOUNT); |
3358 |
+ |
3359 |
+ if (rt == NULL) { |
3360 |
+ err = -ENOMEM; |
3361 |
+diff --git a/net/rds/iw.c b/net/rds/iw.c |
3362 |
+index 7826d46baa70..589935661d66 100644 |
3363 |
+--- a/net/rds/iw.c |
3364 |
++++ b/net/rds/iw.c |
3365 |
+@@ -239,7 +239,8 @@ static int rds_iw_laddr_check(__be32 addr) |
3366 |
+ ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin); |
3367 |
+ /* due to this, we will claim to support IB devices unless we |
3368 |
+ check node_type. */ |
3369 |
+- if (ret || cm_id->device->node_type != RDMA_NODE_RNIC) |
3370 |
++ if (ret || !cm_id->device || |
3371 |
++ cm_id->device->node_type != RDMA_NODE_RNIC) |
3372 |
+ ret = -EADDRNOTAVAIL; |
3373 |
+ |
3374 |
+ rdsdebug("addr %pI4 ret %d node type %d\n", |
3375 |
+diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c |
3376 |
+index 0121e0ab0351..c95a3f2b6309 100644 |
3377 |
+--- a/net/sctp/sm_make_chunk.c |
3378 |
++++ b/net/sctp/sm_make_chunk.c |
3379 |
+@@ -1366,8 +1366,8 @@ static void sctp_chunk_destroy(struct sctp_chunk *chunk) |
3380 |
+ BUG_ON(!list_empty(&chunk->list)); |
3381 |
+ list_del_init(&chunk->transmitted_list); |
3382 |
+ |
3383 |
+- /* Free the chunk skb data and the SCTP_chunk stub itself. */ |
3384 |
+- dev_kfree_skb(chunk->skb); |
3385 |
++ consume_skb(chunk->skb); |
3386 |
++ consume_skb(chunk->auth_chunk); |
3387 |
+ |
3388 |
+ SCTP_DBG_OBJCNT_DEC(chunk); |
3389 |
+ kmem_cache_free(sctp_chunk_cachep, chunk); |
3390 |
+diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c |
3391 |
+index f131caf06a19..5ac33b600538 100644 |
3392 |
+--- a/net/sctp/sm_statefuns.c |
3393 |
++++ b/net/sctp/sm_statefuns.c |
3394 |
+@@ -749,7 +749,6 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep, |
3395 |
+ |
3396 |
+ /* Make sure that we and the peer are AUTH capable */ |
3397 |
+ if (!sctp_auth_enable || !new_asoc->peer.auth_capable) { |
3398 |
+- kfree_skb(chunk->auth_chunk); |
3399 |
+ sctp_association_free(new_asoc); |
3400 |
+ return sctp_sf_pdiscard(ep, asoc, type, arg, commands); |
3401 |
+ } |
3402 |
+@@ -764,10 +763,6 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep, |
3403 |
+ auth.transport = chunk->transport; |
3404 |
+ |
3405 |
+ ret = sctp_sf_authenticate(ep, new_asoc, type, &auth); |
3406 |
+- |
3407 |
+- /* We can now safely free the auth_chunk clone */ |
3408 |
+- kfree_skb(chunk->auth_chunk); |
3409 |
+- |
3410 |
+ if (ret != SCTP_IERROR_NO_ERROR) { |
3411 |
+ sctp_association_free(new_asoc); |
3412 |
+ return sctp_sf_pdiscard(ep, asoc, type, arg, commands); |
3413 |
+diff --git a/net/socket.c b/net/socket.c |
3414 |
+index d4faaded1a9d..3faa358d377f 100644 |
3415 |
+--- a/net/socket.c |
3416 |
++++ b/net/socket.c |
3417 |
+@@ -1884,6 +1884,10 @@ static int copy_msghdr_from_user(struct msghdr *kmsg, |
3418 |
+ { |
3419 |
+ if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) |
3420 |
+ return -EFAULT; |
3421 |
++ |
3422 |
++ if (kmsg->msg_namelen < 0) |
3423 |
++ return -EINVAL; |
3424 |
++ |
3425 |
+ if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) |
3426 |
+ kmsg->msg_namelen = sizeof(struct sockaddr_storage); |
3427 |
+ return 0; |
3428 |
+diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c |
3429 |
+index 54fc90b2408e..8705ee3b11ef 100644 |
3430 |
+--- a/net/unix/af_unix.c |
3431 |
++++ b/net/unix/af_unix.c |
3432 |
+@@ -1771,8 +1771,11 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, |
3433 |
+ goto out; |
3434 |
+ |
3435 |
+ err = mutex_lock_interruptible(&u->readlock); |
3436 |
+- if (err) { |
3437 |
+- err = sock_intr_errno(sock_rcvtimeo(sk, noblock)); |
3438 |
++ if (unlikely(err)) { |
3439 |
++ /* recvmsg() in non blocking mode is supposed to return -EAGAIN |
3440 |
++ * sk_rcvtimeo is not honored by mutex_lock_interruptible() |
3441 |
++ */ |
3442 |
++ err = noblock ? -EAGAIN : -ERESTARTSYS; |
3443 |
+ goto out; |
3444 |
+ } |
3445 |
+ |
3446 |
+@@ -1887,6 +1890,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, |
3447 |
+ struct unix_sock *u = unix_sk(sk); |
3448 |
+ struct sockaddr_un *sunaddr = msg->msg_name; |
3449 |
+ int copied = 0; |
3450 |
++ int noblock = flags & MSG_DONTWAIT; |
3451 |
+ int check_creds = 0; |
3452 |
+ int target; |
3453 |
+ int err = 0; |
3454 |
+@@ -1901,7 +1905,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, |
3455 |
+ goto out; |
3456 |
+ |
3457 |
+ target = sock_rcvlowat(sk, flags&MSG_WAITALL, size); |
3458 |
+- timeo = sock_rcvtimeo(sk, flags&MSG_DONTWAIT); |
3459 |
++ timeo = sock_rcvtimeo(sk, noblock); |
3460 |
+ |
3461 |
+ /* Lock the socket to prevent queue disordering |
3462 |
+ * while sleeps in memcpy_tomsg |
3463 |
+@@ -1913,8 +1917,11 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, |
3464 |
+ } |
3465 |
+ |
3466 |
+ err = mutex_lock_interruptible(&u->readlock); |
3467 |
+- if (err) { |
3468 |
+- err = sock_intr_errno(timeo); |
3469 |
++ if (unlikely(err)) { |
3470 |
++ /* recvmsg() in non blocking mode is supposed to return -EAGAIN |
3471 |
++ * sk_rcvtimeo is not honored by mutex_lock_interruptible() |
3472 |
++ */ |
3473 |
++ err = noblock ? -EAGAIN : -ERESTARTSYS; |
3474 |
+ goto out; |
3475 |
+ } |
3476 |
+ |
3477 |
+diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
3478 |
+index 4fa7939c2e9f..69477ffcce1d 100644 |
3479 |
+--- a/security/selinux/hooks.c |
3480 |
++++ b/security/selinux/hooks.c |
3481 |
+@@ -1328,15 +1328,33 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent |
3482 |
+ isec->sid = sbsec->sid; |
3483 |
+ |
3484 |
+ if ((sbsec->flags & SE_SBPROC) && !S_ISLNK(inode->i_mode)) { |
3485 |
+- if (opt_dentry) { |
3486 |
+- isec->sclass = inode_mode_to_security_class(inode->i_mode); |
3487 |
+- rc = selinux_proc_get_sid(opt_dentry, |
3488 |
+- isec->sclass, |
3489 |
+- &sid); |
3490 |
+- if (rc) |
3491 |
+- goto out_unlock; |
3492 |
+- isec->sid = sid; |
3493 |
+- } |
3494 |
++ /* We must have a dentry to determine the label on |
3495 |
++ * procfs inodes */ |
3496 |
++ if (opt_dentry) |
3497 |
++ /* Called from d_instantiate or |
3498 |
++ * d_splice_alias. */ |
3499 |
++ dentry = dget(opt_dentry); |
3500 |
++ else |
3501 |
++ /* Called from selinux_complete_init, try to |
3502 |
++ * find a dentry. */ |
3503 |
++ dentry = d_find_alias(inode); |
3504 |
++ /* |
3505 |
++ * This can be hit on boot when a file is accessed |
3506 |
++ * before the policy is loaded. When we load policy we |
3507 |
++ * may find inodes that have no dentry on the |
3508 |
++ * sbsec->isec_head list. No reason to complain as |
3509 |
++ * these will get fixed up the next time we go through |
3510 |
++ * inode_doinit() with a dentry, before these inodes |
3511 |
++ * could be used again by userspace. |
3512 |
++ */ |
3513 |
++ if (!dentry) |
3514 |
++ goto out_unlock; |
3515 |
++ isec->sclass = inode_mode_to_security_class(inode->i_mode); |
3516 |
++ rc = selinux_proc_get_sid(dentry, isec->sclass, &sid); |
3517 |
++ dput(dentry); |
3518 |
++ if (rc) |
3519 |
++ goto out_unlock; |
3520 |
++ isec->sid = sid; |
3521 |
+ } |
3522 |
+ break; |
3523 |
+ } |
3524 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
3525 |
+index 36bce68756b0..d307adbb8137 100644 |
3526 |
+--- a/sound/pci/hda/patch_realtek.c |
3527 |
++++ b/sound/pci/hda/patch_realtek.c |
3528 |
+@@ -3855,6 +3855,7 @@ static void alc_auto_init_std(struct hda_codec *codec) |
3529 |
+ |
3530 |
+ static const struct snd_pci_quirk beep_white_list[] = { |
3531 |
+ SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1), |
3532 |
++ SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1), |
3533 |
+ SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
3534 |
+ SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
3535 |
+ SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1), |
3536 |
+diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c |
3537 |
+index 44446f2222d9..7a4a1962ec35 100644 |
3538 |
+--- a/sound/pci/ice1712/ice1712.c |
3539 |
++++ b/sound/pci/ice1712/ice1712.c |
3540 |
+@@ -686,9 +686,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_pointer(struct snd_pcm_substream * |
3541 |
+ if (!(snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL) & 1)) |
3542 |
+ return 0; |
3543 |
+ ptr = runtime->buffer_size - inw(ice->ddma_port + 4); |
3544 |
++ ptr = bytes_to_frames(substream->runtime, ptr); |
3545 |
+ if (ptr == runtime->buffer_size) |
3546 |
+ ptr = 0; |
3547 |
+- return bytes_to_frames(substream->runtime, ptr); |
3548 |
++ return ptr; |
3549 |
+ } |
3550 |
+ |
3551 |
+ static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substream *substream) |
3552 |
+@@ -705,9 +706,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substrea |
3553 |
+ addr = ICE1712_DSC_ADDR0; |
3554 |
+ ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) - |
3555 |
+ ice->playback_con_virt_addr[substream->number]; |
3556 |
++ ptr = bytes_to_frames(substream->runtime, ptr); |
3557 |
+ if (ptr == substream->runtime->buffer_size) |
3558 |
+ ptr = 0; |
3559 |
+- return bytes_to_frames(substream->runtime, ptr); |
3560 |
++ return ptr; |
3561 |
+ } |
3562 |
+ |
3563 |
+ static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *substream) |
3564 |
+@@ -718,9 +720,10 @@ static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *s |
3565 |
+ if (!(snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL) & 1)) |
3566 |
+ return 0; |
3567 |
+ ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr; |
3568 |
++ ptr = bytes_to_frames(substream->runtime, ptr); |
3569 |
+ if (ptr == substream->runtime->buffer_size) |
3570 |
+ ptr = 0; |
3571 |
+- return bytes_to_frames(substream->runtime, ptr); |
3572 |
++ return ptr; |
3573 |
+ } |
3574 |
+ |
3575 |
+ static const struct snd_pcm_hardware snd_ice1712_playback = { |
3576 |
+@@ -1114,9 +1117,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_pro_pointer(struct snd_pcm_substre |
3577 |
+ if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_PLAYBACK_START)) |
3578 |
+ return 0; |
3579 |
+ ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2); |
3580 |
++ ptr = bytes_to_frames(substream->runtime, ptr); |
3581 |
+ if (ptr == substream->runtime->buffer_size) |
3582 |
+ ptr = 0; |
3583 |
+- return bytes_to_frames(substream->runtime, ptr); |
3584 |
++ return ptr; |
3585 |
+ } |
3586 |
+ |
3587 |
+ static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substream *substream) |
3588 |
+@@ -1127,9 +1131,10 @@ static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substrea |
3589 |
+ if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_CAPTURE_START_SHADOW)) |
3590 |
+ return 0; |
3591 |
+ ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2); |
3592 |
++ ptr = bytes_to_frames(substream->runtime, ptr); |
3593 |
+ if (ptr == substream->runtime->buffer_size) |
3594 |
+ ptr = 0; |
3595 |
+- return bytes_to_frames(substream->runtime, ptr); |
3596 |
++ return ptr; |
3597 |
+ } |
3598 |
+ |
3599 |
+ static const struct snd_pcm_hardware snd_ice1712_playback_pro = { |