Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:3.4 commit in: /
Date: Fri, 26 Sep 2014 18:00:04
Message-Id: 1411754209.f9ca61f33c41fa20a3eb99ce3cae9c589cfd2262.mpagano@gentoo
1 commit: f9ca61f33c41fa20a3eb99ce3cae9c589cfd2262
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 26 17:56:49 2014 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 26 17:56:49 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=f9ca61f3
7
8 Linux patch 3.4.104
9
10 ---
11 0000_README | 4 +
12 1103_linux-3.4.104.patch | 1740 ++++++++++++++++++++++++++++++++++++++++++++++
13 2 files changed, 1744 insertions(+)
14
15 diff --git a/0000_README b/0000_README
16 index 9f3e940..544ba0b 100644
17 --- a/0000_README
18 +++ b/0000_README
19 @@ -451,6 +451,10 @@ Patch: 1102_linux-3.4.103.patch
20 From: http://www.kernel.org
21 Desc: Linux 3.4.103
22
23 +Patch: 1103_linux-3.4.104.patch
24 +From: http://www.kernel.org
25 +Desc: Linux 3.4.104
26 +
27 Patch: 1500_XATTR_USER_PREFIX.patch
28 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
29 Desc: Support for namespace user.pax.* on tmpfs.
30
31 diff --git a/1103_linux-3.4.104.patch b/1103_linux-3.4.104.patch
32 new file mode 100644
33 index 0000000..e868d32
34 --- /dev/null
35 +++ b/1103_linux-3.4.104.patch
36 @@ -0,0 +1,1740 @@
37 +diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt
38 +index b0714d8f678a..8dfb6a5f427d 100644
39 +--- a/Documentation/stable_kernel_rules.txt
40 ++++ b/Documentation/stable_kernel_rules.txt
41 +@@ -29,6 +29,9 @@ Rules on what kind of patches are accepted, and which ones are not, into the
42 +
43 + Procedure for submitting patches to the -stable tree:
44 +
45 ++ - If the patch covers files in net/ or drivers/net please follow netdev stable
46 ++ submission guidelines as described in
47 ++ Documentation/networking/netdev-FAQ.txt
48 + - Send the patch, after verifying that it follows the above rules, to
49 + stable@×××××××××××.org. You must note the upstream commit ID in the
50 + changelog of your submission, as well as the kernel version you wish
51 +diff --git a/Makefile b/Makefile
52 +index 36f0913bd1d6..b66396efb001 100644
53 +--- a/Makefile
54 ++++ b/Makefile
55 +@@ -1,6 +1,6 @@
56 + VERSION = 3
57 + PATCHLEVEL = 4
58 +-SUBLEVEL = 103
59 ++SUBLEVEL = 104
60 + EXTRAVERSION =
61 + NAME = Saber-toothed Squirrel
62 +
63 +diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
64 +index 7a3d38d5ed6b..5ebab5895edb 100644
65 +--- a/arch/alpha/include/asm/io.h
66 ++++ b/arch/alpha/include/asm/io.h
67 +@@ -489,6 +489,11 @@ extern inline void writeq(u64 b, volatile void __iomem *addr)
68 + }
69 + #endif
70 +
71 ++#define ioread16be(p) be16_to_cpu(ioread16(p))
72 ++#define ioread32be(p) be32_to_cpu(ioread32(p))
73 ++#define iowrite16be(v,p) iowrite16(cpu_to_be16(v), (p))
74 ++#define iowrite32be(v,p) iowrite32(cpu_to_be32(v), (p))
75 ++
76 + #define inb_p inb
77 + #define inw_p inw
78 + #define inl_p inl
79 +diff --git a/arch/alpha/oprofile/common.c b/arch/alpha/oprofile/common.c
80 +index a0a5d27aa215..b8ce18f485d3 100644
81 +--- a/arch/alpha/oprofile/common.c
82 ++++ b/arch/alpha/oprofile/common.c
83 +@@ -12,6 +12,7 @@
84 + #include <linux/smp.h>
85 + #include <linux/errno.h>
86 + #include <asm/ptrace.h>
87 ++#include <asm/special_insns.h>
88 +
89 + #include "op_impl.h"
90 +
91 +diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
92 +index 9a8531eadd3d..9d95a46b25fd 100644
93 +--- a/arch/arm/kernel/entry-header.S
94 ++++ b/arch/arm/kernel/entry-header.S
95 +@@ -76,26 +76,21 @@
96 + #ifndef CONFIG_THUMB2_KERNEL
97 + .macro svc_exit, rpsr
98 + msr spsr_cxsf, \rpsr
99 +-#if defined(CONFIG_CPU_V6)
100 +- ldr r0, [sp]
101 +- strex r1, r2, [sp] @ clear the exclusive monitor
102 +- ldmib sp, {r1 - pc}^ @ load r1 - pc, cpsr
103 +-#elif defined(CONFIG_CPU_32v6K)
104 +- clrex @ clear the exclusive monitor
105 +- ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
106 +-#else
107 +- ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
108 ++#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K)
109 ++ @ We must avoid clrex due to Cortex-A15 erratum #830321
110 ++ sub r0, sp, #4 @ uninhabited address
111 ++ strex r1, r2, [r0] @ clear the exclusive monitor
112 + #endif
113 ++ ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
114 + .endm
115 +
116 + .macro restore_user_regs, fast = 0, offset = 0
117 + ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
118 + ldr lr, [sp, #\offset + S_PC]! @ get pc
119 + msr spsr_cxsf, r1 @ save in spsr_svc
120 +-#if defined(CONFIG_CPU_V6)
121 ++#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K)
122 ++ @ We must avoid clrex due to Cortex-A15 erratum #830321
123 + strex r1, r2, [sp] @ clear the exclusive monitor
124 +-#elif defined(CONFIG_CPU_32v6K)
125 +- clrex @ clear the exclusive monitor
126 + #endif
127 + .if \fast
128 + ldmdb sp, {r1 - lr}^ @ get calling r1 - lr
129 +@@ -123,7 +118,10 @@
130 + .macro svc_exit, rpsr
131 + ldr lr, [sp, #S_SP] @ top of the stack
132 + ldrd r0, r1, [sp, #S_LR] @ calling lr and pc
133 +- clrex @ clear the exclusive monitor
134 ++
135 ++ @ We must avoid clrex due to Cortex-A15 erratum #830321
136 ++ strex r2, r1, [sp, #S_LR] @ clear the exclusive monitor
137 ++
138 + stmdb lr!, {r0, r1, \rpsr} @ calling lr and rfe context
139 + ldmia sp, {r0 - r12}
140 + mov sp, lr
141 +@@ -132,13 +130,16 @@
142 + .endm
143 +
144 + .macro restore_user_regs, fast = 0, offset = 0
145 +- clrex @ clear the exclusive monitor
146 + mov r2, sp
147 + load_user_sp_lr r2, r3, \offset + S_SP @ calling sp, lr
148 + ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
149 + ldr lr, [sp, #\offset + S_PC] @ get pc
150 + add sp, sp, #\offset + S_SP
151 + msr spsr_cxsf, r1 @ save in spsr_svc
152 ++
153 ++ @ We must avoid clrex due to Cortex-A15 erratum #830321
154 ++ strex r1, r2, [sp] @ clear the exclusive monitor
155 ++
156 + .if \fast
157 + ldmdb sp, {r1 - r12} @ get calling r1 - r12
158 + .else
159 +diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S
160 +index 80741992a9fc..5d777a567c35 100644
161 +--- a/arch/arm/mm/abort-ev6.S
162 ++++ b/arch/arm/mm/abort-ev6.S
163 +@@ -17,12 +17,6 @@
164 + */
165 + .align 5
166 + ENTRY(v6_early_abort)
167 +-#ifdef CONFIG_CPU_V6
168 +- sub r1, sp, #4 @ Get unused stack location
169 +- strex r0, r1, [r1] @ Clear the exclusive monitor
170 +-#elif defined(CONFIG_CPU_32v6K)
171 +- clrex
172 +-#endif
173 + mrc p15, 0, r1, c5, c0, 0 @ get FSR
174 + mrc p15, 0, r0, c6, c0, 0 @ get FAR
175 + /*
176 +diff --git a/arch/arm/mm/abort-ev7.S b/arch/arm/mm/abort-ev7.S
177 +index 703375277ba6..4812ad054214 100644
178 +--- a/arch/arm/mm/abort-ev7.S
179 ++++ b/arch/arm/mm/abort-ev7.S
180 +@@ -13,12 +13,6 @@
181 + */
182 + .align 5
183 + ENTRY(v7_early_abort)
184 +- /*
185 +- * The effect of data aborts on on the exclusive access monitor are
186 +- * UNPREDICTABLE. Do a CLREX to clear the state
187 +- */
188 +- clrex
189 +-
190 + mrc p15, 0, r1, c5, c0, 0 @ get FSR
191 + mrc p15, 0, r0, c6, c0, 0 @ get FAR
192 +
193 +diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
194 +index d3a9f012aa0a..b6fb65030d5e 100644
195 +--- a/arch/mips/cavium-octeon/setup.c
196 ++++ b/arch/mips/cavium-octeon/setup.c
197 +@@ -265,6 +265,18 @@ static irqreturn_t octeon_rlm_interrupt(int cpl, void *dev_id)
198 + }
199 + #endif
200 +
201 ++static char __read_mostly octeon_system_type[80];
202 ++
203 ++static int __init init_octeon_system_type(void)
204 ++{
205 ++ snprintf(octeon_system_type, sizeof(octeon_system_type), "%s (%s)",
206 ++ cvmx_board_type_to_string(octeon_bootinfo->board_type),
207 ++ octeon_model_get_string(read_c0_prid()));
208 ++
209 ++ return 0;
210 ++}
211 ++early_initcall(init_octeon_system_type);
212 ++
213 + /**
214 + * Return a string representing the system type
215 + *
216 +@@ -272,11 +284,7 @@ static irqreturn_t octeon_rlm_interrupt(int cpl, void *dev_id)
217 + */
218 + const char *octeon_board_type_string(void)
219 + {
220 +- static char name[80];
221 +- sprintf(name, "%s (%s)",
222 +- cvmx_board_type_to_string(octeon_bootinfo->board_type),
223 +- octeon_model_get_string(read_c0_prid()));
224 +- return name;
225 ++ return octeon_system_type;
226 + }
227 +
228 + const char *get_system_type(void)
229 +diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
230 +index 811084f4e422..52f60e548722 100644
231 +--- a/arch/mips/kernel/perf_event_mipsxx.c
232 ++++ b/arch/mips/kernel/perf_event_mipsxx.c
233 +@@ -162,11 +162,6 @@ static unsigned int counters_total_to_per_cpu(unsigned int counters)
234 + return counters >> vpe_shift();
235 + }
236 +
237 +-static unsigned int counters_per_cpu_to_total(unsigned int counters)
238 +-{
239 +- return counters << vpe_shift();
240 +-}
241 +-
242 + #else /* !CONFIG_MIPS_MT_SMP */
243 + #define vpe_id() 0
244 +
245 +diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
246 +index bda8eb26ece7..fdd6042843eb 100644
247 +--- a/arch/mips/mm/c-r4k.c
248 ++++ b/arch/mips/mm/c-r4k.c
249 +@@ -12,6 +12,7 @@
250 + #include <linux/highmem.h>
251 + #include <linux/kernel.h>
252 + #include <linux/linkage.h>
253 ++#include <linux/preempt.h>
254 + #include <linux/sched.h>
255 + #include <linux/smp.h>
256 + #include <linux/mm.h>
257 +@@ -598,6 +599,7 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
258 + /* Catch bad driver code */
259 + BUG_ON(size == 0);
260 +
261 ++ preempt_disable();
262 + if (cpu_has_inclusive_pcaches) {
263 + if (size >= scache_size)
264 + r4k_blast_scache();
265 +@@ -618,6 +620,7 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
266 + R4600_HIT_CACHEOP_WAR_IMPL;
267 + blast_dcache_range(addr, addr + size);
268 + }
269 ++ preempt_enable();
270 +
271 + bc_wback_inv(addr, size);
272 + __sync();
273 +@@ -628,6 +631,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
274 + /* Catch bad driver code */
275 + BUG_ON(size == 0);
276 +
277 ++ preempt_disable();
278 + if (cpu_has_inclusive_pcaches) {
279 + if (size >= scache_size)
280 + r4k_blast_scache();
281 +@@ -663,6 +667,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
282 + cache_op(Hit_Writeback_Inv_D, (addr + size - 1) & almask);
283 + blast_inv_dcache_range(addr, addr + size);
284 + }
285 ++ preempt_enable();
286 +
287 + bc_inv(addr, size);
288 + __sync();
289 +diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S
290 +index 1088b5fca3bd..27451968e45c 100644
291 +--- a/arch/openrisc/kernel/head.S
292 ++++ b/arch/openrisc/kernel/head.S
293 +@@ -19,6 +19,7 @@
294 + #include <linux/threads.h>
295 + #include <linux/errno.h>
296 + #include <linux/init.h>
297 ++#include <linux/serial_reg.h>
298 + #include <asm/processor.h>
299 + #include <asm/page.h>
300 + #include <asm/mmu.h>
301 +diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
302 +index eeb8054c7cd8..1f3e9ea1cf90 100644
303 +--- a/arch/unicore32/Kconfig
304 ++++ b/arch/unicore32/Kconfig
305 +@@ -6,6 +6,7 @@ config UNICORE32
306 + select HAVE_DMA_ATTRS
307 + select HAVE_KERNEL_GZIP
308 + select HAVE_KERNEL_BZIP2
309 ++ select GENERIC_ATOMIC64
310 + select HAVE_KERNEL_LZO
311 + select HAVE_KERNEL_LZMA
312 + select GENERIC_FIND_FIRST_BIT
313 +diff --git a/arch/unicore32/include/asm/bug.h b/arch/unicore32/include/asm/bug.h
314 +index b1ff8cadb086..93a56f3e2344 100644
315 +--- a/arch/unicore32/include/asm/bug.h
316 ++++ b/arch/unicore32/include/asm/bug.h
317 +@@ -19,9 +19,4 @@ extern void die(const char *msg, struct pt_regs *regs, int err);
318 + extern void uc32_notify_die(const char *str, struct pt_regs *regs,
319 + struct siginfo *info, unsigned long err, unsigned long trap);
320 +
321 +-extern asmlinkage void __backtrace(void);
322 +-extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
323 +-
324 +-extern void __show_regs(struct pt_regs *);
325 +-
326 + #endif /* __UNICORE_BUG_H__ */
327 +diff --git a/arch/unicore32/include/asm/cmpxchg.h b/arch/unicore32/include/asm/cmpxchg.h
328 +index df4d5acfd19f..8e797ad4fa24 100644
329 +--- a/arch/unicore32/include/asm/cmpxchg.h
330 ++++ b/arch/unicore32/include/asm/cmpxchg.h
331 +@@ -35,7 +35,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
332 + : "memory", "cc");
333 + break;
334 + default:
335 +- ret = __xchg_bad_pointer();
336 ++ __xchg_bad_pointer();
337 + }
338 +
339 + return ret;
340 +diff --git a/arch/unicore32/kernel/setup.h b/arch/unicore32/kernel/setup.h
341 +index f23955028a18..30f749da8f73 100644
342 +--- a/arch/unicore32/kernel/setup.h
343 ++++ b/arch/unicore32/kernel/setup.h
344 +@@ -30,4 +30,10 @@ extern char __vectors_start[], __vectors_end[];
345 + extern void kernel_thread_helper(void);
346 +
347 + extern void __init early_signal_init(void);
348 ++
349 ++extern asmlinkage void __backtrace(void);
350 ++extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
351 ++
352 ++extern void __show_regs(struct pt_regs *);
353 ++
354 + #endif
355 +diff --git a/arch/xtensa/include/asm/ioctls.h b/arch/xtensa/include/asm/ioctls.h
356 +index fd1d1369a407..96341aabceb8 100644
357 +--- a/arch/xtensa/include/asm/ioctls.h
358 ++++ b/arch/xtensa/include/asm/ioctls.h
359 +@@ -28,17 +28,17 @@
360 + #define TCSETSW 0x5403
361 + #define TCSETSF 0x5404
362 +
363 +-#define TCGETA _IOR('t', 23, struct termio)
364 +-#define TCSETA _IOW('t', 24, struct termio)
365 +-#define TCSETAW _IOW('t', 25, struct termio)
366 +-#define TCSETAF _IOW('t', 28, struct termio)
367 ++#define TCGETA 0x80127417 /* _IOR('t', 23, struct termio) */
368 ++#define TCSETA 0x40127418 /* _IOW('t', 24, struct termio) */
369 ++#define TCSETAW 0x40127419 /* _IOW('t', 25, struct termio) */
370 ++#define TCSETAF 0x4012741C /* _IOW('t', 28, struct termio) */
371 +
372 + #define TCSBRK _IO('t', 29)
373 + #define TCXONC _IO('t', 30)
374 + #define TCFLSH _IO('t', 31)
375 +
376 +-#define TIOCSWINSZ _IOW('t', 103, struct winsize)
377 +-#define TIOCGWINSZ _IOR('t', 104, struct winsize)
378 ++#define TIOCSWINSZ 0x40087467 /* _IOW('t', 103, struct winsize) */
379 ++#define TIOCGWINSZ 0x80087468 /* _IOR('t', 104, struct winsize) */
380 + #define TIOCSTART _IO('t', 110) /* start output, like ^Q */
381 + #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
382 + #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
383 +@@ -88,7 +88,6 @@
384 + #define TIOCSETD _IOW('T', 35, int)
385 + #define TIOCGETD _IOR('T', 36, int)
386 + #define TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/
387 +-#define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* For debugging only*/
388 + #define TIOCSBRK _IO('T', 39) /* BSD compatibility */
389 + #define TIOCCBRK _IO('T', 40) /* BSD compatibility */
390 + #define TIOCGSID _IOR('T', 41, pid_t) /* Return the session ID of FD*/
391 +@@ -111,8 +110,10 @@
392 + #define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */
393 + /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
394 + # define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
395 +-#define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* Get multiport config */
396 +-#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* Set multiport config */
397 ++#define TIOCSERGETMULTI 0x80a8545a /* Get multiport config */
398 ++ /* _IOR('T', 90, struct serial_multiport_struct) */
399 ++#define TIOCSERSETMULTI 0x40a8545b /* Set multiport config */
400 ++ /* _IOW('T', 91, struct serial_multiport_struct) */
401 +
402 + #define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */
403 + #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
404 +diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
405 +index b03c043ce75b..7eeaf22fc7b3 100644
406 +--- a/arch/xtensa/include/asm/pgtable.h
407 ++++ b/arch/xtensa/include/asm/pgtable.h
408 +@@ -68,7 +68,12 @@
409 + #define VMALLOC_START 0xC0000000
410 + #define VMALLOC_END 0xC7FEFFFF
411 + #define TLBTEMP_BASE_1 0xC7FF0000
412 +-#define TLBTEMP_BASE_2 0xC7FF8000
413 ++#define TLBTEMP_BASE_2 (TLBTEMP_BASE_1 + DCACHE_WAY_SIZE)
414 ++#if 2 * DCACHE_WAY_SIZE > ICACHE_WAY_SIZE
415 ++#define TLBTEMP_SIZE (2 * DCACHE_WAY_SIZE)
416 ++#else
417 ++#define TLBTEMP_SIZE ICACHE_WAY_SIZE
418 ++#endif
419 +
420 + /*
421 + * Xtensa Linux config PTE layout (when present):
422 +diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
423 +index 6223f3346b5c..e01cffcc35d1 100644
424 +--- a/arch/xtensa/kernel/entry.S
425 ++++ b/arch/xtensa/kernel/entry.S
426 +@@ -1053,9 +1053,8 @@ ENTRY(fast_syscall_xtensa)
427 + movi a7, 4 # sizeof(unsigned int)
428 + access_ok a3, a7, a0, a2, .Leac # a0: scratch reg, a2: sp
429 +
430 +- addi a6, a6, -1 # assuming SYS_XTENSA_ATOMIC_SET = 1
431 +- _bgeui a6, SYS_XTENSA_COUNT - 1, .Lill
432 +- _bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP - 1, .Lnswp
433 ++ _bgeui a6, SYS_XTENSA_COUNT, .Lill
434 ++ _bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP, .Lnswp
435 +
436 + /* Fall through for ATOMIC_CMP_SWP. */
437 +
438 +@@ -1067,27 +1066,26 @@ TRY s32i a5, a3, 0 # different, modify value
439 + l32i a7, a2, PT_AREG7 # restore a7
440 + l32i a0, a2, PT_AREG0 # restore a0
441 + movi a2, 1 # and return 1
442 +- addi a6, a6, 1 # restore a6 (really necessary?)
443 + rfe
444 +
445 + 1: l32i a7, a2, PT_AREG7 # restore a7
446 + l32i a0, a2, PT_AREG0 # restore a0
447 + movi a2, 0 # return 0 (note that we cannot set
448 +- addi a6, a6, 1 # restore a6 (really necessary?)
449 + rfe
450 +
451 + .Lnswp: /* Atomic set, add, and exg_add. */
452 +
453 + TRY l32i a7, a3, 0 # orig
454 ++ addi a6, a6, -SYS_XTENSA_ATOMIC_SET
455 + add a0, a4, a7 # + arg
456 + moveqz a0, a4, a6 # set
457 ++ addi a6, a6, SYS_XTENSA_ATOMIC_SET
458 + TRY s32i a0, a3, 0 # write new value
459 +
460 + mov a0, a2
461 + mov a2, a7
462 + l32i a7, a0, PT_AREG7 # restore a7
463 + l32i a0, a0, PT_AREG0 # restore a0
464 +- addi a6, a6, 1 # restore a6 (really necessary?)
465 + rfe
466 +
467 + CATCH
468 +@@ -1096,7 +1094,7 @@ CATCH
469 + movi a2, -EFAULT
470 + rfe
471 +
472 +-.Lill: l32i a7, a2, PT_AREG0 # restore a7
473 ++.Lill: l32i a7, a2, PT_AREG7 # restore a7
474 + l32i a0, a2, PT_AREG0 # restore a0
475 + movi a2, -EINVAL
476 + rfe
477 +@@ -1629,7 +1627,7 @@ ENTRY(fast_second_level_miss)
478 + rsr a0, EXCVADDR
479 + bltu a0, a3, 2f
480 +
481 +- addi a1, a0, -(2 << (DCACHE_ALIAS_ORDER + PAGE_SHIFT))
482 ++ addi a1, a0, -TLBTEMP_SIZE
483 + bgeu a1, a3, 2f
484 +
485 + /* Check if we have to restore an ITLB mapping. */
486 +diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
487 +index 2783fda76ddc..c055c91a96e6 100644
488 +--- a/arch/xtensa/kernel/pci-dma.c
489 ++++ b/arch/xtensa/kernel/pci-dma.c
490 +@@ -48,9 +48,8 @@ dma_alloc_coherent(struct device *dev,size_t size,dma_addr_t *handle,gfp_t flag)
491 +
492 + /* We currently don't support coherent memory outside KSEG */
493 +
494 +- if (ret < XCHAL_KSEG_CACHED_VADDR
495 +- || ret >= XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE)
496 +- BUG();
497 ++ BUG_ON(ret < XCHAL_KSEG_CACHED_VADDR ||
498 ++ ret > XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE - 1);
499 +
500 +
501 + if (ret != 0) {
502 +@@ -66,10 +65,11 @@ dma_alloc_coherent(struct device *dev,size_t size,dma_addr_t *handle,gfp_t flag)
503 + void dma_free_coherent(struct device *hwdev, size_t size,
504 + void *vaddr, dma_addr_t dma_handle)
505 + {
506 +- long addr=(long)vaddr+XCHAL_KSEG_CACHED_VADDR-XCHAL_KSEG_BYPASS_VADDR;
507 ++ unsigned long addr = (unsigned long)vaddr +
508 ++ XCHAL_KSEG_CACHED_VADDR - XCHAL_KSEG_BYPASS_VADDR;
509 +
510 +- if (addr < 0 || addr >= XCHAL_KSEG_SIZE)
511 +- BUG();
512 ++ BUG_ON(addr < XCHAL_KSEG_CACHED_VADDR ||
513 ++ addr > XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE - 1);
514 +
515 + free_pages(addr, get_order(size));
516 + }
517 +diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
518 +index e265f835c95d..19759d3df45a 100644
519 +--- a/drivers/ata/pata_scc.c
520 ++++ b/drivers/ata/pata_scc.c
521 +@@ -586,7 +586,7 @@ static int scc_wait_after_reset(struct ata_link *link, unsigned int devmask,
522 + * Note: Original code is ata_bus_softreset().
523 + */
524 +
525 +-static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask,
526 ++static int scc_bus_softreset(struct ata_port *ap, unsigned int devmask,
527 + unsigned long deadline)
528 + {
529 + struct ata_ioports *ioaddr = &ap->ioaddr;
530 +@@ -600,9 +600,7 @@ static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask,
531 + udelay(20);
532 + out_be32(ioaddr->ctl_addr, ap->ctl);
533 +
534 +- scc_wait_after_reset(&ap->link, devmask, deadline);
535 +-
536 +- return 0;
537 ++ return scc_wait_after_reset(&ap->link, devmask, deadline);
538 + }
539 +
540 + /**
541 +@@ -619,7 +617,8 @@ static int scc_softreset(struct ata_link *link, unsigned int *classes,
542 + {
543 + struct ata_port *ap = link->ap;
544 + unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
545 +- unsigned int devmask = 0, err_mask;
546 ++ unsigned int devmask = 0;
547 ++ int rc;
548 + u8 err;
549 +
550 + DPRINTK("ENTER\n");
551 +@@ -635,9 +634,9 @@ static int scc_softreset(struct ata_link *link, unsigned int *classes,
552 +
553 + /* issue bus reset */
554 + DPRINTK("about to softreset, devmask=%x\n", devmask);
555 +- err_mask = scc_bus_softreset(ap, devmask, deadline);
556 +- if (err_mask) {
557 +- ata_port_err(ap, "SRST failed (err_mask=0x%x)\n", err_mask);
558 ++ rc = scc_bus_softreset(ap, devmask, deadline);
559 ++ if (rc) {
560 ++ ata_port_err(ap, "SRST failed (err_mask=0x%x)\n", rc);
561 + return -EIO;
562 + }
563 +
564 +diff --git a/drivers/hid/hid-cherry.c b/drivers/hid/hid-cherry.c
565 +index 888ece68a47c..f870bb3a3264 100644
566 +--- a/drivers/hid/hid-cherry.c
567 ++++ b/drivers/hid/hid-cherry.c
568 +@@ -29,7 +29,7 @@
569 + static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
570 + unsigned int *rsize)
571 + {
572 +- if (*rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) {
573 ++ if (*rsize >= 18 && rdesc[11] == 0x3c && rdesc[12] == 0x02) {
574 + hid_info(hdev, "fixing up Cherry Cymotion report descriptor\n");
575 + rdesc[11] = rdesc[16] = 0xff;
576 + rdesc[12] = rdesc[17] = 0x03;
577 +diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c
578 +index b4f0d8216fd0..d7118f8ed34c 100644
579 +--- a/drivers/hid/hid-kye.c
580 ++++ b/drivers/hid/hid-kye.c
581 +@@ -282,7 +282,7 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
582 + * - change the button usage range to 4-7 for the extra
583 + * buttons
584 + */
585 +- if (*rsize >= 74 &&
586 ++ if (*rsize >= 75 &&
587 + rdesc[61] == 0x05 && rdesc[62] == 0x08 &&
588 + rdesc[63] == 0x19 && rdesc[64] == 0x08 &&
589 + rdesc[65] == 0x29 && rdesc[66] == 0x0f &&
590 +diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
591 +index e7a7bd1eb34a..cb01e67a5431 100644
592 +--- a/drivers/hid/hid-lg.c
593 ++++ b/drivers/hid/hid-lg.c
594 +@@ -111,7 +111,7 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
595 + {
596 + unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
597 +
598 +- if ((quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 &&
599 ++ if ((quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 &&
600 + rdesc[84] == 0x8c && rdesc[85] == 0x02) {
601 + hid_info(hdev,
602 + "fixing up Logitech keyboard report descriptor\n");
603 +@@ -120,7 +120,7 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
604 + }
605 + if ((quirks & LG_RDESC_REL_ABS) && *rsize >= 50 &&
606 + rdesc[32] == 0x81 && rdesc[33] == 0x06 &&
607 +- rdesc[49] == 0x81 && rdesc[50] == 0x06) {
608 ++ rdesc[49] == 0x81 && rdesc[51] == 0x06) {
609 + hid_info(hdev,
610 + "fixing up rel/abs in Logitech report descriptor\n");
611 + rdesc[33] = rdesc[50] = 0x02;
612 +diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
613 +index 3bfd74f1ad49..f009ab2df768 100644
614 +--- a/drivers/hid/hid-logitech-dj.c
615 ++++ b/drivers/hid/hid-logitech-dj.c
616 +@@ -230,13 +230,6 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
617 + return;
618 + }
619 +
620 +- if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) ||
621 +- (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) {
622 +- dev_err(&djrcv_hdev->dev, "%s: invalid device index:%d\n",
623 +- __func__, dj_report->device_index);
624 +- return;
625 +- }
626 +-
627 + if (djrcv_dev->paired_dj_devices[dj_report->device_index]) {
628 + /* The device is already known. No need to reallocate it. */
629 + dbg_hid("%s: device is already known\n", __func__);
630 +@@ -688,7 +681,6 @@ static int logi_dj_raw_event(struct hid_device *hdev,
631 + struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
632 + struct dj_report *dj_report = (struct dj_report *) data;
633 + unsigned long flags;
634 +- bool report_processed = false;
635 +
636 + dbg_hid("%s, size:%d\n", __func__, size);
637 +
638 +@@ -716,27 +708,41 @@ static int logi_dj_raw_event(struct hid_device *hdev,
639 + * anything else with it.
640 + */
641 +
642 ++ /* case 1) */
643 ++ if (data[0] != REPORT_ID_DJ_SHORT)
644 ++ return false;
645 ++
646 ++ if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) ||
647 ++ (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) {
648 ++ /*
649 ++ * Device index is wrong, bail out.
650 ++ * This driver can ignore safely the receiver notifications,
651 ++ * so ignore those reports too.
652 ++ */
653 ++ if (dj_report->device_index != DJ_RECEIVER_INDEX)
654 ++ dev_err(&hdev->dev, "%s: invalid device index:%d\n",
655 ++ __func__, dj_report->device_index);
656 ++ return false;
657 ++ }
658 ++
659 + spin_lock_irqsave(&djrcv_dev->lock, flags);
660 +- if (dj_report->report_id == REPORT_ID_DJ_SHORT) {
661 +- switch (dj_report->report_type) {
662 +- case REPORT_TYPE_NOTIF_DEVICE_PAIRED:
663 +- case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED:
664 +- logi_dj_recv_queue_notification(djrcv_dev, dj_report);
665 +- break;
666 +- case REPORT_TYPE_NOTIF_CONNECTION_STATUS:
667 +- if (dj_report->report_params[CONNECTION_STATUS_PARAM_STATUS] ==
668 +- STATUS_LINKLOSS) {
669 +- logi_dj_recv_forward_null_report(djrcv_dev, dj_report);
670 +- }
671 +- break;
672 +- default:
673 +- logi_dj_recv_forward_report(djrcv_dev, dj_report);
674 ++ switch (dj_report->report_type) {
675 ++ case REPORT_TYPE_NOTIF_DEVICE_PAIRED:
676 ++ case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED:
677 ++ logi_dj_recv_queue_notification(djrcv_dev, dj_report);
678 ++ break;
679 ++ case REPORT_TYPE_NOTIF_CONNECTION_STATUS:
680 ++ if (dj_report->report_params[CONNECTION_STATUS_PARAM_STATUS] ==
681 ++ STATUS_LINKLOSS) {
682 ++ logi_dj_recv_forward_null_report(djrcv_dev, dj_report);
683 + }
684 +- report_processed = true;
685 ++ break;
686 ++ default:
687 ++ logi_dj_recv_forward_report(djrcv_dev, dj_report);
688 + }
689 + spin_unlock_irqrestore(&djrcv_dev->lock, flags);
690 +
691 +- return report_processed;
692 ++ return true;
693 + }
694 +
695 + static int logi_dj_probe(struct hid_device *hdev,
696 +diff --git a/drivers/hid/hid-logitech-dj.h b/drivers/hid/hid-logitech-dj.h
697 +index 4a4000340ce1..daeb0aa4bee9 100644
698 +--- a/drivers/hid/hid-logitech-dj.h
699 ++++ b/drivers/hid/hid-logitech-dj.h
700 +@@ -27,6 +27,7 @@
701 +
702 + #define DJ_MAX_PAIRED_DEVICES 6
703 + #define DJ_MAX_NUMBER_NOTIFICATIONS 8
704 ++#define DJ_RECEIVER_INDEX 0
705 + #define DJ_DEVICE_INDEX_MIN 1
706 + #define DJ_DEVICE_INDEX_MAX 6
707 +
708 +diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
709 +index 7cf3ffe4b7bc..81356f6f1580 100644
710 +--- a/drivers/hid/hid-magicmouse.c
711 ++++ b/drivers/hid/hid-magicmouse.c
712 +@@ -308,6 +308,11 @@ static int magicmouse_raw_event(struct hid_device *hdev,
713 + if (size < 4 || ((size - 4) % 9) != 0)
714 + return 0;
715 + npoints = (size - 4) / 9;
716 ++ if (npoints > 15) {
717 ++ hid_warn(hdev, "invalid size value (%d) for TRACKPAD_REPORT_ID\n",
718 ++ size);
719 ++ return 0;
720 ++ }
721 + msc->ntouches = 0;
722 + for (ii = 0; ii < npoints; ii++)
723 + magicmouse_emit_touch(msc, ii, data + ii * 9 + 4);
724 +@@ -331,6 +336,11 @@ static int magicmouse_raw_event(struct hid_device *hdev,
725 + if (size < 6 || ((size - 6) % 8) != 0)
726 + return 0;
727 + npoints = (size - 6) / 8;
728 ++ if (npoints > 15) {
729 ++ hid_warn(hdev, "invalid size value (%d) for MOUSE_REPORT_ID\n",
730 ++ size);
731 ++ return 0;
732 ++ }
733 + msc->ntouches = 0;
734 + for (ii = 0; ii < npoints; ii++)
735 + magicmouse_emit_touch(msc, ii, data + ii * 8 + 6);
736 +diff --git a/drivers/hid/hid-monterey.c b/drivers/hid/hid-monterey.c
737 +index dedf757781ae..eb0271e115c1 100644
738 +--- a/drivers/hid/hid-monterey.c
739 ++++ b/drivers/hid/hid-monterey.c
740 +@@ -25,7 +25,7 @@
741 + static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
742 + unsigned int *rsize)
743 + {
744 +- if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) {
745 ++ if (*rsize >= 31 && rdesc[29] == 0x05 && rdesc[30] == 0x09) {
746 + hid_info(hdev, "fixing up button/consumer in HID report descriptor\n");
747 + rdesc[30] = 0x0c;
748 + }
749 +diff --git a/drivers/hid/hid-petalynx.c b/drivers/hid/hid-petalynx.c
750 +index f1ea3ff8a98d..99f317ac649a 100644
751 +--- a/drivers/hid/hid-petalynx.c
752 ++++ b/drivers/hid/hid-petalynx.c
753 +@@ -26,7 +26,7 @@
754 + static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc,
755 + unsigned int *rsize)
756 + {
757 +- if (*rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 &&
758 ++ if (*rsize >= 62 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 &&
759 + rdesc[41] == 0x00 && rdesc[59] == 0x26 &&
760 + rdesc[60] == 0xf9 && rdesc[61] == 0x00) {
761 + hid_info(hdev, "fixing up Petalynx Maxter Remote report descriptor\n");
762 +diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
763 +index 95f90479f285..4e37b1f4c7e2 100644
764 +--- a/drivers/hid/hid-picolcd.c
765 ++++ b/drivers/hid/hid-picolcd.c
766 +@@ -2370,6 +2370,12 @@ static int picolcd_raw_event(struct hid_device *hdev,
767 + if (!data)
768 + return 1;
769 +
770 ++ if (size > 64) {
771 ++ hid_warn(hdev, "invalid size value (%d) for picolcd raw event\n",
772 ++ size);
773 ++ return 0;
774 ++ }
775 ++
776 + if (report->id == REPORT_KEY_STATE) {
777 + if (data->input_keys)
778 + ret = picolcd_raw_keypad(data, report, raw_data+1, size-1);
779 +diff --git a/drivers/hid/hid-sunplus.c b/drivers/hid/hid-sunplus.c
780 +index d484a0043dd4..3d6ae7bbc25b 100644
781 +--- a/drivers/hid/hid-sunplus.c
782 ++++ b/drivers/hid/hid-sunplus.c
783 +@@ -25,7 +25,7 @@
784 + static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
785 + unsigned int *rsize)
786 + {
787 +- if (*rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 &&
788 ++ if (*rsize >= 112 && rdesc[104] == 0x26 && rdesc[105] == 0x80 &&
789 + rdesc[106] == 0x03) {
790 + hid_info(hdev, "fixing up Sunplus Wireless Desktop report descriptor\n");
791 + rdesc[105] = rdesc[110] = 0x03;
792 +diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
793 +index c0536eda58e9..a55353c37b3d 100644
794 +--- a/drivers/iommu/amd_iommu.c
795 ++++ b/drivers/iommu/amd_iommu.c
796 +@@ -3028,14 +3028,16 @@ free_domains:
797 +
798 + static void cleanup_domain(struct protection_domain *domain)
799 + {
800 +- struct iommu_dev_data *dev_data, *next;
801 ++ struct iommu_dev_data *entry;
802 + unsigned long flags;
803 +
804 + write_lock_irqsave(&amd_iommu_devtable_lock, flags);
805 +
806 +- list_for_each_entry_safe(dev_data, next, &domain->dev_list, list) {
807 +- __detach_device(dev_data);
808 +- atomic_set(&dev_data->bind, 0);
809 ++ while (!list_empty(&domain->dev_list)) {
810 ++ entry = list_first_entry(&domain->dev_list,
811 ++ struct iommu_dev_data, list);
812 ++ __detach_device(entry);
813 ++ atomic_set(&entry->bind, 0);
814 + }
815 +
816 + write_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
817 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
818 +index 17b918d3d6b3..c276ad09ace9 100644
819 +--- a/drivers/md/raid5.c
820 ++++ b/drivers/md/raid5.c
821 +@@ -3433,6 +3433,8 @@ static void handle_stripe(struct stripe_head *sh)
822 + set_bit(R5_Wantwrite, &dev->flags);
823 + if (prexor)
824 + continue;
825 ++ if (s.failed > 1)
826 ++ continue;
827 + if (!test_bit(R5_Insync, &dev->flags) ||
828 + ((i == sh->pd_idx || i == sh->qd_idx) &&
829 + s.failed == 0))
830 +diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
831 +index 33a17609dd0e..b2b715fdccd7 100644
832 +--- a/drivers/net/ethernet/ibm/ibmveth.c
833 ++++ b/drivers/net/ethernet/ibm/ibmveth.c
834 +@@ -293,6 +293,18 @@ failure:
835 + atomic_add(buffers_added, &(pool->available));
836 + }
837 +
838 ++/*
839 ++ * The final 8 bytes of the buffer list is a counter of frames dropped
840 ++ * because there was not a buffer in the buffer list capable of holding
841 ++ * the frame.
842 ++ */
843 ++static void ibmveth_update_rx_no_buffer(struct ibmveth_adapter *adapter)
844 ++{
845 ++ __be64 *p = adapter->buffer_list_addr + 4096 - 8;
846 ++
847 ++ adapter->rx_no_buffer = be64_to_cpup(p);
848 ++}
849 ++
850 + /* replenish routine */
851 + static void ibmveth_replenish_task(struct ibmveth_adapter *adapter)
852 + {
853 +@@ -308,8 +320,7 @@ static void ibmveth_replenish_task(struct ibmveth_adapter *adapter)
854 + ibmveth_replenish_buffer_pool(adapter, pool);
855 + }
856 +
857 +- adapter->rx_no_buffer = *(u64 *)(((char*)adapter->buffer_list_addr) +
858 +- 4096 - 8);
859 ++ ibmveth_update_rx_no_buffer(adapter);
860 + }
861 +
862 + /* empty and free ana buffer pool - also used to do cleanup in error paths */
863 +@@ -692,8 +703,7 @@ static int ibmveth_close(struct net_device *netdev)
864 +
865 + free_irq(netdev->irq, netdev);
866 +
867 +- adapter->rx_no_buffer = *(u64 *)(((char *)adapter->buffer_list_addr) +
868 +- 4096 - 8);
869 ++ ibmveth_update_rx_no_buffer(adapter);
870 +
871 + ibmveth_cleanup(adapter);
872 +
873 +diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
874 +index 886f5650444e..6a271e91e88b 100644
875 +--- a/drivers/staging/et131x/et131x.c
876 ++++ b/drivers/staging/et131x/et131x.c
877 +@@ -1478,22 +1478,16 @@ static int et131x_mii_read(struct et131x_adapter *adapter, u8 reg, u16 *value)
878 + *
879 + * Return 0 on success, errno on failure (as defined in errno.h)
880 + */
881 +-static int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value)
882 ++static int et131x_mii_write(struct et131x_adapter *adapter, u8 addr, u8 reg,
883 ++ u16 value)
884 + {
885 + struct mac_regs __iomem *mac = &adapter->regs->mac;
886 +- struct phy_device *phydev = adapter->phydev;
887 + int status = 0;
888 +- u8 addr;
889 + u32 delay = 0;
890 + u32 mii_addr;
891 + u32 mii_cmd;
892 + u32 mii_indicator;
893 +
894 +- if (!phydev)
895 +- return -EIO;
896 +-
897 +- addr = phydev->addr;
898 +-
899 + /* Save a local copy of the registers we are dealing with so we can
900 + * set them back
901 + */
902 +@@ -1550,6 +1544,7 @@ static void et1310_phy_access_mii_bit(struct et131x_adapter *adapter,
903 + {
904 + u16 reg;
905 + u16 mask = 0x0001 << bitnum;
906 ++ struct phy_device *phydev = adapter->phydev;
907 +
908 + /* Read the requested register */
909 + et131x_mii_read(adapter, regnum, &reg);
910 +@@ -1560,11 +1555,11 @@ static void et1310_phy_access_mii_bit(struct et131x_adapter *adapter,
911 + break;
912 +
913 + case TRUEPHY_BIT_SET:
914 +- et131x_mii_write(adapter, regnum, reg | mask);
915 ++ et131x_mii_write(adapter, phydev->addr, regnum, reg | mask);
916 + break;
917 +
918 + case TRUEPHY_BIT_CLEAR:
919 +- et131x_mii_write(adapter, regnum, reg & ~mask);
920 ++ et131x_mii_write(adapter, phydev->addr, regnum, reg & ~mask);
921 + break;
922 +
923 + default:
924 +@@ -1715,17 +1710,7 @@ static int et131x_mdio_write(struct mii_bus *bus, int phy_addr, int reg, u16 val
925 + struct net_device *netdev = bus->priv;
926 + struct et131x_adapter *adapter = netdev_priv(netdev);
927 +
928 +- return et131x_mii_write(adapter, reg, value);
929 +-}
930 +-
931 +-static int et131x_mdio_reset(struct mii_bus *bus)
932 +-{
933 +- struct net_device *netdev = bus->priv;
934 +- struct et131x_adapter *adapter = netdev_priv(netdev);
935 +-
936 +- et131x_mii_write(adapter, MII_BMCR, BMCR_RESET);
937 +-
938 +- return 0;
939 ++ return et131x_mii_write(adapter, phy_addr, reg, value);
940 + }
941 +
942 + /**
943 +@@ -1741,12 +1726,13 @@ static int et131x_mdio_reset(struct mii_bus *bus)
944 + static void et1310_phy_power_down(struct et131x_adapter *adapter, bool down)
945 + {
946 + u16 data;
947 ++ struct phy_device *phydev = adapter->phydev;
948 +
949 + et131x_mii_read(adapter, MII_BMCR, &data);
950 + data &= ~BMCR_PDOWN;
951 + if (down)
952 + data |= BMCR_PDOWN;
953 +- et131x_mii_write(adapter, MII_BMCR, data);
954 ++ et131x_mii_write(adapter, phydev->addr, MII_BMCR, data);
955 + }
956 +
957 + /**
958 +@@ -1759,6 +1745,7 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter)
959 + u16 imr;
960 + u16 isr;
961 + u16 lcr2;
962 ++ struct phy_device *phydev = adapter->phydev;
963 +
964 + et131x_mii_read(adapter, PHY_INTERRUPT_STATUS, &isr);
965 + et131x_mii_read(adapter, PHY_INTERRUPT_MASK, &imr);
966 +@@ -1770,7 +1757,7 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter)
967 + ET_PHY_INT_MASK_LINKSTAT &
968 + ET_PHY_INT_MASK_ENABLE);
969 +
970 +- et131x_mii_write(adapter, PHY_INTERRUPT_MASK, imr);
971 ++ et131x_mii_write(adapter, phydev->addr, PHY_INTERRUPT_MASK, imr);
972 +
973 + /* Set the LED behavior such that LED 1 indicates speed (off =
974 + * 10Mbits, blink = 100Mbits, on = 1000Mbits) and LED 2 indicates
975 +@@ -1791,7 +1778,7 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter)
976 + else
977 + lcr2 |= (LED_VAL_LINKON << LED_TXRX_SHIFT);
978 +
979 +- et131x_mii_write(adapter, PHY_LED_2, lcr2);
980 ++ et131x_mii_write(adapter, phydev->addr, PHY_LED_2, lcr2);
981 + }
982 + }
983 +
984 +@@ -4202,14 +4189,14 @@ static void et131x_adjust_link(struct net_device *netdev)
985 +
986 + et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG,
987 + &register18);
988 +- et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
989 +- register18 | 0x4);
990 +- et131x_mii_write(adapter, PHY_INDEX_REG,
991 ++ et131x_mii_write(adapter, phydev->addr,
992 ++ PHY_MPHY_CONTROL_REG, register18 | 0x4);
993 ++ et131x_mii_write(adapter, phydev->addr, PHY_INDEX_REG,
994 + register18 | 0x8402);
995 +- et131x_mii_write(adapter, PHY_DATA_REG,
996 ++ et131x_mii_write(adapter, phydev->addr, PHY_DATA_REG,
997 + register18 | 511);
998 +- et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
999 +- register18);
1000 ++ et131x_mii_write(adapter, phydev->addr,
1001 ++ PHY_MPHY_CONTROL_REG, register18);
1002 + }
1003 +
1004 + et1310_config_flow_control(adapter);
1005 +@@ -4221,7 +4208,8 @@ static void et131x_adjust_link(struct net_device *netdev)
1006 + et131x_mii_read(adapter, PHY_CONFIG, &reg);
1007 + reg &= ~ET_PHY_CONFIG_TX_FIFO_DEPTH;
1008 + reg |= ET_PHY_CONFIG_FIFO_DEPTH_32;
1009 +- et131x_mii_write(adapter, PHY_CONFIG, reg);
1010 ++ et131x_mii_write(adapter, phydev->addr, PHY_CONFIG,
1011 ++ reg);
1012 + }
1013 +
1014 + et131x_set_rx_dma_timer(adapter);
1015 +@@ -4254,14 +4242,17 @@ static void et131x_adjust_link(struct net_device *netdev)
1016 +
1017 + et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG,
1018 + &register18);
1019 +- et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
1020 +- register18 | 0x4);
1021 +- et131x_mii_write(adapter, PHY_INDEX_REG,
1022 +- register18 | 0x8402);
1023 +- et131x_mii_write(adapter, PHY_DATA_REG,
1024 +- register18 | 511);
1025 +- et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
1026 +- register18);
1027 ++ et131x_mii_write(adapter, phydev->addr,
1028 ++ PHY_MPHY_CONTROL_REG,
1029 ++ register18 | 0x4);
1030 ++ et131x_mii_write(adapter, phydev->addr,
1031 ++ PHY_INDEX_REG,
1032 ++ register18 | 0x8402);
1033 ++ et131x_mii_write(adapter, phydev->addr,
1034 ++ PHY_DATA_REG, register18 | 511);
1035 ++ et131x_mii_write(adapter, phydev->addr,
1036 ++ PHY_MPHY_CONTROL_REG,
1037 ++ register18);
1038 + }
1039 +
1040 + /* Free the packets being actively sent & stopped */
1041 +@@ -5343,10 +5334,6 @@ static int __devinit et131x_pci_setup(struct pci_dev *pdev,
1042 + /* Copy address into the net_device struct */
1043 + memcpy(netdev->dev_addr, adapter->addr, ETH_ALEN);
1044 +
1045 +- /* Init variable for counting how long we do not have link status */
1046 +- adapter->boot_coma = 0;
1047 +- et1310_disable_phy_coma(adapter);
1048 +-
1049 + rc = -ENOMEM;
1050 +
1051 + /* Setup the mii_bus struct */
1052 +@@ -5362,7 +5349,6 @@ static int __devinit et131x_pci_setup(struct pci_dev *pdev,
1053 + adapter->mii_bus->priv = netdev;
1054 + adapter->mii_bus->read = et131x_mdio_read;
1055 + adapter->mii_bus->write = et131x_mdio_write;
1056 +- adapter->mii_bus->reset = et131x_mdio_reset;
1057 + adapter->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
1058 + if (!adapter->mii_bus->irq) {
1059 + dev_err(&pdev->dev, "mii_bus irq allocation failed\n");
1060 +@@ -5387,6 +5373,10 @@ static int __devinit et131x_pci_setup(struct pci_dev *pdev,
1061 + /* Setup et1310 as per the documentation */
1062 + et131x_adapter_setup(adapter);
1063 +
1064 ++ /* Init variable for counting how long we do not have link status */
1065 ++ adapter->boot_coma = 0;
1066 ++ et1310_disable_phy_coma(adapter);
1067 ++
1068 + /* We can enable interrupts now
1069 + *
1070 + * NOTE - Because registration of interrupt handler is done in the
1071 +diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
1072 +index c48cf891e6bc..d53f39668044 100644
1073 +--- a/drivers/tty/serial/8250/8250_pci.c
1074 ++++ b/drivers/tty/serial/8250/8250_pci.c
1075 +@@ -1080,12 +1080,12 @@ pci_omegapci_setup(struct serial_private *priv,
1076 + static int
1077 + pci_brcm_trumanage_setup(struct serial_private *priv,
1078 + const struct pciserial_board *board,
1079 +- struct uart_8250_port *port, int idx)
1080 ++ struct uart_port *port, int idx)
1081 + {
1082 + int ret = pci_default_setup(priv, board, port, idx);
1083 +
1084 +- port->port.type = PORT_BRCM_TRUMANAGE;
1085 +- port->port.flags = (port->port.flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
1086 ++ port->type = PORT_BRCM_TRUMANAGE;
1087 ++ port->flags = (port->flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
1088 + return ret;
1089 + }
1090 +
1091 +diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
1092 +index 33cff0153b25..8882d654b0d1 100644
1093 +--- a/drivers/usb/host/xhci-pci.c
1094 ++++ b/drivers/usb/host/xhci-pci.c
1095 +@@ -98,6 +98,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
1096 + /* AMD PLL quirk */
1097 + if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info())
1098 + xhci->quirks |= XHCI_AMD_PLL_FIX;
1099 ++
1100 ++ if (pdev->vendor == PCI_VENDOR_ID_AMD)
1101 ++ xhci->quirks |= XHCI_TRUST_TX_LENGTH;
1102 ++
1103 + if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
1104 + pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) {
1105 + xhci->quirks |= XHCI_EP_LIMIT_QUIRK;
1106 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1107 +index 6f1b36d15419..95e8648ade45 100644
1108 +--- a/drivers/usb/host/xhci-ring.c
1109 ++++ b/drivers/usb/host/xhci-ring.c
1110 +@@ -2528,7 +2528,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
1111 + * last TRB of the previous TD. The command completion handle
1112 + * will take care the rest.
1113 + */
1114 +- if (!event_seg && trb_comp_code == COMP_STOP_INVAL) {
1115 ++ if (!event_seg && (trb_comp_code == COMP_STOP ||
1116 ++ trb_comp_code == COMP_STOP_INVAL)) {
1117 + ret = 0;
1118 + goto cleanup;
1119 + }
1120 +diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
1121 +index 7af163da9a79..f1bfd0131e0f 100644
1122 +--- a/drivers/usb/misc/sisusbvga/sisusb.c
1123 ++++ b/drivers/usb/misc/sisusbvga/sisusb.c
1124 +@@ -3248,6 +3248,7 @@ static const struct usb_device_id sisusb_table[] = {
1125 + { USB_DEVICE(0x0711, 0x0918) },
1126 + { USB_DEVICE(0x0711, 0x0920) },
1127 + { USB_DEVICE(0x0711, 0x0950) },
1128 ++ { USB_DEVICE(0x0711, 0x5200) },
1129 + { USB_DEVICE(0x182d, 0x021c) },
1130 + { USB_DEVICE(0x182d, 0x0269) },
1131 + { }
1132 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1133 +index 89b5664aa53b..121a05207d8b 100644
1134 +--- a/drivers/usb/serial/ftdi_sio.c
1135 ++++ b/drivers/usb/serial/ftdi_sio.c
1136 +@@ -162,6 +162,7 @@ static struct usb_device_id id_table_combined [] = {
1137 + { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) },
1138 + { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) },
1139 + { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) },
1140 ++ { USB_DEVICE(FTDI_VID, FTDI_BM_ATOM_NANO_PID) },
1141 + { USB_DEVICE(FTDI_VID, FTDI_NXTCAM_PID) },
1142 + { USB_DEVICE(FTDI_VID, FTDI_EV3CON_PID) },
1143 + { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) },
1144 +@@ -956,6 +957,8 @@ static struct usb_device_id id_table_combined [] = {
1145 + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) },
1146 + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) },
1147 + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) },
1148 ++ /* ekey Devices */
1149 ++ { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) },
1150 + { }, /* Optional parameter entry */
1151 + { } /* Terminating entry */
1152 + };
1153 +diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1154 +index 106cc16cc6ed..0eb2e97bcb4a 100644
1155 +--- a/drivers/usb/serial/ftdi_sio_ids.h
1156 ++++ b/drivers/usb/serial/ftdi_sio_ids.h
1157 +@@ -42,6 +42,8 @@
1158 + /* www.candapter.com Ewert Energy Systems CANdapter device */
1159 + #define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */
1160 +
1161 ++#define FTDI_BM_ATOM_NANO_PID 0xa559 /* Basic Micro ATOM Nano USB2Serial */
1162 ++
1163 + /*
1164 + * Texas Instruments XDS100v2 JTAG / BeagleBone A3
1165 + * http://processors.wiki.ti.com/index.php/XDS100
1166 +@@ -1369,3 +1371,8 @@
1167 + #define BRAINBOXES_US_160_6_PID 0x9006 /* US-160 16xRS232 1Mbaud Port 11 and 12 */
1168 + #define BRAINBOXES_US_160_7_PID 0x9007 /* US-160 16xRS232 1Mbaud Port 13 and 14 */
1169 + #define BRAINBOXES_US_160_8_PID 0x9008 /* US-160 16xRS232 1Mbaud Port 15 and 16 */
1170 ++
1171 ++/*
1172 ++ * ekey biometric systems GmbH (http://ekey.net/)
1173 ++ */
1174 ++#define FTDI_EKEY_CONV_USB_PID 0xCB08 /* Converter USB */
1175 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1176 +index e1e05bad2be0..703ebe7eaa93 100644
1177 +--- a/drivers/usb/serial/option.c
1178 ++++ b/drivers/usb/serial/option.c
1179 +@@ -499,6 +499,10 @@ static void option_instat_callback(struct urb *urb);
1180 + #define INOVIA_VENDOR_ID 0x20a6
1181 + #define INOVIA_SEW858 0x1105
1182 +
1183 ++/* VIA Telecom */
1184 ++#define VIATELECOM_VENDOR_ID 0x15eb
1185 ++#define VIATELECOM_PRODUCT_CDS7 0x0001
1186 ++
1187 + /* some devices interfaces need special handling due to a number of reasons */
1188 + enum option_blacklist_reason {
1189 + OPTION_BLACKLIST_NONE = 0,
1190 +@@ -1744,6 +1748,7 @@ static const struct usb_device_id option_ids[] = {
1191 + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
1192 + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
1193 + { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
1194 ++ { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
1195 + { } /* Terminating entry */
1196 + };
1197 + MODULE_DEVICE_TABLE(usb, option_ids);
1198 +diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
1199 +index 9d768ac5a60a..3e450b4e9c5f 100644
1200 +--- a/drivers/usb/serial/pl2303.c
1201 ++++ b/drivers/usb/serial/pl2303.c
1202 +@@ -51,6 +51,7 @@ static const struct usb_device_id id_table[] = {
1203 + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) },
1204 + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) },
1205 + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) },
1206 ++ { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ZTEK) },
1207 + { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
1208 + { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
1209 + { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
1210 +diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
1211 +index 42bc082896ac..71fd9da1d6e7 100644
1212 +--- a/drivers/usb/serial/pl2303.h
1213 ++++ b/drivers/usb/serial/pl2303.h
1214 +@@ -22,6 +22,7 @@
1215 + #define PL2303_PRODUCT_ID_GPRS 0x0609
1216 + #define PL2303_PRODUCT_ID_HCR331 0x331a
1217 + #define PL2303_PRODUCT_ID_MOTOROLA 0x0307
1218 ++#define PL2303_PRODUCT_ID_ZTEK 0xe1f1
1219 +
1220 + #define ATEN_VENDOR_ID 0x0557
1221 + #define ATEN_VENDOR_ID2 0x0547
1222 +diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
1223 +index 9a145e4b8169..a08230ebe9c5 100644
1224 +--- a/drivers/usb/serial/usb-serial.c
1225 ++++ b/drivers/usb/serial/usb-serial.c
1226 +@@ -794,29 +794,37 @@ int usb_serial_probe(struct usb_interface *interface,
1227 + if (usb_endpoint_is_bulk_in(endpoint)) {
1228 + /* we found a bulk in endpoint */
1229 + dbg("found bulk in on endpoint %d", i);
1230 +- bulk_in_endpoint[num_bulk_in] = endpoint;
1231 +- ++num_bulk_in;
1232 ++ if (num_bulk_in < MAX_NUM_PORTS) {
1233 ++ bulk_in_endpoint[num_bulk_in] = endpoint;
1234 ++ ++num_bulk_in;
1235 ++ }
1236 + }
1237 +
1238 + if (usb_endpoint_is_bulk_out(endpoint)) {
1239 + /* we found a bulk out endpoint */
1240 + dbg("found bulk out on endpoint %d", i);
1241 +- bulk_out_endpoint[num_bulk_out] = endpoint;
1242 +- ++num_bulk_out;
1243 ++ if (num_bulk_out < MAX_NUM_PORTS) {
1244 ++ bulk_out_endpoint[num_bulk_out] = endpoint;
1245 ++ ++num_bulk_out;
1246 ++ }
1247 + }
1248 +
1249 + if (usb_endpoint_is_int_in(endpoint)) {
1250 + /* we found a interrupt in endpoint */
1251 + dbg("found interrupt in on endpoint %d", i);
1252 +- interrupt_in_endpoint[num_interrupt_in] = endpoint;
1253 +- ++num_interrupt_in;
1254 ++ if (num_interrupt_in < MAX_NUM_PORTS) {
1255 ++ interrupt_in_endpoint[num_interrupt_in] = endpoint;
1256 ++ ++num_interrupt_in;
1257 ++ }
1258 + }
1259 +
1260 + if (usb_endpoint_is_int_out(endpoint)) {
1261 + /* we found an interrupt out endpoint */
1262 + dbg("found interrupt out on endpoint %d", i);
1263 +- interrupt_out_endpoint[num_interrupt_out] = endpoint;
1264 +- ++num_interrupt_out;
1265 ++ if (num_interrupt_out < MAX_NUM_PORTS) {
1266 ++ interrupt_out_endpoint[num_interrupt_out] = endpoint;
1267 ++ ++num_interrupt_out;
1268 ++ }
1269 + }
1270 + }
1271 +
1272 +@@ -839,8 +847,10 @@ int usb_serial_probe(struct usb_interface *interface,
1273 + if (usb_endpoint_is_int_in(endpoint)) {
1274 + /* we found a interrupt in endpoint */
1275 + dbg("found interrupt in for Prolific device on separate interface");
1276 +- interrupt_in_endpoint[num_interrupt_in] = endpoint;
1277 +- ++num_interrupt_in;
1278 ++ if (num_interrupt_in < MAX_NUM_PORTS) {
1279 ++ interrupt_in_endpoint[num_interrupt_in] = endpoint;
1280 ++ ++num_interrupt_in;
1281 ++ }
1282 + }
1283 + }
1284 + }
1285 +@@ -879,6 +889,11 @@ int usb_serial_probe(struct usb_interface *interface,
1286 + num_ports = type->num_ports;
1287 + }
1288 +
1289 ++ if (num_ports > MAX_NUM_PORTS) {
1290 ++ dev_warn(&interface->dev, "too many ports requested: %d\n", num_ports);
1291 ++ num_ports = MAX_NUM_PORTS;
1292 ++ }
1293 ++
1294 + serial->num_ports = num_ports;
1295 + serial->num_bulk_in = num_bulk_in;
1296 + serial->num_bulk_out = num_bulk_out;
1297 +diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
1298 +index 0d06d7ca86f9..bf7014d49a50 100644
1299 +--- a/drivers/usb/serial/whiteheat.c
1300 ++++ b/drivers/usb/serial/whiteheat.c
1301 +@@ -953,6 +953,10 @@ static void command_port_read_callback(struct urb *urb)
1302 + dbg("%s - command_info is NULL, exiting.", __func__);
1303 + return;
1304 + }
1305 ++ if (!urb->actual_length) {
1306 ++ dev_dbg(&urb->dev->dev, "%s - empty response, exiting.\n", __func__);
1307 ++ return;
1308 ++ }
1309 + if (status) {
1310 + dbg("%s - nonzero urb status: %d", __func__, status);
1311 + if (status != -ENOENT)
1312 +@@ -974,7 +978,8 @@ static void command_port_read_callback(struct urb *urb)
1313 + /* These are unsolicited reports from the firmware, hence no
1314 + waiting command to wakeup */
1315 + dbg("%s - event received", __func__);
1316 +- } else if (data[0] == WHITEHEAT_GET_DTR_RTS) {
1317 ++ } else if ((data[0] == WHITEHEAT_GET_DTR_RTS) &&
1318 ++ (urb->actual_length - 1 <= sizeof(command_info->result_buffer))) {
1319 + memcpy(command_info->result_buffer, &data[1],
1320 + urb->actual_length - 1);
1321 + command_info->command_finished = WHITEHEAT_CMD_COMPLETE;
1322 +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
1323 +index 43944c6d7b41..8d6ac6bec9e9 100644
1324 +--- a/fs/cifs/inode.c
1325 ++++ b/fs/cifs/inode.c
1326 +@@ -1653,6 +1653,12 @@ unlink_target:
1327 + target_dentry, toName);
1328 + }
1329 +
1330 ++ /* force revalidate to go get info when needed */
1331 ++ CIFS_I(source_dir)->time = CIFS_I(target_dir)->time = 0;
1332 ++
1333 ++ source_dir->i_ctime = source_dir->i_mtime = target_dir->i_ctime =
1334 ++ target_dir->i_mtime = current_fs_time(source_dir->i_sb);
1335 ++
1336 + cifs_rename_exit:
1337 + kfree(info_buf_source);
1338 + kfree(fromName);
1339 +diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
1340 +index 740cad8dcd8d..6a7c4837cc7c 100644
1341 +--- a/fs/ext2/inode.c
1342 ++++ b/fs/ext2/inode.c
1343 +@@ -614,6 +614,8 @@ static int ext2_get_blocks(struct inode *inode,
1344 + int count = 0;
1345 + ext2_fsblk_t first_block = 0;
1346 +
1347 ++ BUG_ON(maxblocks == 0);
1348 ++
1349 + depth = ext2_block_to_path(inode,iblock,offsets,&blocks_to_boundary);
1350 +
1351 + if (depth == 0)
1352 +diff --git a/fs/ext2/xip.c b/fs/ext2/xip.c
1353 +index 1c3312858fcf..e98171a11cfe 100644
1354 +--- a/fs/ext2/xip.c
1355 ++++ b/fs/ext2/xip.c
1356 +@@ -35,6 +35,7 @@ __ext2_get_block(struct inode *inode, pgoff_t pgoff, int create,
1357 + int rc;
1358 +
1359 + memset(&tmp, 0, sizeof(struct buffer_head));
1360 ++ tmp.b_size = 1 << inode->i_blkbits;
1361 + rc = ext2_get_block(inode, pgoff, &tmp, create);
1362 + *result = tmp.b_blocknr;
1363 +
1364 +diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
1365 +index e92a342f14e7..e379b870cecd 100644
1366 +--- a/fs/isofs/inode.c
1367 ++++ b/fs/isofs/inode.c
1368 +@@ -68,7 +68,7 @@ static void isofs_put_super(struct super_block *sb)
1369 + return;
1370 + }
1371 +
1372 +-static int isofs_read_inode(struct inode *);
1373 ++static int isofs_read_inode(struct inode *, int relocated);
1374 + static int isofs_statfs (struct dentry *, struct kstatfs *);
1375 +
1376 + static struct kmem_cache *isofs_inode_cachep;
1377 +@@ -1264,7 +1264,7 @@ out_toomany:
1378 + goto out;
1379 + }
1380 +
1381 +-static int isofs_read_inode(struct inode *inode)
1382 ++static int isofs_read_inode(struct inode *inode, int relocated)
1383 + {
1384 + struct super_block *sb = inode->i_sb;
1385 + struct isofs_sb_info *sbi = ISOFS_SB(sb);
1386 +@@ -1409,7 +1409,7 @@ static int isofs_read_inode(struct inode *inode)
1387 + */
1388 +
1389 + if (!high_sierra) {
1390 +- parse_rock_ridge_inode(de, inode);
1391 ++ parse_rock_ridge_inode(de, inode, relocated);
1392 + /* if we want uid/gid set, override the rock ridge setting */
1393 + if (sbi->s_uid_set)
1394 + inode->i_uid = sbi->s_uid;
1395 +@@ -1488,9 +1488,10 @@ static int isofs_iget5_set(struct inode *ino, void *data)
1396 + * offset that point to the underlying meta-data for the inode. The
1397 + * code below is otherwise similar to the iget() code in
1398 + * include/linux/fs.h */
1399 +-struct inode *isofs_iget(struct super_block *sb,
1400 +- unsigned long block,
1401 +- unsigned long offset)
1402 ++struct inode *__isofs_iget(struct super_block *sb,
1403 ++ unsigned long block,
1404 ++ unsigned long offset,
1405 ++ int relocated)
1406 + {
1407 + unsigned long hashval;
1408 + struct inode *inode;
1409 +@@ -1512,7 +1513,7 @@ struct inode *isofs_iget(struct super_block *sb,
1410 + return ERR_PTR(-ENOMEM);
1411 +
1412 + if (inode->i_state & I_NEW) {
1413 +- ret = isofs_read_inode(inode);
1414 ++ ret = isofs_read_inode(inode, relocated);
1415 + if (ret < 0) {
1416 + iget_failed(inode);
1417 + inode = ERR_PTR(ret);
1418 +diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h
1419 +index 0e73f63d9274..50cd5839844f 100644
1420 +--- a/fs/isofs/isofs.h
1421 ++++ b/fs/isofs/isofs.h
1422 +@@ -107,7 +107,7 @@ extern int iso_date(char *, int);
1423 +
1424 + struct inode; /* To make gcc happy */
1425 +
1426 +-extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *);
1427 ++extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *, int relocated);
1428 + extern int get_rock_ridge_filename(struct iso_directory_record *, char *, struct inode *);
1429 + extern int isofs_name_translate(struct iso_directory_record *, char *, struct inode *);
1430 +
1431 +@@ -118,9 +118,24 @@ extern struct dentry *isofs_lookup(struct inode *, struct dentry *, struct namei
1432 + extern struct buffer_head *isofs_bread(struct inode *, sector_t);
1433 + extern int isofs_get_blocks(struct inode *, sector_t, struct buffer_head **, unsigned long);
1434 +
1435 +-extern struct inode *isofs_iget(struct super_block *sb,
1436 +- unsigned long block,
1437 +- unsigned long offset);
1438 ++struct inode *__isofs_iget(struct super_block *sb,
1439 ++ unsigned long block,
1440 ++ unsigned long offset,
1441 ++ int relocated);
1442 ++
1443 ++static inline struct inode *isofs_iget(struct super_block *sb,
1444 ++ unsigned long block,
1445 ++ unsigned long offset)
1446 ++{
1447 ++ return __isofs_iget(sb, block, offset, 0);
1448 ++}
1449 ++
1450 ++static inline struct inode *isofs_iget_reloc(struct super_block *sb,
1451 ++ unsigned long block,
1452 ++ unsigned long offset)
1453 ++{
1454 ++ return __isofs_iget(sb, block, offset, 1);
1455 ++}
1456 +
1457 + /* Because the inode number is no longer relevant to finding the
1458 + * underlying meta-data for an inode, we are free to choose a more
1459 +diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
1460 +index 70e79d0c756a..ee62cc0c2499 100644
1461 +--- a/fs/isofs/rock.c
1462 ++++ b/fs/isofs/rock.c
1463 +@@ -288,12 +288,16 @@ eio:
1464 + goto out;
1465 + }
1466 +
1467 ++#define RR_REGARD_XA 1
1468 ++#define RR_RELOC_DE 2
1469 ++
1470 + static int
1471 + parse_rock_ridge_inode_internal(struct iso_directory_record *de,
1472 +- struct inode *inode, int regard_xa)
1473 ++ struct inode *inode, int flags)
1474 + {
1475 + int symlink_len = 0;
1476 + int cnt, sig;
1477 ++ unsigned int reloc_block;
1478 + struct inode *reloc;
1479 + struct rock_ridge *rr;
1480 + int rootflag;
1481 +@@ -305,7 +309,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
1482 +
1483 + init_rock_state(&rs, inode);
1484 + setup_rock_ridge(de, inode, &rs);
1485 +- if (regard_xa) {
1486 ++ if (flags & RR_REGARD_XA) {
1487 + rs.chr += 14;
1488 + rs.len -= 14;
1489 + if (rs.len < 0)
1490 +@@ -485,12 +489,22 @@ repeat:
1491 + "relocated directory\n");
1492 + goto out;
1493 + case SIG('C', 'L'):
1494 +- ISOFS_I(inode)->i_first_extent =
1495 +- isonum_733(rr->u.CL.location);
1496 +- reloc =
1497 +- isofs_iget(inode->i_sb,
1498 +- ISOFS_I(inode)->i_first_extent,
1499 +- 0);
1500 ++ if (flags & RR_RELOC_DE) {
1501 ++ printk(KERN_ERR
1502 ++ "ISOFS: Recursive directory relocation "
1503 ++ "is not supported\n");
1504 ++ goto eio;
1505 ++ }
1506 ++ reloc_block = isonum_733(rr->u.CL.location);
1507 ++ if (reloc_block == ISOFS_I(inode)->i_iget5_block &&
1508 ++ ISOFS_I(inode)->i_iget5_offset == 0) {
1509 ++ printk(KERN_ERR
1510 ++ "ISOFS: Directory relocation points to "
1511 ++ "itself\n");
1512 ++ goto eio;
1513 ++ }
1514 ++ ISOFS_I(inode)->i_first_extent = reloc_block;
1515 ++ reloc = isofs_iget_reloc(inode->i_sb, reloc_block, 0);
1516 + if (IS_ERR(reloc)) {
1517 + ret = PTR_ERR(reloc);
1518 + goto out;
1519 +@@ -637,9 +651,11 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
1520 + return rpnt;
1521 + }
1522 +
1523 +-int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode)
1524 ++int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode,
1525 ++ int relocated)
1526 + {
1527 +- int result = parse_rock_ridge_inode_internal(de, inode, 0);
1528 ++ int flags = relocated ? RR_RELOC_DE : 0;
1529 ++ int result = parse_rock_ridge_inode_internal(de, inode, flags);
1530 +
1531 + /*
1532 + * if rockridge flag was reset and we didn't look for attributes
1533 +@@ -647,7 +663,8 @@ int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode)
1534 + */
1535 + if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1)
1536 + && (ISOFS_SB(inode->i_sb)->s_rock == 2)) {
1537 +- result = parse_rock_ridge_inode_internal(de, inode, 14);
1538 ++ result = parse_rock_ridge_inode_internal(de, inode,
1539 ++ flags | RR_REGARD_XA);
1540 + }
1541 + return result;
1542 + }
1543 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
1544 +index 934bb1ca8335..01afcd575920 100644
1545 +--- a/fs/nfs/nfs4proc.c
1546 ++++ b/fs/nfs/nfs4proc.c
1547 +@@ -2051,6 +2051,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
1548 + {
1549 + struct nfs4_closedata *calldata = data;
1550 + struct nfs4_state *state = calldata->state;
1551 ++ bool is_rdonly, is_wronly, is_rdwr;
1552 + int call_close = 0;
1553 +
1554 + dprintk("%s: begin!\n", __func__);
1555 +@@ -2058,18 +2059,24 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
1556 + return;
1557 +
1558 + task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE];
1559 +- calldata->arg.fmode = FMODE_READ|FMODE_WRITE;
1560 + spin_lock(&state->owner->so_lock);
1561 ++ is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags);
1562 ++ is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags);
1563 ++ is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags);
1564 ++ /* Calculate the current open share mode */
1565 ++ calldata->arg.fmode = 0;
1566 ++ if (is_rdonly || is_rdwr)
1567 ++ calldata->arg.fmode |= FMODE_READ;
1568 ++ if (is_wronly || is_rdwr)
1569 ++ calldata->arg.fmode |= FMODE_WRITE;
1570 + /* Calculate the change in open mode */
1571 + if (state->n_rdwr == 0) {
1572 + if (state->n_rdonly == 0) {
1573 +- call_close |= test_bit(NFS_O_RDONLY_STATE, &state->flags);
1574 +- call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags);
1575 ++ call_close |= is_rdonly || is_rdwr;
1576 + calldata->arg.fmode &= ~FMODE_READ;
1577 + }
1578 + if (state->n_wronly == 0) {
1579 +- call_close |= test_bit(NFS_O_WRONLY_STATE, &state->flags);
1580 +- call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags);
1581 ++ call_close |= is_wronly || is_rdwr;
1582 + calldata->arg.fmode &= ~FMODE_WRITE;
1583 + }
1584 + }
1585 +diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
1586 +index fe07e5a90569..cc49b232b6e4 100644
1587 +--- a/include/linux/mempolicy.h
1588 ++++ b/include/linux/mempolicy.h
1589 +@@ -205,7 +205,7 @@ extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
1590 + extern bool init_nodemask_of_mempolicy(nodemask_t *mask);
1591 + extern bool mempolicy_nodemask_intersects(struct task_struct *tsk,
1592 + const nodemask_t *mask);
1593 +-extern unsigned slab_node(struct mempolicy *policy);
1594 ++extern unsigned slab_node(void);
1595 +
1596 + extern enum zone_type policy_zone;
1597 +
1598 +diff --git a/mm/mempolicy.c b/mm/mempolicy.c
1599 +index 5cec36b6e838..87a43cce8d59 100644
1600 +--- a/mm/mempolicy.c
1601 ++++ b/mm/mempolicy.c
1602 +@@ -1609,8 +1609,14 @@ static unsigned interleave_nodes(struct mempolicy *policy)
1603 + * task can change it's policy. The system default policy requires no
1604 + * such protection.
1605 + */
1606 +-unsigned slab_node(struct mempolicy *policy)
1607 ++unsigned slab_node(void)
1608 + {
1609 ++ struct mempolicy *policy;
1610 ++
1611 ++ if (in_interrupt())
1612 ++ return numa_node_id();
1613 ++
1614 ++ policy = current->mempolicy;
1615 + if (!policy || policy->flags & MPOL_F_LOCAL)
1616 + return numa_node_id();
1617 +
1618 +diff --git a/mm/slab.c b/mm/slab.c
1619 +index da2bb689a008..3eb1c38e2c30 100644
1620 +--- a/mm/slab.c
1621 ++++ b/mm/slab.c
1622 +@@ -3336,7 +3336,7 @@ static void *alternate_node_alloc(struct kmem_cache *cachep, gfp_t flags)
1623 + if (cpuset_do_slab_mem_spread() && (cachep->flags & SLAB_MEM_SPREAD))
1624 + nid_alloc = cpuset_slab_spread_node();
1625 + else if (current->mempolicy)
1626 +- nid_alloc = slab_node(current->mempolicy);
1627 ++ nid_alloc = slab_node();
1628 + if (nid_alloc != nid_here)
1629 + return ____cache_alloc_node(cachep, flags, nid_alloc);
1630 + return NULL;
1631 +@@ -3368,7 +3368,7 @@ static void *fallback_alloc(struct kmem_cache *cache, gfp_t flags)
1632 +
1633 + retry_cpuset:
1634 + cpuset_mems_cookie = get_mems_allowed();
1635 +- zonelist = node_zonelist(slab_node(current->mempolicy), flags);
1636 ++ zonelist = node_zonelist(slab_node(), flags);
1637 +
1638 + retry:
1639 + /*
1640 +diff --git a/mm/slub.c b/mm/slub.c
1641 +index c6f225fa9a87..54ac6e90a1fa 100644
1642 +--- a/mm/slub.c
1643 ++++ b/mm/slub.c
1644 +@@ -1617,7 +1617,7 @@ static struct page *get_any_partial(struct kmem_cache *s, gfp_t flags,
1645 +
1646 + do {
1647 + cpuset_mems_cookie = get_mems_allowed();
1648 +- zonelist = node_zonelist(slab_node(current->mempolicy), flags);
1649 ++ zonelist = node_zonelist(slab_node(), flags);
1650 + for_each_zone_zonelist(zone, z, zonelist, high_zoneidx) {
1651 + struct kmem_cache_node *n;
1652 +
1653 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1654 +index 4dac0b332a36..36284b8562f0 100644
1655 +--- a/sound/pci/hda/patch_realtek.c
1656 ++++ b/sound/pci/hda/patch_realtek.c
1657 +@@ -458,6 +458,8 @@ static void alc_fix_pll(struct hda_codec *codec)
1658 + spec->pll_coef_idx);
1659 + val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1660 + AC_VERB_GET_PROC_COEF, 0);
1661 ++ if (val == -1)
1662 ++ return;
1663 + snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1664 + spec->pll_coef_idx);
1665 + snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1666 +@@ -5843,6 +5845,8 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
1667 + static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
1668 + {
1669 + int val = alc_read_coef_idx(codec, 0x04);
1670 ++ if (val == -1)
1671 ++ return;
1672 + if (power_up)
1673 + val |= 1 << 11;
1674 + else
1675 +@@ -6273,27 +6277,30 @@ static void alc269_fill_coef(struct hda_codec *codec)
1676 + if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
1677 + val = alc_read_coef_idx(codec, 0x04);
1678 + /* Power up output pin */
1679 +- alc_write_coef_idx(codec, 0x04, val | (1<<11));
1680 ++ if (val != -1)
1681 ++ alc_write_coef_idx(codec, 0x04, val | (1<<11));
1682 + }
1683 +
1684 + if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
1685 + val = alc_read_coef_idx(codec, 0xd);
1686 +- if ((val & 0x0c00) >> 10 != 0x1) {
1687 ++ if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
1688 + /* Capless ramp up clock control */
1689 + alc_write_coef_idx(codec, 0xd, val | (1<<10));
1690 + }
1691 + val = alc_read_coef_idx(codec, 0x17);
1692 +- if ((val & 0x01c0) >> 6 != 0x4) {
1693 ++ if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
1694 + /* Class D power on reset */
1695 + alc_write_coef_idx(codec, 0x17, val | (1<<7));
1696 + }
1697 + }
1698 +
1699 + val = alc_read_coef_idx(codec, 0xd); /* Class D */
1700 +- alc_write_coef_idx(codec, 0xd, val | (1<<14));
1701 ++ if (val != -1)
1702 ++ alc_write_coef_idx(codec, 0xd, val | (1<<14));
1703 +
1704 + val = alc_read_coef_idx(codec, 0x4); /* HP */
1705 +- alc_write_coef_idx(codec, 0x4, val | (1<<11));
1706 ++ if (val != -1)
1707 ++ alc_write_coef_idx(codec, 0x4, val | (1<<11));
1708 + }
1709 +
1710 + /*
1711 +diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
1712 +index fd04ce139031..540e30bdb79a 100644
1713 +--- a/sound/soc/pxa/pxa-ssp.c
1714 ++++ b/sound/soc/pxa/pxa-ssp.c
1715 +@@ -779,9 +779,7 @@ static int pxa_ssp_remove(struct snd_soc_dai *dai)
1716 + SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \
1717 + SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
1718 +
1719 +-#define PXA_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
1720 +- SNDRV_PCM_FMTBIT_S24_LE | \
1721 +- SNDRV_PCM_FMTBIT_S32_LE)
1722 ++#define PXA_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE)
1723 +
1724 + static const struct snd_soc_dai_ops pxa_ssp_dai_ops = {
1725 + .startup = pxa_ssp_startup,
1726 +diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
1727 +index 53d34f626c15..defc9baa9a45 100644
1728 +--- a/virt/kvm/iommu.c
1729 ++++ b/virt/kvm/iommu.c
1730 +@@ -61,6 +61,14 @@ static pfn_t kvm_pin_pages(struct kvm *kvm, struct kvm_memory_slot *slot,
1731 + return pfn;
1732 + }
1733 +
1734 ++static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages)
1735 ++{
1736 ++ unsigned long i;
1737 ++
1738 ++ for (i = 0; i < npages; ++i)
1739 ++ kvm_release_pfn_clean(pfn + i);
1740 ++}
1741 ++
1742 + int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
1743 + {
1744 + gfn_t gfn, end_gfn;
1745 +@@ -121,6 +129,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
1746 + if (r) {
1747 + printk(KERN_ERR "kvm_iommu_map_address:"
1748 + "iommu failed to map pfn=%llx\n", pfn);
1749 ++ kvm_unpin_pages(kvm, pfn, page_size);
1750 + goto unmap_pages;
1751 + }
1752 +
1753 +@@ -132,7 +141,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
1754 + return 0;
1755 +
1756 + unmap_pages:
1757 +- kvm_iommu_put_pages(kvm, slot->base_gfn, gfn);
1758 ++ kvm_iommu_put_pages(kvm, slot->base_gfn, gfn - slot->base_gfn);
1759 + return r;
1760 + }
1761 +
1762 +@@ -274,14 +283,6 @@ out_unlock:
1763 + return r;
1764 + }
1765 +
1766 +-static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages)
1767 +-{
1768 +- unsigned long i;
1769 +-
1770 +- for (i = 0; i < npages; ++i)
1771 +- kvm_release_pfn_clean(pfn + i);
1772 +-}
1773 +-
1774 + static void kvm_iommu_put_pages(struct kvm *kvm,
1775 + gfn_t base_gfn, unsigned long npages)
1776 + {