Magellan Linux

Contents of /trunk/kernel26-magellan/patches-2.6.39-r2/0102-2.6.39.3-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1424 - (show annotations) (download)
Mon Jul 18 14:29:21 2011 UTC (12 years, 9 months ago) by niro
File size: 121531 byte(s)
-2.6.39-magellan-r2: -using linux-2.6.39.3 and removed deprecated acpi procfs options from config
1 diff --git a/Documentation/filesystems/caching/netfs-api.txt b/Documentation/filesystems/caching/netfs-api.txt
2 index a167ab8..7cc6bf2 100644
3 --- a/Documentation/filesystems/caching/netfs-api.txt
4 +++ b/Documentation/filesystems/caching/netfs-api.txt
5 @@ -673,6 +673,22 @@ storage request to complete, or it may attempt to cancel the storage request -
6 in which case the page will not be stored in the cache this time.
7
8
9 +BULK INODE PAGE UNCACHE
10 +-----------------------
11 +
12 +A convenience routine is provided to perform an uncache on all the pages
13 +attached to an inode. This assumes that the pages on the inode correspond on a
14 +1:1 basis with the pages in the cache.
15 +
16 + void fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,
17 + struct inode *inode);
18 +
19 +This takes the netfs cookie that the pages were cached with and the inode that
20 +the pages are attached to. This function will wait for pages to finish being
21 +written to the cache and for the cache to finish with the page generally. No
22 +error is returned.
23 +
24 +
25 ==========================
26 INDEX AND DATA FILE UPDATE
27 ==========================
28 diff --git a/arch/arm/mach-exynos4/init.c b/arch/arm/mach-exynos4/init.c
29 index cf91f50..a8a83e3 100644
30 --- a/arch/arm/mach-exynos4/init.c
31 +++ b/arch/arm/mach-exynos4/init.c
32 @@ -35,6 +35,7 @@ void __init exynos4_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
33 tcfg->clocks = exynos4_serial_clocks;
34 tcfg->clocks_size = ARRAY_SIZE(exynos4_serial_clocks);
35 }
36 + tcfg->flags |= NO_NEED_CHECK_CLKSRC;
37 }
38
39 s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources, cfg, no);
40 diff --git a/arch/arm/plat-samsung/include/plat/regs-serial.h b/arch/arm/plat-samsung/include/plat/regs-serial.h
41 index 788837e..d2ef07f 100644
42 --- a/arch/arm/plat-samsung/include/plat/regs-serial.h
43 +++ b/arch/arm/plat-samsung/include/plat/regs-serial.h
44 @@ -224,6 +224,8 @@
45 #define S5PV210_UFSTAT_RXMASK (255<<0)
46 #define S5PV210_UFSTAT_RXSHIFT (0)
47
48 +#define NO_NEED_CHECK_CLKSRC 1
49 +
50 #ifndef __ASSEMBLY__
51
52 /* struct s3c24xx_uart_clksrc
53 diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
54 index 31d84ac..a518c0a 100644
55 --- a/arch/x86/include/asm/pvclock.h
56 +++ b/arch/x86/include/asm/pvclock.h
57 @@ -22,6 +22,8 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
58 u64 product;
59 #ifdef __i386__
60 u32 tmp1, tmp2;
61 +#else
62 + ulong tmp;
63 #endif
64
65 if (shift < 0)
66 @@ -42,8 +44,11 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
67 : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
68 #elif defined(__x86_64__)
69 __asm__ (
70 - "mul %%rdx ; shrd $32,%%rdx,%%rax"
71 - : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
72 + "mul %[mul_frac] ; shrd $32, %[hi], %[lo]"
73 + : [lo]"=a"(product),
74 + [hi]"=d"(tmp)
75 + : "0"(delta),
76 + [mul_frac]"rm"((u64)mul_frac));
77 #else
78 #error implement me!
79 #endif
80 diff --git a/arch/x86/kernel/acpi/realmode/wakeup.S b/arch/x86/kernel/acpi/realmode/wakeup.S
81 index ead21b6..b4fd836 100644
82 --- a/arch/x86/kernel/acpi/realmode/wakeup.S
83 +++ b/arch/x86/kernel/acpi/realmode/wakeup.S
84 @@ -28,6 +28,8 @@ pmode_cr3: .long 0 /* Saved %cr3 */
85 pmode_cr4: .long 0 /* Saved %cr4 */
86 pmode_efer: .quad 0 /* Saved EFER */
87 pmode_gdt: .quad 0
88 +pmode_misc_en: .quad 0 /* Saved MISC_ENABLE MSR */
89 +pmode_behavior: .long 0 /* Wakeup behavior flags */
90 realmode_flags: .long 0
91 real_magic: .long 0
92 trampoline_segment: .word 0
93 @@ -91,6 +93,18 @@ wakeup_code:
94 /* Call the C code */
95 calll main
96
97 + /* Restore MISC_ENABLE before entering protected mode, in case
98 + BIOS decided to clear XD_DISABLE during S3. */
99 + movl pmode_behavior, %eax
100 + btl $WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE, %eax
101 + jnc 1f
102 +
103 + movl pmode_misc_en, %eax
104 + movl pmode_misc_en + 4, %edx
105 + movl $MSR_IA32_MISC_ENABLE, %ecx
106 + wrmsr
107 +1:
108 +
109 /* Do any other stuff... */
110
111 #ifndef CONFIG_64BIT
112 diff --git a/arch/x86/kernel/acpi/realmode/wakeup.h b/arch/x86/kernel/acpi/realmode/wakeup.h
113 index e1828c0..97a29e1 100644
114 --- a/arch/x86/kernel/acpi/realmode/wakeup.h
115 +++ b/arch/x86/kernel/acpi/realmode/wakeup.h
116 @@ -21,6 +21,9 @@ struct wakeup_header {
117 u32 pmode_efer_low; /* Protected mode EFER */
118 u32 pmode_efer_high;
119 u64 pmode_gdt;
120 + u32 pmode_misc_en_low; /* Protected mode MISC_ENABLE */
121 + u32 pmode_misc_en_high;
122 + u32 pmode_behavior; /* Wakeup routine behavior flags */
123 u32 realmode_flags;
124 u32 real_magic;
125 u16 trampoline_segment; /* segment with trampoline code, 64-bit only */
126 @@ -39,4 +42,7 @@ extern struct wakeup_header wakeup_header;
127 #define WAKEUP_HEADER_SIGNATURE 0x51ee1111
128 #define WAKEUP_END_SIGNATURE 0x65a22c82
129
130 +/* Wakeup behavior bits */
131 +#define WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE 0
132 +
133 #endif /* ARCH_X86_KERNEL_ACPI_RM_WAKEUP_H */
134 diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
135 index ff93bc1..cdddffc 100644
136 --- a/arch/x86/kernel/acpi/sleep.c
137 +++ b/arch/x86/kernel/acpi/sleep.c
138 @@ -77,6 +77,12 @@ int acpi_suspend_lowlevel(void)
139
140 header->pmode_cr0 = read_cr0();
141 header->pmode_cr4 = read_cr4_safe();
142 + header->pmode_behavior = 0;
143 + if (!rdmsr_safe(MSR_IA32_MISC_ENABLE,
144 + &header->pmode_misc_en_low,
145 + &header->pmode_misc_en_high))
146 + header->pmode_behavior |=
147 + (1 << WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE);
148 header->realmode_flags = acpi_realmode_flags;
149 header->real_magic = 0x12345678;
150
151 diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
152 index cf97500..68894fd 100644
153 --- a/arch/x86/oprofile/nmi_int.c
154 +++ b/arch/x86/oprofile/nmi_int.c
155 @@ -112,8 +112,10 @@ static void nmi_cpu_start(void *dummy)
156 static int nmi_start(void)
157 {
158 get_online_cpus();
159 - on_each_cpu(nmi_cpu_start, NULL, 1);
160 ctr_running = 1;
161 + /* make ctr_running visible to the nmi handler: */
162 + smp_mb();
163 + on_each_cpu(nmi_cpu_start, NULL, 1);
164 put_online_cpus();
165 return 0;
166 }
167 @@ -504,15 +506,18 @@ static int nmi_setup(void)
168
169 nmi_enabled = 0;
170 ctr_running = 0;
171 - barrier();
172 + /* make variables visible to the nmi handler: */
173 + smp_mb();
174 err = register_die_notifier(&profile_exceptions_nb);
175 if (err)
176 goto fail;
177
178 get_online_cpus();
179 register_cpu_notifier(&oprofile_cpu_nb);
180 - on_each_cpu(nmi_cpu_setup, NULL, 1);
181 nmi_enabled = 1;
182 + /* make nmi_enabled visible to the nmi handler: */
183 + smp_mb();
184 + on_each_cpu(nmi_cpu_setup, NULL, 1);
185 put_online_cpus();
186
187 return 0;
188 @@ -531,7 +536,8 @@ static void nmi_shutdown(void)
189 nmi_enabled = 0;
190 ctr_running = 0;
191 put_online_cpus();
192 - barrier();
193 + /* make variables visible to the nmi handler: */
194 + smp_mb();
195 unregister_die_notifier(&profile_exceptions_nb);
196 msrs = &get_cpu_var(cpu_msrs);
197 model->shutdown(msrs);
198 diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
199 index e37b407..632ba33 100644
200 --- a/arch/x86/pci/xen.c
201 +++ b/arch/x86/pci/xen.c
202 @@ -316,7 +316,7 @@ int __init pci_xen_hvm_init(void)
203 }
204
205 #ifdef CONFIG_XEN_DOM0
206 -static int xen_register_pirq(u32 gsi, int triggering)
207 +static int xen_register_pirq(u32 gsi, int gsi_override, int triggering)
208 {
209 int rc, pirq, irq = -1;
210 struct physdev_map_pirq map_irq;
211 @@ -333,16 +333,18 @@ static int xen_register_pirq(u32 gsi, int triggering)
212 shareable = 1;
213 name = "ioapic-level";
214 }
215 -
216 pirq = xen_allocate_pirq_gsi(gsi);
217 if (pirq < 0)
218 goto out;
219
220 - irq = xen_bind_pirq_gsi_to_irq(gsi, pirq, shareable, name);
221 + if (gsi_override >= 0)
222 + irq = xen_bind_pirq_gsi_to_irq(gsi_override, pirq, shareable, name);
223 + else
224 + irq = xen_bind_pirq_gsi_to_irq(gsi, pirq, shareable, name);
225 if (irq < 0)
226 goto out;
227
228 - printk(KERN_DEBUG "xen: --> pirq=%d -> irq=%d\n", pirq, irq);
229 + printk(KERN_DEBUG "xen: --> pirq=%d -> irq=%d (gsi=%d)\n", pirq, irq, gsi);
230
231 map_irq.domid = DOMID_SELF;
232 map_irq.type = MAP_PIRQ_TYPE_GSI;
233 @@ -359,7 +361,7 @@ out:
234 return irq;
235 }
236
237 -static int xen_register_gsi(u32 gsi, int triggering, int polarity)
238 +static int xen_register_gsi(u32 gsi, int gsi_override, int triggering, int polarity)
239 {
240 int rc, irq;
241 struct physdev_setup_gsi setup_gsi;
242 @@ -370,7 +372,7 @@ static int xen_register_gsi(u32 gsi, int triggering, int polarity)
243 printk(KERN_DEBUG "xen: registering gsi %u triggering %d polarity %d\n",
244 gsi, triggering, polarity);
245
246 - irq = xen_register_pirq(gsi, triggering);
247 + irq = xen_register_pirq(gsi, gsi_override, triggering);
248
249 setup_gsi.gsi = gsi;
250 setup_gsi.triggering = (triggering == ACPI_EDGE_SENSITIVE ? 0 : 1);
251 @@ -392,6 +394,8 @@ static __init void xen_setup_acpi_sci(void)
252 int rc;
253 int trigger, polarity;
254 int gsi = acpi_sci_override_gsi;
255 + int irq = -1;
256 + int gsi_override = -1;
257
258 if (!gsi)
259 return;
260 @@ -408,7 +412,25 @@ static __init void xen_setup_acpi_sci(void)
261 printk(KERN_INFO "xen: sci override: global_irq=%d trigger=%d "
262 "polarity=%d\n", gsi, trigger, polarity);
263
264 - gsi = xen_register_gsi(gsi, trigger, polarity);
265 + /* Before we bind the GSI to a Linux IRQ, check whether
266 + * we need to override it with bus_irq (IRQ) value. Usually for
267 + * IRQs below IRQ_LEGACY_IRQ this holds IRQ == GSI, as so:
268 + * ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 low level)
269 + * but there are oddballs where the IRQ != GSI:
270 + * ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 20 low level)
271 + * which ends up being: gsi_to_irq[9] == 20
272 + * (which is what acpi_gsi_to_irq ends up calling when starting the
273 + * the ACPI interpreter and keels over since IRQ 9 has not been
274 + * setup as we had setup IRQ 20 for it).
275 + */
276 + /* Check whether the GSI != IRQ */
277 + if (acpi_gsi_to_irq(gsi, &irq) == 0) {
278 + if (irq >= 0 && irq != gsi)
279 + /* Bugger, we MUST have that IRQ. */
280 + gsi_override = irq;
281 + }
282 +
283 + gsi = xen_register_gsi(gsi, gsi_override, trigger, polarity);
284 printk(KERN_INFO "xen: acpi sci %d\n", gsi);
285
286 return;
287 @@ -417,7 +439,7 @@ static __init void xen_setup_acpi_sci(void)
288 static int acpi_register_gsi_xen(struct device *dev, u32 gsi,
289 int trigger, int polarity)
290 {
291 - return xen_register_gsi(gsi, trigger, polarity);
292 + return xen_register_gsi(gsi, -1 /* no GSI override */, trigger, polarity);
293 }
294
295 static int __init pci_xen_initial_domain(void)
296 @@ -456,7 +478,7 @@ void __init xen_setup_pirqs(void)
297 if (acpi_get_override_irq(irq, &trigger, &polarity) == -1)
298 continue;
299
300 - xen_register_pirq(irq,
301 + xen_register_pirq(irq, -1 /* no GSI override */,
302 trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE);
303 }
304 }
305 diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
306 index f298bd7..0d668d1 100644
307 --- a/arch/x86/xen/mmu.c
308 +++ b/arch/x86/xen/mmu.c
309 @@ -59,6 +59,7 @@
310 #include <asm/page.h>
311 #include <asm/init.h>
312 #include <asm/pat.h>
313 +#include <asm/smp.h>
314
315 #include <asm/xen/hypercall.h>
316 #include <asm/xen/hypervisor.h>
317 @@ -1353,7 +1354,11 @@ static void xen_flush_tlb_others(const struct cpumask *cpus,
318 {
319 struct {
320 struct mmuext_op op;
321 +#ifdef CONFIG_SMP
322 + DECLARE_BITMAP(mask, num_processors);
323 +#else
324 DECLARE_BITMAP(mask, NR_CPUS);
325 +#endif
326 } *args;
327 struct multicall_space mcs;
328
329 @@ -1721,6 +1726,11 @@ static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
330 for (pteidx = 0; pteidx < PTRS_PER_PTE; pteidx++, pfn++) {
331 pte_t pte;
332
333 +#ifdef CONFIG_X86_32
334 + if (pfn > max_pfn_mapped)
335 + max_pfn_mapped = pfn;
336 +#endif
337 +
338 if (!pte_none(pte_page[pteidx]))
339 continue;
340
341 @@ -1888,7 +1898,9 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
342 initial_kernel_pmd =
343 extend_brk(sizeof(pmd_t) * PTRS_PER_PMD, PAGE_SIZE);
344
345 - max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->mfn_list));
346 + max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->pt_base) +
347 + xen_start_info->nr_pt_frames * PAGE_SIZE +
348 + 512*1024);
349
350 kernel_pmd = m2v(pgd[KERNEL_PGD_BOUNDARY].pgd);
351 memcpy(initial_kernel_pmd, kernel_pmd, sizeof(pmd_t) * PTRS_PER_PMD);
352 diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
353 index 3061244..ae49046 100644
354 --- a/arch/x86/xen/smp.c
355 +++ b/arch/x86/xen/smp.c
356 @@ -206,11 +206,18 @@ static void __init xen_smp_prepare_boot_cpu(void)
357 static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
358 {
359 unsigned cpu;
360 + unsigned int i;
361
362 xen_init_lock_cpu(0);
363
364 smp_store_cpu_info(0);
365 cpu_data(0).x86_max_cores = 1;
366 +
367 + for_each_possible_cpu(i) {
368 + zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
369 + zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
370 + zalloc_cpumask_var(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL);
371 + }
372 set_cpu_sibling_map(0);
373
374 if (xen_smp_intr_init(0))
375 diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
376 index ab7a9e6..bd2fa5f 100644
377 --- a/block/cfq-iosched.c
378 +++ b/block/cfq-iosched.c
379 @@ -2704,8 +2704,14 @@ static void __cfq_exit_single_io_context(struct cfq_data *cfqd,
380 smp_wmb();
381 cic->key = cfqd_dead_key(cfqd);
382
383 - if (ioc->ioc_data == cic)
384 + rcu_read_lock();
385 + if (rcu_dereference(ioc->ioc_data) == cic) {
386 + rcu_read_unlock();
387 + spin_lock(&ioc->lock);
388 rcu_assign_pointer(ioc->ioc_data, NULL);
389 + spin_unlock(&ioc->lock);
390 + } else
391 + rcu_read_unlock();
392
393 if (cic->cfqq[BLK_RW_ASYNC]) {
394 cfq_exit_cfqq(cfqd, cic->cfqq[BLK_RW_ASYNC]);
395 @@ -3012,7 +3018,8 @@ cfq_drop_dead_cic(struct cfq_data *cfqd, struct io_context *ioc,
396
397 spin_lock_irqsave(&ioc->lock, flags);
398
399 - BUG_ON(ioc->ioc_data == cic);
400 + BUG_ON(rcu_dereference_check(ioc->ioc_data,
401 + lockdep_is_held(&ioc->lock)) == cic);
402
403 radix_tree_delete(&ioc->radix_root, cfqd->cic_index);
404 hlist_del_rcu(&cic->cic_list);
405 diff --git a/drivers/base/platform.c b/drivers/base/platform.c
406 index 9e0e4fc..5d5bd1a 100644
407 --- a/drivers/base/platform.c
408 +++ b/drivers/base/platform.c
409 @@ -367,7 +367,7 @@ EXPORT_SYMBOL_GPL(platform_device_unregister);
410 *
411 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
412 */
413 -struct platform_device *__init_or_module platform_device_register_resndata(
414 +struct platform_device *platform_device_register_resndata(
415 struct device *parent,
416 const char *name, int id,
417 const struct resource *res, unsigned int num,
418 diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
419 index abe3ab7..631b5d3 100644
420 --- a/drivers/base/power/main.c
421 +++ b/drivers/base/power/main.c
422 @@ -57,7 +57,8 @@ static int async_error;
423 */
424 void device_pm_init(struct device *dev)
425 {
426 - dev->power.in_suspend = false;
427 + dev->power.is_prepared = false;
428 + dev->power.is_suspended = false;
429 init_completion(&dev->power.completion);
430 complete_all(&dev->power.completion);
431 dev->power.wakeup = NULL;
432 @@ -91,7 +92,7 @@ void device_pm_add(struct device *dev)
433 pr_debug("PM: Adding info for %s:%s\n",
434 dev->bus ? dev->bus->name : "No Bus", dev_name(dev));
435 mutex_lock(&dpm_list_mtx);
436 - if (dev->parent && dev->parent->power.in_suspend)
437 + if (dev->parent && dev->parent->power.is_prepared)
438 dev_warn(dev, "parent %s should not be sleeping\n",
439 dev_name(dev->parent));
440 list_add_tail(&dev->power.entry, &dpm_list);
441 @@ -513,7 +514,14 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
442 dpm_wait(dev->parent, async);
443 device_lock(dev);
444
445 - dev->power.in_suspend = false;
446 + /*
447 + * This is a fib. But we'll allow new children to be added below
448 + * a resumed device, even if the device hasn't been completed yet.
449 + */
450 + dev->power.is_prepared = false;
451 +
452 + if (!dev->power.is_suspended)
453 + goto Unlock;
454
455 if (dev->pwr_domain) {
456 pm_dev_dbg(dev, state, "power domain ");
457 @@ -549,6 +557,9 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
458 }
459
460 End:
461 + dev->power.is_suspended = false;
462 +
463 + Unlock:
464 device_unlock(dev);
465 complete_all(&dev->power.completion);
466
467 @@ -668,7 +679,7 @@ static void dpm_complete(pm_message_t state)
468 struct device *dev = to_device(dpm_prepared_list.prev);
469
470 get_device(dev);
471 - dev->power.in_suspend = false;
472 + dev->power.is_prepared = false;
473 list_move(&dev->power.entry, &list);
474 mutex_unlock(&dpm_list_mtx);
475
476 @@ -834,11 +845,11 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
477 device_lock(dev);
478
479 if (async_error)
480 - goto End;
481 + goto Unlock;
482
483 if (pm_wakeup_pending()) {
484 async_error = -EBUSY;
485 - goto End;
486 + goto Unlock;
487 }
488
489 if (dev->type && dev->type->pm) {
490 @@ -876,6 +887,9 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
491 }
492
493 End:
494 + dev->power.is_suspended = !error;
495 +
496 + Unlock:
497 device_unlock(dev);
498 complete_all(&dev->power.completion);
499
500 @@ -1037,7 +1051,7 @@ static int dpm_prepare(pm_message_t state)
501 put_device(dev);
502 break;
503 }
504 - dev->power.in_suspend = true;
505 + dev->power.is_prepared = true;
506 if (!list_empty(&dev->power.entry))
507 list_move_tail(&dev->power.entry, &dpm_prepared_list);
508 put_device(dev);
509 diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
510 index 219d88a..dde6a0f 100644
511 --- a/drivers/connector/connector.c
512 +++ b/drivers/connector/connector.c
513 @@ -139,6 +139,7 @@ static int cn_call_callback(struct sk_buff *skb)
514 spin_unlock_bh(&dev->cbdev->queue_lock);
515
516 if (cbq != NULL) {
517 + err = 0;
518 cbq->callback(msg, nsp);
519 kfree_skb(skb);
520 cn_queue_release_callback(cbq);
521 diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
522 index e1aee4f..b6a19cb 100644
523 --- a/drivers/gpu/drm/drm_pci.c
524 +++ b/drivers/gpu/drm/drm_pci.c
525 @@ -251,7 +251,7 @@ err:
526 }
527
528
529 -int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)
530 +static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)
531 {
532 if ((p->busnum >> 8) != drm_get_pci_domain(dev) ||
533 (p->busnum & 0xff) != dev->pdev->bus->number ||
534 @@ -292,6 +292,7 @@ static struct drm_bus drm_pci_bus = {
535 .get_name = drm_pci_get_name,
536 .set_busid = drm_pci_set_busid,
537 .set_unique = drm_pci_set_unique,
538 + .irq_by_busid = drm_pci_irq_by_busid,
539 .agp_init = drm_pci_agp_init,
540 };
541
542 diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
543 index 188b497..58c7f27 100644
544 --- a/drivers/gpu/drm/i915/i915_irq.c
545 +++ b/drivers/gpu/drm/i915/i915_irq.c
546 @@ -1567,6 +1567,17 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
547 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
548
549 I915_WRITE(HWSTAM, 0xeffe);
550 + if (IS_GEN6(dev)) {
551 + /* Workaround stalls observed on Sandy Bridge GPUs by
552 + * making the blitter command streamer generate a
553 + * write to the Hardware Status Page for
554 + * MI_USER_INTERRUPT. This appears to serialize the
555 + * previous seqno write out before the interrupt
556 + * happens.
557 + */
558 + I915_WRITE(GEN6_BLITTER_HWSTAM, ~GEN6_BLITTER_USER_INTERRUPT);
559 + I915_WRITE(GEN6_BSD_HWSTAM, ~GEN6_BSD_USER_INTERRUPT);
560 + }
561
562 /* XXX hotplug from PCH */
563
564 diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
565 index f39ac3a..5a96fd1 100644
566 --- a/drivers/gpu/drm/i915/i915_reg.h
567 +++ b/drivers/gpu/drm/i915/i915_reg.h
568 @@ -528,6 +528,7 @@
569 #define GEN6_BSD_SLEEP_PSMI_CONTROL_RC_ILDL_MESSAGE_ENABLE 0
570 #define GEN6_BSD_SLEEP_PSMI_CONTROL_IDLE_INDICATOR (1 << 3)
571
572 +#define GEN6_BSD_HWSTAM 0x12098
573 #define GEN6_BSD_IMR 0x120a8
574 #define GEN6_BSD_USER_INTERRUPT (1 << 12)
575
576 diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
577 index d3b903b..d98cee6 100644
578 --- a/drivers/gpu/drm/i915/intel_i2c.c
579 +++ b/drivers/gpu/drm/i915/intel_i2c.c
580 @@ -401,8 +401,7 @@ int intel_setup_gmbus(struct drm_device *dev)
581 bus->reg0 = i | GMBUS_RATE_100KHZ;
582
583 /* XXX force bit banging until GMBUS is fully debugged */
584 - if (IS_GEN2(dev))
585 - bus->force_bit = intel_gpio_create(dev_priv, i);
586 + bus->force_bit = intel_gpio_create(dev_priv, i);
587 }
588
589 intel_i2c_reset(dev_priv->dev);
590 diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
591 index b427488..9423fba 100644
592 --- a/drivers/gpu/drm/radeon/radeon_encoders.c
593 +++ b/drivers/gpu/drm/radeon/radeon_encoders.c
594 @@ -1294,7 +1294,11 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode)
595 if (is_dig) {
596 switch (mode) {
597 case DRM_MODE_DPMS_ON:
598 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);
599 + /* some early dce3.2 boards have a bug in their transmitter control table */
600 + if ((rdev->family == CHIP_RV710) || (rdev->family == CHIP_RV730))
601 + atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0);
602 + else
603 + atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);
604 if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) {
605 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
606
607 diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
608 index ef8a5ba..05aa674 100644
609 --- a/drivers/gpu/drm/radeon/rv770.c
610 +++ b/drivers/gpu/drm/radeon/rv770.c
611 @@ -572,6 +572,12 @@ static void rv770_program_channel_remap(struct radeon_device *rdev)
612 else
613 tcp_chan_steer = 0x00fac688;
614
615 + /* RV770 CE has special chremap setup */
616 + if (rdev->pdev->device == 0x944e) {
617 + tcp_chan_steer = 0x00b08b08;
618 + mc_shared_chremap = 0x00b08b08;
619 + }
620 +
621 WREG32(TCP_CHAN_STEER, tcp_chan_steer);
622 WREG32(MC_SHARED_CHREMAP, mc_shared_chremap);
623 }
624 diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
625 index bc6e2ab..affc17e 100644
626 --- a/drivers/hwmon/ibmaem.c
627 +++ b/drivers/hwmon/ibmaem.c
628 @@ -947,6 +947,7 @@ static int aem_register_sensors(struct aem_data *data,
629
630 /* Set up read-only sensors */
631 while (ro->label) {
632 + sysfs_attr_init(&sensors->dev_attr.attr);
633 sensors->dev_attr.attr.name = ro->label;
634 sensors->dev_attr.attr.mode = S_IRUGO;
635 sensors->dev_attr.show = ro->show;
636 @@ -963,6 +964,7 @@ static int aem_register_sensors(struct aem_data *data,
637
638 /* Set up read-write sensors */
639 while (rw->label) {
640 + sysfs_attr_init(&sensors->dev_attr.attr);
641 sensors->dev_attr.attr.name = rw->label;
642 sensors->dev_attr.attr.mode = S_IRUGO | S_IWUSR;
643 sensors->dev_attr.show = rw->show;
644 diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c
645 index 06d4eaf..41dbf81 100644
646 --- a/drivers/hwmon/ibmpex.c
647 +++ b/drivers/hwmon/ibmpex.c
648 @@ -358,6 +358,7 @@ static int create_sensor(struct ibmpex_bmc_data *data, int type,
649 else if (type == POWER_SENSOR)
650 sprintf(n, power_sensor_name_templates[func], "power", counter);
651
652 + sysfs_attr_init(&data->sensors[sensor].attr[func].dev_attr.attr);
653 data->sensors[sensor].attr[func].dev_attr.attr.name = n;
654 data->sensors[sensor].attr[func].dev_attr.attr.mode = S_IRUGO;
655 data->sensors[sensor].attr[func].dev_attr.show = ibmpex_show_sensor;
656 diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c
657 index 92b42db..b39f52e 100644
658 --- a/drivers/hwmon/s3c-hwmon.c
659 +++ b/drivers/hwmon/s3c-hwmon.c
660 @@ -232,6 +232,7 @@ static int s3c_hwmon_create_attr(struct device *dev,
661
662 attr = &attrs->in;
663 attr->index = channel;
664 + sysfs_attr_init(&attr->dev_attr.attr);
665 attr->dev_attr.attr.name = attrs->in_name;
666 attr->dev_attr.attr.mode = S_IRUGO;
667 attr->dev_attr.show = s3c_hwmon_ch_show;
668 @@ -249,6 +250,7 @@ static int s3c_hwmon_create_attr(struct device *dev,
669
670 attr = &attrs->label;
671 attr->index = channel;
672 + sysfs_attr_init(&attr->dev_attr.attr);
673 attr->dev_attr.attr.name = attrs->label_name;
674 attr->dev_attr.attr.mode = S_IRUGO;
675 attr->dev_attr.show = s3c_hwmon_label_show;
676 diff --git a/drivers/i2c/busses/i2c-taos-evm.c b/drivers/i2c/busses/i2c-taos-evm.c
677 index dd39c1e..26c352a 100644
678 --- a/drivers/i2c/busses/i2c-taos-evm.c
679 +++ b/drivers/i2c/busses/i2c-taos-evm.c
680 @@ -234,7 +234,7 @@ static int taos_connect(struct serio *serio, struct serio_driver *drv)
681
682 if (taos->state != TAOS_STATE_IDLE) {
683 err = -ENODEV;
684 - dev_dbg(&serio->dev, "TAOS EVM reset failed (state=%d, "
685 + dev_err(&serio->dev, "TAOS EVM reset failed (state=%d, "
686 "pos=%d)\n", taos->state, taos->pos);
687 goto exit_close;
688 }
689 @@ -255,7 +255,7 @@ static int taos_connect(struct serio *serio, struct serio_driver *drv)
690 msecs_to_jiffies(250));
691 if (taos->state != TAOS_STATE_IDLE) {
692 err = -ENODEV;
693 - dev_err(&adapter->dev, "Echo off failed "
694 + dev_err(&serio->dev, "TAOS EVM echo off failed "
695 "(state=%d)\n", taos->state);
696 goto exit_close;
697 }
698 @@ -263,7 +263,7 @@ static int taos_connect(struct serio *serio, struct serio_driver *drv)
699 err = i2c_add_adapter(adapter);
700 if (err)
701 goto exit_close;
702 - dev_dbg(&serio->dev, "Connected to TAOS EVM\n");
703 + dev_info(&serio->dev, "Connected to TAOS EVM\n");
704
705 taos->client = taos_instantiate_device(adapter);
706 return 0;
707 @@ -288,7 +288,7 @@ static void taos_disconnect(struct serio *serio)
708 serio_set_drvdata(serio, NULL);
709 kfree(taos);
710
711 - dev_dbg(&serio->dev, "Disconnected from TAOS EVM\n");
712 + dev_info(&serio->dev, "Disconnected from TAOS EVM\n");
713 }
714
715 static struct serio_device_id taos_serio_ids[] = {
716 diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c
717 index 54e1ce7..6f89536 100644
718 --- a/drivers/i2c/muxes/pca954x.c
719 +++ b/drivers/i2c/muxes/pca954x.c
720 @@ -201,10 +201,11 @@ static int pca954x_probe(struct i2c_client *client,
721
722 i2c_set_clientdata(client, data);
723
724 - /* Read the mux register at addr to verify
725 - * that the mux is in fact present.
726 + /* Write the mux register at addr to verify
727 + * that the mux is in fact present. This also
728 + * initializes the mux to disconnected state.
729 */
730 - if (i2c_smbus_read_byte(client) < 0) {
731 + if (i2c_smbus_write_byte(client, 0) < 0) {
732 dev_warn(&client->dev, "probe failed\n");
733 goto exit_free;
734 }
735 diff --git a/drivers/input/input.c b/drivers/input/input.c
736 index ebbceed..e3c88fc 100644
737 --- a/drivers/input/input.c
738 +++ b/drivers/input/input.c
739 @@ -1757,7 +1757,7 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev)
740 } else if (test_bit(ABS_MT_TRACKING_ID, dev->absbit)) {
741 mt_slots = dev->absinfo[ABS_MT_TRACKING_ID].maximum -
742 dev->absinfo[ABS_MT_TRACKING_ID].minimum + 1,
743 - clamp(mt_slots, 2, 32);
744 + mt_slots = clamp(mt_slots, 2, 32);
745 } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) {
746 mt_slots = 2;
747 } else {
748 diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
749 index 7630273..f8ba7c9 100644
750 --- a/drivers/input/mousedev.c
751 +++ b/drivers/input/mousedev.c
752 @@ -187,7 +187,7 @@ static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev,
753 if (size == 0)
754 size = xres ? : 1;
755
756 - clamp(value, min, max);
757 + value = clamp(value, min, max);
758
759 mousedev->packet.x = ((value - min) * xres) / size;
760 mousedev->packet.abs_event = 1;
761 @@ -201,7 +201,7 @@ static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev,
762 if (size == 0)
763 size = yres ? : 1;
764
765 - clamp(value, min, max);
766 + value = clamp(value, min, max);
767
768 mousedev->packet.y = yres - ((value - min) * yres) / size;
769 mousedev->packet.abs_event = 1;
770 diff --git a/drivers/md/md.c b/drivers/md/md.c
771 index 9930792..a7ed02c 100644
772 --- a/drivers/md/md.c
773 +++ b/drivers/md/md.c
774 @@ -7062,6 +7062,7 @@ static int remove_and_add_spares(mddev_t *mddev)
775 list_for_each_entry(rdev, &mddev->disks, same_set) {
776 if (rdev->raid_disk >= 0 &&
777 !test_bit(In_sync, &rdev->flags) &&
778 + !test_bit(Faulty, &rdev->flags) &&
779 !test_bit(Blocked, &rdev->flags))
780 spares++;
781 if (rdev->raid_disk < 0
782 diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c
783 index 11c19d8..423ed45 100644
784 --- a/drivers/media/rc/ir-raw.c
785 +++ b/drivers/media/rc/ir-raw.c
786 @@ -114,18 +114,20 @@ int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type)
787 s64 delta; /* ns */
788 DEFINE_IR_RAW_EVENT(ev);
789 int rc = 0;
790 + int delay;
791
792 if (!dev->raw)
793 return -EINVAL;
794
795 now = ktime_get();
796 delta = ktime_to_ns(ktime_sub(now, dev->raw->last_event));
797 + delay = MS_TO_NS(dev->input_dev->rep[REP_DELAY]);
798
799 /* Check for a long duration since last event or if we're
800 * being called for the first time, note that delta can't
801 * possibly be negative.
802 */
803 - if (delta > IR_MAX_DURATION || !dev->raw->last_type)
804 + if (delta > delay || !dev->raw->last_type)
805 type |= IR_START_EVENT;
806 else
807 ev.duration = delta;
808 diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
809 index 43908a7..c1717bf 100644
810 --- a/drivers/media/rc/ite-cir.c
811 +++ b/drivers/media/rc/ite-cir.c
812 @@ -1357,6 +1357,7 @@ static const struct ite_dev_params ite_dev_descs[] = {
813 { /* 0: ITE8704 */
814 .model = "ITE8704 CIR transceiver",
815 .io_region_size = IT87_IOREG_LENGTH,
816 + .io_rsrc_no = 0,
817 .hw_tx_capable = true,
818 .sample_period = (u32) (1000000000ULL / 115200),
819 .tx_carrier_freq = 38000,
820 @@ -1381,6 +1382,7 @@ static const struct ite_dev_params ite_dev_descs[] = {
821 { /* 1: ITE8713 */
822 .model = "ITE8713 CIR transceiver",
823 .io_region_size = IT87_IOREG_LENGTH,
824 + .io_rsrc_no = 0,
825 .hw_tx_capable = true,
826 .sample_period = (u32) (1000000000ULL / 115200),
827 .tx_carrier_freq = 38000,
828 @@ -1405,6 +1407,7 @@ static const struct ite_dev_params ite_dev_descs[] = {
829 { /* 2: ITE8708 */
830 .model = "ITE8708 CIR transceiver",
831 .io_region_size = IT8708_IOREG_LENGTH,
832 + .io_rsrc_no = 0,
833 .hw_tx_capable = true,
834 .sample_period = (u32) (1000000000ULL / 115200),
835 .tx_carrier_freq = 38000,
836 @@ -1430,6 +1433,7 @@ static const struct ite_dev_params ite_dev_descs[] = {
837 { /* 3: ITE8709 */
838 .model = "ITE8709 CIR transceiver",
839 .io_region_size = IT8709_IOREG_LENGTH,
840 + .io_rsrc_no = 2,
841 .hw_tx_capable = true,
842 .sample_period = (u32) (1000000000ULL / 115200),
843 .tx_carrier_freq = 38000,
844 @@ -1471,6 +1475,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
845 struct rc_dev *rdev = NULL;
846 int ret = -ENOMEM;
847 int model_no;
848 + int io_rsrc_no;
849
850 ite_dbg("%s called", __func__);
851
852 @@ -1500,10 +1505,11 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
853
854 /* get the description for the device */
855 dev_desc = &ite_dev_descs[model_no];
856 + io_rsrc_no = dev_desc->io_rsrc_no;
857
858 /* validate pnp resources */
859 - if (!pnp_port_valid(pdev, 0) ||
860 - pnp_port_len(pdev, 0) != dev_desc->io_region_size) {
861 + if (!pnp_port_valid(pdev, io_rsrc_no) ||
862 + pnp_port_len(pdev, io_rsrc_no) != dev_desc->io_region_size) {
863 dev_err(&pdev->dev, "IR PNP Port not valid!\n");
864 goto failure;
865 }
866 @@ -1514,7 +1520,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
867 }
868
869 /* store resource values */
870 - itdev->cir_addr = pnp_port_start(pdev, 0);
871 + itdev->cir_addr = pnp_port_start(pdev, io_rsrc_no);
872 itdev->cir_irq = pnp_irq(pdev, 0);
873
874 /* initialize spinlocks */
875 diff --git a/drivers/media/rc/ite-cir.h b/drivers/media/rc/ite-cir.h
876 index 16a19f5..aa899a0 100644
877 --- a/drivers/media/rc/ite-cir.h
878 +++ b/drivers/media/rc/ite-cir.h
879 @@ -57,6 +57,9 @@ struct ite_dev_params {
880 /* size of the I/O region */
881 int io_region_size;
882
883 + /* IR pnp I/O resource number */
884 + int io_rsrc_no;
885 +
886 /* true if the hardware supports transmission */
887 bool hw_tx_capable;
888
889 diff --git a/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c b/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c
890 index bb10ffe..8d558ae 100644
891 --- a/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c
892 +++ b/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c
893 @@ -15,43 +15,39 @@
894 /* Pinnacle PCTV HD 800i mini remote */
895
896 static struct rc_map_table pinnacle_pctv_hd[] = {
897 -
898 - { 0x0f, KEY_1 },
899 - { 0x15, KEY_2 },
900 - { 0x10, KEY_3 },
901 - { 0x18, KEY_4 },
902 - { 0x1b, KEY_5 },
903 - { 0x1e, KEY_6 },
904 - { 0x11, KEY_7 },
905 - { 0x21, KEY_8 },
906 - { 0x12, KEY_9 },
907 - { 0x27, KEY_0 },
908 -
909 - { 0x24, KEY_ZOOM },
910 - { 0x2a, KEY_SUBTITLE },
911 -
912 - { 0x00, KEY_MUTE },
913 - { 0x01, KEY_ENTER }, /* Pinnacle Logo */
914 - { 0x39, KEY_POWER },
915 -
916 - { 0x03, KEY_VOLUMEUP },
917 - { 0x09, KEY_VOLUMEDOWN },
918 - { 0x06, KEY_CHANNELUP },
919 - { 0x0c, KEY_CHANNELDOWN },
920 -
921 - { 0x2d, KEY_REWIND },
922 - { 0x30, KEY_PLAYPAUSE },
923 - { 0x33, KEY_FASTFORWARD },
924 - { 0x3c, KEY_STOP },
925 - { 0x36, KEY_RECORD },
926 - { 0x3f, KEY_EPG }, /* Labeled "?" */
927 + /* Key codes for the tiny Pinnacle remote*/
928 + { 0x0700, KEY_MUTE },
929 + { 0x0701, KEY_MENU }, /* Pinnacle logo */
930 + { 0x0739, KEY_POWER },
931 + { 0x0703, KEY_VOLUMEUP },
932 + { 0x0709, KEY_VOLUMEDOWN },
933 + { 0x0706, KEY_CHANNELUP },
934 + { 0x070c, KEY_CHANNELDOWN },
935 + { 0x070f, KEY_1 },
936 + { 0x0715, KEY_2 },
937 + { 0x0710, KEY_3 },
938 + { 0x0718, KEY_4 },
939 + { 0x071b, KEY_5 },
940 + { 0x071e, KEY_6 },
941 + { 0x0711, KEY_7 },
942 + { 0x0721, KEY_8 },
943 + { 0x0712, KEY_9 },
944 + { 0x0727, KEY_0 },
945 + { 0x0724, KEY_ZOOM }, /* 'Square' key */
946 + { 0x072a, KEY_SUBTITLE }, /* 'T' key */
947 + { 0x072d, KEY_REWIND },
948 + { 0x0730, KEY_PLAYPAUSE },
949 + { 0x0733, KEY_FASTFORWARD },
950 + { 0x0736, KEY_RECORD },
951 + { 0x073c, KEY_STOP },
952 + { 0x073f, KEY_HELP }, /* '?' key */
953 };
954
955 static struct rc_map_list pinnacle_pctv_hd_map = {
956 .map = {
957 .scan = pinnacle_pctv_hd,
958 .size = ARRAY_SIZE(pinnacle_pctv_hd),
959 - .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
960 + .rc_type = RC_TYPE_RC5,
961 .name = RC_MAP_PINNACLE_PCTV_HD,
962 }
963 };
964 diff --git a/drivers/media/video/uvc/uvc_queue.c b/drivers/media/video/uvc/uvc_queue.c
965 index f14581b..48c5c57 100644
966 --- a/drivers/media/video/uvc/uvc_queue.c
967 +++ b/drivers/media/video/uvc/uvc_queue.c
968 @@ -104,6 +104,8 @@ static int __uvc_free_buffers(struct uvc_video_queue *queue)
969 }
970
971 if (queue->count) {
972 + uvc_queue_cancel(queue, 0);
973 + INIT_LIST_HEAD(&queue->mainqueue);
974 vfree(queue->mem);
975 queue->count = 0;
976 }
977 diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c
978 index 81d7fa4..150cd70 100644
979 --- a/drivers/misc/lkdtm.c
980 +++ b/drivers/misc/lkdtm.c
981 @@ -120,6 +120,7 @@ static int recur_count = REC_NUM_DEFAULT;
982 static enum cname cpoint = CN_INVALID;
983 static enum ctype cptype = CT_NONE;
984 static int count = DEFAULT_COUNT;
985 +static DEFINE_SPINLOCK(count_lock);
986
987 module_param(recur_count, int, 0644);
988 MODULE_PARM_DESC(recur_count, " Recursion level for the stack overflow test, "\
989 @@ -230,11 +231,14 @@ static const char *cp_name_to_str(enum cname name)
990 static int lkdtm_parse_commandline(void)
991 {
992 int i;
993 + unsigned long flags;
994
995 if (cpoint_count < 1 || recur_count < 1)
996 return -EINVAL;
997
998 + spin_lock_irqsave(&count_lock, flags);
999 count = cpoint_count;
1000 + spin_unlock_irqrestore(&count_lock, flags);
1001
1002 /* No special parameters */
1003 if (!cpoint_type && !cpoint_name)
1004 @@ -349,6 +353,9 @@ static void lkdtm_do_action(enum ctype which)
1005
1006 static void lkdtm_handler(void)
1007 {
1008 + unsigned long flags;
1009 +
1010 + spin_lock_irqsave(&count_lock, flags);
1011 count--;
1012 printk(KERN_INFO "lkdtm: Crash point %s of type %s hit, trigger in %d rounds\n",
1013 cp_name_to_str(cpoint), cp_type_to_str(cptype), count);
1014 @@ -357,6 +364,7 @@ static void lkdtm_handler(void)
1015 lkdtm_do_action(cptype);
1016 count = cpoint_count;
1017 }
1018 + spin_unlock_irqrestore(&count_lock, flags);
1019 }
1020
1021 static int lkdtm_register_cpoint(enum cname which)
1022 diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
1023 index 710339a..b98196c 100644
1024 --- a/drivers/mmc/host/tmio_mmc_pio.c
1025 +++ b/drivers/mmc/host/tmio_mmc_pio.c
1026 @@ -760,8 +760,8 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc)
1027 struct tmio_mmc_host *host = mmc_priv(mmc);
1028 struct tmio_mmc_data *pdata = host->pdata;
1029
1030 - return ((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) ||
1031 - !(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT));
1032 + return !((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) ||
1033 + (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT));
1034 }
1035
1036 static int tmio_mmc_get_cd(struct mmc_host *mmc)
1037 diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
1038 index 3e5d0b6..0d28378 100644
1039 --- a/drivers/net/hamradio/6pack.c
1040 +++ b/drivers/net/hamradio/6pack.c
1041 @@ -692,10 +692,10 @@ static void sixpack_close(struct tty_struct *tty)
1042 {
1043 struct sixpack *sp;
1044
1045 - write_lock(&disc_data_lock);
1046 + write_lock_bh(&disc_data_lock);
1047 sp = tty->disc_data;
1048 tty->disc_data = NULL;
1049 - write_unlock(&disc_data_lock);
1050 + write_unlock_bh(&disc_data_lock);
1051 if (!sp)
1052 return;
1053
1054 diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
1055 index 4c62839..bc02968 100644
1056 --- a/drivers/net/hamradio/mkiss.c
1057 +++ b/drivers/net/hamradio/mkiss.c
1058 @@ -813,10 +813,10 @@ static void mkiss_close(struct tty_struct *tty)
1059 {
1060 struct mkiss *ax;
1061
1062 - write_lock(&disc_data_lock);
1063 + write_lock_bh(&disc_data_lock);
1064 ax = tty->disc_data;
1065 tty->disc_data = NULL;
1066 - write_unlock(&disc_data_lock);
1067 + write_unlock_bh(&disc_data_lock);
1068
1069 if (!ax)
1070 return;
1071 diff --git a/drivers/net/pxa168_eth.c b/drivers/net/pxa168_eth.c
1072 index 89f7540..5f597ca 100644
1073 --- a/drivers/net/pxa168_eth.c
1074 +++ b/drivers/net/pxa168_eth.c
1075 @@ -1273,7 +1273,7 @@ static int pxa168_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
1076 wmb();
1077 wrl(pep, SDMA_CMD, SDMA_CMD_TXDH | SDMA_CMD_ERD);
1078
1079 - stats->tx_bytes += skb->len;
1080 + stats->tx_bytes += length;
1081 stats->tx_packets++;
1082 dev->trans_start = jiffies;
1083 if (pep->tx_ring_size - pep->tx_desc_count <= 1) {
1084 diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
1085 index 349a596..76d5089 100644
1086 --- a/drivers/net/wireless/ath/ath5k/base.c
1087 +++ b/drivers/net/wireless/ath/ath5k/base.c
1088 @@ -72,6 +72,11 @@ static int modparam_all_channels;
1089 module_param_named(all_channels, modparam_all_channels, bool, S_IRUGO);
1090 MODULE_PARM_DESC(all_channels, "Expose all channels the device can use.");
1091
1092 +static int modparam_fastchanswitch;
1093 +module_param_named(fastchanswitch, modparam_fastchanswitch, bool, S_IRUGO);
1094 +MODULE_PARM_DESC(fastchanswitch, "Enable fast channel switching for AR2413/AR5413 radios.");
1095 +
1096 +
1097 /* Module info */
1098 MODULE_AUTHOR("Jiri Slaby");
1099 MODULE_AUTHOR("Nick Kossifidis");
1100 @@ -2644,6 +2649,7 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,
1101 struct ath5k_hw *ah = sc->ah;
1102 struct ath_common *common = ath5k_hw_common(ah);
1103 int ret, ani_mode;
1104 + bool fast;
1105
1106 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n");
1107
1108 @@ -2663,7 +2669,10 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,
1109 ath5k_drain_tx_buffs(sc);
1110 if (chan)
1111 sc->curchan = chan;
1112 - ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, chan != NULL,
1113 +
1114 + fast = ((chan != NULL) && modparam_fastchanswitch) ? 1 : 0;
1115 +
1116 + ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, fast,
1117 skip_pcu);
1118 if (ret) {
1119 ATH5K_ERR(sc, "can't reset hardware (%d)\n", ret);
1120 diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
1121 index efb672c..a33ae01 100644
1122 --- a/drivers/net/wireless/ath/ath5k/eeprom.c
1123 +++ b/drivers/net/wireless/ath/ath5k/eeprom.c
1124 @@ -1565,14 +1565,12 @@ ath5k_eeprom_free_pcal_info(struct ath5k_hw *ah, int mode)
1125 if (!chinfo[pier].pd_curves)
1126 continue;
1127
1128 - for (pdg = 0; pdg < ee->ee_pd_gains[mode]; pdg++) {
1129 + for (pdg = 0; pdg < AR5K_EEPROM_N_PD_CURVES; pdg++) {
1130 struct ath5k_pdgain_info *pd =
1131 &chinfo[pier].pd_curves[pdg];
1132
1133 - if (pd != NULL) {
1134 - kfree(pd->pd_step);
1135 - kfree(pd->pd_pwr);
1136 - }
1137 + kfree(pd->pd_step);
1138 + kfree(pd->pd_pwr);
1139 }
1140
1141 kfree(chinfo[pier].pd_curves);
1142 diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
1143 index 8420689..6f53d2b 100644
1144 --- a/drivers/net/wireless/ath/ath5k/reset.c
1145 +++ b/drivers/net/wireless/ath/ath5k/reset.c
1146 @@ -1119,8 +1119,11 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1147 /* Non fatal, can happen eg.
1148 * on mode change */
1149 ret = 0;
1150 - } else
1151 + } else {
1152 + ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET,
1153 + "fast chan change successful\n");
1154 return 0;
1155 + }
1156 }
1157
1158 /*
1159 diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
1160 index 9c65459..e137212 100644
1161 --- a/drivers/net/wireless/ath/ath9k/pci.c
1162 +++ b/drivers/net/wireless/ath/ath9k/pci.c
1163 @@ -278,6 +278,12 @@ static int ath_pci_suspend(struct device *device)
1164
1165 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
1166
1167 + /* The device has to be moved to FULLSLEEP forcibly.
1168 + * Otherwise the chip never moved to full sleep,
1169 + * when no interface is up.
1170 + */
1171 + ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP);
1172 +
1173 return 0;
1174 }
1175
1176 diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
1177 index 7950bc4..7fd7fe6 100644
1178 --- a/drivers/net/wireless/iwlwifi/iwl-core.c
1179 +++ b/drivers/net/wireless/iwlwifi/iwl-core.c
1180 @@ -1772,6 +1772,7 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1181 struct iwl_priv *priv = hw->priv;
1182 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
1183 struct iwl_rxon_context *tmp;
1184 + enum nl80211_iftype newviftype = newtype;
1185 u32 interface_modes;
1186 int err;
1187
1188 @@ -1814,7 +1815,7 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1189
1190 /* success */
1191 iwl_teardown_interface(priv, vif, true);
1192 - vif->type = newtype;
1193 + vif->type = newviftype;
1194 vif->p2p = newp2p;
1195 err = iwl_setup_interface(priv, ctx);
1196 WARN_ON(err);
1197 diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
1198 index 135df16..46767c5 100644
1199 --- a/drivers/pci/pci-driver.c
1200 +++ b/drivers/pci/pci-driver.c
1201 @@ -624,7 +624,7 @@ static int pci_pm_prepare(struct device *dev)
1202 * system from the sleep state, we'll have to prevent it from signaling
1203 * wake-up.
1204 */
1205 - pm_runtime_resume(dev);
1206 + pm_runtime_get_sync(dev);
1207
1208 if (drv && drv->pm && drv->pm->prepare)
1209 error = drv->pm->prepare(dev);
1210 @@ -638,6 +638,8 @@ static void pci_pm_complete(struct device *dev)
1211
1212 if (drv && drv->pm && drv->pm->complete)
1213 drv->pm->complete(dev);
1214 +
1215 + pm_runtime_put_sync(dev);
1216 }
1217
1218 #else /* !CONFIG_PM_SLEEP */
1219 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1220 index 4b2bbe8..a5747c2 100644
1221 --- a/drivers/pci/quirks.c
1222 +++ b/drivers/pci/quirks.c
1223 @@ -2758,6 +2758,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
1224 }
1225 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
1226 DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
1227 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
1228 +DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
1229 #endif /*CONFIG_MMC_RICOH_MMC*/
1230
1231 #if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
1232 diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c
1233 index dd6a57c..4e051f6 100644
1234 --- a/drivers/staging/lirc/lirc_zilog.c
1235 +++ b/drivers/staging/lirc/lirc_zilog.c
1236 @@ -475,14 +475,14 @@ static int lirc_thread(void *arg)
1237 dprintk("poll thread started\n");
1238
1239 while (!kthread_should_stop()) {
1240 + set_current_state(TASK_INTERRUPTIBLE);
1241 +
1242 /* if device not opened, we can sleep half a second */
1243 if (atomic_read(&ir->open_count) == 0) {
1244 schedule_timeout(HZ/2);
1245 continue;
1246 }
1247
1248 - set_current_state(TASK_INTERRUPTIBLE);
1249 -
1250 /*
1251 * This is ~113*2 + 24 + jitter (2*repeat gap + code length).
1252 * We use this interval as the chip resets every time you poll
1253 diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
1254 index 26403b8..da9270e 100644
1255 --- a/drivers/tty/serial/pch_uart.c
1256 +++ b/drivers/tty/serial/pch_uart.c
1257 @@ -1392,6 +1392,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
1258 int fifosize, base_baud;
1259 int port_type;
1260 struct pch_uart_driver_data *board;
1261 + const char *board_name;
1262
1263 board = &drv_dat[id->driver_data];
1264 port_type = board->port_type;
1265 @@ -1407,7 +1408,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
1266 base_baud = 1843200; /* 1.8432MHz */
1267
1268 /* quirk for CM-iTC board */
1269 - if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC"))
1270 + board_name = dmi_get_system_info(DMI_BOARD_NAME);
1271 + if (board_name && strstr(board_name, "CM-iTC"))
1272 base_baud = 192000000; /* 192.0MHz */
1273
1274 switch (port_type) {
1275 diff --git a/drivers/tty/serial/s5pv210.c b/drivers/tty/serial/s5pv210.c
1276 index 6ebccd7..453e5b7 100644
1277 --- a/drivers/tty/serial/s5pv210.c
1278 +++ b/drivers/tty/serial/s5pv210.c
1279 @@ -31,7 +31,7 @@ static int s5pv210_serial_setsource(struct uart_port *port,
1280 struct s3c2410_uartcfg *cfg = port->dev->platform_data;
1281 unsigned long ucon = rd_regl(port, S3C2410_UCON);
1282
1283 - if ((cfg->clocks_size) == 1)
1284 + if (cfg->flags & NO_NEED_CHECK_CLKSRC)
1285 return 0;
1286
1287 if (strcmp(clk->name, "pclk") == 0)
1288 @@ -56,7 +56,7 @@ static int s5pv210_serial_getsource(struct uart_port *port,
1289
1290 clk->divisor = 1;
1291
1292 - if ((cfg->clocks_size) == 1)
1293 + if (cfg->flags & NO_NEED_CHECK_CLKSRC)
1294 return 0;
1295
1296 switch (ucon & S5PV210_UCON_CLKMASK) {
1297 diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
1298 index e19e136..1104c9d 100644
1299 --- a/drivers/tty/tty_ldisc.c
1300 +++ b/drivers/tty/tty_ldisc.c
1301 @@ -555,7 +555,7 @@ static void tty_ldisc_flush_works(struct tty_struct *tty)
1302 static int tty_ldisc_wait_idle(struct tty_struct *tty)
1303 {
1304 int ret;
1305 - ret = wait_event_interruptible_timeout(tty_ldisc_idle,
1306 + ret = wait_event_timeout(tty_ldisc_idle,
1307 atomic_read(&tty->ldisc->users) == 1, 5 * HZ);
1308 if (ret < 0)
1309 return ret;
1310 @@ -763,6 +763,8 @@ static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
1311 if (IS_ERR(ld))
1312 return -1;
1313
1314 + WARN_ON_ONCE(tty_ldisc_wait_idle(tty));
1315 +
1316 tty_ldisc_close(tty, tty->ldisc);
1317 tty_ldisc_put(tty->ldisc);
1318 tty->ldisc = NULL;
1319 diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
1320 index e35a176..34e3da5 100644
1321 --- a/drivers/usb/core/driver.c
1322 +++ b/drivers/usb/core/driver.c
1323 @@ -375,7 +375,7 @@ static int usb_unbind_interface(struct device *dev)
1324 * Just re-enable it without affecting the endpoint toggles.
1325 */
1326 usb_enable_interface(udev, intf, false);
1327 - } else if (!error && !intf->dev.power.in_suspend) {
1328 + } else if (!error && !intf->dev.power.is_prepared) {
1329 r = usb_set_interface(udev, intf->altsetting[0].
1330 desc.bInterfaceNumber, 0);
1331 if (r < 0)
1332 @@ -960,7 +960,7 @@ void usb_rebind_intf(struct usb_interface *intf)
1333 }
1334
1335 /* Try to rebind the interface */
1336 - if (!intf->dev.power.in_suspend) {
1337 + if (!intf->dev.power.is_prepared) {
1338 intf->needs_binding = 0;
1339 rc = device_attach(&intf->dev);
1340 if (rc < 0)
1341 @@ -1107,7 +1107,7 @@ static int usb_resume_interface(struct usb_device *udev,
1342 if (intf->condition == USB_INTERFACE_UNBOUND) {
1343
1344 /* Carry out a deferred switch to altsetting 0 */
1345 - if (intf->needs_altsetting0 && !intf->dev.power.in_suspend) {
1346 + if (intf->needs_altsetting0 && !intf->dev.power.is_prepared) {
1347 usb_set_interface(udev, intf->altsetting[0].
1348 desc.bInterfaceNumber, 0);
1349 intf->needs_altsetting0 = 0;
1350 @@ -1187,13 +1187,22 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1351 for (i = n - 1; i >= 0; --i) {
1352 intf = udev->actconfig->interface[i];
1353 status = usb_suspend_interface(udev, intf, msg);
1354 +
1355 + /* Ignore errors during system sleep transitions */
1356 + if (!(msg.event & PM_EVENT_AUTO))
1357 + status = 0;
1358 if (status != 0)
1359 break;
1360 }
1361 }
1362 - if (status == 0)
1363 + if (status == 0) {
1364 status = usb_suspend_device(udev, msg);
1365
1366 + /* Again, ignore errors during system sleep transitions */
1367 + if (!(msg.event & PM_EVENT_AUTO))
1368 + status = 0;
1369 + }
1370 +
1371 /* If the suspend failed, resume interfaces that did get suspended */
1372 if (status != 0) {
1373 msg.event ^= (PM_EVENT_SUSPEND | PM_EVENT_RESUME);
1374 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1375 index 78e7f25..64edb30 100644
1376 --- a/drivers/usb/core/hub.c
1377 +++ b/drivers/usb/core/hub.c
1378 @@ -1643,6 +1643,7 @@ void usb_disconnect(struct usb_device **pdev)
1379 {
1380 struct usb_device *udev = *pdev;
1381 int i;
1382 + struct usb_hcd *hcd = bus_to_hcd(udev->bus);
1383
1384 if (!udev) {
1385 pr_debug ("%s nodev\n", __func__);
1386 @@ -1670,7 +1671,9 @@ void usb_disconnect(struct usb_device **pdev)
1387 * so that the hardware is now fully quiesced.
1388 */
1389 dev_dbg (&udev->dev, "unregistering device\n");
1390 + mutex_lock(hcd->bandwidth_mutex);
1391 usb_disable_device(udev, 0);
1392 + mutex_unlock(hcd->bandwidth_mutex);
1393 usb_hcd_synchronize_unlinks(udev);
1394
1395 usb_remove_ep_devs(&udev->ep0);
1396 @@ -2308,6 +2311,10 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
1397 USB_DEVICE_REMOTE_WAKEUP, 0,
1398 NULL, 0,
1399 USB_CTRL_SET_TIMEOUT);
1400 +
1401 + /* System sleep transitions should never fail */
1402 + if (!(msg.event & PM_EVENT_AUTO))
1403 + status = 0;
1404 } else {
1405 /* device has up to 10 msec to fully suspend */
1406 dev_dbg(&udev->dev, "usb %ssuspend\n",
1407 @@ -2546,16 +2553,15 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
1408 struct usb_device *hdev = hub->hdev;
1409 unsigned port1;
1410
1411 - /* fail if children aren't already suspended */
1412 + /* Warn if children aren't already suspended */
1413 for (port1 = 1; port1 <= hdev->maxchild; port1++) {
1414 struct usb_device *udev;
1415
1416 udev = hdev->children [port1-1];
1417 if (udev && udev->can_submit) {
1418 - if (!(msg.event & PM_EVENT_AUTO))
1419 - dev_dbg(&intf->dev, "port %d nyet suspended\n",
1420 - port1);
1421 - return -EBUSY;
1422 + dev_warn(&intf->dev, "port %d nyet suspended\n", port1);
1423 + if (msg.event & PM_EVENT_AUTO)
1424 + return -EBUSY;
1425 }
1426 }
1427
1428 diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
1429 index 5701e85..0b5ec23 100644
1430 --- a/drivers/usb/core/message.c
1431 +++ b/drivers/usb/core/message.c
1432 @@ -1135,15 +1135,26 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf,
1433 * Deallocates hcd/hardware state for the endpoints (nuking all or most
1434 * pending urbs) and usbcore state for the interfaces, so that usbcore
1435 * must usb_set_configuration() before any interfaces could be used.
1436 + *
1437 + * Must be called with hcd->bandwidth_mutex held.
1438 */
1439 void usb_disable_device(struct usb_device *dev, int skip_ep0)
1440 {
1441 int i;
1442 + struct usb_hcd *hcd = bus_to_hcd(dev->bus);
1443
1444 /* getting rid of interfaces will disconnect
1445 * any drivers bound to them (a key side effect)
1446 */
1447 if (dev->actconfig) {
1448 + /*
1449 + * FIXME: In order to avoid self-deadlock involving the
1450 + * bandwidth_mutex, we have to mark all the interfaces
1451 + * before unregistering any of them.
1452 + */
1453 + for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++)
1454 + dev->actconfig->interface[i]->unregistering = 1;
1455 +
1456 for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
1457 struct usb_interface *interface;
1458
1459 @@ -1153,7 +1164,6 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1460 continue;
1461 dev_dbg(&dev->dev, "unregistering interface %s\n",
1462 dev_name(&interface->dev));
1463 - interface->unregistering = 1;
1464 remove_intf_ep_devs(interface);
1465 device_del(&interface->dev);
1466 }
1467 @@ -1172,6 +1182,16 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1468
1469 dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__,
1470 skip_ep0 ? "non-ep0" : "all");
1471 + if (hcd->driver->check_bandwidth) {
1472 + /* First pass: Cancel URBs, leave endpoint pointers intact. */
1473 + for (i = skip_ep0; i < 16; ++i) {
1474 + usb_disable_endpoint(dev, i, false);
1475 + usb_disable_endpoint(dev, i + USB_DIR_IN, false);
1476 + }
1477 + /* Remove endpoints from the host controller internal state */
1478 + usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
1479 + /* Second pass: remove endpoint pointers */
1480 + }
1481 for (i = skip_ep0; i < 16; ++i) {
1482 usb_disable_endpoint(dev, i, true);
1483 usb_disable_endpoint(dev, i + USB_DIR_IN, true);
1484 @@ -1273,6 +1293,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1485 interface);
1486 return -EINVAL;
1487 }
1488 + if (iface->unregistering)
1489 + return -ENODEV;
1490
1491 alt = usb_altnum_to_altsetting(iface, alternate);
1492 if (!alt) {
1493 @@ -1727,6 +1749,7 @@ free_interfaces:
1494 /* if it's already configured, clear out old state first.
1495 * getting rid of old interfaces means unbinding their drivers.
1496 */
1497 + mutex_lock(hcd->bandwidth_mutex);
1498 if (dev->state != USB_STATE_ADDRESS)
1499 usb_disable_device(dev, 1); /* Skip ep0 */
1500
1501 @@ -1739,7 +1762,6 @@ free_interfaces:
1502 * host controller will not allow submissions to dropped endpoints. If
1503 * this call fails, the device state is unchanged.
1504 */
1505 - mutex_lock(hcd->bandwidth_mutex);
1506 ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL);
1507 if (ret < 0) {
1508 mutex_unlock(hcd->bandwidth_mutex);
1509 diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
1510 index 4940717..6fce318 100644
1511 --- a/drivers/usb/host/xhci-pci.c
1512 +++ b/drivers/usb/host/xhci-pci.c
1513 @@ -28,6 +28,9 @@
1514 #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73
1515 #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000
1516
1517 +#define PCI_VENDOR_ID_ETRON 0x1b6f
1518 +#define PCI_DEVICE_ID_ASROCK_P67 0x7023
1519 +
1520 static const char hcd_name[] = "xhci_hcd";
1521
1522 /* called after powerup, by probe or system-pm "wakeup" */
1523 @@ -120,6 +123,11 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
1524 "has broken MSI implementation\n",
1525 pdev->revision);
1526 }
1527 + if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
1528 + pdev->device == PCI_DEVICE_ID_ASROCK_P67) {
1529 + xhci->quirks |= XHCI_RESET_ON_RESUME;
1530 + xhci_dbg(xhci, "QUIRK: Resetting on resume\n");
1531 + }
1532
1533 if (pdev->vendor == PCI_VENDOR_ID_NEC)
1534 xhci->quirks |= XHCI_NEC_HOST;
1535 diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1536 index 078b566..a5e96cb 100644
1537 --- a/drivers/usb/host/xhci-ring.c
1538 +++ b/drivers/usb/host/xhci-ring.c
1539 @@ -1768,9 +1768,6 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1540 }
1541 }
1542
1543 - if ((idx == urb_priv->length - 1) && *status == -EINPROGRESS)
1544 - *status = 0;
1545 -
1546 return finish_td(xhci, td, event_trb, event, ep, status, false);
1547 }
1548
1549 @@ -1788,8 +1785,7 @@ static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1550 idx = urb_priv->td_cnt;
1551 frame = &td->urb->iso_frame_desc[idx];
1552
1553 - /* The transfer is partly done */
1554 - *status = -EXDEV;
1555 + /* The transfer is partly done. */
1556 frame->status = -EXDEV;
1557
1558 /* calc actual length */
1559 @@ -2139,6 +2135,11 @@ cleanup:
1560 "status = %d\n",
1561 urb, urb->actual_length, status);
1562 spin_unlock(&xhci->lock);
1563 + /* EHCI, UHCI, and OHCI always unconditionally set the
1564 + * urb->status of an isochronous endpoint to 0.
1565 + */
1566 + if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS)
1567 + status = 0;
1568 usb_hcd_giveback_urb(bus_to_hcd(urb->dev->bus), urb, status);
1569 spin_lock(&xhci->lock);
1570 }
1571 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1572 index e5c4861..4209b02 100644
1573 --- a/drivers/usb/host/xhci.c
1574 +++ b/drivers/usb/host/xhci.c
1575 @@ -759,6 +759,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
1576 msleep(100);
1577
1578 spin_lock_irq(&xhci->lock);
1579 + if (xhci->quirks & XHCI_RESET_ON_RESUME)
1580 + hibernated = true;
1581
1582 if (!hibernated) {
1583 /* step 1: restore register */
1584 @@ -1396,6 +1398,7 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
1585 u32 added_ctxs;
1586 unsigned int last_ctx;
1587 u32 new_add_flags, new_drop_flags, new_slot_info;
1588 + struct xhci_virt_device *virt_dev;
1589 int ret = 0;
1590
1591 ret = xhci_check_args(hcd, udev, ep, 1, true, __func__);
1592 @@ -1418,11 +1421,25 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
1593 return 0;
1594 }
1595
1596 - in_ctx = xhci->devs[udev->slot_id]->in_ctx;
1597 - out_ctx = xhci->devs[udev->slot_id]->out_ctx;
1598 + virt_dev = xhci->devs[udev->slot_id];
1599 + in_ctx = virt_dev->in_ctx;
1600 + out_ctx = virt_dev->out_ctx;
1601 ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx);
1602 ep_index = xhci_get_endpoint_index(&ep->desc);
1603 ep_ctx = xhci_get_ep_ctx(xhci, out_ctx, ep_index);
1604 +
1605 + /* If this endpoint is already in use, and the upper layers are trying
1606 + * to add it again without dropping it, reject the addition.
1607 + */
1608 + if (virt_dev->eps[ep_index].ring &&
1609 + !(le32_to_cpu(ctrl_ctx->drop_flags) &
1610 + xhci_get_endpoint_flag(&ep->desc))) {
1611 + xhci_warn(xhci, "Trying to add endpoint 0x%x "
1612 + "without dropping it.\n",
1613 + (unsigned int) ep->desc.bEndpointAddress);
1614 + return -EINVAL;
1615 + }
1616 +
1617 /* If the HCD has already noted the endpoint is enabled,
1618 * ignore this request.
1619 */
1620 @@ -1437,8 +1454,7 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
1621 * process context, not interrupt context (or so documenation
1622 * for usb_set_interface() and usb_set_configuration() claim).
1623 */
1624 - if (xhci_endpoint_init(xhci, xhci->devs[udev->slot_id],
1625 - udev, ep, GFP_NOIO) < 0) {
1626 + if (xhci_endpoint_init(xhci, virt_dev, udev, ep, GFP_NOIO) < 0) {
1627 dev_dbg(&udev->dev, "%s - could not initialize ep %#x\n",
1628 __func__, ep->desc.bEndpointAddress);
1629 return -ENOMEM;
1630 diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
1631 index fb85ce3..1e52d5e 100644
1632 --- a/drivers/usb/host/xhci.h
1633 +++ b/drivers/usb/host/xhci.h
1634 @@ -1287,6 +1287,7 @@ struct xhci_hcd {
1635 #define XHCI_NEC_HOST (1 << 2)
1636 #define XHCI_AMD_PLL_FIX (1 << 3)
1637 #define XHCI_BROKEN_MSI (1 << 6)
1638 +#define XHCI_RESET_ON_RESUME (1 << 7)
1639 /* There are two roothubs to keep track of bus suspend info for */
1640 struct xhci_bus_state bus_state[2];
1641 /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */
1642 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1643 index 1627289..2e06b90 100644
1644 --- a/drivers/usb/serial/ftdi_sio.c
1645 +++ b/drivers/usb/serial/ftdi_sio.c
1646 @@ -179,6 +179,7 @@ static struct usb_device_id id_table_combined [] = {
1647 { USB_DEVICE(FTDI_VID, FTDI_232RL_PID) },
1648 { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) },
1649 { USB_DEVICE(FTDI_VID, FTDI_4232H_PID) },
1650 + { USB_DEVICE(FTDI_VID, FTDI_232H_PID) },
1651 { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) },
1652 { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) },
1653 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) },
1654 @@ -848,7 +849,8 @@ static const char *ftdi_chip_name[] = {
1655 [FT2232C] = "FT2232C",
1656 [FT232RL] = "FT232RL",
1657 [FT2232H] = "FT2232H",
1658 - [FT4232H] = "FT4232H"
1659 + [FT4232H] = "FT4232H",
1660 + [FT232H] = "FT232H"
1661 };
1662
1663
1664 @@ -1168,6 +1170,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
1665 break;
1666 case FT2232H: /* FT2232H chip */
1667 case FT4232H: /* FT4232H chip */
1668 + case FT232H: /* FT232H chip */
1669 if ((baud <= 12000000) & (baud >= 1200)) {
1670 div_value = ftdi_2232h_baud_to_divisor(baud);
1671 } else if (baud < 1200) {
1672 @@ -1429,9 +1432,12 @@ static void ftdi_determine_type(struct usb_serial_port *port)
1673 } else if (version < 0x600) {
1674 /* Assume it's an FT232BM (or FT245BM) */
1675 priv->chip_type = FT232BM;
1676 - } else {
1677 - /* Assume it's an FT232R */
1678 + } else if (version < 0x900) {
1679 + /* Assume it's an FT232RL */
1680 priv->chip_type = FT232RL;
1681 + } else {
1682 + /* Assume it's an FT232H */
1683 + priv->chip_type = FT232H;
1684 }
1685 dev_info(&udev->dev, "Detected %s\n", ftdi_chip_name[priv->chip_type]);
1686 }
1687 @@ -1559,7 +1565,8 @@ static int create_sysfs_attrs(struct usb_serial_port *port)
1688 priv->chip_type == FT2232C ||
1689 priv->chip_type == FT232RL ||
1690 priv->chip_type == FT2232H ||
1691 - priv->chip_type == FT4232H)) {
1692 + priv->chip_type == FT4232H ||
1693 + priv->chip_type == FT232H)) {
1694 retval = device_create_file(&port->dev,
1695 &dev_attr_latency_timer);
1696 }
1697 @@ -1580,7 +1587,8 @@ static void remove_sysfs_attrs(struct usb_serial_port *port)
1698 priv->chip_type == FT2232C ||
1699 priv->chip_type == FT232RL ||
1700 priv->chip_type == FT2232H ||
1701 - priv->chip_type == FT4232H) {
1702 + priv->chip_type == FT4232H ||
1703 + priv->chip_type == FT232H) {
1704 device_remove_file(&port->dev, &dev_attr_latency_timer);
1705 }
1706 }
1707 @@ -2212,6 +2220,7 @@ static int ftdi_tiocmget(struct tty_struct *tty)
1708 case FT232RL:
1709 case FT2232H:
1710 case FT4232H:
1711 + case FT232H:
1712 len = 2;
1713 break;
1714 default:
1715 diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
1716 index 213fe3d..19584fa 100644
1717 --- a/drivers/usb/serial/ftdi_sio.h
1718 +++ b/drivers/usb/serial/ftdi_sio.h
1719 @@ -156,7 +156,8 @@ enum ftdi_chip_type {
1720 FT2232C = 4,
1721 FT232RL = 5,
1722 FT2232H = 6,
1723 - FT4232H = 7
1724 + FT4232H = 7,
1725 + FT232H = 8
1726 };
1727
1728 enum ftdi_sio_baudrate {
1729 diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1730 index ab1fcdf..19156d1 100644
1731 --- a/drivers/usb/serial/ftdi_sio_ids.h
1732 +++ b/drivers/usb/serial/ftdi_sio_ids.h
1733 @@ -22,6 +22,7 @@
1734 #define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */
1735 #define FTDI_8U2232C_PID 0x6010 /* Dual channel device */
1736 #define FTDI_4232H_PID 0x6011 /* Quad channel hi-speed device */
1737 +#define FTDI_232H_PID 0x6014 /* Single channel hi-speed device */
1738 #define FTDI_SIO_PID 0x8372 /* Product Id SIO application of 8U100AX */
1739 #define FTDI_232RL_PID 0xFBFA /* Product ID for FT232RL */
1740
1741 diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c
1742 index 5ec5ac1..befbe80 100644
1743 --- a/drivers/watchdog/mtx-1_wdt.c
1744 +++ b/drivers/watchdog/mtx-1_wdt.c
1745 @@ -211,6 +211,12 @@ static int __devinit mtx1_wdt_probe(struct platform_device *pdev)
1746 int ret;
1747
1748 mtx1_wdt_device.gpio = pdev->resource[0].start;
1749 + ret = gpio_request_one(mtx1_wdt_device.gpio,
1750 + GPIOF_OUT_INIT_HIGH, "mtx1-wdt");
1751 + if (ret < 0) {
1752 + dev_err(&pdev->dev, "failed to request gpio");
1753 + return ret;
1754 + }
1755
1756 spin_lock_init(&mtx1_wdt_device.lock);
1757 init_completion(&mtx1_wdt_device.stop);
1758 @@ -236,6 +242,8 @@ static int __devexit mtx1_wdt_remove(struct platform_device *pdev)
1759 mtx1_wdt_device.queue = 0;
1760 wait_for_completion(&mtx1_wdt_device.stop);
1761 }
1762 +
1763 + gpio_free(mtx1_wdt_device.gpio);
1764 misc_deregister(&mtx1_wdt_misc);
1765 return 0;
1766 }
1767 diff --git a/fs/block_dev.c b/fs/block_dev.c
1768 index 1a2421f..610e8e0 100644
1769 --- a/fs/block_dev.c
1770 +++ b/fs/block_dev.c
1771 @@ -762,7 +762,19 @@ static struct block_device *bd_start_claiming(struct block_device *bdev,
1772 if (!disk)
1773 return ERR_PTR(-ENXIO);
1774
1775 - whole = bdget_disk(disk, 0);
1776 + /*
1777 + * Normally, @bdev should equal what's returned from bdget_disk()
1778 + * if partno is 0; however, some drivers (floppy) use multiple
1779 + * bdev's for the same physical device and @bdev may be one of the
1780 + * aliases. Keep @bdev if partno is 0. This means claimer
1781 + * tracking is broken for those devices but it has always been that
1782 + * way.
1783 + */
1784 + if (partno)
1785 + whole = bdget_disk(disk, 0);
1786 + else
1787 + whole = bdgrab(bdev);
1788 +
1789 module_put(disk->fops->owner);
1790 put_disk(disk);
1791 if (!whole)
1792 diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c
1793 index 297a43d..05268cf 100644
1794 --- a/fs/cifs/fscache.c
1795 +++ b/fs/cifs/fscache.c
1796 @@ -94,6 +94,7 @@ static void cifs_fscache_disable_inode_cookie(struct inode *inode)
1797 if (cifsi->fscache) {
1798 cFYI(1, "CIFS disabling inode cookie (0x%p)",
1799 cifsi->fscache);
1800 + fscache_uncache_all_inode_pages(cifsi->fscache, inode);
1801 fscache_relinquish_cookie(cifsi->fscache, 1);
1802 cifsi->fscache = NULL;
1803 }
1804 diff --git a/fs/fscache/page.c b/fs/fscache/page.c
1805 index 41c441c..52b59e2 100644
1806 --- a/fs/fscache/page.c
1807 +++ b/fs/fscache/page.c
1808 @@ -967,3 +967,47 @@ void fscache_mark_pages_cached(struct fscache_retrieval *op,
1809 pagevec_reinit(pagevec);
1810 }
1811 EXPORT_SYMBOL(fscache_mark_pages_cached);
1812 +
1813 +/*
1814 + * Uncache all the pages in an inode that are marked PG_fscache, assuming them
1815 + * to be associated with the given cookie.
1816 + */
1817 +void __fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,
1818 + struct inode *inode)
1819 +{
1820 + struct address_space *mapping = inode->i_mapping;
1821 + struct pagevec pvec;
1822 + pgoff_t next;
1823 + int i;
1824 +
1825 + _enter("%p,%p", cookie, inode);
1826 +
1827 + if (!mapping || mapping->nrpages == 0) {
1828 + _leave(" [no pages]");
1829 + return;
1830 + }
1831 +
1832 + pagevec_init(&pvec, 0);
1833 + next = 0;
1834 + while (next <= (loff_t)-1 &&
1835 + pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)
1836 + ) {
1837 + for (i = 0; i < pagevec_count(&pvec); i++) {
1838 + struct page *page = pvec.pages[i];
1839 + pgoff_t page_index = page->index;
1840 +
1841 + ASSERTCMP(page_index, >=, next);
1842 + next = page_index + 1;
1843 +
1844 + if (PageFsCache(page)) {
1845 + __fscache_wait_on_page_write(cookie, page);
1846 + __fscache_uncache_page(cookie, page);
1847 + }
1848 + }
1849 + pagevec_release(&pvec);
1850 + cond_resched();
1851 + }
1852 +
1853 + _leave("");
1854 +}
1855 +EXPORT_SYMBOL(__fscache_uncache_all_inode_pages);
1856 diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
1857 index 3031d81..4ac88ff 100644
1858 --- a/fs/hfsplus/wrapper.c
1859 +++ b/fs/hfsplus/wrapper.c
1860 @@ -36,6 +36,7 @@ int hfsplus_submit_bio(struct block_device *bdev, sector_t sector,
1861 {
1862 DECLARE_COMPLETION_ONSTACK(wait);
1863 struct bio *bio;
1864 + int ret = 0;
1865
1866 bio = bio_alloc(GFP_NOIO, 1);
1867 bio->bi_sector = sector;
1868 @@ -54,8 +55,10 @@ int hfsplus_submit_bio(struct block_device *bdev, sector_t sector,
1869 wait_for_completion(&wait);
1870
1871 if (!bio_flagged(bio, BIO_UPTODATE))
1872 - return -EIO;
1873 - return 0;
1874 + ret = -EIO;
1875 +
1876 + bio_put(bio);
1877 + return ret;
1878 }
1879
1880 static int hfsplus_read_mdb(void *bufptr, struct hfsplus_wd *wd)
1881 diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
1882 index adb45ec..e374050 100644
1883 --- a/fs/lockd/clntproc.c
1884 +++ b/fs/lockd/clntproc.c
1885 @@ -708,7 +708,13 @@ static void nlmclnt_unlock_callback(struct rpc_task *task, void *data)
1886
1887 if (task->tk_status < 0) {
1888 dprintk("lockd: unlock failed (err = %d)\n", -task->tk_status);
1889 - goto retry_rebind;
1890 + switch (task->tk_status) {
1891 + case -EACCES:
1892 + case -EIO:
1893 + goto die;
1894 + default:
1895 + goto retry_rebind;
1896 + }
1897 }
1898 if (status == NLM_LCK_DENIED_GRACE_PERIOD) {
1899 rpc_delay(task, NLMCLNT_GRACE_WAIT);
1900 diff --git a/fs/locks.c b/fs/locks.c
1901 index 0a4f50d..b286539 100644
1902 --- a/fs/locks.c
1903 +++ b/fs/locks.c
1904 @@ -160,10 +160,28 @@ EXPORT_SYMBOL_GPL(unlock_flocks);
1905
1906 static struct kmem_cache *filelock_cache __read_mostly;
1907
1908 +static void locks_init_lock_always(struct file_lock *fl)
1909 +{
1910 + fl->fl_next = NULL;
1911 + fl->fl_fasync = NULL;
1912 + fl->fl_owner = NULL;
1913 + fl->fl_pid = 0;
1914 + fl->fl_nspid = NULL;
1915 + fl->fl_file = NULL;
1916 + fl->fl_flags = 0;
1917 + fl->fl_type = 0;
1918 + fl->fl_start = fl->fl_end = 0;
1919 +}
1920 +
1921 /* Allocate an empty lock structure. */
1922 struct file_lock *locks_alloc_lock(void)
1923 {
1924 - return kmem_cache_alloc(filelock_cache, GFP_KERNEL);
1925 + struct file_lock *fl = kmem_cache_alloc(filelock_cache, GFP_KERNEL);
1926 +
1927 + if (fl)
1928 + locks_init_lock_always(fl);
1929 +
1930 + return fl;
1931 }
1932 EXPORT_SYMBOL_GPL(locks_alloc_lock);
1933
1934 @@ -200,17 +218,9 @@ void locks_init_lock(struct file_lock *fl)
1935 INIT_LIST_HEAD(&fl->fl_link);
1936 INIT_LIST_HEAD(&fl->fl_block);
1937 init_waitqueue_head(&fl->fl_wait);
1938 - fl->fl_next = NULL;
1939 - fl->fl_fasync = NULL;
1940 - fl->fl_owner = NULL;
1941 - fl->fl_pid = 0;
1942 - fl->fl_nspid = NULL;
1943 - fl->fl_file = NULL;
1944 - fl->fl_flags = 0;
1945 - fl->fl_type = 0;
1946 - fl->fl_start = fl->fl_end = 0;
1947 fl->fl_ops = NULL;
1948 fl->fl_lmops = NULL;
1949 + locks_init_lock_always(fl);
1950 }
1951
1952 EXPORT_SYMBOL(locks_init_lock);
1953 diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
1954 index ce153a6..419119c 100644
1955 --- a/fs/nfs/fscache.c
1956 +++ b/fs/nfs/fscache.c
1957 @@ -259,12 +259,10 @@ static void nfs_fscache_disable_inode_cookie(struct inode *inode)
1958 dfprintk(FSCACHE,
1959 "NFS: nfsi 0x%p turning cache off\n", NFS_I(inode));
1960
1961 - /* Need to invalidate any mapped pages that were read in before
1962 - * turning off the cache.
1963 + /* Need to uncache any pages attached to this inode that
1964 + * fscache knows about before turning off the cache.
1965 */
1966 - if (inode->i_mapping && inode->i_mapping->nrpages)
1967 - invalidate_inode_pages2(inode->i_mapping);
1968 -
1969 + fscache_uncache_all_inode_pages(NFS_I(inode)->fscache, inode);
1970 nfs_fscache_zap_inode_cookie(inode);
1971 }
1972 }
1973 diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
1974 index 57bb31a..19877db 100644
1975 --- a/fs/nfs/inode.c
1976 +++ b/fs/nfs/inode.c
1977 @@ -256,7 +256,8 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
1978
1979 nfs_attr_check_mountpoint(sb, fattr);
1980
1981 - if ((fattr->valid & NFS_ATTR_FATTR_FILEID) == 0 && (fattr->valid & NFS_ATTR_FATTR_MOUNTPOINT) == 0)
1982 + if (((fattr->valid & NFS_ATTR_FATTR_FILEID) == 0) &&
1983 + !nfs_attr_use_mounted_on_fileid(fattr))
1984 goto out_no_inode;
1985 if ((fattr->valid & NFS_ATTR_FATTR_TYPE) == 0)
1986 goto out_no_inode;
1987 @@ -1294,7 +1295,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1988 if (new_isize != cur_isize) {
1989 /* Do we perhaps have any outstanding writes, or has
1990 * the file grown beyond our last write? */
1991 - if (nfsi->npages == 0 || new_isize > cur_isize) {
1992 + if ((nfsi->npages == 0 && !test_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags)) ||
1993 + new_isize > cur_isize) {
1994 i_size_write(inode, new_isize);
1995 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;
1996 }
1997 diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
1998 index ce118ce..d10eb7e 100644
1999 --- a/fs/nfs/internal.h
2000 +++ b/fs/nfs/internal.h
2001 @@ -45,6 +45,17 @@ static inline void nfs_attr_check_mountpoint(struct super_block *parent, struct
2002 fattr->valid |= NFS_ATTR_FATTR_MOUNTPOINT;
2003 }
2004
2005 +static inline int nfs_attr_use_mounted_on_fileid(struct nfs_fattr *fattr)
2006 +{
2007 + if (((fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) == 0) ||
2008 + (((fattr->valid & NFS_ATTR_FATTR_MOUNTPOINT) == 0) &&
2009 + ((fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) == 0)))
2010 + return 0;
2011 +
2012 + fattr->fileid = fattr->mounted_on_fileid;
2013 + return 1;
2014 +}
2015 +
2016 struct nfs_clone_mount {
2017 const struct super_block *sb;
2018 const struct dentry *dentry;
2019 diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
2020 index be79dc9..590c09c 100644
2021 --- a/fs/nfs/nfs4filelayout.c
2022 +++ b/fs/nfs/nfs4filelayout.c
2023 @@ -554,13 +554,18 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo,
2024 __func__, nfl_util, fl->num_fh, fl->first_stripe_index,
2025 fl->pattern_offset);
2026
2027 - if (!fl->num_fh)
2028 + /* Note that a zero value for num_fh is legal for STRIPE_SPARSE.
2029 + * Futher checking is done in filelayout_check_layout */
2030 + if (fl->num_fh < 0 || fl->num_fh >
2031 + max(NFS4_PNFS_MAX_STRIPE_CNT, NFS4_PNFS_MAX_MULTI_CNT))
2032 goto out_err;
2033
2034 - fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *),
2035 - gfp_flags);
2036 - if (!fl->fh_array)
2037 - goto out_err;
2038 + if (fl->num_fh > 0) {
2039 + fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *),
2040 + gfp_flags);
2041 + if (!fl->fh_array)
2042 + goto out_err;
2043 + }
2044
2045 for (i = 0; i < fl->num_fh; i++) {
2046 /* Do we want to use a mempool here? */
2047 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
2048 index d0e15db..d348326 100644
2049 --- a/fs/nfs/nfs4proc.c
2050 +++ b/fs/nfs/nfs4proc.c
2051 @@ -2265,12 +2265,14 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
2052 return nfs4_map_errors(status);
2053 }
2054
2055 +static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr);
2056 /*
2057 * Get locations and (maybe) other attributes of a referral.
2058 * Note that we'll actually follow the referral later when
2059 * we detect fsid mismatch in inode revalidation
2060 */
2061 -static int nfs4_get_referral(struct inode *dir, const struct qstr *name, struct nfs_fattr *fattr, struct nfs_fh *fhandle)
2062 +static int nfs4_get_referral(struct inode *dir, const struct qstr *name,
2063 + struct nfs_fattr *fattr, struct nfs_fh *fhandle)
2064 {
2065 int status = -ENOMEM;
2066 struct page *page = NULL;
2067 @@ -2288,15 +2290,16 @@ static int nfs4_get_referral(struct inode *dir, const struct qstr *name, struct
2068 goto out;
2069 /* Make sure server returned a different fsid for the referral */
2070 if (nfs_fsid_equal(&NFS_SERVER(dir)->fsid, &locations->fattr.fsid)) {
2071 - dprintk("%s: server did not return a different fsid for a referral at %s\n", __func__, name->name);
2072 + dprintk("%s: server did not return a different fsid for"
2073 + " a referral at %s\n", __func__, name->name);
2074 status = -EIO;
2075 goto out;
2076 }
2077 + /* Fixup attributes for the nfs_lookup() call to nfs_fhget() */
2078 + nfs_fixup_referral_attributes(&locations->fattr);
2079
2080 + /* replace the lookup nfs_fattr with the locations nfs_fattr */
2081 memcpy(fattr, &locations->fattr, sizeof(struct nfs_fattr));
2082 - fattr->valid |= NFS_ATTR_FATTR_V4_REFERRAL;
2083 - if (!fattr->mode)
2084 - fattr->mode = S_IFDIR;
2085 memset(fhandle, 0, sizeof(struct nfs_fh));
2086 out:
2087 if (page)
2088 @@ -4657,11 +4660,15 @@ static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list,
2089 return len;
2090 }
2091
2092 +/*
2093 + * nfs_fhget will use either the mounted_on_fileid or the fileid
2094 + */
2095 static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr)
2096 {
2097 - if (!((fattr->valid & NFS_ATTR_FATTR_FILEID) &&
2098 - (fattr->valid & NFS_ATTR_FATTR_FSID) &&
2099 - (fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL)))
2100 + if (!(((fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) ||
2101 + (fattr->valid & NFS_ATTR_FATTR_FILEID)) &&
2102 + (fattr->valid & NFS_ATTR_FATTR_FSID) &&
2103 + (fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL)))
2104 return;
2105
2106 fattr->valid |= NFS_ATTR_FATTR_TYPE | NFS_ATTR_FATTR_MODE |
2107 @@ -4676,7 +4683,6 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,
2108 struct nfs_server *server = NFS_SERVER(dir);
2109 u32 bitmask[2] = {
2110 [0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS,
2111 - [1] = FATTR4_WORD1_MOUNTED_ON_FILEID,
2112 };
2113 struct nfs4_fs_locations_arg args = {
2114 .dir_fh = NFS_FH(dir),
2115 @@ -4695,11 +4701,18 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,
2116 int status;
2117
2118 dprintk("%s: start\n", __func__);
2119 +
2120 + /* Ask for the fileid of the absent filesystem if mounted_on_fileid
2121 + * is not supported */
2122 + if (NFS_SERVER(dir)->attr_bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)
2123 + bitmask[1] |= FATTR4_WORD1_MOUNTED_ON_FILEID;
2124 + else
2125 + bitmask[0] |= FATTR4_WORD0_FILEID;
2126 +
2127 nfs_fattr_init(&fs_locations->fattr);
2128 fs_locations->server = server;
2129 fs_locations->nlocations = 0;
2130 status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
2131 - nfs_fixup_referral_attributes(&fs_locations->fattr);
2132 dprintk("%s: returned status = %d\n", __func__, status);
2133 return status;
2134 }
2135 diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
2136 index c3ccd2c..7685279 100644
2137 --- a/fs/nfs/nfs4xdr.c
2138 +++ b/fs/nfs/nfs4xdr.c
2139 @@ -3030,7 +3030,7 @@ out_overflow:
2140 return -EIO;
2141 }
2142
2143 -static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap)
2144 +static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap, int32_t *res)
2145 {
2146 __be32 *p;
2147
2148 @@ -3041,7 +3041,7 @@ static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap)
2149 if (unlikely(!p))
2150 goto out_overflow;
2151 bitmap[0] &= ~FATTR4_WORD0_RDATTR_ERROR;
2152 - return -be32_to_cpup(p);
2153 + *res = -be32_to_cpup(p);
2154 }
2155 return 0;
2156 out_overflow:
2157 @@ -4002,6 +4002,7 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap,
2158 int status;
2159 umode_t fmode = 0;
2160 uint32_t type;
2161 + int32_t err;
2162
2163 status = decode_attr_type(xdr, bitmap, &type);
2164 if (status < 0)
2165 @@ -4027,13 +4028,12 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap,
2166 goto xdr_error;
2167 fattr->valid |= status;
2168
2169 - status = decode_attr_error(xdr, bitmap);
2170 - if (status == -NFS4ERR_WRONGSEC) {
2171 - nfs_fixup_secinfo_attributes(fattr, fh);
2172 - status = 0;
2173 - }
2174 + err = 0;
2175 + status = decode_attr_error(xdr, bitmap, &err);
2176 if (status < 0)
2177 goto xdr_error;
2178 + if (err == -NFS4ERR_WRONGSEC)
2179 + nfs_fixup_secinfo_attributes(fattr, fh);
2180
2181 status = decode_attr_filehandle(xdr, bitmap, fh);
2182 if (status < 0)
2183 diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig
2184 index 18b3e89..fbb2a5e 100644
2185 --- a/fs/nfsd/Kconfig
2186 +++ b/fs/nfsd/Kconfig
2187 @@ -82,6 +82,7 @@ config NFSD_V4
2188 select NFSD_V3
2189 select FS_POSIX_ACL
2190 select SUNRPC_GSS
2191 + select CRYPTO
2192 help
2193 This option enables support in your system's NFS server for
2194 version 4 of the NFS protocol (RFC 3530).
2195 diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
2196 index 1f5eae4..2b1449d 100644
2197 --- a/fs/nfsd/nfsctl.c
2198 +++ b/fs/nfsd/nfsctl.c
2199 @@ -13,6 +13,7 @@
2200 #include <linux/lockd/lockd.h>
2201 #include <linux/sunrpc/clnt.h>
2202 #include <linux/sunrpc/gss_api.h>
2203 +#include <linux/sunrpc/gss_krb5_enctypes.h>
2204
2205 #include "idmap.h"
2206 #include "nfsd.h"
2207 @@ -189,18 +190,10 @@ static struct file_operations export_features_operations = {
2208 .release = single_release,
2209 };
2210
2211 -#ifdef CONFIG_SUNRPC_GSS
2212 +#if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE)
2213 static int supported_enctypes_show(struct seq_file *m, void *v)
2214 {
2215 - struct gss_api_mech *k5mech;
2216 -
2217 - k5mech = gss_mech_get_by_name("krb5");
2218 - if (k5mech == NULL)
2219 - goto out;
2220 - if (k5mech->gm_upcall_enctypes != NULL)
2221 - seq_printf(m, k5mech->gm_upcall_enctypes);
2222 - gss_mech_put(k5mech);
2223 -out:
2224 + seq_printf(m, KRB5_SUPPORTED_ENCTYPES);
2225 return 0;
2226 }
2227
2228 @@ -215,7 +208,7 @@ static struct file_operations supported_enctypes_ops = {
2229 .llseek = seq_lseek,
2230 .release = single_release,
2231 };
2232 -#endif /* CONFIG_SUNRPC_GSS */
2233 +#endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */
2234
2235 extern int nfsd_pool_stats_open(struct inode *inode, struct file *file);
2236 extern int nfsd_pool_stats_release(struct inode *inode, struct file *file);
2237 @@ -1427,9 +1420,9 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
2238 [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR},
2239 [NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO},
2240 [NFSD_MaxBlkSize] = {"max_block_size", &transaction_ops, S_IWUSR|S_IRUGO},
2241 -#ifdef CONFIG_SUNRPC_GSS
2242 +#if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE)
2243 [NFSD_SupportedEnctypes] = {"supported_krb5_enctypes", &supported_enctypes_ops, S_IRUGO},
2244 -#endif /* CONFIG_SUNRPC_GSS */
2245 +#endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */
2246 #ifdef CONFIG_NFSD_V4
2247 [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR},
2248 [NFSD_Gracetime] = {"nfsv4gracetime", &transaction_ops, S_IWUSR|S_IRUSR},
2249 diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
2250 index 129f3c9..d80b2d8 100644
2251 --- a/fs/nfsd/vfs.c
2252 +++ b/fs/nfsd/vfs.c
2253 @@ -699,7 +699,15 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *suppor
2254 }
2255 #endif /* CONFIG_NFSD_V3 */
2256
2257 +static int nfsd_open_break_lease(struct inode *inode, int access)
2258 +{
2259 + unsigned int mode;
2260
2261 + if (access & NFSD_MAY_NOT_BREAK_LEASE)
2262 + return 0;
2263 + mode = (access & NFSD_MAY_WRITE) ? O_WRONLY : O_RDONLY;
2264 + return break_lease(inode, mode | O_NONBLOCK);
2265 +}
2266
2267 /*
2268 * Open an existing file or directory.
2269 @@ -747,12 +755,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
2270 if (!inode->i_fop)
2271 goto out;
2272
2273 - /*
2274 - * Check to see if there are any leases on this file.
2275 - * This may block while leases are broken.
2276 - */
2277 - if (!(access & NFSD_MAY_NOT_BREAK_LEASE))
2278 - host_err = break_lease(inode, O_NONBLOCK | ((access & NFSD_MAY_WRITE) ? O_WRONLY : 0));
2279 + host_err = nfsd_open_break_lease(inode, access);
2280 if (host_err) /* NOMEM or WOULDBLOCK */
2281 goto out_nfserr;
2282
2283 @@ -1653,8 +1656,10 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
2284 if (!dold->d_inode)
2285 goto out_drop_write;
2286 host_err = nfsd_break_lease(dold->d_inode);
2287 - if (host_err)
2288 + if (host_err) {
2289 + err = nfserrno(host_err);
2290 goto out_drop_write;
2291 + }
2292 host_err = vfs_link(dold, dirp, dnew);
2293 if (!host_err) {
2294 err = nfserrno(commit_metadata(ffhp));
2295 diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
2296 index e5a3f58..dfb0ec6 100644
2297 --- a/include/asm-generic/bug.h
2298 +++ b/include/asm-generic/bug.h
2299 @@ -162,9 +162,6 @@ extern void warn_slowpath_null(const char *file, const int line);
2300 unlikely(__ret_warn_once); \
2301 })
2302
2303 -#define WARN_ON_RATELIMIT(condition, state) \
2304 - WARN_ON((condition) && __ratelimit(state))
2305 -
2306 /*
2307 * WARN_ON_SMP() is for cases that the warning is either
2308 * meaningless for !SMP or may even cause failures.
2309 diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
2310 index be50d9e..acdb143 100644
2311 --- a/include/linux/blk_types.h
2312 +++ b/include/linux/blk_types.h
2313 @@ -168,7 +168,7 @@ enum rq_flag_bits {
2314 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
2315 #define REQ_COMMON_MASK \
2316 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_DISCARD | \
2317 - REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
2318 + REQ_NOIDLE | REQ_FLUSH | REQ_FUA | REQ_SECURE)
2319 #define REQ_CLONE_MASK REQ_COMMON_MASK
2320
2321 #define REQ_RAHEAD (1 << __REQ_RAHEAD)
2322 diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
2323 index c37b21a..24e2932 100644
2324 --- a/include/linux/clocksource.h
2325 +++ b/include/linux/clocksource.h
2326 @@ -192,6 +192,7 @@ struct clocksource {
2327 #ifdef CONFIG_CLOCKSOURCE_WATCHDOG
2328 /* Watchdog related data, used by the framework */
2329 struct list_head wd_list;
2330 + cycle_t cs_last;
2331 cycle_t wd_last;
2332 #endif
2333 };
2334 diff --git a/include/linux/connector.h b/include/linux/connector.h
2335 index 7c60d09..f696bcc 100644
2336 --- a/include/linux/connector.h
2337 +++ b/include/linux/connector.h
2338 @@ -44,7 +44,7 @@
2339 #define CN_VAL_DRBD 0x1
2340 #define CN_KVP_IDX 0x9 /* HyperV KVP */
2341
2342 -#define CN_NETLINK_USERS 9
2343 +#define CN_NETLINK_USERS 10 /* Highest index + 1 */
2344
2345 /*
2346 * Maximum connector's message size.
2347 diff --git a/include/linux/device.h b/include/linux/device.h
2348 index d08399d..779e860 100644
2349 --- a/include/linux/device.h
2350 +++ b/include/linux/device.h
2351 @@ -506,13 +506,13 @@ static inline int device_is_registered(struct device *dev)
2352
2353 static inline void device_enable_async_suspend(struct device *dev)
2354 {
2355 - if (!dev->power.in_suspend)
2356 + if (!dev->power.is_prepared)
2357 dev->power.async_suspend = true;
2358 }
2359
2360 static inline void device_disable_async_suspend(struct device *dev)
2361 {
2362 - if (!dev->power.in_suspend)
2363 + if (!dev->power.is_prepared)
2364 dev->power.async_suspend = false;
2365 }
2366
2367 diff --git a/include/linux/fscache.h b/include/linux/fscache.h
2368 index 7c4d72f..9ec20de 100644
2369 --- a/include/linux/fscache.h
2370 +++ b/include/linux/fscache.h
2371 @@ -204,6 +204,8 @@ extern bool __fscache_check_page_write(struct fscache_cookie *, struct page *);
2372 extern void __fscache_wait_on_page_write(struct fscache_cookie *, struct page *);
2373 extern bool __fscache_maybe_release_page(struct fscache_cookie *, struct page *,
2374 gfp_t);
2375 +extern void __fscache_uncache_all_inode_pages(struct fscache_cookie *,
2376 + struct inode *);
2377
2378 /**
2379 * fscache_register_netfs - Register a filesystem as desiring caching services
2380 @@ -643,4 +645,23 @@ bool fscache_maybe_release_page(struct fscache_cookie *cookie,
2381 return false;
2382 }
2383
2384 +/**
2385 + * fscache_uncache_all_inode_pages - Uncache all an inode's pages
2386 + * @cookie: The cookie representing the inode's cache object.
2387 + * @inode: The inode to uncache pages from.
2388 + *
2389 + * Uncache all the pages in an inode that are marked PG_fscache, assuming them
2390 + * to be associated with the given cookie.
2391 + *
2392 + * This function may sleep. It will wait for pages that are being written out
2393 + * and will wait whilst the PG_fscache mark is removed by the cache.
2394 + */
2395 +static inline
2396 +void fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,
2397 + struct inode *inode)
2398 +{
2399 + if (fscache_cookie_valid(cookie))
2400 + __fscache_uncache_all_inode_pages(cookie, inode);
2401 +}
2402 +
2403 #endif /* _LINUX_FSCACHE_H */
2404 diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
2405 index 72bfa5a..8e37fba 100644
2406 --- a/include/linux/if_packet.h
2407 +++ b/include/linux/if_packet.h
2408 @@ -62,6 +62,7 @@ struct tpacket_auxdata {
2409 __u16 tp_mac;
2410 __u16 tp_net;
2411 __u16 tp_vlan_tci;
2412 + __u16 tp_padding;
2413 };
2414
2415 /* Rx ring - header status */
2416 @@ -100,6 +101,7 @@ struct tpacket2_hdr {
2417 __u32 tp_sec;
2418 __u32 tp_nsec;
2419 __u16 tp_vlan_tci;
2420 + __u16 tp_padding;
2421 };
2422
2423 #define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll))
2424 diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
2425 index a0196ac..ac3c822 100644
2426 --- a/include/linux/netfilter/ipset/ip_set_ahash.h
2427 +++ b/include/linux/netfilter/ipset/ip_set_ahash.h
2428 @@ -839,7 +839,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
2429 struct htable *t = h->table;
2430 const struct type_pf_elem *d = value;
2431 struct hbucket *n;
2432 - int i, ret = 0;
2433 + int i;
2434 struct type_pf_elem *data;
2435 u32 key;
2436
2437 @@ -850,7 +850,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
2438 if (!type_pf_data_equal(data, d))
2439 continue;
2440 if (type_pf_data_expired(data))
2441 - ret = -IPSET_ERR_EXIST;
2442 + return -IPSET_ERR_EXIST;
2443 if (i != n->pos - 1)
2444 /* Not last one */
2445 type_pf_data_copy(data, ahash_tdata(n, n->pos - 1));
2446 diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
2447 index 9f30c5f..bb773c1 100644
2448 --- a/include/linux/netfilter/ipset/ip_set_timeout.h
2449 +++ b/include/linux/netfilter/ipset/ip_set_timeout.h
2450 @@ -45,7 +45,7 @@ ip_set_timeout_test(unsigned long timeout)
2451 {
2452 return timeout != IPSET_ELEM_UNSET &&
2453 (timeout == IPSET_ELEM_PERMANENT ||
2454 - time_after(timeout, jiffies));
2455 + time_is_after_jiffies(timeout));
2456 }
2457
2458 static inline bool
2459 @@ -53,7 +53,7 @@ ip_set_timeout_expired(unsigned long timeout)
2460 {
2461 return timeout != IPSET_ELEM_UNSET &&
2462 timeout != IPSET_ELEM_PERMANENT &&
2463 - time_before(timeout, jiffies);
2464 + time_is_before_jiffies(timeout);
2465 }
2466
2467 static inline unsigned long
2468 @@ -64,7 +64,7 @@ ip_set_timeout_set(u32 timeout)
2469 if (!timeout)
2470 return IPSET_ELEM_PERMANENT;
2471
2472 - t = timeout * HZ + jiffies;
2473 + t = msecs_to_jiffies(timeout * 1000) + jiffies;
2474 if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT)
2475 /* Bingo! */
2476 t++;
2477 @@ -75,7 +75,8 @@ ip_set_timeout_set(u32 timeout)
2478 static inline u32
2479 ip_set_timeout_get(unsigned long timeout)
2480 {
2481 - return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
2482 + return timeout == IPSET_ELEM_PERMANENT ? 0 :
2483 + jiffies_to_msecs(timeout - jiffies)/1000;
2484 }
2485
2486 #else
2487 @@ -89,14 +90,14 @@ static inline bool
2488 ip_set_timeout_test(unsigned long timeout)
2489 {
2490 return timeout == IPSET_ELEM_PERMANENT ||
2491 - time_after(timeout, jiffies);
2492 + time_is_after_jiffies(timeout);
2493 }
2494
2495 static inline bool
2496 ip_set_timeout_expired(unsigned long timeout)
2497 {
2498 return timeout != IPSET_ELEM_PERMANENT &&
2499 - time_before(timeout, jiffies);
2500 + time_is_before_jiffies(timeout);
2501 }
2502
2503 static inline unsigned long
2504 @@ -107,7 +108,7 @@ ip_set_timeout_set(u32 timeout)
2505 if (!timeout)
2506 return IPSET_ELEM_PERMANENT;
2507
2508 - t = timeout * HZ + jiffies;
2509 + t = msecs_to_jiffies(timeout * 1000) + jiffies;
2510 if (t == IPSET_ELEM_PERMANENT)
2511 /* Bingo! :-) */
2512 t++;
2513 @@ -118,7 +119,8 @@ ip_set_timeout_set(u32 timeout)
2514 static inline u32
2515 ip_set_timeout_get(unsigned long timeout)
2516 {
2517 - return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
2518 + return timeout == IPSET_ELEM_PERMANENT ? 0 :
2519 + jiffies_to_msecs(timeout - jiffies)/1000;
2520 }
2521 #endif /* ! IP_SET_BITMAP_TIMEOUT */
2522
2523 diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
2524 index 8652a4f..d041a4a 100644
2525 --- a/include/linux/pci_ids.h
2526 +++ b/include/linux/pci_ids.h
2527 @@ -1537,6 +1537,7 @@
2528 #define PCI_DEVICE_ID_RICOH_RL5C476 0x0476
2529 #define PCI_DEVICE_ID_RICOH_RL5C478 0x0478
2530 #define PCI_DEVICE_ID_RICOH_R5C822 0x0822
2531 +#define PCI_DEVICE_ID_RICOH_R5CE823 0xe823
2532 #define PCI_DEVICE_ID_RICOH_R5C832 0x0832
2533 #define PCI_DEVICE_ID_RICOH_R5C843 0x0843
2534
2535 diff --git a/include/linux/pm.h b/include/linux/pm.h
2536 index 512e091..fffb12f 100644
2537 --- a/include/linux/pm.h
2538 +++ b/include/linux/pm.h
2539 @@ -425,7 +425,8 @@ struct dev_pm_info {
2540 pm_message_t power_state;
2541 unsigned int can_wakeup:1;
2542 unsigned int async_suspend:1;
2543 - unsigned int in_suspend:1; /* Owned by the PM core */
2544 + bool is_prepared:1; /* Owned by the PM core */
2545 + bool is_suspended:1; /* Ditto */
2546 spinlock_t lock;
2547 #ifdef CONFIG_PM_SLEEP
2548 struct list_head entry;
2549 diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
2550 index 03ff67b..2f00715 100644
2551 --- a/include/linux/ratelimit.h
2552 +++ b/include/linux/ratelimit.h
2553 @@ -41,4 +41,44 @@ extern struct ratelimit_state printk_ratelimit_state;
2554 extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
2555 #define __ratelimit(state) ___ratelimit(state, __func__)
2556
2557 +#ifdef CONFIG_PRINTK
2558 +
2559 +#define WARN_ON_RATELIMIT(condition, state) \
2560 + WARN_ON((condition) && __ratelimit(state))
2561 +
2562 +#define __WARN_RATELIMIT(condition, state, format...) \
2563 +({ \
2564 + int rtn = 0; \
2565 + if (unlikely(__ratelimit(state))) \
2566 + rtn = WARN(condition, format); \
2567 + rtn; \
2568 +})
2569 +
2570 +#define WARN_RATELIMIT(condition, format...) \
2571 +({ \
2572 + static DEFINE_RATELIMIT_STATE(_rs, \
2573 + DEFAULT_RATELIMIT_INTERVAL, \
2574 + DEFAULT_RATELIMIT_BURST); \
2575 + __WARN_RATELIMIT(condition, &_rs, format); \
2576 +})
2577 +
2578 +#else
2579 +
2580 +#define WARN_ON_RATELIMIT(condition, state) \
2581 + WARN_ON(condition)
2582 +
2583 +#define __WARN_RATELIMIT(condition, state, format...) \
2584 +({ \
2585 + int rtn = WARN(condition, format); \
2586 + rtn; \
2587 +})
2588 +
2589 +#define WARN_RATELIMIT(condition, format...) \
2590 +({ \
2591 + int rtn = WARN(condition, format); \
2592 + rtn; \
2593 +})
2594 +
2595 +#endif
2596 +
2597 #endif /* _LINUX_RATELIMIT_H */
2598 diff --git a/include/linux/sunrpc/gss_krb5_enctypes.h b/include/linux/sunrpc/gss_krb5_enctypes.h
2599 new file mode 100644
2600 index 0000000..ec6234e
2601 --- /dev/null
2602 +++ b/include/linux/sunrpc/gss_krb5_enctypes.h
2603 @@ -0,0 +1,4 @@
2604 +/*
2605 + * Dumb way to share this static piece of information with nfsd
2606 + */
2607 +#define KRB5_SUPPORTED_ENCTYPES "18,17,16,23,3,1,2"
2608 diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
2609 index f73c482..fe2d8e6 100644
2610 --- a/include/linux/sunrpc/sched.h
2611 +++ b/include/linux/sunrpc/sched.h
2612 @@ -84,7 +84,8 @@ struct rpc_task {
2613 #endif
2614 unsigned char tk_priority : 2,/* Task priority */
2615 tk_garb_retry : 2,
2616 - tk_cred_retry : 2;
2617 + tk_cred_retry : 2,
2618 + tk_rebind_retry : 2;
2619 };
2620 #define tk_xprt tk_client->cl_xprt
2621
2622 diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
2623 index 86aefed..e5bf4c8 100644
2624 --- a/include/net/ip_vs.h
2625 +++ b/include/net/ip_vs.h
2626 @@ -802,7 +802,8 @@ struct netns_ipvs {
2627 struct list_head rs_table[IP_VS_RTAB_SIZE];
2628 /* ip_vs_app */
2629 struct list_head app_list;
2630 -
2631 + /* ip_vs_ftp */
2632 + struct ip_vs_app *ftp_app;
2633 /* ip_vs_proto */
2634 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
2635 struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
2636 diff --git a/init/calibrate.c b/init/calibrate.c
2637 index 76ac919..30a44cd 100644
2638 --- a/init/calibrate.c
2639 +++ b/init/calibrate.c
2640 @@ -185,30 +185,32 @@ recalibrate:
2641
2642 void __cpuinit calibrate_delay(void)
2643 {
2644 + unsigned long lpj;
2645 static bool printed;
2646
2647 if (preset_lpj) {
2648 - loops_per_jiffy = preset_lpj;
2649 + lpj = preset_lpj;
2650 if (!printed)
2651 pr_info("Calibrating delay loop (skipped) "
2652 "preset value.. ");
2653 } else if ((!printed) && lpj_fine) {
2654 - loops_per_jiffy = lpj_fine;
2655 + lpj = lpj_fine;
2656 pr_info("Calibrating delay loop (skipped), "
2657 "value calculated using timer frequency.. ");
2658 - } else if ((loops_per_jiffy = calibrate_delay_direct()) != 0) {
2659 + } else if ((lpj = calibrate_delay_direct()) != 0) {
2660 if (!printed)
2661 pr_info("Calibrating delay using timer "
2662 "specific routine.. ");
2663 } else {
2664 if (!printed)
2665 pr_info("Calibrating delay loop... ");
2666 - loops_per_jiffy = calibrate_delay_converge();
2667 + lpj = calibrate_delay_converge();
2668 }
2669 if (!printed)
2670 pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n",
2671 - loops_per_jiffy/(500000/HZ),
2672 - (loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy);
2673 + lpj/(500000/HZ),
2674 + (lpj/(5000/HZ)) % 100, lpj);
2675
2676 + loops_per_jiffy = lpj;
2677 printed = true;
2678 }
2679 diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
2680 index ca0aacc..1a78c1a 100644
2681 --- a/kernel/power/snapshot.c
2682 +++ b/kernel/power/snapshot.c
2683 @@ -1199,7 +1199,11 @@ static void free_unnecessary_pages(void)
2684 to_free_highmem = alloc_highmem - save;
2685 } else {
2686 to_free_highmem = 0;
2687 - to_free_normal -= save - alloc_highmem;
2688 + save -= alloc_highmem;
2689 + if (to_free_normal > save)
2690 + to_free_normal -= save;
2691 + else
2692 + to_free_normal = 0;
2693 }
2694
2695 memory_bm_position_reset(&copy_bm);
2696 diff --git a/kernel/power/user.c b/kernel/power/user.c
2697 index 7d02d33..42ddbc6 100644
2698 --- a/kernel/power/user.c
2699 +++ b/kernel/power/user.c
2700 @@ -113,8 +113,10 @@ static int snapshot_open(struct inode *inode, struct file *filp)
2701 if (error)
2702 pm_notifier_call_chain(PM_POST_RESTORE);
2703 }
2704 - if (error)
2705 + if (error) {
2706 + free_basic_memory_bitmaps();
2707 atomic_inc(&snapshot_device_available);
2708 + }
2709 data->frozen = 0;
2710 data->ready = 0;
2711 data->platform_support = 0;
2712 diff --git a/kernel/taskstats.c b/kernel/taskstats.c
2713 index 9ffea36..fc0f220 100644
2714 --- a/kernel/taskstats.c
2715 +++ b/kernel/taskstats.c
2716 @@ -285,16 +285,18 @@ ret:
2717 static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd)
2718 {
2719 struct listener_list *listeners;
2720 - struct listener *s, *tmp;
2721 + struct listener *s, *tmp, *s2;
2722 unsigned int cpu;
2723
2724 if (!cpumask_subset(mask, cpu_possible_mask))
2725 return -EINVAL;
2726
2727 + s = NULL;
2728 if (isadd == REGISTER) {
2729 for_each_cpu(cpu, mask) {
2730 - s = kmalloc_node(sizeof(struct listener), GFP_KERNEL,
2731 - cpu_to_node(cpu));
2732 + if (!s)
2733 + s = kmalloc_node(sizeof(struct listener),
2734 + GFP_KERNEL, cpu_to_node(cpu));
2735 if (!s)
2736 goto cleanup;
2737 s->pid = pid;
2738 @@ -303,9 +305,16 @@ static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd)
2739
2740 listeners = &per_cpu(listener_array, cpu);
2741 down_write(&listeners->sem);
2742 + list_for_each_entry_safe(s2, tmp, &listeners->list, list) {
2743 + if (s2->pid == pid)
2744 + goto next_cpu;
2745 + }
2746 list_add(&s->list, &listeners->list);
2747 + s = NULL;
2748 +next_cpu:
2749 up_write(&listeners->sem);
2750 }
2751 + kfree(s);
2752 return 0;
2753 }
2754
2755 diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
2756 index 0e17c10..727da92 100644
2757 --- a/kernel/time/clocksource.c
2758 +++ b/kernel/time/clocksource.c
2759 @@ -185,7 +185,6 @@ static struct clocksource *watchdog;
2760 static struct timer_list watchdog_timer;
2761 static DECLARE_WORK(watchdog_work, clocksource_watchdog_work);
2762 static DEFINE_SPINLOCK(watchdog_lock);
2763 -static cycle_t watchdog_last;
2764 static int watchdog_running;
2765
2766 static int clocksource_watchdog_kthread(void *data);
2767 @@ -254,11 +253,6 @@ static void clocksource_watchdog(unsigned long data)
2768 if (!watchdog_running)
2769 goto out;
2770
2771 - wdnow = watchdog->read(watchdog);
2772 - wd_nsec = clocksource_cyc2ns((wdnow - watchdog_last) & watchdog->mask,
2773 - watchdog->mult, watchdog->shift);
2774 - watchdog_last = wdnow;
2775 -
2776 list_for_each_entry(cs, &watchdog_list, wd_list) {
2777
2778 /* Clocksource already marked unstable? */
2779 @@ -268,19 +262,28 @@ static void clocksource_watchdog(unsigned long data)
2780 continue;
2781 }
2782
2783 + local_irq_disable();
2784 csnow = cs->read(cs);
2785 + wdnow = watchdog->read(watchdog);
2786 + local_irq_enable();
2787
2788 /* Clocksource initialized ? */
2789 if (!(cs->flags & CLOCK_SOURCE_WATCHDOG)) {
2790 cs->flags |= CLOCK_SOURCE_WATCHDOG;
2791 - cs->wd_last = csnow;
2792 + cs->wd_last = wdnow;
2793 + cs->cs_last = csnow;
2794 continue;
2795 }
2796
2797 - /* Check the deviation from the watchdog clocksource. */
2798 - cs_nsec = clocksource_cyc2ns((csnow - cs->wd_last) &
2799 + wd_nsec = clocksource_cyc2ns((wdnow - cs->wd_last) & watchdog->mask,
2800 + watchdog->mult, watchdog->shift);
2801 +
2802 + cs_nsec = clocksource_cyc2ns((csnow - cs->cs_last) &
2803 cs->mask, cs->mult, cs->shift);
2804 - cs->wd_last = csnow;
2805 + cs->cs_last = csnow;
2806 + cs->wd_last = wdnow;
2807 +
2808 + /* Check the deviation from the watchdog clocksource. */
2809 if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) {
2810 clocksource_unstable(cs, cs_nsec - wd_nsec);
2811 continue;
2812 @@ -318,7 +321,6 @@ static inline void clocksource_start_watchdog(void)
2813 return;
2814 init_timer(&watchdog_timer);
2815 watchdog_timer.function = clocksource_watchdog;
2816 - watchdog_last = watchdog->read(watchdog);
2817 watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL;
2818 add_timer_on(&watchdog_timer, cpumask_first(cpu_online_mask));
2819 watchdog_running = 1;
2820 diff --git a/lib/debugobjects.c b/lib/debugobjects.c
2821 index 9d86e45..a78b7c6 100644
2822 --- a/lib/debugobjects.c
2823 +++ b/lib/debugobjects.c
2824 @@ -198,7 +198,7 @@ static void free_object(struct debug_obj *obj)
2825 * initialized:
2826 */
2827 if (obj_pool_free > ODEBUG_POOL_SIZE && obj_cache)
2828 - sched = !work_pending(&debug_obj_work);
2829 + sched = keventd_up() && !work_pending(&debug_obj_work);
2830 hlist_add_head(&obj->node, &obj_pool);
2831 obj_pool_free++;
2832 obj_pool_used--;
2833 diff --git a/mm/hugetlb.c b/mm/hugetlb.c
2834 index 39f86fc..f7c32fb 100644
2835 --- a/mm/hugetlb.c
2836 +++ b/mm/hugetlb.c
2837 @@ -1111,6 +1111,14 @@ static void __init gather_bootmem_prealloc(void)
2838 WARN_ON(page_count(page) != 1);
2839 prep_compound_huge_page(page, h->order);
2840 prep_new_huge_page(h, page, page_to_nid(page));
2841 + /*
2842 + * If we had gigantic hugepages allocated at boot time, we need
2843 + * to restore the 'stolen' pages to totalram_pages in order to
2844 + * fix confusing memory reports from free(1) and another
2845 + * side-effects, like CommitLimit going negative.
2846 + */
2847 + if (h->order > (MAX_ORDER - 1))
2848 + totalram_pages += 1 << h->order;
2849 }
2850 }
2851
2852 diff --git a/mm/ksm.c b/mm/ksm.c
2853 index 942dfc7..e48c86e 100644
2854 --- a/mm/ksm.c
2855 +++ b/mm/ksm.c
2856 @@ -1301,6 +1301,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page)
2857 slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list);
2858 ksm_scan.mm_slot = slot;
2859 spin_unlock(&ksm_mmlist_lock);
2860 + /*
2861 + * Although we tested list_empty() above, a racing __ksm_exit
2862 + * of the last mm on the list may have removed it since then.
2863 + */
2864 + if (slot == &ksm_mm_head)
2865 + return NULL;
2866 next_mm:
2867 ksm_scan.address = 0;
2868 ksm_scan.rmap_list = &slot->rmap_list;
2869 diff --git a/mm/memory-failure.c b/mm/memory-failure.c
2870 index 2b9a5ee..9568e0b 100644
2871 --- a/mm/memory-failure.c
2872 +++ b/mm/memory-failure.c
2873 @@ -52,6 +52,7 @@
2874 #include <linux/swapops.h>
2875 #include <linux/hugetlb.h>
2876 #include <linux/memory_hotplug.h>
2877 +#include <linux/mm_inline.h>
2878 #include "internal.h"
2879
2880 int sysctl_memory_failure_early_kill __read_mostly = 0;
2881 @@ -1463,7 +1464,8 @@ int soft_offline_page(struct page *page, int flags)
2882 ret = isolate_lru_page(page);
2883 if (!ret) {
2884 LIST_HEAD(pagelist);
2885 -
2886 + inc_zone_page_state(page, NR_ISOLATED_ANON +
2887 + page_is_file_cache(page));
2888 list_add(&page->lru, &pagelist);
2889 ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
2890 0, true);
2891 diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
2892 index 9ca1d60..fc5e0ba 100644
2893 --- a/mm/memory_hotplug.c
2894 +++ b/mm/memory_hotplug.c
2895 @@ -518,7 +518,7 @@ int mem_online_node(int nid)
2896
2897 lock_memory_hotplug();
2898 pgdat = hotadd_new_pgdat(nid, 0);
2899 - if (pgdat) {
2900 + if (!pgdat) {
2901 ret = -ENOMEM;
2902 goto out;
2903 }
2904 diff --git a/mm/migrate.c b/mm/migrate.c
2905 index 34132f8..3179891 100644
2906 --- a/mm/migrate.c
2907 +++ b/mm/migrate.c
2908 @@ -288,7 +288,7 @@ static int migrate_page_move_mapping(struct address_space *mapping,
2909 */
2910 __dec_zone_page_state(page, NR_FILE_PAGES);
2911 __inc_zone_page_state(newpage, NR_FILE_PAGES);
2912 - if (PageSwapBacked(page)) {
2913 + if (!PageSwapCache(page) && PageSwapBacked(page)) {
2914 __dec_zone_page_state(page, NR_SHMEM);
2915 __inc_zone_page_state(newpage, NR_SHMEM);
2916 }
2917 diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
2918 index b2ff6c8..f11e61e 100644
2919 --- a/net/8021q/vlan_dev.c
2920 +++ b/net/8021q/vlan_dev.c
2921 @@ -338,7 +338,7 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
2922 u64_stats_update_begin(&stats->syncp);
2923 stats->tx_packets++;
2924 stats->tx_bytes += len;
2925 - u64_stats_update_begin(&stats->syncp);
2926 + u64_stats_update_end(&stats->syncp);
2927 } else {
2928 this_cpu_inc(vlan_dev_info(dev)->vlan_pcpu_stats->tx_dropped);
2929 }
2930 diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
2931 index 5f9c091..ecaaa00 100644
2932 --- a/net/bridge/br_netfilter.c
2933 +++ b/net/bridge/br_netfilter.c
2934 @@ -104,10 +104,16 @@ static void fake_update_pmtu(struct dst_entry *dst, u32 mtu)
2935 {
2936 }
2937
2938 +static u32 *fake_cow_metrics(struct dst_entry *dst, unsigned long old)
2939 +{
2940 + return NULL;
2941 +}
2942 +
2943 static struct dst_ops fake_dst_ops = {
2944 .family = AF_INET,
2945 .protocol = cpu_to_be16(ETH_P_IP),
2946 .update_pmtu = fake_update_pmtu,
2947 + .cow_metrics = fake_cow_metrics,
2948 };
2949
2950 /*
2951 diff --git a/net/core/ethtool.c b/net/core/ethtool.c
2952 index f337525..76ed645 100644
2953 --- a/net/core/ethtool.c
2954 +++ b/net/core/ethtool.c
2955 @@ -231,6 +231,29 @@ static int ethtool_set_feature_compat(struct net_device *dev,
2956 return 1;
2957 }
2958
2959 +static int ethtool_set_flags_compat(struct net_device *dev,
2960 + int (*legacy_set)(struct net_device *, u32),
2961 + struct ethtool_set_features_block *features, u32 mask)
2962 +{
2963 + u32 value;
2964 +
2965 + if (!legacy_set)
2966 + return 0;
2967 +
2968 + if (!(features[0].valid & mask))
2969 + return 0;
2970 +
2971 + value = dev->features & ~features[0].valid;
2972 + value |= features[0].requested;
2973 +
2974 + features[0].valid &= ~mask;
2975 +
2976 + if (legacy_set(dev, value & mask) < 0)
2977 + netdev_info(dev, "Legacy flags change failed\n");
2978 +
2979 + return 1;
2980 +}
2981 +
2982 static int ethtool_set_features_compat(struct net_device *dev,
2983 struct ethtool_set_features_block *features)
2984 {
2985 @@ -247,7 +270,7 @@ static int ethtool_set_features_compat(struct net_device *dev,
2986 features, NETIF_F_ALL_TSO);
2987 compat |= ethtool_set_feature_compat(dev, dev->ethtool_ops->set_rx_csum,
2988 features, NETIF_F_RXCSUM);
2989 - compat |= ethtool_set_feature_compat(dev, dev->ethtool_ops->set_flags,
2990 + compat |= ethtool_set_flags_compat(dev, dev->ethtool_ops->set_flags,
2991 features, flags_dup_features);
2992
2993 return compat;
2994 diff --git a/net/core/filter.c b/net/core/filter.c
2995 index afb8afb..1238cbd 100644
2996 --- a/net/core/filter.c
2997 +++ b/net/core/filter.c
2998 @@ -38,6 +38,7 @@
2999 #include <asm/unaligned.h>
3000 #include <linux/filter.h>
3001 #include <linux/reciprocal_div.h>
3002 +#include <linux/ratelimit.h>
3003
3004 enum {
3005 BPF_S_RET_K = 1,
3006 @@ -409,7 +410,9 @@ load_b:
3007 continue;
3008 }
3009 default:
3010 - WARN_ON(1);
3011 + WARN_RATELIMIT(1, "Unknown code:%u jt:%u tf:%u k:%u\n",
3012 + fentry->code, fentry->jt,
3013 + fentry->jf, fentry->k);
3014 return 0;
3015 }
3016 }
3017 diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
3018 index 807d83c..6bab50e 100644
3019 --- a/net/ipv4/af_inet.c
3020 +++ b/net/ipv4/af_inet.c
3021 @@ -464,6 +464,9 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
3022 if (addr_len < sizeof(struct sockaddr_in))
3023 goto out;
3024
3025 + if (addr->sin_family != AF_INET)
3026 + goto out;
3027 +
3028 chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
3029
3030 /* Not specified by any standard per-se, however it breaks too
3031 diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
3032 index 2ada171..65c23d9 100644
3033 --- a/net/ipv4/inet_diag.c
3034 +++ b/net/ipv4/inet_diag.c
3035 @@ -437,7 +437,7 @@ static int valid_cc(const void *bc, int len, int cc)
3036 return 0;
3037 if (cc == len)
3038 return 1;
3039 - if (op->yes < 4)
3040 + if (op->yes < 4 || op->yes & 3)
3041 return 0;
3042 len -= op->yes;
3043 bc += op->yes;
3044 @@ -447,11 +447,11 @@ static int valid_cc(const void *bc, int len, int cc)
3045
3046 static int inet_diag_bc_audit(const void *bytecode, int bytecode_len)
3047 {
3048 - const unsigned char *bc = bytecode;
3049 + const void *bc = bytecode;
3050 int len = bytecode_len;
3051
3052 while (len > 0) {
3053 - struct inet_diag_bc_op *op = (struct inet_diag_bc_op *)bc;
3054 + const struct inet_diag_bc_op *op = bc;
3055
3056 //printk("BC: %d %d %d {%d} / %d\n", op->code, op->yes, op->no, op[1].no, len);
3057 switch (op->code) {
3058 @@ -462,22 +462,20 @@ static int inet_diag_bc_audit(const void *bytecode, int bytecode_len)
3059 case INET_DIAG_BC_S_LE:
3060 case INET_DIAG_BC_D_GE:
3061 case INET_DIAG_BC_D_LE:
3062 - if (op->yes < 4 || op->yes > len + 4)
3063 - return -EINVAL;
3064 case INET_DIAG_BC_JMP:
3065 - if (op->no < 4 || op->no > len + 4)
3066 + if (op->no < 4 || op->no > len + 4 || op->no & 3)
3067 return -EINVAL;
3068 if (op->no < len &&
3069 !valid_cc(bytecode, bytecode_len, len - op->no))
3070 return -EINVAL;
3071 break;
3072 case INET_DIAG_BC_NOP:
3073 - if (op->yes < 4 || op->yes > len + 4)
3074 - return -EINVAL;
3075 break;
3076 default:
3077 return -EINVAL;
3078 }
3079 + if (op->yes < 4 || op->yes > len + 4 || op->yes & 3)
3080 + return -EINVAL;
3081 bc += op->yes;
3082 len -= op->yes;
3083 }
3084 diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
3085 index 9df4e63..ce616d9 100644
3086 --- a/net/ipv4/inetpeer.c
3087 +++ b/net/ipv4/inetpeer.c
3088 @@ -154,11 +154,9 @@ void __init inet_initpeers(void)
3089 /* Called with or without local BH being disabled. */
3090 static void unlink_from_unused(struct inet_peer *p)
3091 {
3092 - if (!list_empty(&p->unused)) {
3093 - spin_lock_bh(&unused_peers.lock);
3094 - list_del_init(&p->unused);
3095 - spin_unlock_bh(&unused_peers.lock);
3096 - }
3097 + spin_lock_bh(&unused_peers.lock);
3098 + list_del_init(&p->unused);
3099 + spin_unlock_bh(&unused_peers.lock);
3100 }
3101
3102 static int addr_compare(const struct inetpeer_addr *a,
3103 @@ -205,6 +203,20 @@ static int addr_compare(const struct inetpeer_addr *a,
3104 u; \
3105 })
3106
3107 +static bool atomic_add_unless_return(atomic_t *ptr, int a, int u, int *newv)
3108 +{
3109 + int cur, old = atomic_read(ptr);
3110 +
3111 + while (old != u) {
3112 + *newv = old + a;
3113 + cur = atomic_cmpxchg(ptr, old, *newv);
3114 + if (cur == old)
3115 + return true;
3116 + old = cur;
3117 + }
3118 + return false;
3119 +}
3120 +
3121 /*
3122 * Called with rcu_read_lock()
3123 * Because we hold no lock against a writer, its quite possible we fall
3124 @@ -213,7 +225,8 @@ static int addr_compare(const struct inetpeer_addr *a,
3125 * We exit from this function if number of links exceeds PEER_MAXDEPTH
3126 */
3127 static struct inet_peer *lookup_rcu(const struct inetpeer_addr *daddr,
3128 - struct inet_peer_base *base)
3129 + struct inet_peer_base *base,
3130 + int *newrefcnt)
3131 {
3132 struct inet_peer *u = rcu_dereference(base->root);
3133 int count = 0;
3134 @@ -226,7 +239,7 @@ static struct inet_peer *lookup_rcu(const struct inetpeer_addr *daddr,
3135 * distinction between an unused entry (refcnt=0) and
3136 * a freed one.
3137 */
3138 - if (unlikely(!atomic_add_unless(&u->refcnt, 1, -1)))
3139 + if (!atomic_add_unless_return(&u->refcnt, 1, -1, newrefcnt))
3140 u = NULL;
3141 return u;
3142 }
3143 @@ -465,22 +478,23 @@ struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
3144 struct inet_peer_base *base = family_to_base(daddr->family);
3145 struct inet_peer *p;
3146 unsigned int sequence;
3147 - int invalidated;
3148 + int invalidated, newrefcnt = 0;
3149
3150 /* Look up for the address quickly, lockless.
3151 * Because of a concurrent writer, we might not find an existing entry.
3152 */
3153 rcu_read_lock();
3154 sequence = read_seqbegin(&base->lock);
3155 - p = lookup_rcu(daddr, base);
3156 + p = lookup_rcu(daddr, base, &newrefcnt);
3157 invalidated = read_seqretry(&base->lock, sequence);
3158 rcu_read_unlock();
3159
3160 if (p) {
3161 - /* The existing node has been found.
3162 +found: /* The existing node has been found.
3163 * Remove the entry from unused list if it was there.
3164 */
3165 - unlink_from_unused(p);
3166 + if (newrefcnt == 1)
3167 + unlink_from_unused(p);
3168 return p;
3169 }
3170
3171 @@ -494,11 +508,9 @@ struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
3172 write_seqlock_bh(&base->lock);
3173 p = lookup(daddr, stack, base);
3174 if (p != peer_avl_empty) {
3175 - atomic_inc(&p->refcnt);
3176 + newrefcnt = atomic_inc_return(&p->refcnt);
3177 write_sequnlock_bh(&base->lock);
3178 - /* Remove the entry from unused list if it was there. */
3179 - unlink_from_unused(p);
3180 - return p;
3181 + goto found;
3182 }
3183 p = create ? kmem_cache_alloc(peer_cachep, GFP_ATOMIC) : NULL;
3184 if (p) {
3185 diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
3186 index 4614bab..2e97e3e 100644
3187 --- a/net/ipv4/netfilter.c
3188 +++ b/net/ipv4/netfilter.c
3189 @@ -17,51 +17,35 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type)
3190 const struct iphdr *iph = ip_hdr(skb);
3191 struct rtable *rt;
3192 struct flowi4 fl4 = {};
3193 - unsigned long orefdst;
3194 + __be32 saddr = iph->saddr;
3195 + __u8 flags = 0;
3196 unsigned int hh_len;
3197 - unsigned int type;
3198
3199 - type = inet_addr_type(net, iph->saddr);
3200 - if (skb->sk && inet_sk(skb->sk)->transparent)
3201 - type = RTN_LOCAL;
3202 - if (addr_type == RTN_UNSPEC)
3203 - addr_type = type;
3204 + if (!skb->sk && addr_type != RTN_LOCAL) {
3205 + if (addr_type == RTN_UNSPEC)
3206 + addr_type = inet_addr_type(net, saddr);
3207 + if (addr_type == RTN_LOCAL || addr_type == RTN_UNICAST)
3208 + flags |= FLOWI_FLAG_ANYSRC;
3209 + else
3210 + saddr = 0;
3211 + }
3212
3213 /* some non-standard hacks like ipt_REJECT.c:send_reset() can cause
3214 * packets with foreign saddr to appear on the NF_INET_LOCAL_OUT hook.
3215 */
3216 - if (addr_type == RTN_LOCAL) {
3217 - fl4.daddr = iph->daddr;
3218 - if (type == RTN_LOCAL)
3219 - fl4.saddr = iph->saddr;
3220 - fl4.flowi4_tos = RT_TOS(iph->tos);
3221 - fl4.flowi4_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0;
3222 - fl4.flowi4_mark = skb->mark;
3223 - fl4.flowi4_flags = skb->sk ? inet_sk_flowi_flags(skb->sk) : 0;
3224 - rt = ip_route_output_key(net, &fl4);
3225 - if (IS_ERR(rt))
3226 - return -1;
3227 -
3228 - /* Drop old route. */
3229 - skb_dst_drop(skb);
3230 - skb_dst_set(skb, &rt->dst);
3231 - } else {
3232 - /* non-local src, find valid iif to satisfy
3233 - * rp-filter when calling ip_route_input. */
3234 - fl4.daddr = iph->saddr;
3235 - rt = ip_route_output_key(net, &fl4);
3236 - if (IS_ERR(rt))
3237 - return -1;
3238 + fl4.daddr = iph->daddr;
3239 + fl4.saddr = saddr;
3240 + fl4.flowi4_tos = RT_TOS(iph->tos);
3241 + fl4.flowi4_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0;
3242 + fl4.flowi4_mark = skb->mark;
3243 + fl4.flowi4_flags = skb->sk ? inet_sk_flowi_flags(skb->sk) : flags;
3244 + rt = ip_route_output_key(net, &fl4);
3245 + if (IS_ERR(rt))
3246 + return -1;
3247
3248 - orefdst = skb->_skb_refdst;
3249 - if (ip_route_input(skb, iph->daddr, iph->saddr,
3250 - RT_TOS(iph->tos), rt->dst.dev) != 0) {
3251 - dst_release(&rt->dst);
3252 - return -1;
3253 - }
3254 - dst_release(&rt->dst);
3255 - refdst_drop(orefdst);
3256 - }
3257 + /* Drop old route. */
3258 + skb_dst_drop(skb);
3259 + skb_dst_set(skb, &rt->dst);
3260
3261 if (skb_dst(skb)->error)
3262 return -1;
3263 diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c
3264 index 1ff79e5..51f13f8 100644
3265 --- a/net/ipv4/netfilter/ipt_REJECT.c
3266 +++ b/net/ipv4/netfilter/ipt_REJECT.c
3267 @@ -40,7 +40,6 @@ static void send_reset(struct sk_buff *oldskb, int hook)
3268 struct iphdr *niph;
3269 const struct tcphdr *oth;
3270 struct tcphdr _otcph, *tcph;
3271 - unsigned int addr_type;
3272
3273 /* IP header checks: fragment. */
3274 if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET))
3275 @@ -55,6 +54,9 @@ static void send_reset(struct sk_buff *oldskb, int hook)
3276 if (oth->rst)
3277 return;
3278
3279 + if (skb_rtable(oldskb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
3280 + return;
3281 +
3282 /* Check checksum */
3283 if (nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), IPPROTO_TCP))
3284 return;
3285 @@ -101,19 +103,11 @@ static void send_reset(struct sk_buff *oldskb, int hook)
3286 nskb->csum_start = (unsigned char *)tcph - nskb->head;
3287 nskb->csum_offset = offsetof(struct tcphdr, check);
3288
3289 - addr_type = RTN_UNSPEC;
3290 - if (hook != NF_INET_FORWARD
3291 -#ifdef CONFIG_BRIDGE_NETFILTER
3292 - || (nskb->nf_bridge && nskb->nf_bridge->mask & BRNF_BRIDGED)
3293 -#endif
3294 - )
3295 - addr_type = RTN_LOCAL;
3296 -
3297 /* ip_route_me_harder expects skb->dst to be set */
3298 skb_dst_set_noref(nskb, skb_dst(oldskb));
3299
3300 nskb->protocol = htons(ETH_P_IP);
3301 - if (ip_route_me_harder(nskb, addr_type))
3302 + if (ip_route_me_harder(nskb, RTN_UNSPEC))
3303 goto free_nskb;
3304
3305 niph->ttl = ip4_dst_hoplimit(skb_dst(nskb));
3306 diff --git a/net/ipv4/route.c b/net/ipv4/route.c
3307 index 99e6e4b..b8b5c3f 100644
3308 --- a/net/ipv4/route.c
3309 +++ b/net/ipv4/route.c
3310 @@ -1914,9 +1914,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
3311
3312 hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev)));
3313 rth = rt_intern_hash(hash, rth, skb, dev->ifindex);
3314 - err = 0;
3315 - if (IS_ERR(rth))
3316 - err = PTR_ERR(rth);
3317 + return IS_ERR(rth) ? PTR_ERR(rth) : 0;
3318
3319 e_nobufs:
3320 return -ENOBUFS;
3321 diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
3322 index f87a8eb..0e33e34 100644
3323 --- a/net/ipv4/udp.c
3324 +++ b/net/ipv4/udp.c
3325 @@ -1241,6 +1241,9 @@ csum_copy_err:
3326
3327 if (noblock)
3328 return -EAGAIN;
3329 +
3330 + /* starting over for a new packet */
3331 + msg->msg_flags &= ~MSG_TRUNC;
3332 goto try_again;
3333 }
3334
3335 diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
3336 index 9e305d74..b31a2f3 100644
3337 --- a/net/ipv6/udp.c
3338 +++ b/net/ipv6/udp.c
3339 @@ -453,8 +453,11 @@ csum_copy_err:
3340 }
3341 unlock_sock_fast(sk, slow);
3342
3343 - if (flags & MSG_DONTWAIT)
3344 + if (noblock)
3345 return -EAGAIN;
3346 +
3347 + /* starting over for a new packet */
3348 + msg->msg_flags &= ~MSG_TRUNC;
3349 goto try_again;
3350 }
3351
3352 diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
3353 index 72d1ac6..8041bef 100644
3354 --- a/net/netfilter/ipset/ip_set_core.c
3355 +++ b/net/netfilter/ipset/ip_set_core.c
3356 @@ -815,7 +815,7 @@ ip_set_flush(struct sock *ctnl, struct sk_buff *skb,
3357 ip_set_id_t i;
3358
3359 if (unlikely(protocol_failed(attr)))
3360 - return -EPROTO;
3361 + return -IPSET_ERR_PROTOCOL;
3362
3363 if (!attr[IPSET_ATTR_SETNAME]) {
3364 for (i = 0; i < ip_set_max; i++)
3365 diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
3366 index bf28ac2..782db27 100644
3367 --- a/net/netfilter/ipvs/ip_vs_conn.c
3368 +++ b/net/netfilter/ipvs/ip_vs_conn.c
3369 @@ -776,8 +776,16 @@ static void ip_vs_conn_expire(unsigned long data)
3370 if (cp->control)
3371 ip_vs_control_del(cp);
3372
3373 - if (cp->flags & IP_VS_CONN_F_NFCT)
3374 + if (cp->flags & IP_VS_CONN_F_NFCT) {
3375 ip_vs_conn_drop_conntrack(cp);
3376 + /* Do not access conntracks during subsys cleanup
3377 + * because nf_conntrack_find_get can not be used after
3378 + * conntrack cleanup for the net.
3379 + */
3380 + smp_rmb();
3381 + if (ipvs->enable)
3382 + ip_vs_conn_drop_conntrack(cp);
3383 + }
3384
3385 ip_vs_pe_put(cp->pe);
3386 kfree(cp->pe_data);
3387 diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
3388 index a74dae6..7729eae 100644
3389 --- a/net/netfilter/ipvs/ip_vs_core.c
3390 +++ b/net/netfilter/ipvs/ip_vs_core.c
3391 @@ -1965,6 +1965,7 @@ static void __net_exit __ip_vs_dev_cleanup(struct net *net)
3392 {
3393 EnterFunction(2);
3394 net_ipvs(net)->enable = 0; /* Disable packet reception */
3395 + smp_wmb();
3396 __ip_vs_sync_cleanup(net);
3397 LeaveFunction(2);
3398 }
3399 diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
3400 index 6b5dd6d..af63553 100644
3401 --- a/net/netfilter/ipvs/ip_vs_ftp.c
3402 +++ b/net/netfilter/ipvs/ip_vs_ftp.c
3403 @@ -411,25 +411,35 @@ static struct ip_vs_app ip_vs_ftp = {
3404 static int __net_init __ip_vs_ftp_init(struct net *net)
3405 {
3406 int i, ret;
3407 - struct ip_vs_app *app = &ip_vs_ftp;
3408 + struct ip_vs_app *app;
3409 + struct netns_ipvs *ipvs = net_ipvs(net);
3410 +
3411 + app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL);
3412 + if (!app)
3413 + return -ENOMEM;
3414 + INIT_LIST_HEAD(&app->a_list);
3415 + INIT_LIST_HEAD(&app->incs_list);
3416 + ipvs->ftp_app = app;
3417
3418 ret = register_ip_vs_app(net, app);
3419 if (ret)
3420 - return ret;
3421 + goto err_exit;
3422
3423 for (i=0; i<IP_VS_APP_MAX_PORTS; i++) {
3424 if (!ports[i])
3425 continue;
3426 ret = register_ip_vs_app_inc(net, app, app->protocol, ports[i]);
3427 if (ret)
3428 - break;
3429 + goto err_unreg;
3430 pr_info("%s: loaded support on port[%d] = %d\n",
3431 app->name, i, ports[i]);
3432 }
3433 + return 0;
3434
3435 - if (ret)
3436 - unregister_ip_vs_app(net, app);
3437 -
3438 +err_unreg:
3439 + unregister_ip_vs_app(net, app);
3440 +err_exit:
3441 + kfree(ipvs->ftp_app);
3442 return ret;
3443 }
3444 /*
3445 @@ -437,9 +447,10 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
3446 */
3447 static void __ip_vs_ftp_exit(struct net *net)
3448 {
3449 - struct ip_vs_app *app = &ip_vs_ftp;
3450 + struct netns_ipvs *ipvs = net_ipvs(net);
3451
3452 - unregister_ip_vs_app(net, app);
3453 + unregister_ip_vs_app(net, ipvs->ftp_app);
3454 + kfree(ipvs->ftp_app);
3455 }
3456
3457 static struct pernet_operations ip_vs_ftp_ops = {
3458 diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
3459 index b5362e9..04098c2 100644
3460 --- a/net/packet/af_packet.c
3461 +++ b/net/packet/af_packet.c
3462 @@ -799,6 +799,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
3463 h.h2->tp_sec = ts.tv_sec;
3464 h.h2->tp_nsec = ts.tv_nsec;
3465 h.h2->tp_vlan_tci = vlan_tx_tag_get(skb);
3466 + h.h2->tp_padding = 0;
3467 hdrlen = sizeof(*h.h2);
3468 break;
3469 default:
3470 @@ -1727,6 +1728,7 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock,
3471 aux.tp_net = skb_network_offset(skb);
3472 aux.tp_vlan_tci = vlan_tx_tag_get(skb);
3473
3474 + aux.tp_padding = 0;
3475 put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(aux), &aux);
3476 }
3477
3478 diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
3479 index 339ba64..5daf6cc 100644
3480 --- a/net/sunrpc/auth_gss/auth_gss.c
3481 +++ b/net/sunrpc/auth_gss/auth_gss.c
3482 @@ -577,13 +577,13 @@ retry:
3483 }
3484 inode = &gss_msg->inode->vfs_inode;
3485 for (;;) {
3486 - prepare_to_wait(&gss_msg->waitqueue, &wait, TASK_INTERRUPTIBLE);
3487 + prepare_to_wait(&gss_msg->waitqueue, &wait, TASK_KILLABLE);
3488 spin_lock(&inode->i_lock);
3489 if (gss_msg->ctx != NULL || gss_msg->msg.errno < 0) {
3490 break;
3491 }
3492 spin_unlock(&inode->i_lock);
3493 - if (signalled()) {
3494 + if (fatal_signal_pending(current)) {
3495 err = -ERESTARTSYS;
3496 goto out_intr;
3497 }
3498 diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
3499 index 0a9a2ec..c3b7533 100644
3500 --- a/net/sunrpc/auth_gss/gss_krb5_mech.c
3501 +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
3502 @@ -43,6 +43,7 @@
3503 #include <linux/sunrpc/gss_krb5.h>
3504 #include <linux/sunrpc/xdr.h>
3505 #include <linux/crypto.h>
3506 +#include <linux/sunrpc/gss_krb5_enctypes.h>
3507
3508 #ifdef RPC_DEBUG
3509 # define RPCDBG_FACILITY RPCDBG_AUTH
3510 @@ -750,7 +751,7 @@ static struct gss_api_mech gss_kerberos_mech = {
3511 .gm_ops = &gss_kerberos_ops,
3512 .gm_pf_num = ARRAY_SIZE(gss_kerberos_pfs),
3513 .gm_pfs = gss_kerberos_pfs,
3514 - .gm_upcall_enctypes = "18,17,16,23,3,1,2",
3515 + .gm_upcall_enctypes = KRB5_SUPPORTED_ENCTYPES,
3516 };
3517
3518 static int __init init_kerberos_module(void)
3519 diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
3520 index 8d83f9d..00df09b 100644
3521 --- a/net/sunrpc/clnt.c
3522 +++ b/net/sunrpc/clnt.c
3523 @@ -1058,7 +1058,7 @@ call_allocate(struct rpc_task *task)
3524
3525 dprintk("RPC: %5u rpc_buffer allocation failed\n", task->tk_pid);
3526
3527 - if (RPC_IS_ASYNC(task) || !signalled()) {
3528 + if (RPC_IS_ASYNC(task) || !fatal_signal_pending(current)) {
3529 task->tk_action = call_allocate;
3530 rpc_delay(task, HZ>>4);
3531 return;
3532 @@ -1172,6 +1172,9 @@ call_bind_status(struct rpc_task *task)
3533 status = -EOPNOTSUPP;
3534 break;
3535 }
3536 + if (task->tk_rebind_retry == 0)
3537 + break;
3538 + task->tk_rebind_retry--;
3539 rpc_delay(task, 3*HZ);
3540 goto retry_timeout;
3541 case -ETIMEDOUT:
3542 diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
3543 index 6b43ee7..a27406b 100644
3544 --- a/net/sunrpc/sched.c
3545 +++ b/net/sunrpc/sched.c
3546 @@ -792,6 +792,7 @@ static void rpc_init_task(struct rpc_task *task, const struct rpc_task_setup *ta
3547 /* Initialize retry counters */
3548 task->tk_garb_retry = 2;
3549 task->tk_cred_retry = 2;
3550 + task->tk_rebind_retry = 2;
3551
3552 task->tk_priority = task_setup_data->priority - RPC_PRIORITY_LOW;
3553 task->tk_owner = current->tgid;
3554 diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
3555 index 47f1b86..b11ea69 100644
3556 --- a/net/xfrm/xfrm_replay.c
3557 +++ b/net/xfrm/xfrm_replay.c
3558 @@ -265,7 +265,7 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq)
3559 bitnr = bitnr & 0x1F;
3560 replay_esn->bmp[nr] |= (1U << bitnr);
3561 } else {
3562 - nr = replay_esn->replay_window >> 5;
3563 + nr = (replay_esn->replay_window - 1) >> 5;
3564 for (i = 0; i <= nr; i++)
3565 replay_esn->bmp[i] = 0;
3566
3567 @@ -471,7 +471,7 @@ static void xfrm_replay_advance_esn(struct xfrm_state *x, __be32 net_seq)
3568 bitnr = bitnr & 0x1F;
3569 replay_esn->bmp[nr] |= (1U << bitnr);
3570 } else {
3571 - nr = replay_esn->replay_window >> 5;
3572 + nr = (replay_esn->replay_window - 1) >> 5;
3573 for (i = 0; i <= nr; i++)
3574 replay_esn->bmp[i] = 0;
3575
3576 diff --git a/security/keys/request_key.c b/security/keys/request_key.c
3577 index df3c041..6197a26 100644
3578 --- a/security/keys/request_key.c
3579 +++ b/security/keys/request_key.c
3580 @@ -470,7 +470,7 @@ static struct key *construct_key_and_link(struct key_type *type,
3581 } else if (ret == -EINPROGRESS) {
3582 ret = 0;
3583 } else {
3584 - key = ERR_PTR(ret);
3585 + goto couldnt_alloc_key;
3586 }
3587
3588 key_put(dest_keyring);
3589 @@ -480,6 +480,7 @@ static struct key *construct_key_and_link(struct key_type *type,
3590 construction_failed:
3591 key_negate_and_link(key, key_negative_timeout, NULL, NULL);
3592 key_put(key);
3593 +couldnt_alloc_key:
3594 key_put(dest_keyring);
3595 kleave(" = %d", ret);
3596 return ERR_PTR(ret);
3597 diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
3598 index 15b9d16..e47f22c 100644
3599 --- a/sound/pci/hda/patch_conexant.c
3600 +++ b/sound/pci/hda/patch_conexant.c
3601 @@ -3846,6 +3846,8 @@ static struct hda_codec_preset snd_hda_preset_conexant[] = {
3602 .patch = patch_cxt5066 },
3603 { .id = 0x14f15069, .name = "CX20585",
3604 .patch = patch_cxt5066 },
3605 + { .id = 0x14f1506c, .name = "CX20588",
3606 + .patch = patch_cxt5066 },
3607 { .id = 0x14f1506e, .name = "CX20590",
3608 .patch = patch_cxt5066 },
3609 { .id = 0x14f15097, .name = "CX20631",
3610 @@ -3874,6 +3876,7 @@ MODULE_ALIAS("snd-hda-codec-id:14f15066");
3611 MODULE_ALIAS("snd-hda-codec-id:14f15067");
3612 MODULE_ALIAS("snd-hda-codec-id:14f15068");
3613 MODULE_ALIAS("snd-hda-codec-id:14f15069");
3614 +MODULE_ALIAS("snd-hda-codec-id:14f1506c");
3615 MODULE_ALIAS("snd-hda-codec-id:14f1506e");
3616 MODULE_ALIAS("snd-hda-codec-id:14f15097");
3617 MODULE_ALIAS("snd-hda-codec-id:14f15098");
3618 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3619 index 2e95f01..4145c3c 100644
3620 --- a/sound/pci/hda/patch_realtek.c
3621 +++ b/sound/pci/hda/patch_realtek.c
3622 @@ -4607,7 +4607,6 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = {
3623 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3624 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3625 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3626 - SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3627 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3628 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3629 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3630 diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c
3631 index 2ce0b2d..fab20a5 100644
3632 --- a/sound/soc/pxa/pxa2xx-pcm.c
3633 +++ b/sound/soc/pxa/pxa2xx-pcm.c
3634 @@ -95,14 +95,14 @@ static int pxa2xx_soc_pcm_new(struct snd_card *card, struct snd_soc_dai *dai,
3635 if (!card->dev->coherent_dma_mask)
3636 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
3637
3638 - if (dai->driver->playback.channels_min) {
3639 + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
3640 ret = pxa2xx_pcm_preallocate_dma_buffer(pcm,
3641 SNDRV_PCM_STREAM_PLAYBACK);
3642 if (ret)
3643 goto out;
3644 }
3645
3646 - if (dai->driver->capture.channels_min) {
3647 + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
3648 ret = pxa2xx_pcm_preallocate_dma_buffer(pcm,
3649 SNDRV_PCM_STREAM_CAPTURE);
3650 if (ret)
3651 diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
3652 index ae72ae6..e3f1235 100644
3653 --- a/virt/kvm/assigned-dev.c
3654 +++ b/virt/kvm/assigned-dev.c
3655 @@ -197,8 +197,7 @@ static void kvm_free_assigned_device(struct kvm *kvm,
3656 {
3657 kvm_free_assigned_irq(kvm, assigned_dev);
3658
3659 - __pci_reset_function(assigned_dev->dev);
3660 - pci_restore_state(assigned_dev->dev);
3661 + pci_reset_function(assigned_dev->dev);
3662
3663 pci_release_regions(assigned_dev->dev);
3664 pci_disable_device(assigned_dev->dev);
3665 @@ -515,7 +514,6 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
3666 }
3667
3668 pci_reset_function(dev);
3669 - pci_save_state(dev);
3670
3671 match->assigned_dev_id = assigned_dev->assigned_dev_id;
3672 match->host_segnr = assigned_dev->segnr;
3673 @@ -546,7 +544,6 @@ out:
3674 mutex_unlock(&kvm->lock);
3675 return r;
3676 out_list_del:
3677 - pci_restore_state(dev);
3678 list_del(&match->list);
3679 pci_release_regions(dev);
3680 out_disable: