Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1593 - genpatches-2.6/trunk/2.6.30
Date: Fri, 31 Jul 2009 00:07:31
Message-Id: E1MWfed-0007Ub-He@stork.gentoo.org
1 Author: mpagano
2 Date: 2009-07-31 00:07:19 +0000 (Fri, 31 Jul 2009)
3 New Revision: 1593
4
5 Added:
6 genpatches-2.6/trunk/2.6.30/1003_linux-2.6.30.4.patch
7 Modified:
8 genpatches-2.6/trunk/2.6.30/0000_README
9 Log:
10 Linux patch version 2.6.30.4
11
12 Modified: genpatches-2.6/trunk/2.6.30/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/2.6.30/0000_README 2009-07-25 01:04:29 UTC (rev 1592)
15 +++ genpatches-2.6/trunk/2.6.30/0000_README 2009-07-31 00:07:19 UTC (rev 1593)
16 @@ -51,6 +51,10 @@
17 From: http://www.kernel.org
18 Desc: Linux 2.6.30.3
19
20 +Patch: 1003_linux-2.6.30.4.patch
21 +From: http://www.kernel.org
22 +Desc: Linux 2.6.30.4
23 +
24 Patch: 2500_ide-cd-handle-fragmented-patckets.patch
25 From: http://bugs.gentoo.org/show_bug.cgi?id=274182
26 Desc: ide-cd: handle fragmented packet commands gracefully
27
28 Added: genpatches-2.6/trunk/2.6.30/1003_linux-2.6.30.4.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/2.6.30/1003_linux-2.6.30.4.patch (rev 0)
31 +++ genpatches-2.6/trunk/2.6.30/1003_linux-2.6.30.4.patch 2009-07-31 00:07:19 UTC (rev 1593)
32 @@ -0,0 +1,2452 @@
33 +diff --git a/Documentation/RCU/rculist_nulls.txt b/Documentation/RCU/rculist_nulls.txt
34 +index 6389dec..d0c017e 100644
35 +--- a/Documentation/RCU/rculist_nulls.txt
36 ++++ b/Documentation/RCU/rculist_nulls.txt
37 +@@ -83,11 +83,12 @@ not detect it missed following items in original chain.
38 + obj = kmem_cache_alloc(...);
39 + lock_chain(); // typically a spin_lock()
40 + obj->key = key;
41 +-atomic_inc(&obj->refcnt);
42 + /*
43 + * we need to make sure obj->key is updated before obj->next
44 ++ * or obj->refcnt
45 + */
46 + smp_wmb();
47 ++atomic_set(&obj->refcnt, 1);
48 + hlist_add_head_rcu(&obj->obj_node, list);
49 + unlock_chain(); // typically a spin_unlock()
50 +
51 +@@ -159,6 +160,10 @@ out:
52 + obj = kmem_cache_alloc(cachep);
53 + lock_chain(); // typically a spin_lock()
54 + obj->key = key;
55 ++/*
56 ++ * changes to obj->key must be visible before refcnt one
57 ++ */
58 ++smp_wmb();
59 + atomic_set(&obj->refcnt, 1);
60 + /*
61 + * insert obj in RCU way (readers might be traversing chain)
62 +diff --git a/arch/parisc/include/asm/system.h b/arch/parisc/include/asm/system.h
63 +index ee80c92..d91357b 100644
64 +--- a/arch/parisc/include/asm/system.h
65 ++++ b/arch/parisc/include/asm/system.h
66 +@@ -168,8 +168,8 @@ static inline void set_eiem(unsigned long val)
67 + /* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. */
68 + #define __ldcw(a) ({ \
69 + unsigned __ret; \
70 +- __asm__ __volatile__(__LDCW " 0(%1),%0" \
71 +- : "=r" (__ret) : "r" (a)); \
72 ++ __asm__ __volatile__(__LDCW " 0(%2),%0" \
73 ++ : "=r" (__ret), "+m" (*(a)) : "r" (a)); \
74 + __ret; \
75 + })
76 +
77 +diff --git a/arch/parisc/include/asm/tlbflush.h b/arch/parisc/include/asm/tlbflush.h
78 +index 1f6fd4f..8f1a810 100644
79 +--- a/arch/parisc/include/asm/tlbflush.h
80 ++++ b/arch/parisc/include/asm/tlbflush.h
81 +@@ -12,14 +12,12 @@
82 + * N class systems, only one PxTLB inter processor broadcast can be
83 + * active at any one time on the Merced bus. This tlb purge
84 + * synchronisation is fairly lightweight and harmless so we activate
85 +- * it on all SMP systems not just the N class. We also need to have
86 +- * preemption disabled on uniprocessor machines, and spin_lock does that
87 +- * nicely.
88 ++ * it on all systems not just the N class.
89 + */
90 + extern spinlock_t pa_tlb_lock;
91 +
92 +-#define purge_tlb_start(x) spin_lock(&pa_tlb_lock)
93 +-#define purge_tlb_end(x) spin_unlock(&pa_tlb_lock)
94 ++#define purge_tlb_start(flags) spin_lock_irqsave(&pa_tlb_lock, flags)
95 ++#define purge_tlb_end(flags) spin_unlock_irqrestore(&pa_tlb_lock, flags)
96 +
97 + extern void flush_tlb_all(void);
98 + extern void flush_tlb_all_local(void *);
99 +@@ -63,14 +61,16 @@ static inline void flush_tlb_mm(struct mm_struct *mm)
100 + static inline void flush_tlb_page(struct vm_area_struct *vma,
101 + unsigned long addr)
102 + {
103 ++ unsigned long flags;
104 ++
105 + /* For one page, it's not worth testing the split_tlb variable */
106 +
107 + mb();
108 + mtsp(vma->vm_mm->context,1);
109 +- purge_tlb_start();
110 ++ purge_tlb_start(flags);
111 + pdtlb(addr);
112 + pitlb(addr);
113 +- purge_tlb_end();
114 ++ purge_tlb_end(flags);
115 + }
116 +
117 + void __flush_tlb_range(unsigned long sid,
118 +diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
119 +index 837530e..43546de 100644
120 +--- a/arch/parisc/kernel/cache.c
121 ++++ b/arch/parisc/kernel/cache.c
122 +@@ -398,12 +398,13 @@ EXPORT_SYMBOL(flush_kernel_icache_range_asm);
123 +
124 + void clear_user_page_asm(void *page, unsigned long vaddr)
125 + {
126 ++ unsigned long flags;
127 + /* This function is implemented in assembly in pacache.S */
128 + extern void __clear_user_page_asm(void *page, unsigned long vaddr);
129 +
130 +- purge_tlb_start();
131 ++ purge_tlb_start(flags);
132 + __clear_user_page_asm(page, vaddr);
133 +- purge_tlb_end();
134 ++ purge_tlb_end(flags);
135 + }
136 +
137 + #define FLUSH_THRESHOLD 0x80000 /* 0.5MB */
138 +@@ -444,20 +445,24 @@ extern void clear_user_page_asm(void *page, unsigned long vaddr);
139 +
140 + void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
141 + {
142 ++ unsigned long flags;
143 ++
144 + purge_kernel_dcache_page((unsigned long)page);
145 +- purge_tlb_start();
146 ++ purge_tlb_start(flags);
147 + pdtlb_kernel(page);
148 +- purge_tlb_end();
149 ++ purge_tlb_end(flags);
150 + clear_user_page_asm(page, vaddr);
151 + }
152 + EXPORT_SYMBOL(clear_user_page);
153 +
154 + void flush_kernel_dcache_page_addr(void *addr)
155 + {
156 ++ unsigned long flags;
157 ++
158 + flush_kernel_dcache_page_asm(addr);
159 +- purge_tlb_start();
160 ++ purge_tlb_start(flags);
161 + pdtlb_kernel(addr);
162 +- purge_tlb_end();
163 ++ purge_tlb_end(flags);
164 + }
165 + EXPORT_SYMBOL(flush_kernel_dcache_page_addr);
166 +
167 +@@ -490,8 +495,10 @@ void __flush_tlb_range(unsigned long sid, unsigned long start,
168 + if (npages >= 512) /* 2MB of space: arbitrary, should be tuned */
169 + flush_tlb_all();
170 + else {
171 ++ unsigned long flags;
172 ++
173 + mtsp(sid, 1);
174 +- purge_tlb_start();
175 ++ purge_tlb_start(flags);
176 + if (split_tlb) {
177 + while (npages--) {
178 + pdtlb(start);
179 +@@ -504,7 +511,7 @@ void __flush_tlb_range(unsigned long sid, unsigned long start,
180 + start += PAGE_SIZE;
181 + }
182 + }
183 +- purge_tlb_end();
184 ++ purge_tlb_end(flags);
185 + }
186 + }
187 +
188 +diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
189 +index 7d927ea..c07f618 100644
190 +--- a/arch/parisc/kernel/pci-dma.c
191 ++++ b/arch/parisc/kernel/pci-dma.c
192 +@@ -90,12 +90,14 @@ static inline int map_pte_uncached(pte_t * pte,
193 + if (end > PMD_SIZE)
194 + end = PMD_SIZE;
195 + do {
196 ++ unsigned long flags;
197 ++
198 + if (!pte_none(*pte))
199 + printk(KERN_ERR "map_pte_uncached: page already exists\n");
200 + set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC));
201 +- purge_tlb_start();
202 ++ purge_tlb_start(flags);
203 + pdtlb_kernel(orig_vaddr);
204 +- purge_tlb_end();
205 ++ purge_tlb_end(flags);
206 + vaddr += PAGE_SIZE;
207 + orig_vaddr += PAGE_SIZE;
208 + (*paddr_ptr) += PAGE_SIZE;
209 +@@ -168,11 +170,13 @@ static inline void unmap_uncached_pte(pmd_t * pmd, unsigned long vaddr,
210 + if (end > PMD_SIZE)
211 + end = PMD_SIZE;
212 + do {
213 ++ unsigned long flags;
214 + pte_t page = *pte;
215 ++
216 + pte_clear(&init_mm, vaddr, pte);
217 +- purge_tlb_start();
218 ++ purge_tlb_start(flags);
219 + pdtlb_kernel(orig_vaddr);
220 +- purge_tlb_end();
221 ++ purge_tlb_end(flags);
222 + vaddr += PAGE_SIZE;
223 + orig_vaddr += PAGE_SIZE;
224 + pte++;
225 +diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
226 +index 0efc12d..5bd527b 100644
227 +--- a/arch/powerpc/sysdev/mpic.c
228 ++++ b/arch/powerpc/sysdev/mpic.c
229 +@@ -279,28 +279,29 @@ static void _mpic_map_mmio(struct mpic *mpic, phys_addr_t phys_addr,
230 + }
231 +
232 + #ifdef CONFIG_PPC_DCR
233 +-static void _mpic_map_dcr(struct mpic *mpic, struct mpic_reg_bank *rb,
234 ++static void _mpic_map_dcr(struct mpic *mpic, struct device_node *node,
235 ++ struct mpic_reg_bank *rb,
236 + unsigned int offset, unsigned int size)
237 + {
238 + const u32 *dbasep;
239 +
240 +- dbasep = of_get_property(mpic->irqhost->of_node, "dcr-reg", NULL);
241 ++ dbasep = of_get_property(node, "dcr-reg", NULL);
242 +
243 +- rb->dhost = dcr_map(mpic->irqhost->of_node, *dbasep + offset, size);
244 ++ rb->dhost = dcr_map(node, *dbasep + offset, size);
245 + BUG_ON(!DCR_MAP_OK(rb->dhost));
246 + }
247 +
248 +-static inline void mpic_map(struct mpic *mpic, phys_addr_t phys_addr,
249 +- struct mpic_reg_bank *rb, unsigned int offset,
250 +- unsigned int size)
251 ++static inline void mpic_map(struct mpic *mpic, struct device_node *node,
252 ++ phys_addr_t phys_addr, struct mpic_reg_bank *rb,
253 ++ unsigned int offset, unsigned int size)
254 + {
255 + if (mpic->flags & MPIC_USES_DCR)
256 +- _mpic_map_dcr(mpic, rb, offset, size);
257 ++ _mpic_map_dcr(mpic, node, rb, offset, size);
258 + else
259 + _mpic_map_mmio(mpic, phys_addr, rb, offset, size);
260 + }
261 + #else /* CONFIG_PPC_DCR */
262 +-#define mpic_map(m,p,b,o,s) _mpic_map_mmio(m,p,b,o,s)
263 ++#define mpic_map(m,n,p,b,o,s) _mpic_map_mmio(m,p,b,o,s)
264 + #endif /* !CONFIG_PPC_DCR */
265 +
266 +
267 +@@ -1150,8 +1151,8 @@ struct mpic * __init mpic_alloc(struct device_node *node,
268 + }
269 +
270 + /* Map the global registers */
271 +- mpic_map(mpic, paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000);
272 +- mpic_map(mpic, paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
273 ++ mpic_map(mpic, node, paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000);
274 ++ mpic_map(mpic, node, paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
275 +
276 + /* Reset */
277 + if (flags & MPIC_WANTS_RESET) {
278 +@@ -1192,7 +1193,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
279 +
280 + /* Map the per-CPU registers */
281 + for (i = 0; i < mpic->num_cpus; i++) {
282 +- mpic_map(mpic, paddr, &mpic->cpuregs[i],
283 ++ mpic_map(mpic, node, paddr, &mpic->cpuregs[i],
284 + MPIC_INFO(CPU_BASE) + i * MPIC_INFO(CPU_STRIDE),
285 + 0x1000);
286 + }
287 +@@ -1200,7 +1201,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
288 + /* Initialize main ISU if none provided */
289 + if (mpic->isu_size == 0) {
290 + mpic->isu_size = mpic->num_sources;
291 +- mpic_map(mpic, paddr, &mpic->isus[0],
292 ++ mpic_map(mpic, node, paddr, &mpic->isus[0],
293 + MPIC_INFO(IRQ_BASE), MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
294 + }
295 + mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1);
296 +@@ -1254,8 +1255,10 @@ void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
297 +
298 + BUG_ON(isu_num >= MPIC_MAX_ISU);
299 +
300 +- mpic_map(mpic, paddr, &mpic->isus[isu_num], 0,
301 ++ mpic_map(mpic, mpic->irqhost->of_node,
302 ++ paddr, &mpic->isus[isu_num], 0,
303 + MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
304 ++
305 + if ((isu_first + mpic->isu_size) > mpic->num_sources)
306 + mpic->num_sources = isu_first + mpic->isu_size;
307 + }
308 +diff --git a/arch/x86/boot/video-vga.c b/arch/x86/boot/video-vga.c
309 +index 9e0587a..2fd19e6 100644
310 +--- a/arch/x86/boot/video-vga.c
311 ++++ b/arch/x86/boot/video-vga.c
312 +@@ -45,8 +45,10 @@ static u8 vga_set_basic_mode(void)
313 +
314 + #ifdef CONFIG_VIDEO_400_HACK
315 + if (adapter >= ADAPTER_VGA) {
316 ++ ax = 0x1202;
317 + asm volatile(INT10
318 +- : : "a" (0x1202), "b" (0x0030)
319 ++ : "+a" (ax)
320 ++ : "b" (0x0030)
321 + : "ecx", "edx", "esi", "edi");
322 + }
323 + #endif
324 +@@ -81,44 +83,59 @@ static u8 vga_set_basic_mode(void)
325 +
326 + static void vga_set_8font(void)
327 + {
328 ++ u16 ax;
329 ++
330 + /* Set 8x8 font - 80x43 on EGA, 80x50 on VGA */
331 +
332 + /* Set 8x8 font */
333 +- asm volatile(INT10 : : "a" (0x1112), "b" (0));
334 ++ ax = 0x1112;
335 ++ asm volatile(INT10 : "+a" (ax) : "b" (0));
336 +
337 + /* Use alternate print screen */
338 +- asm volatile(INT10 : : "a" (0x1200), "b" (0x20));
339 ++ ax = 0x1200;
340 ++ asm volatile(INT10 : "+a" (ax) : "b" (0x20));
341 +
342 + /* Turn off cursor emulation */
343 +- asm volatile(INT10 : : "a" (0x1201), "b" (0x34));
344 ++ ax = 0x1201;
345 ++ asm volatile(INT10 : "+a" (ax) : "b" (0x34));
346 +
347 + /* Cursor is scan lines 6-7 */
348 +- asm volatile(INT10 : : "a" (0x0100), "c" (0x0607));
349 ++ ax = 0x0100;
350 ++ asm volatile(INT10 : "+a" (ax) : "c" (0x0607));
351 + }
352 +
353 + static void vga_set_14font(void)
354 + {
355 ++ u16 ax;
356 ++
357 + /* Set 9x14 font - 80x28 on VGA */
358 +
359 + /* Set 9x14 font */
360 +- asm volatile(INT10 : : "a" (0x1111), "b" (0));
361 ++ ax = 0x1111;
362 ++ asm volatile(INT10 : "+a" (ax) : "b" (0));
363 +
364 + /* Turn off cursor emulation */
365 +- asm volatile(INT10 : : "a" (0x1201), "b" (0x34));
366 ++ ax = 0x1201;
367 ++ asm volatile(INT10 : "+a" (ax) : "b" (0x34));
368 +
369 + /* Cursor is scan lines 11-12 */
370 +- asm volatile(INT10 : : "a" (0x0100), "c" (0x0b0c));
371 ++ ax = 0x0100;
372 ++ asm volatile(INT10 : "+a" (ax) : "c" (0x0b0c));
373 + }
374 +
375 + static void vga_set_80x43(void)
376 + {
377 ++ u16 ax;
378 ++
379 + /* Set 80x43 mode on VGA (not EGA) */
380 +
381 + /* Set 350 scans */
382 +- asm volatile(INT10 : : "a" (0x1201), "b" (0x30));
383 ++ ax = 0x1201;
384 ++ asm volatile(INT10 : "+a" (ax) : "b" (0x30));
385 +
386 + /* Reset video mode */
387 +- asm volatile(INT10 : : "a" (0x0003));
388 ++ ax = 0x0003;
389 ++ asm volatile(INT10 : "+a" (ax));
390 +
391 + vga_set_8font();
392 + }
393 +@@ -225,7 +242,7 @@ static int vga_set_mode(struct mode_info *mode)
394 + */
395 + static int vga_probe(void)
396 + {
397 +- u16 ega_bx;
398 ++ u16 ax, ega_bx;
399 +
400 + static const char *card_name[] = {
401 + "CGA/MDA/HGC", "EGA", "VGA"
402 +@@ -242,9 +259,10 @@ static int vga_probe(void)
403 + };
404 + u8 vga_flag;
405 +
406 ++ ax = 0x1200;
407 + asm(INT10
408 +- : "=b" (ega_bx)
409 +- : "a" (0x1200), "b" (0x10) /* Check EGA/VGA */
410 ++ : "+a" (ax), "=b" (ega_bx)
411 ++ : "b" (0x10) /* Check EGA/VGA */
412 + : "ecx", "edx", "esi", "edi");
413 +
414 + #ifndef _WAKEUP
415 +diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
416 +index 2d81af3..7b2d71d 100644
417 +--- a/arch/x86/include/asm/fixmap.h
418 ++++ b/arch/x86/include/asm/fixmap.h
419 +@@ -111,12 +111,9 @@ enum fixed_addresses {
420 + #ifdef CONFIG_PARAVIRT
421 + FIX_PARAVIRT_BOOTMAP,
422 + #endif
423 +- FIX_TEXT_POKE0, /* reserve 2 pages for text_poke() */
424 +- FIX_TEXT_POKE1,
425 ++ FIX_TEXT_POKE1, /* reserve 2 pages for text_poke() */
426 ++ FIX_TEXT_POKE0, /* first page is last, because allocation is backward */
427 + __end_of_permanent_fixed_addresses,
428 +-#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
429 +- FIX_OHCI1394_BASE,
430 +-#endif
431 + /*
432 + * 256 temporary boot-time mappings, used by early_ioremap(),
433 + * before ioremap() is functional.
434 +@@ -129,6 +126,9 @@ enum fixed_addresses {
435 + FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 256 -
436 + (__end_of_permanent_fixed_addresses & 255),
437 + FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_SLOTS - 1,
438 ++#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
439 ++ FIX_OHCI1394_BASE,
440 ++#endif
441 + #ifdef CONFIG_X86_32
442 + FIX_WP_TEST,
443 + #endif
444 +diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
445 +index 9d826e4..667ed7f 100644
446 +--- a/arch/x86/include/asm/io_apic.h
447 ++++ b/arch/x86/include/asm/io_apic.h
448 +@@ -160,6 +160,7 @@ extern int io_apic_set_pci_routing(int ioapic, int pin, int irq,
449 +
450 + extern int (*ioapic_renumber_irq)(int ioapic, int irq);
451 + extern void ioapic_init_mappings(void);
452 ++extern void ioapic_insert_resources(void);
453 +
454 + #ifdef CONFIG_X86_64
455 + extern struct IO_APIC_route_entry **alloc_ioapic_entries(void);
456 +@@ -183,6 +184,7 @@ extern void ioapic_write_entry(int apic, int pin,
457 + #define io_apic_assign_pci_irqs 0
458 + static const int timer_through_8259 = 0;
459 + static inline void ioapic_init_mappings(void) { }
460 ++static inline void ioapic_insert_resources(void) { }
461 +
462 + static inline void probe_nr_irqs_gsi(void) { }
463 + #endif
464 +diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
465 +index b685ece..02c3fc6 100644
466 +--- a/arch/x86/include/asm/uaccess.h
467 ++++ b/arch/x86/include/asm/uaccess.h
468 +@@ -212,9 +212,9 @@ extern int __get_user_bad(void);
469 + : "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
470 + #else
471 + #define __put_user_asm_u64(x, ptr, retval, errret) \
472 +- __put_user_asm(x, ptr, retval, "q", "", "Zr", errret)
473 ++ __put_user_asm(x, ptr, retval, "q", "", "er", errret)
474 + #define __put_user_asm_ex_u64(x, addr) \
475 +- __put_user_asm_ex(x, addr, "q", "", "Zr")
476 ++ __put_user_asm_ex(x, addr, "q", "", "er")
477 + #define __put_user_x8(x, ptr, __ret_pu) __put_user_x(8, x, ptr, __ret_pu)
478 + #endif
479 +
480 +diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
481 +index 8cc6873..db24b21 100644
482 +--- a/arch/x86/include/asm/uaccess_64.h
483 ++++ b/arch/x86/include/asm/uaccess_64.h
484 +@@ -88,11 +88,11 @@ int __copy_to_user(void __user *dst, const void *src, unsigned size)
485 + ret, "l", "k", "ir", 4);
486 + return ret;
487 + case 8:__put_user_asm(*(u64 *)src, (u64 __user *)dst,
488 +- ret, "q", "", "ir", 8);
489 ++ ret, "q", "", "er", 8);
490 + return ret;
491 + case 10:
492 + __put_user_asm(*(u64 *)src, (u64 __user *)dst,
493 +- ret, "q", "", "ir", 10);
494 ++ ret, "q", "", "er", 10);
495 + if (unlikely(ret))
496 + return ret;
497 + asm("":::"memory");
498 +@@ -101,12 +101,12 @@ int __copy_to_user(void __user *dst, const void *src, unsigned size)
499 + return ret;
500 + case 16:
501 + __put_user_asm(*(u64 *)src, (u64 __user *)dst,
502 +- ret, "q", "", "ir", 16);
503 ++ ret, "q", "", "er", 16);
504 + if (unlikely(ret))
505 + return ret;
506 + asm("":::"memory");
507 + __put_user_asm(1[(u64 *)src], 1 + (u64 __user *)dst,
508 +- ret, "q", "", "ir", 8);
509 ++ ret, "q", "", "er", 8);
510 + return ret;
511 + default:
512 + return copy_user_generic((__force void *)dst, src, size);
513 +@@ -157,7 +157,7 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
514 + ret, "q", "", "=r", 8);
515 + if (likely(!ret))
516 + __put_user_asm(tmp, (u64 __user *)dst,
517 +- ret, "q", "", "ir", 8);
518 ++ ret, "q", "", "er", 8);
519 + return ret;
520 + }
521 + default:
522 +diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
523 +index 30da617..edfc25c 100644
524 +--- a/arch/x86/kernel/apic/io_apic.c
525 ++++ b/arch/x86/kernel/apic/io_apic.c
526 +@@ -4182,28 +4182,20 @@ fake_ioapic_page:
527 + }
528 + }
529 +
530 +-static int __init ioapic_insert_resources(void)
531 ++void __init ioapic_insert_resources(void)
532 + {
533 + int i;
534 + struct resource *r = ioapic_resources;
535 +
536 + if (!r) {
537 +- if (nr_ioapics > 0) {
538 ++ if (nr_ioapics > 0)
539 + printk(KERN_ERR
540 + "IO APIC resources couldn't be allocated.\n");
541 +- return -1;
542 +- }
543 +- return 0;
544 ++ return;
545 + }
546 +
547 + for (i = 0; i < nr_ioapics; i++) {
548 + insert_resource(&iomem_resource, r);
549 + r++;
550 + }
551 +-
552 +- return 0;
553 + }
554 +-
555 +-/* Insert the IO APIC resources after PCI initialization has occured to handle
556 +- * IO APICS that are mapped in on a BAR in PCI space. */
557 +-late_initcall(ioapic_insert_resources);
558 +diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c
559 +index 846510b..2a62d84 100644
560 +--- a/arch/x86/kernel/mfgpt_32.c
561 ++++ b/arch/x86/kernel/mfgpt_32.c
562 +@@ -347,7 +347,7 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id)
563 +
564 + static struct irqaction mfgptirq = {
565 + .handler = mfgpt_tick,
566 +- .flags = IRQF_DISABLED | IRQF_NOBALANCING,
567 ++ .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER,
568 + .name = "mfgpt-timer"
569 + };
570 +
571 +diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
572 +index 0acc6a7..771ffd0 100644
573 +--- a/arch/x86/kernel/setup.c
574 ++++ b/arch/x86/kernel/setup.c
575 +@@ -650,6 +650,19 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
576 + DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies"),
577 + },
578 + },
579 ++ {
580 ++ /*
581 ++ * AMI BIOS with low memory corruption was found on Intel DG45ID board.
582 ++ * It hase different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
583 ++ * match only DMI_BOARD_NAME and see if there is more bad products
584 ++ * with this vendor.
585 ++ */
586 ++ .callback = dmi_low_memory_corruption,
587 ++ .ident = "AMI BIOS",
588 ++ .matches = {
589 ++ DMI_MATCH(DMI_BOARD_NAME, "DG45ID"),
590 ++ },
591 ++ },
592 + #endif
593 + {}
594 + };
595 +diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
596 +index 6340cef..312e8eb 100644
597 +--- a/arch/x86/mm/gup.c
598 ++++ b/arch/x86/mm/gup.c
599 +@@ -247,10 +247,15 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
600 + start &= PAGE_MASK;
601 + addr = start;
602 + len = (unsigned long) nr_pages << PAGE_SHIFT;
603 ++
604 + end = start + len;
605 +- if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
606 +- (void __user *)start, len)))
607 ++ if (end < start)
608 ++ goto slow_irqon;
609 ++
610 ++#ifdef CONFIG_X86_64
611 ++ if (end >> 47)
612 + goto slow_irqon;
613 ++#endif
614 +
615 + /*
616 + * XXX: batch / limit 'nr', to avoid large irq off latency
617 +diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
618 +index 0176595..c5c43e0 100644
619 +--- a/arch/x86/mm/srat_64.c
620 ++++ b/arch/x86/mm/srat_64.c
621 +@@ -89,8 +89,10 @@ static __init void bad_srat(void)
622 + found_add_area = 0;
623 + for (i = 0; i < MAX_LOCAL_APIC; i++)
624 + apicid_to_node[i] = NUMA_NO_NODE;
625 +- for (i = 0; i < MAX_NUMNODES; i++)
626 +- nodes_add[i].start = nodes[i].end = 0;
627 ++ for (i = 0; i < MAX_NUMNODES; i++) {
628 ++ nodes[i].start = nodes[i].end = 0;
629 ++ nodes_add[i].start = nodes_add[i].end = 0;
630 ++ }
631 + remove_all_active_ranges();
632 + }
633 +
634 +diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
635 +index a85bef2..6dcebb5 100644
636 +--- a/arch/x86/pci/i386.c
637 ++++ b/arch/x86/pci/i386.c
638 +@@ -35,6 +35,7 @@
639 + #include <asm/pat.h>
640 + #include <asm/e820.h>
641 + #include <asm/pci_x86.h>
642 ++#include <asm/io_apic.h>
643 +
644 +
645 + static int
646 +@@ -230,6 +231,12 @@ void __init pcibios_resource_survey(void)
647 + pcibios_allocate_resources(1);
648 +
649 + e820_reserve_resources_late();
650 ++ /*
651 ++ * Insert the IO APIC resources after PCI initialization has
652 ++ * occured to handle IO APICS that are mapped in on a BAR in
653 ++ * PCI space, but before trying to assign unassigned pci res.
654 ++ */
655 ++ ioapic_insert_resources();
656 + }
657 +
658 + /**
659 +diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
660 +index 94919ad..d37808b 100644
661 +--- a/drivers/ata/libata-eh.c
662 ++++ b/drivers/ata/libata-eh.c
663 +@@ -2517,6 +2517,10 @@ int ata_eh_reset(struct ata_link *link, int classify,
664 +
665 + ata_eh_about_to_do(link, NULL, ATA_EH_RESET);
666 + rc = ata_do_reset(link, reset, classes, deadline, true);
667 ++ if (rc) {
668 ++ failed_link = link;
669 ++ goto fail;
670 ++ }
671 + }
672 + } else {
673 + if (verbose)
674 +diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
675 +index d94d25c..c1791a6 100644
676 +--- a/drivers/char/vc_screen.c
677 ++++ b/drivers/char/vc_screen.c
678 +@@ -495,11 +495,15 @@ void vcs_remove_sysfs(int index)
679 +
680 + int __init vcs_init(void)
681 + {
682 ++ unsigned int i;
683 ++
684 + if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops))
685 + panic("unable to get major %d for vcs device", VCS_MAJOR);
686 + vc_class = class_create(THIS_MODULE, "vc");
687 +
688 + device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs");
689 + device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa");
690 ++ for (i = 0; i < MIN_NR_CONSOLES; i++)
691 ++ vcs_make_sysfs(i);
692 + return 0;
693 + }
694 +diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
695 +index e9b436d..39e27f4 100644
696 +--- a/drivers/hid/usbhid/hiddev.c
697 ++++ b/drivers/hid/usbhid/hiddev.c
698 +@@ -527,8 +527,10 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
699 + goto goodreturn;
700 +
701 + case HIDIOCGCOLLECTIONINDEX:
702 ++ i = field->usage[uref->usage_index].collection_index;
703 ++ unlock_kernel();
704 + kfree(uref_multi);
705 +- return field->usage[uref->usage_index].collection_index;
706 ++ return i;
707 + case HIDIOCGUSAGES:
708 + for (i = 0; i < uref_multi->num_values; i++)
709 + uref_multi->values[i] =
710 +diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
711 +index f27af6a..65cf25f 100644
712 +--- a/drivers/hwmon/max6650.c
713 ++++ b/drivers/hwmon/max6650.c
714 +@@ -407,6 +407,7 @@ static ssize_t set_div(struct device *dev, struct device_attribute *devattr,
715 + data->count = 3;
716 + break;
717 + default:
718 ++ mutex_unlock(&data->update_lock);
719 + dev_err(&client->dev,
720 + "illegal value for fan divider (%d)\n", div);
721 + return -EINVAL;
722 +diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
723 +index 7c8957d..26e17a9 100644
724 +--- a/drivers/input/misc/wistron_btns.c
725 ++++ b/drivers/input/misc/wistron_btns.c
726 +@@ -646,6 +646,15 @@ static struct dmi_system_id dmi_ids[] __initdata = {
727 + },
728 + {
729 + .callback = dmi_matched,
730 ++ .ident = "Maxdata Pro 7000 DX",
731 ++ .matches = {
732 ++ DMI_MATCH(DMI_SYS_VENDOR, "MAXDATA"),
733 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Pro 7000"),
734 ++ },
735 ++ .driver_data = keymap_fs_amilo_pro_v2000
736 ++ },
737 ++ {
738 ++ .callback = dmi_matched,
739 + .ident = "Fujitsu N3510",
740 + .matches = {
741 + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
742 +diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
743 +index e582a48..42f1a82 100644
744 +--- a/drivers/isdn/gigaset/ev-layer.c
745 ++++ b/drivers/isdn/gigaset/ev-layer.c
746 +@@ -294,32 +294,33 @@ struct reply_t gigaset_tab_cid_m10x[] = /* for M10x */
747 + {RSP_OK, 604,604, -1, 605, 5, {ACT_CMD+AT_MSN}},
748 + {RSP_OK, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}},
749 + {RSP_NULL, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}},
750 +- {RSP_OK, 606,606, -1, 607, 5, {0}, "+VLS=17\r"}, /* set "Endgeraetemodus" */
751 ++ {RSP_OK, 606,606, -1, 607, 5, {0}, "+VLS=17\r"},
752 + {RSP_OK, 607,607, -1, 608,-1},
753 +- //{RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 608, 0, {ACT_ERROR}},//DELETE
754 + {RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 609, 5, {ACT_CMD+AT_DIAL}},
755 + {RSP_OK, 609,609, -1, 650, 0, {ACT_DIALING}},
756 +
757 +- {RSP_ZVLS, 608,608, 17, -1,-1, {ACT_DEBUG}},
758 +- {RSP_ZCTP, 609,609, -1, -1,-1, {ACT_DEBUG}},
759 +- {RSP_ZCPN, 609,609, -1, -1,-1, {ACT_DEBUG}},
760 + {RSP_ERROR, 601,609, -1, 0, 0, {ACT_ABORTDIAL}},
761 + {EV_TIMEOUT, 601,609, -1, 0, 0, {ACT_ABORTDIAL}},
762 +
763 +- /* dialing */
764 +- {RSP_ZCTP, 650,650, -1, -1,-1, {ACT_DEBUG}},
765 +- {RSP_ZCPN, 650,650, -1, -1,-1, {ACT_DEBUG}},
766 +- {RSP_ZSAU, 650,650,ZSAU_CALL_DELIVERED, -1,-1, {ACT_DEBUG}}, /* some devices don't send this */
767 +-
768 +- /* connection established */
769 +- {RSP_ZSAU, 650,650,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, //FIXME -> DLE1
770 +- {RSP_ZSAU, 750,750,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, //FIXME -> DLE1
771 +-
772 +- {EV_BC_OPEN, 800,800, -1, 800,-1, {ACT_NOTIFY_BC_UP}}, //FIXME new constate + timeout
773 ++ /* optional dialing responses */
774 ++ {EV_BC_OPEN, 650,650, -1, 651,-1},
775 ++ {RSP_ZVLS, 608,651, 17, -1,-1, {ACT_DEBUG}},
776 ++ {RSP_ZCTP, 609,651, -1, -1,-1, {ACT_DEBUG}},
777 ++ {RSP_ZCPN, 609,651, -1, -1,-1, {ACT_DEBUG}},
778 ++ {RSP_ZSAU, 650,651,ZSAU_CALL_DELIVERED, -1,-1, {ACT_DEBUG}},
779 ++
780 ++ /* connect */
781 ++ {RSP_ZSAU, 650,650,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}},
782 ++ {RSP_ZSAU, 651,651,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT,
783 ++ ACT_NOTIFY_BC_UP}},
784 ++ {RSP_ZSAU, 750,750,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}},
785 ++ {RSP_ZSAU, 751,751,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT,
786 ++ ACT_NOTIFY_BC_UP}},
787 ++ {EV_BC_OPEN, 800,800, -1, 800,-1, {ACT_NOTIFY_BC_UP}},
788 +
789 + /* remote hangup */
790 +- {RSP_ZSAU, 650,650,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT}},
791 +- {RSP_ZSAU, 750,750,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}},
792 ++ {RSP_ZSAU, 650,651,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT}},
793 ++ {RSP_ZSAU, 750,751,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}},
794 + {RSP_ZSAU, 800,800,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}},
795 +
796 + /* hangup */
797 +@@ -358,7 +359,8 @@ struct reply_t gigaset_tab_cid_m10x[] = /* for M10x */
798 + {RSP_ZSAU, 700,729,ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT}},
799 + {RSP_ZSAU, 700,729,ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT}},
800 +
801 +- {EV_TIMEOUT, 750,750, -1, 0, 0, {ACT_CONNTIMEOUT}},
802 ++ {EV_BC_OPEN, 750,750, -1, 751,-1},
803 ++ {EV_TIMEOUT, 750,751, -1, 0, 0, {ACT_CONNTIMEOUT}},
804 +
805 + /* B channel closed (general case) */
806 + {EV_BC_CLOSED, -1, -1, -1, -1,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME
807 +@@ -876,12 +878,6 @@ static void bchannel_down(struct bc_state *bcs)
808 +
809 + static void bchannel_up(struct bc_state *bcs)
810 + {
811 +- if (!(bcs->chstate & CHS_D_UP)) {
812 +- dev_notice(bcs->cs->dev, "%s: D channel not up\n", __func__);
813 +- bcs->chstate |= CHS_D_UP;
814 +- gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DCONN);
815 +- }
816 +-
817 + if (bcs->chstate & CHS_B_UP) {
818 + dev_notice(bcs->cs->dev, "%s: B channel already up\n",
819 + __func__);
820 +diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
821 +index 076fbb4..d8d31b8 100644
822 +--- a/drivers/md/dm-raid1.c
823 ++++ b/drivers/md/dm-raid1.c
824 +@@ -638,6 +638,7 @@ static void do_writes(struct mirror_set *ms, struct bio_list *writes)
825 + spin_lock_irq(&ms->lock);
826 + bio_list_merge(&ms->writes, &requeue);
827 + spin_unlock_irq(&ms->lock);
828 ++ delayed_wake(ms);
829 + }
830 +
831 + /*
832 +diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
833 +index b56d72f..34e2348 100644
834 +--- a/drivers/mmc/host/mvsdio.c
835 ++++ b/drivers/mmc/host/mvsdio.c
836 +@@ -384,7 +384,7 @@ static irqreturn_t mvsd_irq(int irq, void *dev)
837 + u16 val[2] = {0, 0};
838 + val[0] = mvsd_read(MVSD_FIFO);
839 + val[1] = mvsd_read(MVSD_FIFO);
840 +- memcpy(p, &val, s);
841 ++ memcpy(p, ((void *)&val) + 4 - s, s);
842 + s = 0;
843 + intr_status = mvsd_read(MVSD_NOR_INTR_STATUS);
844 + }
845 +@@ -423,7 +423,7 @@ static irqreturn_t mvsd_irq(int irq, void *dev)
846 + if (s < 4) {
847 + if (s && (intr_status & MVSD_NOR_TX_AVAIL)) {
848 + u16 val[2] = {0, 0};
849 +- memcpy(&val, p, s);
850 ++ memcpy(((void *)&val) + 4 - s, p, s);
851 + mvsd_write(MVSD_FIFO, val[0]);
852 + mvsd_write(MVSD_FIFO, val[1]);
853 + s = 0;
854 +diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
855 +index 1fc4543..d35cf5b 100644
856 +--- a/drivers/net/8139too.c
857 ++++ b/drivers/net/8139too.c
858 +@@ -917,6 +917,7 @@ static const struct net_device_ops rtl8139_netdev_ops = {
859 + .ndo_open = rtl8139_open,
860 + .ndo_stop = rtl8139_close,
861 + .ndo_get_stats = rtl8139_get_stats,
862 ++ .ndo_change_mtu = eth_change_mtu,
863 + .ndo_validate_addr = eth_validate_addr,
864 + .ndo_set_mac_address = rtl8139_set_mac_address,
865 + .ndo_start_xmit = rtl8139_start_xmit,
866 +diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
867 +index a740053..25aef09 100644
868 +--- a/drivers/net/arm/ixp4xx_eth.c
869 ++++ b/drivers/net/arm/ixp4xx_eth.c
870 +@@ -1140,7 +1140,9 @@ static const struct net_device_ops ixp4xx_netdev_ops = {
871 + .ndo_start_xmit = eth_xmit,
872 + .ndo_set_multicast_list = eth_set_mcast_list,
873 + .ndo_do_ioctl = eth_ioctl,
874 +-
875 ++ .ndo_change_mtu = eth_change_mtu,
876 ++ .ndo_set_mac_address = eth_mac_addr,
877 ++ .ndo_validate_addr = eth_validate_addr,
878 + };
879 +
880 + static int __devinit eth_init_one(struct platform_device *pdev)
881 +diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
882 +index b22dab9..0a7a288 100644
883 +--- a/drivers/net/ehea/ehea_main.c
884 ++++ b/drivers/net/ehea/ehea_main.c
885 +@@ -3080,7 +3080,9 @@ static const struct net_device_ops ehea_netdev_ops = {
886 + .ndo_poll_controller = ehea_netpoll,
887 + #endif
888 + .ndo_get_stats = ehea_get_stats,
889 ++ .ndo_change_mtu = eth_change_mtu,
890 + .ndo_set_mac_address = ehea_set_mac_addr,
891 ++ .ndo_validate_addr = eth_validate_addr,
892 + .ndo_set_multicast_list = ehea_set_multicast_list,
893 + .ndo_change_mtu = ehea_change_mtu,
894 + .ndo_vlan_rx_register = ehea_vlan_rx_register,
895 +diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
896 +index a051918..d8b2649 100644
897 +--- a/drivers/net/gianfar.c
898 ++++ b/drivers/net/gianfar.c
899 +@@ -155,6 +155,8 @@ static const struct net_device_ops gfar_netdev_ops = {
900 + .ndo_tx_timeout = gfar_timeout,
901 + .ndo_do_ioctl = gfar_ioctl,
902 + .ndo_vlan_rx_register = gfar_vlan_rx_register,
903 ++ .ndo_set_mac_address = eth_mac_addr,
904 ++ .ndo_validate_addr = eth_validate_addr,
905 + #ifdef CONFIG_NET_POLL_CONTROLLER
906 + .ndo_poll_controller = gfar_netpoll,
907 + #endif
908 +diff --git a/drivers/net/plip.c b/drivers/net/plip.c
909 +index 0be0f0b..5e2d89d 100644
910 +--- a/drivers/net/plip.c
911 ++++ b/drivers/net/plip.c
912 +@@ -270,6 +270,9 @@ static const struct net_device_ops plip_netdev_ops = {
913 + .ndo_stop = plip_close,
914 + .ndo_start_xmit = plip_tx_packet,
915 + .ndo_do_ioctl = plip_ioctl,
916 ++ .ndo_change_mtu = eth_change_mtu,
917 ++ .ndo_set_mac_address = eth_mac_addr,
918 ++ .ndo_validate_addr = eth_validate_addr,
919 + };
920 +
921 + /* Entry point of PLIP driver.
922 +diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
923 +index 30900b3..34c53c6 100644
924 +--- a/drivers/net/ps3_gelic_net.c
925 ++++ b/drivers/net/ps3_gelic_net.c
926 +@@ -1410,6 +1410,7 @@ static const struct net_device_ops gelic_netdevice_ops = {
927 + .ndo_set_multicast_list = gelic_net_set_multi,
928 + .ndo_change_mtu = gelic_net_change_mtu,
929 + .ndo_tx_timeout = gelic_net_tx_timeout,
930 ++ .ndo_set_mac_address = eth_mac_addr,
931 + .ndo_validate_addr = eth_validate_addr,
932 + #ifdef CONFIG_NET_POLL_CONTROLLER
933 + .ndo_poll_controller = gelic_net_poll_controller,
934 +diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
935 +index 4f3ada6..4530126 100644
936 +--- a/drivers/net/ps3_gelic_wireless.c
937 ++++ b/drivers/net/ps3_gelic_wireless.c
938 +@@ -2707,6 +2707,7 @@ static const struct net_device_ops gelic_wl_netdevice_ops = {
939 + .ndo_set_multicast_list = gelic_net_set_multi,
940 + .ndo_change_mtu = gelic_net_change_mtu,
941 + .ndo_tx_timeout = gelic_net_tx_timeout,
942 ++ .ndo_set_mac_address = eth_mac_addr,
943 + .ndo_validate_addr = eth_validate_addr,
944 + #ifdef CONFIG_NET_POLL_CONTROLLER
945 + .ndo_poll_controller = gelic_net_poll_controller,
946 +diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
947 +index fdcbaf8..1c70e99 100644
948 +--- a/drivers/net/smc91x.c
949 ++++ b/drivers/net/smc91x.c
950 +@@ -1774,6 +1774,7 @@ static const struct net_device_ops smc_netdev_ops = {
951 + .ndo_start_xmit = smc_hard_start_xmit,
952 + .ndo_tx_timeout = smc_timeout,
953 + .ndo_set_multicast_list = smc_set_multicast_list,
954 ++ .ndo_change_mtu = eth_change_mtu,
955 + .ndo_validate_addr = eth_validate_addr,
956 + .ndo_set_mac_address = eth_mac_addr,
957 + #ifdef CONFIG_NET_POLL_CONTROLLER
958 +diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
959 +index eb7db03..b4e2685 100644
960 +--- a/drivers/net/smsc911x.c
961 ++++ b/drivers/net/smsc911x.c
962 +@@ -1766,6 +1766,7 @@ static const struct net_device_ops smsc911x_netdev_ops = {
963 + .ndo_get_stats = smsc911x_get_stats,
964 + .ndo_set_multicast_list = smsc911x_set_multicast_list,
965 + .ndo_do_ioctl = smsc911x_do_ioctl,
966 ++ .ndo_change_mtu = eth_change_mtu,
967 + .ndo_validate_addr = eth_validate_addr,
968 + .ndo_set_mac_address = smsc911x_set_mac_address,
969 + #ifdef CONFIG_NET_POLL_CONTROLLER
970 +diff --git a/drivers/net/sunvnet.c b/drivers/net/sunvnet.c
971 +index a82fb2a..f1e5e45 100644
972 +--- a/drivers/net/sunvnet.c
973 ++++ b/drivers/net/sunvnet.c
974 +@@ -1016,7 +1016,9 @@ static const struct net_device_ops vnet_ops = {
975 + .ndo_open = vnet_open,
976 + .ndo_stop = vnet_close,
977 + .ndo_set_multicast_list = vnet_set_rx_mode,
978 ++ .ndo_change_mtu = eth_change_mtu,
979 + .ndo_set_mac_address = vnet_set_mac_addr,
980 ++ .ndo_validate_addr = eth_validate_addr,
981 + .ndo_tx_timeout = vnet_tx_timeout,
982 + .ndo_change_mtu = vnet_change_mtu,
983 + .ndo_start_xmit = vnet_start_xmit,
984 +diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
985 +index 3d0d0b0..d837cf1 100644
986 +--- a/drivers/net/usb/kaweth.c
987 ++++ b/drivers/net/usb/kaweth.c
988 +@@ -982,6 +982,9 @@ static const struct net_device_ops kaweth_netdev_ops = {
989 + .ndo_tx_timeout = kaweth_tx_timeout,
990 + .ndo_set_multicast_list = kaweth_set_rx_mode,
991 + .ndo_get_stats = kaweth_netdev_stats,
992 ++ .ndo_change_mtu = eth_change_mtu,
993 ++ .ndo_set_mac_address = eth_mac_addr,
994 ++ .ndo_validate_addr = eth_validate_addr,
995 + };
996 +
997 + static int kaweth_probe(
998 +diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
999 +index 73acbd2..631d269 100644
1000 +--- a/drivers/net/usb/pegasus.c
1001 ++++ b/drivers/net/usb/pegasus.c
1002 +@@ -1493,6 +1493,9 @@ static const struct net_device_ops pegasus_netdev_ops = {
1003 + .ndo_set_multicast_list = pegasus_set_multicast,
1004 + .ndo_get_stats = pegasus_netdev_stats,
1005 + .ndo_tx_timeout = pegasus_tx_timeout,
1006 ++ .ndo_change_mtu = eth_change_mtu,
1007 ++ .ndo_set_mac_address = eth_mac_addr,
1008 ++ .ndo_validate_addr = eth_validate_addr,
1009 + };
1010 +
1011 + static struct usb_driver pegasus_driver = {
1012 +diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
1013 +index 45daba7..9d49497 100644
1014 +--- a/drivers/net/via-rhine.c
1015 ++++ b/drivers/net/via-rhine.c
1016 +@@ -622,6 +622,7 @@ static const struct net_device_ops rhine_netdev_ops = {
1017 + .ndo_start_xmit = rhine_start_tx,
1018 + .ndo_get_stats = rhine_get_stats,
1019 + .ndo_set_multicast_list = rhine_set_rx_mode,
1020 ++ .ndo_change_mtu = eth_change_mtu,
1021 + .ndo_validate_addr = eth_validate_addr,
1022 + .ndo_set_mac_address = eth_mac_addr,
1023 + .ndo_do_ioctl = netdev_ioctl,
1024 +diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
1025 +index 345593c..a370e51 100644
1026 +--- a/drivers/net/wireless/orinoco/main.c
1027 ++++ b/drivers/net/wireless/orinoco/main.c
1028 +@@ -2521,6 +2521,8 @@ static const struct net_device_ops orinoco_netdev_ops = {
1029 + .ndo_start_xmit = orinoco_xmit,
1030 + .ndo_set_multicast_list = orinoco_set_multicast_list,
1031 + .ndo_change_mtu = orinoco_change_mtu,
1032 ++ .ndo_set_mac_address = eth_mac_addr,
1033 ++ .ndo_validate_addr = eth_validate_addr,
1034 + .ndo_tx_timeout = orinoco_tx_timeout,
1035 + .ndo_get_stats = orinoco_get_stats,
1036 + };
1037 +@@ -2555,7 +2557,6 @@ struct net_device
1038 + priv->wireless_data.spy_data = &priv->spy_data;
1039 + dev->wireless_data = &priv->wireless_data;
1040 + #endif
1041 +- /* we use the default eth_mac_addr for setting the MAC addr */
1042 +
1043 + /* Reserve space in skb for the SNAP header */
1044 + dev->hard_header_len += ENCAPS_OVERHEAD;
1045 +diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
1046 +index e1716f1..ff63279 100644
1047 +--- a/drivers/scsi/sg.c
1048 ++++ b/drivers/scsi/sg.c
1049 +@@ -1656,6 +1656,10 @@ static int sg_start_req(Sg_request *srp, unsigned char *cmd)
1050 + md->nr_entries = req_schp->k_use_sg;
1051 + md->offset = 0;
1052 + md->null_mapped = hp->dxferp ? 0 : 1;
1053 ++ if (dxfer_dir == SG_DXFER_TO_FROM_DEV)
1054 ++ md->from_user = 1;
1055 ++ else
1056 ++ md->from_user = 0;
1057 + }
1058 +
1059 + if (iov_count) {
1060 +diff --git a/drivers/scsi/zalon.c b/drivers/scsi/zalon.c
1061 +index 97f3158..27e84e4 100644
1062 +--- a/drivers/scsi/zalon.c
1063 ++++ b/drivers/scsi/zalon.c
1064 +@@ -134,7 +134,7 @@ zalon_probe(struct parisc_device *dev)
1065 +
1066 + host = ncr_attach(&zalon7xx_template, unit, &device);
1067 + if (!host)
1068 +- goto fail;
1069 ++ return -ENODEV;
1070 +
1071 + if (request_irq(dev->irq, ncr53c8xx_intr, IRQF_SHARED, "zalon", host)) {
1072 + dev_printk(KERN_ERR, &dev->dev, "irq problem with %d, detaching\n ",
1073 +diff --git a/drivers/staging/rt2870/rt2870.h b/drivers/staging/rt2870/rt2870.h
1074 +index a69cf33..fef14a4 100644
1075 +--- a/drivers/staging/rt2870/rt2870.h
1076 ++++ b/drivers/staging/rt2870/rt2870.h
1077 +@@ -97,6 +97,7 @@
1078 + {USB_DEVICE(0x0DF6,0x002C)}, /* Sitecom */ \
1079 + {USB_DEVICE(0x0DF6,0x002D)}, /* Sitecom */ \
1080 + {USB_DEVICE(0x0DF6,0x0039)}, /* Sitecom */ \
1081 ++ {USB_DEVICE(0x0DF6,0x003F)}, /* Sitecom WL-608 */ \
1082 + {USB_DEVICE(0x14B2,0x3C06)}, /* Conceptronic */ \
1083 + {USB_DEVICE(0x14B2,0x3C28)}, /* Conceptronic */ \
1084 + {USB_DEVICE(0x2019,0xED06)}, /* Planex Communications, Inc. */ \
1085 +diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c
1086 +index 93af37e..54b4b71 100644
1087 +--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c
1088 ++++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c
1089 +@@ -461,19 +461,19 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee,
1090 + struct iw_request_info *info,
1091 + union iwreq_data *wrqu, char *extra)
1092 + {
1093 +- strcpy(wrqu->name, "802.11");
1094 ++ strlcpy(wrqu->name, "802.11", IFNAMSIZ);
1095 + if(ieee->modulation & IEEE80211_CCK_MODULATION){
1096 +- strcat(wrqu->name, "b");
1097 ++ strlcat(wrqu->name, "b", IFNAMSIZ);
1098 + if(ieee->modulation & IEEE80211_OFDM_MODULATION)
1099 +- strcat(wrqu->name, "/g");
1100 ++ strlcat(wrqu->name, "/g", IFNAMSIZ);
1101 + }else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
1102 +- strcat(wrqu->name, "g");
1103 ++ strlcat(wrqu->name, "g", IFNAMSIZ);
1104 +
1105 + if((ieee->state == IEEE80211_LINKED) ||
1106 + (ieee->state == IEEE80211_LINKED_SCANNING))
1107 +- strcat(wrqu->name," linked");
1108 ++ strlcat(wrqu->name," link", IFNAMSIZ);
1109 + else if(ieee->state != IEEE80211_NOLINK)
1110 +- strcat(wrqu->name," link..");
1111 ++ strlcat(wrqu->name," .....", IFNAMSIZ);
1112 +
1113 +
1114 + return 0;
1115 +diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
1116 +index 3086090..ef03927 100644
1117 +--- a/drivers/usb/core/devio.c
1118 ++++ b/drivers/usb/core/devio.c
1119 +@@ -982,7 +982,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1120 + USBDEVFS_URB_ZERO_PACKET |
1121 + USBDEVFS_URB_NO_INTERRUPT))
1122 + return -EINVAL;
1123 +- if (!uurb->buffer)
1124 ++ if (uurb->buffer_length > 0 && !uurb->buffer)
1125 + return -EINVAL;
1126 + if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL &&
1127 + (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) {
1128 +@@ -1038,11 +1038,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1129 + is_in = 0;
1130 + uurb->endpoint &= ~USB_DIR_IN;
1131 + }
1132 +- if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
1133 +- uurb->buffer, uurb->buffer_length)) {
1134 +- kfree(dr);
1135 +- return -EFAULT;
1136 +- }
1137 + snoop(&ps->dev->dev, "control urb: bRequest=%02x "
1138 + "bRrequestType=%02x wValue=%04x "
1139 + "wIndex=%04x wLength=%04x\n",
1140 +@@ -1062,9 +1057,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1141 + uurb->number_of_packets = 0;
1142 + if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
1143 + return -EINVAL;
1144 +- if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
1145 +- uurb->buffer, uurb->buffer_length))
1146 +- return -EFAULT;
1147 + snoop(&ps->dev->dev, "bulk urb\n");
1148 + break;
1149 +
1150 +@@ -1106,28 +1098,35 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1151 + return -EINVAL;
1152 + if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
1153 + return -EINVAL;
1154 +- if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
1155 +- uurb->buffer, uurb->buffer_length))
1156 +- return -EFAULT;
1157 + snoop(&ps->dev->dev, "interrupt urb\n");
1158 + break;
1159 +
1160 + default:
1161 + return -EINVAL;
1162 + }
1163 +- as = alloc_async(uurb->number_of_packets);
1164 +- if (!as) {
1165 ++ if (uurb->buffer_length > 0 &&
1166 ++ !access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
1167 ++ uurb->buffer, uurb->buffer_length)) {
1168 + kfree(isopkt);
1169 + kfree(dr);
1170 +- return -ENOMEM;
1171 ++ return -EFAULT;
1172 + }
1173 +- as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL);
1174 +- if (!as->urb->transfer_buffer) {
1175 ++ as = alloc_async(uurb->number_of_packets);
1176 ++ if (!as) {
1177 + kfree(isopkt);
1178 + kfree(dr);
1179 +- free_async(as);
1180 + return -ENOMEM;
1181 + }
1182 ++ if (uurb->buffer_length > 0) {
1183 ++ as->urb->transfer_buffer = kmalloc(uurb->buffer_length,
1184 ++ GFP_KERNEL);
1185 ++ if (!as->urb->transfer_buffer) {
1186 ++ kfree(isopkt);
1187 ++ kfree(dr);
1188 ++ free_async(as);
1189 ++ return -ENOMEM;
1190 ++ }
1191 ++ }
1192 + as->urb->dev = ps->dev;
1193 + as->urb->pipe = (uurb->type << 30) |
1194 + __create_pipe(ps->dev, uurb->endpoint & 0xf) |
1195 +@@ -1169,7 +1168,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1196 + kfree(isopkt);
1197 + as->ps = ps;
1198 + as->userurb = arg;
1199 +- if (uurb->endpoint & USB_DIR_IN)
1200 ++ if (is_in && uurb->buffer_length > 0)
1201 + as->userbuffer = uurb->buffer;
1202 + else
1203 + as->userbuffer = NULL;
1204 +@@ -1179,9 +1178,9 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1205 + as->uid = cred->uid;
1206 + as->euid = cred->euid;
1207 + security_task_getsecid(current, &as->secid);
1208 +- if (!is_in) {
1209 ++ if (!is_in && uurb->buffer_length > 0) {
1210 + if (copy_from_user(as->urb->transfer_buffer, uurb->buffer,
1211 +- as->urb->transfer_buffer_length)) {
1212 ++ uurb->buffer_length)) {
1213 + free_async(as);
1214 + return -EFAULT;
1215 + }
1216 +@@ -1231,22 +1230,22 @@ static int processcompl(struct async *as, void __user * __user *arg)
1217 + if (as->userbuffer)
1218 + if (copy_to_user(as->userbuffer, urb->transfer_buffer,
1219 + urb->transfer_buffer_length))
1220 +- return -EFAULT;
1221 ++ goto err_out;
1222 + if (put_user(as->status, &userurb->status))
1223 +- return -EFAULT;
1224 ++ goto err_out;
1225 + if (put_user(urb->actual_length, &userurb->actual_length))
1226 +- return -EFAULT;
1227 ++ goto err_out;
1228 + if (put_user(urb->error_count, &userurb->error_count))
1229 +- return -EFAULT;
1230 ++ goto err_out;
1231 +
1232 + if (usb_endpoint_xfer_isoc(&urb->ep->desc)) {
1233 + for (i = 0; i < urb->number_of_packets; i++) {
1234 + if (put_user(urb->iso_frame_desc[i].actual_length,
1235 + &userurb->iso_frame_desc[i].actual_length))
1236 +- return -EFAULT;
1237 ++ goto err_out;
1238 + if (put_user(urb->iso_frame_desc[i].status,
1239 + &userurb->iso_frame_desc[i].status))
1240 +- return -EFAULT;
1241 ++ goto err_out;
1242 + }
1243 + }
1244 +
1245 +@@ -1255,6 +1254,10 @@ static int processcompl(struct async *as, void __user * __user *arg)
1246 + if (put_user(addr, (void __user * __user *)arg))
1247 + return -EFAULT;
1248 + return 0;
1249 ++
1250 ++err_out:
1251 ++ free_async(as);
1252 ++ return -EFAULT;
1253 + }
1254 +
1255 + static struct async *reap_as(struct dev_state *ps)
1256 +diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
1257 +index b626283..a94f184 100644
1258 +--- a/drivers/usb/core/message.c
1259 ++++ b/drivers/usb/core/message.c
1260 +@@ -758,6 +758,48 @@ static int usb_string_sub(struct usb_device *dev, unsigned int langid,
1261 + return rc;
1262 + }
1263 +
1264 ++static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf)
1265 ++{
1266 ++ int err;
1267 ++
1268 ++ if (dev->have_langid)
1269 ++ return 0;
1270 ++
1271 ++ if (dev->string_langid < 0)
1272 ++ return -EPIPE;
1273 ++
1274 ++ err = usb_string_sub(dev, 0, 0, tbuf);
1275 ++
1276 ++ /* If the string was reported but is malformed, default to english
1277 ++ * (0x0409) */
1278 ++ if (err == -ENODATA || (err > 0 && err < 4)) {
1279 ++ dev->string_langid = 0x0409;
1280 ++ dev->have_langid = 1;
1281 ++ dev_err(&dev->dev,
1282 ++ "string descriptor 0 malformed (err = %d), "
1283 ++ "defaulting to 0x%04x\n",
1284 ++ err, dev->string_langid);
1285 ++ return 0;
1286 ++ }
1287 ++
1288 ++ /* In case of all other errors, we assume the device is not able to
1289 ++ * deal with strings at all. Set string_langid to -1 in order to
1290 ++ * prevent any string to be retrieved from the device */
1291 ++ if (err < 0) {
1292 ++ dev_err(&dev->dev, "string descriptor 0 read error: %d\n",
1293 ++ err);
1294 ++ dev->string_langid = -1;
1295 ++ return -EPIPE;
1296 ++ }
1297 ++
1298 ++ /* always use the first langid listed */
1299 ++ dev->string_langid = tbuf[2] | (tbuf[3] << 8);
1300 ++ dev->have_langid = 1;
1301 ++ dev_dbg(&dev->dev, "default language 0x%04x\n",
1302 ++ dev->string_langid);
1303 ++ return 0;
1304 ++}
1305 ++
1306 + /**
1307 + * usb_string - returns ISO 8859-1 version of a string descriptor
1308 + * @dev: the device whose string descriptor is being retrieved
1309 +@@ -797,24 +839,9 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
1310 + if (!tbuf)
1311 + return -ENOMEM;
1312 +
1313 +- /* get langid for strings if it's not yet known */
1314 +- if (!dev->have_langid) {
1315 +- err = usb_string_sub(dev, 0, 0, tbuf);
1316 +- if (err < 0) {
1317 +- dev_err(&dev->dev,
1318 +- "string descriptor 0 read error: %d\n",
1319 +- err);
1320 +- } else if (err < 4) {
1321 +- dev_err(&dev->dev, "string descriptor 0 too short\n");
1322 +- } else {
1323 +- dev->string_langid = tbuf[2] | (tbuf[3] << 8);
1324 +- /* always use the first langid listed */
1325 +- dev_dbg(&dev->dev, "default language 0x%04x\n",
1326 +- dev->string_langid);
1327 +- }
1328 +-
1329 +- dev->have_langid = 1;
1330 +- }
1331 ++ err = usb_get_langid(dev, tbuf);
1332 ++ if (err < 0)
1333 ++ goto errout;
1334 +
1335 + err = usb_string_sub(dev, dev->string_langid, index, tbuf);
1336 + if (err < 0)
1337 +diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
1338 +index d006dc6..bd102f5 100644
1339 +--- a/drivers/usb/gadget/ether.c
1340 ++++ b/drivers/usb/gadget/ether.c
1341 +@@ -293,15 +293,16 @@ static int __init eth_bind(struct usb_composite_dev *cdev)
1342 + /* CDC Subset */
1343 + eth_config_driver.label = "CDC Subset/SAFE";
1344 +
1345 +- device_desc.idVendor = cpu_to_le16(SIMPLE_VENDOR_NUM),
1346 +- device_desc.idProduct = cpu_to_le16(SIMPLE_PRODUCT_NUM),
1347 +- device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC;
1348 ++ device_desc.idVendor = cpu_to_le16(SIMPLE_VENDOR_NUM);
1349 ++ device_desc.idProduct = cpu_to_le16(SIMPLE_PRODUCT_NUM);
1350 ++ if (!has_rndis())
1351 ++ device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC;
1352 + }
1353 +
1354 + if (has_rndis()) {
1355 + /* RNDIS plus ECM-or-Subset */
1356 +- device_desc.idVendor = cpu_to_le16(RNDIS_VENDOR_NUM),
1357 +- device_desc.idProduct = cpu_to_le16(RNDIS_PRODUCT_NUM),
1358 ++ device_desc.idVendor = cpu_to_le16(RNDIS_VENDOR_NUM);
1359 ++ device_desc.idProduct = cpu_to_le16(RNDIS_PRODUCT_NUM);
1360 + device_desc.bNumConfigurations = 2;
1361 + }
1362 +
1363 +diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
1364 +index 556d0ec..a01201a 100644
1365 +--- a/drivers/usb/host/ehci-sched.c
1366 ++++ b/drivers/usb/host/ehci-sched.c
1367 +@@ -1617,11 +1617,14 @@ itd_complete (
1368 + desc->status = -EPROTO;
1369 +
1370 + /* HC need not update length with this error */
1371 +- if (!(t & EHCI_ISOC_BABBLE))
1372 +- desc->actual_length = EHCI_ITD_LENGTH (t);
1373 ++ if (!(t & EHCI_ISOC_BABBLE)) {
1374 ++ desc->actual_length = EHCI_ITD_LENGTH(t);
1375 ++ urb->actual_length += desc->actual_length;
1376 ++ }
1377 + } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) {
1378 + desc->status = 0;
1379 +- desc->actual_length = EHCI_ITD_LENGTH (t);
1380 ++ desc->actual_length = EHCI_ITD_LENGTH(t);
1381 ++ urb->actual_length += desc->actual_length;
1382 + } else {
1383 + /* URB was too late */
1384 + desc->status = -EXDEV;
1385 +@@ -2012,7 +2015,8 @@ sitd_complete (
1386 + desc->status = -EPROTO;
1387 + } else {
1388 + desc->status = 0;
1389 +- desc->actual_length = desc->length - SITD_LENGTH (t);
1390 ++ desc->actual_length = desc->length - SITD_LENGTH(t);
1391 ++ urb->actual_length += desc->actual_length;
1392 + }
1393 + stream->depth -= stream->interval << 3;
1394 +
1395 +diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
1396 +index ef5f756..1b28cae 100644
1397 +--- a/drivers/usb/serial/ti_usb_3410_5052.c
1398 ++++ b/drivers/usb/serial/ti_usb_3410_5052.c
1399 +@@ -192,7 +192,6 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
1400 + { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) },
1401 + { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) },
1402 + { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
1403 +- { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
1404 + };
1405 +
1406 + static struct usb_device_id ti_id_table_combined[14+2*TI_EXTRA_VID_PID_COUNT+1] = {
1407 +@@ -1660,7 +1659,7 @@ static int ti_do_download(struct usb_device *dev, int pipe,
1408 + u8 cs = 0;
1409 + int done;
1410 + struct ti_firmware_header *header;
1411 +- int status;
1412 ++ int status = 0;
1413 + int len;
1414 +
1415 + for (pos = sizeof(struct ti_firmware_header); pos < size; pos++)
1416 +diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
1417 +index 40381df..605b17a 100644
1418 +--- a/fs/binfmt_elf.c
1419 ++++ b/fs/binfmt_elf.c
1420 +@@ -1518,11 +1518,11 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
1421 + info->thread = NULL;
1422 +
1423 + psinfo = kmalloc(sizeof(*psinfo), GFP_KERNEL);
1424 +- fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo);
1425 +-
1426 + if (psinfo == NULL)
1427 + return 0;
1428 +
1429 ++ fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo);
1430 ++
1431 + /*
1432 + * Figure out how many notes we're going to need for each thread.
1433 + */
1434 +diff --git a/fs/bio.c b/fs/bio.c
1435 +index 9871164..78b0509 100644
1436 +--- a/fs/bio.c
1437 ++++ b/fs/bio.c
1438 +@@ -706,14 +706,13 @@ static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count,
1439 + }
1440 +
1441 + static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs,
1442 +- struct sg_iovec *iov, int iov_count, int uncopy,
1443 +- int do_free_page)
1444 ++ struct sg_iovec *iov, int iov_count,
1445 ++ int to_user, int from_user, int do_free_page)
1446 + {
1447 + int ret = 0, i;
1448 + struct bio_vec *bvec;
1449 + int iov_idx = 0;
1450 + unsigned int iov_off = 0;
1451 +- int read = bio_data_dir(bio) == READ;
1452 +
1453 + __bio_for_each_segment(bvec, bio, i, 0) {
1454 + char *bv_addr = page_address(bvec->bv_page);
1455 +@@ -728,13 +727,14 @@ static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs,
1456 + iov_addr = iov[iov_idx].iov_base + iov_off;
1457 +
1458 + if (!ret) {
1459 +- if (!read && !uncopy)
1460 +- ret = copy_from_user(bv_addr, iov_addr,
1461 +- bytes);
1462 +- if (read && uncopy)
1463 ++ if (to_user)
1464 + ret = copy_to_user(iov_addr, bv_addr,
1465 + bytes);
1466 +
1467 ++ if (from_user)
1468 ++ ret = copy_from_user(bv_addr, iov_addr,
1469 ++ bytes);
1470 ++
1471 + if (ret)
1472 + ret = -EFAULT;
1473 + }
1474 +@@ -771,7 +771,8 @@ int bio_uncopy_user(struct bio *bio)
1475 +
1476 + if (!bio_flagged(bio, BIO_NULL_MAPPED))
1477 + ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs,
1478 +- bmd->nr_sgvecs, 1, bmd->is_our_pages);
1479 ++ bmd->nr_sgvecs, bio_data_dir(bio) == READ,
1480 ++ 0, bmd->is_our_pages);
1481 + bio_free_map_data(bmd);
1482 + bio_put(bio);
1483 + return ret;
1484 +@@ -876,8 +877,9 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
1485 + /*
1486 + * success
1487 + */
1488 +- if (!write_to_vm && (!map_data || !map_data->null_mapped)) {
1489 +- ret = __bio_copy_iov(bio, bio->bi_io_vec, iov, iov_count, 0, 0);
1490 ++ if ((!write_to_vm && (!map_data || !map_data->null_mapped)) ||
1491 ++ (map_data && map_data->from_user)) {
1492 ++ ret = __bio_copy_iov(bio, bio->bi_io_vec, iov, iov_count, 0, 1, 0);
1493 + if (ret)
1494 + goto cleanup;
1495 + }
1496 +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
1497 +index 4aa81a5..1dc14f2 100644
1498 +--- a/fs/cifs/connect.c
1499 ++++ b/fs/cifs/connect.c
1500 +@@ -2745,6 +2745,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
1501 + strncpy(tcon->treeName, tree, MAX_TREE_SIZE);
1502 +
1503 + /* mostly informational -- no need to fail on error here */
1504 ++ kfree(tcon->nativeFileSystem);
1505 + tcon->nativeFileSystem = cifs_strndup_from_ucs(bcc_ptr,
1506 + bytes_left, is_unicode,
1507 + nls_codepage);
1508 +diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
1509 +index 3758965..83440ca 100644
1510 +--- a/fs/cifs/dir.c
1511 ++++ b/fs/cifs/dir.c
1512 +@@ -641,6 +641,15 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
1513 + }
1514 + }
1515 +
1516 ++ /*
1517 ++ * O_EXCL: optimize away the lookup, but don't hash the dentry. Let
1518 ++ * the VFS handle the create.
1519 ++ */
1520 ++ if (nd->flags & LOOKUP_EXCL) {
1521 ++ d_instantiate(direntry, NULL);
1522 ++ return 0;
1523 ++ }
1524 ++
1525 + /* can not grab the rename sem here since it would
1526 + deadlock in the cases (beginning of sys_rename itself)
1527 + in which we already have the sb rename sem */
1528 +diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
1529 +index af737bb..259525c 100644
1530 +--- a/fs/ecryptfs/keystore.c
1531 ++++ b/fs/ecryptfs/keystore.c
1532 +@@ -1303,6 +1303,13 @@ parse_tag_3_packet(struct ecryptfs_crypt_stat *crypt_stat,
1533 + }
1534 + (*new_auth_tok)->session_key.encrypted_key_size =
1535 + (body_size - (ECRYPTFS_SALT_SIZE + 5));
1536 ++ if ((*new_auth_tok)->session_key.encrypted_key_size
1537 ++ > ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES) {
1538 ++ printk(KERN_WARNING "Tag 3 packet contains key larger "
1539 ++ "than ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES\n");
1540 ++ rc = -EINVAL;
1541 ++ goto out_free;
1542 ++ }
1543 + if (unlikely(data[(*packet_size)++] != 0x04)) {
1544 + printk(KERN_WARNING "Unknown version number [%d]\n",
1545 + data[(*packet_size) - 1]);
1546 +@@ -1449,6 +1456,12 @@ parse_tag_11_packet(unsigned char *data, unsigned char *contents,
1547 + rc = -EINVAL;
1548 + goto out;
1549 + }
1550 ++ if (unlikely((*tag_11_contents_size) > max_contents_bytes)) {
1551 ++ printk(KERN_ERR "Literal data section in tag 11 packet exceeds "
1552 ++ "expected size\n");
1553 ++ rc = -EINVAL;
1554 ++ goto out;
1555 ++ }
1556 + if (data[(*packet_size)++] != 0x62) {
1557 + printk(KERN_WARNING "Unrecognizable packet\n");
1558 + rc = -EINVAL;
1559 +diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
1560 +index b660435..7843755 100644
1561 +--- a/fs/nfsd/vfs.c
1562 ++++ b/fs/nfsd/vfs.c
1563 +@@ -677,7 +677,6 @@ __be32
1564 + nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
1565 + int access, struct file **filp)
1566 + {
1567 +- const struct cred *cred = current_cred();
1568 + struct dentry *dentry;
1569 + struct inode *inode;
1570 + int flags = O_RDONLY|O_LARGEFILE;
1571 +@@ -732,7 +731,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
1572 + vfs_dq_init(inode);
1573 + }
1574 + *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_path.mnt),
1575 +- flags, cred);
1576 ++ flags, current_cred());
1577 + if (IS_ERR(*filp))
1578 + host_err = PTR_ERR(*filp);
1579 + out_nfserr:
1580 +diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c
1581 +index 300f1cd..2d81a4d 100644
1582 +--- a/fs/nilfs2/cpfile.c
1583 ++++ b/fs/nilfs2/cpfile.c
1584 +@@ -311,7 +311,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
1585 + ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh);
1586 + if (ret < 0) {
1587 + if (ret != -ENOENT)
1588 +- goto out_header;
1589 ++ break;
1590 + /* skip hole */
1591 + ret = 0;
1592 + continue;
1593 +@@ -344,7 +344,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
1594 + continue;
1595 + printk(KERN_ERR "%s: cannot delete block\n",
1596 + __func__);
1597 +- goto out_header;
1598 ++ break;
1599 + }
1600 + }
1601 +
1602 +@@ -362,7 +362,6 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
1603 + kunmap_atomic(kaddr, KM_USER0);
1604 + }
1605 +
1606 +- out_header:
1607 + brelse(header_bh);
1608 +
1609 + out_sem:
1610 +diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c
1611 +index bb8a581..e2646c3 100644
1612 +--- a/fs/nilfs2/dat.c
1613 ++++ b/fs/nilfs2/dat.c
1614 +@@ -149,15 +149,6 @@ void nilfs_dat_commit_start(struct inode *dat, struct nilfs_palloc_req *req,
1615 + entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
1616 + req->pr_entry_bh, kaddr);
1617 + entry->de_start = cpu_to_le64(nilfs_mdt_cno(dat));
1618 +- if (entry->de_blocknr != cpu_to_le64(0) ||
1619 +- entry->de_end != cpu_to_le64(NILFS_CNO_MAX)) {
1620 +- printk(KERN_CRIT
1621 +- "%s: vbn = %llu, start = %llu, end = %llu, pbn = %llu\n",
1622 +- __func__, (unsigned long long)req->pr_entry_nr,
1623 +- (unsigned long long)le64_to_cpu(entry->de_start),
1624 +- (unsigned long long)le64_to_cpu(entry->de_end),
1625 +- (unsigned long long)le64_to_cpu(entry->de_blocknr));
1626 +- }
1627 + entry->de_blocknr = cpu_to_le64(blocknr);
1628 + kunmap_atomic(kaddr, KM_USER0);
1629 +
1630 +diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
1631 +index 22c7f65..1779ddc 100644
1632 +--- a/fs/nilfs2/segment.c
1633 ++++ b/fs/nilfs2/segment.c
1634 +@@ -1846,26 +1846,13 @@ static int nilfs_segctor_write(struct nilfs_sc_info *sci,
1635 + err = nilfs_segbuf_write(segbuf, &wi);
1636 +
1637 + res = nilfs_segbuf_wait(segbuf, &wi);
1638 +- err = unlikely(err) ? : res;
1639 +- if (unlikely(err))
1640 ++ err = err ? : res;
1641 ++ if (err)
1642 + return err;
1643 + }
1644 + return 0;
1645 + }
1646 +
1647 +-static int nilfs_page_has_uncleared_buffer(struct page *page)
1648 +-{
1649 +- struct buffer_head *head, *bh;
1650 +-
1651 +- head = bh = page_buffers(page);
1652 +- do {
1653 +- if (buffer_dirty(bh) && !list_empty(&bh->b_assoc_buffers))
1654 +- return 1;
1655 +- bh = bh->b_this_page;
1656 +- } while (bh != head);
1657 +- return 0;
1658 +-}
1659 +-
1660 + static void __nilfs_end_page_io(struct page *page, int err)
1661 + {
1662 + if (!err) {
1663 +@@ -1889,12 +1876,11 @@ static void nilfs_end_page_io(struct page *page, int err)
1664 + if (!page)
1665 + return;
1666 +
1667 +- if (buffer_nilfs_node(page_buffers(page)) &&
1668 +- nilfs_page_has_uncleared_buffer(page))
1669 +- /* For b-tree node pages, this function may be called twice
1670 +- or more because they might be split in a segment.
1671 +- This check assures that cleanup has been done for all
1672 +- buffers in a split btnode page. */
1673 ++ if (buffer_nilfs_node(page_buffers(page)) && !PageWriteback(page))
1674 ++ /*
1675 ++ * For b-tree node pages, this function may be called twice
1676 ++ * or more because they might be split in a segment.
1677 ++ */
1678 + return;
1679 +
1680 + __nilfs_end_page_io(page, err);
1681 +@@ -1957,7 +1943,7 @@ static void nilfs_segctor_abort_write(struct nilfs_sc_info *sci,
1682 + }
1683 + if (bh->b_page != fs_page) {
1684 + nilfs_end_page_io(fs_page, err);
1685 +- if (unlikely(fs_page == failed_page))
1686 ++ if (fs_page && fs_page == failed_page)
1687 + goto done;
1688 + fs_page = bh->b_page;
1689 + }
1690 +diff --git a/fs/partitions/check.c b/fs/partitions/check.c
1691 +index 99e33ef..763c9e2 100644
1692 +--- a/fs/partitions/check.c
1693 ++++ b/fs/partitions/check.c
1694 +@@ -426,7 +426,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
1695 + rcu_assign_pointer(ptbl->part[partno], p);
1696 +
1697 + /* suppress uevent if the disk supresses it */
1698 +- if (!dev_get_uevent_suppress(pdev))
1699 ++ if (!dev_get_uevent_suppress(ddev))
1700 + kobject_uevent(&pdev->kobj, KOBJ_ADD);
1701 +
1702 + return p;
1703 +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
1704 +index b4f71f1..e590df0 100644
1705 +--- a/include/linux/blkdev.h
1706 ++++ b/include/linux/blkdev.h
1707 +@@ -723,6 +723,7 @@ struct rq_map_data {
1708 + int nr_entries;
1709 + unsigned long offset;
1710 + int null_mapped;
1711 ++ int from_user;
1712 + };
1713 +
1714 + struct req_iterator {
1715 +diff --git a/include/linux/sched.h b/include/linux/sched.h
1716 +index b4c38bc..03c6c36 100644
1717 +--- a/include/linux/sched.h
1718 ++++ b/include/linux/sched.h
1719 +@@ -206,7 +206,7 @@ extern unsigned long long time_sync_thresh;
1720 + ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
1721 + #define task_contributes_to_load(task) \
1722 + ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \
1723 +- (task->flags & PF_FROZEN) == 0)
1724 ++ (task->flags & PF_FREEZING) == 0)
1725 +
1726 + #define __set_task_state(tsk, state_value) \
1727 + do { (tsk)->state = (state_value); } while (0)
1728 +@@ -1630,6 +1630,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1729 + #define PF_MEMALLOC 0x00000800 /* Allocating memory */
1730 + #define PF_FLUSHER 0x00001000 /* responsible for disk writeback */
1731 + #define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */
1732 ++#define PF_FREEZING 0x00004000 /* freeze in progress. do not account to load */
1733 + #define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */
1734 + #define PF_FROZEN 0x00010000 /* frozen for system suspend */
1735 + #define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
1736 +diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
1737 +index 6c3f964..5d9a848 100644
1738 +--- a/include/net/netfilter/nf_conntrack.h
1739 ++++ b/include/net/netfilter/nf_conntrack.h
1740 +@@ -255,8 +255,8 @@ static inline bool nf_ct_kill(struct nf_conn *ct)
1741 + /* Update TCP window tracking data when NAT mangles the packet */
1742 + extern void nf_conntrack_tcp_update(const struct sk_buff *skb,
1743 + unsigned int dataoff,
1744 +- struct nf_conn *ct,
1745 +- int dir);
1746 ++ struct nf_conn *ct, int dir,
1747 ++ s16 offset);
1748 +
1749 + /* Fake conntrack entry for untracked connections */
1750 + extern struct nf_conn nf_conntrack_untracked;
1751 +diff --git a/kernel/freezer.c b/kernel/freezer.c
1752 +index 2f4936c..bd1d42b 100644
1753 +--- a/kernel/freezer.c
1754 ++++ b/kernel/freezer.c
1755 +@@ -44,12 +44,19 @@ void refrigerator(void)
1756 + recalc_sigpending(); /* We sent fake signal, clean it up */
1757 + spin_unlock_irq(&current->sighand->siglock);
1758 +
1759 ++ /* prevent accounting of that task to load */
1760 ++ current->flags |= PF_FREEZING;
1761 ++
1762 + for (;;) {
1763 + set_current_state(TASK_UNINTERRUPTIBLE);
1764 + if (!frozen(current))
1765 + break;
1766 + schedule();
1767 + }
1768 ++
1769 ++ /* Remove the accounting blocker */
1770 ++ current->flags &= ~PF_FREEZING;
1771 ++
1772 + pr_debug("%s left refrigerator\n", current->comm);
1773 + __set_current_state(save);
1774 + }
1775 +diff --git a/kernel/sched.c b/kernel/sched.c
1776 +index 26efa47..0d3d47f 100644
1777 +--- a/kernel/sched.c
1778 ++++ b/kernel/sched.c
1779 +@@ -497,6 +497,7 @@ struct rt_rq {
1780 + #endif
1781 + #ifdef CONFIG_SMP
1782 + unsigned long rt_nr_migratory;
1783 ++ unsigned long rt_nr_total;
1784 + int overloaded;
1785 + struct plist_head pushable_tasks;
1786 + #endif
1787 +diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
1788 +index 9bf0d2a..3918e01 100644
1789 +--- a/kernel/sched_rt.c
1790 ++++ b/kernel/sched_rt.c
1791 +@@ -10,6 +10,8 @@ static inline struct task_struct *rt_task_of(struct sched_rt_entity *rt_se)
1792 +
1793 + #ifdef CONFIG_RT_GROUP_SCHED
1794 +
1795 ++#define rt_entity_is_task(rt_se) (!(rt_se)->my_q)
1796 ++
1797 + static inline struct rq *rq_of_rt_rq(struct rt_rq *rt_rq)
1798 + {
1799 + return rt_rq->rq;
1800 +@@ -22,6 +24,8 @@ static inline struct rt_rq *rt_rq_of_se(struct sched_rt_entity *rt_se)
1801 +
1802 + #else /* CONFIG_RT_GROUP_SCHED */
1803 +
1804 ++#define rt_entity_is_task(rt_se) (1)
1805 ++
1806 + static inline struct rq *rq_of_rt_rq(struct rt_rq *rt_rq)
1807 + {
1808 + return container_of(rt_rq, struct rq, rt);
1809 +@@ -73,7 +77,7 @@ static inline void rt_clear_overload(struct rq *rq)
1810 +
1811 + static void update_rt_migration(struct rt_rq *rt_rq)
1812 + {
1813 +- if (rt_rq->rt_nr_migratory && (rt_rq->rt_nr_running > 1)) {
1814 ++ if (rt_rq->rt_nr_migratory && rt_rq->rt_nr_total > 1) {
1815 + if (!rt_rq->overloaded) {
1816 + rt_set_overload(rq_of_rt_rq(rt_rq));
1817 + rt_rq->overloaded = 1;
1818 +@@ -86,6 +90,12 @@ static void update_rt_migration(struct rt_rq *rt_rq)
1819 +
1820 + static void inc_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
1821 + {
1822 ++ if (!rt_entity_is_task(rt_se))
1823 ++ return;
1824 ++
1825 ++ rt_rq = &rq_of_rt_rq(rt_rq)->rt;
1826 ++
1827 ++ rt_rq->rt_nr_total++;
1828 + if (rt_se->nr_cpus_allowed > 1)
1829 + rt_rq->rt_nr_migratory++;
1830 +
1831 +@@ -94,6 +104,12 @@ static void inc_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
1832 +
1833 + static void dec_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
1834 + {
1835 ++ if (!rt_entity_is_task(rt_se))
1836 ++ return;
1837 ++
1838 ++ rt_rq = &rq_of_rt_rq(rt_rq)->rt;
1839 ++
1840 ++ rt_rq->rt_nr_total--;
1841 + if (rt_se->nr_cpus_allowed > 1)
1842 + rt_rq->rt_nr_migratory--;
1843 +
1844 +diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
1845 +index 90f1347..01e5c43 100644
1846 +--- a/kernel/trace/trace_functions.c
1847 ++++ b/kernel/trace/trace_functions.c
1848 +@@ -364,7 +364,7 @@ ftrace_trace_onoff_callback(char *glob, char *cmd, char *param, int enable)
1849 + out_reg:
1850 + ret = register_ftrace_function_probe(glob, ops, count);
1851 +
1852 +- return ret;
1853 ++ return ret < 0 ? ret : 0;
1854 + }
1855 +
1856 + static struct ftrace_func_command ftrace_traceon_cmd = {
1857 +diff --git a/mm/filemap.c b/mm/filemap.c
1858 +index 1b60f30..0b20d1f 100644
1859 +--- a/mm/filemap.c
1860 ++++ b/mm/filemap.c
1861 +@@ -2249,6 +2249,7 @@ again:
1862 + pagefault_enable();
1863 + flush_dcache_page(page);
1864 +
1865 ++ mark_page_accessed(page);
1866 + status = a_ops->write_end(file, mapping, pos, bytes, copied,
1867 + page, fsdata);
1868 + if (unlikely(status < 0))
1869 +diff --git a/mm/internal.h b/mm/internal.h
1870 +index 987bb03..090c267 100644
1871 +--- a/mm/internal.h
1872 ++++ b/mm/internal.h
1873 +@@ -284,4 +284,8 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1874 + unsigned long start, int len, int flags,
1875 + struct page **pages, struct vm_area_struct **vmas);
1876 +
1877 ++#define ZONE_RECLAIM_NOSCAN -2
1878 ++#define ZONE_RECLAIM_FULL -1
1879 ++#define ZONE_RECLAIM_SOME 0
1880 ++#define ZONE_RECLAIM_SUCCESS 1
1881 + #endif
1882 +diff --git a/mm/nommu.c b/mm/nommu.c
1883 +index b571ef7..2fd2ad5 100644
1884 +--- a/mm/nommu.c
1885 ++++ b/mm/nommu.c
1886 +@@ -69,6 +69,9 @@ int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT;
1887 + int sysctl_nr_trim_pages = CONFIG_NOMMU_INITIAL_TRIM_EXCESS;
1888 + int heap_stack_gap = 0;
1889 +
1890 ++/* amount of vm to protect from userspace access */
1891 ++unsigned long mmap_min_addr = CONFIG_DEFAULT_MMAP_MIN_ADDR;
1892 ++
1893 + atomic_long_t mmap_pages_allocated;
1894 +
1895 + EXPORT_SYMBOL(mem_map);
1896 +diff --git a/mm/page_alloc.c b/mm/page_alloc.c
1897 +index f820383..480907c 100644
1898 +--- a/mm/page_alloc.c
1899 ++++ b/mm/page_alloc.c
1900 +@@ -1420,20 +1420,38 @@ zonelist_scan:
1901 +
1902 + if (!(alloc_flags & ALLOC_NO_WATERMARKS)) {
1903 + unsigned long mark;
1904 ++ int ret;
1905 + if (alloc_flags & ALLOC_WMARK_MIN)
1906 + mark = zone->pages_min;
1907 + else if (alloc_flags & ALLOC_WMARK_LOW)
1908 + mark = zone->pages_low;
1909 + else
1910 + mark = zone->pages_high;
1911 +- if (!zone_watermark_ok(zone, order, mark,
1912 +- classzone_idx, alloc_flags)) {
1913 +- if (!zone_reclaim_mode ||
1914 +- !zone_reclaim(zone, gfp_mask, order))
1915 ++
1916 ++ if (zone_watermark_ok(zone, order, mark,
1917 ++ classzone_idx, alloc_flags))
1918 ++ goto try_this_zone;
1919 ++
1920 ++ if (zone_reclaim_mode == 0)
1921 ++ goto this_zone_full;
1922 ++
1923 ++ ret = zone_reclaim(zone, gfp_mask, order);
1924 ++ switch (ret) {
1925 ++ case ZONE_RECLAIM_NOSCAN:
1926 ++ /* did not scan */
1927 ++ goto try_next_zone;
1928 ++ case ZONE_RECLAIM_FULL:
1929 ++ /* scanned but unreclaimable */
1930 ++ goto this_zone_full;
1931 ++ default:
1932 ++ /* did we reclaim enough */
1933 ++ if (!zone_watermark_ok(zone, order, mark,
1934 ++ classzone_idx, alloc_flags))
1935 + goto this_zone_full;
1936 + }
1937 + }
1938 +
1939 ++try_this_zone:
1940 + page = buffered_rmqueue(preferred_zone, zone, order, gfp_mask);
1941 + if (page)
1942 + break;
1943 +diff --git a/mm/slab.c b/mm/slab.c
1944 +index 9a90b00..021d69f 100644
1945 +--- a/mm/slab.c
1946 ++++ b/mm/slab.c
1947 +@@ -2592,7 +2592,7 @@ void kmem_cache_destroy(struct kmem_cache *cachep)
1948 + }
1949 +
1950 + if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU))
1951 +- synchronize_rcu();
1952 ++ rcu_barrier();
1953 +
1954 + __kmem_cache_destroy(cachep);
1955 + mutex_unlock(&cache_chain_mutex);
1956 +diff --git a/mm/slob.c b/mm/slob.c
1957 +index f92e66d..c80d982 100644
1958 +--- a/mm/slob.c
1959 ++++ b/mm/slob.c
1960 +@@ -590,6 +590,8 @@ EXPORT_SYMBOL(kmem_cache_create);
1961 +
1962 + void kmem_cache_destroy(struct kmem_cache *c)
1963 + {
1964 ++ if (c->flags & SLAB_DESTROY_BY_RCU)
1965 ++ rcu_barrier();
1966 + slob_free(c, sizeof(struct kmem_cache));
1967 + }
1968 + EXPORT_SYMBOL(kmem_cache_destroy);
1969 +diff --git a/mm/slub.c b/mm/slub.c
1970 +index 65ffda5..253016d 100644
1971 +--- a/mm/slub.c
1972 ++++ b/mm/slub.c
1973 +@@ -2490,6 +2490,8 @@ static inline int kmem_cache_close(struct kmem_cache *s)
1974 + */
1975 + void kmem_cache_destroy(struct kmem_cache *s)
1976 + {
1977 ++ if (s->flags & SLAB_DESTROY_BY_RCU)
1978 ++ rcu_barrier();
1979 + down_write(&slub_lock);
1980 + s->refcount--;
1981 + if (!s->refcount) {
1982 +diff --git a/mm/vmscan.c b/mm/vmscan.c
1983 +index 2500b01..b3e39b5 100644
1984 +--- a/mm/vmscan.c
1985 ++++ b/mm/vmscan.c
1986 +@@ -2426,16 +2426,16 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
1987 + */
1988 + if (zone_pagecache_reclaimable(zone) <= zone->min_unmapped_pages &&
1989 + zone_page_state(zone, NR_SLAB_RECLAIMABLE) <= zone->min_slab_pages)
1990 +- return 0;
1991 ++ return ZONE_RECLAIM_FULL;
1992 +
1993 + if (zone_is_all_unreclaimable(zone))
1994 +- return 0;
1995 ++ return ZONE_RECLAIM_FULL;
1996 +
1997 + /*
1998 + * Do not scan if the allocation should not be delayed.
1999 + */
2000 + if (!(gfp_mask & __GFP_WAIT) || (current->flags & PF_MEMALLOC))
2001 +- return 0;
2002 ++ return ZONE_RECLAIM_NOSCAN;
2003 +
2004 + /*
2005 + * Only run zone reclaim on the local zone or on zones that do not
2006 +@@ -2445,10 +2445,11 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
2007 + */
2008 + node_id = zone_to_nid(zone);
2009 + if (node_state(node_id, N_CPU) && node_id != numa_node_id())
2010 +- return 0;
2011 ++ return ZONE_RECLAIM_NOSCAN;
2012 +
2013 + if (zone_test_and_set_flag(zone, ZONE_RECLAIM_LOCKED))
2014 +- return 0;
2015 ++ return ZONE_RECLAIM_NOSCAN;
2016 ++
2017 + ret = __zone_reclaim(zone, gfp_mask, order);
2018 + zone_clear_flag(zone, ZONE_RECLAIM_LOCKED);
2019 +
2020 +diff --git a/net/dsa/mv88e6xxx.c b/net/dsa/mv88e6xxx.c
2021 +index 4e4d8b5..efe661a 100644
2022 +--- a/net/dsa/mv88e6xxx.c
2023 ++++ b/net/dsa/mv88e6xxx.c
2024 +@@ -418,7 +418,7 @@ static int mv88e6xxx_stats_wait(struct dsa_switch *ds)
2025 + int i;
2026 +
2027 + for (i = 0; i < 10; i++) {
2028 +- ret = REG_READ(REG_GLOBAL2, 0x1d);
2029 ++ ret = REG_READ(REG_GLOBAL, 0x1d);
2030 + if ((ret & 0x8000) == 0)
2031 + return 0;
2032 + }
2033 +diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c
2034 +index cf7a42b..05ede41 100644
2035 +--- a/net/ipv4/netfilter/nf_nat_helper.c
2036 ++++ b/net/ipv4/netfilter/nf_nat_helper.c
2037 +@@ -191,7 +191,8 @@ nf_nat_mangle_tcp_packet(struct sk_buff *skb,
2038 + ct, ctinfo);
2039 + /* Tell TCP window tracking about seq change */
2040 + nf_conntrack_tcp_update(skb, ip_hdrlen(skb),
2041 +- ct, CTINFO2DIR(ctinfo));
2042 ++ ct, CTINFO2DIR(ctinfo),
2043 ++ (int)rep_len - (int)match_len);
2044 +
2045 + nf_conntrack_event_cache(IPCT_NATSEQADJ, ct);
2046 + }
2047 +@@ -377,6 +378,7 @@ nf_nat_seq_adjust(struct sk_buff *skb,
2048 + struct tcphdr *tcph;
2049 + int dir;
2050 + __be32 newseq, newack;
2051 ++ s16 seqoff, ackoff;
2052 + struct nf_conn_nat *nat = nfct_nat(ct);
2053 + struct nf_nat_seq *this_way, *other_way;
2054 +
2055 +@@ -390,15 +392,18 @@ nf_nat_seq_adjust(struct sk_buff *skb,
2056 +
2057 + tcph = (void *)skb->data + ip_hdrlen(skb);
2058 + if (after(ntohl(tcph->seq), this_way->correction_pos))
2059 +- newseq = htonl(ntohl(tcph->seq) + this_way->offset_after);
2060 ++ seqoff = this_way->offset_after;
2061 + else
2062 +- newseq = htonl(ntohl(tcph->seq) + this_way->offset_before);
2063 ++ seqoff = this_way->offset_before;
2064 +
2065 + if (after(ntohl(tcph->ack_seq) - other_way->offset_before,
2066 + other_way->correction_pos))
2067 +- newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_after);
2068 ++ ackoff = other_way->offset_after;
2069 + else
2070 +- newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_before);
2071 ++ ackoff = other_way->offset_before;
2072 ++
2073 ++ newseq = htonl(ntohl(tcph->seq) + seqoff);
2074 ++ newack = htonl(ntohl(tcph->ack_seq) - ackoff);
2075 +
2076 + inet_proto_csum_replace4(&tcph->check, skb, tcph->seq, newseq, 0);
2077 + inet_proto_csum_replace4(&tcph->check, skb, tcph->ack_seq, newack, 0);
2078 +@@ -413,7 +418,7 @@ nf_nat_seq_adjust(struct sk_buff *skb,
2079 + if (!nf_nat_sack_adjust(skb, tcph, ct, ctinfo))
2080 + return 0;
2081 +
2082 +- nf_conntrack_tcp_update(skb, ip_hdrlen(skb), ct, dir);
2083 ++ nf_conntrack_tcp_update(skb, ip_hdrlen(skb), ct, dir, seqoff);
2084 +
2085 + return 1;
2086 + }
2087 +diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
2088 +index 8020db6..0d961ee 100644
2089 +--- a/net/netfilter/nf_conntrack_core.c
2090 ++++ b/net/netfilter/nf_conntrack_core.c
2091 +@@ -295,7 +295,8 @@ begin:
2092 + h = __nf_conntrack_find(net, tuple);
2093 + if (h) {
2094 + ct = nf_ct_tuplehash_to_ctrack(h);
2095 +- if (unlikely(!atomic_inc_not_zero(&ct->ct_general.use)))
2096 ++ if (unlikely(nf_ct_is_dying(ct) ||
2097 ++ !atomic_inc_not_zero(&ct->ct_general.use)))
2098 + h = NULL;
2099 + else {
2100 + if (unlikely(!nf_ct_tuple_equal(tuple, &h->tuple))) {
2101 +@@ -385,7 +386,6 @@ __nf_conntrack_confirm(struct sk_buff *skb)
2102 + /* Remove from unconfirmed list */
2103 + hlist_nulls_del_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode);
2104 +
2105 +- __nf_conntrack_hash_insert(ct, hash, repl_hash);
2106 + /* Timer relative to confirmation time, not original
2107 + setting time, otherwise we'd get timer wrap in
2108 + weird delay cases. */
2109 +@@ -393,8 +393,16 @@ __nf_conntrack_confirm(struct sk_buff *skb)
2110 + add_timer(&ct->timeout);
2111 + atomic_inc(&ct->ct_general.use);
2112 + set_bit(IPS_CONFIRMED_BIT, &ct->status);
2113 ++
2114 ++ /* Since the lookup is lockless, hash insertion must be done after
2115 ++ * starting the timer and setting the CONFIRMED bit. The RCU barriers
2116 ++ * guarantee that no other CPU can find the conntrack before the above
2117 ++ * stores are visible.
2118 ++ */
2119 ++ __nf_conntrack_hash_insert(ct, hash, repl_hash);
2120 + NF_CT_STAT_INC(net, insert);
2121 + spin_unlock_bh(&nf_conntrack_lock);
2122 ++
2123 + help = nfct_help(ct);
2124 + if (help && help->helper)
2125 + nf_conntrack_event_cache(IPCT_HELPER, ct);
2126 +@@ -467,7 +475,8 @@ static noinline int early_drop(struct net *net, unsigned int hash)
2127 + cnt++;
2128 + }
2129 +
2130 +- if (ct && unlikely(!atomic_inc_not_zero(&ct->ct_general.use)))
2131 ++ if (ct && unlikely(nf_ct_is_dying(ct) ||
2132 ++ !atomic_inc_not_zero(&ct->ct_general.use)))
2133 + ct = NULL;
2134 + if (ct || cnt >= NF_CT_EVICTION_RANGE)
2135 + break;
2136 +@@ -516,22 +525,37 @@ struct nf_conn *nf_conntrack_alloc(struct net *net,
2137 + }
2138 + }
2139 +
2140 +- ct = kmem_cache_zalloc(nf_conntrack_cachep, gfp);
2141 ++ /*
2142 ++ * Do not use kmem_cache_zalloc(), as this cache uses
2143 ++ * SLAB_DESTROY_BY_RCU.
2144 ++ */
2145 ++ ct = kmem_cache_alloc(nf_conntrack_cachep, gfp);
2146 + if (ct == NULL) {
2147 + pr_debug("nf_conntrack_alloc: Can't alloc conntrack.\n");
2148 + atomic_dec(&net->ct.count);
2149 + return ERR_PTR(-ENOMEM);
2150 + }
2151 +-
2152 +- atomic_set(&ct->ct_general.use, 1);
2153 ++ /*
2154 ++ * Let ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode.next
2155 ++ * and ct->tuplehash[IP_CT_DIR_REPLY].hnnode.next unchanged.
2156 ++ */
2157 ++ memset(&ct->tuplehash[IP_CT_DIR_MAX], 0,
2158 ++ sizeof(*ct) - offsetof(struct nf_conn, tuplehash[IP_CT_DIR_MAX]));
2159 + ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *orig;
2160 ++ ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode.pprev = NULL;
2161 + ct->tuplehash[IP_CT_DIR_REPLY].tuple = *repl;
2162 ++ ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev = NULL;
2163 + /* Don't set timer yet: wait for confirmation */
2164 + setup_timer(&ct->timeout, death_by_timeout, (unsigned long)ct);
2165 + #ifdef CONFIG_NET_NS
2166 + ct->ct_net = net;
2167 + #endif
2168 +
2169 ++ /*
2170 ++ * changes to lookup keys must be done before setting refcnt to 1
2171 ++ */
2172 ++ smp_wmb();
2173 ++ atomic_set(&ct->ct_general.use, 1);
2174 + return ct;
2175 + }
2176 + EXPORT_SYMBOL_GPL(nf_conntrack_alloc);
2177 +diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
2178 +index 97a6e93..a38bc22 100644
2179 +--- a/net/netfilter/nf_conntrack_proto_tcp.c
2180 ++++ b/net/netfilter/nf_conntrack_proto_tcp.c
2181 +@@ -706,8 +706,8 @@ static bool tcp_in_window(const struct nf_conn *ct,
2182 + /* Caller must linearize skb at tcp header. */
2183 + void nf_conntrack_tcp_update(const struct sk_buff *skb,
2184 + unsigned int dataoff,
2185 +- struct nf_conn *ct,
2186 +- int dir)
2187 ++ struct nf_conn *ct, int dir,
2188 ++ s16 offset)
2189 + {
2190 + const struct tcphdr *tcph = (const void *)skb->data + dataoff;
2191 + const struct ip_ct_tcp_state *sender = &ct->proto.tcp.seen[dir];
2192 +@@ -720,7 +720,7 @@ void nf_conntrack_tcp_update(const struct sk_buff *skb,
2193 + /*
2194 + * We have to worry for the ack in the reply packet only...
2195 + */
2196 +- if (after(end, ct->proto.tcp.seen[dir].td_end))
2197 ++ if (ct->proto.tcp.seen[dir].td_end + offset == end)
2198 + ct->proto.tcp.seen[dir].td_end = end;
2199 + ct->proto.tcp.last_end = end;
2200 + write_unlock_bh(&tcp_lock);
2201 +diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
2202 +index beb3731..4e62030 100644
2203 +--- a/net/netfilter/nf_log.c
2204 ++++ b/net/netfilter/nf_log.c
2205 +@@ -47,7 +47,6 @@ int nf_log_register(u_int8_t pf, struct nf_logger *logger)
2206 + mutex_lock(&nf_log_mutex);
2207 +
2208 + if (pf == NFPROTO_UNSPEC) {
2209 +- int i;
2210 + for (i = NFPROTO_UNSPEC; i < NFPROTO_NUMPROTO; i++)
2211 + list_add_tail(&(logger->list[i]), &(nf_loggers_l[i]));
2212 + } else {
2213 +@@ -216,7 +215,7 @@ static const struct file_operations nflog_file_ops = {
2214 + #endif /* PROC_FS */
2215 +
2216 + #ifdef CONFIG_SYSCTL
2217 +-struct ctl_path nf_log_sysctl_path[] = {
2218 ++static struct ctl_path nf_log_sysctl_path[] = {
2219 + { .procname = "net", .ctl_name = CTL_NET, },
2220 + { .procname = "netfilter", .ctl_name = NET_NETFILTER, },
2221 + { .procname = "nf_log", .ctl_name = CTL_UNNUMBERED, },
2222 +@@ -228,19 +227,26 @@ static struct ctl_table nf_log_sysctl_table[NFPROTO_NUMPROTO+1];
2223 + static struct ctl_table_header *nf_log_dir_header;
2224 +
2225 + static int nf_log_proc_dostring(ctl_table *table, int write, struct file *filp,
2226 +- void *buffer, size_t *lenp, loff_t *ppos)
2227 ++ void __user *buffer, size_t *lenp, loff_t *ppos)
2228 + {
2229 + const struct nf_logger *logger;
2230 ++ char buf[NFLOGGER_NAME_LEN];
2231 ++ size_t size = *lenp;
2232 + int r = 0;
2233 + int tindex = (unsigned long)table->extra1;
2234 +
2235 + if (write) {
2236 +- if (!strcmp(buffer, "NONE")) {
2237 ++ if (size > sizeof(buf))
2238 ++ size = sizeof(buf);
2239 ++ if (copy_from_user(buf, buffer, size))
2240 ++ return -EFAULT;
2241 ++
2242 ++ if (!strcmp(buf, "NONE")) {
2243 + nf_log_unbind_pf(tindex);
2244 + return 0;
2245 + }
2246 + mutex_lock(&nf_log_mutex);
2247 +- logger = __find_logger(tindex, buffer);
2248 ++ logger = __find_logger(tindex, buf);
2249 + if (logger == NULL) {
2250 + mutex_unlock(&nf_log_mutex);
2251 + return -ENOENT;
2252 +@@ -248,14 +254,14 @@ static int nf_log_proc_dostring(ctl_table *table, int write, struct file *filp,
2253 + rcu_assign_pointer(nf_loggers[tindex], logger);
2254 + mutex_unlock(&nf_log_mutex);
2255 + } else {
2256 +- rcu_read_lock();
2257 +- logger = rcu_dereference(nf_loggers[tindex]);
2258 ++ mutex_lock(&nf_log_mutex);
2259 ++ logger = nf_loggers[tindex];
2260 + if (!logger)
2261 + table->data = "NONE";
2262 + else
2263 + table->data = logger->name;
2264 + r = proc_dostring(table, write, filp, buffer, lenp, ppos);
2265 +- rcu_read_unlock();
2266 ++ mutex_unlock(&nf_log_mutex);
2267 + }
2268 +
2269 + return r;
2270 +diff --git a/net/netfilter/xt_quota.c b/net/netfilter/xt_quota.c
2271 +index 01dd07b..98fc190 100644
2272 +--- a/net/netfilter/xt_quota.c
2273 ++++ b/net/netfilter/xt_quota.c
2274 +@@ -54,6 +54,7 @@ static bool quota_mt_check(const struct xt_mtchk_param *par)
2275 + if (q->master == NULL)
2276 + return -ENOMEM;
2277 +
2278 ++ q->master->quota = q->quota;
2279 + return true;
2280 + }
2281 +
2282 +diff --git a/net/netfilter/xt_rateest.c b/net/netfilter/xt_rateest.c
2283 +index 220a1d5..4fc6a91 100644
2284 +--- a/net/netfilter/xt_rateest.c
2285 ++++ b/net/netfilter/xt_rateest.c
2286 +@@ -66,7 +66,7 @@ xt_rateest_mt(const struct sk_buff *skb, const struct xt_match_param *par)
2287 + if (info->flags & XT_RATEEST_MATCH_BPS)
2288 + ret &= bps1 == bps2;
2289 + if (info->flags & XT_RATEEST_MATCH_PPS)
2290 +- ret &= pps2 == pps2;
2291 ++ ret &= pps1 == pps2;
2292 + break;
2293 + }
2294 +
2295 +diff --git a/net/wireless/scan.c b/net/wireless/scan.c
2296 +index 1f260c4..bc7f788 100644
2297 +--- a/net/wireless/scan.c
2298 ++++ b/net/wireless/scan.c
2299 +@@ -365,7 +365,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
2300 + found = rb_find_bss(dev, res);
2301 +
2302 + if (found) {
2303 +- kref_get(&found->ref);
2304 + found->pub.beacon_interval = res->pub.beacon_interval;
2305 + found->pub.tsf = res->pub.tsf;
2306 + found->pub.signal = res->pub.signal;
2307 +diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
2308 +index bfac30f..a31412b 100644
2309 +--- a/sound/pci/ca0106/ca0106_main.c
2310 ++++ b/sound/pci/ca0106/ca0106_main.c
2311 +@@ -325,9 +325,9 @@ static struct snd_pcm_hardware snd_ca0106_capture_hw = {
2312 + .rate_max = 192000,
2313 + .channels_min = 2,
2314 + .channels_max = 2,
2315 +- .buffer_bytes_max = ((65536 - 64) * 8),
2316 ++ .buffer_bytes_max = 65536 - 128,
2317 + .period_bytes_min = 64,
2318 +- .period_bytes_max = (65536 - 64),
2319 ++ .period_bytes_max = 32768 - 64,
2320 + .periods_min = 2,
2321 + .periods_max = 2,
2322 + .fifo_size = 0,
2323 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2324 +index f09324a..18e8dad 100644
2325 +--- a/sound/pci/hda/patch_realtek.c
2326 ++++ b/sound/pci/hda/patch_realtek.c
2327 +@@ -10204,6 +10204,18 @@ static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
2328 + alc262_lenovo_3000_automute(codec, 1);
2329 + }
2330 +
2331 ++static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
2332 ++ int dir, int idx, long *valp)
2333 ++{
2334 ++ int i, change = 0;
2335 ++
2336 ++ for (i = 0; i < 2; i++, valp++)
2337 ++ change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
2338 ++ HDA_AMP_MUTE,
2339 ++ *valp ? 0 : HDA_AMP_MUTE);
2340 ++ return change;
2341 ++}
2342 ++
2343 + /* bind hp and internal speaker mute (with plug check) */
2344 + static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
2345 + struct snd_ctl_elem_value *ucontrol)
2346 +@@ -10212,13 +10224,8 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
2347 + long *valp = ucontrol->value.integer.value;
2348 + int change;
2349 +
2350 +- change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2351 +- HDA_AMP_MUTE,
2352 +- valp ? 0 : HDA_AMP_MUTE);
2353 +- change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2354 +- HDA_AMP_MUTE,
2355 +- valp ? 0 : HDA_AMP_MUTE);
2356 +-
2357 ++ change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
2358 ++ change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
2359 + if (change)
2360 + alc262_fujitsu_automute(codec, 0);
2361 + return change;
2362 +@@ -10253,10 +10260,7 @@ static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
2363 + long *valp = ucontrol->value.integer.value;
2364 + int change;
2365 +
2366 +- change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2367 +- HDA_AMP_MUTE,
2368 +- valp ? 0 : HDA_AMP_MUTE);
2369 +-
2370 ++ change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
2371 + if (change)
2372 + alc262_lenovo_3000_automute(codec, 0);
2373 + return change;
2374 +@@ -11377,12 +11381,7 @@ static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
2375 + long *valp = ucontrol->value.integer.value;
2376 + int change;
2377 +
2378 +- change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
2379 +- HDA_AMP_MUTE,
2380 +- valp[0] ? 0 : HDA_AMP_MUTE);
2381 +- change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
2382 +- HDA_AMP_MUTE,
2383 +- valp[1] ? 0 : HDA_AMP_MUTE);
2384 ++ change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
2385 + if (change)
2386 + alc268_acer_automute(codec, 0);
2387 + return change;
2388 +diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
2389 +index d2fd8ef..4e971b6 100644
2390 +--- a/sound/pci/hda/patch_sigmatel.c
2391 ++++ b/sound/pci/hda/patch_sigmatel.c
2392 +@@ -2325,6 +2325,7 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2393 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
2394 + "Dell Vostro 1500", STAC_9205_DELL_M42),
2395 + /* Gateway */
2396 ++ SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
2397 + SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
2398 + {} /* terminator */
2399 + };
2400 +@@ -5661,6 +5662,8 @@ static unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = {
2401 + };
2402 +
2403 + static struct snd_pci_quirk stac9872_cfg_tbl[] = {
2404 ++ SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
2405 ++ "Sony VAIO F/S", STAC_9872_VAIO),
2406 + {} /* terminator */
2407 + };
2408 +
2409 +@@ -5673,6 +5676,8 @@ static int patch_stac9872(struct hda_codec *codec)
2410 + if (spec == NULL)
2411 + return -ENOMEM;
2412 + codec->spec = spec;
2413 ++ spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
2414 ++ spec->pin_nids = stac9872_pin_nids;
2415 +
2416 + spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
2417 + stac9872_models,
2418 +@@ -5684,8 +5689,6 @@ static int patch_stac9872(struct hda_codec *codec)
2419 + stac92xx_set_config_regs(codec,
2420 + stac9872_brd_tbl[spec->board_config]);
2421 +
2422 +- spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
2423 +- spec->pin_nids = stac9872_pin_nids;
2424 + spec->multiout.dac_nids = spec->dac_nids;
2425 + spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids);
2426 + spec->adc_nids = stac9872_adc_nids;
2427 +diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
2428 +index bc5ce11..b369504 100644
2429 +--- a/sound/pci/oxygen/virtuoso.c
2430 ++++ b/sound/pci/oxygen/virtuoso.c
2431 +@@ -621,6 +621,8 @@ static void xonar_d2_resume(struct oxygen *chip)
2432 +
2433 + static void xonar_d1_resume(struct oxygen *chip)
2434 + {
2435 ++ oxygen_set_bits8(chip, OXYGEN_FUNCTION, OXYGEN_FUNCTION_RESET_CODEC);
2436 ++ msleep(1);
2437 + cs43xx_init(chip);
2438 + xonar_enable_output(chip);
2439 + }
2440 +diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
2441 +index a6e8f3f..40d4116 100644
2442 +--- a/sound/soc/codecs/wm8753.c
2443 ++++ b/sound/soc/codecs/wm8753.c
2444 +@@ -1664,7 +1664,7 @@ static int wm8753_register(struct wm8753_priv *wm8753)
2445 + codec->reg_cache = &wm8753->reg_cache;
2446 + codec->private_data = wm8753;
2447 +
2448 +- memcpy(codec->reg_cache, wm8753_reg, sizeof(codec->reg_cache));
2449 ++ memcpy(codec->reg_cache, wm8753_reg, sizeof(wm8753->reg_cache));
2450 + INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work);
2451 +
2452 + ret = wm8753_reset(codec);
2453 +diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
2454 +index a6b8848..6ea6868 100644
2455 +--- a/sound/usb/usbaudio.c
2456 ++++ b/sound/usb/usbaudio.c
2457 +@@ -2649,7 +2649,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
2458 + struct usb_interface_descriptor *altsd;
2459 + int i, altno, err, stream;
2460 + int format;
2461 +- struct audioformat *fp;
2462 ++ struct audioformat *fp = NULL;
2463 + unsigned char *fmt, *csep;
2464 + int num;
2465 +
2466 +@@ -2722,6 +2722,18 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
2467 + continue;
2468 + }
2469 +
2470 ++ /*
2471 ++ * Blue Microphones workaround: The last altsetting is identical
2472 ++ * with the previous one, except for a larger packet size, but
2473 ++ * is actually a mislabeled two-channel setting; ignore it.
2474 ++ */
2475 ++ if (fmt[4] == 1 && fmt[5] == 2 && altno == 2 && num == 3 &&
2476 ++ fp && fp->altsetting == 1 && fp->channels == 1 &&
2477 ++ fp->format == SNDRV_PCM_FORMAT_S16_LE &&
2478 ++ le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) ==
2479 ++ fp->maxpacksize * 2)
2480 ++ continue;
2481 ++
2482 + csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT);
2483 + /* Creamware Noah has this descriptor after the 2nd endpoint */
2484 + if (!csep && altsd->bNumEndpoints >= 2)