Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1830 - genpatches-2.6/trunk/2.6.35
Date: Mon, 22 Nov 2010 23:26:53
Message-Id: 20101122232641.8430820051@flycatcher.gentoo.org
1 Author: mpagano
2 Date: 2010-11-22 23:26:41 +0000 (Mon, 22 Nov 2010)
3 New Revision: 1830
4
5 Added:
6 genpatches-2.6/trunk/2.6.35/1008_linux-2.6.35.9.patch
7 Modified:
8 genpatches-2.6/trunk/2.6.35/0000_README
9 Log:
10 Linux patch 2.6.35.9
11
12 Modified: genpatches-2.6/trunk/2.6.35/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/2.6.35/0000_README 2010-11-22 22:46:33 UTC (rev 1829)
15 +++ genpatches-2.6/trunk/2.6.35/0000_README 2010-11-22 23:26:41 UTC (rev 1830)
16 @@ -71,6 +71,10 @@
17 From: http://www.kernel.org
18 Desc: Linux 2.6.35.8
19
20 +Patch: 1008_linux-2.6.35.9.patch
21 +From: http://www.kernel.org
22 +Desc: Linux 2.6.35.9
23 +
24 Patch: 1900_create-mount-for-cgroupsfs.patch
25 From: http://bugs.gentoo.org/show_bug.cgi?id=318365
26 Desc: create /sys/fs/cgroup to mount cgroupfs to support systemd
27
28 Added: genpatches-2.6/trunk/2.6.35/1008_linux-2.6.35.9.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/2.6.35/1008_linux-2.6.35.9.patch (rev 0)
31 +++ genpatches-2.6/trunk/2.6.35/1008_linux-2.6.35.9.patch 2010-11-22 23:26:41 UTC (rev 1830)
32 @@ -0,0 +1,2592 @@
33 +diff --git a/arch/arm/mach-cns3xxx/include/mach/debug-macro.S b/arch/arm/mach-cns3xxx/include/mach/debug-macro.S
34 +index d16ce7e..9b50442 100644
35 +--- a/arch/arm/mach-cns3xxx/include/mach/debug-macro.S
36 ++++ b/arch/arm/mach-cns3xxx/include/mach/debug-macro.S
37 +@@ -10,7 +10,7 @@
38 + * published by the Free Software Foundation.
39 + */
40 +
41 +- .macro addruart,rx
42 ++ .macro addruart,rx,rtmp
43 + mrc p15, 0, \rx, c1, c0
44 + tst \rx, #1 @ MMU enabled?
45 + moveq \rx, #0x10000000
46 +diff --git a/arch/powerpc/kernel/ppc970-pmu.c b/arch/powerpc/kernel/ppc970-pmu.c
47 +index 8eff48e..3fee685 100644
48 +--- a/arch/powerpc/kernel/ppc970-pmu.c
49 ++++ b/arch/powerpc/kernel/ppc970-pmu.c
50 +@@ -169,9 +169,11 @@ static int p970_marked_instr_event(u64 event)
51 + switch (unit) {
52 + case PM_VPU:
53 + mask = 0x4c; /* byte 0 bits 2,3,6 */
54 ++ break;
55 + case PM_LSU0:
56 + /* byte 2 bits 0,2,3,4,6; all of byte 1 */
57 + mask = 0x085dff00;
58 ++ break;
59 + case PM_LSU1L:
60 + mask = 0x50 << 24; /* byte 3 bits 4,6 */
61 + break;
62 +diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
63 +index 4681459..14e0ee1 100644
64 +--- a/arch/x86/include/asm/cpufeature.h
65 ++++ b/arch/x86/include/asm/cpufeature.h
66 +@@ -150,7 +150,7 @@
67 + #define X86_FEATURE_3DNOWPREFETCH (6*32+ 8) /* 3DNow prefetch instructions */
68 + #define X86_FEATURE_OSVW (6*32+ 9) /* OS Visible Workaround */
69 + #define X86_FEATURE_IBS (6*32+10) /* Instruction Based Sampling */
70 +-#define X86_FEATURE_SSE5 (6*32+11) /* SSE-5 */
71 ++#define X86_FEATURE_XOP (6*32+11) /* extended AVX instructions */
72 + #define X86_FEATURE_SKINIT (6*32+12) /* SKINIT/STGI instructions */
73 + #define X86_FEATURE_WDT (6*32+13) /* Watchdog timer */
74 + #define X86_FEATURE_NODEID_MSR (6*32+19) /* NodeId MSR */
75 +diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
76 +index 30a3e97..6a45ec4 100644
77 +--- a/arch/x86/include/asm/io.h
78 ++++ b/arch/x86/include/asm/io.h
79 +@@ -206,6 +206,7 @@ static inline void __iomem *ioremap(resource_size_t offset, unsigned long size)
80 +
81 + extern void iounmap(volatile void __iomem *addr);
82 +
83 ++extern void set_iounmap_nonlazy(void);
84 +
85 + #ifdef __KERNEL__
86 +
87 +diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
88 +index 0b2729b..50de7b4 100644
89 +--- a/arch/x86/include/asm/kvm_emulate.h
90 ++++ b/arch/x86/include/asm/kvm_emulate.h
91 +@@ -143,7 +143,15 @@ struct x86_emulate_ops {
92 + struct operand {
93 + enum { OP_REG, OP_MEM, OP_IMM, OP_NONE } type;
94 + unsigned int bytes;
95 +- unsigned long val, orig_val, *ptr;
96 ++ union {
97 ++ unsigned long orig_val;
98 ++ u64 orig_val64;
99 ++ };
100 ++ unsigned long *ptr;
101 ++ union {
102 ++ unsigned long val;
103 ++ u64 val64;
104 ++ };
105 + };
106 +
107 + struct fetch_cache {
108 +diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
109 +index 4cfc908..4c2f63c 100644
110 +--- a/arch/x86/include/asm/smp.h
111 ++++ b/arch/x86/include/asm/smp.h
112 +@@ -50,7 +50,7 @@ struct smp_ops {
113 + void (*smp_prepare_cpus)(unsigned max_cpus);
114 + void (*smp_cpus_done)(unsigned max_cpus);
115 +
116 +- void (*smp_send_stop)(void);
117 ++ void (*stop_other_cpus)(int wait);
118 + void (*smp_send_reschedule)(int cpu);
119 +
120 + int (*cpu_up)(unsigned cpu);
121 +@@ -73,7 +73,12 @@ extern struct smp_ops smp_ops;
122 +
123 + static inline void smp_send_stop(void)
124 + {
125 +- smp_ops.smp_send_stop();
126 ++ smp_ops.stop_other_cpus(0);
127 ++}
128 ++
129 ++static inline void stop_other_cpus(void)
130 ++{
131 ++ smp_ops.stop_other_cpus(1);
132 + }
133 +
134 + static inline void smp_prepare_boot_cpu(void)
135 +diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
136 +index 5c5b8f3..ad1515d 100644
137 +--- a/arch/x86/kernel/apic/io_apic.c
138 ++++ b/arch/x86/kernel/apic/io_apic.c
139 +@@ -1397,6 +1397,7 @@ int setup_ioapic_entry(int apic_id, int irq,
140 + irte.dlvry_mode = apic->irq_delivery_mode;
141 + irte.vector = vector;
142 + irte.dest_id = IRTE_DEST(destination);
143 ++ irte.redir_hint = 1;
144 +
145 + /* Set source-id of interrupt request */
146 + set_ioapic_sid(&irte, apic_id);
147 +@@ -3348,6 +3349,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq,
148 + irte.dlvry_mode = apic->irq_delivery_mode;
149 + irte.vector = cfg->vector;
150 + irte.dest_id = IRTE_DEST(dest);
151 ++ irte.redir_hint = 1;
152 +
153 + /* Set source-id of interrupt request */
154 + if (pdev)
155 +diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c
156 +index 06130b5..a670384 100644
157 +--- a/arch/x86/kernel/cpu/mtrr/cleanup.c
158 ++++ b/arch/x86/kernel/cpu/mtrr/cleanup.c
159 +@@ -827,7 +827,7 @@ int __init amd_special_default_mtrr(void)
160 +
161 + if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
162 + return 0;
163 +- if (boot_cpu_data.x86 < 0xf || boot_cpu_data.x86 > 0x11)
164 ++ if (boot_cpu_data.x86 < 0xf)
165 + return 0;
166 + /* In case some hypervisor doesn't pass SYSCFG through: */
167 + if (rdmsr_safe(MSR_K8_SYSCFG, &l, &h) < 0)
168 +diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
169 +index c2897b7..46d5844 100644
170 +--- a/arch/x86/kernel/cpu/perf_event_amd.c
171 ++++ b/arch/x86/kernel/cpu/perf_event_amd.c
172 +@@ -52,7 +52,7 @@ static __initconst const u64 amd_hw_cache_event_ids
173 + [ C(DTLB) ] = {
174 + [ C(OP_READ) ] = {
175 + [ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses */
176 +- [ C(RESULT_MISS) ] = 0x0046, /* L1 DTLB and L2 DLTB Miss */
177 ++ [ C(RESULT_MISS) ] = 0x0746, /* L1_DTLB_AND_L2_DLTB_MISS.ALL */
178 + },
179 + [ C(OP_WRITE) ] = {
180 + [ C(RESULT_ACCESS) ] = 0,
181 +@@ -66,7 +66,7 @@ static __initconst const u64 amd_hw_cache_event_ids
182 + [ C(ITLB) ] = {
183 + [ C(OP_READ) ] = {
184 + [ C(RESULT_ACCESS) ] = 0x0080, /* Instruction fecthes */
185 +- [ C(RESULT_MISS) ] = 0x0085, /* Instr. fetch ITLB misses */
186 ++ [ C(RESULT_MISS) ] = 0x0385, /* L1_ITLB_AND_L2_ITLB_MISS.ALL */
187 + },
188 + [ C(OP_WRITE) ] = {
189 + [ C(RESULT_ACCESS) ] = -1,
190 +diff --git a/arch/x86/kernel/crash_dump_64.c b/arch/x86/kernel/crash_dump_64.c
191 +index 045b36c..9948288 100644
192 +--- a/arch/x86/kernel/crash_dump_64.c
193 ++++ b/arch/x86/kernel/crash_dump_64.c
194 +@@ -34,7 +34,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
195 + if (!csize)
196 + return 0;
197 +
198 +- vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
199 ++ vaddr = ioremap_cache(pfn << PAGE_SHIFT, PAGE_SIZE);
200 + if (!vaddr)
201 + return -ENOMEM;
202 +
203 +@@ -46,6 +46,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
204 + } else
205 + memcpy(buf, vaddr + offset, csize);
206 +
207 ++ set_iounmap_nonlazy();
208 + iounmap(vaddr);
209 + return csize;
210 + }
211 +diff --git a/arch/x86/kernel/olpc.c b/arch/x86/kernel/olpc.c
212 +index 8297160..a23b382 100644
213 +--- a/arch/x86/kernel/olpc.c
214 ++++ b/arch/x86/kernel/olpc.c
215 +@@ -117,6 +117,7 @@ int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
216 + unsigned long flags;
217 + int ret = -EIO;
218 + int i;
219 ++ int restarts = 0;
220 +
221 + spin_lock_irqsave(&ec_lock, flags);
222 +
223 +@@ -173,7 +174,9 @@ restart:
224 + if (wait_on_obf(0x6c, 1)) {
225 + printk(KERN_ERR "olpc-ec: timeout waiting for"
226 + " EC to provide data!\n");
227 +- goto restart;
228 ++ if (restarts++ < 10)
229 ++ goto restart;
230 ++ goto err;
231 + }
232 + outbuf[i] = inb(0x68);
233 + printk(KERN_DEBUG "olpc-ec: received 0x%x\n",
234 +diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
235 +index e3af342..76a0d71 100644
236 +--- a/arch/x86/kernel/reboot.c
237 ++++ b/arch/x86/kernel/reboot.c
238 +@@ -641,7 +641,7 @@ void native_machine_shutdown(void)
239 + /* O.K Now that I'm on the appropriate processor,
240 + * stop all of the others.
241 + */
242 +- smp_send_stop();
243 ++ stop_other_cpus();
244 + #endif
245 +
246 + lapic_shutdown();
247 +diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
248 +index d801210..513deac 100644
249 +--- a/arch/x86/kernel/smp.c
250 ++++ b/arch/x86/kernel/smp.c
251 +@@ -159,10 +159,10 @@ asmlinkage void smp_reboot_interrupt(void)
252 + irq_exit();
253 + }
254 +
255 +-static void native_smp_send_stop(void)
256 ++static void native_stop_other_cpus(int wait)
257 + {
258 + unsigned long flags;
259 +- unsigned long wait;
260 ++ unsigned long timeout;
261 +
262 + if (reboot_force)
263 + return;
264 +@@ -179,9 +179,12 @@ static void native_smp_send_stop(void)
265 + if (num_online_cpus() > 1) {
266 + apic->send_IPI_allbutself(REBOOT_VECTOR);
267 +
268 +- /* Don't wait longer than a second */
269 +- wait = USEC_PER_SEC;
270 +- while (num_online_cpus() > 1 && wait--)
271 ++ /*
272 ++ * Don't wait longer than a second if the caller
273 ++ * didn't ask us to wait.
274 ++ */
275 ++ timeout = USEC_PER_SEC;
276 ++ while (num_online_cpus() > 1 && (wait || timeout--))
277 + udelay(1);
278 + }
279 +
280 +@@ -227,7 +230,7 @@ struct smp_ops smp_ops = {
281 + .smp_prepare_cpus = native_smp_prepare_cpus,
282 + .smp_cpus_done = native_smp_cpus_done,
283 +
284 +- .smp_send_stop = native_smp_send_stop,
285 ++ .stop_other_cpus = native_stop_other_cpus,
286 + .smp_send_reschedule = native_smp_send_reschedule,
287 +
288 + .cpu_up = native_cpu_up,
289 +diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
290 +index 725ef4d..4d0f3ed 100644
291 +--- a/arch/x86/kernel/traps.c
292 ++++ b/arch/x86/kernel/traps.c
293 +@@ -568,6 +568,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
294 + if (regs->flags & X86_VM_MASK) {
295 + handle_vm86_trap((struct kernel_vm86_regs *) regs,
296 + error_code, 1);
297 ++ preempt_conditional_cli(regs);
298 + return;
299 + }
300 +
301 +diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
302 +index 5ffb562..61fb985 100644
303 +--- a/arch/x86/kernel/vm86_32.c
304 ++++ b/arch/x86/kernel/vm86_32.c
305 +@@ -551,8 +551,14 @@ cannot_handle:
306 + int handle_vm86_trap(struct kernel_vm86_regs *regs, long error_code, int trapno)
307 + {
308 + if (VMPI.is_vm86pus) {
309 +- if ((trapno == 3) || (trapno == 1))
310 +- return_to_32bit(regs, VM86_TRAP + (trapno << 8));
311 ++ if ((trapno == 3) || (trapno == 1)) {
312 ++ KVM86->regs32->ax = VM86_TRAP + (trapno << 8);
313 ++ /* setting this flag forces the code in entry_32.S to
314 ++ call save_v86_state() and change the stack pointer
315 ++ to KVM86->regs32 */
316 ++ set_thread_flag(TIF_IRET);
317 ++ return 0;
318 ++ }
319 + do_int(regs, trapno, (unsigned char __user *) (regs->pt.ss << 4), SP(regs));
320 + return 0;
321 + }
322 +diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
323 +index 715a7fa..582c8fc 100644
324 +--- a/arch/x86/kvm/emulate.c
325 ++++ b/arch/x86/kvm/emulate.c
326 +@@ -1712,17 +1712,16 @@ static inline int emulate_grp9(struct x86_emulate_ctxt *ctxt,
327 + struct x86_emulate_ops *ops)
328 + {
329 + struct decode_cache *c = &ctxt->decode;
330 +- u64 old = c->dst.orig_val;
331 ++ u64 old = c->dst.orig_val64;
332 +
333 + if (((u32) (old >> 0) != (u32) c->regs[VCPU_REGS_RAX]) ||
334 + ((u32) (old >> 32) != (u32) c->regs[VCPU_REGS_RDX])) {
335 +-
336 + c->regs[VCPU_REGS_RAX] = (u32) (old >> 0);
337 + c->regs[VCPU_REGS_RDX] = (u32) (old >> 32);
338 + ctxt->eflags &= ~EFLG_ZF;
339 + } else {
340 +- c->dst.val = ((u64)c->regs[VCPU_REGS_RCX] << 32) |
341 +- (u32) c->regs[VCPU_REGS_RBX];
342 ++ c->dst.val64 = ((u64)c->regs[VCPU_REGS_RCX] << 32) |
343 ++ (u32) c->regs[VCPU_REGS_RBX];
344 +
345 + ctxt->eflags |= EFLG_ZF;
346 + }
347 +@@ -2535,7 +2534,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
348 + ctxt->vcpu);
349 + if (rc != X86EMUL_CONTINUE)
350 + goto done;
351 +- c->src.orig_val = c->src.val;
352 ++ c->src.orig_val64 = c->src.val64;
353 + }
354 +
355 + if (c->src2.type == OP_MEM) {
356 +diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
357 +index 93730fe..02a5603 100644
358 +--- a/arch/x86/kvm/svm.c
359 ++++ b/arch/x86/kvm/svm.c
360 +@@ -87,6 +87,14 @@ struct nested_state {
361 + /* A VMEXIT is required but not yet emulated */
362 + bool exit_required;
363 +
364 ++ /*
365 ++ * If we vmexit during an instruction emulation we need this to restore
366 ++ * the l1 guest rip after the emulation
367 ++ */
368 ++ unsigned long vmexit_rip;
369 ++ unsigned long vmexit_rsp;
370 ++ unsigned long vmexit_rax;
371 ++
372 + /* cache for intercepts of the guest */
373 + u16 intercept_cr_read;
374 + u16 intercept_cr_write;
375 +@@ -1201,8 +1209,12 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
376 + if (old == new) {
377 + /* cr0 write with ts and mp unchanged */
378 + svm->vmcb->control.exit_code = SVM_EXIT_CR0_SEL_WRITE;
379 +- if (nested_svm_exit_handled(svm) == NESTED_EXIT_DONE)
380 ++ if (nested_svm_exit_handled(svm) == NESTED_EXIT_DONE) {
381 ++ svm->nested.vmexit_rip = kvm_rip_read(vcpu);
382 ++ svm->nested.vmexit_rsp = kvm_register_read(vcpu, VCPU_REGS_RSP);
383 ++ svm->nested.vmexit_rax = kvm_register_read(vcpu, VCPU_REGS_RAX);
384 + return;
385 ++ }
386 + }
387 + }
388 +
389 +@@ -2398,6 +2410,23 @@ static int emulate_on_interception(struct vcpu_svm *svm)
390 + return 1;
391 + }
392 +
393 ++static int cr0_write_interception(struct vcpu_svm *svm)
394 ++{
395 ++ struct kvm_vcpu *vcpu = &svm->vcpu;
396 ++ int r;
397 ++
398 ++ r = emulate_instruction(&svm->vcpu, 0, 0, 0);
399 ++
400 ++ if (svm->nested.vmexit_rip) {
401 ++ kvm_register_write(vcpu, VCPU_REGS_RIP, svm->nested.vmexit_rip);
402 ++ kvm_register_write(vcpu, VCPU_REGS_RSP, svm->nested.vmexit_rsp);
403 ++ kvm_register_write(vcpu, VCPU_REGS_RAX, svm->nested.vmexit_rax);
404 ++ svm->nested.vmexit_rip = 0;
405 ++ }
406 ++
407 ++ return r == EMULATE_DONE;
408 ++}
409 ++
410 + static int cr8_write_interception(struct vcpu_svm *svm)
411 + {
412 + struct kvm_run *kvm_run = svm->vcpu.run;
413 +@@ -2671,7 +2700,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm) = {
414 + [SVM_EXIT_READ_CR4] = emulate_on_interception,
415 + [SVM_EXIT_READ_CR8] = emulate_on_interception,
416 + [SVM_EXIT_CR0_SEL_WRITE] = emulate_on_interception,
417 +- [SVM_EXIT_WRITE_CR0] = emulate_on_interception,
418 ++ [SVM_EXIT_WRITE_CR0] = cr0_write_interception,
419 + [SVM_EXIT_WRITE_CR3] = emulate_on_interception,
420 + [SVM_EXIT_WRITE_CR4] = emulate_on_interception,
421 + [SVM_EXIT_WRITE_CR8] = cr8_write_interception,
422 +@@ -3253,6 +3282,10 @@ static void svm_cpuid_update(struct kvm_vcpu *vcpu)
423 + static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
424 + {
425 + switch (func) {
426 ++ case 0x80000001:
427 ++ if (nested)
428 ++ entry->ecx |= (1 << 2); /* Set SVM bit */
429 ++ break;
430 + case 0x8000000A:
431 + entry->eax = 1; /* SVM revision 1 */
432 + entry->ebx = 8; /* Lets support 8 ASIDs in case we add proper
433 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
434 +index fd22688..be92511 100644
435 +--- a/arch/x86/kvm/x86.c
436 ++++ b/arch/x86/kvm/x86.c
437 +@@ -1910,9 +1910,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
438 + 0 /* Reserved, XSAVE, OSXSAVE */;
439 + /* cpuid 0x80000001.ecx */
440 + const u32 kvm_supported_word6_x86_features =
441 +- F(LAHF_LM) | F(CMP_LEGACY) | F(SVM) | 0 /* ExtApicSpace */ |
442 ++ F(LAHF_LM) | F(CMP_LEGACY) | 0 /*SVM*/ | 0 /* ExtApicSpace */ |
443 + F(CR8_LEGACY) | F(ABM) | F(SSE4A) | F(MISALIGNSSE) |
444 +- F(3DNOWPREFETCH) | 0 /* OSVW */ | 0 /* IBS */ | F(SSE5) |
445 ++ F(3DNOWPREFETCH) | 0 /* OSVW */ | 0 /* IBS */ | F(XOP) |
446 + 0 /* SKINIT */ | 0 /* WDT */;
447 +
448 + /* all calls to cpuid_count() should be made on the same cpu */
449 +diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
450 +index 27dff06..4d32089 100644
451 +--- a/arch/x86/xen/enlighten.c
452 ++++ b/arch/x86/xen/enlighten.c
453 +@@ -1001,7 +1001,7 @@ static void xen_reboot(int reason)
454 + struct sched_shutdown r = { .reason = reason };
455 +
456 + #ifdef CONFIG_SMP
457 +- smp_send_stop();
458 ++ stop_other_cpus();
459 + #endif
460 +
461 + if (HYPERVISOR_sched_op(SCHEDOP_shutdown, &r))
462 +diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
463 +index a29693f..d2dfbf5 100644
464 +--- a/arch/x86/xen/smp.c
465 ++++ b/arch/x86/xen/smp.c
466 +@@ -398,9 +398,9 @@ static void stop_self(void *v)
467 + BUG();
468 + }
469 +
470 +-static void xen_smp_send_stop(void)
471 ++static void xen_stop_other_cpus(int wait)
472 + {
473 +- smp_call_function(stop_self, NULL, 0);
474 ++ smp_call_function(stop_self, NULL, wait);
475 + }
476 +
477 + static void xen_smp_send_reschedule(int cpu)
478 +@@ -468,7 +468,7 @@ static const struct smp_ops xen_smp_ops __initdata = {
479 + .cpu_disable = xen_cpu_disable,
480 + .play_dead = xen_play_dead,
481 +
482 +- .smp_send_stop = xen_smp_send_stop,
483 ++ .stop_other_cpus = xen_stop_other_cpus,
484 + .smp_send_reschedule = xen_smp_send_reschedule,
485 +
486 + .send_call_func_ipi = xen_smp_send_call_function_ipi,
487 +diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
488 +index 88aa888..22a20e8 100644
489 +--- a/drivers/ata/ahci.h
490 ++++ b/drivers/ata/ahci.h
491 +@@ -72,6 +72,7 @@ enum {
492 + AHCI_CMD_RESET = (1 << 8),
493 + AHCI_CMD_CLR_BUSY = (1 << 10),
494 +
495 ++ RX_FIS_PIO_SETUP = 0x20, /* offset of PIO Setup FIS data */
496 + RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */
497 + RX_FIS_SDB = 0x58, /* offset of SDB FIS data */
498 + RX_FIS_UNK = 0x60, /* offset of Unknown FIS data */
499 +diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
500 +index b765a01..b5aecd0 100644
501 +--- a/drivers/ata/libahci.c
502 ++++ b/drivers/ata/libahci.c
503 +@@ -1824,12 +1824,24 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc)
504 + static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc)
505 + {
506 + struct ahci_port_priv *pp = qc->ap->private_data;
507 +- u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
508 ++ u8 *rx_fis = pp->rx_fis;
509 +
510 + if (pp->fbs_enabled)
511 +- d2h_fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ;
512 ++ rx_fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ;
513 ++
514 ++ /*
515 ++ * After a successful execution of an ATA PIO data-in command,
516 ++ * the device doesn't send D2H Reg FIS to update the TF and
517 ++ * the host should take TF and E_Status from the preceding PIO
518 ++ * Setup FIS.
519 ++ */
520 ++ if (qc->tf.protocol == ATA_PROT_PIO && qc->dma_dir == DMA_FROM_DEVICE &&
521 ++ !(qc->flags & ATA_QCFLAG_FAILED)) {
522 ++ ata_tf_from_fis(rx_fis + RX_FIS_PIO_SETUP, &qc->result_tf);
523 ++ qc->result_tf.command = (rx_fis + RX_FIS_PIO_SETUP)[15];
524 ++ } else
525 ++ ata_tf_from_fis(rx_fis + RX_FIS_D2H_REG, &qc->result_tf);
526 +
527 +- ata_tf_from_fis(d2h_fis, &qc->result_tf);
528 + return true;
529 + }
530 +
531 +diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
532 +index 76a1abb..283b127 100644
533 +--- a/drivers/bluetooth/hci_ldisc.c
534 ++++ b/drivers/bluetooth/hci_ldisc.c
535 +@@ -258,9 +258,16 @@ static int hci_uart_tty_open(struct tty_struct *tty)
536 +
537 + BT_DBG("tty %p", tty);
538 +
539 ++ /* FIXME: This btw is bogus, nothing requires the old ldisc to clear
540 ++ the pointer */
541 + if (hu)
542 + return -EEXIST;
543 +
544 ++ /* Error if the tty has no write op instead of leaving an exploitable
545 ++ hole */
546 ++ if (tty->ops->write == NULL)
547 ++ return -EOPNOTSUPP;
548 ++
549 + if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) {
550 + BT_ERR("Can't allocate control structure");
551 + return -ENFILE;
552 +diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
553 +index 308903e..824d67c 100644
554 +--- a/drivers/char/pcmcia/synclink_cs.c
555 ++++ b/drivers/char/pcmcia/synclink_cs.c
556 +@@ -4132,6 +4132,8 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
557 + if (cmd != SIOCWANDEV)
558 + return hdlc_ioctl(dev, ifr, cmd);
559 +
560 ++ memset(&new_line, 0, size);
561 ++
562 + switch(ifr->ifr_settings.type) {
563 + case IF_GET_IFACE: /* return current sync_serial_settings */
564 +
565 +diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
566 +index 54f0fb4..ae48da9 100755
567 +--- a/drivers/idle/intel_idle.c
568 ++++ b/drivers/idle/intel_idle.c
569 +@@ -308,7 +308,7 @@ static int intel_idle_probe(void)
570 + break;
571 +
572 + case 0x1C: /* 28 - Atom Processor */
573 +- lapic_timer_reliable_states = (1 << 2) | (1 << 1); /* C2, C1 */
574 ++ lapic_timer_reliable_states = (1 << 1); /* C1 */
575 + cpuidle_state_table = atom_cstates;
576 + choose_substate = choose_zero_substate;
577 + break;
578 +diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
579 +index fc8454d..51dc60d 100644
580 +--- a/drivers/isdn/i4l/isdn_tty.c
581 ++++ b/drivers/isdn/i4l/isdn_tty.c
582 +@@ -2636,12 +2636,6 @@ isdn_tty_modem_result(int code, modem_info * info)
583 + if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) {
584 + return;
585 + }
586 +-#ifdef CONFIG_ISDN_AUDIO
587 +- if ( !info->vonline )
588 +- tty_ldisc_flush(info->tty);
589 +-#else
590 +- tty_ldisc_flush(info->tty);
591 +-#endif
592 + if ((info->flags & ISDN_ASYNC_CHECK_CD) &&
593 + (!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) &&
594 + (info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) {
595 +diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
596 +index 1f59ee2..17bbacb 100644
597 +--- a/drivers/misc/sgi-xp/xpc_uv.c
598 ++++ b/drivers/misc/sgi-xp/xpc_uv.c
599 +@@ -417,6 +417,7 @@ xpc_process_activate_IRQ_rcvd_uv(void)
600 + static void
601 + xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
602 + struct xpc_activate_mq_msghdr_uv *msg_hdr,
603 ++ int part_setup,
604 + int *wakeup_hb_checker)
605 + {
606 + unsigned long irq_flags;
607 +@@ -481,6 +482,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
608 + case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV: {
609 + struct xpc_activate_mq_msg_chctl_closerequest_uv *msg;
610 +
611 ++ if (!part_setup)
612 ++ break;
613 ++
614 + msg = container_of(msg_hdr, struct
615 + xpc_activate_mq_msg_chctl_closerequest_uv,
616 + hdr);
617 +@@ -497,6 +501,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
618 + case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV: {
619 + struct xpc_activate_mq_msg_chctl_closereply_uv *msg;
620 +
621 ++ if (!part_setup)
622 ++ break;
623 ++
624 + msg = container_of(msg_hdr, struct
625 + xpc_activate_mq_msg_chctl_closereply_uv,
626 + hdr);
627 +@@ -511,6 +518,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
628 + case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV: {
629 + struct xpc_activate_mq_msg_chctl_openrequest_uv *msg;
630 +
631 ++ if (!part_setup)
632 ++ break;
633 ++
634 + msg = container_of(msg_hdr, struct
635 + xpc_activate_mq_msg_chctl_openrequest_uv,
636 + hdr);
637 +@@ -528,6 +538,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
638 + case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV: {
639 + struct xpc_activate_mq_msg_chctl_openreply_uv *msg;
640 +
641 ++ if (!part_setup)
642 ++ break;
643 ++
644 + msg = container_of(msg_hdr, struct
645 + xpc_activate_mq_msg_chctl_openreply_uv, hdr);
646 + args = &part->remote_openclose_args[msg->ch_number];
647 +@@ -545,6 +558,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
648 + case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENCOMPLETE_UV: {
649 + struct xpc_activate_mq_msg_chctl_opencomplete_uv *msg;
650 +
651 ++ if (!part_setup)
652 ++ break;
653 ++
654 + msg = container_of(msg_hdr, struct
655 + xpc_activate_mq_msg_chctl_opencomplete_uv, hdr);
656 + spin_lock_irqsave(&part->chctl_lock, irq_flags);
657 +@@ -621,6 +637,7 @@ xpc_handle_activate_IRQ_uv(int irq, void *dev_id)
658 +
659 + part_referenced = xpc_part_ref(part);
660 + xpc_handle_activate_mq_msg_uv(part, msg_hdr,
661 ++ part_referenced,
662 + &wakeup_hb_checker);
663 + if (part_referenced)
664 + xpc_part_deref(part);
665 +diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
666 +index 28b53d1..26a1aca 100644
667 +--- a/drivers/net/gianfar.c
668 ++++ b/drivers/net/gianfar.c
669 +@@ -2427,7 +2427,7 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
670 + if (skb_queue_len(&priv->rx_recycle) < rx_queue->rx_ring_size &&
671 + skb_recycle_check(skb, priv->rx_buffer_size +
672 + RXBUF_ALIGNMENT))
673 +- __skb_queue_head(&priv->rx_recycle, skb);
674 ++ skb_queue_head(&priv->rx_recycle, skb);
675 + else
676 + dev_kfree_skb_any(skb);
677 +
678 +@@ -2498,7 +2498,7 @@ struct sk_buff * gfar_new_skb(struct net_device *dev)
679 + struct gfar_private *priv = netdev_priv(dev);
680 + struct sk_buff *skb = NULL;
681 +
682 +- skb = __skb_dequeue(&priv->rx_recycle);
683 ++ skb = skb_dequeue(&priv->rx_recycle);
684 + if (!skb)
685 + skb = netdev_alloc_skb(dev,
686 + priv->rx_buffer_size + RXBUF_ALIGNMENT);
687 +@@ -2675,7 +2675,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
688 + * recycle list.
689 + */
690 + skb_reserve(skb, -GFAR_CB(skb)->alignamount);
691 +- __skb_queue_head(&priv->rx_recycle, skb);
692 ++ skb_queue_head(&priv->rx_recycle, skb);
693 + }
694 + } else {
695 + /* Increment the number of packets */
696 +diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
697 +index 9bda023..ddab703 100644
698 +--- a/drivers/net/gianfar_ethtool.c
699 ++++ b/drivers/net/gianfar_ethtool.c
700 +@@ -538,7 +538,7 @@ static int gfar_set_rx_csum(struct net_device *dev, uint32_t data)
701 +
702 + unlock_tx_qs(priv);
703 + unlock_rx_qs(priv);
704 +- local_irq_save(flags);
705 ++ local_irq_restore(flags);
706 +
707 + for (i = 0; i < priv->num_rx_queues; i++)
708 + gfar_clean_rx_ring(priv->rx_queue[i],
709 +diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
710 +index c865dda..81f982a 100644
711 +--- a/drivers/net/netxen/netxen_nic_init.c
712 ++++ b/drivers/net/netxen/netxen_nic_init.c
713 +@@ -1540,7 +1540,6 @@ netxen_process_rcv(struct netxen_adapter *adapter,
714 + if (pkt_offset)
715 + skb_pull(skb, pkt_offset);
716 +
717 +- skb->truesize = skb->len + sizeof(struct sk_buff);
718 + skb->protocol = eth_type_trans(skb, netdev);
719 +
720 + napi_gro_receive(&sds_ring->napi, skb);
721 +@@ -1602,8 +1601,6 @@ netxen_process_lro(struct netxen_adapter *adapter,
722 +
723 + skb_put(skb, lro_length + data_offset);
724 +
725 +- skb->truesize = skb->len + sizeof(struct sk_buff) + skb_headroom(skb);
726 +-
727 + skb_pull(skb, l2_hdr_offset);
728 + skb->protocol = eth_type_trans(skb, netdev);
729 +
730 +diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
731 +index 71a4e66..a4c69d5 100644
732 +--- a/drivers/net/qlcnic/qlcnic_init.c
733 ++++ b/drivers/net/qlcnic/qlcnic_init.c
734 +@@ -1363,7 +1363,6 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter,
735 + if (pkt_offset)
736 + skb_pull(skb, pkt_offset);
737 +
738 +- skb->truesize = skb->len + sizeof(struct sk_buff);
739 + skb->protocol = eth_type_trans(skb, netdev);
740 +
741 + napi_gro_receive(&sds_ring->napi, skb);
742 +@@ -1425,8 +1424,6 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
743 +
744 + skb_put(skb, lro_length + data_offset);
745 +
746 +- skb->truesize = skb->len + sizeof(struct sk_buff) + skb_headroom(skb);
747 +-
748 + skb_pull(skb, l2_hdr_offset);
749 + skb->protocol = eth_type_trans(skb, netdev);
750 +
751 +@@ -1659,8 +1656,6 @@ qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter,
752 + if (pkt_offset)
753 + skb_pull(skb, pkt_offset);
754 +
755 +- skb->truesize = skb->len + sizeof(struct sk_buff);
756 +-
757 + if (!qlcnic_check_loopback_buff(skb->data))
758 + adapter->diag_cnt++;
759 +
760 +diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
761 +index 9a251ac..b7758d3 100644
762 +--- a/drivers/net/r6040.c
763 ++++ b/drivers/net/r6040.c
764 +@@ -988,16 +988,18 @@ static void r6040_multicast_list(struct net_device *dev)
765 + /* Multicast Address 1~4 case */
766 + i = 0;
767 + netdev_for_each_mc_addr(ha, dev) {
768 +- if (i < MCAST_MAX) {
769 +- adrp = (u16 *) ha->addr;
770 +- iowrite16(adrp[0], ioaddr + MID_1L + 8 * i);
771 +- iowrite16(adrp[1], ioaddr + MID_1M + 8 * i);
772 +- iowrite16(adrp[2], ioaddr + MID_1H + 8 * i);
773 +- } else {
774 +- iowrite16(0xffff, ioaddr + MID_1L + 8 * i);
775 +- iowrite16(0xffff, ioaddr + MID_1M + 8 * i);
776 +- iowrite16(0xffff, ioaddr + MID_1H + 8 * i);
777 +- }
778 ++ if (i >= MCAST_MAX)
779 ++ break;
780 ++ adrp = (u16 *) ha->addr;
781 ++ iowrite16(adrp[0], ioaddr + MID_1L + 8 * i);
782 ++ iowrite16(adrp[1], ioaddr + MID_1M + 8 * i);
783 ++ iowrite16(adrp[2], ioaddr + MID_1H + 8 * i);
784 ++ i++;
785 ++ }
786 ++ while (i < MCAST_MAX) {
787 ++ iowrite16(0xffff, ioaddr + MID_1L + 8 * i);
788 ++ iowrite16(0xffff, ioaddr + MID_1M + 8 * i);
789 ++ iowrite16(0xffff, ioaddr + MID_1H + 8 * i);
790 + i++;
791 + }
792 + }
793 +diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c
794 +index 187e263..53d0f20 100644
795 +--- a/drivers/net/wireless/p54/eeprom.c
796 ++++ b/drivers/net/wireless/p54/eeprom.c
797 +@@ -262,8 +262,10 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)
798 + list->max_entries = max_channel_num;
799 + list->channels = kzalloc(sizeof(struct p54_channel_entry) *
800 + max_channel_num, GFP_KERNEL);
801 +- if (!list->channels)
802 ++ if (!list->channels) {
803 ++ ret = -ENOMEM;
804 + goto free;
805 ++ }
806 +
807 + for (i = 0; i < max_channel_num; i++) {
808 + if (i < priv->iq_autocal_len) {
809 +diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
810 +index 7307325..1214afe 100644
811 +--- a/drivers/net/wireless/p54/p54usb.c
812 ++++ b/drivers/net/wireless/p54/p54usb.c
813 +@@ -33,8 +33,17 @@ MODULE_ALIAS("prism54usb");
814 + MODULE_FIRMWARE("isl3886usb");
815 + MODULE_FIRMWARE("isl3887usb");
816 +
817 ++/*
818 ++ * Note:
819 ++ *
820 ++ * Always update our wiki's device list (located at:
821 ++ * http://wireless.kernel.org/en/users/Drivers/p54/devices ),
822 ++ * whenever you add a new device.
823 ++ */
824 ++
825 + static struct usb_device_id p54u_table[] __devinitdata = {
826 + /* Version 1 devices (pci chip + net2280) */
827 ++ {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */
828 + {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */
829 + {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */
830 + {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */
831 +@@ -47,7 +56,9 @@ static struct usb_device_id p54u_table[] __devinitdata = {
832 + {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */
833 + {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */
834 + {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */
835 ++ {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */
836 + {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */
837 ++ {USB_DEVICE(0x1630, 0x0005)}, /* 2Wire 802.11g USB (v1) / Z-Com */
838 + {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */
839 + {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */
840 + {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */
841 +@@ -60,6 +71,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
842 + {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */
843 + {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */
844 + {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */
845 ++ {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */
846 + {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */
847 + {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */
848 + {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */
849 +@@ -79,6 +91,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
850 + {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */
851 + {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */
852 + {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */
853 ++ {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */
854 + {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */
855 + {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */
856 + {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */
857 +@@ -930,8 +943,8 @@ static int __devinit p54u_probe(struct usb_interface *intf,
858 + #ifdef CONFIG_PM
859 + /* ISL3887 needs a full reset on resume */
860 + udev->reset_resume = 1;
861 ++#endif /* CONFIG_PM */
862 + err = p54u_device_reset(dev);
863 +-#endif
864 +
865 + priv->hw_type = P54U_3887;
866 + dev->extra_tx_headroom += sizeof(struct lm87_tx_hdr);
867 +diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
868 +index efe8f63..1fccc85 100644
869 +--- a/drivers/platform/x86/asus-laptop.c
870 ++++ b/drivers/platform/x86/asus-laptop.c
871 +@@ -1064,9 +1064,9 @@ static ssize_t store_gps(struct device *dev, struct device_attribute *attr,
872 + */
873 + static int asus_gps_rfkill_set(void *data, bool blocked)
874 + {
875 +- acpi_handle handle = data;
876 ++ struct asus_laptop *asus = data;
877 +
878 +- return asus_gps_switch(handle, !blocked);
879 ++ return asus_gps_switch(asus, !blocked);
880 + }
881 +
882 + static const struct rfkill_ops asus_gps_rfkill_ops = {
883 +@@ -1093,7 +1093,7 @@ static int asus_rfkill_init(struct asus_laptop *asus)
884 +
885 + asus->gps_rfkill = rfkill_alloc("asus-gps", &asus->platform_device->dev,
886 + RFKILL_TYPE_GPS,
887 +- &asus_gps_rfkill_ops, NULL);
888 ++ &asus_gps_rfkill_ops, asus);
889 + if (!asus->gps_rfkill)
890 + return -EINVAL;
891 +
892 +diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
893 +index f672d62..3ccbf76 100644
894 +--- a/drivers/scsi/gdth.c
895 ++++ b/drivers/scsi/gdth.c
896 +@@ -4175,6 +4175,14 @@ static int ioc_general(void __user *arg, char *cmnd)
897 + ha = gdth_find_ha(gen.ionode);
898 + if (!ha)
899 + return -EFAULT;
900 ++
901 ++ if (gen.data_len > INT_MAX)
902 ++ return -EINVAL;
903 ++ if (gen.sense_len > INT_MAX)
904 ++ return -EINVAL;
905 ++ if (gen.data_len + gen.sense_len > INT_MAX)
906 ++ return -EINVAL;
907 ++
908 + if (gen.data_len + gen.sense_len != 0) {
909 + if (!(buf = gdth_ioctl_alloc(ha, gen.data_len + gen.sense_len,
910 + FALSE, &paddr)))
911 +diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
912 +index 8c496b5..fb78856 100644
913 +--- a/drivers/scsi/libsas/sas_ata.c
914 ++++ b/drivers/scsi/libsas/sas_ata.c
915 +@@ -347,6 +347,7 @@ static int sas_ata_scr_read(struct ata_link *link, unsigned int sc_reg_in,
916 + static struct ata_port_operations sas_sata_ops = {
917 + .phy_reset = sas_ata_phy_reset,
918 + .post_internal_cmd = sas_ata_post_internal,
919 ++ .qc_defer = ata_std_qc_defer,
920 + .qc_prep = ata_noop_qc_prep,
921 + .qc_issue = sas_ata_qc_issue,
922 + .qc_fill_rtf = sas_ata_qc_fill_rtf,
923 +diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
924 +index 1646fe7..9cc450b 100644
925 +--- a/drivers/scsi/scsi_lib.c
926 ++++ b/drivers/scsi/scsi_lib.c
927 +@@ -2436,7 +2436,8 @@ scsi_internal_device_unblock(struct scsi_device *sdev)
928 + sdev->sdev_state = SDEV_RUNNING;
929 + else if (sdev->sdev_state == SDEV_CREATED_BLOCK)
930 + sdev->sdev_state = SDEV_CREATED;
931 +- else
932 ++ else if (sdev->sdev_state != SDEV_CANCEL &&
933 ++ sdev->sdev_state != SDEV_OFFLINE)
934 + return -EINVAL;
935 +
936 + spin_lock_irqsave(q->queue_lock, flags);
937 +diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
938 +index c23ab97..86ea5f3 100644
939 +--- a/drivers/scsi/scsi_sysfs.c
940 ++++ b/drivers/scsi/scsi_sysfs.c
941 +@@ -990,10 +990,11 @@ static void __scsi_remove_target(struct scsi_target *starget)
942 + list_for_each_entry(sdev, &shost->__devices, siblings) {
943 + if (sdev->channel != starget->channel ||
944 + sdev->id != starget->id ||
945 +- sdev->sdev_state == SDEV_DEL)
946 ++ scsi_device_get(sdev))
947 + continue;
948 + spin_unlock_irqrestore(shost->host_lock, flags);
949 + scsi_remove_device(sdev);
950 ++ scsi_device_put(sdev);
951 + spin_lock_irqsave(shost->host_lock, flags);
952 + goto restart;
953 + }
954 +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
955 +index 8802e48..e4d9c51 100644
956 +--- a/drivers/scsi/sd.c
957 ++++ b/drivers/scsi/sd.c
958 +@@ -2204,11 +2204,10 @@ static void sd_probe_async(void *data, async_cookie_t cookie)
959 + index = sdkp->index;
960 + dev = &sdp->sdev_gendev;
961 +
962 +- if (index < SD_MAX_DISKS) {
963 +- gd->major = sd_major((index & 0xf0) >> 4);
964 +- gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
965 +- gd->minors = SD_MINORS;
966 +- }
967 ++ gd->major = sd_major((index & 0xf0) >> 4);
968 ++ gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
969 ++ gd->minors = SD_MINORS;
970 ++
971 + gd->fops = &sd_fops;
972 + gd->private_data = &sdkp->driver;
973 + gd->queue = sdkp->device->request_queue;
974 +@@ -2297,6 +2296,12 @@ static int sd_probe(struct device *dev)
975 + if (error)
976 + goto out_put;
977 +
978 ++ if (index >= SD_MAX_DISKS) {
979 ++ error = -ENODEV;
980 ++ sdev_printk(KERN_WARNING, sdp, "SCSI disk (sd) name space exhausted.\n");
981 ++ goto out_free_index;
982 ++ }
983 ++
984 + error = sd_format_disk_name("sd", index, gd->disk_name, DISK_NAME_LEN);
985 + if (error)
986 + goto out_free_index;
987 +diff --git a/drivers/staging/phison/phison.c b/drivers/staging/phison/phison.c
988 +index 42783d7..6771520 100644
989 +--- a/drivers/staging/phison/phison.c
990 ++++ b/drivers/staging/phison/phison.c
991 +@@ -62,7 +62,7 @@ static int phison_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
992 + };
993 + const struct ata_port_info *ppi[] = { &info, NULL };
994 +
995 +- ret = ata_pci_sff_init_one(pdev, ppi, &phison_sht, NULL, 0);
996 ++ ret = ata_pci_bmdma_init_one(pdev, ppi, &phison_sht, NULL, 0);
997 +
998 + dev_dbg(&pdev->dev, "phison_init_one(), ret = %x\n", ret);
999 +
1000 +diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c
1001 +index a2566f1..af3832b 100644
1002 +--- a/drivers/staging/usbip/usbip_event.c
1003 ++++ b/drivers/staging/usbip/usbip_event.c
1004 +@@ -38,21 +38,13 @@ static int event_handler(struct usbip_device *ud)
1005 + ud->eh_ops.shutdown(ud);
1006 +
1007 + ud->event &= ~USBIP_EH_SHUTDOWN;
1008 +-
1009 +- break;
1010 + }
1011 +
1012 +- /* Stop the error handler. */
1013 +- if (ud->event & USBIP_EH_BYE)
1014 +- return -1;
1015 +-
1016 + /* Reset the device. */
1017 + if (ud->event & USBIP_EH_RESET) {
1018 + ud->eh_ops.reset(ud);
1019 +
1020 + ud->event &= ~USBIP_EH_RESET;
1021 +-
1022 +- break;
1023 + }
1024 +
1025 + /* Mark the device as unusable. */
1026 +@@ -60,13 +52,11 @@ static int event_handler(struct usbip_device *ud)
1027 + ud->eh_ops.unusable(ud);
1028 +
1029 + ud->event &= ~USBIP_EH_UNUSABLE;
1030 +-
1031 +- break;
1032 + }
1033 +
1034 +- /* NOTREACHED */
1035 +- printk(KERN_ERR "%s: unknown event\n", __func__);
1036 +- return -1;
1037 ++ /* Stop the error handler. */
1038 ++ if (ud->event & USBIP_EH_BYE)
1039 ++ return -1;
1040 + }
1041 +
1042 + return 0;
1043 +diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c
1044 +index be5d8db..b6c871c 100644
1045 +--- a/drivers/staging/usbip/vhci_hcd.c
1046 ++++ b/drivers/staging/usbip/vhci_hcd.c
1047 +@@ -164,6 +164,8 @@ void rh_port_disconnect(int rhport)
1048 + * spin_unlock(&vdev->ud.lock); */
1049 +
1050 + spin_unlock_irqrestore(&the_controller->lock, flags);
1051 ++
1052 ++ usb_hcd_poll_rh_status(vhci_to_hcd(the_controller));
1053 + }
1054 +
1055 +
1056 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1057 +index ffc80e3..53467b5 100644
1058 +--- a/drivers/usb/core/hub.c
1059 ++++ b/drivers/usb/core/hub.c
1060 +@@ -2859,13 +2859,16 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
1061 + else
1062 + i = udev->descriptor.bMaxPacketSize0;
1063 + if (le16_to_cpu(udev->ep0.desc.wMaxPacketSize) != i) {
1064 +- if (udev->speed != USB_SPEED_FULL ||
1065 ++ if (udev->speed == USB_SPEED_LOW ||
1066 + !(i == 8 || i == 16 || i == 32 || i == 64)) {
1067 +- dev_err(&udev->dev, "ep0 maxpacket = %d\n", i);
1068 ++ dev_err(&udev->dev, "Invalid ep0 maxpacket: %d\n", i);
1069 + retval = -EMSGSIZE;
1070 + goto fail;
1071 + }
1072 +- dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i);
1073 ++ if (udev->speed == USB_SPEED_FULL)
1074 ++ dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i);
1075 ++ else
1076 ++ dev_warn(&udev->dev, "Using ep0 maxpacket: %d\n", i);
1077 + udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i);
1078 + usb_ep0_reinit(udev);
1079 + }
1080 +diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
1081 +index 9f0ce7d..d6e3e41 100644
1082 +--- a/drivers/usb/core/message.c
1083 ++++ b/drivers/usb/core/message.c
1084 +@@ -1140,13 +1140,6 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1085 + {
1086 + int i;
1087 +
1088 +- dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__,
1089 +- skip_ep0 ? "non-ep0" : "all");
1090 +- for (i = skip_ep0; i < 16; ++i) {
1091 +- usb_disable_endpoint(dev, i, true);
1092 +- usb_disable_endpoint(dev, i + USB_DIR_IN, true);
1093 +- }
1094 +-
1095 + /* getting rid of interfaces will disconnect
1096 + * any drivers bound to them (a key side effect)
1097 + */
1098 +@@ -1176,6 +1169,13 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1099 + if (dev->state == USB_STATE_CONFIGURED)
1100 + usb_set_device_state(dev, USB_STATE_ADDRESS);
1101 + }
1102 ++
1103 ++ dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__,
1104 ++ skip_ep0 ? "non-ep0" : "all");
1105 ++ for (i = skip_ep0; i < 16; ++i) {
1106 ++ usb_disable_endpoint(dev, i, true);
1107 ++ usb_disable_endpoint(dev, i + USB_DIR_IN, true);
1108 ++ }
1109 + }
1110 +
1111 + /**
1112 +diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
1113 +index d623c7b..959f062 100644
1114 +--- a/drivers/usb/gadget/atmel_usba_udc.c
1115 ++++ b/drivers/usb/gadget/atmel_usba_udc.c
1116 +@@ -2014,6 +2014,9 @@ static int __init usba_udc_probe(struct platform_device *pdev)
1117 + } else {
1118 + disable_irq(gpio_to_irq(udc->vbus_pin));
1119 + }
1120 ++ } else {
1121 ++ /* gpio_request fail so use -EINVAL for gpio_is_valid */
1122 ++ ubc->vbus_pin = -EINVAL;
1123 + }
1124 + }
1125 +
1126 +diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
1127 +index 391d169..4b02b32 100644
1128 +--- a/drivers/usb/gadget/composite.c
1129 ++++ b/drivers/usb/gadget/composite.c
1130 +@@ -838,7 +838,8 @@ unknown:
1131 + */
1132 + switch (ctrl->bRequestType & USB_RECIP_MASK) {
1133 + case USB_RECIP_INTERFACE:
1134 +- f = cdev->config->interface[intf];
1135 ++ if (cdev->config)
1136 ++ f = cdev->config->interface[intf];
1137 + break;
1138 +
1139 + case USB_RECIP_ENDPOINT:
1140 +diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
1141 +index d47a123..bd6226c 100644
1142 +--- a/drivers/usb/gadget/f_acm.c
1143 ++++ b/drivers/usb/gadget/f_acm.c
1144 +@@ -111,7 +111,7 @@ acm_iad_descriptor = {
1145 + .bInterfaceCount = 2, // control + data
1146 + .bFunctionClass = USB_CLASS_COMM,
1147 + .bFunctionSubClass = USB_CDC_SUBCLASS_ACM,
1148 +- .bFunctionProtocol = USB_CDC_PROTO_NONE,
1149 ++ .bFunctionProtocol = USB_CDC_ACM_PROTO_AT_V25TER,
1150 + /* .iFunction = DYNAMIC */
1151 + };
1152 +
1153 +diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
1154 +index d1af253..bc43322 100644
1155 +--- a/drivers/usb/gadget/g_ffs.c
1156 ++++ b/drivers/usb/gadget/g_ffs.c
1157 +@@ -52,8 +52,8 @@ MODULE_AUTHOR("Michal Nazarewicz");
1158 + MODULE_LICENSE("GPL");
1159 +
1160 +
1161 +-static unsigned short gfs_vendor_id = 0x0525; /* XXX NetChip */
1162 +-static unsigned short gfs_product_id = 0xa4ac; /* XXX */
1163 ++static unsigned short gfs_vendor_id = 0x1d6b; /* Linux Foundation */
1164 ++static unsigned short gfs_product_id = 0x0105; /* FunctionFS Gadget */
1165 +
1166 + static struct usb_device_descriptor gfs_dev_desc = {
1167 + .bLength = sizeof gfs_dev_desc,
1168 +diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
1169 +index a930d7f..0ac051e 100644
1170 +--- a/drivers/usb/gadget/multi.c
1171 ++++ b/drivers/usb/gadget/multi.c
1172 +@@ -39,8 +39,8 @@
1173 +
1174 + /*-------------------------------------------------------------------------*/
1175 +
1176 +-#define MULTI_VENDOR_NUM 0x0525 /* XXX NetChip */
1177 +-#define MULTI_PRODUCT_NUM 0xa4ab /* XXX */
1178 ++#define MULTI_VENDOR_NUM 0x1d6b /* Linux Foundation */
1179 ++#define MULTI_PRODUCT_NUM 0x0104 /* Multifunction Composite Gadget */
1180 +
1181 + /*-------------------------------------------------------------------------*/
1182 +
1183 +diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h
1184 +index 95d0f5a..25563e9 100644
1185 +--- a/drivers/usb/host/r8a66597.h
1186 ++++ b/drivers/usb/host/r8a66597.h
1187 +@@ -227,7 +227,7 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597,
1188 + int odd = len & 0x0001;
1189 +
1190 + len = len / 2;
1191 +- ioread16_rep(fifoaddr, buf, len);
1192 ++ iowrite16_rep(fifoaddr, buf, len);
1193 + if (unlikely(odd)) {
1194 + buf = &buf[len];
1195 + iowrite8((unsigned char)*buf, fifoaddr);
1196 +diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
1197 +index b611420..611a9d2 100644
1198 +--- a/drivers/usb/musb/blackfin.c
1199 ++++ b/drivers/usb/musb/blackfin.c
1200 +@@ -342,8 +342,10 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
1201 +
1202 + usb_nop_xceiv_register();
1203 + musb->xceiv = otg_get_transceiver();
1204 +- if (!musb->xceiv)
1205 ++ if (!musb->xceiv) {
1206 ++ gpio_free(musb->config->gpio_vrsel);
1207 + return -ENODEV;
1208 ++ }
1209 +
1210 + if (ANOMALY_05000346) {
1211 + bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value);
1212 +@@ -394,8 +396,9 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
1213 +
1214 + int musb_platform_exit(struct musb *musb)
1215 + {
1216 +-
1217 + gpio_free(musb->config->gpio_vrsel);
1218 +
1219 ++ otg_put_transceiver(musb->xceiv);
1220 ++ usb_nop_xceiv_unregister();
1221 + return 0;
1222 + }
1223 +diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
1224 +index 5762436..6e67629 100644
1225 +--- a/drivers/usb/musb/davinci.c
1226 ++++ b/drivers/usb/musb/davinci.c
1227 +@@ -446,6 +446,7 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
1228 + fail:
1229 + clk_disable(musb->clock);
1230 +
1231 ++ otg_put_transceiver(musb->xceiv);
1232 + usb_nop_xceiv_unregister();
1233 + return -ENODEV;
1234 + }
1235 +@@ -496,6 +497,7 @@ int musb_platform_exit(struct musb *musb)
1236 +
1237 + clk_disable(musb->clock);
1238 +
1239 ++ otg_put_transceiver(musb->xceiv);
1240 + usb_nop_xceiv_unregister();
1241 +
1242 + return 0;
1243 +diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
1244 +index 3b795c5..fbb768d 100644
1245 +--- a/drivers/usb/musb/musb_core.c
1246 ++++ b/drivers/usb/musb/musb_core.c
1247 +@@ -1922,10 +1922,6 @@ static void musb_free(struct musb *musb)
1248 + dma_controller_destroy(c);
1249 + }
1250 +
1251 +-#ifdef CONFIG_USB_MUSB_OTG
1252 +- put_device(musb->xceiv->dev);
1253 +-#endif
1254 +-
1255 + #ifdef CONFIG_USB_MUSB_HDRC_HCD
1256 + usb_put_hcd(musb_to_hcd(musb));
1257 + #else
1258 +diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
1259 +index e06d65e..d57d9a4 100644
1260 +--- a/drivers/usb/musb/omap2430.c
1261 ++++ b/drivers/usb/musb/omap2430.c
1262 +@@ -326,5 +326,6 @@ int musb_platform_exit(struct musb *musb)
1263 +
1264 + musb_platform_suspend(musb);
1265 +
1266 ++ otg_put_transceiver(musb->xceiv);
1267 + return 0;
1268 + }
1269 +diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
1270 +index 3c48e77..bde40ef 100644
1271 +--- a/drivers/usb/musb/tusb6010.c
1272 ++++ b/drivers/usb/musb/tusb6010.c
1273 +@@ -1152,6 +1152,8 @@ done:
1274 + if (ret < 0) {
1275 + if (sync)
1276 + iounmap(sync);
1277 ++
1278 ++ otg_put_transceiver(musb->xceiv);
1279 + usb_nop_xceiv_unregister();
1280 + }
1281 + return ret;
1282 +@@ -1166,6 +1168,8 @@ int musb_platform_exit(struct musb *musb)
1283 + musb->board_set_power(0);
1284 +
1285 + iounmap(musb->sync_va);
1286 ++
1287 ++ otg_put_transceiver(musb->xceiv);
1288 + usb_nop_xceiv_unregister();
1289 + return 0;
1290 + }
1291 +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1292 +index 8ed6ff6..9927bca 100644
1293 +--- a/drivers/usb/serial/cp210x.c
1294 ++++ b/drivers/usb/serial/cp210x.c
1295 +@@ -54,6 +54,7 @@ static int cp210x_carrier_raised(struct usb_serial_port *p);
1296 + static int debug;
1297 +
1298 + static const struct usb_device_id id_table[] = {
1299 ++ { USB_DEVICE(0x045B, 0x0053) }, /* Renesas RX610 RX-Stick */
1300 + { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */
1301 + { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */
1302 + { USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */
1303 +@@ -131,6 +132,7 @@ static const struct usb_device_id id_table[] = {
1304 + { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
1305 + { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
1306 + { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
1307 ++ { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
1308 + { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
1309 + { } /* Terminating Entry */
1310 + };
1311 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1312 +index 0edf4b3..e5438e6 100644
1313 +--- a/drivers/usb/serial/ftdi_sio.c
1314 ++++ b/drivers/usb/serial/ftdi_sio.c
1315 +@@ -177,6 +177,7 @@ static struct usb_device_id id_table_combined [] = {
1316 + { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_SNIFFER_PID) },
1317 + { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) },
1318 + { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) },
1319 ++ { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) },
1320 + { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
1321 + { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
1322 + { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
1323 +@@ -674,7 +675,6 @@ static struct usb_device_id id_table_combined [] = {
1324 + { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) },
1325 + { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) },
1326 + { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) },
1327 +- { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) },
1328 + { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) },
1329 + { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) },
1330 + { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) },
1331 +@@ -715,8 +715,37 @@ static struct usb_device_id id_table_combined [] = {
1332 + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1333 + { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
1334 + { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) },
1335 ++
1336 ++ /* Papouch devices based on FTDI chip */
1337 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_PID) },
1338 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_PID) },
1339 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_PID) },
1340 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_2_PID) },
1341 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_2_PID) },
1342 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_2_PID) },
1343 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485S_PID) },
1344 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485C_PID) },
1345 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_LEC_PID) },
1346 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB232_PID) },
1347 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) },
1348 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_IRAMP_PID) },
1349 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK5_PID) },
1350 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO8x8_PID) },
1351 + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) },
1352 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x2_PID) },
1353 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO10x1_PID) },
1354 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO30x3_PID) },
1355 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO60x3_PID) },
1356 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x16_PID) },
1357 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO3x32_PID) },
1358 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK6_PID) },
1359 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_UPSUSB_PID) },
1360 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_MU_PID) },
1361 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SIMUKEY_PID) },
1362 + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AD4USB_PID) },
1363 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMUX_PID) },
1364 ++ { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMSR_PID) },
1365 ++
1366 + { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) },
1367 + { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) },
1368 + { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) },
1369 +@@ -751,6 +780,7 @@ static struct usb_device_id id_table_combined [] = {
1370 + { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID),
1371 + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1372 + { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) },
1373 ++ { USB_DEVICE(FTDI_VID, ACCESIO_COM4SM_PID) },
1374 + { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID),
1375 + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1376 + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) },
1377 +@@ -761,6 +791,9 @@ static struct usb_device_id id_table_combined [] = {
1378 + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MAXI_WING_PID) },
1379 + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MEDIA_WING_PID) },
1380 + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_WING_PID) },
1381 ++ { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) },
1382 ++ { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) },
1383 ++ { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) },
1384 + { }, /* Optional parameter entry */
1385 + { } /* Terminating entry */
1386 + };
1387 +@@ -2028,8 +2061,6 @@ static void ftdi_set_termios(struct tty_struct *tty,
1388 + "urb failed to set to rts/cts flow control\n");
1389 + }
1390 +
1391 +- /* raise DTR/RTS */
1392 +- set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1393 + } else {
1394 + /*
1395 + * Xon/Xoff code
1396 +@@ -2077,8 +2108,6 @@ static void ftdi_set_termios(struct tty_struct *tty,
1397 + }
1398 + }
1399 +
1400 +- /* lower DTR/RTS */
1401 +- clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1402 + }
1403 + return;
1404 + }
1405 +diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1406 +index 15a4583..cf1aea1b 100644
1407 +--- a/drivers/usb/serial/ftdi_sio_ids.h
1408 ++++ b/drivers/usb/serial/ftdi_sio_ids.h
1409 +@@ -61,6 +61,7 @@
1410 + #define FTDI_OPENDCC_SNIFFER_PID 0xBFD9
1411 + #define FTDI_OPENDCC_THROTTLE_PID 0xBFDA
1412 + #define FTDI_OPENDCC_GATEWAY_PID 0xBFDB
1413 ++#define FTDI_OPENDCC_GBM_PID 0xBFDC
1414 +
1415 + /*
1416 + * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com)
1417 +@@ -1022,9 +1023,34 @@
1418 + */
1419 +
1420 + #define PAPOUCH_VID 0x5050 /* Vendor ID */
1421 ++#define PAPOUCH_SB485_PID 0x0100 /* Papouch SB485 USB-485/422 Converter */
1422 ++#define PAPOUCH_AP485_PID 0x0101 /* AP485 USB-RS485 Converter */
1423 ++#define PAPOUCH_SB422_PID 0x0102 /* Papouch SB422 USB-RS422 Converter */
1424 ++#define PAPOUCH_SB485_2_PID 0x0103 /* Papouch SB485 USB-485/422 Converter */
1425 ++#define PAPOUCH_AP485_2_PID 0x0104 /* AP485 USB-RS485 Converter */
1426 ++#define PAPOUCH_SB422_2_PID 0x0105 /* Papouch SB422 USB-RS422 Converter */
1427 ++#define PAPOUCH_SB485S_PID 0x0106 /* Papouch SB485S USB-485/422 Converter */
1428 ++#define PAPOUCH_SB485C_PID 0x0107 /* Papouch SB485C USB-485/422 Converter */
1429 ++#define PAPOUCH_LEC_PID 0x0300 /* LEC USB Converter */
1430 ++#define PAPOUCH_SB232_PID 0x0301 /* Papouch SB232 USB-RS232 Converter */
1431 + #define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */
1432 +-#define PAPOUCH_QUIDO4x4_PID 0x0900 /* Quido 4/4 Module */
1433 ++#define PAPOUCH_IRAMP_PID 0x0500 /* Papouch IRAmp Duplex */
1434 ++#define PAPOUCH_DRAK5_PID 0x0700 /* Papouch DRAK5 */
1435 ++#define PAPOUCH_QUIDO8x8_PID 0x0800 /* Papouch Quido 8/8 Module */
1436 ++#define PAPOUCH_QUIDO4x4_PID 0x0900 /* Papouch Quido 4/4 Module */
1437 ++#define PAPOUCH_QUIDO2x2_PID 0x0a00 /* Papouch Quido 2/2 Module */
1438 ++#define PAPOUCH_QUIDO10x1_PID 0x0b00 /* Papouch Quido 10/1 Module */
1439 ++#define PAPOUCH_QUIDO30x3_PID 0x0c00 /* Papouch Quido 30/3 Module */
1440 ++#define PAPOUCH_QUIDO60x3_PID 0x0d00 /* Papouch Quido 60(100)/3 Module */
1441 ++#define PAPOUCH_QUIDO2x16_PID 0x0e00 /* Papouch Quido 2/16 Module */
1442 ++#define PAPOUCH_QUIDO3x32_PID 0x0f00 /* Papouch Quido 3/32 Module */
1443 ++#define PAPOUCH_DRAK6_PID 0x1000 /* Papouch DRAK6 */
1444 ++#define PAPOUCH_UPSUSB_PID 0x8000 /* Papouch UPS-USB adapter */
1445 ++#define PAPOUCH_MU_PID 0x8001 /* MU controller */
1446 ++#define PAPOUCH_SIMUKEY_PID 0x8002 /* Papouch SimuKey */
1447 + #define PAPOUCH_AD4USB_PID 0x8003 /* AD4USB Measurement Module */
1448 ++#define PAPOUCH_GMUX_PID 0x8004 /* Papouch GOLIATH MUX */
1449 ++#define PAPOUCH_GMSR_PID 0x8005 /* Papouch GOLIATH MSR */
1450 +
1451 + /*
1452 + * Marvell SheevaPlug
1453 +@@ -1063,3 +1089,14 @@
1454 + * Submitted by John G. Rogers
1455 + */
1456 + #define SEGWAY_RMP200_PID 0xe729
1457 ++
1458 ++
1459 ++/*
1460 ++ * Accesio USB Data Acquisition products (http://www.accesio.com/)
1461 ++ */
1462 ++#define ACCESIO_COM4SM_PID 0xD578
1463 ++
1464 ++/* www.sciencescope.co.uk educational dataloggers */
1465 ++#define FTDI_SCIENCESCOPE_LOGBOOKML_PID 0xFF18
1466 ++#define FTDI_SCIENCESCOPE_LS_LOGBOOK_PID 0xFF1C
1467 ++#define FTDI_SCIENCESCOPE_HS_LOGBOOK_PID 0xFF1D
1468 +diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
1469 +index 7aa01b9..2849f8c 100644
1470 +--- a/drivers/usb/serial/mct_u232.c
1471 ++++ b/drivers/usb/serial/mct_u232.c
1472 +@@ -549,9 +549,12 @@ static void mct_u232_close(struct usb_serial_port *port)
1473 + {
1474 + dbg("%s port %d", __func__, port->number);
1475 +
1476 +- usb_serial_generic_close(port);
1477 +- if (port->serial->dev)
1478 ++ if (port->serial->dev) {
1479 ++ /* shutdown our urbs */
1480 ++ usb_kill_urb(port->write_urb);
1481 ++ usb_kill_urb(port->read_urb);
1482 + usb_kill_urb(port->interrupt_in_urb);
1483 ++ }
1484 + } /* mct_u232_close */
1485 +
1486 +
1487 +diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
1488 +index ed01f3b..9ff19c8 100644
1489 +--- a/drivers/usb/serial/opticon.c
1490 ++++ b/drivers/usb/serial/opticon.c
1491 +@@ -96,8 +96,8 @@ static void opticon_bulk_callback(struct urb *urb)
1492 + /* real data, send it to the tty layer */
1493 + tty = tty_port_tty_get(&port->port);
1494 + if (tty) {
1495 +- tty_insert_flip_string(tty, data,
1496 +- data_length);
1497 ++ tty_insert_flip_string(tty, data + 2,
1498 ++ data_length);
1499 + tty_flip_buffer_push(tty);
1500 + tty_kref_put(tty);
1501 + }
1502 +@@ -130,7 +130,7 @@ exit:
1503 + priv->bulk_address),
1504 + priv->bulk_in_buffer, priv->buffer_size,
1505 + opticon_bulk_callback, priv);
1506 +- result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
1507 ++ result = usb_submit_urb(priv->bulk_read_urb, GFP_ATOMIC);
1508 + if (result)
1509 + dev_err(&port->dev,
1510 + "%s - failed resubmitting read urb, error %d\n",
1511 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1512 +index 80c74d4..1987e6d 100644
1513 +--- a/drivers/usb/serial/option.c
1514 ++++ b/drivers/usb/serial/option.c
1515 +@@ -595,6 +595,7 @@ static const struct usb_device_id option_ids[] = {
1516 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0011, 0xff, 0xff, 0xff) },
1517 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff) },
1518 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) },
1519 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) },
1520 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) },
1521 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) },
1522 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff) },
1523 +@@ -606,38 +607,52 @@ static const struct usb_device_id option_ids[] = {
1524 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0023, 0xff, 0xff, 0xff) },
1525 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) },
1526 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff) },
1527 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) },
1528 ++ /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, */
1529 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) },
1530 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) },
1531 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) },
1532 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626, 0xff, 0xff, 0xff) },
1533 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0032, 0xff, 0xff, 0xff) },
1534 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0033, 0xff, 0xff, 0xff) },
1535 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0034, 0xff, 0xff, 0xff) },
1536 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0037, 0xff, 0xff, 0xff) },
1537 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0038, 0xff, 0xff, 0xff) },
1538 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0039, 0xff, 0xff, 0xff) },
1539 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0040, 0xff, 0xff, 0xff) },
1540 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0042, 0xff, 0xff, 0xff) },
1541 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0043, 0xff, 0xff, 0xff) },
1542 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0044, 0xff, 0xff, 0xff) },
1543 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0048, 0xff, 0xff, 0xff) },
1544 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0049, 0xff, 0xff, 0xff) },
1545 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0050, 0xff, 0xff, 0xff) },
1546 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) },
1547 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff) },
1548 ++ /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0053, 0xff, 0xff, 0xff) }, */
1549 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) },
1550 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff) },
1551 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0056, 0xff, 0xff, 0xff) },
1552 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) },
1553 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff) },
1554 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) },
1555 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) },
1556 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) },
1557 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff) },
1558 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0064, 0xff, 0xff, 0xff) },
1559 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0065, 0xff, 0xff, 0xff) },
1560 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) },
1561 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0067, 0xff, 0xff, 0xff) },
1562 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0069, 0xff, 0xff, 0xff) },
1563 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) },
1564 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0076, 0xff, 0xff, 0xff) },
1565 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0077, 0xff, 0xff, 0xff) },
1566 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0078, 0xff, 0xff, 0xff) },
1567 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0079, 0xff, 0xff, 0xff) },
1568 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0082, 0xff, 0xff, 0xff) },
1569 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0083, 0xff, 0xff, 0xff) },
1570 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) },
1571 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) },
1572 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
1573 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0087, 0xff, 0xff, 0xff) },
1574 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff) },
1575 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) },
1576 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) },
1577 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) },
1578 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff) },
1579 +@@ -853,6 +868,8 @@ static const struct usb_device_id option_ids[] = {
1580 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) },
1581 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) },
1582 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) },
1583 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) },
1584 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
1585 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
1586 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
1587 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
1588 +diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
1589 +index eb76aae..15a5d89 100644
1590 +--- a/drivers/usb/serial/visor.c
1591 ++++ b/drivers/usb/serial/visor.c
1592 +@@ -606,6 +606,10 @@ static int treo_attach(struct usb_serial *serial)
1593 +
1594 + static int clie_5_attach(struct usb_serial *serial)
1595 + {
1596 ++ struct usb_serial_port *port;
1597 ++ unsigned int pipe;
1598 ++ int j;
1599 ++
1600 + dbg("%s", __func__);
1601 +
1602 + /* TH55 registers 2 ports.
1603 +@@ -621,9 +625,14 @@ static int clie_5_attach(struct usb_serial *serial)
1604 + return -1;
1605 +
1606 + /* port 0 now uses the modified endpoint Address */
1607 +- serial->port[0]->bulk_out_endpointAddress =
1608 ++ port = serial->port[0];
1609 ++ port->bulk_out_endpointAddress =
1610 + serial->port[1]->bulk_out_endpointAddress;
1611 +
1612 ++ pipe = usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress);
1613 ++ for (j = 0; j < ARRAY_SIZE(port->write_urbs); ++j)
1614 ++ port->write_urbs[j]->pipe = pipe;
1615 ++
1616 + return 0;
1617 + }
1618 +
1619 +diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
1620 +index fb6318b..4c54a8b 100644
1621 +--- a/fs/cifs/cifsproto.h
1622 ++++ b/fs/cifs/cifsproto.h
1623 +@@ -104,7 +104,8 @@ extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
1624 +
1625 + extern struct cifsFileInfo *cifs_new_fileinfo(struct inode *newinode,
1626 + __u16 fileHandle, struct file *file,
1627 +- struct vfsmount *mnt, unsigned int oflags);
1628 ++ struct vfsmount *mnt, unsigned int oflags,
1629 ++ __u32 oplock);
1630 + extern int cifs_posix_open(char *full_path, struct inode **pinode,
1631 + struct super_block *sb,
1632 + int mode, int oflags,
1633 +diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
1634 +index e7ae78b..9c33878 100644
1635 +--- a/fs/cifs/dir.c
1636 ++++ b/fs/cifs/dir.c
1637 +@@ -138,9 +138,9 @@ cifs_bp_rename_retry:
1638 + */
1639 + struct cifsFileInfo *
1640 + cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
1641 +- struct file *file, struct vfsmount *mnt, unsigned int oflags)
1642 ++ struct file *file, struct vfsmount *mnt, unsigned int oflags,
1643 ++ __u32 oplock)
1644 + {
1645 +- int oplock = 0;
1646 + struct cifsFileInfo *pCifsFile;
1647 + struct cifsInodeInfo *pCifsInode;
1648 + struct cifs_sb_info *cifs_sb = CIFS_SB(mnt->mnt_sb);
1649 +@@ -149,9 +149,6 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
1650 + if (pCifsFile == NULL)
1651 + return pCifsFile;
1652 +
1653 +- if (oplockEnabled)
1654 +- oplock = REQ_OPLOCK;
1655 +-
1656 + pCifsFile->netfid = fileHandle;
1657 + pCifsFile->pid = current->tgid;
1658 + pCifsFile->pInode = igrab(newinode);
1659 +@@ -476,7 +473,7 @@ cifs_create_set_dentry:
1660 + }
1661 +
1662 + pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp,
1663 +- nd->path.mnt, oflags);
1664 ++ nd->path.mnt, oflags, oplock);
1665 + if (pfile_info == NULL) {
1666 + fput(filp);
1667 + CIFSSMBClose(xid, tcon, fileHandle);
1668 +@@ -738,7 +735,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
1669 +
1670 + cfile = cifs_new_fileinfo(newInode, fileHandle, filp,
1671 + nd->path.mnt,
1672 +- nd->intent.open.flags);
1673 ++ nd->intent.open.flags,
1674 ++ oplock);
1675 + if (cfile == NULL) {
1676 + fput(filp);
1677 + CIFSSMBClose(xid, pTcon, fileHandle);
1678 +diff --git a/fs/cifs/file.c b/fs/cifs/file.c
1679 +index 409e4f5..de2e6c4 100644
1680 +--- a/fs/cifs/file.c
1681 ++++ b/fs/cifs/file.c
1682 +@@ -277,7 +277,7 @@ int cifs_open(struct inode *inode, struct file *file)
1683 +
1684 + pCifsFile = cifs_new_fileinfo(inode, netfid, file,
1685 + file->f_path.mnt,
1686 +- oflags);
1687 ++ oflags, oplock);
1688 + if (pCifsFile == NULL) {
1689 + CIFSSMBClose(xid, tcon, netfid);
1690 + rc = -ENOMEM;
1691 +@@ -367,7 +367,7 @@ int cifs_open(struct inode *inode, struct file *file)
1692 + goto out;
1693 +
1694 + pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt,
1695 +- file->f_flags);
1696 ++ file->f_flags, oplock);
1697 + if (pCifsFile == NULL) {
1698 + rc = -ENOMEM;
1699 + goto out;
1700 +diff --git a/fs/pipe.c b/fs/pipe.c
1701 +index 279eef9..37eb1eb 100644
1702 +--- a/fs/pipe.c
1703 ++++ b/fs/pipe.c
1704 +@@ -382,7 +382,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
1705 + error = ops->confirm(pipe, buf);
1706 + if (error) {
1707 + if (!ret)
1708 +- error = ret;
1709 ++ ret = error;
1710 + break;
1711 + }
1712 +
1713 +diff --git a/include/linux/tipc.h b/include/linux/tipc.h
1714 +index 181c8d0..d10614b 100644
1715 +--- a/include/linux/tipc.h
1716 ++++ b/include/linux/tipc.h
1717 +@@ -127,17 +127,23 @@ static inline unsigned int tipc_node(__u32 addr)
1718 + * TIPC topology subscription service definitions
1719 + */
1720 +
1721 +-#define TIPC_SUB_SERVICE 0x00 /* Filter for service availability */
1722 +-#define TIPC_SUB_PORTS 0x01 /* Filter for port availability */
1723 +-#define TIPC_SUB_CANCEL 0x04 /* Cancel a subscription */
1724 ++#define TIPC_SUB_PORTS 0x01 /* filter for port availability */
1725 ++#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */
1726 ++#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */
1727 ++#if 0
1728 ++/* The following filter options are not currently implemented */
1729 ++#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */
1730 ++#define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */
1731 ++#define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */
1732 ++#endif
1733 +
1734 + #define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */
1735 +
1736 + struct tipc_subscr {
1737 +- struct tipc_name_seq seq; /* NBO. Name sequence of interest */
1738 +- __u32 timeout; /* NBO. Subscription duration (in ms) */
1739 +- __u32 filter; /* NBO. Bitmask of filter options */
1740 +- char usr_handle[8]; /* Opaque. Available for subscriber use */
1741 ++ struct tipc_name_seq seq; /* name sequence of interest */
1742 ++ __u32 timeout; /* subscription duration (in ms) */
1743 ++ __u32 filter; /* bitmask of filter options */
1744 ++ char usr_handle[8]; /* available for subscriber use */
1745 + };
1746 +
1747 + #define TIPC_PUBLISHED 1 /* publication event */
1748 +@@ -145,11 +151,11 @@ struct tipc_subscr {
1749 + #define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */
1750 +
1751 + struct tipc_event {
1752 +- __u32 event; /* NBO. Event type, as defined above */
1753 +- __u32 found_lower; /* NBO. Matching name seq instances */
1754 +- __u32 found_upper; /* " " " " " */
1755 +- struct tipc_portid port; /* NBO. Associated port */
1756 +- struct tipc_subscr s; /* Original, associated subscription */
1757 ++ __u32 event; /* event type */
1758 ++ __u32 found_lower; /* matching name seq instances */
1759 ++ __u32 found_upper; /* " " " " */
1760 ++ struct tipc_portid port; /* associated port */
1761 ++ struct tipc_subscr s; /* associated subscription */
1762 + };
1763 +
1764 + /*
1765 +diff --git a/kernel/futex.c b/kernel/futex.c
1766 +index 6a3a5fa..e328f57 100644
1767 +--- a/kernel/futex.c
1768 ++++ b/kernel/futex.c
1769 +@@ -1363,7 +1363,6 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q)
1770 + {
1771 + struct futex_hash_bucket *hb;
1772 +
1773 +- get_futex_key_refs(&q->key);
1774 + hb = hash_futex(&q->key);
1775 + q->lock_ptr = &hb->lock;
1776 +
1777 +@@ -1375,7 +1374,6 @@ static inline void
1778 + queue_unlock(struct futex_q *q, struct futex_hash_bucket *hb)
1779 + {
1780 + spin_unlock(&hb->lock);
1781 +- drop_futex_key_refs(&q->key);
1782 + }
1783 +
1784 + /**
1785 +@@ -1480,8 +1478,6 @@ static void unqueue_me_pi(struct futex_q *q)
1786 + q->pi_state = NULL;
1787 +
1788 + spin_unlock(q->lock_ptr);
1789 +-
1790 +- drop_futex_key_refs(&q->key);
1791 + }
1792 +
1793 + /*
1794 +@@ -1812,7 +1808,10 @@ static int futex_wait(u32 __user *uaddr, int fshared,
1795 + }
1796 +
1797 + retry:
1798 +- /* Prepare to wait on uaddr. */
1799 ++ /*
1800 ++ * Prepare to wait on uaddr. On success, holds hb lock and increments
1801 ++ * q.key refs.
1802 ++ */
1803 + ret = futex_wait_setup(uaddr, val, fshared, &q, &hb);
1804 + if (ret)
1805 + goto out;
1806 +@@ -1822,24 +1821,23 @@ retry:
1807 +
1808 + /* If we were woken (and unqueued), we succeeded, whatever. */
1809 + ret = 0;
1810 ++ /* unqueue_me() drops q.key ref */
1811 + if (!unqueue_me(&q))
1812 +- goto out_put_key;
1813 ++ goto out;
1814 + ret = -ETIMEDOUT;
1815 + if (to && !to->task)
1816 +- goto out_put_key;
1817 ++ goto out;
1818 +
1819 + /*
1820 + * We expect signal_pending(current), but we might be the
1821 + * victim of a spurious wakeup as well.
1822 + */
1823 +- if (!signal_pending(current)) {
1824 +- put_futex_key(fshared, &q.key);
1825 ++ if (!signal_pending(current))
1826 + goto retry;
1827 +- }
1828 +
1829 + ret = -ERESTARTSYS;
1830 + if (!abs_time)
1831 +- goto out_put_key;
1832 ++ goto out;
1833 +
1834 + restart = &current_thread_info()->restart_block;
1835 + restart->fn = futex_wait_restart;
1836 +@@ -1856,8 +1854,6 @@ retry:
1837 +
1838 + ret = -ERESTART_RESTARTBLOCK;
1839 +
1840 +-out_put_key:
1841 +- put_futex_key(fshared, &q.key);
1842 + out:
1843 + if (to) {
1844 + hrtimer_cancel(&to->timer);
1845 +@@ -2236,7 +2232,10 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared,
1846 + q.rt_waiter = &rt_waiter;
1847 + q.requeue_pi_key = &key2;
1848 +
1849 +- /* Prepare to wait on uaddr. */
1850 ++ /*
1851 ++ * Prepare to wait on uaddr. On success, increments q.key (key1) ref
1852 ++ * count.
1853 ++ */
1854 + ret = futex_wait_setup(uaddr, val, fshared, &q, &hb);
1855 + if (ret)
1856 + goto out_key2;
1857 +@@ -2254,7 +2253,9 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared,
1858 + * In order for us to be here, we know our q.key == key2, and since
1859 + * we took the hb->lock above, we also know that futex_requeue() has
1860 + * completed and we no longer have to concern ourselves with a wakeup
1861 +- * race with the atomic proxy lock acquition by the requeue code.
1862 ++ * race with the atomic proxy lock acquisition by the requeue code. The
1863 ++ * futex_requeue dropped our key1 reference and incremented our key2
1864 ++ * reference count.
1865 + */
1866 +
1867 + /* Check if the requeue code acquired the second futex for us. */
1868 +diff --git a/kernel/perf_event.c b/kernel/perf_event.c
1869 +index ff86c55..ac869dc 100644
1870 +--- a/kernel/perf_event.c
1871 ++++ b/kernel/perf_event.c
1872 +@@ -1757,7 +1757,13 @@ static u64 perf_event_read(struct perf_event *event)
1873 + unsigned long flags;
1874 +
1875 + raw_spin_lock_irqsave(&ctx->lock, flags);
1876 +- update_context_time(ctx);
1877 ++ /*
1878 ++ * may read while context is not active
1879 ++ * (e.g., thread is blocked), in that case
1880 ++ * we cannot update context time
1881 ++ */
1882 ++ if (ctx->is_active)
1883 ++ update_context_time(ctx);
1884 + update_event_times(event);
1885 + raw_spin_unlock_irqrestore(&ctx->lock, flags);
1886 + }
1887 +diff --git a/kernel/sched.c b/kernel/sched.c
1888 +index 4fa520b..05b40f8 100644
1889 +--- a/kernel/sched.c
1890 ++++ b/kernel/sched.c
1891 +@@ -721,7 +721,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf,
1892 + size_t cnt, loff_t *ppos)
1893 + {
1894 + char buf[64];
1895 +- char *cmp = buf;
1896 ++ char *cmp;
1897 + int neg = 0;
1898 + int i;
1899 +
1900 +@@ -732,6 +732,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf,
1901 + return -EFAULT;
1902 +
1903 + buf[cnt] = 0;
1904 ++ cmp = strstrip(buf);
1905 +
1906 + if (strncmp(buf, "NO_", 3) == 0) {
1907 + neg = 1;
1908 +@@ -739,9 +740,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf,
1909 + }
1910 +
1911 + for (i = 0; sched_feat_names[i]; i++) {
1912 +- int len = strlen(sched_feat_names[i]);
1913 +-
1914 +- if (strncmp(cmp, sched_feat_names[i], len) == 0) {
1915 ++ if (strcmp(cmp, sched_feat_names[i]) == 0) {
1916 + if (neg)
1917 + sysctl_sched_features &= ~(1UL << i);
1918 + else
1919 +@@ -1830,12 +1829,6 @@ static void dec_nr_running(struct rq *rq)
1920 +
1921 + static void set_load_weight(struct task_struct *p)
1922 + {
1923 +- if (task_has_rt_policy(p)) {
1924 +- p->se.load.weight = 0;
1925 +- p->se.load.inv_weight = WMULT_CONST;
1926 +- return;
1927 +- }
1928 +-
1929 + /*
1930 + * SCHED_IDLE tasks get minimal weight:
1931 + */
1932 +diff --git a/mm/vmalloc.c b/mm/vmalloc.c
1933 +index ae00746..20a402c 100644
1934 +--- a/mm/vmalloc.c
1935 ++++ b/mm/vmalloc.c
1936 +@@ -513,6 +513,15 @@ static atomic_t vmap_lazy_nr = ATOMIC_INIT(0);
1937 + static void purge_fragmented_blocks_allcpus(void);
1938 +
1939 + /*
1940 ++ * called before a call to iounmap() if the caller wants vm_area_struct's
1941 ++ * immediately freed.
1942 ++ */
1943 ++void set_iounmap_nonlazy(void)
1944 ++{
1945 ++ atomic_set(&vmap_lazy_nr, lazy_max_pages()+1);
1946 ++}
1947 ++
1948 ++/*
1949 + * Purges all lazily-freed vmap areas.
1950 + *
1951 + * If sync is 0 then don't purge if there is already a purge in progress.
1952 +diff --git a/net/core/dev.c b/net/core/dev.c
1953 +index 95cc486..a7054e8 100644
1954 +--- a/net/core/dev.c
1955 ++++ b/net/core/dev.c
1956 +@@ -1491,7 +1491,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1957 + nf_reset(skb);
1958 +
1959 + if (!(dev->flags & IFF_UP) ||
1960 +- (skb->len > (dev->mtu + dev->hard_header_len))) {
1961 ++ (skb->len > (dev->mtu + dev->hard_header_len + VLAN_HLEN))) {
1962 + kfree_skb(skb);
1963 + return NET_RX_DROP;
1964 + }
1965 +@@ -2110,6 +2110,9 @@ static inline int skb_needs_linearize(struct sk_buff *skb,
1966 + illegal_highdma(dev, skb)));
1967 + }
1968 +
1969 ++static DEFINE_PER_CPU(int, xmit_recursion);
1970 ++#define RECURSION_LIMIT 10
1971 ++
1972 + /**
1973 + * dev_queue_xmit - transmit a buffer
1974 + * @skb: buffer to transmit
1975 +@@ -2194,10 +2197,15 @@ gso:
1976 +
1977 + if (txq->xmit_lock_owner != cpu) {
1978 +
1979 ++ if (__this_cpu_read(xmit_recursion) > RECURSION_LIMIT)
1980 ++ goto recursion_alert;
1981 ++
1982 + HARD_TX_LOCK(dev, txq, cpu);
1983 +
1984 + if (!netif_tx_queue_stopped(txq)) {
1985 ++ __this_cpu_inc(xmit_recursion);
1986 + rc = dev_hard_start_xmit(skb, dev, txq);
1987 ++ __this_cpu_dec(xmit_recursion);
1988 + if (dev_xmit_complete(rc)) {
1989 + HARD_TX_UNLOCK(dev, txq);
1990 + goto out;
1991 +@@ -2209,7 +2217,9 @@ gso:
1992 + "queue packet!\n", dev->name);
1993 + } else {
1994 + /* Recursion is detected! It is possible,
1995 +- * unfortunately */
1996 ++ * unfortunately
1997 ++ */
1998 ++recursion_alert:
1999 + if (net_ratelimit())
2000 + printk(KERN_CRIT "Dead loop on virtual device "
2001 + "%s, fix it urgently!\n", dev->name);
2002 +diff --git a/net/core/ethtool.c b/net/core/ethtool.c
2003 +index 75e4ffe..f5e3856 100644
2004 +--- a/net/core/ethtool.c
2005 ++++ b/net/core/ethtool.c
2006 +@@ -482,7 +482,7 @@ static int ethtool_get_rx_ntuple(struct net_device *dev, void __user *useraddr)
2007 +
2008 + gstrings.len = ret;
2009 +
2010 +- data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
2011 ++ data = kzalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
2012 + if (!data)
2013 + return -ENOMEM;
2014 +
2015 +@@ -719,7 +719,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
2016 + if (regs.len > reglen)
2017 + regs.len = reglen;
2018 +
2019 +- regbuf = kmalloc(reglen, GFP_USER);
2020 ++ regbuf = kzalloc(reglen, GFP_USER);
2021 + if (!regbuf)
2022 + return -ENOMEM;
2023 +
2024 +diff --git a/net/core/stream.c b/net/core/stream.c
2025 +index cc196f4..9ece62b 100644
2026 +--- a/net/core/stream.c
2027 ++++ b/net/core/stream.c
2028 +@@ -144,10 +144,10 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)
2029 +
2030 + set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
2031 + sk->sk_write_pending++;
2032 +- sk_wait_event(sk, &current_timeo, !sk->sk_err &&
2033 +- !(sk->sk_shutdown & SEND_SHUTDOWN) &&
2034 +- sk_stream_memory_free(sk) &&
2035 +- vm_wait);
2036 ++ sk_wait_event(sk, &current_timeo, sk->sk_err ||
2037 ++ (sk->sk_shutdown & SEND_SHUTDOWN) ||
2038 ++ (sk_stream_memory_free(sk) &&
2039 ++ !vm_wait));
2040 + sk->sk_write_pending--;
2041 +
2042 + if (vm_wait) {
2043 +diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
2044 +index 041d41d..f300f43 100644
2045 +--- a/net/ipv4/ip_output.c
2046 ++++ b/net/ipv4/ip_output.c
2047 +@@ -488,9 +488,8 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
2048 + * we can switch to copy when see the first bad fragment.
2049 + */
2050 + if (skb_has_frags(skb)) {
2051 +- struct sk_buff *frag;
2052 ++ struct sk_buff *frag, *frag2;
2053 + int first_len = skb_pagelen(skb);
2054 +- int truesizes = 0;
2055 +
2056 + if (first_len - hlen > mtu ||
2057 + ((first_len - hlen) & 7) ||
2058 +@@ -503,18 +502,18 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
2059 + if (frag->len > mtu ||
2060 + ((frag->len & 7) && frag->next) ||
2061 + skb_headroom(frag) < hlen)
2062 +- goto slow_path;
2063 ++ goto slow_path_clean;
2064 +
2065 + /* Partially cloned skb? */
2066 + if (skb_shared(frag))
2067 +- goto slow_path;
2068 ++ goto slow_path_clean;
2069 +
2070 + BUG_ON(frag->sk);
2071 + if (skb->sk) {
2072 + frag->sk = skb->sk;
2073 + frag->destructor = sock_wfree;
2074 + }
2075 +- truesizes += frag->truesize;
2076 ++ skb->truesize -= frag->truesize;
2077 + }
2078 +
2079 + /* Everything is OK. Generate! */
2080 +@@ -524,7 +523,6 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
2081 + frag = skb_shinfo(skb)->frag_list;
2082 + skb_frag_list_init(skb);
2083 + skb->data_len = first_len - skb_headlen(skb);
2084 +- skb->truesize -= truesizes;
2085 + skb->len = first_len;
2086 + iph->tot_len = htons(first_len);
2087 + iph->frag_off = htons(IP_MF);
2088 +@@ -576,6 +574,15 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
2089 + }
2090 + IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
2091 + return err;
2092 ++
2093 ++slow_path_clean:
2094 ++ skb_walk_frags(skb, frag2) {
2095 ++ if (frag2 == frag)
2096 ++ break;
2097 ++ frag2->sk = NULL;
2098 ++ frag2->destructor = NULL;
2099 ++ skb->truesize += frag2->truesize;
2100 ++ }
2101 + }
2102 +
2103 + slow_path:
2104 +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
2105 +index c88ca26..dc6cffa 100644
2106 +--- a/net/ipv4/tcp.c
2107 ++++ b/net/ipv4/tcp.c
2108 +@@ -388,8 +388,6 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
2109 + */
2110 +
2111 + mask = 0;
2112 +- if (sk->sk_err)
2113 +- mask = POLLERR;
2114 +
2115 + /*
2116 + * POLLHUP is certainly not done right. But poll() doesn't
2117 +@@ -459,6 +457,11 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
2118 + if (tp->urg_data & TCP_URG_VALID)
2119 + mask |= POLLPRI;
2120 + }
2121 ++ /* This barrier is coupled with smp_wmb() in tcp_reset() */
2122 ++ smp_rmb();
2123 ++ if (sk->sk_err)
2124 ++ mask |= POLLERR;
2125 ++
2126 + return mask;
2127 + }
2128 +
2129 +@@ -3252,12 +3255,14 @@ void __init tcp_init(void)
2130 +
2131 + /* Set the pressure threshold to be a fraction of global memory that
2132 + * is up to 1/2 at 256 MB, decreasing toward zero with the amount of
2133 +- * memory, with a floor of 128 pages.
2134 ++ * memory, with a floor of 128 pages, and a ceiling that prevents an
2135 ++ * integer overflow.
2136 + */
2137 + nr_pages = totalram_pages - totalhigh_pages;
2138 + limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
2139 + limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
2140 + limit = max(limit, 128UL);
2141 ++ limit = min(limit, INT_MAX * 4UL / 3 / 2);
2142 + sysctl_tcp_mem[0] = limit / 4 * 3;
2143 + sysctl_tcp_mem[1] = limit;
2144 + sysctl_tcp_mem[2] = sysctl_tcp_mem[0] * 2;
2145 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2146 +index 548d575..d83b496 100644
2147 +--- a/net/ipv4/tcp_input.c
2148 ++++ b/net/ipv4/tcp_input.c
2149 +@@ -4041,6 +4041,8 @@ static void tcp_reset(struct sock *sk)
2150 + default:
2151 + sk->sk_err = ECONNRESET;
2152 + }
2153 ++ /* This barrier is coupled with smp_rmb() in tcp_poll() */
2154 ++ smp_wmb();
2155 +
2156 + if (!sock_flag(sk, SOCK_DEAD))
2157 + sk->sk_error_report(sk);
2158 +diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
2159 +index 7abd922..ebb3dbb 100644
2160 +--- a/net/ipv4/tcp_timer.c
2161 ++++ b/net/ipv4/tcp_timer.c
2162 +@@ -136,13 +136,16 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk)
2163 +
2164 + /* This function calculates a "timeout" which is equivalent to the timeout of a
2165 + * TCP connection after "boundary" unsuccessful, exponentially backed-off
2166 +- * retransmissions with an initial RTO of TCP_RTO_MIN.
2167 ++ * retransmissions with an initial RTO of TCP_RTO_MIN or TCP_TIMEOUT_INIT if
2168 ++ * syn_set flag is set.
2169 + */
2170 + static bool retransmits_timed_out(struct sock *sk,
2171 +- unsigned int boundary)
2172 ++ unsigned int boundary,
2173 ++ bool syn_set)
2174 + {
2175 + unsigned int timeout, linear_backoff_thresh;
2176 + unsigned int start_ts;
2177 ++ unsigned int rto_base = syn_set ? TCP_TIMEOUT_INIT : TCP_RTO_MIN;
2178 +
2179 + if (!inet_csk(sk)->icsk_retransmits)
2180 + return false;
2181 +@@ -152,12 +155,12 @@ static bool retransmits_timed_out(struct sock *sk,
2182 + else
2183 + start_ts = tcp_sk(sk)->retrans_stamp;
2184 +
2185 +- linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
2186 ++ linear_backoff_thresh = ilog2(TCP_RTO_MAX/rto_base);
2187 +
2188 + if (boundary <= linear_backoff_thresh)
2189 +- timeout = ((2 << boundary) - 1) * TCP_RTO_MIN;
2190 ++ timeout = ((2 << boundary) - 1) * rto_base;
2191 + else
2192 +- timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN +
2193 ++ timeout = ((2 << linear_backoff_thresh) - 1) * rto_base +
2194 + (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
2195 +
2196 + return (tcp_time_stamp - start_ts) >= timeout;
2197 +@@ -168,14 +171,15 @@ static int tcp_write_timeout(struct sock *sk)
2198 + {
2199 + struct inet_connection_sock *icsk = inet_csk(sk);
2200 + int retry_until;
2201 +- bool do_reset;
2202 ++ bool do_reset, syn_set = 0;
2203 +
2204 + if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) {
2205 + if (icsk->icsk_retransmits)
2206 + dst_negative_advice(sk);
2207 + retry_until = icsk->icsk_syn_retries ? : sysctl_tcp_syn_retries;
2208 ++ syn_set = 1;
2209 + } else {
2210 +- if (retransmits_timed_out(sk, sysctl_tcp_retries1)) {
2211 ++ if (retransmits_timed_out(sk, sysctl_tcp_retries1, 0)) {
2212 + /* Black hole detection */
2213 + tcp_mtu_probing(icsk, sk);
2214 +
2215 +@@ -188,14 +192,14 @@ static int tcp_write_timeout(struct sock *sk)
2216 +
2217 + retry_until = tcp_orphan_retries(sk, alive);
2218 + do_reset = alive ||
2219 +- !retransmits_timed_out(sk, retry_until);
2220 ++ !retransmits_timed_out(sk, retry_until, 0);
2221 +
2222 + if (tcp_out_of_resources(sk, do_reset))
2223 + return 1;
2224 + }
2225 + }
2226 +
2227 +- if (retransmits_timed_out(sk, retry_until)) {
2228 ++ if (retransmits_timed_out(sk, retry_until, syn_set)) {
2229 + /* Has it gone just too far? */
2230 + tcp_write_err(sk);
2231 + return 1;
2232 +@@ -437,7 +441,7 @@ out_reset_timer:
2233 + icsk->icsk_rto = min(icsk->icsk_rto << 1, TCP_RTO_MAX);
2234 + }
2235 + inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto, TCP_RTO_MAX);
2236 +- if (retransmits_timed_out(sk, sysctl_tcp_retries1 + 1))
2237 ++ if (retransmits_timed_out(sk, sysctl_tcp_retries1 + 1, 0))
2238 + __sk_dst_reset(sk);
2239 +
2240 + out:;
2241 +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
2242 +index 434dd67..f0fbbba 100644
2243 +--- a/net/ipv4/udp.c
2244 ++++ b/net/ipv4/udp.c
2245 +@@ -2167,12 +2167,14 @@ void __init udp_init(void)
2246 + udp_table_init(&udp_table, "UDP");
2247 + /* Set the pressure threshold up by the same strategy of TCP. It is a
2248 + * fraction of global memory that is up to 1/2 at 256 MB, decreasing
2249 +- * toward zero with the amount of memory, with a floor of 128 pages.
2250 ++ * toward zero with the amount of memory, with a floor of 128 pages,
2251 ++ * and a ceiling that prevents an integer overflow.
2252 + */
2253 + nr_pages = totalram_pages - totalhigh_pages;
2254 + limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
2255 + limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
2256 + limit = max(limit, 128UL);
2257 ++ limit = min(limit, INT_MAX * 4UL / 3 / 2);
2258 + sysctl_udp_mem[0] = limit / 4 * 3;
2259 + sysctl_udp_mem[1] = limit;
2260 + sysctl_udp_mem[2] = sysctl_udp_mem[0] * 2;
2261 +diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
2262 +index 23883a4..ce1e1b5 100644
2263 +--- a/net/ipv4/xfrm4_policy.c
2264 ++++ b/net/ipv4/xfrm4_policy.c
2265 +@@ -61,7 +61,7 @@ static int xfrm4_get_saddr(struct net *net,
2266 +
2267 + static int xfrm4_get_tos(struct flowi *fl)
2268 + {
2269 +- return fl->fl4_tos;
2270 ++ return IPTOS_RT_MASK & fl->fl4_tos; /* Strip ECN bits */
2271 + }
2272 +
2273 + static int xfrm4_init_path(struct xfrm_dst *path, struct dst_entry *dst,
2274 +diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
2275 +index 784f34d..0bbaddc 100644
2276 +--- a/net/ipv6/addrconf.c
2277 ++++ b/net/ipv6/addrconf.c
2278 +@@ -1424,8 +1424,10 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp)
2279 + {
2280 + struct inet6_dev *idev = ifp->idev;
2281 +
2282 +- if (addrconf_dad_end(ifp))
2283 ++ if (addrconf_dad_end(ifp)) {
2284 ++ in6_ifa_put(ifp);
2285 + return;
2286 ++ }
2287 +
2288 + if (net_ratelimit())
2289 + printk(KERN_INFO "%s: IPv6 duplicate address %pI6c detected!\n",
2290 +diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
2291 +index 89425af..00a0bbe 100644
2292 +--- a/net/ipv6/ip6_output.c
2293 ++++ b/net/ipv6/ip6_output.c
2294 +@@ -639,7 +639,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
2295 +
2296 + if (skb_has_frags(skb)) {
2297 + int first_len = skb_pagelen(skb);
2298 +- int truesizes = 0;
2299 ++ struct sk_buff *frag2;
2300 +
2301 + if (first_len - hlen > mtu ||
2302 + ((first_len - hlen) & 7) ||
2303 +@@ -651,18 +651,18 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
2304 + if (frag->len > mtu ||
2305 + ((frag->len & 7) && frag->next) ||
2306 + skb_headroom(frag) < hlen)
2307 +- goto slow_path;
2308 ++ goto slow_path_clean;
2309 +
2310 + /* Partially cloned skb? */
2311 + if (skb_shared(frag))
2312 +- goto slow_path;
2313 ++ goto slow_path_clean;
2314 +
2315 + BUG_ON(frag->sk);
2316 + if (skb->sk) {
2317 + frag->sk = skb->sk;
2318 + frag->destructor = sock_wfree;
2319 +- truesizes += frag->truesize;
2320 + }
2321 ++ skb->truesize -= frag->truesize;
2322 + }
2323 +
2324 + err = 0;
2325 +@@ -693,7 +693,6 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
2326 +
2327 + first_len = skb_pagelen(skb);
2328 + skb->data_len = first_len - skb_headlen(skb);
2329 +- skb->truesize -= truesizes;
2330 + skb->len = first_len;
2331 + ipv6_hdr(skb)->payload_len = htons(first_len -
2332 + sizeof(struct ipv6hdr));
2333 +@@ -756,6 +755,15 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
2334 + IPSTATS_MIB_FRAGFAILS);
2335 + dst_release(&rt->u.dst);
2336 + return err;
2337 ++
2338 ++slow_path_clean:
2339 ++ skb_walk_frags(skb, frag2) {
2340 ++ if (frag2 == frag)
2341 ++ break;
2342 ++ frag2->sk = NULL;
2343 ++ frag2->destructor = NULL;
2344 ++ skb->truesize += frag2->truesize;
2345 ++ }
2346 + }
2347 +
2348 + slow_path:
2349 +diff --git a/net/ipv6/route.c b/net/ipv6/route.c
2350 +index 252d761..4d947c1 100644
2351 +--- a/net/ipv6/route.c
2352 ++++ b/net/ipv6/route.c
2353 +@@ -1559,14 +1559,13 @@ out:
2354 + * i.e. Path MTU discovery
2355 + */
2356 +
2357 +-void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
2358 +- struct net_device *dev, u32 pmtu)
2359 ++static void rt6_do_pmtu_disc(struct in6_addr *daddr, struct in6_addr *saddr,
2360 ++ struct net *net, u32 pmtu, int ifindex)
2361 + {
2362 + struct rt6_info *rt, *nrt;
2363 +- struct net *net = dev_net(dev);
2364 + int allfrag = 0;
2365 +
2366 +- rt = rt6_lookup(net, daddr, saddr, dev->ifindex, 0);
2367 ++ rt = rt6_lookup(net, daddr, saddr, ifindex, 0);
2368 + if (rt == NULL)
2369 + return;
2370 +
2371 +@@ -1634,6 +1633,27 @@ out:
2372 + dst_release(&rt->u.dst);
2373 + }
2374 +
2375 ++void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
2376 ++ struct net_device *dev, u32 pmtu)
2377 ++{
2378 ++ struct net *net = dev_net(dev);
2379 ++
2380 ++ /*
2381 ++ * RFC 1981 states that a node "MUST reduce the size of the packets it
2382 ++ * is sending along the path" that caused the Packet Too Big message.
2383 ++ * Since it's not possible in the general case to determine which
2384 ++ * interface was used to send the original packet, we update the MTU
2385 ++ * on the interface that will be used to send future packets. We also
2386 ++ * update the MTU on the interface that received the Packet Too Big in
2387 ++ * case the original packet was forced out that interface with
2388 ++ * SO_BINDTODEVICE or similar. This is the next best thing to the
2389 ++ * correct behaviour, which would be to update the MTU on all
2390 ++ * interfaces.
2391 ++ */
2392 ++ rt6_do_pmtu_disc(daddr, saddr, net, pmtu, 0);
2393 ++ rt6_do_pmtu_disc(daddr, saddr, net, pmtu, dev->ifindex);
2394 ++}
2395 ++
2396 + /*
2397 + * Misc support functions
2398 + */
2399 +diff --git a/net/netfilter/xt_SECMARK.c b/net/netfilter/xt_SECMARK.c
2400 +index 23b2d6c..364ad16 100644
2401 +--- a/net/netfilter/xt_SECMARK.c
2402 ++++ b/net/netfilter/xt_SECMARK.c
2403 +@@ -101,7 +101,7 @@ static int secmark_tg_check(const struct xt_tgchk_param *par)
2404 + switch (info->mode) {
2405 + case SECMARK_MODE_SEL:
2406 + err = checkentry_selinux(info);
2407 +- if (err <= 0)
2408 ++ if (err)
2409 + return err;
2410 + break;
2411 +
2412 +diff --git a/net/phonet/pep.c b/net/phonet/pep.c
2413 +index b2a3ae6..1500302 100644
2414 +--- a/net/phonet/pep.c
2415 ++++ b/net/phonet/pep.c
2416 +@@ -225,12 +225,13 @@ static void pipe_grant_credits(struct sock *sk)
2417 + static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)
2418 + {
2419 + struct pep_sock *pn = pep_sk(sk);
2420 +- struct pnpipehdr *hdr = pnp_hdr(skb);
2421 ++ struct pnpipehdr *hdr;
2422 + int wake = 0;
2423 +
2424 + if (!pskb_may_pull(skb, sizeof(*hdr) + 4))
2425 + return -EINVAL;
2426 +
2427 ++ hdr = pnp_hdr(skb);
2428 + if (hdr->data[0] != PN_PEP_TYPE_COMMON) {
2429 + LIMIT_NETDEBUG(KERN_DEBUG"Phonet unknown PEP type: %u\n",
2430 + (unsigned)hdr->data[0]);
2431 +diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
2432 +index 8e45e76..d952e7e 100644
2433 +--- a/net/rose/af_rose.c
2434 ++++ b/net/rose/af_rose.c
2435 +@@ -679,7 +679,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
2436 + if (addr_len == sizeof(struct sockaddr_rose) && addr->srose_ndigis > 1)
2437 + return -EINVAL;
2438 +
2439 +- if (addr->srose_ndigis > ROSE_MAX_DIGIS)
2440 ++ if ((unsigned int) addr->srose_ndigis > ROSE_MAX_DIGIS)
2441 + return -EINVAL;
2442 +
2443 + if ((dev = rose_dev_get(&addr->srose_addr)) == NULL) {
2444 +@@ -739,7 +739,7 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le
2445 + if (addr_len == sizeof(struct sockaddr_rose) && addr->srose_ndigis > 1)
2446 + return -EINVAL;
2447 +
2448 +- if (addr->srose_ndigis > ROSE_MAX_DIGIS)
2449 ++ if ((unsigned int) addr->srose_ndigis > ROSE_MAX_DIGIS)
2450 + return -EINVAL;
2451 +
2452 + /* Source + Destination digis should not exceed ROSE_MAX_DIGIS */
2453 +diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
2454 +index 1827498..b3d890f 100644
2455 +--- a/net/sctp/protocol.c
2456 ++++ b/net/sctp/protocol.c
2457 +@@ -1161,7 +1161,8 @@ SCTP_STATIC __init int sctp_init(void)
2458 +
2459 + /* Set the pressure threshold to be a fraction of global memory that
2460 + * is up to 1/2 at 256 MB, decreasing toward zero with the amount of
2461 +- * memory, with a floor of 128 pages.
2462 ++ * memory, with a floor of 128 pages, and a ceiling that prevents an
2463 ++ * integer overflow.
2464 + * Note this initalizes the data in sctpv6_prot too
2465 + * Unabashedly stolen from tcp_init
2466 + */
2467 +@@ -1169,6 +1170,7 @@ SCTP_STATIC __init int sctp_init(void)
2468 + limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
2469 + limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
2470 + limit = max(limit, 128UL);
2471 ++ limit = min(limit, INT_MAX * 4UL / 3 / 2);
2472 + sysctl_sctp_mem[0] = limit / 4 * 3;
2473 + sysctl_sctp_mem[1] = limit;
2474 + sysctl_sctp_mem[2] = sysctl_sctp_mem[0] * 2;
2475 +diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
2476 +index ab6eab4..ac91f0d 100644
2477 +--- a/net/tipc/subscr.c
2478 ++++ b/net/tipc/subscr.c
2479 +@@ -76,6 +76,19 @@ struct top_srv {
2480 + static struct top_srv topsrv = { 0 };
2481 +
2482 + /**
2483 ++ * htohl - convert value to endianness used by destination
2484 ++ * @in: value to convert
2485 ++ * @swap: non-zero if endianness must be reversed
2486 ++ *
2487 ++ * Returns converted value
2488 ++ */
2489 ++
2490 ++static u32 htohl(u32 in, int swap)
2491 ++{
2492 ++ return swap ? swab32(in) : in;
2493 ++}
2494 ++
2495 ++/**
2496 + * subscr_send_event - send a message containing a tipc_event to the subscriber
2497 + *
2498 + * Note: Must not hold subscriber's server port lock, since tipc_send() will
2499 +@@ -94,11 +107,11 @@ static void subscr_send_event(struct subscription *sub,
2500 + msg_sect.iov_base = (void *)&sub->evt;
2501 + msg_sect.iov_len = sizeof(struct tipc_event);
2502 +
2503 +- sub->evt.event = htonl(event);
2504 +- sub->evt.found_lower = htonl(found_lower);
2505 +- sub->evt.found_upper = htonl(found_upper);
2506 +- sub->evt.port.ref = htonl(port_ref);
2507 +- sub->evt.port.node = htonl(node);
2508 ++ sub->evt.event = htohl(event, sub->swap);
2509 ++ sub->evt.found_lower = htohl(found_lower, sub->swap);
2510 ++ sub->evt.found_upper = htohl(found_upper, sub->swap);
2511 ++ sub->evt.port.ref = htohl(port_ref, sub->swap);
2512 ++ sub->evt.port.node = htohl(node, sub->swap);
2513 + tipc_send(sub->server_ref, 1, &msg_sect);
2514 + }
2515 +
2516 +@@ -274,29 +287,16 @@ static void subscr_cancel(struct tipc_subscr *s,
2517 + {
2518 + struct subscription *sub;
2519 + struct subscription *sub_temp;
2520 +- __u32 type, lower, upper, timeout, filter;
2521 + int found = 0;
2522 +
2523 + /* Find first matching subscription, exit if not found */
2524 +
2525 +- type = ntohl(s->seq.type);
2526 +- lower = ntohl(s->seq.lower);
2527 +- upper = ntohl(s->seq.upper);
2528 +- timeout = ntohl(s->timeout);
2529 +- filter = ntohl(s->filter) & ~TIPC_SUB_CANCEL;
2530 +-
2531 + list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list,
2532 + subscription_list) {
2533 +- if ((type == sub->seq.type) &&
2534 +- (lower == sub->seq.lower) &&
2535 +- (upper == sub->seq.upper) &&
2536 +- (timeout == sub->timeout) &&
2537 +- (filter == sub->filter) &&
2538 +- !memcmp(s->usr_handle,sub->evt.s.usr_handle,
2539 +- sizeof(s->usr_handle)) ){
2540 +- found = 1;
2541 +- break;
2542 +- }
2543 ++ if (!memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) {
2544 ++ found = 1;
2545 ++ break;
2546 ++ }
2547 + }
2548 + if (!found)
2549 + return;
2550 +@@ -310,7 +310,7 @@ static void subscr_cancel(struct tipc_subscr *s,
2551 + k_term_timer(&sub->timer);
2552 + spin_lock_bh(subscriber->lock);
2553 + }
2554 +- dbg("Cancel: removing sub %u,%u,%u from subscriber %p list\n",
2555 ++ dbg("Cancel: removing sub %u,%u,%u from subscriber %x list\n",
2556 + sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber);
2557 + subscr_del(sub);
2558 + }
2559 +@@ -325,10 +325,16 @@ static struct subscription *subscr_subscribe(struct tipc_subscr *s,
2560 + struct subscriber *subscriber)
2561 + {
2562 + struct subscription *sub;
2563 ++ int swap;
2564 ++
2565 ++ /* Determine subscriber's endianness */
2566 ++
2567 ++ swap = !(s->filter & (TIPC_SUB_PORTS | TIPC_SUB_SERVICE));
2568 +
2569 + /* Detect & process a subscription cancellation request */
2570 +
2571 +- if (ntohl(s->filter) & TIPC_SUB_CANCEL) {
2572 ++ if (s->filter & htohl(TIPC_SUB_CANCEL, swap)) {
2573 ++ s->filter &= ~htohl(TIPC_SUB_CANCEL, swap);
2574 + subscr_cancel(s, subscriber);
2575 + return NULL;
2576 + }
2577 +@@ -353,12 +359,13 @@ static struct subscription *subscr_subscribe(struct tipc_subscr *s,
2578 +
2579 + /* Initialize subscription object */
2580 +
2581 +- sub->seq.type = ntohl(s->seq.type);
2582 +- sub->seq.lower = ntohl(s->seq.lower);
2583 +- sub->seq.upper = ntohl(s->seq.upper);
2584 +- sub->timeout = ntohl(s->timeout);
2585 +- sub->filter = ntohl(s->filter);
2586 +- if ((sub->filter && (sub->filter != TIPC_SUB_PORTS)) ||
2587 ++ sub->seq.type = htohl(s->seq.type, swap);
2588 ++ sub->seq.lower = htohl(s->seq.lower, swap);
2589 ++ sub->seq.upper = htohl(s->seq.upper, swap);
2590 ++ sub->timeout = htohl(s->timeout, swap);
2591 ++ sub->filter = htohl(s->filter, swap);
2592 ++ if ((!(sub->filter & TIPC_SUB_PORTS) ==
2593 ++ !(sub->filter & TIPC_SUB_SERVICE)) ||
2594 + (sub->seq.lower > sub->seq.upper)) {
2595 + warn("Subscription rejected, illegal request\n");
2596 + kfree(sub);
2597 +@@ -369,6 +376,7 @@ static struct subscription *subscr_subscribe(struct tipc_subscr *s,
2598 + INIT_LIST_HEAD(&sub->nameseq_list);
2599 + list_add(&sub->subscription_list, &subscriber->subscription_list);
2600 + sub->server_ref = subscriber->port_ref;
2601 ++ sub->swap = swap;
2602 + memcpy(&sub->evt.s, s, sizeof(struct tipc_subscr));
2603 + atomic_inc(&topsrv.subscription_count);
2604 + if (sub->timeout != TIPC_WAIT_FOREVER) {
2605 +diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h
2606 +index c20f496..45d89bf 100644
2607 +--- a/net/tipc/subscr.h
2608 ++++ b/net/tipc/subscr.h
2609 +@@ -53,6 +53,7 @@ typedef void (*tipc_subscr_event) (struct subscription *sub,
2610 + * @nameseq_list: adjacent subscriptions in name sequence's subscription list
2611 + * @subscription_list: adjacent subscriptions in subscriber's subscription list
2612 + * @server_ref: object reference of server port associated with subscription
2613 ++ * @swap: indicates if subscriber uses opposite endianness in its messages
2614 + * @evt: template for events generated by subscription
2615 + */
2616 +
2617 +@@ -65,6 +66,7 @@ struct subscription {
2618 + struct list_head nameseq_list;
2619 + struct list_head subscription_list;
2620 + u32 server_ref;
2621 ++ int swap;
2622 + struct tipc_event evt;
2623 + };
2624 +