Magellan Linux

Contents of /trunk/kernel26-magellan-server/patches-2.6.24-r4/0103-2.6.24.4-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download)
Tue Mar 25 11:39:14 2008 UTC (16 years, 1 month ago) by niro
File size: 115991 byte(s)
-fixed a small issue with the arch/sparc/kernel/Makefile

1 diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
2 index 83ef5ec..df5ae27 100644
3 --- a/arch/arm/mach-pxa/clock.c
4 +++ b/arch/arm/mach-pxa/clock.c
5 @@ -23,18 +23,27 @@ static LIST_HEAD(clocks);
6 static DEFINE_MUTEX(clocks_mutex);
7 static DEFINE_SPINLOCK(clocks_lock);
8
9 +static struct clk *clk_lookup(struct device *dev, const char *id)
10 +{
11 + struct clk *p;
12 +
13 + list_for_each_entry(p, &clocks, node)
14 + if (strcmp(id, p->name) == 0 && p->dev == dev)
15 + return p;
16 +
17 + return NULL;
18 +}
19 +
20 struct clk *clk_get(struct device *dev, const char *id)
21 {
22 struct clk *p, *clk = ERR_PTR(-ENOENT);
23
24 mutex_lock(&clocks_mutex);
25 - list_for_each_entry(p, &clocks, node) {
26 - if (strcmp(id, p->name) == 0 &&
27 - (p->dev == NULL || p->dev == dev)) {
28 - clk = p;
29 - break;
30 - }
31 - }
32 + p = clk_lookup(dev, id);
33 + if (!p)
34 + p = clk_lookup(NULL, id);
35 + if (p)
36 + clk = p;
37 mutex_unlock(&clocks_mutex);
38
39 return clk;
40 diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
41 index 4710135..9158dd8 100644
42 --- a/arch/mips/kernel/i8259.c
43 +++ b/arch/mips/kernel/i8259.c
44 @@ -338,8 +338,10 @@ void __init init_i8259_irqs(void)
45
46 init_8259A(0);
47
48 - for (i = I8259A_IRQ_BASE; i < I8259A_IRQ_BASE + 16; i++)
49 + for (i = I8259A_IRQ_BASE; i < I8259A_IRQ_BASE + 16; i++) {
50 set_irq_chip_and_handler(i, &i8259A_chip, handle_level_irq);
51 + set_irq_probe(i);
52 + }
53
54 setup_irq(I8259A_IRQ_BASE + PIC_CASCADE_IR, &irq2);
55 }
56 diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
57 index d06e9c9..e3309ff 100644
58 --- a/arch/mips/kernel/irq.c
59 +++ b/arch/mips/kernel/irq.c
60 @@ -145,6 +145,11 @@ __setup("nokgdb", nokgdb);
61
62 void __init init_IRQ(void)
63 {
64 + int i;
65 +
66 + for (i = 0; i < NR_IRQS; i++)
67 + set_irq_noprobe(i);
68 +
69 arch_init_irq();
70
71 #ifdef CONFIG_KGDB
72 diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c
73 index 7e8efaa..5efdfe9 100644
74 --- a/arch/s390/lib/uaccess_pt.c
75 +++ b/arch/s390/lib/uaccess_pt.c
76 @@ -406,6 +406,8 @@ int futex_atomic_cmpxchg_pt(int __user *uaddr, int oldval, int newval)
77 {
78 int ret;
79
80 + if (!current->mm)
81 + return -EFAULT;
82 spin_lock(&current->mm->page_table_lock);
83 uaddr = (int __user *) __dat_user_addr((unsigned long) uaddr);
84 if (!uaddr) {
85 diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
86 index e795f28..bf1b15d 100644
87 --- a/arch/sparc/kernel/Makefile
88 +++ b/arch/sparc/kernel/Makefile
89 @@ -12,7 +12,8 @@ obj-y := entry.o wof.o wuf.o etrap.o rtrap.o traps.o $(IRQ_OBJS) \
90 sys_sparc.o sunos_asm.o systbls.o \
91 time.o windows.o cpu.o devices.o sclow.o \
92 tadpole.o tick14.o ptrace.o sys_solaris.o \
93 - unaligned.o muldiv.o semaphore.o prom.o of_device.o devres.o
94 + unaligned.o una_asm.o muldiv.o semaphore.o \
95 + prom.o of_device.o devres.o
96
97 devres-y = ../../../kernel/irq/devres.o
98
99 diff --git a/arch/sparc/kernel/una_asm.S b/arch/sparc/kernel/una_asm.S
100 new file mode 100644
101 index 0000000..8cc0345
102 --- /dev/null
103 +++ b/arch/sparc/kernel/una_asm.S
104 @@ -0,0 +1,153 @@
105 +/* una_asm.S: Kernel unaligned trap assembler helpers.
106 + *
107 + * Copyright (C) 1996,2005,2008 David S. Miller (davem@davemloft.net)
108 + * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
109 + */
110 +
111 +#include <linux/errno.h>
112 +
113 + .text
114 +
115 +retl_efault:
116 + retl
117 + mov -EFAULT, %o0
118 +
119 + /* int __do_int_store(unsigned long *dst_addr, int size,
120 + * unsigned long *src_val)
121 + *
122 + * %o0 = dest_addr
123 + * %o1 = size
124 + * %o2 = src_val
125 + *
126 + * Return '0' on success, -EFAULT on failure.
127 + */
128 + .globl __do_int_store
129 +__do_int_store:
130 + ld [%o2], %g1
131 + cmp %1, 2
132 + be 2f
133 + cmp %1, 4
134 + be 1f
135 + srl %g1, 24, %g2
136 + srl %g1, 16, %g7
137 +4: stb %g2, [%o0]
138 + srl %g1, 8, %g2
139 +5: stb %g7, [%o0 + 1]
140 + ld [%o2 + 4], %g7
141 +6: stb %g2, [%o0 + 2]
142 + srl %g7, 24, %g2
143 +7: stb %g1, [%o0 + 3]
144 + srl %g7, 16, %g1
145 +8: stb %g2, [%o0 + 4]
146 + srl %g7, 8, %g2
147 +9: stb %g1, [%o0 + 5]
148 +10: stb %g2, [%o0 + 6]
149 + b 0f
150 +11: stb %g7, [%o0 + 7]
151 +1: srl %g1, 16, %g7
152 +12: stb %g2, [%o0]
153 + srl %g1, 8, %g2
154 +13: stb %g7, [%o0 + 1]
155 +14: stb %g2, [%o0 + 2]
156 + b 0f
157 +15: stb %g1, [%o0 + 3]
158 +2: srl %g1, 8, %g2
159 +16: stb %g2, [%o0]
160 +17: stb %g1, [%o0 + 1]
161 +0: retl
162 + mov 0, %o0
163 +
164 + .section __ex_table,#alloc
165 + .word 4b, retl_efault
166 + .word 5b, retl_efault
167 + .word 6b, retl_efault
168 + .word 7b, retl_efault
169 + .word 8b, retl_efault
170 + .word 9b, retl_efault
171 + .word 10b, retl_efault
172 + .word 11b, retl_efault
173 + .word 12b, retl_efault
174 + .word 13b, retl_efault
175 + .word 14b, retl_efault
176 + .word 15b, retl_efault
177 + .word 16b, retl_efault
178 + .word 17b, retl_efault
179 + .previous
180 +
181 + /* int do_int_load(unsigned long *dest_reg, int size,
182 + * unsigned long *saddr, int is_signed)
183 + *
184 + * %o0 = dest_reg
185 + * %o1 = size
186 + * %o2 = saddr
187 + * %o3 = is_signed
188 + *
189 + * Return '0' on success, -EFAULT on failure.
190 + */
191 + .globl do_int_load
192 +do_int_load:
193 + cmp %o1, 8
194 + be 9f
195 + cmp %o1, 4
196 + be 6f
197 +4: ldub [%o2], %g1
198 +5: ldub [%o2 + 1], %g2
199 + sll %g1, 8, %g1
200 + tst %o3
201 + be 3f
202 + or %g1, %g2, %g1
203 + sll %g1, 16, %g1
204 + sra %g1, 16, %g1
205 +3: b 0f
206 + st %g1, [%o0]
207 +6: ldub [%o2 + 1], %g2
208 + sll %g1, 24, %g1
209 +7: ldub [%o2 + 2], %g7
210 + sll %g2, 16, %g2
211 +8: ldub [%o2 + 3], %g3
212 + sll %g7, 8, %g7
213 + or %g3, %g2, %g3
214 + or %g7, %g3, %g7
215 + or %g1, %g7, %g1
216 + b 0f
217 + st %g1, [%o0]
218 +9: ldub [%o2], %g1
219 +10: ldub [%o2 + 1], %g2
220 + sll %g1, 24, %g1
221 +11: ldub [%o2 + 2], %g7
222 + sll %g2, 16, %g2
223 +12: ldub [%o2 + 3], %g3
224 + sll %g7, 8, %g7
225 + or %g1, %g2, %g1
226 + or %g7, %g3, %g7
227 + or %g1, %g7, %g7
228 +13: ldub [%o2 + 4], %g1
229 + st %g7, [%o0]
230 +14: ldub [%o2 + 5], %g2
231 + sll %g1, 24, %g1
232 +15: ldub [%o2 + 6], %g7
233 + sll %g2, 16, %g2
234 +16: ldub [%o2 + 7], %g3
235 + sll %g7, 8, %g7
236 + or %g1, %g2, %g1
237 + or %g7, %g3, %g7
238 + or %g1, %g7, %g7
239 + st %g7, [%o0 + 4]
240 +0: retl
241 + mov 0, %o0
242 +
243 + .section __ex_table,#alloc
244 + .word 4b, retl_efault
245 + .word 5b, retl_efault
246 + .word 6b, retl_efault
247 + .word 7b, retl_efault
248 + .word 8b, retl_efault
249 + .word 9b, retl_efault
250 + .word 10b, retl_efault
251 + .word 11b, retl_efault
252 + .word 12b, retl_efault
253 + .word 13b, retl_efault
254 + .word 14b, retl_efault
255 + .word 15b, retl_efault
256 + .word 16b, retl_efault
257 + .previous
258 diff --git a/arch/sparc/kernel/unaligned.c b/arch/sparc/kernel/unaligned.c
259 index a6330fb..33857be 100644
260 --- a/arch/sparc/kernel/unaligned.c
261 +++ b/arch/sparc/kernel/unaligned.c
262 @@ -175,157 +175,31 @@ static void unaligned_panic(char *str)
263 panic(str);
264 }
265
266 -#define do_integer_load(dest_reg, size, saddr, is_signed, errh) ({ \
267 -__asm__ __volatile__ ( \
268 - "cmp %1, 8\n\t" \
269 - "be 9f\n\t" \
270 - " cmp %1, 4\n\t" \
271 - "be 6f\n" \
272 -"4:\t" " ldub [%2], %%l1\n" \
273 -"5:\t" "ldub [%2 + 1], %%l2\n\t" \
274 - "sll %%l1, 8, %%l1\n\t" \
275 - "tst %3\n\t" \
276 - "be 3f\n\t" \
277 - " add %%l1, %%l2, %%l1\n\t" \
278 - "sll %%l1, 16, %%l1\n\t" \
279 - "sra %%l1, 16, %%l1\n" \
280 -"3:\t" "b 0f\n\t" \
281 - " st %%l1, [%0]\n" \
282 -"6:\t" "ldub [%2 + 1], %%l2\n\t" \
283 - "sll %%l1, 24, %%l1\n" \
284 -"7:\t" "ldub [%2 + 2], %%g7\n\t" \
285 - "sll %%l2, 16, %%l2\n" \
286 -"8:\t" "ldub [%2 + 3], %%g1\n\t" \
287 - "sll %%g7, 8, %%g7\n\t" \
288 - "or %%l1, %%l2, %%l1\n\t" \
289 - "or %%g7, %%g1, %%g7\n\t" \
290 - "or %%l1, %%g7, %%l1\n\t" \
291 - "b 0f\n\t" \
292 - " st %%l1, [%0]\n" \
293 -"9:\t" "ldub [%2], %%l1\n" \
294 -"10:\t" "ldub [%2 + 1], %%l2\n\t" \
295 - "sll %%l1, 24, %%l1\n" \
296 -"11:\t" "ldub [%2 + 2], %%g7\n\t" \
297 - "sll %%l2, 16, %%l2\n" \
298 -"12:\t" "ldub [%2 + 3], %%g1\n\t" \
299 - "sll %%g7, 8, %%g7\n\t" \
300 - "or %%l1, %%l2, %%l1\n\t" \
301 - "or %%g7, %%g1, %%g7\n\t" \
302 - "or %%l1, %%g7, %%g7\n" \
303 -"13:\t" "ldub [%2 + 4], %%l1\n\t" \
304 - "st %%g7, [%0]\n" \
305 -"14:\t" "ldub [%2 + 5], %%l2\n\t" \
306 - "sll %%l1, 24, %%l1\n" \
307 -"15:\t" "ldub [%2 + 6], %%g7\n\t" \
308 - "sll %%l2, 16, %%l2\n" \
309 -"16:\t" "ldub [%2 + 7], %%g1\n\t" \
310 - "sll %%g7, 8, %%g7\n\t" \
311 - "or %%l1, %%l2, %%l1\n\t" \
312 - "or %%g7, %%g1, %%g7\n\t" \
313 - "or %%l1, %%g7, %%g7\n\t" \
314 - "st %%g7, [%0 + 4]\n" \
315 -"0:\n\n\t" \
316 - ".section __ex_table,#alloc\n\t" \
317 - ".word 4b, " #errh "\n\t" \
318 - ".word 5b, " #errh "\n\t" \
319 - ".word 6b, " #errh "\n\t" \
320 - ".word 7b, " #errh "\n\t" \
321 - ".word 8b, " #errh "\n\t" \
322 - ".word 9b, " #errh "\n\t" \
323 - ".word 10b, " #errh "\n\t" \
324 - ".word 11b, " #errh "\n\t" \
325 - ".word 12b, " #errh "\n\t" \
326 - ".word 13b, " #errh "\n\t" \
327 - ".word 14b, " #errh "\n\t" \
328 - ".word 15b, " #errh "\n\t" \
329 - ".word 16b, " #errh "\n\n\t" \
330 - ".previous\n\t" \
331 - : : "r" (dest_reg), "r" (size), "r" (saddr), "r" (is_signed) \
332 - : "l1", "l2", "g7", "g1", "cc"); \
333 -})
334 -
335 -#define store_common(dst_addr, size, src_val, errh) ({ \
336 -__asm__ __volatile__ ( \
337 - "ld [%2], %%l1\n" \
338 - "cmp %1, 2\n\t" \
339 - "be 2f\n\t" \
340 - " cmp %1, 4\n\t" \
341 - "be 1f\n\t" \
342 - " srl %%l1, 24, %%l2\n\t" \
343 - "srl %%l1, 16, %%g7\n" \
344 -"4:\t" "stb %%l2, [%0]\n\t" \
345 - "srl %%l1, 8, %%l2\n" \
346 -"5:\t" "stb %%g7, [%0 + 1]\n\t" \
347 - "ld [%2 + 4], %%g7\n" \
348 -"6:\t" "stb %%l2, [%0 + 2]\n\t" \
349 - "srl %%g7, 24, %%l2\n" \
350 -"7:\t" "stb %%l1, [%0 + 3]\n\t" \
351 - "srl %%g7, 16, %%l1\n" \
352 -"8:\t" "stb %%l2, [%0 + 4]\n\t" \
353 - "srl %%g7, 8, %%l2\n" \
354 -"9:\t" "stb %%l1, [%0 + 5]\n" \
355 -"10:\t" "stb %%l2, [%0 + 6]\n\t" \
356 - "b 0f\n" \
357 -"11:\t" " stb %%g7, [%0 + 7]\n" \
358 -"1:\t" "srl %%l1, 16, %%g7\n" \
359 -"12:\t" "stb %%l2, [%0]\n\t" \
360 - "srl %%l1, 8, %%l2\n" \
361 -"13:\t" "stb %%g7, [%0 + 1]\n" \
362 -"14:\t" "stb %%l2, [%0 + 2]\n\t" \
363 - "b 0f\n" \
364 -"15:\t" " stb %%l1, [%0 + 3]\n" \
365 -"2:\t" "srl %%l1, 8, %%l2\n" \
366 -"16:\t" "stb %%l2, [%0]\n" \
367 -"17:\t" "stb %%l1, [%0 + 1]\n" \
368 -"0:\n\n\t" \
369 - ".section __ex_table,#alloc\n\t" \
370 - ".word 4b, " #errh "\n\t" \
371 - ".word 5b, " #errh "\n\t" \
372 - ".word 6b, " #errh "\n\t" \
373 - ".word 7b, " #errh "\n\t" \
374 - ".word 8b, " #errh "\n\t" \
375 - ".word 9b, " #errh "\n\t" \
376 - ".word 10b, " #errh "\n\t" \
377 - ".word 11b, " #errh "\n\t" \
378 - ".word 12b, " #errh "\n\t" \
379 - ".word 13b, " #errh "\n\t" \
380 - ".word 14b, " #errh "\n\t" \
381 - ".word 15b, " #errh "\n\t" \
382 - ".word 16b, " #errh "\n\t" \
383 - ".word 17b, " #errh "\n\n\t" \
384 - ".previous\n\t" \
385 - : : "r" (dst_addr), "r" (size), "r" (src_val) \
386 - : "l1", "l2", "g7", "g1", "cc"); \
387 -})
388 -
389 -#define do_integer_store(reg_num, size, dst_addr, regs, errh) ({ \
390 - unsigned long *src_val; \
391 - static unsigned long zero[2] = { 0, }; \
392 - \
393 - if (reg_num) src_val = fetch_reg_addr(reg_num, regs); \
394 - else { \
395 - src_val = &zero[0]; \
396 - if (size == 8) \
397 - zero[1] = fetch_reg(1, regs); \
398 - } \
399 - store_common(dst_addr, size, src_val, errh); \
400 -})
401 +/* una_asm.S */
402 +extern int do_int_load(unsigned long *dest_reg, int size,
403 + unsigned long *saddr, int is_signed);
404 +extern int __do_int_store(unsigned long *dst_addr, int size,
405 + unsigned long *src_val);
406 +
407 +static int do_int_store(int reg_num, int size, unsigned long *dst_addr,
408 + struct pt_regs *regs)
409 +{
410 + unsigned long zero[2] = { 0, 0 };
411 + unsigned long *src_val;
412 +
413 + if (reg_num)
414 + src_val = fetch_reg_addr(reg_num, regs);
415 + else {
416 + src_val = &zero[0];
417 + if (size == 8)
418 + zero[1] = fetch_reg(1, regs);
419 + }
420 + return __do_int_store(dst_addr, size, src_val);
421 +}
422
423 extern void smp_capture(void);
424 extern void smp_release(void);
425
426 -#define do_atomic(srcdest_reg, mem, errh) ({ \
427 - unsigned long flags, tmp; \
428 - \
429 - smp_capture(); \
430 - local_irq_save(flags); \
431 - tmp = *srcdest_reg; \
432 - do_integer_load(srcdest_reg, 4, mem, 0, errh); \
433 - store_common(mem, 4, &tmp, errh); \
434 - local_irq_restore(flags); \
435 - smp_release(); \
436 -})
437 -
438 static inline void advance(struct pt_regs *regs)
439 {
440 regs->pc = regs->npc;
441 @@ -342,9 +216,7 @@ static inline int ok_for_kernel(unsigned int insn)
442 return !floating_point_load_or_store_p(insn);
443 }
444
445 -void kernel_mna_trap_fault(struct pt_regs *regs, unsigned int insn) __asm__ ("kernel_mna_trap_fault");
446 -
447 -void kernel_mna_trap_fault(struct pt_regs *regs, unsigned int insn)
448 +static void kernel_mna_trap_fault(struct pt_regs *regs, unsigned int insn)
449 {
450 unsigned long g2 = regs->u_regs [UREG_G2];
451 unsigned long fixup = search_extables_range(regs->pc, &g2);
452 @@ -379,48 +251,34 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)
453 printk("Unsupported unaligned load/store trap for kernel at <%08lx>.\n",
454 regs->pc);
455 unaligned_panic("Wheee. Kernel does fpu/atomic unaligned load/store.");
456 -
457 - __asm__ __volatile__ ("\n"
458 -"kernel_unaligned_trap_fault:\n\t"
459 - "mov %0, %%o0\n\t"
460 - "call kernel_mna_trap_fault\n\t"
461 - " mov %1, %%o1\n\t"
462 - :
463 - : "r" (regs), "r" (insn)
464 - : "o0", "o1", "o2", "o3", "o4", "o5", "o7",
465 - "g1", "g2", "g3", "g4", "g5", "g7", "cc");
466 } else {
467 unsigned long addr = compute_effective_address(regs, insn);
468 + int err;
469
470 #ifdef DEBUG_MNA
471 printk("KMNA: pc=%08lx [dir=%s addr=%08lx size=%d] retpc[%08lx]\n",
472 regs->pc, dirstrings[dir], addr, size, regs->u_regs[UREG_RETPC]);
473 #endif
474 - switch(dir) {
475 + switch (dir) {
476 case load:
477 - do_integer_load(fetch_reg_addr(((insn>>25)&0x1f), regs),
478 - size, (unsigned long *) addr,
479 - decode_signedness(insn),
480 - kernel_unaligned_trap_fault);
481 + err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f),
482 + regs),
483 + size, (unsigned long *) addr,
484 + decode_signedness(insn));
485 break;
486
487 case store:
488 - do_integer_store(((insn>>25)&0x1f), size,
489 - (unsigned long *) addr, regs,
490 - kernel_unaligned_trap_fault);
491 + err = do_int_store(((insn>>25)&0x1f), size,
492 + (unsigned long *) addr, regs);
493 break;
494 -#if 0 /* unsupported */
495 - case both:
496 - do_atomic(fetch_reg_addr(((insn>>25)&0x1f), regs),
497 - (unsigned long *) addr,
498 - kernel_unaligned_trap_fault);
499 - break;
500 -#endif
501 default:
502 panic("Impossible kernel unaligned trap.");
503 /* Not reached... */
504 }
505 - advance(regs);
506 + if (err)
507 + kernel_mna_trap_fault(regs, insn);
508 + else
509 + advance(regs);
510 }
511 }
512
513 @@ -459,9 +317,7 @@ static inline int ok_for_user(struct pt_regs *regs, unsigned int insn,
514 return 0;
515 }
516
517 -void user_mna_trap_fault(struct pt_regs *regs, unsigned int insn) __asm__ ("user_mna_trap_fault");
518 -
519 -void user_mna_trap_fault(struct pt_regs *regs, unsigned int insn)
520 +static void user_mna_trap_fault(struct pt_regs *regs, unsigned int insn)
521 {
522 siginfo_t info;
523
524 @@ -485,7 +341,7 @@ asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn)
525 if(!ok_for_user(regs, insn, dir)) {
526 goto kill_user;
527 } else {
528 - int size = decode_access_size(insn);
529 + int err, size = decode_access_size(insn);
530 unsigned long addr;
531
532 if(floating_point_load_or_store_p(insn)) {
533 @@ -496,48 +352,34 @@ asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn)
534 addr = compute_effective_address(regs, insn);
535 switch(dir) {
536 case load:
537 - do_integer_load(fetch_reg_addr(((insn>>25)&0x1f), regs),
538 - size, (unsigned long *) addr,
539 - decode_signedness(insn),
540 - user_unaligned_trap_fault);
541 + err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f),
542 + regs),
543 + size, (unsigned long *) addr,
544 + decode_signedness(insn));
545 break;
546
547 case store:
548 - do_integer_store(((insn>>25)&0x1f), size,
549 - (unsigned long *) addr, regs,
550 - user_unaligned_trap_fault);
551 + err = do_int_store(((insn>>25)&0x1f), size,
552 + (unsigned long *) addr, regs);
553 break;
554
555 case both:
556 -#if 0 /* unsupported */
557 - do_atomic(fetch_reg_addr(((insn>>25)&0x1f), regs),
558 - (unsigned long *) addr,
559 - user_unaligned_trap_fault);
560 -#else
561 /*
562 * This was supported in 2.4. However, we question
563 * the value of SWAP instruction across word boundaries.
564 */
565 printk("Unaligned SWAP unsupported.\n");
566 - goto kill_user;
567 -#endif
568 + err = -EFAULT;
569 break;
570
571 default:
572 unaligned_panic("Impossible user unaligned trap.");
573 -
574 - __asm__ __volatile__ ("\n"
575 -"user_unaligned_trap_fault:\n\t"
576 - "mov %0, %%o0\n\t"
577 - "call user_mna_trap_fault\n\t"
578 - " mov %1, %%o1\n\t"
579 - :
580 - : "r" (regs), "r" (insn)
581 - : "o0", "o1", "o2", "o3", "o4", "o5", "o7",
582 - "g1", "g2", "g3", "g4", "g5", "g7", "cc");
583 goto out;
584 }
585 - advance(regs);
586 + if (err)
587 + goto kill_user;
588 + else
589 + advance(regs);
590 goto out;
591 }
592
593 diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c
594 index e2027f2..2650d0d 100644
595 --- a/arch/sparc64/mm/fault.c
596 +++ b/arch/sparc64/mm/fault.c
597 @@ -244,16 +244,8 @@ static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code,
598 if (regs->tstate & TSTATE_PRIV) {
599 const struct exception_table_entry *entry;
600
601 - if (asi == ASI_P && (insn & 0xc0800000) == 0xc0800000) {
602 - if (insn & 0x2000)
603 - asi = (regs->tstate >> 24);
604 - else
605 - asi = (insn >> 5);
606 - }
607 -
608 - /* Look in asi.h: All _S asis have LS bit set */
609 - if ((asi & 0x1) &&
610 - (entry = search_exception_tables(regs->tpc))) {
611 + entry = search_exception_tables(regs->tpc);
612 + if (entry) {
613 regs->tpc = entry->fixup;
614 regs->tnpc = regs->tpc + 4;
615 return;
616 @@ -294,7 +286,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
617 unsigned long tpc = regs->tpc;
618
619 /* Sanity check the PC. */
620 - if ((tpc >= KERNBASE && tpc < (unsigned long) _etext) ||
621 + if ((tpc >= KERNBASE && tpc < (unsigned long) __init_end) ||
622 (tpc >= MODULES_VADDR && tpc < MODULES_END)) {
623 /* Valid, no problems... */
624 } else {
625 diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
626 index 6ea19c2..4eaaf78 100644
627 --- a/arch/x86/ia32/ia32_signal.c
628 +++ b/arch/x86/ia32/ia32_signal.c
629 @@ -494,7 +494,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
630 regs->ss = __USER32_DS;
631
632 set_fs(USER_DS);
633 - regs->eflags &= ~TF_MASK;
634 + regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
635 if (test_thread_flag(TIF_SINGLESTEP))
636 ptrace_notify(SIGTRAP);
637
638 @@ -600,7 +600,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
639 regs->ss = __USER32_DS;
640
641 set_fs(USER_DS);
642 - regs->eflags &= ~TF_MASK;
643 + regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
644 if (test_thread_flag(TIF_SINGLESTEP))
645 ptrace_notify(SIGTRAP);
646
647 diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
648 index edb5108..c48fbb1 100644
649 --- a/arch/x86/kernel/apic_32.c
650 +++ b/arch/x86/kernel/apic_32.c
651 @@ -154,7 +154,7 @@ unsigned long safe_apic_wait_icr_idle(void)
652 /**
653 * enable_NMI_through_LVT0 - enable NMI through local vector table 0
654 */
655 -void enable_NMI_through_LVT0 (void * dummy)
656 +void __cpuinit enable_NMI_through_LVT0(void)
657 {
658 unsigned int v = APIC_DM_NMI;
659
660 diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
661 index f28ccb5..0173007 100644
662 --- a/arch/x86/kernel/apic_64.c
663 +++ b/arch/x86/kernel/apic_64.c
664 @@ -151,7 +151,7 @@ unsigned int safe_apic_wait_icr_idle(void)
665 return send_status;
666 }
667
668 -void enable_NMI_through_LVT0 (void * dummy)
669 +void enable_NMI_through_LVT0(void)
670 {
671 unsigned int v;
672
673 diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
674 index a6b1490..232fdeb 100644
675 --- a/arch/x86/kernel/io_apic_32.c
676 +++ b/arch/x86/kernel/io_apic_32.c
677 @@ -2080,7 +2080,7 @@ static struct irq_chip lapic_chip __read_mostly = {
678 .eoi = ack_apic,
679 };
680
681 -static void setup_nmi (void)
682 +static void __init setup_nmi(void)
683 {
684 /*
685 * Dirty trick to enable the NMI watchdog ...
686 @@ -2093,7 +2093,7 @@ static void setup_nmi (void)
687 */
688 apic_printk(APIC_VERBOSE, KERN_INFO "activating NMI Watchdog ...");
689
690 - on_each_cpu(enable_NMI_through_LVT0, NULL, 1, 1);
691 + enable_NMI_through_LVT0();
692
693 apic_printk(APIC_VERBOSE, " done.\n");
694 }
695 diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
696 index cbac167..7119cb7 100644
697 --- a/arch/x86/kernel/io_apic_64.c
698 +++ b/arch/x86/kernel/io_apic_64.c
699 @@ -1565,7 +1565,7 @@ static struct hw_interrupt_type lapic_irq_type __read_mostly = {
700 .end = end_lapic_irq,
701 };
702
703 -static void setup_nmi (void)
704 +static void __init setup_nmi(void)
705 {
706 /*
707 * Dirty trick to enable the NMI watchdog ...
708 @@ -1578,7 +1578,7 @@ static void setup_nmi (void)
709 */
710 printk(KERN_INFO "activating NMI Watchdog ...");
711
712 - enable_NMI_through_LVT0(NULL);
713 + enable_NMI_through_LVT0();
714
715 printk(" done.\n");
716 }
717 @@ -1654,7 +1654,7 @@ static inline void unlock_ExtINT_logic(void)
718 *
719 * FIXME: really need to revamp this for modern platforms only.
720 */
721 -static inline void check_timer(void)
722 +static inline void __init check_timer(void)
723 {
724 struct irq_cfg *cfg = irq_cfg + 0;
725 int apic1, pin1, apic2, pin2;
726 diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
727 index ab79e1d..d7f7132 100644
728 --- a/arch/x86/kernel/process_64.c
729 +++ b/arch/x86/kernel/process_64.c
730 @@ -212,14 +212,13 @@ void cpu_idle (void)
731 current_thread_info()->status |= TS_POLLING;
732 /* endless idle loop with no priority at all */
733 while (1) {
734 + tick_nohz_stop_sched_tick();
735 while (!need_resched()) {
736 void (*idle)(void);
737
738 if (__get_cpu_var(cpu_idle_state))
739 __get_cpu_var(cpu_idle_state) = 0;
740
741 - tick_nohz_stop_sched_tick();
742 -
743 rmb();
744 idle = pm_idle;
745 if (!idle)
746 diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
747 index 9bdd830..20056db 100644
748 --- a/arch/x86/kernel/signal_32.c
749 +++ b/arch/x86/kernel/signal_32.c
750 @@ -396,7 +396,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
751 * The tracer may want to single-step inside the
752 * handler too.
753 */
754 - regs->eflags &= ~TF_MASK;
755 + regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
756 if (test_thread_flag(TIF_SINGLESTEP))
757 ptrace_notify(SIGTRAP);
758
759 @@ -489,7 +489,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
760 * The tracer may want to single-step inside the
761 * handler too.
762 */
763 - regs->eflags &= ~TF_MASK;
764 + regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
765 if (test_thread_flag(TIF_SINGLESTEP))
766 ptrace_notify(SIGTRAP);
767
768 diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
769 index ab086b0..62964c5 100644
770 --- a/arch/x86/kernel/signal_64.c
771 +++ b/arch/x86/kernel/signal_64.c
772 @@ -295,7 +295,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
773 see include/asm-x86_64/uaccess.h for details. */
774 set_fs(USER_DS);
775
776 - regs->eflags &= ~TF_MASK;
777 + regs->eflags &= ~(TF_MASK | X86_EFLAGS_DF);
778 if (test_thread_flag(TIF_SINGLESTEP))
779 ptrace_notify(SIGTRAP);
780 #ifdef DEBUG_SIG
781 diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c
782 index 4ea80cb..fe200cf 100644
783 --- a/arch/x86/kernel/smpboot_32.c
784 +++ b/arch/x86/kernel/smpboot_32.c
785 @@ -405,7 +405,7 @@ static void __cpuinit start_secondary(void *unused)
786 setup_secondary_clock();
787 if (nmi_watchdog == NMI_IO_APIC) {
788 disable_8259A_irq(0);
789 - enable_NMI_through_LVT0(NULL);
790 + enable_NMI_through_LVT0();
791 enable_8259A_irq(0);
792 }
793 /*
794 diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
795 index aaf4e12..eca8026 100644
796 --- a/arch/x86/kernel/smpboot_64.c
797 +++ b/arch/x86/kernel/smpboot_64.c
798 @@ -338,7 +338,7 @@ void __cpuinit start_secondary(void)
799
800 if (nmi_watchdog == NMI_IO_APIC) {
801 disable_8259A_irq(0);
802 - enable_NMI_through_LVT0(NULL);
803 + enable_NMI_through_LVT0();
804 enable_8259A_irq(0);
805 }
806
807 diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
808 index 4df637e..6b521d3 100644
809 --- a/arch/x86/pci/mmconfig-shared.c
810 +++ b/arch/x86/pci/mmconfig-shared.c
811 @@ -22,42 +22,9 @@
812 #define MMCONFIG_APER_MIN (2 * 1024*1024)
813 #define MMCONFIG_APER_MAX (256 * 1024*1024)
814
815 -DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS);
816 -
817 /* Indicate if the mmcfg resources have been placed into the resource table. */
818 static int __initdata pci_mmcfg_resources_inserted;
819
820 -/* K8 systems have some devices (typically in the builtin northbridge)
821 - that are only accessible using type1
822 - Normally this can be expressed in the MCFG by not listing them
823 - and assigning suitable _SEGs, but this isn't implemented in some BIOS.
824 - Instead try to discover all devices on bus 0 that are unreachable using MM
825 - and fallback for them. */
826 -static void __init unreachable_devices(void)
827 -{
828 - int i, bus;
829 - /* Use the max bus number from ACPI here? */
830 - for (bus = 0; bus < PCI_MMCFG_MAX_CHECK_BUS; bus++) {
831 - for (i = 0; i < 32; i++) {
832 - unsigned int devfn = PCI_DEVFN(i, 0);
833 - u32 val1, val2;
834 -
835 - pci_conf1_read(0, bus, devfn, 0, 4, &val1);
836 - if (val1 == 0xffffffff)
837 - continue;
838 -
839 - if (pci_mmcfg_arch_reachable(0, bus, devfn)) {
840 - raw_pci_ops->read(0, bus, devfn, 0, 4, &val2);
841 - if (val1 == val2)
842 - continue;
843 - }
844 - set_bit(i + 32 * bus, pci_mmcfg_fallback_slots);
845 - printk(KERN_NOTICE "PCI: No mmconfig possible on device"
846 - " %02x:%02x\n", bus, i);
847 - }
848 - }
849 -}
850 -
851 static const char __init *pci_mmcfg_e7520(void)
852 {
853 u32 win;
854 @@ -270,8 +237,6 @@ void __init pci_mmcfg_init(int type)
855 return;
856
857 if (pci_mmcfg_arch_init()) {
858 - if (type == 1)
859 - unreachable_devices();
860 if (known_bridge)
861 pci_mmcfg_insert_resources(IORESOURCE_BUSY);
862 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
863 diff --git a/arch/x86/pci/mmconfig_32.c b/arch/x86/pci/mmconfig_32.c
864 index 1bf5816..7b75e65 100644
865 --- a/arch/x86/pci/mmconfig_32.c
866 +++ b/arch/x86/pci/mmconfig_32.c
867 @@ -30,10 +30,6 @@ static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
868 struct acpi_mcfg_allocation *cfg;
869 int cfg_num;
870
871 - if (seg == 0 && bus < PCI_MMCFG_MAX_CHECK_BUS &&
872 - test_bit(PCI_SLOT(devfn) + 32*bus, pci_mmcfg_fallback_slots))
873 - return 0;
874 -
875 for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) {
876 cfg = &pci_mmcfg_config[cfg_num];
877 if (cfg->pci_segment == seg &&
878 @@ -68,13 +64,16 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
879 u32 base;
880
881 if ((bus > 255) || (devfn > 255) || (reg > 4095)) {
882 - *value = -1;
883 +err: *value = -1;
884 return -EINVAL;
885 }
886
887 + if (reg < 256)
888 + return pci_conf1_read(seg,bus,devfn,reg,len,value);
889 +
890 base = get_base_addr(seg, bus, devfn);
891 if (!base)
892 - return pci_conf1_read(seg,bus,devfn,reg,len,value);
893 + goto err;
894
895 spin_lock_irqsave(&pci_config_lock, flags);
896
897 @@ -105,9 +104,12 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
898 if ((bus > 255) || (devfn > 255) || (reg > 4095))
899 return -EINVAL;
900
901 + if (reg < 256)
902 + return pci_conf1_write(seg,bus,devfn,reg,len,value);
903 +
904 base = get_base_addr(seg, bus, devfn);
905 if (!base)
906 - return pci_conf1_write(seg,bus,devfn,reg,len,value);
907 + return -EINVAL;
908
909 spin_lock_irqsave(&pci_config_lock, flags);
910
911 @@ -134,12 +136,6 @@ static struct pci_raw_ops pci_mmcfg = {
912 .write = pci_mmcfg_write,
913 };
914
915 -int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
916 - unsigned int devfn)
917 -{
918 - return get_base_addr(seg, bus, devfn) != 0;
919 -}
920 -
921 int __init pci_mmcfg_arch_init(void)
922 {
923 printk(KERN_INFO "PCI: Using MMCONFIG\n");
924 diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c
925 index 4095e4d..c4cf318 100644
926 --- a/arch/x86/pci/mmconfig_64.c
927 +++ b/arch/x86/pci/mmconfig_64.c
928 @@ -40,9 +40,7 @@ static char __iomem *get_virt(unsigned int seg, unsigned bus)
929 static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
930 {
931 char __iomem *addr;
932 - if (seg == 0 && bus < PCI_MMCFG_MAX_CHECK_BUS &&
933 - test_bit(32*bus + PCI_SLOT(devfn), pci_mmcfg_fallback_slots))
934 - return NULL;
935 +
936 addr = get_virt(seg, bus);
937 if (!addr)
938 return NULL;
939 @@ -56,13 +54,16 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
940
941 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */
942 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) {
943 - *value = -1;
944 +err: *value = -1;
945 return -EINVAL;
946 }
947
948 + if (reg < 256)
949 + return pci_conf1_read(seg,bus,devfn,reg,len,value);
950 +
951 addr = pci_dev_base(seg, bus, devfn);
952 if (!addr)
953 - return pci_conf1_read(seg,bus,devfn,reg,len,value);
954 + goto err;
955
956 switch (len) {
957 case 1:
958 @@ -88,9 +89,12 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
959 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095)))
960 return -EINVAL;
961
962 + if (reg < 256)
963 + return pci_conf1_write(seg,bus,devfn,reg,len,value);
964 +
965 addr = pci_dev_base(seg, bus, devfn);
966 if (!addr)
967 - return pci_conf1_write(seg,bus,devfn,reg,len,value);
968 + return -EINVAL;
969
970 switch (len) {
971 case 1:
972 @@ -126,12 +130,6 @@ static void __iomem * __init mcfg_ioremap(struct acpi_mcfg_allocation *cfg)
973 return addr;
974 }
975
976 -int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
977 - unsigned int devfn)
978 -{
979 - return pci_dev_base(seg, bus, devfn) != NULL;
980 -}
981 -
982 int __init pci_mmcfg_arch_init(void)
983 {
984 int i;
985 diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h
986 index ac56d39..36cb44c 100644
987 --- a/arch/x86/pci/pci.h
988 +++ b/arch/x86/pci/pci.h
989 @@ -98,13 +98,6 @@ extern void pcibios_sort(void);
990
991 /* pci-mmconfig.c */
992
993 -/* Verify the first 16 busses. We assume that systems with more busses
994 - get MCFG right. */
995 -#define PCI_MMCFG_MAX_CHECK_BUS 16
996 -extern DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS);
997 -
998 -extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
999 - unsigned int devfn);
1000 extern int __init pci_mmcfg_arch_init(void);
1001
1002 /*
1003 diff --git a/crypto/async_tx/async_xor.c b/crypto/async_tx/async_xor.c
1004 index 2575f67..5c579d2 100644
1005 --- a/crypto/async_tx/async_xor.c
1006 +++ b/crypto/async_tx/async_xor.c
1007 @@ -264,7 +264,7 @@ async_xor_zero_sum(struct page *dest, struct page **src_list,
1008
1009 BUG_ON(src_cnt <= 1);
1010
1011 - if (tx) {
1012 + if (tx && src_cnt <= device->max_xor) {
1013 dma_addr_t dma_addr;
1014 enum dma_data_direction dir;
1015
1016 diff --git a/crypto/xcbc.c b/crypto/xcbc.c
1017 index ac68f3b..a957373 100644
1018 --- a/crypto/xcbc.c
1019 +++ b/crypto/xcbc.c
1020 @@ -124,6 +124,11 @@ static int crypto_xcbc_digest_update2(struct hash_desc *pdesc,
1021 unsigned int offset = sg[i].offset;
1022 unsigned int slen = sg[i].length;
1023
1024 + if (unlikely(slen > nbytes))
1025 + slen = nbytes;
1026 +
1027 + nbytes -= slen;
1028 +
1029 while (slen > 0) {
1030 unsigned int len = min(slen, ((unsigned int)(PAGE_SIZE)) - offset);
1031 char *p = crypto_kmap(pg, 0) + offset;
1032 @@ -177,7 +182,6 @@ static int crypto_xcbc_digest_update2(struct hash_desc *pdesc,
1033 offset = 0;
1034 pg++;
1035 }
1036 - nbytes-=sg[i].length;
1037 i++;
1038 } while (nbytes>0);
1039
1040 diff --git a/crypto/xts.c b/crypto/xts.c
1041 index 8eb08bf..d87b0f3 100644
1042 --- a/crypto/xts.c
1043 +++ b/crypto/xts.c
1044 @@ -77,16 +77,16 @@ static int setkey(struct crypto_tfm *parent, const u8 *key,
1045 }
1046
1047 struct sinfo {
1048 - be128 t;
1049 + be128 *t;
1050 struct crypto_tfm *tfm;
1051 void (*fn)(struct crypto_tfm *, u8 *, const u8 *);
1052 };
1053
1054 static inline void xts_round(struct sinfo *s, void *dst, const void *src)
1055 {
1056 - be128_xor(dst, &s->t, src); /* PP <- T xor P */
1057 + be128_xor(dst, s->t, src); /* PP <- T xor P */
1058 s->fn(s->tfm, dst, dst); /* CC <- E(Key1,PP) */
1059 - be128_xor(dst, dst, &s->t); /* C <- T xor CC */
1060 + be128_xor(dst, dst, s->t); /* C <- T xor CC */
1061 }
1062
1063 static int crypt(struct blkcipher_desc *d,
1064 @@ -101,7 +101,6 @@ static int crypt(struct blkcipher_desc *d,
1065 .tfm = crypto_cipher_tfm(ctx->child),
1066 .fn = fn
1067 };
1068 - be128 *iv;
1069 u8 *wsrc;
1070 u8 *wdst;
1071
1072 @@ -109,20 +108,20 @@ static int crypt(struct blkcipher_desc *d,
1073 if (!w->nbytes)
1074 return err;
1075
1076 + s.t = (be128 *)w->iv;
1077 avail = w->nbytes;
1078
1079 wsrc = w->src.virt.addr;
1080 wdst = w->dst.virt.addr;
1081
1082 /* calculate first value of T */
1083 - iv = (be128 *)w->iv;
1084 - tw(crypto_cipher_tfm(ctx->tweak), (void *)&s.t, w->iv);
1085 + tw(crypto_cipher_tfm(ctx->tweak), w->iv, w->iv);
1086
1087 goto first;
1088
1089 for (;;) {
1090 do {
1091 - gf128mul_x_ble(&s.t, &s.t);
1092 + gf128mul_x_ble(s.t, s.t);
1093
1094 first:
1095 xts_round(&s, wdst, wsrc);
1096 diff --git a/drivers/acorn/char/defkeymap-l7200.c b/drivers/acorn/char/defkeymap-l7200.c
1097 index 28a5fbc..93d80a1 100644
1098 --- a/drivers/acorn/char/defkeymap-l7200.c
1099 +++ b/drivers/acorn/char/defkeymap-l7200.c
1100 @@ -347,40 +347,40 @@ char *func_table[MAX_NR_FUNC] = {
1101 };
1102
1103 struct kbdiacruc accent_table[MAX_DIACR] = {
1104 - {'`', 'A', '\300'}, {'`', 'a', '\340'},
1105 - {'\'', 'A', '\301'}, {'\'', 'a', '\341'},
1106 - {'^', 'A', '\302'}, {'^', 'a', '\342'},
1107 - {'~', 'A', '\303'}, {'~', 'a', '\343'},
1108 - {'"', 'A', '\304'}, {'"', 'a', '\344'},
1109 - {'O', 'A', '\305'}, {'o', 'a', '\345'},
1110 - {'0', 'A', '\305'}, {'0', 'a', '\345'},
1111 - {'A', 'A', '\305'}, {'a', 'a', '\345'},
1112 - {'A', 'E', '\306'}, {'a', 'e', '\346'},
1113 - {',', 'C', '\307'}, {',', 'c', '\347'},
1114 - {'`', 'E', '\310'}, {'`', 'e', '\350'},
1115 - {'\'', 'E', '\311'}, {'\'', 'e', '\351'},
1116 - {'^', 'E', '\312'}, {'^', 'e', '\352'},
1117 - {'"', 'E', '\313'}, {'"', 'e', '\353'},
1118 - {'`', 'I', '\314'}, {'`', 'i', '\354'},
1119 - {'\'', 'I', '\315'}, {'\'', 'i', '\355'},
1120 - {'^', 'I', '\316'}, {'^', 'i', '\356'},
1121 - {'"', 'I', '\317'}, {'"', 'i', '\357'},
1122 - {'-', 'D', '\320'}, {'-', 'd', '\360'},
1123 - {'~', 'N', '\321'}, {'~', 'n', '\361'},
1124 - {'`', 'O', '\322'}, {'`', 'o', '\362'},
1125 - {'\'', 'O', '\323'}, {'\'', 'o', '\363'},
1126 - {'^', 'O', '\324'}, {'^', 'o', '\364'},
1127 - {'~', 'O', '\325'}, {'~', 'o', '\365'},
1128 - {'"', 'O', '\326'}, {'"', 'o', '\366'},
1129 - {'/', 'O', '\330'}, {'/', 'o', '\370'},
1130 - {'`', 'U', '\331'}, {'`', 'u', '\371'},
1131 - {'\'', 'U', '\332'}, {'\'', 'u', '\372'},
1132 - {'^', 'U', '\333'}, {'^', 'u', '\373'},
1133 - {'"', 'U', '\334'}, {'"', 'u', '\374'},
1134 - {'\'', 'Y', '\335'}, {'\'', 'y', '\375'},
1135 - {'T', 'H', '\336'}, {'t', 'h', '\376'},
1136 - {'s', 's', '\337'}, {'"', 'y', '\377'},
1137 - {'s', 'z', '\337'}, {'i', 'j', '\377'},
1138 + {'`', 'A', 0300}, {'`', 'a', 0340},
1139 + {'\'', 'A', 0301}, {'\'', 'a', 0341},
1140 + {'^', 'A', 0302}, {'^', 'a', 0342},
1141 + {'~', 'A', 0303}, {'~', 'a', 0343},
1142 + {'"', 'A', 0304}, {'"', 'a', 0344},
1143 + {'O', 'A', 0305}, {'o', 'a', 0345},
1144 + {'0', 'A', 0305}, {'0', 'a', 0345},
1145 + {'A', 'A', 0305}, {'a', 'a', 0345},
1146 + {'A', 'E', 0306}, {'a', 'e', 0346},
1147 + {',', 'C', 0307}, {',', 'c', 0347},
1148 + {'`', 'E', 0310}, {'`', 'e', 0350},
1149 + {'\'', 'E', 0311}, {'\'', 'e', 0351},
1150 + {'^', 'E', 0312}, {'^', 'e', 0352},
1151 + {'"', 'E', 0313}, {'"', 'e', 0353},
1152 + {'`', 'I', 0314}, {'`', 'i', 0354},
1153 + {'\'', 'I', 0315}, {'\'', 'i', 0355},
1154 + {'^', 'I', 0316}, {'^', 'i', 0356},
1155 + {'"', 'I', 0317}, {'"', 'i', 0357},
1156 + {'-', 'D', 0320}, {'-', 'd', 0360},
1157 + {'~', 'N', 0321}, {'~', 'n', 0361},
1158 + {'`', 'O', 0322}, {'`', 'o', 0362},
1159 + {'\'', 'O', 0323}, {'\'', 'o', 0363},
1160 + {'^', 'O', 0324}, {'^', 'o', 0364},
1161 + {'~', 'O', 0325}, {'~', 'o', 0365},
1162 + {'"', 'O', 0326}, {'"', 'o', 0366},
1163 + {'/', 'O', 0330}, {'/', 'o', 0370},
1164 + {'`', 'U', 0331}, {'`', 'u', 0371},
1165 + {'\'', 'U', 0332}, {'\'', 'u', 0372},
1166 + {'^', 'U', 0333}, {'^', 'u', 0373},
1167 + {'"', 'U', 0334}, {'"', 'u', 0374},
1168 + {'\'', 'Y', 0335}, {'\'', 'y', 0375},
1169 + {'T', 'H', 0336}, {'t', 'h', 0376},
1170 + {'s', 's', 0337}, {'"', 'y', 0377},
1171 + {'s', 'z', 0337}, {'i', 'j', 0377},
1172 };
1173
1174 unsigned int accent_table_size = 68;
1175 diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
1176 index 0713872..a742efa 100644
1177 --- a/drivers/ata/pata_hpt366.c
1178 +++ b/drivers/ata/pata_hpt366.c
1179 @@ -27,7 +27,7 @@
1180 #include <linux/libata.h>
1181
1182 #define DRV_NAME "pata_hpt366"
1183 -#define DRV_VERSION "0.6.1"
1184 +#define DRV_VERSION "0.6.2"
1185
1186 struct hpt_clock {
1187 u8 xfer_speed;
1188 @@ -180,9 +180,9 @@ static unsigned long hpt366_filter(struct ata_device *adev, unsigned long mask)
1189 if (hpt_dma_blacklisted(adev, "UDMA", bad_ata33))
1190 mask &= ~ATA_MASK_UDMA;
1191 if (hpt_dma_blacklisted(adev, "UDMA3", bad_ata66_3))
1192 - mask &= ~(0x07 << ATA_SHIFT_UDMA);
1193 + mask &= ~(0xF8 << ATA_SHIFT_UDMA);
1194 if (hpt_dma_blacklisted(adev, "UDMA4", bad_ata66_4))
1195 - mask &= ~(0x0F << ATA_SHIFT_UDMA);
1196 + mask &= ~(0xF0 << ATA_SHIFT_UDMA);
1197 }
1198 return ata_pci_default_filter(adev, mask);
1199 }
1200 diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
1201 index c79f066..eac6a2b 100644
1202 --- a/drivers/ata/pata_hpt37x.c
1203 +++ b/drivers/ata/pata_hpt37x.c
1204 @@ -24,7 +24,7 @@
1205 #include <linux/libata.h>
1206
1207 #define DRV_NAME "pata_hpt37x"
1208 -#define DRV_VERSION "0.6.9"
1209 +#define DRV_VERSION "0.6.11"
1210
1211 struct hpt_clock {
1212 u8 xfer_speed;
1213 @@ -281,7 +281,7 @@ static unsigned long hpt370_filter(struct ata_device *adev, unsigned long mask)
1214 if (hpt_dma_blacklisted(adev, "UDMA", bad_ata33))
1215 mask &= ~ATA_MASK_UDMA;
1216 if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
1217 - mask &= ~(0x1F << ATA_SHIFT_UDMA);
1218 + mask &= ~(0xE0 << ATA_SHIFT_UDMA);
1219 }
1220 return ata_pci_default_filter(adev, mask);
1221 }
1222 @@ -297,7 +297,7 @@ static unsigned long hpt370a_filter(struct ata_device *adev, unsigned long mask)
1223 {
1224 if (adev->class == ATA_DEV_ATA) {
1225 if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
1226 - mask &= ~ (0x1F << ATA_SHIFT_UDMA);
1227 + mask &= ~(0xE0 << ATA_SHIFT_UDMA);
1228 }
1229 return ata_pci_default_filter(adev, mask);
1230 }
1231 diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
1232 index 8bed888..004cac7 100644
1233 --- a/drivers/ata/pata_serverworks.c
1234 +++ b/drivers/ata/pata_serverworks.c
1235 @@ -226,7 +226,7 @@ static unsigned long serverworks_csb_filter(struct ata_device *adev, unsigned lo
1236
1237 for (i = 0; (p = csb_bad_ata100[i]) != NULL; i++) {
1238 if (!strcmp(p, model_num))
1239 - mask &= ~(0x1F << ATA_SHIFT_UDMA);
1240 + mask &= ~(0xE0 << ATA_SHIFT_UDMA);
1241 }
1242 return ata_pci_default_filter(adev, mask);
1243 }
1244 diff --git a/drivers/base/platform.c b/drivers/base/platform.c
1245 index fb56092..39d8b7b 100644
1246 --- a/drivers/base/platform.c
1247 +++ b/drivers/base/platform.c
1248 @@ -647,7 +647,7 @@ u64 dma_get_required_mask(struct device *dev)
1249 high_totalram += high_totalram - 1;
1250 mask = (((u64)high_totalram) << 32) + 0xffffffff;
1251 }
1252 - return mask & *dev->dma_mask;
1253 + return mask;
1254 }
1255 EXPORT_SYMBOL_GPL(dma_get_required_mask);
1256 #endif
1257 diff --git a/drivers/block/ub.c b/drivers/block/ub.c
1258 index 08e909d..7aca466 100644
1259 --- a/drivers/block/ub.c
1260 +++ b/drivers/block/ub.c
1261 @@ -657,7 +657,6 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq)
1262 if ((cmd = ub_get_cmd(lun)) == NULL)
1263 return -1;
1264 memset(cmd, 0, sizeof(struct ub_scsi_cmd));
1265 - sg_init_table(cmd->sgv, UB_MAX_REQ_SG);
1266
1267 blkdev_dequeue_request(rq);
1268
1269 @@ -668,6 +667,7 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq)
1270 /*
1271 * get scatterlist from block layer
1272 */
1273 + sg_init_table(&urq->sgv[0], UB_MAX_REQ_SG);
1274 n_elem = blk_rq_map_sg(lun->disk->queue, rq, &urq->sgv[0]);
1275 if (n_elem < 0) {
1276 /* Impossible, because blk_rq_map_sg should not hit ENOMEM. */
1277 diff --git a/drivers/char/defkeymap.c_shipped b/drivers/char/defkeymap.c_shipped
1278 index 0aa419a..d2208df 100644
1279 --- a/drivers/char/defkeymap.c_shipped
1280 +++ b/drivers/char/defkeymap.c_shipped
1281 @@ -223,40 +223,40 @@ char *func_table[MAX_NR_FUNC] = {
1282 };
1283
1284 struct kbdiacruc accent_table[MAX_DIACR] = {
1285 - {'`', 'A', '\300'}, {'`', 'a', '\340'},
1286 - {'\'', 'A', '\301'}, {'\'', 'a', '\341'},
1287 - {'^', 'A', '\302'}, {'^', 'a', '\342'},
1288 - {'~', 'A', '\303'}, {'~', 'a', '\343'},
1289 - {'"', 'A', '\304'}, {'"', 'a', '\344'},
1290 - {'O', 'A', '\305'}, {'o', 'a', '\345'},
1291 - {'0', 'A', '\305'}, {'0', 'a', '\345'},
1292 - {'A', 'A', '\305'}, {'a', 'a', '\345'},
1293 - {'A', 'E', '\306'}, {'a', 'e', '\346'},
1294 - {',', 'C', '\307'}, {',', 'c', '\347'},
1295 - {'`', 'E', '\310'}, {'`', 'e', '\350'},
1296 - {'\'', 'E', '\311'}, {'\'', 'e', '\351'},
1297 - {'^', 'E', '\312'}, {'^', 'e', '\352'},
1298 - {'"', 'E', '\313'}, {'"', 'e', '\353'},
1299 - {'`', 'I', '\314'}, {'`', 'i', '\354'},
1300 - {'\'', 'I', '\315'}, {'\'', 'i', '\355'},
1301 - {'^', 'I', '\316'}, {'^', 'i', '\356'},
1302 - {'"', 'I', '\317'}, {'"', 'i', '\357'},
1303 - {'-', 'D', '\320'}, {'-', 'd', '\360'},
1304 - {'~', 'N', '\321'}, {'~', 'n', '\361'},
1305 - {'`', 'O', '\322'}, {'`', 'o', '\362'},
1306 - {'\'', 'O', '\323'}, {'\'', 'o', '\363'},
1307 - {'^', 'O', '\324'}, {'^', 'o', '\364'},
1308 - {'~', 'O', '\325'}, {'~', 'o', '\365'},
1309 - {'"', 'O', '\326'}, {'"', 'o', '\366'},
1310 - {'/', 'O', '\330'}, {'/', 'o', '\370'},
1311 - {'`', 'U', '\331'}, {'`', 'u', '\371'},
1312 - {'\'', 'U', '\332'}, {'\'', 'u', '\372'},
1313 - {'^', 'U', '\333'}, {'^', 'u', '\373'},
1314 - {'"', 'U', '\334'}, {'"', 'u', '\374'},
1315 - {'\'', 'Y', '\335'}, {'\'', 'y', '\375'},
1316 - {'T', 'H', '\336'}, {'t', 'h', '\376'},
1317 - {'s', 's', '\337'}, {'"', 'y', '\377'},
1318 - {'s', 'z', '\337'}, {'i', 'j', '\377'},
1319 + {'`', 'A', 0300}, {'`', 'a', 0340},
1320 + {'\'', 'A', 0301}, {'\'', 'a', 0341},
1321 + {'^', 'A', 0302}, {'^', 'a', 0342},
1322 + {'~', 'A', 0303}, {'~', 'a', 0343},
1323 + {'"', 'A', 0304}, {'"', 'a', 0344},
1324 + {'O', 'A', 0305}, {'o', 'a', 0345},
1325 + {'0', 'A', 0305}, {'0', 'a', 0345},
1326 + {'A', 'A', 0305}, {'a', 'a', 0345},
1327 + {'A', 'E', 0306}, {'a', 'e', 0346},
1328 + {',', 'C', 0307}, {',', 'c', 0347},
1329 + {'`', 'E', 0310}, {'`', 'e', 0350},
1330 + {'\'', 'E', 0311}, {'\'', 'e', 0351},
1331 + {'^', 'E', 0312}, {'^', 'e', 0352},
1332 + {'"', 'E', 0313}, {'"', 'e', 0353},
1333 + {'`', 'I', 0314}, {'`', 'i', 0354},
1334 + {'\'', 'I', 0315}, {'\'', 'i', 0355},
1335 + {'^', 'I', 0316}, {'^', 'i', 0356},
1336 + {'"', 'I', 0317}, {'"', 'i', 0357},
1337 + {'-', 'D', 0320}, {'-', 'd', 0360},
1338 + {'~', 'N', 0321}, {'~', 'n', 0361},
1339 + {'`', 'O', 0322}, {'`', 'o', 0362},
1340 + {'\'', 'O', 0323}, {'\'', 'o', 0363},
1341 + {'^', 'O', 0324}, {'^', 'o', 0364},
1342 + {'~', 'O', 0325}, {'~', 'o', 0365},
1343 + {'"', 'O', 0326}, {'"', 'o', 0366},
1344 + {'/', 'O', 0330}, {'/', 'o', 0370},
1345 + {'`', 'U', 0331}, {'`', 'u', 0371},
1346 + {'\'', 'U', 0332}, {'\'', 'u', 0372},
1347 + {'^', 'U', 0333}, {'^', 'u', 0373},
1348 + {'"', 'U', 0334}, {'"', 'u', 0374},
1349 + {'\'', 'Y', 0335}, {'\'', 'y', 0375},
1350 + {'T', 'H', 0336}, {'t', 'h', 0376},
1351 + {'s', 's', 0337}, {'"', 'y', 0377},
1352 + {'s', 'z', 0337}, {'i', 'j', 0377},
1353 };
1354
1355 unsigned int accent_table_size = 68;
1356 diff --git a/drivers/char/vt.c b/drivers/char/vt.c
1357 index 7a5badf..93cfe4a 100644
1358 --- a/drivers/char/vt.c
1359 +++ b/drivers/char/vt.c
1360 @@ -702,6 +702,7 @@ void redraw_screen(struct vc_data *vc, int is_switch)
1361 if (is_switch) {
1362 set_leds();
1363 compute_shiftstate();
1364 + notify_update(vc);
1365 }
1366 }
1367
1368 diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
1369 index 45e7b46..8cf542b 100644
1370 --- a/drivers/dma/ioat_dma.c
1371 +++ b/drivers/dma/ioat_dma.c
1372 @@ -726,6 +726,7 @@ static struct dma_async_tx_descriptor *ioat1_dma_prep_memcpy(
1373
1374 if (new) {
1375 new->len = len;
1376 + new->async_tx.ack = 0;
1377 return &new->async_tx;
1378 } else
1379 return NULL;
1380 @@ -749,6 +750,7 @@ static struct dma_async_tx_descriptor *ioat2_dma_prep_memcpy(
1381
1382 if (new) {
1383 new->len = len;
1384 + new->async_tx.ack = 0;
1385 return &new->async_tx;
1386 } else
1387 return NULL;
1388 diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
1389 index e4c94f9..c8d3ffb 100644
1390 --- a/drivers/message/fusion/mptsas.c
1391 +++ b/drivers/message/fusion/mptsas.c
1392 @@ -1699,6 +1699,11 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
1393 if (error)
1394 goto out_free_consistent;
1395
1396 + if (!buffer->NumPhys) {
1397 + error = -ENODEV;
1398 + goto out_free_consistent;
1399 + }
1400 +
1401 /* save config data */
1402 port_info->num_phys = buffer->NumPhys;
1403 port_info->phy_info = kcalloc(port_info->num_phys,
1404 diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
1405 index 9cc5a6b..55584ee 100644
1406 --- a/drivers/net/e1000e/netdev.c
1407 +++ b/drivers/net/e1000e/netdev.c
1408 @@ -1686,6 +1686,9 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
1409 else
1410 rctl |= E1000_RCTL_LPE;
1411
1412 + /* Enable hardware CRC frame stripping */
1413 + rctl |= E1000_RCTL_SECRC;
1414 +
1415 /* Setup buffer sizes */
1416 rctl &= ~E1000_RCTL_SZ_4096;
1417 rctl |= E1000_RCTL_BSEX;
1418 @@ -1751,9 +1754,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
1419
1420 /* Enable Packet split descriptors */
1421 rctl |= E1000_RCTL_DTYP_PS;
1422 -
1423 - /* Enable hardware CRC frame stripping */
1424 - rctl |= E1000_RCTL_SECRC;
1425
1426 psrctl |= adapter->rx_ps_bsize0 >>
1427 E1000_PSRCTL_BSIZE0_SHIFT;
1428 diff --git a/drivers/net/macb.c b/drivers/net/macb.c
1429 index e10528e..c796948 100644
1430 --- a/drivers/net/macb.c
1431 +++ b/drivers/net/macb.c
1432 @@ -148,7 +148,7 @@ static void macb_handle_link_change(struct net_device *dev)
1433
1434 if (phydev->duplex)
1435 reg |= MACB_BIT(FD);
1436 - if (phydev->speed)
1437 + if (phydev->speed == SPEED_100)
1438 reg |= MACB_BIT(SPD);
1439
1440 macb_writel(bp, NCFGR, reg);
1441 diff --git a/drivers/net/niu.c b/drivers/net/niu.c
1442 index 5f6beab..226dc54 100644
1443 --- a/drivers/net/niu.c
1444 +++ b/drivers/net/niu.c
1445 @@ -33,8 +33,8 @@
1446
1447 #define DRV_MODULE_NAME "niu"
1448 #define PFX DRV_MODULE_NAME ": "
1449 -#define DRV_MODULE_VERSION "0.6"
1450 -#define DRV_MODULE_RELDATE "January 5, 2008"
1451 +#define DRV_MODULE_VERSION "0.7"
1452 +#define DRV_MODULE_RELDATE "February 18, 2008"
1453
1454 static char version[] __devinitdata =
1455 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
1456 @@ -1616,12 +1616,13 @@ static int niu_enable_alt_mac(struct niu *np, int index, int on)
1457 if (index >= niu_num_alt_addr(np))
1458 return -EINVAL;
1459
1460 - if (np->flags & NIU_FLAGS_XMAC)
1461 + if (np->flags & NIU_FLAGS_XMAC) {
1462 reg = XMAC_ADDR_CMPEN;
1463 - else
1464 + mask = 1 << index;
1465 + } else {
1466 reg = BMAC_ADDR_CMPEN;
1467 -
1468 - mask = 1 << index;
1469 + mask = 1 << (index + 1);
1470 + }
1471
1472 val = nr64_mac(reg);
1473 if (on)
1474 @@ -5147,7 +5148,12 @@ static void niu_set_rx_mode(struct net_device *dev)
1475 index++;
1476 }
1477 } else {
1478 - for (i = 0; i < niu_num_alt_addr(np); i++) {
1479 + int alt_start;
1480 + if (np->flags & NIU_FLAGS_XMAC)
1481 + alt_start = 0;
1482 + else
1483 + alt_start = 1;
1484 + for (i = alt_start; i < niu_num_alt_addr(np); i++) {
1485 err = niu_enable_alt_mac(np, i, 0);
1486 if (err)
1487 printk(KERN_WARNING PFX "%s: Error %d "
1488 diff --git a/drivers/net/niu.h b/drivers/net/niu.h
1489 index 0e8626a..59dc05f 100644
1490 --- a/drivers/net/niu.h
1491 +++ b/drivers/net/niu.h
1492 @@ -499,7 +499,7 @@
1493 #define BMAC_ADDR2 0x00110UL
1494 #define BMAC_ADDR2_ADDR2 0x000000000000ffffULL
1495
1496 -#define BMAC_NUM_ALT_ADDR 7
1497 +#define BMAC_NUM_ALT_ADDR 6
1498
1499 #define BMAC_ALT_ADDR0(NUM) (0x00118UL + (NUM)*0x18UL)
1500 #define BMAC_ALT_ADDR0_ADDR0 0x000000000000ffffULL
1501 diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
1502 index 559a9a9..ddcc0c4 100644
1503 --- a/drivers/net/wireless/b43/dma.c
1504 +++ b/drivers/net/wireless/b43/dma.c
1505 @@ -165,7 +165,7 @@ static void op64_fill_descriptor(struct b43_dmaring *ring,
1506 addrhi = (((u64) dmaaddr >> 32) & ~SSB_DMA_TRANSLATION_MASK);
1507 addrext = (((u64) dmaaddr >> 32) & SSB_DMA_TRANSLATION_MASK)
1508 >> SSB_DMA_TRANSLATION_SHIFT;
1509 - addrhi |= ssb_dma_translation(ring->dev->dev);
1510 + addrhi |= (ssb_dma_translation(ring->dev->dev) << 1);
1511 if (slot == ring->nr_slots - 1)
1512 ctl0 |= B43_DMA64_DCTL0_DTABLEEND;
1513 if (start)
1514 @@ -426,9 +426,21 @@ static inline
1515 static int alloc_ringmemory(struct b43_dmaring *ring)
1516 {
1517 struct device *dev = ring->dev->dev->dev;
1518 -
1519 + gfp_t flags = GFP_KERNEL;
1520 +
1521 + /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K
1522 + * alignment and 8K buffers for 64-bit DMA with 8K alignment. Testing
1523 + * has shown that 4K is sufficient for the latter as long as the buffer
1524 + * does not cross an 8K boundary.
1525 + *
1526 + * For unknown reasons - possibly a hardware error - the BCM4311 rev
1527 + * 02, which uses 64-bit DMA, needs the ring buffer in very low memory,
1528 + * which accounts for the GFP_DMA flag below.
1529 + */
1530 + if (ring->dma64)
1531 + flags |= GFP_DMA;
1532 ring->descbase = dma_alloc_coherent(dev, B43_DMA_RINGMEMSIZE,
1533 - &(ring->dmabase), GFP_KERNEL);
1534 + &(ring->dmabase), flags);
1535 if (!ring->descbase) {
1536 b43err(ring->dev->wl, "DMA ringmemory allocation failed\n");
1537 return -ENOMEM;
1538 @@ -483,7 +495,7 @@ int b43_dmacontroller_rx_reset(struct b43_wldev *dev, u16 mmio_base, int dma64)
1539 return 0;
1540 }
1541
1542 -/* Reset the RX DMA channel */
1543 +/* Reset the TX DMA channel */
1544 int b43_dmacontroller_tx_reset(struct b43_wldev *dev, u16 mmio_base, int dma64)
1545 {
1546 int i;
1547 @@ -647,7 +659,7 @@ static int dmacontroller_setup(struct b43_dmaring *ring)
1548 b43_dma_write(ring, B43_DMA64_TXRINGHI,
1549 ((ringbase >> 32) &
1550 ~SSB_DMA_TRANSLATION_MASK)
1551 - | trans);
1552 + | (trans << 1));
1553 } else {
1554 u32 ringbase = (u32) (ring->dmabase);
1555
1556 @@ -680,8 +692,9 @@ static int dmacontroller_setup(struct b43_dmaring *ring)
1557 b43_dma_write(ring, B43_DMA64_RXRINGHI,
1558 ((ringbase >> 32) &
1559 ~SSB_DMA_TRANSLATION_MASK)
1560 - | trans);
1561 - b43_dma_write(ring, B43_DMA64_RXINDEX, 200);
1562 + | (trans << 1));
1563 + b43_dma_write(ring, B43_DMA64_RXINDEX, ring->nr_slots *
1564 + sizeof(struct b43_dmadesc64));
1565 } else {
1566 u32 ringbase = (u32) (ring->dmabase);
1567
1568 @@ -695,11 +708,12 @@ static int dmacontroller_setup(struct b43_dmaring *ring)
1569 b43_dma_write(ring, B43_DMA32_RXRING,
1570 (ringbase & ~SSB_DMA_TRANSLATION_MASK)
1571 | trans);
1572 - b43_dma_write(ring, B43_DMA32_RXINDEX, 200);
1573 + b43_dma_write(ring, B43_DMA32_RXINDEX, ring->nr_slots *
1574 + sizeof(struct b43_dmadesc32));
1575 }
1576 }
1577
1578 - out:
1579 +out:
1580 return err;
1581 }
1582
1583 diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
1584 index 69795fd..36a1de2 100644
1585 --- a/drivers/net/wireless/b43/main.c
1586 +++ b/drivers/net/wireless/b43/main.c
1587 @@ -101,6 +101,7 @@ static const struct ssb_device_id b43_ssb_tbl[] = {
1588 SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 7),
1589 SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 9),
1590 SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 10),
1591 + SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 13),
1592 SSB_DEVTABLE_END
1593 };
1594
1595 @@ -3079,7 +3080,7 @@ static int b43_phy_versioning(struct b43_wldev *dev)
1596 unsupported = 1;
1597 break;
1598 case B43_PHYTYPE_G:
1599 - if (phy_rev > 8)
1600 + if (phy_rev > 9)
1601 unsupported = 1;
1602 break;
1603 default:
1604 diff --git a/drivers/s390/char/defkeymap.c b/drivers/s390/char/defkeymap.c
1605 index 389346c..07c7f31 100644
1606 --- a/drivers/s390/char/defkeymap.c
1607 +++ b/drivers/s390/char/defkeymap.c
1608 @@ -151,8 +151,8 @@ char *func_table[MAX_NR_FUNC] = {
1609 };
1610
1611 struct kbdiacruc accent_table[MAX_DIACR] = {
1612 - {'^', 'c', '\003'}, {'^', 'd', '\004'},
1613 - {'^', 'z', '\032'}, {'^', '\012', '\000'},
1614 + {'^', 'c', 0003}, {'^', 'd', 0004},
1615 + {'^', 'z', 0032}, {'^', 0012, 0000},
1616 };
1617
1618 unsigned int accent_table_size = 4;
1619 diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
1620 index 38a1ee2..f40417b 100644
1621 --- a/drivers/scsi/advansys.c
1622 +++ b/drivers/scsi/advansys.c
1623 @@ -566,7 +566,7 @@ typedef struct asc_dvc_var {
1624 ASC_SCSI_BIT_ID_TYPE unit_not_ready;
1625 ASC_SCSI_BIT_ID_TYPE queue_full_or_busy;
1626 ASC_SCSI_BIT_ID_TYPE start_motor;
1627 - uchar overrun_buf[ASC_OVERRUN_BSIZE] __aligned(8);
1628 + uchar *overrun_buf;
1629 dma_addr_t overrun_dma;
1630 uchar scsi_reset_wait;
1631 uchar chip_no;
1632 @@ -6439,7 +6439,7 @@ static int AdvLoadMicrocode(AdvPortAddr iop_base, unsigned char *buf, int size,
1633 i += 2;
1634 len += 2;
1635 } else {
1636 - unsigned char off = buf[i] * 2;
1637 + unsigned int off = buf[i] * 2;
1638 unsigned short word = (buf[off + 1] << 8) | buf[off];
1639 AdvWriteWordAutoIncLram(iop_base, word);
1640 len += 2;
1641 @@ -13833,6 +13833,12 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
1642 */
1643 if (ASC_NARROW_BOARD(boardp)) {
1644 ASC_DBG(2, "AscInitAsc1000Driver()\n");
1645 +
1646 + asc_dvc_varp->overrun_buf = kzalloc(ASC_OVERRUN_BSIZE, GFP_KERNEL);
1647 + if (!asc_dvc_varp->overrun_buf) {
1648 + ret = -ENOMEM;
1649 + goto err_free_wide_mem;
1650 + }
1651 warn_code = AscInitAsc1000Driver(asc_dvc_varp);
1652
1653 if (warn_code || asc_dvc_varp->err_code) {
1654 @@ -13840,8 +13846,10 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
1655 "warn 0x%x, error 0x%x\n",
1656 asc_dvc_varp->init_state, warn_code,
1657 asc_dvc_varp->err_code);
1658 - if (asc_dvc_varp->err_code)
1659 + if (asc_dvc_varp->err_code) {
1660 ret = -ENODEV;
1661 + kfree(asc_dvc_varp->overrun_buf);
1662 + }
1663 }
1664 } else {
1665 if (advansys_wide_init_chip(shost))
1666 @@ -13894,6 +13902,7 @@ static int advansys_release(struct Scsi_Host *shost)
1667 dma_unmap_single(board->dev,
1668 board->dvc_var.asc_dvc_var.overrun_dma,
1669 ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE);
1670 + kfree(board->dvc_var.asc_dvc_var.overrun_buf);
1671 } else {
1672 iounmap(board->ioremap_addr);
1673 advansys_wide_free_mem(board);
1674 diff --git a/drivers/scsi/aic94xx/aic94xx_scb.c b/drivers/scsi/aic94xx/aic94xx_scb.c
1675 index db6ab1a..eae2d97 100644
1676 --- a/drivers/scsi/aic94xx/aic94xx_scb.c
1677 +++ b/drivers/scsi/aic94xx/aic94xx_scb.c
1678 @@ -458,13 +458,19 @@ static void escb_tasklet_complete(struct asd_ascb *ascb,
1679 tc_abort = le16_to_cpu(tc_abort);
1680
1681 list_for_each_entry_safe(a, b, &asd_ha->seq.pend_q, list) {
1682 - struct sas_task *task = ascb->uldd_task;
1683 + struct sas_task *task = a->uldd_task;
1684 +
1685 + if (a->tc_index != tc_abort)
1686 + continue;
1687
1688 - if (task && a->tc_index == tc_abort) {
1689 + if (task) {
1690 failed_dev = task->dev;
1691 sas_task_abort(task);
1692 - break;
1693 + } else {
1694 + ASD_DPRINTK("R_T_A for non TASK scb 0x%x\n",
1695 + a->scb->header.opcode);
1696 }
1697 + break;
1698 }
1699
1700 if (!failed_dev) {
1701 @@ -478,7 +484,7 @@ static void escb_tasklet_complete(struct asd_ascb *ascb,
1702 * that the EH will wake up and do something.
1703 */
1704 list_for_each_entry_safe(a, b, &asd_ha->seq.pend_q, list) {
1705 - struct sas_task *task = ascb->uldd_task;
1706 + struct sas_task *task = a->uldd_task;
1707
1708 if (task &&
1709 task->dev == failed_dev &&
1710 diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
1711 index d466a2d..dcd6c9a 100644
1712 --- a/drivers/scsi/arcmsr/arcmsr_hba.c
1713 +++ b/drivers/scsi/arcmsr/arcmsr_hba.c
1714 @@ -1380,17 +1380,16 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, \
1715 switch(controlcode) {
1716
1717 case ARCMSR_MESSAGE_READ_RQBUFFER: {
1718 - unsigned long *ver_addr;
1719 - dma_addr_t buf_handle;
1720 + unsigned char *ver_addr;
1721 uint8_t *pQbuffer, *ptmpQbuffer;
1722 int32_t allxfer_len = 0;
1723
1724 - ver_addr = pci_alloc_consistent(acb->pdev, 1032, &buf_handle);
1725 + ver_addr = kmalloc(1032, GFP_ATOMIC);
1726 if (!ver_addr) {
1727 retvalue = ARCMSR_MESSAGE_FAIL;
1728 goto message_out;
1729 }
1730 - ptmpQbuffer = (uint8_t *) ver_addr;
1731 + ptmpQbuffer = ver_addr;
1732 while ((acb->rqbuf_firstindex != acb->rqbuf_lastindex)
1733 && (allxfer_len < 1031)) {
1734 pQbuffer = &acb->rqbuffer[acb->rqbuf_firstindex];
1735 @@ -1419,25 +1418,24 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, \
1736 }
1737 arcmsr_iop_message_read(acb);
1738 }
1739 - memcpy(pcmdmessagefld->messagedatabuffer, (uint8_t *)ver_addr, allxfer_len);
1740 + memcpy(pcmdmessagefld->messagedatabuffer, ver_addr, allxfer_len);
1741 pcmdmessagefld->cmdmessage.Length = allxfer_len;
1742 pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK;
1743 - pci_free_consistent(acb->pdev, 1032, ver_addr, buf_handle);
1744 + kfree(ver_addr);
1745 }
1746 break;
1747
1748 case ARCMSR_MESSAGE_WRITE_WQBUFFER: {
1749 - unsigned long *ver_addr;
1750 - dma_addr_t buf_handle;
1751 + unsigned char *ver_addr;
1752 int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex;
1753 uint8_t *pQbuffer, *ptmpuserbuffer;
1754
1755 - ver_addr = pci_alloc_consistent(acb->pdev, 1032, &buf_handle);
1756 + ver_addr = kmalloc(1032, GFP_ATOMIC);
1757 if (!ver_addr) {
1758 retvalue = ARCMSR_MESSAGE_FAIL;
1759 goto message_out;
1760 }
1761 - ptmpuserbuffer = (uint8_t *)ver_addr;
1762 + ptmpuserbuffer = ver_addr;
1763 user_len = pcmdmessagefld->cmdmessage.Length;
1764 memcpy(ptmpuserbuffer, pcmdmessagefld->messagedatabuffer, user_len);
1765 wqbuf_lastindex = acb->wqbuf_lastindex;
1766 @@ -1483,7 +1481,7 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, \
1767 retvalue = ARCMSR_MESSAGE_FAIL;
1768 }
1769 }
1770 - pci_free_consistent(acb->pdev, 1032, ver_addr, buf_handle);
1771 + kfree(ver_addr);
1772 }
1773 break;
1774
1775 diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
1776 index 8eb78be..b8b67f6 100644
1777 --- a/drivers/scsi/gdth.c
1778 +++ b/drivers/scsi/gdth.c
1779 @@ -160,7 +160,7 @@ static void gdth_readapp_event(gdth_ha_str *ha, unchar application,
1780 static void gdth_clear_events(void);
1781
1782 static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
1783 - char *buffer, ushort count, int to_buffer);
1784 + char *buffer, ushort count);
1785 static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp);
1786 static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive);
1787
1788 @@ -183,7 +183,6 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,
1789 unsigned int cmd, unsigned long arg);
1790
1791 static void gdth_flush(gdth_ha_str *ha);
1792 -static int gdth_halt(struct notifier_block *nb, ulong event, void *buf);
1793 static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *));
1794 static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp,
1795 struct gdth_cmndinfo *cmndinfo);
1796 @@ -418,12 +417,6 @@ static inline void gdth_set_sglist(struct scsi_cmnd *cmd,
1797 #include "gdth_proc.h"
1798 #include "gdth_proc.c"
1799
1800 -/* notifier block to get a notify on system shutdown/halt/reboot */
1801 -static struct notifier_block gdth_notifier = {
1802 - gdth_halt, NULL, 0
1803 -};
1804 -static int notifier_disabled = 0;
1805 -
1806 static gdth_ha_str *gdth_find_ha(int hanum)
1807 {
1808 gdth_ha_str *ha;
1809 @@ -446,8 +439,8 @@ static struct gdth_cmndinfo *gdth_get_cmndinfo(gdth_ha_str *ha)
1810 for (i=0; i<GDTH_MAXCMDS; ++i) {
1811 if (ha->cmndinfo[i].index == 0) {
1812 priv = &ha->cmndinfo[i];
1813 - priv->index = i+1;
1814 memset(priv, 0, sizeof(*priv));
1815 + priv->index = i+1;
1816 break;
1817 }
1818 }
1819 @@ -494,7 +487,6 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd,
1820 gdth_ha_str *ha = shost_priv(sdev->host);
1821 Scsi_Cmnd *scp;
1822 struct gdth_cmndinfo cmndinfo;
1823 - struct scatterlist one_sg;
1824 DECLARE_COMPLETION_ONSTACK(wait);
1825 int rval;
1826
1827 @@ -508,13 +500,10 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd,
1828 /* use request field to save the ptr. to completion struct. */
1829 scp->request = (struct request *)&wait;
1830 scp->timeout_per_command = timeout*HZ;
1831 - sg_init_one(&one_sg, gdtcmd, sizeof(*gdtcmd));
1832 - gdth_set_sglist(scp, &one_sg);
1833 - gdth_set_sg_count(scp, 1);
1834 - gdth_set_bufflen(scp, sizeof(*gdtcmd));
1835 scp->cmd_len = 12;
1836 memcpy(scp->cmnd, cmnd, 12);
1837 cmndinfo.priority = IOCTL_PRI;
1838 + cmndinfo.internal_cmd_str = gdtcmd;
1839 cmndinfo.internal_command = 1;
1840
1841 TRACE(("__gdth_execute() cmd 0x%x\n", scp->cmnd[0]));
1842 @@ -2355,7 +2344,7 @@ static void gdth_next(gdth_ha_str *ha)
1843 * buffers, kmap_atomic() as needed.
1844 */
1845 static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
1846 - char *buffer, ushort count, int to_buffer)
1847 + char *buffer, ushort count)
1848 {
1849 ushort cpcount,i, max_sg = gdth_sg_count(scp);
1850 ushort cpsum,cpnow;
1851 @@ -2381,10 +2370,7 @@ static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
1852 }
1853 local_irq_save(flags);
1854 address = kmap_atomic(sg_page(sl), KM_BIO_SRC_IRQ) + sl->offset;
1855 - if (to_buffer)
1856 - memcpy(buffer, address, cpnow);
1857 - else
1858 - memcpy(address, buffer, cpnow);
1859 + memcpy(address, buffer, cpnow);
1860 flush_dcache_page(sg_page(sl));
1861 kunmap_atomic(address, KM_BIO_SRC_IRQ);
1862 local_irq_restore(flags);
1863 @@ -2438,7 +2424,7 @@ static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
1864 strcpy(inq.vendor,ha->oem_name);
1865 sprintf(inq.product,"Host Drive #%02d",t);
1866 strcpy(inq.revision," ");
1867 - gdth_copy_internal_data(ha, scp, (char*)&inq, sizeof(gdth_inq_data), 0);
1868 + gdth_copy_internal_data(ha, scp, (char*)&inq, sizeof(gdth_inq_data));
1869 break;
1870
1871 case REQUEST_SENSE:
1872 @@ -2448,7 +2434,7 @@ static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
1873 sd.key = NO_SENSE;
1874 sd.info = 0;
1875 sd.add_length= 0;
1876 - gdth_copy_internal_data(ha, scp, (char*)&sd, sizeof(gdth_sense_data), 0);
1877 + gdth_copy_internal_data(ha, scp, (char*)&sd, sizeof(gdth_sense_data));
1878 break;
1879
1880 case MODE_SENSE:
1881 @@ -2460,7 +2446,7 @@ static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
1882 mpd.bd.block_length[0] = (SECTOR_SIZE & 0x00ff0000) >> 16;
1883 mpd.bd.block_length[1] = (SECTOR_SIZE & 0x0000ff00) >> 8;
1884 mpd.bd.block_length[2] = (SECTOR_SIZE & 0x000000ff);
1885 - gdth_copy_internal_data(ha, scp, (char*)&mpd, sizeof(gdth_modep_data), 0);
1886 + gdth_copy_internal_data(ha, scp, (char*)&mpd, sizeof(gdth_modep_data));
1887 break;
1888
1889 case READ_CAPACITY:
1890 @@ -2470,7 +2456,7 @@ static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
1891 else
1892 rdc.last_block_no = cpu_to_be32(ha->hdr[t].size-1);
1893 rdc.block_length = cpu_to_be32(SECTOR_SIZE);
1894 - gdth_copy_internal_data(ha, scp, (char*)&rdc, sizeof(gdth_rdcap_data), 0);
1895 + gdth_copy_internal_data(ha, scp, (char*)&rdc, sizeof(gdth_rdcap_data));
1896 break;
1897
1898 case SERVICE_ACTION_IN:
1899 @@ -2482,7 +2468,7 @@ static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
1900 rdc16.last_block_no = cpu_to_be64(ha->hdr[t].size-1);
1901 rdc16.block_length = cpu_to_be32(SECTOR_SIZE);
1902 gdth_copy_internal_data(ha, scp, (char*)&rdc16,
1903 - sizeof(gdth_rdcap16_data), 0);
1904 + sizeof(gdth_rdcap16_data));
1905 } else {
1906 scp->result = DID_ABORT << 16;
1907 }
1908 @@ -2852,6 +2838,7 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b)
1909 static int gdth_special_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
1910 {
1911 register gdth_cmd_str *cmdp;
1912 + struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
1913 int cmd_index;
1914
1915 cmdp= ha->pccb;
1916 @@ -2860,7 +2847,7 @@ static int gdth_special_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
1917 if (ha->type==GDT_EISA && ha->cmd_cnt>0)
1918 return 0;
1919
1920 - gdth_copy_internal_data(ha, scp, (char *)cmdp, sizeof(gdth_cmd_str), 1);
1921 + *cmdp = *cmndinfo->internal_cmd_str;
1922 cmdp->RequestBuffer = scp;
1923
1924 /* search free command index */
1925 @@ -3793,6 +3780,8 @@ static void gdth_timeout(ulong data)
1926 gdth_ha_str *ha;
1927 ulong flags;
1928
1929 + BUG_ON(list_empty(&gdth_instances));
1930 +
1931 ha = list_first_entry(&gdth_instances, gdth_ha_str, list);
1932 spin_lock_irqsave(&ha->smp_lock, flags);
1933
1934 @@ -4668,45 +4657,6 @@ static void gdth_flush(gdth_ha_str *ha)
1935 }
1936 }
1937
1938 -/* shutdown routine */
1939 -static int gdth_halt(struct notifier_block *nb, ulong event, void *buf)
1940 -{
1941 - gdth_ha_str *ha;
1942 -#ifndef __alpha__
1943 - gdth_cmd_str gdtcmd;
1944 - char cmnd[MAX_COMMAND_SIZE];
1945 -#endif
1946 -
1947 - if (notifier_disabled)
1948 - return NOTIFY_OK;
1949 -
1950 - TRACE2(("gdth_halt() event %d\n",(int)event));
1951 - if (event != SYS_RESTART && event != SYS_HALT && event != SYS_POWER_OFF)
1952 - return NOTIFY_DONE;
1953 -
1954 - notifier_disabled = 1;
1955 - printk("GDT-HA: Flushing all host drives .. ");
1956 - list_for_each_entry(ha, &gdth_instances, list) {
1957 - gdth_flush(ha);
1958 -
1959 -#ifndef __alpha__
1960 - /* controller reset */
1961 - memset(cmnd, 0xff, MAX_COMMAND_SIZE);
1962 - gdtcmd.BoardNode = LOCALBOARD;
1963 - gdtcmd.Service = CACHESERVICE;
1964 - gdtcmd.OpCode = GDT_RESET;
1965 - TRACE2(("gdth_halt(): reset controller %d\n", ha->hanum));
1966 - gdth_execute(ha->shost, &gdtcmd, cmnd, 10, NULL);
1967 -#endif
1968 - }
1969 - printk("Done.\n");
1970 -
1971 -#ifdef GDTH_STATISTICS
1972 - del_timer(&gdth_timer);
1973 -#endif
1974 - return NOTIFY_OK;
1975 -}
1976 -
1977 /* configure lun */
1978 static int gdth_slave_configure(struct scsi_device *sdev)
1979 {
1980 @@ -5141,13 +5091,13 @@ static void gdth_remove_one(gdth_ha_str *ha)
1981
1982 scsi_remove_host(shp);
1983
1984 + gdth_flush(ha);
1985 +
1986 if (ha->sdev) {
1987 scsi_free_host_dev(ha->sdev);
1988 ha->sdev = NULL;
1989 }
1990
1991 - gdth_flush(ha);
1992 -
1993 if (shp->irq)
1994 free_irq(shp->irq,ha);
1995
1996 @@ -5173,6 +5123,24 @@ static void gdth_remove_one(gdth_ha_str *ha)
1997 scsi_host_put(shp);
1998 }
1999
2000 +static int gdth_halt(struct notifier_block *nb, ulong event, void *buf)
2001 +{
2002 + gdth_ha_str *ha;
2003 +
2004 + TRACE2(("gdth_halt() event %d\n", (int)event));
2005 + if (event != SYS_RESTART && event != SYS_HALT && event != SYS_POWER_OFF)
2006 + return NOTIFY_DONE;
2007 +
2008 + list_for_each_entry(ha, &gdth_instances, list)
2009 + gdth_flush(ha);
2010 +
2011 + return NOTIFY_OK;
2012 +}
2013 +
2014 +static struct notifier_block gdth_notifier = {
2015 + gdth_halt, NULL, 0
2016 +};
2017 +
2018 static int __init gdth_init(void)
2019 {
2020 if (disable) {
2021 @@ -5235,7 +5203,6 @@ static int __init gdth_init(void)
2022 add_timer(&gdth_timer);
2023 #endif
2024 major = register_chrdev(0,"gdth", &gdth_fops);
2025 - notifier_disabled = 0;
2026 register_reboot_notifier(&gdth_notifier);
2027 gdth_polling = FALSE;
2028 return 0;
2029 @@ -5245,14 +5212,15 @@ static void __exit gdth_exit(void)
2030 {
2031 gdth_ha_str *ha;
2032
2033 - list_for_each_entry(ha, &gdth_instances, list)
2034 - gdth_remove_one(ha);
2035 + unregister_chrdev(major, "gdth");
2036 + unregister_reboot_notifier(&gdth_notifier);
2037
2038 #ifdef GDTH_STATISTICS
2039 - del_timer(&gdth_timer);
2040 + del_timer_sync(&gdth_timer);
2041 #endif
2042 - unregister_chrdev(major,"gdth");
2043 - unregister_reboot_notifier(&gdth_notifier);
2044 +
2045 + list_for_each_entry(ha, &gdth_instances, list)
2046 + gdth_remove_one(ha);
2047 }
2048
2049 module_init(gdth_init);
2050 diff --git a/drivers/scsi/gdth.h b/drivers/scsi/gdth.h
2051 index 1434c6b..26e4e92 100644
2052 --- a/drivers/scsi/gdth.h
2053 +++ b/drivers/scsi/gdth.h
2054 @@ -915,6 +915,7 @@ typedef struct {
2055 struct gdth_cmndinfo { /* per-command private info */
2056 int index;
2057 int internal_command; /* don't call scsi_done */
2058 + gdth_cmd_str *internal_cmd_str; /* crier for internal messages*/
2059 dma_addr_t sense_paddr; /* sense dma-addr */
2060 unchar priority;
2061 int timeout;
2062 diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
2063 index de57734..ce0228e 100644
2064 --- a/drivers/scsi/gdth_proc.c
2065 +++ b/drivers/scsi/gdth_proc.c
2066 @@ -694,15 +694,13 @@ static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, ulong64 paddr)
2067 {
2068 ulong flags;
2069
2070 - spin_lock_irqsave(&ha->smp_lock, flags);
2071 -
2072 if (buf == ha->pscratch) {
2073 + spin_lock_irqsave(&ha->smp_lock, flags);
2074 ha->scratch_busy = FALSE;
2075 + spin_unlock_irqrestore(&ha->smp_lock, flags);
2076 } else {
2077 pci_free_consistent(ha->pdev, size, buf, paddr);
2078 }
2079 -
2080 - spin_unlock_irqrestore(&ha->smp_lock, flags);
2081 }
2082
2083 #ifdef GDTH_IOCTL_PROC
2084 diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
2085 index 5c5a9b2..f4e9c8d 100644
2086 --- a/drivers/scsi/ips.c
2087 +++ b/drivers/scsi/ips.c
2088 @@ -1580,7 +1580,7 @@ ips_make_passthru(ips_ha_t *ha, struct scsi_cmnd *SC, ips_scb_t *scb, int intr)
2089 METHOD_TRACE("ips_make_passthru", 1);
2090
2091 scsi_for_each_sg(SC, sg, scsi_sg_count(SC), i)
2092 - length += sg[i].length;
2093 + length += sg->length;
2094
2095 if (length < sizeof (ips_passthru_t)) {
2096 /* wrong size */
2097 @@ -6842,13 +6842,10 @@ ips_register_scsi(int index)
2098 if (request_irq(ha->irq, do_ipsintr, IRQF_SHARED, ips_name, ha)) {
2099 IPS_PRINTK(KERN_WARNING, ha->pcidev,
2100 "Unable to install interrupt handler\n");
2101 - scsi_host_put(sh);
2102 - return -1;
2103 + goto err_out_sh;
2104 }
2105
2106 kfree(oldha);
2107 - ips_sh[index] = sh;
2108 - ips_ha[index] = ha;
2109
2110 /* Store away needed values for later use */
2111 sh->io_port = ha->io_addr;
2112 @@ -6867,10 +6864,21 @@ ips_register_scsi(int index)
2113 sh->max_channel = ha->nbus - 1;
2114 sh->can_queue = ha->max_cmds - 1;
2115
2116 - scsi_add_host(sh, NULL);
2117 + if (scsi_add_host(sh, &ha->pcidev->dev))
2118 + goto err_out;
2119 +
2120 + ips_sh[index] = sh;
2121 + ips_ha[index] = ha;
2122 +
2123 scsi_scan_host(sh);
2124
2125 return 0;
2126 +
2127 +err_out:
2128 + free_irq(ha->pcidev->irq, ha);
2129 +err_out_sh:
2130 + scsi_host_put(sh);
2131 + return -1;
2132 }
2133
2134 /*---------------------------------------------------------------------------*/
2135 diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
2136 index a9ac5b1..273728e 100644
2137 --- a/drivers/scsi/scsi_lib.c
2138 +++ b/drivers/scsi/scsi_lib.c
2139 @@ -298,7 +298,6 @@ static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl,
2140 page = sg_page(sg);
2141 off = sg->offset;
2142 len = sg->length;
2143 - data_len += len;
2144
2145 while (len > 0 && data_len > 0) {
2146 /*
2147 diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
2148 index ff10808..e9d7959 100644
2149 --- a/drivers/spi/atmel_spi.c
2150 +++ b/drivers/spi/atmel_spi.c
2151 @@ -85,6 +85,16 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi)
2152 unsigned gpio = (unsigned) spi->controller_data;
2153 unsigned active = spi->mode & SPI_CS_HIGH;
2154 u32 mr;
2155 + int i;
2156 + u32 csr;
2157 + u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0;
2158 +
2159 + /* Make sure clock polarity is correct */
2160 + for (i = 0; i < spi->master->num_chipselect; i++) {
2161 + csr = spi_readl(as, CSR0 + 4 * i);
2162 + if ((csr ^ cpol) & SPI_BIT(CPOL))
2163 + spi_writel(as, CSR0 + 4 * i, csr ^ SPI_BIT(CPOL));
2164 + }
2165
2166 mr = spi_readl(as, MR);
2167 mr = SPI_BFINS(PCS, ~(1 << spi->chip_select), mr);
2168 diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
2169 index 1c2ab54..840e682 100644
2170 --- a/drivers/spi/pxa2xx_spi.c
2171 +++ b/drivers/spi/pxa2xx_spi.c
2172 @@ -48,13 +48,19 @@ MODULE_LICENSE("GPL");
2173 #define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK)
2174 #define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0)
2175
2176 -/* for testing SSCR1 changes that require SSP restart, basically
2177 - * everything except the service and interrupt enables */
2178 -#define SSCR1_CHANGE_MASK (SSCR1_TTELP | SSCR1_TTE | SSCR1_EBCEI | SSCR1_SCFR \
2179 +/*
2180 + * for testing SSCR1 changes that require SSP restart, basically
2181 + * everything except the service and interrupt enables, the pxa270 developer
2182 + * manual says only SSCR1_SCFR, SSCR1_SPH, SSCR1_SPO need to be in this
2183 + * list, but the PXA255 dev man says all bits without really meaning the
2184 + * service and interrupt enables
2185 + */
2186 +#define SSCR1_CHANGE_MASK (SSCR1_TTELP | SSCR1_TTE | SSCR1_SCFR \
2187 | SSCR1_ECRA | SSCR1_ECRB | SSCR1_SCLKDIR \
2188 - | SSCR1_RWOT | SSCR1_TRAIL | SSCR1_PINTE \
2189 - | SSCR1_STRF | SSCR1_EFWR |SSCR1_RFT \
2190 - | SSCR1_TFT | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM)
2191 + | SSCR1_SFRMDIR | SSCR1_RWOT | SSCR1_TRAIL \
2192 + | SSCR1_IFS | SSCR1_STRF | SSCR1_EFWR \
2193 + | SSCR1_RFT | SSCR1_TFT | SSCR1_MWDS \
2194 + | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM)
2195
2196 #define DEFINE_SSP_REG(reg, off) \
2197 static inline u32 read_##reg(void *p) { return __raw_readl(p + (off)); } \
2198 @@ -961,9 +967,6 @@ static void pump_transfers(unsigned long data)
2199 if (drv_data->ssp_type == PXA25x_SSP)
2200 DCMD(drv_data->tx_channel) |= DCMD_ENDIRQEN;
2201
2202 - /* Fix me, need to handle cs polarity */
2203 - drv_data->cs_control(PXA2XX_CS_ASSERT);
2204 -
2205 /* Clear status and start DMA engine */
2206 cr1 = chip->cr1 | dma_thresh | drv_data->dma_cr1;
2207 write_SSSR(drv_data->clear_sr, reg);
2208 @@ -973,9 +976,6 @@ static void pump_transfers(unsigned long data)
2209 /* Ensure we have the correct interrupt handler */
2210 drv_data->transfer_handler = interrupt_transfer;
2211
2212 - /* Fix me, need to handle cs polarity */
2213 - drv_data->cs_control(PXA2XX_CS_ASSERT);
2214 -
2215 /* Clear status */
2216 cr1 = chip->cr1 | chip->threshold | drv_data->int_cr1;
2217 write_SSSR(drv_data->clear_sr, reg);
2218 @@ -986,16 +986,29 @@ static void pump_transfers(unsigned long data)
2219 || (read_SSCR1(reg) & SSCR1_CHANGE_MASK) !=
2220 (cr1 & SSCR1_CHANGE_MASK)) {
2221
2222 + /* stop the SSP, and update the other bits */
2223 write_SSCR0(cr0 & ~SSCR0_SSE, reg);
2224 if (drv_data->ssp_type != PXA25x_SSP)
2225 write_SSTO(chip->timeout, reg);
2226 - write_SSCR1(cr1, reg);
2227 + /* first set CR1 without interrupt and service enables */
2228 + write_SSCR1(cr1 & SSCR1_CHANGE_MASK, reg);
2229 + /* restart the SSP */
2230 write_SSCR0(cr0, reg);
2231 +
2232 } else {
2233 if (drv_data->ssp_type != PXA25x_SSP)
2234 write_SSTO(chip->timeout, reg);
2235 - write_SSCR1(cr1, reg);
2236 }
2237 +
2238 + /* FIXME, need to handle cs polarity,
2239 + * this driver uses struct pxa2xx_spi_chip.cs_control to
2240 + * specify a CS handling function, and it ignores most
2241 + * struct spi_device.mode[s], including SPI_CS_HIGH */
2242 + drv_data->cs_control(PXA2XX_CS_ASSERT);
2243 +
2244 + /* after chip select, release the data by enabling service
2245 + * requests and interrupts, without changing any mode bits */
2246 + write_SSCR1(cr1, reg);
2247 }
2248
2249 static void pump_messages(struct work_struct *work)
2250 diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
2251 index b10f39c..d1df9e9 100644
2252 --- a/drivers/usb/host/ehci-q.c
2253 +++ b/drivers/usb/host/ehci-q.c
2254 @@ -315,10 +315,10 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
2255 if (likely (last->urb != urb)) {
2256 ehci_urb_done(ehci, last->urb, last_status);
2257 count++;
2258 + last_status = -EINPROGRESS;
2259 }
2260 ehci_qtd_free (ehci, last);
2261 last = NULL;
2262 - last_status = -EINPROGRESS;
2263 }
2264
2265 /* ignore urbs submitted during completions we reported */
2266 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
2267 index 1382af9..c04beac 100644
2268 --- a/drivers/usb/serial/ftdi_sio.c
2269 +++ b/drivers/usb/serial/ftdi_sio.c
2270 @@ -310,6 +310,7 @@ struct ftdi_sio_quirk {
2271 };
2272
2273 static int ftdi_olimex_probe (struct usb_serial *serial);
2274 +static int ftdi_mtxorb_hack_setup (struct usb_serial *serial);
2275 static void ftdi_USB_UIRT_setup (struct ftdi_private *priv);
2276 static void ftdi_HE_TIRA1_setup (struct ftdi_private *priv);
2277
2278 @@ -317,6 +318,10 @@ static struct ftdi_sio_quirk ftdi_olimex_quirk = {
2279 .probe = ftdi_olimex_probe,
2280 };
2281
2282 +static struct ftdi_sio_quirk ftdi_mtxorb_hack_quirk = {
2283 + .probe = ftdi_mtxorb_hack_setup,
2284 +};
2285 +
2286 static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = {
2287 .port_probe = ftdi_USB_UIRT_setup,
2288 };
2289 @@ -379,6 +384,8 @@ static struct usb_device_id id_table_combined [] = {
2290 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) },
2291 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) },
2292 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) },
2293 + { USB_DEVICE(MTXORB_VK_VID, MTXORB_VK_PID),
2294 + .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
2295 { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) },
2296 { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) },
2297 { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) },
2298 @@ -492,6 +499,7 @@ static struct usb_device_id id_table_combined [] = {
2299 { USB_DEVICE(FTDI_VID, FTDI_ELV_FS20SIG_PID) },
2300 { USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) },
2301 { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) },
2302 + { USB_DEVICE(FTDI_VID, FTDI_ELV_EM1010PC_PID) },
2303 { USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) },
2304 { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) },
2305 { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) },
2306 @@ -1301,6 +1309,23 @@ static int ftdi_olimex_probe(struct usb_serial *serial)
2307 return 0;
2308 }
2309
2310 +/*
2311 + * The Matrix Orbital VK204-25-USB has an invalid IN endpoint.
2312 + * We have to correct it if we want to read from it.
2313 + */
2314 +static int ftdi_mtxorb_hack_setup(struct usb_serial *serial)
2315 +{
2316 + struct usb_host_endpoint *ep = serial->dev->ep_in[1];
2317 + struct usb_endpoint_descriptor *ep_desc = &ep->desc;
2318 +
2319 + if (ep->enabled && ep_desc->wMaxPacketSize == 0) {
2320 + ep_desc->wMaxPacketSize = 0x40;
2321 + info("Fixing invalid wMaxPacketSize on read pipe");
2322 + }
2323 +
2324 + return 0;
2325 +}
2326 +
2327 /* ftdi_shutdown is called from usbserial:usb_serial_disconnect
2328 * it is called when the usb device is disconnected
2329 *
2330 diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
2331 index f6053da..893b429 100644
2332 --- a/drivers/usb/serial/ftdi_sio.h
2333 +++ b/drivers/usb/serial/ftdi_sio.h
2334 @@ -98,6 +98,13 @@
2335 #define FTDI_MTXORB_5_PID 0xFA05 /* Matrix Orbital Product Id */
2336 #define FTDI_MTXORB_6_PID 0xFA06 /* Matrix Orbital Product Id */
2337
2338 +/*
2339 + * The following are the values for the Matrix Orbital VK204-25-USB
2340 + * display, which use the FT232RL.
2341 + */
2342 +#define MTXORB_VK_VID 0x1b3d
2343 +#define MTXORB_VK_PID 0x0158
2344 +
2345 /* Interbiometrics USB I/O Board */
2346 /* Developed for Interbiometrics by Rudolf Gugler */
2347 #define INTERBIOMETRICS_VID 0x1209
2348 diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
2349 index 889622b..45262f3 100644
2350 --- a/drivers/usb/storage/protocol.c
2351 +++ b/drivers/usb/storage/protocol.c
2352 @@ -194,7 +194,7 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
2353 * and the starting offset within the page, and update
2354 * the *offset and *index values for the next loop. */
2355 cnt = 0;
2356 - while (cnt < buflen) {
2357 + while (cnt < buflen && sg) {
2358 struct page *page = sg_page(sg) +
2359 ((sg->offset + *offset) >> PAGE_SHIFT);
2360 unsigned int poff =
2361 @@ -249,7 +249,8 @@ void usb_stor_set_xfer_buf(unsigned char *buffer,
2362 unsigned int offset = 0;
2363 struct scatterlist *sg = NULL;
2364
2365 - usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset,
2366 + buflen = min(buflen, srb->request_bufflen);
2367 + buflen = usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset,
2368 TO_XFER_BUF);
2369 if (buflen < srb->request_bufflen)
2370 srb->resid = srb->request_bufflen - buflen;
2371 diff --git a/fs/aio.c b/fs/aio.c
2372 index 9dec7d2..758f911 100644
2373 --- a/fs/aio.c
2374 +++ b/fs/aio.c
2375 @@ -997,6 +997,14 @@ put_rq:
2376 /* everything turned out well, dispose of the aiocb. */
2377 ret = __aio_put_req(ctx, iocb);
2378
2379 + /*
2380 + * We have to order our ring_info tail store above and test
2381 + * of the wait list below outside the wait lock. This is
2382 + * like in wake_up_bit() where clearing a bit has to be
2383 + * ordered with the unlocked test.
2384 + */
2385 + smp_mb();
2386 +
2387 if (waitqueue_active(&ctx->wait))
2388 wake_up(&ctx->wait);
2389
2390 diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
2391 index 32c5711..a985a8f 100644
2392 --- a/fs/ecryptfs/mmap.c
2393 +++ b/fs/ecryptfs/mmap.c
2394 @@ -263,52 +263,102 @@ out:
2395 return 0;
2396 }
2397
2398 -/* This function must zero any hole we create */
2399 +/**
2400 + * ecryptfs_prepare_write
2401 + * @file: The eCryptfs file
2402 + * @page: The eCryptfs page
2403 + * @from: The start byte from which we will write
2404 + * @to: The end byte to which we will write
2405 + *
2406 + * This function must zero any hole we create
2407 + *
2408 + * Returns zero on success; non-zero otherwise
2409 + */
2410 static int ecryptfs_prepare_write(struct file *file, struct page *page,
2411 unsigned from, unsigned to)
2412 {
2413 - int rc = 0;
2414 loff_t prev_page_end_size;
2415 + int rc = 0;
2416
2417 if (!PageUptodate(page)) {
2418 - rc = ecryptfs_read_lower_page_segment(page, page->index, 0,
2419 - PAGE_CACHE_SIZE,
2420 - page->mapping->host);
2421 - if (rc) {
2422 - printk(KERN_ERR "%s: Error attemping to read lower "
2423 - "page segment; rc = [%d]\n", __FUNCTION__, rc);
2424 - ClearPageUptodate(page);
2425 - goto out;
2426 - } else
2427 + struct ecryptfs_crypt_stat *crypt_stat =
2428 + &ecryptfs_inode_to_private(
2429 + file->f_path.dentry->d_inode)->crypt_stat;
2430 +
2431 + if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)
2432 + || (crypt_stat->flags & ECRYPTFS_NEW_FILE)) {
2433 + rc = ecryptfs_read_lower_page_segment(
2434 + page, page->index, 0, PAGE_CACHE_SIZE,
2435 + page->mapping->host);
2436 + if (rc) {
2437 + printk(KERN_ERR "%s: Error attemping to read "
2438 + "lower page segment; rc = [%d]\n",
2439 + __FUNCTION__, rc);
2440 + ClearPageUptodate(page);
2441 + goto out;
2442 + } else
2443 + SetPageUptodate(page);
2444 + } else if (crypt_stat->flags & ECRYPTFS_VIEW_AS_ENCRYPTED) {
2445 + if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) {
2446 + rc = ecryptfs_copy_up_encrypted_with_header(
2447 + page, crypt_stat);
2448 + if (rc) {
2449 + printk(KERN_ERR "%s: Error attempting "
2450 + "to copy the encrypted content "
2451 + "from the lower file whilst "
2452 + "inserting the metadata from "
2453 + "the xattr into the header; rc "
2454 + "= [%d]\n", __FUNCTION__, rc);
2455 + ClearPageUptodate(page);
2456 + goto out;
2457 + }
2458 + SetPageUptodate(page);
2459 + } else {
2460 + rc = ecryptfs_read_lower_page_segment(
2461 + page, page->index, 0, PAGE_CACHE_SIZE,
2462 + page->mapping->host);
2463 + if (rc) {
2464 + printk(KERN_ERR "%s: Error reading "
2465 + "page; rc = [%d]\n",
2466 + __FUNCTION__, rc);
2467 + ClearPageUptodate(page);
2468 + goto out;
2469 + }
2470 + SetPageUptodate(page);
2471 + }
2472 + } else {
2473 + rc = ecryptfs_decrypt_page(page);
2474 + if (rc) {
2475 + printk(KERN_ERR "%s: Error decrypting page "
2476 + "at index [%ld]; rc = [%d]\n",
2477 + __FUNCTION__, page->index, rc);
2478 + ClearPageUptodate(page);
2479 + goto out;
2480 + }
2481 SetPageUptodate(page);
2482 + }
2483 }
2484 -
2485 prev_page_end_size = ((loff_t)page->index << PAGE_CACHE_SHIFT);
2486 -
2487 - /*
2488 - * If creating a page or more of holes, zero them out via truncate.
2489 - * Note, this will increase i_size.
2490 - */
2491 + /* If creating a page or more of holes, zero them out via truncate.
2492 + * Note, this will increase i_size. */
2493 if (page->index != 0) {
2494 if (prev_page_end_size > i_size_read(page->mapping->host)) {
2495 rc = ecryptfs_truncate(file->f_path.dentry,
2496 prev_page_end_size);
2497 if (rc) {
2498 - printk(KERN_ERR "Error on attempt to "
2499 + printk(KERN_ERR "%s: Error on attempt to "
2500 "truncate to (higher) offset [%lld];"
2501 - " rc = [%d]\n", prev_page_end_size, rc);
2502 + " rc = [%d]\n", __FUNCTION__,
2503 + prev_page_end_size, rc);
2504 goto out;
2505 }
2506 }
2507 }
2508 - /*
2509 - * Writing to a new page, and creating a small hole from start of page?
2510 - * Zero it out.
2511 - */
2512 - if ((i_size_read(page->mapping->host) == prev_page_end_size) &&
2513 - (from != 0)) {
2514 + /* Writing to a new page, and creating a small hole from start
2515 + * of page? Zero it out. */
2516 + if ((i_size_read(page->mapping->host) == prev_page_end_size)
2517 + && (from != 0))
2518 zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
2519 - }
2520 out:
2521 return rc;
2522 }
2523 diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
2524 index 80d2f52..dcac591 100644
2525 --- a/fs/fuse/dir.c
2526 +++ b/fs/fuse/dir.c
2527 @@ -905,7 +905,7 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
2528 }
2529
2530 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
2531 - int err = generic_permission(inode, mask, NULL);
2532 + err = generic_permission(inode, mask, NULL);
2533
2534 /* If permission is denied, try to refresh file
2535 attributes. This is also needed, because the root
2536 diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c
2537 index 37dbd64..defb932 100644
2538 --- a/fs/isofs/compress.c
2539 +++ b/fs/isofs/compress.c
2540 @@ -72,6 +72,17 @@ static int zisofs_readpage(struct file *file, struct page *page)
2541 offset = index & ~zisofs_block_page_mask;
2542 blockindex = offset >> zisofs_block_page_shift;
2543 maxpage = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
2544 +
2545 + /*
2546 + * If this page is wholly outside i_size we just return zero;
2547 + * do_generic_file_read() will handle this for us
2548 + */
2549 + if (page->index >= maxpage) {
2550 + SetPageUptodate(page);
2551 + unlock_page(page);
2552 + return 0;
2553 + }
2554 +
2555 maxpage = min(zisofs_block_pages, maxpage-offset);
2556
2557 for ( i = 0 ; i < maxpage ; i++, offset++ ) {
2558 diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c
2559 index c5d9694..9aaa4fa 100644
2560 --- a/fs/jbd/recovery.c
2561 +++ b/fs/jbd/recovery.c
2562 @@ -478,7 +478,7 @@ static int do_one_pass(journal_t *journal,
2563 memcpy(nbh->b_data, obh->b_data,
2564 journal->j_blocksize);
2565 if (flags & JFS_FLAG_ESCAPE) {
2566 - *((__be32 *)bh->b_data) =
2567 + *((__be32 *)nbh->b_data) =
2568 cpu_to_be32(JFS_MAGIC_NUMBER);
2569 }
2570
2571 diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
2572 index d0ce627..fa0d4e9 100644
2573 --- a/fs/jbd2/recovery.c
2574 +++ b/fs/jbd2/recovery.c
2575 @@ -488,7 +488,7 @@ static int do_one_pass(journal_t *journal,
2576 memcpy(nbh->b_data, obh->b_data,
2577 journal->j_blocksize);
2578 if (flags & JBD2_FLAG_ESCAPE) {
2579 - *((__be32 *)bh->b_data) =
2580 + *((__be32 *)nbh->b_data) =
2581 cpu_to_be32(JBD2_MAGIC_NUMBER);
2582 }
2583
2584 diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
2585 index 468f17a..429cec2 100644
2586 --- a/fs/nfsd/nfsfh.c
2587 +++ b/fs/nfsd/nfsfh.c
2588 @@ -231,6 +231,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
2589 fhp->fh_dentry = dentry;
2590 fhp->fh_export = exp;
2591 nfsd_nr_verified++;
2592 + cache_get(&exp->h);
2593 } else {
2594 /*
2595 * just rechecking permissions
2596 @@ -240,6 +241,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
2597 dprintk("nfsd: fh_verify - just checking\n");
2598 dentry = fhp->fh_dentry;
2599 exp = fhp->fh_export;
2600 + cache_get(&exp->h);
2601 /*
2602 * Set user creds for this exportpoint; necessary even
2603 * in the "just checking" case because this may be a
2604 @@ -251,8 +253,6 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
2605 if (error)
2606 goto out;
2607 }
2608 - cache_get(&exp->h);
2609 -
2610
2611 error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type);
2612 if (error)
2613 diff --git a/fs/ufs/util.h b/fs/ufs/util.h
2614 index b26fc4d..23ceed8 100644
2615 --- a/fs/ufs/util.h
2616 +++ b/fs/ufs/util.h
2617 @@ -58,7 +58,7 @@ ufs_set_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
2618 {
2619 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
2620 case UFS_ST_SUNOS:
2621 - if (fs32_to_cpu(sb, usb3->fs_postblformat == UFS_42POSTBLFMT)) {
2622 + if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT) {
2623 usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value);
2624 break;
2625 }
2626 diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
2627 index 1bd398d..c12c294 100644
2628 --- a/include/asm-arm/arch-pxa/pxa-regs.h
2629 +++ b/include/asm-arm/arch-pxa/pxa-regs.h
2630 @@ -1669,6 +1669,7 @@
2631 #define SSCR1_RSRE (1 << 20) /* Receive Service Request Enable */
2632 #define SSCR1_TINTE (1 << 19) /* Receiver Time-out Interrupt enable */
2633 #define SSCR1_PINTE (1 << 18) /* Peripheral Trailing Byte Interupt Enable */
2634 +#define SSCR1_IFS (1 << 16) /* Invert Frame Signal */
2635 #define SSCR1_STRF (1 << 15) /* Select FIFO or EFWR */
2636 #define SSCR1_EFWR (1 << 14) /* Enable FIFO Write/Read */
2637
2638 diff --git a/include/asm-x86/apic_32.h b/include/asm-x86/apic_32.h
2639 index be158b2..04fbe7f 100644
2640 --- a/include/asm-x86/apic_32.h
2641 +++ b/include/asm-x86/apic_32.h
2642 @@ -109,7 +109,7 @@ extern void setup_boot_APIC_clock (void);
2643 extern void setup_secondary_APIC_clock (void);
2644 extern int APIC_init_uniprocessor (void);
2645
2646 -extern void enable_NMI_through_LVT0 (void * dummy);
2647 +extern void enable_NMI_through_LVT0(void);
2648
2649 #define ARCH_APICTIMER_STOPS_ON_C3 1
2650
2651 diff --git a/include/asm-x86/futex_32.h b/include/asm-x86/futex_32.h
2652 index 438ef0e..80964fd 100644
2653 --- a/include/asm-x86/futex_32.h
2654 +++ b/include/asm-x86/futex_32.h
2655 @@ -28,7 +28,7 @@
2656 "1: movl %2, %0\n\
2657 movl %0, %3\n" \
2658 insn "\n" \
2659 -"2: " LOCK_PREFIX "cmpxchgl %3, %2\n\
2660 +"2: lock ; cmpxchgl %3, %2\n\
2661 jnz 1b\n\
2662 3: .section .fixup,\"ax\"\n\
2663 4: mov %5, %1\n\
2664 @@ -68,7 +68,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
2665 #endif
2666 switch (op) {
2667 case FUTEX_OP_ADD:
2668 - __futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret,
2669 + __futex_atomic_op1("lock ; xaddl %0, %2", ret,
2670 oldval, uaddr, oparg);
2671 break;
2672 case FUTEX_OP_OR:
2673 @@ -111,7 +111,7 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
2674 return -EFAULT;
2675
2676 __asm__ __volatile__(
2677 - "1: " LOCK_PREFIX "cmpxchgl %3, %1 \n"
2678 + "1: lock ; cmpxchgl %3, %1 \n"
2679
2680 "2: .section .fixup, \"ax\" \n"
2681 "3: mov %2, %0 \n"
2682 diff --git a/include/asm-x86/futex_64.h b/include/asm-x86/futex_64.h
2683 index 5cdfb08..423c051 100644
2684 --- a/include/asm-x86/futex_64.h
2685 +++ b/include/asm-x86/futex_64.h
2686 @@ -27,7 +27,7 @@
2687 "1: movl %2, %0\n\
2688 movl %0, %3\n" \
2689 insn "\n" \
2690 -"2: " LOCK_PREFIX "cmpxchgl %3, %2\n\
2691 +"2: lock ; cmpxchgl %3, %2\n\
2692 jnz 1b\n\
2693 3: .section .fixup,\"ax\"\n\
2694 4: mov %5, %1\n\
2695 @@ -62,7 +62,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
2696 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg);
2697 break;
2698 case FUTEX_OP_ADD:
2699 - __futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret, oldval,
2700 + __futex_atomic_op1("lock ; xaddl %0, %2", ret, oldval,
2701 uaddr, oparg);
2702 break;
2703 case FUTEX_OP_OR:
2704 @@ -101,7 +101,7 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
2705 return -EFAULT;
2706
2707 __asm__ __volatile__(
2708 - "1: " LOCK_PREFIX "cmpxchgl %3, %1 \n"
2709 + "1: lock ; cmpxchgl %3, %1 \n"
2710
2711 "2: .section .fixup, \"ax\" \n"
2712 "3: mov %2, %0 \n"
2713 diff --git a/include/asm-x86/io_apic_64.h b/include/asm-x86/io_apic_64.h
2714 index e2c1367..1913ad0 100644
2715 --- a/include/asm-x86/io_apic_64.h
2716 +++ b/include/asm-x86/io_apic_64.h
2717 @@ -129,7 +129,7 @@ extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int);
2718
2719 extern int sis_apic_bug; /* dummy */
2720
2721 -void enable_NMI_through_LVT0 (void * dummy);
2722 +void enable_NMI_through_LVT0(void);
2723
2724 extern spinlock_t i8259A_lock;
2725
2726 diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h
2727 index 13976b0..787ee2e 100644
2728 --- a/include/asm-x86/processor_32.h
2729 +++ b/include/asm-x86/processor_32.h
2730 @@ -712,9 +712,10 @@ static inline unsigned int cpuid_edx(unsigned int op)
2731 #define ASM_NOP6 K7_NOP6
2732 #define ASM_NOP7 K7_NOP7
2733 #define ASM_NOP8 K7_NOP8
2734 -#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \
2735 +#elif (defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \
2736 defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) || \
2737 - defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4)
2738 + defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4)) && \
2739 + !defined(CONFIG_X86_GENERIC)
2740 #define ASM_NOP1 P6_NOP1
2741 #define ASM_NOP2 P6_NOP2
2742 #define ASM_NOP3 P6_NOP3
2743 diff --git a/include/linux/Kbuild b/include/linux/Kbuild
2744 index 4b32bb1..f30fa92 100644
2745 --- a/include/linux/Kbuild
2746 +++ b/include/linux/Kbuild
2747 @@ -217,7 +217,6 @@ unifdef-y += i2o-dev.h
2748 unifdef-y += icmp.h
2749 unifdef-y += icmpv6.h
2750 unifdef-y += if_addr.h
2751 -unifdef-y += if_addrlabel.h
2752 unifdef-y += if_arp.h
2753 unifdef-y += if_bridge.h
2754 unifdef-y += if_ec.h
2755 diff --git a/include/linux/futex.h b/include/linux/futex.h
2756 index 92d420f..e5f3b84 100644
2757 --- a/include/linux/futex.h
2758 +++ b/include/linux/futex.h
2759 @@ -153,6 +153,7 @@ union futex_key {
2760 #ifdef CONFIG_FUTEX
2761 extern void exit_robust_list(struct task_struct *curr);
2762 extern void exit_pi_state_list(struct task_struct *curr);
2763 +extern int futex_cmpxchg_enabled;
2764 #else
2765 static inline void exit_robust_list(struct task_struct *curr)
2766 {
2767 diff --git a/include/linux/irq.h b/include/linux/irq.h
2768 index 4669be0..1fc1cb8 100644
2769 --- a/include/linux/irq.h
2770 +++ b/include/linux/irq.h
2771 @@ -367,6 +367,9 @@ set_irq_chained_handler(unsigned int irq,
2772 __set_irq_handler(irq, handle, 1, NULL);
2773 }
2774
2775 +extern void set_irq_noprobe(unsigned int irq);
2776 +extern void set_irq_probe(unsigned int irq);
2777 +
2778 /* Handle dynamic irq creation and destruction */
2779 extern int create_irq(void);
2780 extern void destroy_irq(unsigned int irq);
2781 diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
2782 index 13410b2..c1d64c2 100644
2783 --- a/include/linux/moduleparam.h
2784 +++ b/include/linux/moduleparam.h
2785 @@ -62,6 +62,16 @@ struct kparam_array
2786 void *elem;
2787 };
2788
2789 +/* On alpha, ia64 and ppc64 relocations to global data cannot go into
2790 + read-only sections (which is part of respective UNIX ABI on these
2791 + platforms). So 'const' makes no sense and even causes compile failures
2792 + with some compilers. */
2793 +#if defined(CONFIG_ALPHA) || defined(CONFIG_IA64) || defined(CONFIG_PPC64)
2794 +#define __moduleparam_const
2795 +#else
2796 +#define __moduleparam_const const
2797 +#endif
2798 +
2799 /* This is the fundamental function for registering boot/module
2800 parameters. perm sets the visibility in sysfs: 000 means it's
2801 not there, read bits mean it's readable, write bits mean it's
2802 @@ -71,7 +81,7 @@ struct kparam_array
2803 static int __param_perm_check_##name __attribute__((unused)) = \
2804 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
2805 static const char __param_str_##name[] = prefix #name; \
2806 - static struct kernel_param const __param_##name \
2807 + static struct kernel_param __moduleparam_const __param_##name \
2808 __attribute_used__ \
2809 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
2810 = { __param_str_##name, perm, set, get, { arg } }
2811 diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
2812 index 70013c5..89cd011 100644
2813 --- a/include/net/inet_sock.h
2814 +++ b/include/net/inet_sock.h
2815 @@ -175,7 +175,8 @@ extern void build_ehash_secret(void);
2816 static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport,
2817 const __be32 faddr, const __be16 fport)
2818 {
2819 - return jhash_2words((__force __u32) laddr ^ (__force __u32) faddr,
2820 + return jhash_3words((__force __u32) laddr,
2821 + (__force __u32) faddr,
2822 ((__u32) lport) << 16 | (__force __u32)fport,
2823 inet_ehash_secret);
2824 }
2825 diff --git a/kernel/futex.c b/kernel/futex.c
2826 index 55d78b5..d166080 100644
2827 --- a/kernel/futex.c
2828 +++ b/kernel/futex.c
2829 @@ -60,6 +60,8 @@
2830
2831 #include "rtmutex_common.h"
2832
2833 +int __read_mostly futex_cmpxchg_enabled;
2834 +
2835 #define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8)
2836
2837 /*
2838 @@ -466,6 +468,8 @@ void exit_pi_state_list(struct task_struct *curr)
2839 struct futex_hash_bucket *hb;
2840 union futex_key key;
2841
2842 + if (!futex_cmpxchg_enabled)
2843 + return;
2844 /*
2845 * We are a ZOMBIE and nobody can enqueue itself on
2846 * pi_state_list anymore, but we have to be careful
2847 @@ -1854,6 +1858,8 @@ asmlinkage long
2848 sys_set_robust_list(struct robust_list_head __user *head,
2849 size_t len)
2850 {
2851 + if (!futex_cmpxchg_enabled)
2852 + return -ENOSYS;
2853 /*
2854 * The kernel knows only one size for now:
2855 */
2856 @@ -1878,6 +1884,9 @@ sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr,
2857 struct robust_list_head __user *head;
2858 unsigned long ret;
2859
2860 + if (!futex_cmpxchg_enabled)
2861 + return -ENOSYS;
2862 +
2863 if (!pid)
2864 head = current->robust_list;
2865 else {
2866 @@ -1980,6 +1989,9 @@ void exit_robust_list(struct task_struct *curr)
2867 unsigned long futex_offset;
2868 int rc;
2869
2870 + if (!futex_cmpxchg_enabled)
2871 + return;
2872 +
2873 /*
2874 * Fetch the list head (which was registered earlier, via
2875 * sys_set_robust_list()):
2876 @@ -2034,7 +2046,7 @@ void exit_robust_list(struct task_struct *curr)
2877 long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
2878 u32 __user *uaddr2, u32 val2, u32 val3)
2879 {
2880 - int ret;
2881 + int ret = -ENOSYS;
2882 int cmd = op & FUTEX_CMD_MASK;
2883 struct rw_semaphore *fshared = NULL;
2884
2885 @@ -2062,13 +2074,16 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
2886 ret = futex_wake_op(uaddr, fshared, uaddr2, val, val2, val3);
2887 break;
2888 case FUTEX_LOCK_PI:
2889 - ret = futex_lock_pi(uaddr, fshared, val, timeout, 0);
2890 + if (futex_cmpxchg_enabled)
2891 + ret = futex_lock_pi(uaddr, fshared, val, timeout, 0);
2892 break;
2893 case FUTEX_UNLOCK_PI:
2894 - ret = futex_unlock_pi(uaddr, fshared);
2895 + if (futex_cmpxchg_enabled)
2896 + ret = futex_unlock_pi(uaddr, fshared);
2897 break;
2898 case FUTEX_TRYLOCK_PI:
2899 - ret = futex_lock_pi(uaddr, fshared, 0, timeout, 1);
2900 + if (futex_cmpxchg_enabled)
2901 + ret = futex_lock_pi(uaddr, fshared, 0, timeout, 1);
2902 break;
2903 default:
2904 ret = -ENOSYS;
2905 @@ -2123,8 +2138,29 @@ static struct file_system_type futex_fs_type = {
2906
2907 static int __init init(void)
2908 {
2909 - int i = register_filesystem(&futex_fs_type);
2910 + u32 curval;
2911 + int i;
2912 +
2913 + /*
2914 + * This will fail and we want it. Some arch implementations do
2915 + * runtime detection of the futex_atomic_cmpxchg_inatomic()
2916 + * functionality. We want to know that before we call in any
2917 + * of the complex code paths. Also we want to prevent
2918 + * registration of robust lists in that case. NULL is
2919 + * guaranteed to fault and we get -EFAULT on functional
2920 + * implementation, the non functional ones will return
2921 + * -ENOSYS.
2922 + */
2923 + curval = cmpxchg_futex_value_locked(NULL, 0, 0);
2924 + if (curval == -EFAULT)
2925 + futex_cmpxchg_enabled = 1;
2926
2927 + for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
2928 + plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
2929 + spin_lock_init(&futex_queues[i].lock);
2930 + }
2931 +
2932 + i = register_filesystem(&futex_fs_type);
2933 if (i)
2934 return i;
2935
2936 @@ -2134,10 +2170,6 @@ static int __init init(void)
2937 return PTR_ERR(futex_mnt);
2938 }
2939
2940 - for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
2941 - plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
2942 - spin_lock_init(&futex_queues[i].lock);
2943 - }
2944 return 0;
2945 }
2946 __initcall(init);
2947 diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
2948 index 8682c79..d95f79b 100644
2949 --- a/kernel/futex_compat.c
2950 +++ b/kernel/futex_compat.c
2951 @@ -54,6 +54,9 @@ void compat_exit_robust_list(struct task_struct *curr)
2952 compat_long_t futex_offset;
2953 int rc;
2954
2955 + if (!futex_cmpxchg_enabled)
2956 + return;
2957 +
2958 /*
2959 * Fetch the list head (which was registered earlier, via
2960 * sys_set_robust_list()):
2961 @@ -115,6 +118,9 @@ asmlinkage long
2962 compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
2963 compat_size_t len)
2964 {
2965 + if (!futex_cmpxchg_enabled)
2966 + return -ENOSYS;
2967 +
2968 if (unlikely(len != sizeof(*head)))
2969 return -EINVAL;
2970
2971 @@ -130,6 +136,9 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
2972 struct compat_robust_list_head __user *head;
2973 unsigned long ret;
2974
2975 + if (!futex_cmpxchg_enabled)
2976 + return -ENOSYS;
2977 +
2978 if (!pid)
2979 head = current->compat_robust_list;
2980 else {
2981 diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
2982 index 465c69c..e4e1c99 100644
2983 --- a/kernel/irq/chip.c
2984 +++ b/kernel/irq/chip.c
2985 @@ -607,3 +607,39 @@ set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
2986 set_irq_chip(irq, chip);
2987 __set_irq_handler(irq, handle, 0, name);
2988 }
2989 +
2990 +void __init set_irq_noprobe(unsigned int irq)
2991 +{
2992 + struct irq_desc *desc;
2993 + unsigned long flags;
2994 +
2995 + if (irq >= NR_IRQS) {
2996 + printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq);
2997 +
2998 + return;
2999 + }
3000 +
3001 + desc = irq_desc + irq;
3002 +
3003 + spin_lock_irqsave(&desc->lock, flags);
3004 + desc->status |= IRQ_NOPROBE;
3005 + spin_unlock_irqrestore(&desc->lock, flags);
3006 +}
3007 +
3008 +void __init set_irq_probe(unsigned int irq)
3009 +{
3010 + struct irq_desc *desc;
3011 + unsigned long flags;
3012 +
3013 + if (irq >= NR_IRQS) {
3014 + printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq);
3015 +
3016 + return;
3017 + }
3018 +
3019 + desc = irq_desc + irq;
3020 +
3021 + spin_lock_irqsave(&desc->lock, flags);
3022 + desc->status &= ~IRQ_NOPROBE;
3023 + spin_unlock_irqrestore(&desc->lock, flags);
3024 +}
3025 diff --git a/kernel/relay.c b/kernel/relay.c
3026 index 7c03733..889102a 100644
3027 --- a/kernel/relay.c
3028 +++ b/kernel/relay.c
3029 @@ -1072,7 +1072,7 @@ static int subbuf_splice_actor(struct file *in,
3030 unsigned int flags,
3031 int *nonpad_ret)
3032 {
3033 - unsigned int pidx, poff, total_len, subbuf_pages, ret;
3034 + unsigned int pidx, poff, total_len, subbuf_pages, nr_pages, ret;
3035 struct rchan_buf *rbuf = in->private_data;
3036 unsigned int subbuf_size = rbuf->chan->subbuf_size;
3037 uint64_t pos = (uint64_t) *ppos;
3038 @@ -1103,8 +1103,9 @@ static int subbuf_splice_actor(struct file *in,
3039 subbuf_pages = rbuf->chan->alloc_size >> PAGE_SHIFT;
3040 pidx = (read_start / PAGE_SIZE) % subbuf_pages;
3041 poff = read_start & ~PAGE_MASK;
3042 + nr_pages = min_t(unsigned int, subbuf_pages, PIPE_BUFFERS);
3043
3044 - for (total_len = 0; spd.nr_pages < subbuf_pages; spd.nr_pages++) {
3045 + for (total_len = 0; spd.nr_pages < nr_pages; spd.nr_pages++) {
3046 unsigned int this_len, this_end, private;
3047 unsigned int cur_pos = read_start + total_len;
3048
3049 diff --git a/kernel/sched.c b/kernel/sched.c
3050 index e76b11c..5ba5db9 100644
3051 --- a/kernel/sched.c
3052 +++ b/kernel/sched.c
3053 @@ -4028,11 +4028,10 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
3054 oldprio = p->prio;
3055 on_rq = p->se.on_rq;
3056 running = task_current(rq, p);
3057 - if (on_rq) {
3058 + if (on_rq)
3059 dequeue_task(rq, p, 0);
3060 - if (running)
3061 - p->sched_class->put_prev_task(rq, p);
3062 - }
3063 + if (running)
3064 + p->sched_class->put_prev_task(rq, p);
3065
3066 if (rt_prio(prio))
3067 p->sched_class = &rt_sched_class;
3068 @@ -4041,9 +4040,9 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
3069
3070 p->prio = prio;
3071
3072 + if (running)
3073 + p->sched_class->set_curr_task(rq);
3074 if (on_rq) {
3075 - if (running)
3076 - p->sched_class->set_curr_task(rq);
3077 enqueue_task(rq, p, 0);
3078 /*
3079 * Reschedule if we are currently running on this runqueue and
3080 @@ -4339,18 +4338,17 @@ recheck:
3081 update_rq_clock(rq);
3082 on_rq = p->se.on_rq;
3083 running = task_current(rq, p);
3084 - if (on_rq) {
3085 + if (on_rq)
3086 deactivate_task(rq, p, 0);
3087 - if (running)
3088 - p->sched_class->put_prev_task(rq, p);
3089 - }
3090 + if (running)
3091 + p->sched_class->put_prev_task(rq, p);
3092
3093 oldprio = p->prio;
3094 __setscheduler(rq, p, policy, param->sched_priority);
3095
3096 + if (running)
3097 + p->sched_class->set_curr_task(rq);
3098 if (on_rq) {
3099 - if (running)
3100 - p->sched_class->set_curr_task(rq);
3101 activate_task(rq, p, 0);
3102 /*
3103 * Reschedule if we are currently running on this runqueue and
3104 @@ -7110,19 +7108,17 @@ void sched_move_task(struct task_struct *tsk)
3105 running = task_current(rq, tsk);
3106 on_rq = tsk->se.on_rq;
3107
3108 - if (on_rq) {
3109 + if (on_rq)
3110 dequeue_task(rq, tsk, 0);
3111 - if (unlikely(running))
3112 - tsk->sched_class->put_prev_task(rq, tsk);
3113 - }
3114 + if (unlikely(running))
3115 + tsk->sched_class->put_prev_task(rq, tsk);
3116
3117 set_task_cfs_rq(tsk, task_cpu(tsk));
3118
3119 - if (on_rq) {
3120 - if (unlikely(running))
3121 - tsk->sched_class->set_curr_task(rq);
3122 + if (unlikely(running))
3123 + tsk->sched_class->set_curr_task(rq);
3124 + if (on_rq)
3125 enqueue_task(rq, tsk, 0);
3126 - }
3127
3128 done:
3129 task_rq_unlock(rq, &flags);
3130 diff --git a/kernel/sysctl.c b/kernel/sysctl.c
3131 index e3e0ee3..397ff8c 100644
3132 --- a/kernel/sysctl.c
3133 +++ b/kernel/sysctl.c
3134 @@ -306,7 +306,7 @@ static struct ctl_table kern_table[] = {
3135 .procname = "sched_nr_migrate",
3136 .data = &sysctl_sched_nr_migrate,
3137 .maxlen = sizeof(unsigned int),
3138 - .mode = 644,
3139 + .mode = 0644,
3140 .proc_handler = &proc_dointvec,
3141 },
3142 #endif
3143 diff --git a/mm/filemap.c b/mm/filemap.c
3144 index 69430d2..76b036f 100644
3145 --- a/mm/filemap.c
3146 +++ b/mm/filemap.c
3147 @@ -1725,21 +1725,27 @@ size_t iov_iter_copy_from_user(struct page *page,
3148 }
3149 EXPORT_SYMBOL(iov_iter_copy_from_user);
3150
3151 -static void __iov_iter_advance_iov(struct iov_iter *i, size_t bytes)
3152 +void iov_iter_advance(struct iov_iter *i, size_t bytes)
3153 {
3154 + BUG_ON(i->count < bytes);
3155 +
3156 if (likely(i->nr_segs == 1)) {
3157 i->iov_offset += bytes;
3158 + i->count -= bytes;
3159 } else {
3160 const struct iovec *iov = i->iov;
3161 size_t base = i->iov_offset;
3162
3163 /*
3164 * The !iov->iov_len check ensures we skip over unlikely
3165 - * zero-length segments.
3166 + * zero-length segments (without overruning the iovec).
3167 */
3168 - while (bytes || !iov->iov_len) {
3169 - int copy = min(bytes, iov->iov_len - base);
3170 + while (bytes || unlikely(!iov->iov_len && i->count)) {
3171 + int copy;
3172
3173 + copy = min(bytes, iov->iov_len - base);
3174 + BUG_ON(!i->count || i->count < copy);
3175 + i->count -= copy;
3176 bytes -= copy;
3177 base += copy;
3178 if (iov->iov_len == base) {
3179 @@ -1751,14 +1757,6 @@ static void __iov_iter_advance_iov(struct iov_iter *i, size_t bytes)
3180 i->iov_offset = base;
3181 }
3182 }
3183 -
3184 -void iov_iter_advance(struct iov_iter *i, size_t bytes)
3185 -{
3186 - BUG_ON(i->count < bytes);
3187 -
3188 - __iov_iter_advance_iov(i, bytes);
3189 - i->count -= bytes;
3190 -}
3191 EXPORT_SYMBOL(iov_iter_advance);
3192
3193 /*
3194 diff --git a/mm/hugetlb.c b/mm/hugetlb.c
3195 index 9c746cb..d95ce35 100644
3196 --- a/mm/hugetlb.c
3197 +++ b/mm/hugetlb.c
3198 @@ -119,6 +119,7 @@ static void free_huge_page(struct page *page)
3199 struct address_space *mapping;
3200
3201 mapping = (struct address_space *) page_private(page);
3202 + set_page_private(page, 0);
3203 BUG_ON(page_count(page));
3204 INIT_LIST_HEAD(&page->lru);
3205
3206 @@ -133,7 +134,6 @@ static void free_huge_page(struct page *page)
3207 spin_unlock(&hugetlb_lock);
3208 if (mapping)
3209 hugetlb_put_quota(mapping, 1);
3210 - set_page_private(page, 0);
3211 }
3212
3213 /*
3214 diff --git a/mm/slab.c b/mm/slab.c
3215 index ff31261..79c3be0 100644
3216 --- a/mm/slab.c
3217 +++ b/mm/slab.c
3218 @@ -2961,11 +2961,10 @@ static void *cache_alloc_refill(struct kmem_cache *cachep, gfp_t flags)
3219 struct array_cache *ac;
3220 int node;
3221
3222 - node = numa_node_id();
3223 -
3224 +retry:
3225 check_irq_off();
3226 + node = numa_node_id();
3227 ac = cpu_cache_get(cachep);
3228 -retry:
3229 batchcount = ac->batchcount;
3230 if (!ac->touched && batchcount > BATCHREFILL_LIMIT) {
3231 /*
3232 diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
3233 index 2726adc..e13cf5e 100644
3234 --- a/net/bluetooth/hci_sysfs.c
3235 +++ b/net/bluetooth/hci_sysfs.c
3236 @@ -282,6 +282,7 @@ static void add_conn(struct work_struct *work)
3237 int i;
3238
3239 flush_workqueue(btdelconn);
3240 +
3241 if (device_add(&conn->dev) < 0) {
3242 BT_ERR("Failed to register connection device");
3243 return;
3244 @@ -317,7 +318,6 @@ void hci_conn_add_sysfs(struct hci_conn *conn)
3245 INIT_WORK(&conn->work, add_conn);
3246
3247 queue_work(btaddconn, &conn->work);
3248 - schedule_work(&conn->work);
3249 }
3250
3251 static int __match_tty(struct device *dev, void *data)
3252 @@ -354,7 +354,6 @@ void hci_conn_del_sysfs(struct hci_conn *conn)
3253 INIT_WORK(&conn->work, del_conn);
3254
3255 queue_work(btdelconn, &conn->work);
3256 - schedule_work(&conn->work);
3257 }
3258
3259 int hci_register_sysfs(struct hci_dev *hdev)
3260 @@ -408,6 +407,7 @@ int __init bt_sysfs_init(void)
3261 err = -ENOMEM;
3262 goto out;
3263 }
3264 +
3265 btdelconn = create_singlethread_workqueue("btdelconn");
3266 if (!btdelconn) {
3267 err = -ENOMEM;
3268 @@ -447,8 +447,12 @@ out:
3269 void bt_sysfs_cleanup(void)
3270 {
3271 destroy_workqueue(btaddconn);
3272 +
3273 destroy_workqueue(btdelconn);
3274 +
3275 class_destroy(bt_class);
3276 +
3277 bus_unregister(&bt_bus);
3278 +
3279 platform_device_unregister(bt_platform);
3280 }
3281 diff --git a/net/bridge/netfilter/ebt_dnat.c b/net/bridge/netfilter/ebt_dnat.c
3282 index 74262e9..1024511 100644
3283 --- a/net/bridge/netfilter/ebt_dnat.c
3284 +++ b/net/bridge/netfilter/ebt_dnat.c
3285 @@ -20,8 +20,8 @@ static int ebt_target_dnat(struct sk_buff *skb, unsigned int hooknr,
3286 {
3287 struct ebt_nat_info *info = (struct ebt_nat_info *)data;
3288
3289 - if (skb_make_writable(skb, 0))
3290 - return NF_DROP;
3291 + if (!skb_make_writable(skb, 0))
3292 + return EBT_DROP;
3293
3294 memcpy(eth_hdr(skb)->h_dest, info->mac, ETH_ALEN);
3295 return info->target;
3296 diff --git a/net/bridge/netfilter/ebt_redirect.c b/net/bridge/netfilter/ebt_redirect.c
3297 index 422cb83..88afc34 100644
3298 --- a/net/bridge/netfilter/ebt_redirect.c
3299 +++ b/net/bridge/netfilter/ebt_redirect.c
3300 @@ -21,8 +21,8 @@ static int ebt_target_redirect(struct sk_buff *skb, unsigned int hooknr,
3301 {
3302 struct ebt_redirect_info *info = (struct ebt_redirect_info *)data;
3303
3304 - if (skb_make_writable(skb, 0))
3305 - return NF_DROP;
3306 + if (!skb_make_writable(skb, 0))
3307 + return EBT_DROP;
3308
3309 if (hooknr != NF_BR_BROUTING)
3310 memcpy(eth_hdr(skb)->h_dest,
3311 diff --git a/net/bridge/netfilter/ebt_snat.c b/net/bridge/netfilter/ebt_snat.c
3312 index 425ac92..4c5a5a9 100644
3313 --- a/net/bridge/netfilter/ebt_snat.c
3314 +++ b/net/bridge/netfilter/ebt_snat.c
3315 @@ -22,8 +22,8 @@ static int ebt_target_snat(struct sk_buff *skb, unsigned int hooknr,
3316 {
3317 struct ebt_nat_info *info = (struct ebt_nat_info *) data;
3318
3319 - if (skb_make_writable(skb, 0))
3320 - return NF_DROP;
3321 + if (!skb_make_writable(skb, 0))
3322 + return EBT_DROP;
3323
3324 memcpy(eth_hdr(skb)->h_source, info->mac, ETH_ALEN);
3325 if (!(info->target & NAT_ARP_BIT) &&
3326 diff --git a/net/core/dev.c b/net/core/dev.c
3327 index 0879f52..4d44372 100644
3328 --- a/net/core/dev.c
3329 +++ b/net/core/dev.c
3330 @@ -1068,8 +1068,6 @@ int dev_close(struct net_device *dev)
3331 */
3332 call_netdevice_notifiers(NETDEV_GOING_DOWN, dev);
3333
3334 - dev_deactivate(dev);
3335 -
3336 clear_bit(__LINK_STATE_START, &dev->state);
3337
3338 /* Synchronize to scheduled poll. We cannot touch poll list,
3339 @@ -1080,6 +1078,8 @@ int dev_close(struct net_device *dev)
3340 */
3341 smp_mb__after_clear_bit(); /* Commit netif_running(). */
3342
3343 + dev_deactivate(dev);
3344 +
3345 /*
3346 * Call the device specific close. This cannot fail.
3347 * Only if device is UP
3348 @@ -2906,7 +2906,7 @@ int __dev_addr_add(struct dev_addr_list **list, int *count,
3349 }
3350 }
3351
3352 - da = kmalloc(sizeof(*da), GFP_ATOMIC);
3353 + da = kzalloc(sizeof(*da), GFP_ATOMIC);
3354 if (da == NULL)
3355 return -ENOMEM;
3356 memcpy(da->da_addr, addr, alen);
3357 diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
3358 index 82817e5..7794e17 100644
3359 --- a/net/ipv4/ip_sockglue.c
3360 +++ b/net/ipv4/ip_sockglue.c
3361 @@ -514,11 +514,6 @@ static int do_ip_setsockopt(struct sock *sk, int level,
3362 val &= ~3;
3363 val |= inet->tos & 3;
3364 }
3365 - if (IPTOS_PREC(val) >= IPTOS_PREC_CRITIC_ECP &&
3366 - !capable(CAP_NET_ADMIN)) {
3367 - err = -EPERM;
3368 - break;
3369 - }
3370 if (inet->tos != val) {
3371 inet->tos = val;
3372 sk->sk_priority = rt_tos2priority(val);
3373 diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
3374 index 80cab8c..b284b4e 100644
3375 --- a/net/ipv4/ipcomp.c
3376 +++ b/net/ipv4/ipcomp.c
3377 @@ -108,8 +108,11 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb)
3378 const int cpu = get_cpu();
3379 u8 *scratch = *per_cpu_ptr(ipcomp_scratches, cpu);
3380 struct crypto_comp *tfm = *per_cpu_ptr(ipcd->tfms, cpu);
3381 - int err = crypto_comp_compress(tfm, start, plen, scratch, &dlen);
3382 + int err;
3383
3384 + local_bh_disable();
3385 + err = crypto_comp_compress(tfm, start, plen, scratch, &dlen);
3386 + local_bh_enable();
3387 if (err)
3388 goto out;
3389
3390 diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
3391 index b8f7763..15dc11e 100644
3392 --- a/net/ipv4/ipconfig.c
3393 +++ b/net/ipv4/ipconfig.c
3394 @@ -739,9 +739,9 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d
3395 printk("Unknown ARP type 0x%04x for device %s\n", dev->type, dev->name);
3396 b->htype = dev->type; /* can cause undefined behavior */
3397 }
3398 +
3399 + /* server_ip and your_ip address are both already zero per RFC2131 */
3400 b->hlen = dev->addr_len;
3401 - b->your_ip = NONE;
3402 - b->server_ip = NONE;
3403 memcpy(b->hw_addr, dev->dev_addr, dev->addr_len);
3404 b->secs = htons(jiffies_diff / HZ);
3405 b->xid = d->xid;
3406 diff --git a/net/ipv4/netfilter/arpt_mangle.c b/net/ipv4/netfilter/arpt_mangle.c
3407 index 45fa4e2..3f4222b 100644
3408 --- a/net/ipv4/netfilter/arpt_mangle.c
3409 +++ b/net/ipv4/netfilter/arpt_mangle.c
3410 @@ -19,7 +19,7 @@ target(struct sk_buff *skb,
3411 unsigned char *arpptr;
3412 int pln, hln;
3413
3414 - if (skb_make_writable(skb, skb->len))
3415 + if (!skb_make_writable(skb, skb->len))
3416 return NF_DROP;
3417
3418 arp = arp_hdr(skb);
3419 diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
3420 index 14d64a3..16d0fb3 100644
3421 --- a/net/ipv4/netfilter/ip_queue.c
3422 +++ b/net/ipv4/netfilter/ip_queue.c
3423 @@ -336,8 +336,8 @@ static int
3424 ipq_mangle_ipv4(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
3425 {
3426 int diff;
3427 - int err;
3428 struct iphdr *user_iph = (struct iphdr *)v->payload;
3429 + struct sk_buff *nskb;
3430
3431 if (v->data_len < sizeof(*user_iph))
3432 return 0;
3433 @@ -349,14 +349,16 @@ ipq_mangle_ipv4(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
3434 if (v->data_len > 0xFFFF)
3435 return -EINVAL;
3436 if (diff > skb_tailroom(e->skb)) {
3437 - err = pskb_expand_head(e->skb, 0,
3438 + nskb = skb_copy_expand(e->skb, 0,
3439 diff - skb_tailroom(e->skb),
3440 GFP_ATOMIC);
3441 - if (err) {
3442 + if (!nskb) {
3443 printk(KERN_WARNING "ip_queue: error "
3444 - "in mangle, dropping packet: %d\n", -err);
3445 - return err;
3446 + "in mangle, dropping packet\n");
3447 + return -ENOMEM;
3448 }
3449 + kfree_skb(e->skb);
3450 + e->skb = nskb;
3451 }
3452 skb_put(e->skb, diff);
3453 }
3454 diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
3455 index 2f59baa..5b4095b 100644
3456 --- a/net/ipv6/ip6_output.c
3457 +++ b/net/ipv6/ip6_output.c
3458 @@ -593,7 +593,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
3459 * or if the skb it not generated by a local socket. (This last
3460 * check should be redundant, but it's free.)
3461 */
3462 - if (!np || np->pmtudisc >= IPV6_PMTUDISC_DO) {
3463 + if (!skb->local_df) {
3464 skb->dev = skb->dst->dev;
3465 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
3466 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS);
3467 @@ -1389,6 +1389,10 @@ int ip6_push_pending_frames(struct sock *sk)
3468 tmp_skb->sk = NULL;
3469 }
3470
3471 + /* Allow local fragmentation. */
3472 + if (np->pmtudisc < IPV6_PMTUDISC_DO)
3473 + skb->local_df = 1;
3474 +
3475 ipv6_addr_copy(final_dst, &fl->fl6_dst);
3476 __skb_pull(skb, skb_network_header_len(skb));
3477 if (opt && opt->opt_flen)
3478 diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
3479 index 5383b33..81941a1 100644
3480 --- a/net/ipv6/ip6_tunnel.c
3481 +++ b/net/ipv6/ip6_tunnel.c
3482 @@ -550,6 +550,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
3483 ip_rt_put(rt);
3484 goto out;
3485 }
3486 + skb2->dst = (struct dst_entry *)rt;
3487 } else {
3488 ip_rt_put(rt);
3489 if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos,
3490 diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
3491 index 1c5b09f..f46c38f 100644
3492 --- a/net/ipv6/ipcomp6.c
3493 +++ b/net/ipv6/ipcomp6.c
3494 @@ -146,7 +146,9 @@ static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb)
3495 scratch = *per_cpu_ptr(ipcomp6_scratches, cpu);
3496 tfm = *per_cpu_ptr(ipcd->tfms, cpu);
3497
3498 + local_bh_disable();
3499 err = crypto_comp_compress(tfm, start, plen, scratch, &dlen);
3500 + local_bh_enable();
3501 if (err || (dlen + sizeof(*ipch)) >= plen) {
3502 put_cpu();
3503 goto out_ok;
3504 diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
3505 index e273605..710a04f 100644
3506 --- a/net/ipv6/netfilter/ip6_queue.c
3507 +++ b/net/ipv6/netfilter/ip6_queue.c
3508 @@ -333,8 +333,8 @@ static int
3509 ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
3510 {
3511 int diff;
3512 - int err;
3513 struct ipv6hdr *user_iph = (struct ipv6hdr *)v->payload;
3514 + struct sk_buff *nskb;
3515
3516 if (v->data_len < sizeof(*user_iph))
3517 return 0;
3518 @@ -346,14 +346,16 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
3519 if (v->data_len > 0xFFFF)
3520 return -EINVAL;
3521 if (diff > skb_tailroom(e->skb)) {
3522 - err = pskb_expand_head(e->skb, 0,
3523 + nskb = skb_copy_expand(e->skb, 0,
3524 diff - skb_tailroom(e->skb),
3525 GFP_ATOMIC);
3526 - if (err) {
3527 + if (!nskb) {
3528 printk(KERN_WARNING "ip6_queue: OOM "
3529 "in mangle, dropping packet\n");
3530 - return err;
3531 + return -ENOMEM;
3532 }
3533 + kfree_skb(e->skb);
3534 + e->skb = nskb;
3535 }
3536 skb_put(e->skb, diff);
3537 }
3538 diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
3539 index 6569767..dc22909 100644
3540 --- a/net/ipv6/xfrm6_output.c
3541 +++ b/net/ipv6/xfrm6_output.c
3542 @@ -34,7 +34,7 @@ static int xfrm6_tunnel_check_size(struct sk_buff *skb)
3543 if (mtu < IPV6_MIN_MTU)
3544 mtu = IPV6_MIN_MTU;
3545
3546 - if (skb->len > mtu) {
3547 + if (!skb->local_df && skb->len > mtu) {
3548 skb->dev = dst->dev;
3549 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
3550 ret = -EMSGSIZE;
3551 diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
3552 index 2c7bd2e..dc43df1 100644
3553 --- a/net/netfilter/nfnetlink_log.c
3554 +++ b/net/netfilter/nfnetlink_log.c
3555 @@ -594,7 +594,7 @@ nfulnl_log_packet(unsigned int pf,
3556 /* FIXME: do we want to make the size calculation conditional based on
3557 * what is actually present? way more branches and checks, but more
3558 * memory efficient... */
3559 - size = NLMSG_ALIGN(sizeof(struct nfgenmsg))
3560 + size = NLMSG_SPACE(sizeof(struct nfgenmsg))
3561 + nla_total_size(sizeof(struct nfulnl_msg_packet_hdr))
3562 + nla_total_size(sizeof(u_int32_t)) /* ifindex */
3563 + nla_total_size(sizeof(u_int32_t)) /* ifindex */
3564 diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
3565 index 3ceeffc..7c3646c 100644
3566 --- a/net/netfilter/nfnetlink_queue.c
3567 +++ b/net/netfilter/nfnetlink_queue.c
3568 @@ -353,7 +353,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
3569
3570 QDEBUG("entered\n");
3571
3572 - size = NLMSG_ALIGN(sizeof(struct nfgenmsg))
3573 + size = NLMSG_SPACE(sizeof(struct nfgenmsg))
3574 + nla_total_size(sizeof(struct nfqnl_msg_packet_hdr))
3575 + nla_total_size(sizeof(u_int32_t)) /* ifindex */
3576 + nla_total_size(sizeof(u_int32_t)) /* ifindex */
3577 @@ -616,8 +616,8 @@ err_out_put:
3578 static int
3579 nfqnl_mangle(void *data, int data_len, struct nfqnl_queue_entry *e)
3580 {
3581 + struct sk_buff *nskb;
3582 int diff;
3583 - int err;
3584
3585 diff = data_len - e->skb->len;
3586 if (diff < 0) {
3587 @@ -627,14 +627,16 @@ nfqnl_mangle(void *data, int data_len, struct nfqnl_queue_entry *e)
3588 if (data_len > 0xFFFF)
3589 return -EINVAL;
3590 if (diff > skb_tailroom(e->skb)) {
3591 - err = pskb_expand_head(e->skb, 0,
3592 + nskb = skb_copy_expand(e->skb, 0,
3593 diff - skb_tailroom(e->skb),
3594 GFP_ATOMIC);
3595 - if (err) {
3596 + if (!nskb) {
3597 printk(KERN_WARNING "nf_queue: OOM "
3598 "in mangle, dropping packet\n");
3599 - return err;
3600 + return -ENOMEM;
3601 }
3602 + kfree_skb(e->skb);
3603 + e->skb = nskb;
3604 }
3605 skb_put(e->skb, diff);
3606 }
3607 diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c
3608 index f9c55dc..5222a97 100644
3609 --- a/net/netfilter/xt_time.c
3610 +++ b/net/netfilter/xt_time.c
3611 @@ -95,8 +95,11 @@ static inline void localtime_2(struct xtm *r, time_t time)
3612 */
3613 r->dse = time / 86400;
3614
3615 - /* 1970-01-01 (w=0) was a Thursday (4). */
3616 - r->weekday = (4 + r->dse) % 7;
3617 + /*
3618 + * 1970-01-01 (w=0) was a Thursday (4).
3619 + * -1 and +1 map Sunday properly onto 7.
3620 + */
3621 + r->weekday = (4 + r->dse - 1) % 7 + 1;
3622 }
3623
3624 static void localtime_3(struct xtm *r, time_t time)
3625 diff --git a/security/commoncap.c b/security/commoncap.c
3626 index ea61bc7..e87422e 100644
3627 --- a/security/commoncap.c
3628 +++ b/security/commoncap.c
3629 @@ -539,7 +539,7 @@ int cap_task_kill(struct task_struct *p, struct siginfo *info,
3630 * allowed.
3631 * We must preserve legacy signal behavior in this case.
3632 */
3633 - if (p->euid == 0 && p->uid == current->uid)
3634 + if (p->uid == current->uid)
3635 return 0;
3636
3637 /* sigcont is permitted within same session */