Magellan Linux

Contents of /trunk/kernel-lts/patches-3.4/0138-3.4.39-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2151 - (show annotations) (download)
Mon Apr 8 07:05:14 2013 UTC (11 years, 7 months ago) by niro
File size: 106133 byte(s)
-linux-3.4.39
1 diff --git a/arch/arm/include/asm/signal.h b/arch/arm/include/asm/signal.h
2 index 43ba0fb..559ee24 100644
3 --- a/arch/arm/include/asm/signal.h
4 +++ b/arch/arm/include/asm/signal.h
5 @@ -127,6 +127,7 @@ struct sigaction {
6 __sigrestore_t sa_restorer;
7 sigset_t sa_mask; /* mask last for extensibility */
8 };
9 +#define __ARCH_HAS_SA_RESTORER
10
11 struct k_sigaction {
12 struct sigaction sa;
13 diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c
14 index 031805b..7f26faf 100644
15 --- a/arch/arm/mach-cns3xxx/core.c
16 +++ b/arch/arm/mach-cns3xxx/core.c
17 @@ -22,19 +22,9 @@
18
19 static struct map_desc cns3xxx_io_desc[] __initdata = {
20 {
21 - .virtual = CNS3XXX_TC11MP_TWD_BASE_VIRT,
22 - .pfn = __phys_to_pfn(CNS3XXX_TC11MP_TWD_BASE),
23 - .length = SZ_4K,
24 - .type = MT_DEVICE,
25 - }, {
26 - .virtual = CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT,
27 - .pfn = __phys_to_pfn(CNS3XXX_TC11MP_GIC_CPU_BASE),
28 - .length = SZ_4K,
29 - .type = MT_DEVICE,
30 - }, {
31 - .virtual = CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT,
32 - .pfn = __phys_to_pfn(CNS3XXX_TC11MP_GIC_DIST_BASE),
33 - .length = SZ_4K,
34 + .virtual = CNS3XXX_TC11MP_SCU_BASE_VIRT,
35 + .pfn = __phys_to_pfn(CNS3XXX_TC11MP_SCU_BASE),
36 + .length = SZ_8K,
37 .type = MT_DEVICE,
38 }, {
39 .virtual = CNS3XXX_TIMER1_2_3_BASE_VIRT,
40 diff --git a/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h b/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
41 index 191c8e5..b1021aa 100644
42 --- a/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
43 +++ b/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
44 @@ -94,10 +94,10 @@
45 #define RTC_INTR_STS_OFFSET 0x34
46
47 #define CNS3XXX_MISC_BASE 0x76000000 /* Misc Control */
48 -#define CNS3XXX_MISC_BASE_VIRT 0xFFF07000 /* Misc Control */
49 +#define CNS3XXX_MISC_BASE_VIRT 0xFB000000 /* Misc Control */
50
51 #define CNS3XXX_PM_BASE 0x77000000 /* Power Management Control */
52 -#define CNS3XXX_PM_BASE_VIRT 0xFFF08000
53 +#define CNS3XXX_PM_BASE_VIRT 0xFB001000
54
55 #define PM_CLK_GATE_OFFSET 0x00
56 #define PM_SOFT_RST_OFFSET 0x04
57 @@ -109,7 +109,7 @@
58 #define PM_PLL_HM_PD_OFFSET 0x1C
59
60 #define CNS3XXX_UART0_BASE 0x78000000 /* UART 0 */
61 -#define CNS3XXX_UART0_BASE_VIRT 0xFFF09000
62 +#define CNS3XXX_UART0_BASE_VIRT 0xFB002000
63
64 #define CNS3XXX_UART1_BASE 0x78400000 /* UART 1 */
65 #define CNS3XXX_UART1_BASE_VIRT 0xFFF0A000
66 @@ -130,7 +130,7 @@
67 #define CNS3XXX_I2S_BASE_VIRT 0xFFF10000
68
69 #define CNS3XXX_TIMER1_2_3_BASE 0x7C800000 /* Timer */
70 -#define CNS3XXX_TIMER1_2_3_BASE_VIRT 0xFFF10800
71 +#define CNS3XXX_TIMER1_2_3_BASE_VIRT 0xFB003000
72
73 #define TIMER1_COUNTER_OFFSET 0x00
74 #define TIMER1_AUTO_RELOAD_OFFSET 0x04
75 @@ -227,16 +227,16 @@
76 * Testchip peripheral and fpga gic regions
77 */
78 #define CNS3XXX_TC11MP_SCU_BASE 0x90000000 /* IRQ, Test chip */
79 -#define CNS3XXX_TC11MP_SCU_BASE_VIRT 0xFF000000
80 +#define CNS3XXX_TC11MP_SCU_BASE_VIRT 0xFB004000
81
82 #define CNS3XXX_TC11MP_GIC_CPU_BASE 0x90000100 /* Test chip interrupt controller CPU interface */
83 -#define CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT 0xFF000100
84 +#define CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x100)
85
86 #define CNS3XXX_TC11MP_TWD_BASE 0x90000600
87 -#define CNS3XXX_TC11MP_TWD_BASE_VIRT 0xFF000600
88 +#define CNS3XXX_TC11MP_TWD_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x600)
89
90 #define CNS3XXX_TC11MP_GIC_DIST_BASE 0x90001000 /* Test chip interrupt controller distributor */
91 -#define CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT 0xFF001000
92 +#define CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x1000)
93
94 #define CNS3XXX_TC11MP_L220_BASE 0x92002000 /* L220 registers */
95 #define CNS3XXX_TC11MP_L220_BASE_VIRT 0xFF002000
96 diff --git a/arch/avr32/include/asm/signal.h b/arch/avr32/include/asm/signal.h
97 index 8790dfc..e6952a0 100644
98 --- a/arch/avr32/include/asm/signal.h
99 +++ b/arch/avr32/include/asm/signal.h
100 @@ -128,6 +128,7 @@ struct sigaction {
101 __sigrestore_t sa_restorer;
102 sigset_t sa_mask; /* mask last for extensibility */
103 };
104 +#define __ARCH_HAS_SA_RESTORER
105
106 struct k_sigaction {
107 struct sigaction sa;
108 diff --git a/arch/cris/include/asm/signal.h b/arch/cris/include/asm/signal.h
109 index ea6af9a..057fea2 100644
110 --- a/arch/cris/include/asm/signal.h
111 +++ b/arch/cris/include/asm/signal.h
112 @@ -122,6 +122,7 @@ struct sigaction {
113 void (*sa_restorer)(void);
114 sigset_t sa_mask; /* mask last for extensibility */
115 };
116 +#define __ARCH_HAS_SA_RESTORER
117
118 struct k_sigaction {
119 struct sigaction sa;
120 diff --git a/arch/h8300/include/asm/signal.h b/arch/h8300/include/asm/signal.h
121 index fd8b66e..8695707 100644
122 --- a/arch/h8300/include/asm/signal.h
123 +++ b/arch/h8300/include/asm/signal.h
124 @@ -121,6 +121,7 @@ struct sigaction {
125 void (*sa_restorer)(void);
126 sigset_t sa_mask; /* mask last for extensibility */
127 };
128 +#define __ARCH_HAS_SA_RESTORER
129
130 struct k_sigaction {
131 struct sigaction sa;
132 diff --git a/arch/m32r/include/asm/signal.h b/arch/m32r/include/asm/signal.h
133 index b2eeb0d..802d561 100644
134 --- a/arch/m32r/include/asm/signal.h
135 +++ b/arch/m32r/include/asm/signal.h
136 @@ -123,6 +123,7 @@ struct sigaction {
137 __sigrestore_t sa_restorer;
138 sigset_t sa_mask; /* mask last for extensibility */
139 };
140 +#define __ARCH_HAS_SA_RESTORER
141
142 struct k_sigaction {
143 struct sigaction sa;
144 diff --git a/arch/m68k/include/asm/signal.h b/arch/m68k/include/asm/signal.h
145 index 93fe83e..a20ae63 100644
146 --- a/arch/m68k/include/asm/signal.h
147 +++ b/arch/m68k/include/asm/signal.h
148 @@ -119,6 +119,7 @@ struct sigaction {
149 __sigrestore_t sa_restorer;
150 sigset_t sa_mask; /* mask last for extensibility */
151 };
152 +#define __ARCH_HAS_SA_RESTORER
153
154 struct k_sigaction {
155 struct sigaction sa;
156 diff --git a/arch/mn10300/include/asm/signal.h b/arch/mn10300/include/asm/signal.h
157 index 1865d72..eecaa76 100644
158 --- a/arch/mn10300/include/asm/signal.h
159 +++ b/arch/mn10300/include/asm/signal.h
160 @@ -131,6 +131,7 @@ struct sigaction {
161 __sigrestore_t sa_restorer;
162 sigset_t sa_mask; /* mask last for extensibility */
163 };
164 +#define __ARCH_HAS_SA_RESTORER
165
166 struct k_sigaction {
167 struct sigaction sa;
168 diff --git a/arch/powerpc/include/asm/signal.h b/arch/powerpc/include/asm/signal.h
169 index 3eb13be..ec63a0a 100644
170 --- a/arch/powerpc/include/asm/signal.h
171 +++ b/arch/powerpc/include/asm/signal.h
172 @@ -109,6 +109,7 @@ struct sigaction {
173 __sigrestore_t sa_restorer;
174 sigset_t sa_mask; /* mask last for extensibility */
175 };
176 +#define __ARCH_HAS_SA_RESTORER
177
178 struct k_sigaction {
179 struct sigaction sa;
180 diff --git a/arch/s390/include/asm/signal.h b/arch/s390/include/asm/signal.h
181 index cdf5cb2..c872626 100644
182 --- a/arch/s390/include/asm/signal.h
183 +++ b/arch/s390/include/asm/signal.h
184 @@ -131,6 +131,7 @@ struct sigaction {
185 void (*sa_restorer)(void);
186 sigset_t sa_mask; /* mask last for extensibility */
187 };
188 +#define __ARCH_HAS_SA_RESTORER
189
190 struct k_sigaction {
191 struct sigaction sa;
192 diff --git a/arch/sparc/include/asm/signal.h b/arch/sparc/include/asm/signal.h
193 index aa42fe3..d07beb3 100644
194 --- a/arch/sparc/include/asm/signal.h
195 +++ b/arch/sparc/include/asm/signal.h
196 @@ -192,6 +192,7 @@ struct __old_sigaction {
197 unsigned long sa_flags;
198 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */
199 };
200 +#define __ARCH_HAS_SA_RESTORER
201
202 typedef struct sigaltstack {
203 void __user *ss_sp;
204 diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
205 index bff23f4..fd107ab 100644
206 --- a/arch/tile/kernel/setup.c
207 +++ b/arch/tile/kernel/setup.c
208 @@ -912,15 +912,8 @@ void __cpuinit setup_cpu(int boot)
209
210 #ifdef CONFIG_BLK_DEV_INITRD
211
212 -/*
213 - * Note that the kernel can potentially support other compression
214 - * techniques than gz, though we don't do so by default. If we ever
215 - * decide to do so we can either look for other filename extensions,
216 - * or just allow a file with this name to be compressed with an
217 - * arbitrary compressor (somewhat counterintuitively).
218 - */
219 static int __initdata set_initramfs_file;
220 -static char __initdata initramfs_file[128] = "initramfs.cpio.gz";
221 +static char __initdata initramfs_file[128] = "initramfs";
222
223 static int __init setup_initramfs_file(char *str)
224 {
225 @@ -934,9 +927,9 @@ static int __init setup_initramfs_file(char *str)
226 early_param("initramfs_file", setup_initramfs_file);
227
228 /*
229 - * We look for an "initramfs.cpio.gz" file in the hvfs.
230 - * If there is one, we allocate some memory for it and it will be
231 - * unpacked to the initramfs.
232 + * We look for a file called "initramfs" in the hvfs. If there is one, we
233 + * allocate some memory for it and it will be unpacked to the initramfs.
234 + * If it's compressed, the initd code will uncompress it first.
235 */
236 static void __init load_hv_initrd(void)
237 {
238 @@ -946,10 +939,16 @@ static void __init load_hv_initrd(void)
239
240 fd = hv_fs_findfile((HV_VirtAddr) initramfs_file);
241 if (fd == HV_ENOENT) {
242 - if (set_initramfs_file)
243 + if (set_initramfs_file) {
244 pr_warning("No such hvfs initramfs file '%s'\n",
245 initramfs_file);
246 - return;
247 + return;
248 + } else {
249 + /* Try old backwards-compatible name. */
250 + fd = hv_fs_findfile((HV_VirtAddr)"initramfs.cpio.gz");
251 + if (fd == HV_ENOENT)
252 + return;
253 + }
254 }
255 BUG_ON(fd < 0);
256 stat = hv_fs_fstat(fd);
257 diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h
258 index 598457c..6cbc795 100644
259 --- a/arch/x86/include/asm/signal.h
260 +++ b/arch/x86/include/asm/signal.h
261 @@ -125,6 +125,8 @@ typedef unsigned long sigset_t;
262 extern void do_notify_resume(struct pt_regs *, void *, __u32);
263 # endif /* __KERNEL__ */
264
265 +#define __ARCH_HAS_SA_RESTORER
266 +
267 #ifdef __i386__
268 # ifdef __KERNEL__
269 struct old_sigaction {
270 diff --git a/arch/xtensa/include/asm/signal.h b/arch/xtensa/include/asm/signal.h
271 index 633ba73..75edf8a 100644
272 --- a/arch/xtensa/include/asm/signal.h
273 +++ b/arch/xtensa/include/asm/signal.h
274 @@ -133,6 +133,7 @@ struct sigaction {
275 void (*sa_restorer)(void);
276 sigset_t sa_mask; /* mask last for extensibility */
277 };
278 +#define __ARCH_HAS_SA_RESTORER
279
280 struct k_sigaction {
281 struct sigaction sa;
282 diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
283 index 887f68f..db30542 100644
284 --- a/drivers/block/aoe/aoecmd.c
285 +++ b/drivers/block/aoe/aoecmd.c
286 @@ -30,8 +30,9 @@ new_skb(ulong len)
287 {
288 struct sk_buff *skb;
289
290 - skb = alloc_skb(len, GFP_ATOMIC);
291 + skb = alloc_skb(len + MAX_HEADER, GFP_ATOMIC);
292 if (skb) {
293 + skb_reserve(skb, MAX_HEADER);
294 skb_reset_mac_header(skb);
295 skb_reset_network_header(skb);
296 skb->protocol = __constant_htons(ETH_P_AOE);
297 diff --git a/drivers/block/loop.c b/drivers/block/loop.c
298 index 5e3be05..179b5b4 100644
299 --- a/drivers/block/loop.c
300 +++ b/drivers/block/loop.c
301 @@ -908,6 +908,11 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
302 lo->lo_flags |= LO_FLAGS_PARTSCAN;
303 if (lo->lo_flags & LO_FLAGS_PARTSCAN)
304 ioctl_by_bdev(bdev, BLKRRPART, 0);
305 +
306 + /* Grab the block_device to prevent its destruction after we
307 + * put /dev/loopXX inode. Later in loop_clr_fd() we bdput(bdev).
308 + */
309 + bdgrab(bdev);
310 return 0;
311
312 out_clr:
313 @@ -1004,8 +1009,10 @@ static int loop_clr_fd(struct loop_device *lo)
314 memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE);
315 memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
316 memset(lo->lo_file_name, 0, LO_NAME_SIZE);
317 - if (bdev)
318 + if (bdev) {
319 + bdput(bdev);
320 invalidate_bdev(bdev);
321 + }
322 set_capacity(lo->lo_disk, 0);
323 loop_sysfs_exit(lo);
324 if (bdev) {
325 diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
326 index 73d8c92..4fd1dea 100644
327 --- a/drivers/block/xen-blkback/blkback.c
328 +++ b/drivers/block/xen-blkback/blkback.c
329 @@ -422,6 +422,16 @@ static int dispatch_discard_io(struct xen_blkif *blkif,
330 return err;
331 }
332
333 +static int dispatch_other_io(struct xen_blkif *blkif,
334 + struct blkif_request *req,
335 + struct pending_req *pending_req)
336 +{
337 + free_req(pending_req);
338 + make_response(blkif, req->u.other.id, req->operation,
339 + BLKIF_RSP_EOPNOTSUPP);
340 + return -EIO;
341 +}
342 +
343 static void xen_blk_drain_io(struct xen_blkif *blkif)
344 {
345 atomic_set(&blkif->drain, 1);
346 @@ -543,17 +553,30 @@ __do_block_io_op(struct xen_blkif *blkif)
347
348 /* Apply all sanity checks to /private copy/ of request. */
349 barrier();
350 - if (unlikely(req.operation == BLKIF_OP_DISCARD)) {
351 +
352 + switch (req.operation) {
353 + case BLKIF_OP_READ:
354 + case BLKIF_OP_WRITE:
355 + case BLKIF_OP_WRITE_BARRIER:
356 + case BLKIF_OP_FLUSH_DISKCACHE:
357 + if (dispatch_rw_block_io(blkif, &req, pending_req))
358 + goto done;
359 + break;
360 + case BLKIF_OP_DISCARD:
361 free_req(pending_req);
362 if (dispatch_discard_io(blkif, &req))
363 - break;
364 - } else if (dispatch_rw_block_io(blkif, &req, pending_req))
365 + goto done;
366 break;
367 + default:
368 + if (dispatch_other_io(blkif, &req, pending_req))
369 + goto done;
370 + break;
371 + }
372
373 /* Yield point for this unbounded loop. */
374 cond_resched();
375 }
376 -
377 +done:
378 return more_to_do;
379 }
380
381 @@ -623,6 +646,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
382 goto fail_response;
383 }
384
385 + preq.dev = req->u.rw.handle;
386 preq.sector_number = req->u.rw.sector_number;
387 preq.nr_sects = 0;
388
389 @@ -719,13 +743,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
390 bio->bi_end_io = end_block_io_op;
391 }
392
393 - /*
394 - * We set it one so that the last submit_bio does not have to call
395 - * atomic_inc.
396 - */
397 atomic_set(&pending_req->pendcnt, nbio);
398 -
399 - /* Get a reference count for the disk queue and start sending I/O */
400 blk_start_plug(&plug);
401
402 for (i = 0; i < nbio; i++)
403 @@ -753,6 +771,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
404 fail_put_bio:
405 for (i = 0; i < nbio; i++)
406 bio_put(biolist[i]);
407 + atomic_set(&pending_req->pendcnt, 1);
408 __end_block_io_op(pending_req, -EINVAL);
409 msleep(1); /* back off a bit */
410 return -EIO;
411 diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
412 index 9ad3b5e..fc2a486 100644
413 --- a/drivers/block/xen-blkback/common.h
414 +++ b/drivers/block/xen-blkback/common.h
415 @@ -76,11 +76,18 @@ struct blkif_x86_32_request_discard {
416 uint64_t nr_sectors;
417 } __attribute__((__packed__));
418
419 +struct blkif_x86_32_request_other {
420 + uint8_t _pad1;
421 + blkif_vdev_t _pad2;
422 + uint64_t id; /* private guest value, echoed in resp */
423 +} __attribute__((__packed__));
424 +
425 struct blkif_x86_32_request {
426 uint8_t operation; /* BLKIF_OP_??? */
427 union {
428 struct blkif_x86_32_request_rw rw;
429 struct blkif_x86_32_request_discard discard;
430 + struct blkif_x86_32_request_other other;
431 } u;
432 } __attribute__((__packed__));
433
434 @@ -112,11 +119,19 @@ struct blkif_x86_64_request_discard {
435 uint64_t nr_sectors;
436 } __attribute__((__packed__));
437
438 +struct blkif_x86_64_request_other {
439 + uint8_t _pad1;
440 + blkif_vdev_t _pad2;
441 + uint32_t _pad3; /* offsetof(blkif_..,u.discard.id)==8 */
442 + uint64_t id; /* private guest value, echoed in resp */
443 +} __attribute__((__packed__));
444 +
445 struct blkif_x86_64_request {
446 uint8_t operation; /* BLKIF_OP_??? */
447 union {
448 struct blkif_x86_64_request_rw rw;
449 struct blkif_x86_64_request_discard discard;
450 + struct blkif_x86_64_request_other other;
451 } u;
452 } __attribute__((__packed__));
453
454 @@ -262,6 +277,11 @@ static inline void blkif_get_x86_32_req(struct blkif_request *dst,
455 dst->u.discard.nr_sectors = src->u.discard.nr_sectors;
456 break;
457 default:
458 + /*
459 + * Don't know how to translate this op. Only get the
460 + * ID so failure can be reported to the frontend.
461 + */
462 + dst->u.other.id = src->u.other.id;
463 break;
464 }
465 }
466 @@ -293,6 +313,11 @@ static inline void blkif_get_x86_64_req(struct blkif_request *dst,
467 dst->u.discard.nr_sectors = src->u.discard.nr_sectors;
468 break;
469 default:
470 + /*
471 + * Don't know how to translate this op. Only get the
472 + * ID so failure can be reported to the frontend.
473 + */
474 + dst->u.other.id = src->u.other.id;
475 break;
476 }
477 }
478 diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
479 index 1ae7039..681be14 100644
480 --- a/drivers/bluetooth/ath3k.c
481 +++ b/drivers/bluetooth/ath3k.c
482 @@ -72,8 +72,10 @@ static struct usb_device_id ath3k_table[] = {
483 { USB_DEVICE(0x03F0, 0x311D) },
484
485 /* Atheros AR3012 with sflash firmware*/
486 + { USB_DEVICE(0x0CF3, 0x0036) },
487 { USB_DEVICE(0x0CF3, 0x3004) },
488 { USB_DEVICE(0x0CF3, 0x311D) },
489 + { USB_DEVICE(0x0CF3, 0x817a) },
490 { USB_DEVICE(0x13d3, 0x3375) },
491 { USB_DEVICE(0x04CA, 0x3005) },
492 { USB_DEVICE(0x13d3, 0x3362) },
493 @@ -93,8 +95,10 @@ MODULE_DEVICE_TABLE(usb, ath3k_table);
494 static struct usb_device_id ath3k_blist_tbl[] = {
495
496 /* Atheros AR3012 with sflash firmware*/
497 + { USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 },
498 { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
499 { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 },
500 + { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 },
501 { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
502 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
503 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
504 diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
505 index 27f9d9f..56fede1 100644
506 --- a/drivers/bluetooth/btusb.c
507 +++ b/drivers/bluetooth/btusb.c
508 @@ -136,8 +136,10 @@ static struct usb_device_id blacklist_table[] = {
509 { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE },
510
511 /* Atheros 3012 with sflash firmware */
512 + { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 },
513 { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
514 { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 },
515 + { USB_DEVICE(0x0cf3, 0x817a), .driver_info = BTUSB_ATH3012 },
516 { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
517 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
518 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
519 diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
520 index bfd8f43..2cbb675 100644
521 --- a/drivers/firmware/efivars.c
522 +++ b/drivers/firmware/efivars.c
523 @@ -122,6 +122,9 @@ struct efivar_attribute {
524 ssize_t (*store)(struct efivar_entry *entry, const char *buf, size_t count);
525 };
526
527 +static struct efivars __efivars;
528 +static struct efivar_operations ops;
529 +
530 #define PSTORE_EFI_ATTRIBUTES \
531 (EFI_VARIABLE_NON_VOLATILE | \
532 EFI_VARIABLE_BOOTSERVICE_ACCESS | \
533 @@ -942,6 +945,53 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj,
534 return count;
535 }
536
537 +static bool variable_is_present(efi_char16_t *variable_name, efi_guid_t *vendor)
538 +{
539 + struct efivar_entry *entry, *n;
540 + struct efivars *efivars = &__efivars;
541 + unsigned long strsize1, strsize2;
542 + bool found = false;
543 +
544 + strsize1 = utf16_strsize(variable_name, 1024);
545 + list_for_each_entry_safe(entry, n, &efivars->list, list) {
546 + strsize2 = utf16_strsize(entry->var.VariableName, 1024);
547 + if (strsize1 == strsize2 &&
548 + !memcmp(variable_name, &(entry->var.VariableName),
549 + strsize2) &&
550 + !efi_guidcmp(entry->var.VendorGuid,
551 + *vendor)) {
552 + found = true;
553 + break;
554 + }
555 + }
556 + return found;
557 +}
558 +
559 +/*
560 + * Returns the size of variable_name, in bytes, including the
561 + * terminating NULL character, or variable_name_size if no NULL
562 + * character is found among the first variable_name_size bytes.
563 + */
564 +static unsigned long var_name_strnsize(efi_char16_t *variable_name,
565 + unsigned long variable_name_size)
566 +{
567 + unsigned long len;
568 + efi_char16_t c;
569 +
570 + /*
571 + * The variable name is, by definition, a NULL-terminated
572 + * string, so make absolutely sure that variable_name_size is
573 + * the value we expect it to be. If not, return the real size.
574 + */
575 + for (len = 2; len <= variable_name_size; len += sizeof(c)) {
576 + c = variable_name[(len / sizeof(c)) - 1];
577 + if (!c)
578 + break;
579 + }
580 +
581 + return min(len, variable_name_size);
582 +}
583 +
584 /*
585 * Let's not leave out systab information that snuck into
586 * the efivars driver
587 @@ -1129,6 +1179,28 @@ void unregister_efivars(struct efivars *efivars)
588 }
589 EXPORT_SYMBOL_GPL(unregister_efivars);
590
591 +/*
592 + * Print a warning when duplicate EFI variables are encountered and
593 + * disable the sysfs workqueue since the firmware is buggy.
594 + */
595 +static void dup_variable_bug(efi_char16_t *s16, efi_guid_t *vendor_guid,
596 + unsigned long len16)
597 +{
598 + size_t i, len8 = len16 / sizeof(efi_char16_t);
599 + char *s8;
600 +
601 + s8 = kzalloc(len8, GFP_KERNEL);
602 + if (!s8)
603 + return;
604 +
605 + for (i = 0; i < len8; i++)
606 + s8[i] = s16[i];
607 +
608 + printk(KERN_WARNING "efivars: duplicate variable: %s-%pUl\n",
609 + s8, vendor_guid);
610 + kfree(s8);
611 +}
612 +
613 int register_efivars(struct efivars *efivars,
614 const struct efivar_operations *ops,
615 struct kobject *parent_kobj)
616 @@ -1169,6 +1241,24 @@ int register_efivars(struct efivars *efivars,
617 &vendor_guid);
618 switch (status) {
619 case EFI_SUCCESS:
620 + variable_name_size = var_name_strnsize(variable_name,
621 + variable_name_size);
622 +
623 + /*
624 + * Some firmware implementations return the
625 + * same variable name on multiple calls to
626 + * get_next_variable(). Terminate the loop
627 + * immediately as there is no guarantee that
628 + * we'll ever see a different variable name,
629 + * and may end up looping here forever.
630 + */
631 + if (variable_is_present(variable_name, &vendor_guid)) {
632 + dup_variable_bug(variable_name, &vendor_guid,
633 + variable_name_size);
634 + status = EFI_NOT_FOUND;
635 + break;
636 + }
637 +
638 efivar_create_sysfs_entry(efivars,
639 variable_name_size,
640 variable_name,
641 @@ -1205,9 +1295,6 @@ out:
642 }
643 EXPORT_SYMBOL_GPL(register_efivars);
644
645 -static struct efivars __efivars;
646 -static struct efivar_operations ops;
647 -
648 /*
649 * For now we register the efi subsystem with the firmware subsystem
650 * and the vars subsystem with the efi subsystem. In the future, it
651 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
652 index 7ccf896..84867a8 100644
653 --- a/drivers/gpu/drm/i915/intel_display.c
654 +++ b/drivers/gpu/drm/i915/intel_display.c
655 @@ -7567,8 +7567,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
656 {
657 struct drm_device *dev = crtc->dev;
658 struct drm_i915_private *dev_priv = dev->dev_private;
659 - struct intel_framebuffer *intel_fb;
660 - struct drm_i915_gem_object *obj;
661 + struct drm_framebuffer *old_fb = crtc->fb;
662 + struct drm_i915_gem_object *obj = to_intel_framebuffer(fb)->obj;
663 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
664 struct intel_unpin_work *work;
665 unsigned long flags;
666 @@ -7580,8 +7580,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
667
668 work->event = event;
669 work->dev = crtc->dev;
670 - intel_fb = to_intel_framebuffer(crtc->fb);
671 - work->old_fb_obj = intel_fb->obj;
672 + work->old_fb_obj = to_intel_framebuffer(old_fb)->obj;
673 INIT_WORK(&work->work, intel_unpin_work_fn);
674
675 ret = drm_vblank_get(dev, intel_crtc->pipe);
676 @@ -7601,9 +7600,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
677 intel_crtc->unpin_work = work;
678 spin_unlock_irqrestore(&dev->event_lock, flags);
679
680 - intel_fb = to_intel_framebuffer(fb);
681 - obj = intel_fb->obj;
682 -
683 mutex_lock(&dev->struct_mutex);
684
685 /* Reference the objects for the scheduled work. */
686 @@ -7634,6 +7630,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
687
688 cleanup_pending:
689 atomic_sub(1 << intel_crtc->plane, &work->old_fb_obj->pending_flip);
690 + crtc->fb = old_fb;
691 drm_gem_object_unreference(&work->old_fb_obj->base);
692 drm_gem_object_unreference(&obj->base);
693 mutex_unlock(&dev->struct_mutex);
694 diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
695 index 02f4664..14d2239 100644
696 --- a/drivers/hid/hid-ids.h
697 +++ b/drivers/hid/hid-ids.h
698 @@ -644,6 +644,9 @@
699 #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008
700 #define USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN 0x3001
701
702 +#define USB_VENDOR_ID_REALTEK 0x0bda
703 +#define USB_DEVICE_ID_REALTEK_READER 0x0152
704 +
705 #define USB_VENDOR_ID_ROCCAT 0x1e7d
706 #define USB_DEVICE_ID_ROCCAT_ARVO 0x30d4
707 #define USB_DEVICE_ID_ROCCAT_ISKU 0x319c
708 diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
709 index 9fea98f..5c4112e 100644
710 --- a/drivers/hid/usbhid/hid-quirks.c
711 +++ b/drivers/hid/usbhid/hid-quirks.c
712 @@ -77,6 +77,7 @@ static const struct hid_blacklist {
713 { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET },
714 { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET },
715 { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET },
716 + { USB_VENDOR_ID_REALTEK, USB_DEVICE_ID_REALTEK_READER, HID_QUIRK_NO_INIT_REPORTS },
717 { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET },
718 { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET },
719 { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },
720 diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
721 index 57ed244..0569843 100644
722 --- a/drivers/iommu/amd_iommu.c
723 +++ b/drivers/iommu/amd_iommu.c
724 @@ -2270,18 +2270,16 @@ static int device_change_notifier(struct notifier_block *nb,
725
726 /* allocate a protection domain if a device is added */
727 dma_domain = find_protection_domain(devid);
728 - if (dma_domain)
729 - goto out;
730 - dma_domain = dma_ops_domain_alloc();
731 - if (!dma_domain)
732 - goto out;
733 - dma_domain->target_dev = devid;
734 -
735 - spin_lock_irqsave(&iommu_pd_list_lock, flags);
736 - list_add_tail(&dma_domain->list, &iommu_pd_list);
737 - spin_unlock_irqrestore(&iommu_pd_list_lock, flags);
738 -
739 - dev_data = get_dev_data(dev);
740 + if (!dma_domain) {
741 + dma_domain = dma_ops_domain_alloc();
742 + if (!dma_domain)
743 + goto out;
744 + dma_domain->target_dev = devid;
745 +
746 + spin_lock_irqsave(&iommu_pd_list_lock, flags);
747 + list_add_tail(&dma_domain->list, &iommu_pd_list);
748 + spin_unlock_irqrestore(&iommu_pd_list_lock, flags);
749 + }
750
751 dev->archdata.dma_ops = &amd_iommu_dma_ops;
752
753 diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
754 index dadf337..d9f646f 100644
755 --- a/drivers/net/bonding/bond_main.c
756 +++ b/drivers/net/bonding/bond_main.c
757 @@ -1956,12 +1956,11 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
758 return -EINVAL;
759 }
760
761 + write_unlock_bh(&bond->lock);
762 /* unregister rx_handler early so bond_handle_frame wouldn't be called
763 * for this slave anymore.
764 */
765 netdev_rx_handler_unregister(slave_dev);
766 - write_unlock_bh(&bond->lock);
767 - synchronize_net();
768 write_lock_bh(&bond->lock);
769
770 if (!bond->params.fail_over_mac) {
771 @@ -3398,6 +3397,28 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count)
772
773 /*-------------------------- Device entry points ----------------------------*/
774
775 +static void bond_work_init_all(struct bonding *bond)
776 +{
777 + INIT_DELAYED_WORK(&bond->mcast_work,
778 + bond_resend_igmp_join_requests_delayed);
779 + INIT_DELAYED_WORK(&bond->alb_work, bond_alb_monitor);
780 + INIT_DELAYED_WORK(&bond->mii_work, bond_mii_monitor);
781 + if (bond->params.mode == BOND_MODE_ACTIVEBACKUP)
782 + INIT_DELAYED_WORK(&bond->arp_work, bond_activebackup_arp_mon);
783 + else
784 + INIT_DELAYED_WORK(&bond->arp_work, bond_loadbalance_arp_mon);
785 + INIT_DELAYED_WORK(&bond->ad_work, bond_3ad_state_machine_handler);
786 +}
787 +
788 +static void bond_work_cancel_all(struct bonding *bond)
789 +{
790 + cancel_delayed_work_sync(&bond->mii_work);
791 + cancel_delayed_work_sync(&bond->arp_work);
792 + cancel_delayed_work_sync(&bond->alb_work);
793 + cancel_delayed_work_sync(&bond->ad_work);
794 + cancel_delayed_work_sync(&bond->mcast_work);
795 +}
796 +
797 static int bond_open(struct net_device *bond_dev)
798 {
799 struct bonding *bond = netdev_priv(bond_dev);
800 @@ -3420,41 +3441,27 @@ static int bond_open(struct net_device *bond_dev)
801 }
802 read_unlock(&bond->lock);
803
804 - INIT_DELAYED_WORK(&bond->mcast_work, bond_resend_igmp_join_requests_delayed);
805 + bond_work_init_all(bond);
806
807 if (bond_is_lb(bond)) {
808 /* bond_alb_initialize must be called before the timer
809 * is started.
810 */
811 - if (bond_alb_initialize(bond, (bond->params.mode == BOND_MODE_ALB))) {
812 - /* something went wrong - fail the open operation */
813 + if (bond_alb_initialize(bond, (bond->params.mode == BOND_MODE_ALB)))
814 return -ENOMEM;
815 - }
816 -
817 - INIT_DELAYED_WORK(&bond->alb_work, bond_alb_monitor);
818 queue_delayed_work(bond->wq, &bond->alb_work, 0);
819 }
820
821 - if (bond->params.miimon) { /* link check interval, in milliseconds. */
822 - INIT_DELAYED_WORK(&bond->mii_work, bond_mii_monitor);
823 + if (bond->params.miimon) /* link check interval, in milliseconds. */
824 queue_delayed_work(bond->wq, &bond->mii_work, 0);
825 - }
826
827 if (bond->params.arp_interval) { /* arp interval, in milliseconds. */
828 - if (bond->params.mode == BOND_MODE_ACTIVEBACKUP)
829 - INIT_DELAYED_WORK(&bond->arp_work,
830 - bond_activebackup_arp_mon);
831 - else
832 - INIT_DELAYED_WORK(&bond->arp_work,
833 - bond_loadbalance_arp_mon);
834 -
835 queue_delayed_work(bond->wq, &bond->arp_work, 0);
836 if (bond->params.arp_validate)
837 bond->recv_probe = bond_arp_rcv;
838 }
839
840 if (bond->params.mode == BOND_MODE_8023AD) {
841 - INIT_DELAYED_WORK(&bond->ad_work, bond_3ad_state_machine_handler);
842 queue_delayed_work(bond->wq, &bond->ad_work, 0);
843 /* register to receive LACPDUs */
844 bond->recv_probe = bond_3ad_lacpdu_recv;
845 @@ -3469,34 +3476,10 @@ static int bond_close(struct net_device *bond_dev)
846 struct bonding *bond = netdev_priv(bond_dev);
847
848 write_lock_bh(&bond->lock);
849 -
850 bond->send_peer_notif = 0;
851 -
852 write_unlock_bh(&bond->lock);
853
854 - if (bond->params.miimon) { /* link check interval, in milliseconds. */
855 - cancel_delayed_work_sync(&bond->mii_work);
856 - }
857 -
858 - if (bond->params.arp_interval) { /* arp interval, in milliseconds. */
859 - cancel_delayed_work_sync(&bond->arp_work);
860 - }
861 -
862 - switch (bond->params.mode) {
863 - case BOND_MODE_8023AD:
864 - cancel_delayed_work_sync(&bond->ad_work);
865 - break;
866 - case BOND_MODE_TLB:
867 - case BOND_MODE_ALB:
868 - cancel_delayed_work_sync(&bond->alb_work);
869 - break;
870 - default:
871 - break;
872 - }
873 -
874 - if (delayed_work_pending(&bond->mcast_work))
875 - cancel_delayed_work_sync(&bond->mcast_work);
876 -
877 + bond_work_cancel_all(bond);
878 if (bond_is_lb(bond)) {
879 /* Must be called only after all
880 * slaves have been released
881 @@ -4375,26 +4358,6 @@ static void bond_setup(struct net_device *bond_dev)
882 bond_dev->features |= bond_dev->hw_features;
883 }
884
885 -static void bond_work_cancel_all(struct bonding *bond)
886 -{
887 - if (bond->params.miimon && delayed_work_pending(&bond->mii_work))
888 - cancel_delayed_work_sync(&bond->mii_work);
889 -
890 - if (bond->params.arp_interval && delayed_work_pending(&bond->arp_work))
891 - cancel_delayed_work_sync(&bond->arp_work);
892 -
893 - if (bond->params.mode == BOND_MODE_ALB &&
894 - delayed_work_pending(&bond->alb_work))
895 - cancel_delayed_work_sync(&bond->alb_work);
896 -
897 - if (bond->params.mode == BOND_MODE_8023AD &&
898 - delayed_work_pending(&bond->ad_work))
899 - cancel_delayed_work_sync(&bond->ad_work);
900 -
901 - if (delayed_work_pending(&bond->mcast_work))
902 - cancel_delayed_work_sync(&bond->mcast_work);
903 -}
904 -
905 /*
906 * Destroy a bonding device.
907 * Must be under rtnl_lock when this function is called.
908 diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
909 index 6734737..c40c0a8 100644
910 --- a/drivers/net/bonding/bond_sysfs.c
911 +++ b/drivers/net/bonding/bond_sysfs.c
912 @@ -183,6 +183,11 @@ int bond_create_slave_symlinks(struct net_device *master,
913 sprintf(linkname, "slave_%s", slave->name);
914 ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj),
915 linkname);
916 +
917 + /* free the master link created earlier in case of error */
918 + if (ret)
919 + sysfs_remove_link(&(slave->dev.kobj), "master");
920 +
921 return ret;
922
923 }
924 @@ -513,6 +518,8 @@ static ssize_t bonding_store_arp_interval(struct device *d,
925 int new_value, ret = count;
926 struct bonding *bond = to_bond(d);
927
928 + if (!rtnl_trylock())
929 + return restart_syscall();
930 if (sscanf(buf, "%d", &new_value) != 1) {
931 pr_err("%s: no arp_interval value specified.\n",
932 bond->dev->name);
933 @@ -520,7 +527,7 @@ static ssize_t bonding_store_arp_interval(struct device *d,
934 goto out;
935 }
936 if (new_value < 0) {
937 - pr_err("%s: Invalid arp_interval value %d not in range 1-%d; rejected.\n",
938 + pr_err("%s: Invalid arp_interval value %d not in range 0-%d; rejected.\n",
939 bond->dev->name, new_value, INT_MAX);
940 ret = -EINVAL;
941 goto out;
942 @@ -535,18 +542,15 @@ static ssize_t bonding_store_arp_interval(struct device *d,
943 pr_info("%s: Setting ARP monitoring interval to %d.\n",
944 bond->dev->name, new_value);
945 bond->params.arp_interval = new_value;
946 - if (bond->params.miimon) {
947 - pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n",
948 - bond->dev->name, bond->dev->name);
949 - bond->params.miimon = 0;
950 - if (delayed_work_pending(&bond->mii_work)) {
951 - cancel_delayed_work(&bond->mii_work);
952 - flush_workqueue(bond->wq);
953 + if (new_value) {
954 + if (bond->params.miimon) {
955 + pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n",
956 + bond->dev->name, bond->dev->name);
957 + bond->params.miimon = 0;
958 }
959 - }
960 - if (!bond->params.arp_targets[0]) {
961 - pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n",
962 - bond->dev->name);
963 + if (!bond->params.arp_targets[0])
964 + pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n",
965 + bond->dev->name);
966 }
967 if (bond->dev->flags & IFF_UP) {
968 /* If the interface is up, we may need to fire off
969 @@ -554,19 +558,15 @@ static ssize_t bonding_store_arp_interval(struct device *d,
970 * timer will get fired off when the open function
971 * is called.
972 */
973 - if (!delayed_work_pending(&bond->arp_work)) {
974 - if (bond->params.mode == BOND_MODE_ACTIVEBACKUP)
975 - INIT_DELAYED_WORK(&bond->arp_work,
976 - bond_activebackup_arp_mon);
977 - else
978 - INIT_DELAYED_WORK(&bond->arp_work,
979 - bond_loadbalance_arp_mon);
980 -
981 + if (!new_value) {
982 + cancel_delayed_work_sync(&bond->arp_work);
983 + } else {
984 + cancel_delayed_work_sync(&bond->mii_work);
985 queue_delayed_work(bond->wq, &bond->arp_work, 0);
986 }
987 }
988 -
989 out:
990 + rtnl_unlock();
991 return ret;
992 }
993 static DEVICE_ATTR(arp_interval, S_IRUGO | S_IWUSR,
994 @@ -706,7 +706,7 @@ static ssize_t bonding_store_downdelay(struct device *d,
995 }
996 if (new_value < 0) {
997 pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n",
998 - bond->dev->name, new_value, 1, INT_MAX);
999 + bond->dev->name, new_value, 0, INT_MAX);
1000 ret = -EINVAL;
1001 goto out;
1002 } else {
1003 @@ -761,8 +761,8 @@ static ssize_t bonding_store_updelay(struct device *d,
1004 goto out;
1005 }
1006 if (new_value < 0) {
1007 - pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n",
1008 - bond->dev->name, new_value, 1, INT_MAX);
1009 + pr_err("%s: Invalid up delay value %d not in range %d-%d; rejected.\n",
1010 + bond->dev->name, new_value, 0, INT_MAX);
1011 ret = -EINVAL;
1012 goto out;
1013 } else {
1014 @@ -962,6 +962,8 @@ static ssize_t bonding_store_miimon(struct device *d,
1015 int new_value, ret = count;
1016 struct bonding *bond = to_bond(d);
1017
1018 + if (!rtnl_trylock())
1019 + return restart_syscall();
1020 if (sscanf(buf, "%d", &new_value) != 1) {
1021 pr_err("%s: no miimon value specified.\n",
1022 bond->dev->name);
1023 @@ -970,50 +972,43 @@ static ssize_t bonding_store_miimon(struct device *d,
1024 }
1025 if (new_value < 0) {
1026 pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n",
1027 - bond->dev->name, new_value, 1, INT_MAX);
1028 + bond->dev->name, new_value, 0, INT_MAX);
1029 ret = -EINVAL;
1030 goto out;
1031 - } else {
1032 - pr_info("%s: Setting MII monitoring interval to %d.\n",
1033 - bond->dev->name, new_value);
1034 - bond->params.miimon = new_value;
1035 - if (bond->params.updelay)
1036 - pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n",
1037 - bond->dev->name,
1038 - bond->params.updelay * bond->params.miimon);
1039 - if (bond->params.downdelay)
1040 - pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n",
1041 - bond->dev->name,
1042 - bond->params.downdelay * bond->params.miimon);
1043 - if (bond->params.arp_interval) {
1044 - pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n",
1045 - bond->dev->name);
1046 - bond->params.arp_interval = 0;
1047 - if (bond->params.arp_validate) {
1048 - bond->params.arp_validate =
1049 - BOND_ARP_VALIDATE_NONE;
1050 - }
1051 - if (delayed_work_pending(&bond->arp_work)) {
1052 - cancel_delayed_work(&bond->arp_work);
1053 - flush_workqueue(bond->wq);
1054 - }
1055 - }
1056 -
1057 - if (bond->dev->flags & IFF_UP) {
1058 - /* If the interface is up, we may need to fire off
1059 - * the MII timer. If the interface is down, the
1060 - * timer will get fired off when the open function
1061 - * is called.
1062 - */
1063 - if (!delayed_work_pending(&bond->mii_work)) {
1064 - INIT_DELAYED_WORK(&bond->mii_work,
1065 - bond_mii_monitor);
1066 - queue_delayed_work(bond->wq,
1067 - &bond->mii_work, 0);
1068 - }
1069 + }
1070 + pr_info("%s: Setting MII monitoring interval to %d.\n",
1071 + bond->dev->name, new_value);
1072 + bond->params.miimon = new_value;
1073 + if (bond->params.updelay)
1074 + pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n",
1075 + bond->dev->name,
1076 + bond->params.updelay * bond->params.miimon);
1077 + if (bond->params.downdelay)
1078 + pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n",
1079 + bond->dev->name,
1080 + bond->params.downdelay * bond->params.miimon);
1081 + if (new_value && bond->params.arp_interval) {
1082 + pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n",
1083 + bond->dev->name);
1084 + bond->params.arp_interval = 0;
1085 + if (bond->params.arp_validate)
1086 + bond->params.arp_validate = BOND_ARP_VALIDATE_NONE;
1087 + }
1088 + if (bond->dev->flags & IFF_UP) {
1089 + /* If the interface is up, we may need to fire off
1090 + * the MII timer. If the interface is down, the
1091 + * timer will get fired off when the open function
1092 + * is called.
1093 + */
1094 + if (!new_value) {
1095 + cancel_delayed_work_sync(&bond->mii_work);
1096 + } else {
1097 + cancel_delayed_work_sync(&bond->arp_work);
1098 + queue_delayed_work(bond->wq, &bond->mii_work, 0);
1099 }
1100 }
1101 out:
1102 + rtnl_unlock();
1103 return ret;
1104 }
1105 static DEVICE_ATTR(miimon, S_IRUGO | S_IWUSR,
1106 diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c
1107 index a227586..ee280b2 100644
1108 --- a/drivers/net/can/sja1000/plx_pci.c
1109 +++ b/drivers/net/can/sja1000/plx_pci.c
1110 @@ -329,7 +329,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv)
1111 */
1112 if ((priv->read_reg(priv, REG_CR) & REG_CR_BASICCAN_INITIAL_MASK) ==
1113 REG_CR_BASICCAN_INITIAL &&
1114 - (priv->read_reg(priv, REG_SR) == REG_SR_BASICCAN_INITIAL) &&
1115 + (priv->read_reg(priv, SJA1000_REG_SR) == REG_SR_BASICCAN_INITIAL) &&
1116 (priv->read_reg(priv, REG_IR) == REG_IR_BASICCAN_INITIAL))
1117 flag = 1;
1118
1119 @@ -341,7 +341,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv)
1120 * See states on p. 23 of the Datasheet.
1121 */
1122 if (priv->read_reg(priv, REG_MOD) == REG_MOD_PELICAN_INITIAL &&
1123 - priv->read_reg(priv, REG_SR) == REG_SR_PELICAN_INITIAL &&
1124 + priv->read_reg(priv, SJA1000_REG_SR) == REG_SR_PELICAN_INITIAL &&
1125 priv->read_reg(priv, REG_IR) == REG_IR_PELICAN_INITIAL)
1126 return flag;
1127
1128 diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
1129 index 5e10472..c2309ec 100644
1130 --- a/drivers/net/can/sja1000/sja1000.c
1131 +++ b/drivers/net/can/sja1000/sja1000.c
1132 @@ -91,7 +91,7 @@ static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val)
1133 */
1134 spin_lock_irqsave(&priv->cmdreg_lock, flags);
1135 priv->write_reg(priv, REG_CMR, val);
1136 - priv->read_reg(priv, REG_SR);
1137 + priv->read_reg(priv, SJA1000_REG_SR);
1138 spin_unlock_irqrestore(&priv->cmdreg_lock, flags);
1139 }
1140
1141 @@ -496,7 +496,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
1142
1143 while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) {
1144 n++;
1145 - status = priv->read_reg(priv, REG_SR);
1146 + status = priv->read_reg(priv, SJA1000_REG_SR);
1147 /* check for absent controller due to hw unplug */
1148 if (status == 0xFF && sja1000_is_absent(priv))
1149 return IRQ_NONE;
1150 @@ -515,7 +515,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
1151 /* receive interrupt */
1152 while (status & SR_RBS) {
1153 sja1000_rx(dev);
1154 - status = priv->read_reg(priv, REG_SR);
1155 + status = priv->read_reg(priv, SJA1000_REG_SR);
1156 /* check for absent controller */
1157 if (status == 0xFF && sja1000_is_absent(priv))
1158 return IRQ_NONE;
1159 diff --git a/drivers/net/can/sja1000/sja1000.h b/drivers/net/can/sja1000/sja1000.h
1160 index 23fff06..2a79543 100644
1161 --- a/drivers/net/can/sja1000/sja1000.h
1162 +++ b/drivers/net/can/sja1000/sja1000.h
1163 @@ -56,7 +56,7 @@
1164 /* SJA1000 registers - manual section 6.4 (Pelican Mode) */
1165 #define REG_MOD 0x00
1166 #define REG_CMR 0x01
1167 -#define REG_SR 0x02
1168 +#define SJA1000_REG_SR 0x02
1169 #define REG_IR 0x03
1170 #define REG_IER 0x04
1171 #define REG_ALC 0x0B
1172 diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e.h b/drivers/net/ethernet/atheros/atl1e/atl1e.h
1173 index 829b5ad..edfdf6b 100644
1174 --- a/drivers/net/ethernet/atheros/atl1e/atl1e.h
1175 +++ b/drivers/net/ethernet/atheros/atl1e/atl1e.h
1176 @@ -438,7 +438,6 @@ struct atl1e_adapter {
1177 struct atl1e_hw hw;
1178 struct atl1e_hw_stats hw_stats;
1179
1180 - bool have_msi;
1181 u32 wol;
1182 u16 link_speed;
1183 u16 link_duplex;
1184 diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
1185 index 93ff2b2..f964151 100644
1186 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
1187 +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
1188 @@ -1870,37 +1870,19 @@ static void atl1e_free_irq(struct atl1e_adapter *adapter)
1189 struct net_device *netdev = adapter->netdev;
1190
1191 free_irq(adapter->pdev->irq, netdev);
1192 -
1193 - if (adapter->have_msi)
1194 - pci_disable_msi(adapter->pdev);
1195 }
1196
1197 static int atl1e_request_irq(struct atl1e_adapter *adapter)
1198 {
1199 struct pci_dev *pdev = adapter->pdev;
1200 struct net_device *netdev = adapter->netdev;
1201 - int flags = 0;
1202 int err = 0;
1203
1204 - adapter->have_msi = true;
1205 - err = pci_enable_msi(adapter->pdev);
1206 - if (err) {
1207 - netdev_dbg(adapter->netdev,
1208 - "Unable to allocate MSI interrupt Error: %d\n", err);
1209 - adapter->have_msi = false;
1210 - } else
1211 - netdev->irq = pdev->irq;
1212 -
1213 -
1214 - if (!adapter->have_msi)
1215 - flags |= IRQF_SHARED;
1216 - err = request_irq(adapter->pdev->irq, atl1e_intr, flags,
1217 - netdev->name, netdev);
1218 + err = request_irq(pdev->irq, atl1e_intr, IRQF_SHARED,
1219 + netdev->name, netdev);
1220 if (err) {
1221 netdev_dbg(adapter->netdev,
1222 "Unable to allocate interrupt Error: %d\n", err);
1223 - if (adapter->have_msi)
1224 - pci_disable_msi(adapter->pdev);
1225 return err;
1226 }
1227 netdev_dbg(adapter->netdev, "atl1e_request_irq OK\n");
1228 diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
1229 index 15ed91f..3551ad8 100644
1230 --- a/drivers/net/ethernet/broadcom/tg3.c
1231 +++ b/drivers/net/ethernet/broadcom/tg3.c
1232 @@ -13590,8 +13590,11 @@ static void __devinit tg3_read_vpd(struct tg3 *tp)
1233 if (j + len > block_end)
1234 goto partno;
1235
1236 - memcpy(tp->fw_ver, &vpd_data[j], len);
1237 - strncat(tp->fw_ver, " bc ", vpdlen - len - 1);
1238 + if (len >= sizeof(tp->fw_ver))
1239 + len = sizeof(tp->fw_ver) - 1;
1240 + memset(tp->fw_ver, 0, sizeof(tp->fw_ver));
1241 + snprintf(tp->fw_ver, sizeof(tp->fw_ver), "%.*s bc ", len,
1242 + &vpd_data[j]);
1243 }
1244
1245 partno:
1246 diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
1247 index 36499d5..a9628b6 100644
1248 --- a/drivers/net/ethernet/davicom/dm9000.c
1249 +++ b/drivers/net/ethernet/davicom/dm9000.c
1250 @@ -257,6 +257,107 @@ static void dm9000_dumpblk_32bit(void __iomem *reg, int count)
1251 tmp = readl(reg);
1252 }
1253
1254 +/*
1255 + * Sleep, either by using msleep() or if we are suspending, then
1256 + * use mdelay() to sleep.
1257 + */
1258 +static void dm9000_msleep(board_info_t *db, unsigned int ms)
1259 +{
1260 + if (db->in_suspend)
1261 + mdelay(ms);
1262 + else
1263 + msleep(ms);
1264 +}
1265 +
1266 +/* Read a word from phyxcer */
1267 +static int
1268 +dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg)
1269 +{
1270 + board_info_t *db = netdev_priv(dev);
1271 + unsigned long flags;
1272 + unsigned int reg_save;
1273 + int ret;
1274 +
1275 + mutex_lock(&db->addr_lock);
1276 +
1277 + spin_lock_irqsave(&db->lock, flags);
1278 +
1279 + /* Save previous register address */
1280 + reg_save = readb(db->io_addr);
1281 +
1282 + /* Fill the phyxcer register into REG_0C */
1283 + iow(db, DM9000_EPAR, DM9000_PHY | reg);
1284 +
1285 + /* Issue phyxcer read command */
1286 + iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS);
1287 +
1288 + writeb(reg_save, db->io_addr);
1289 + spin_unlock_irqrestore(&db->lock, flags);
1290 +
1291 + dm9000_msleep(db, 1); /* Wait read complete */
1292 +
1293 + spin_lock_irqsave(&db->lock, flags);
1294 + reg_save = readb(db->io_addr);
1295 +
1296 + iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */
1297 +
1298 + /* The read data keeps on REG_0D & REG_0E */
1299 + ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL);
1300 +
1301 + /* restore the previous address */
1302 + writeb(reg_save, db->io_addr);
1303 + spin_unlock_irqrestore(&db->lock, flags);
1304 +
1305 + mutex_unlock(&db->addr_lock);
1306 +
1307 + dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret);
1308 + return ret;
1309 +}
1310 +
1311 +/* Write a word to phyxcer */
1312 +static void
1313 +dm9000_phy_write(struct net_device *dev,
1314 + int phyaddr_unused, int reg, int value)
1315 +{
1316 + board_info_t *db = netdev_priv(dev);
1317 + unsigned long flags;
1318 + unsigned long reg_save;
1319 +
1320 + dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value);
1321 + mutex_lock(&db->addr_lock);
1322 +
1323 + spin_lock_irqsave(&db->lock, flags);
1324 +
1325 + /* Save previous register address */
1326 + reg_save = readb(db->io_addr);
1327 +
1328 + /* Fill the phyxcer register into REG_0C */
1329 + iow(db, DM9000_EPAR, DM9000_PHY | reg);
1330 +
1331 + /* Fill the written data into REG_0D & REG_0E */
1332 + iow(db, DM9000_EPDRL, value);
1333 + iow(db, DM9000_EPDRH, value >> 8);
1334 +
1335 + /* Issue phyxcer write command */
1336 + iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW);
1337 +
1338 + writeb(reg_save, db->io_addr);
1339 + spin_unlock_irqrestore(&db->lock, flags);
1340 +
1341 + dm9000_msleep(db, 1); /* Wait write complete */
1342 +
1343 + spin_lock_irqsave(&db->lock, flags);
1344 + reg_save = readb(db->io_addr);
1345 +
1346 + iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */
1347 +
1348 + /* restore the previous address */
1349 + writeb(reg_save, db->io_addr);
1350 +
1351 + spin_unlock_irqrestore(&db->lock, flags);
1352 + mutex_unlock(&db->addr_lock);
1353 +}
1354 +
1355 /* dm9000_set_io
1356 *
1357 * select the specified set of io routines to use with the
1358 @@ -794,6 +895,9 @@ dm9000_init_dm9000(struct net_device *dev)
1359
1360 iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */
1361
1362 + dm9000_phy_write(dev, 0, MII_BMCR, BMCR_RESET); /* PHY RESET */
1363 + dm9000_phy_write(dev, 0, MII_DM_DSPCR, DSPCR_INIT_PARAM); /* Init */
1364 +
1365 ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0;
1366
1367 /* if wol is needed, then always set NCR_WAKEEN otherwise we end
1368 @@ -1200,109 +1304,6 @@ dm9000_open(struct net_device *dev)
1369 return 0;
1370 }
1371
1372 -/*
1373 - * Sleep, either by using msleep() or if we are suspending, then
1374 - * use mdelay() to sleep.
1375 - */
1376 -static void dm9000_msleep(board_info_t *db, unsigned int ms)
1377 -{
1378 - if (db->in_suspend)
1379 - mdelay(ms);
1380 - else
1381 - msleep(ms);
1382 -}
1383 -
1384 -/*
1385 - * Read a word from phyxcer
1386 - */
1387 -static int
1388 -dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg)
1389 -{
1390 - board_info_t *db = netdev_priv(dev);
1391 - unsigned long flags;
1392 - unsigned int reg_save;
1393 - int ret;
1394 -
1395 - mutex_lock(&db->addr_lock);
1396 -
1397 - spin_lock_irqsave(&db->lock,flags);
1398 -
1399 - /* Save previous register address */
1400 - reg_save = readb(db->io_addr);
1401 -
1402 - /* Fill the phyxcer register into REG_0C */
1403 - iow(db, DM9000_EPAR, DM9000_PHY | reg);
1404 -
1405 - iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS); /* Issue phyxcer read command */
1406 -
1407 - writeb(reg_save, db->io_addr);
1408 - spin_unlock_irqrestore(&db->lock,flags);
1409 -
1410 - dm9000_msleep(db, 1); /* Wait read complete */
1411 -
1412 - spin_lock_irqsave(&db->lock,flags);
1413 - reg_save = readb(db->io_addr);
1414 -
1415 - iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */
1416 -
1417 - /* The read data keeps on REG_0D & REG_0E */
1418 - ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL);
1419 -
1420 - /* restore the previous address */
1421 - writeb(reg_save, db->io_addr);
1422 - spin_unlock_irqrestore(&db->lock,flags);
1423 -
1424 - mutex_unlock(&db->addr_lock);
1425 -
1426 - dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret);
1427 - return ret;
1428 -}
1429 -
1430 -/*
1431 - * Write a word to phyxcer
1432 - */
1433 -static void
1434 -dm9000_phy_write(struct net_device *dev,
1435 - int phyaddr_unused, int reg, int value)
1436 -{
1437 - board_info_t *db = netdev_priv(dev);
1438 - unsigned long flags;
1439 - unsigned long reg_save;
1440 -
1441 - dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value);
1442 - mutex_lock(&db->addr_lock);
1443 -
1444 - spin_lock_irqsave(&db->lock,flags);
1445 -
1446 - /* Save previous register address */
1447 - reg_save = readb(db->io_addr);
1448 -
1449 - /* Fill the phyxcer register into REG_0C */
1450 - iow(db, DM9000_EPAR, DM9000_PHY | reg);
1451 -
1452 - /* Fill the written data into REG_0D & REG_0E */
1453 - iow(db, DM9000_EPDRL, value);
1454 - iow(db, DM9000_EPDRH, value >> 8);
1455 -
1456 - iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW); /* Issue phyxcer write command */
1457 -
1458 - writeb(reg_save, db->io_addr);
1459 - spin_unlock_irqrestore(&db->lock, flags);
1460 -
1461 - dm9000_msleep(db, 1); /* Wait write complete */
1462 -
1463 - spin_lock_irqsave(&db->lock,flags);
1464 - reg_save = readb(db->io_addr);
1465 -
1466 - iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */
1467 -
1468 - /* restore the previous address */
1469 - writeb(reg_save, db->io_addr);
1470 -
1471 - spin_unlock_irqrestore(&db->lock, flags);
1472 - mutex_unlock(&db->addr_lock);
1473 -}
1474 -
1475 static void
1476 dm9000_shutdown(struct net_device *dev)
1477 {
1478 @@ -1501,7 +1502,12 @@ dm9000_probe(struct platform_device *pdev)
1479 db->flags |= DM9000_PLATF_SIMPLE_PHY;
1480 #endif
1481
1482 - dm9000_reset(db);
1483 + /* Fixing bug on dm9000_probe, takeover dm9000_reset(db),
1484 + * Need 'NCR_MAC_LBK' bit to indeed stable our DM9000 fifo
1485 + * while probe stage.
1486 + */
1487 +
1488 + iow(db, DM9000_NCR, NCR_MAC_LBK | NCR_RST);
1489
1490 /* try multiple times, DM9000 sometimes gets the read wrong */
1491 for (i = 0; i < 8; i++) {
1492 diff --git a/drivers/net/ethernet/davicom/dm9000.h b/drivers/net/ethernet/davicom/dm9000.h
1493 index 55688bd..9ce058a 100644
1494 --- a/drivers/net/ethernet/davicom/dm9000.h
1495 +++ b/drivers/net/ethernet/davicom/dm9000.h
1496 @@ -69,7 +69,9 @@
1497 #define NCR_WAKEEN (1<<6)
1498 #define NCR_FCOL (1<<4)
1499 #define NCR_FDX (1<<3)
1500 -#define NCR_LBK (3<<1)
1501 +
1502 +#define NCR_RESERVED (3<<1)
1503 +#define NCR_MAC_LBK (1<<1)
1504 #define NCR_RST (1<<0)
1505
1506 #define NSR_SPEED (1<<7)
1507 @@ -167,5 +169,12 @@
1508 #define ISR_LNKCHNG (1<<5)
1509 #define ISR_UNDERRUN (1<<4)
1510
1511 +/* Davicom MII registers.
1512 + */
1513 +
1514 +#define MII_DM_DSPCR 0x1b /* DSP Control Register */
1515 +
1516 +#define DSPCR_INIT_PARAM 0xE100 /* DSP init parameter */
1517 +
1518 #endif /* _DM9000X_H_ */
1519
1520 diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
1521 index 2b78ddd..0dc9a35 100644
1522 --- a/drivers/net/ethernet/marvell/sky2.c
1523 +++ b/drivers/net/ethernet/marvell/sky2.c
1524 @@ -1066,7 +1066,7 @@ static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 space)
1525 sky2_write32(hw, RB_ADDR(q, RB_RX_UTHP), tp);
1526 sky2_write32(hw, RB_ADDR(q, RB_RX_LTHP), space/2);
1527
1528 - tp = space - 2048/8;
1529 + tp = space - 8192/8;
1530 sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp);
1531 sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4);
1532 } else {
1533 diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h
1534 index 3c896ce..a0f229e 100644
1535 --- a/drivers/net/ethernet/marvell/sky2.h
1536 +++ b/drivers/net/ethernet/marvell/sky2.h
1537 @@ -2069,7 +2069,7 @@ enum {
1538 GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */
1539 GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */
1540
1541 -#define GMAC_DEF_MSK GM_IS_TX_FF_UR
1542 +#define GMAC_DEF_MSK (GM_IS_TX_FF_UR | GM_IS_RX_FF_OR)
1543 };
1544
1545 /* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */
1546 diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
1547 index 5e313e9..2a417c3 100644
1548 --- a/drivers/net/ethernet/micrel/ks8851.c
1549 +++ b/drivers/net/ethernet/micrel/ks8851.c
1550 @@ -547,7 +547,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
1551 for (; rxfc != 0; rxfc--) {
1552 rxh = ks8851_rdreg32(ks, KS_RXFHSR);
1553 rxstat = rxh & 0xffff;
1554 - rxlen = rxh >> 16;
1555 + rxlen = (rxh >> 16) & 0xfff;
1556
1557 netif_dbg(ks, rx_status, ks->netdev,
1558 "rx: stat 0x%04x, len 0x%04x\n", rxstat, rxlen);
1559 diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
1560 index 1e38d50..8b1c2eb 100644
1561 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
1562 +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
1563 @@ -1740,9 +1740,9 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter,
1564
1565 skb->protocol = eth_type_trans(skb, netdev);
1566 if (tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK)
1567 - skb->ip_summed = CHECKSUM_NONE;
1568 - else
1569 skb->ip_summed = CHECKSUM_UNNECESSARY;
1570 + else
1571 + skb->ip_summed = CHECKSUM_NONE;
1572
1573 napi_gro_receive(&adapter->napi, skb);
1574 (*work_done)++;
1575 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
1576 index 6685bbb..310e353 100644
1577 --- a/drivers/net/ethernet/ti/cpsw.c
1578 +++ b/drivers/net/ethernet/ti/cpsw.c
1579 @@ -249,7 +249,7 @@ void cpsw_tx_handler(void *token, int len, int status)
1580 struct cpsw_priv *priv = netdev_priv(ndev);
1581
1582 if (unlikely(netif_queue_stopped(ndev)))
1583 - netif_start_queue(ndev);
1584 + netif_wake_queue(ndev);
1585 priv->stats.tx_packets++;
1586 priv->stats.tx_bytes += len;
1587 dev_kfree_skb_any(skb);
1588 diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
1589 index 08aff1a..43fada5 100644
1590 --- a/drivers/net/ethernet/ti/davinci_emac.c
1591 +++ b/drivers/net/ethernet/ti/davinci_emac.c
1592 @@ -1052,7 +1052,7 @@ static void emac_tx_handler(void *token, int len, int status)
1593 atomic_dec(&priv->cur_tx);
1594
1595 if (unlikely(netif_queue_stopped(ndev)))
1596 - netif_start_queue(ndev);
1597 + netif_wake_queue(ndev);
1598 ndev->stats.tx_packets++;
1599 ndev->stats.tx_bytes += len;
1600 dev_kfree_skb_any(skb);
1601 diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
1602 index 00103a8..5caba55 100644
1603 --- a/drivers/net/usb/smsc75xx.c
1604 +++ b/drivers/net/usb/smsc75xx.c
1605 @@ -725,8 +725,12 @@ static int smsc75xx_set_rx_max_frame_length(struct usbnet *dev, int size)
1606 static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu)
1607 {
1608 struct usbnet *dev = netdev_priv(netdev);
1609 + int ret;
1610 +
1611 + if (new_mtu > MAX_SINGLE_PACKET_SIZE)
1612 + return -EINVAL;
1613
1614 - int ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu);
1615 + ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu + ETH_HLEN);
1616 check_warn_return(ret, "Failed to set mac rx frame length");
1617
1618 return usbnet_change_mtu(netdev, new_mtu);
1619 @@ -979,7 +983,7 @@ static int smsc75xx_reset(struct usbnet *dev)
1620
1621 netif_dbg(dev, ifup, dev->net, "FCT_TX_CTL set to 0x%08x", buf);
1622
1623 - ret = smsc75xx_set_rx_max_frame_length(dev, 1514);
1624 + ret = smsc75xx_set_rx_max_frame_length(dev, dev->net->mtu + ETH_HLEN);
1625 check_warn_return(ret, "Failed to set max rx frame length");
1626
1627 ret = smsc75xx_read_reg(dev, MAC_RX, &buf);
1628 @@ -1123,8 +1127,8 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
1629 else if (rx_cmd_a & (RX_CMD_A_LONG | RX_CMD_A_RUNT))
1630 dev->net->stats.rx_frame_errors++;
1631 } else {
1632 - /* ETH_FRAME_LEN + 4(CRC) + 2(COE) + 4(Vlan) */
1633 - if (unlikely(size > (ETH_FRAME_LEN + 12))) {
1634 + /* MAX_SINGLE_PACKET_SIZE + 4(CRC) + 2(COE) + 4(Vlan) */
1635 + if (unlikely(size > (MAX_SINGLE_PACKET_SIZE + ETH_HLEN + 12))) {
1636 netif_dbg(dev, rx_err, dev->net,
1637 "size err rx_cmd_a=0x%08x", rx_cmd_a);
1638 return 0;
1639 diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
1640 index 9284bca..7c86415 100644
1641 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
1642 +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
1643 @@ -938,6 +938,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
1644 AR_PHY_CL_TAB_1,
1645 AR_PHY_CL_TAB_2 };
1646
1647 + /* Use chip chainmask only for calibration */
1648 ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask);
1649
1650 if (rtt) {
1651 @@ -1085,6 +1086,9 @@ skip_tx_iqcal:
1652 ar9003_hw_rtt_disable(ah);
1653 }
1654
1655 + /* Revert chainmask to runtime parameters */
1656 + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
1657 +
1658 /* Initialize list pointers */
1659 ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
1660 ah->supp_cals = IQ_MISMATCH_CAL;
1661 diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
1662 index 65f831f..bb2848a 100644
1663 --- a/drivers/net/wireless/b43/dma.c
1664 +++ b/drivers/net/wireless/b43/dma.c
1665 @@ -1487,8 +1487,12 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1666 const struct b43_dma_ops *ops;
1667 struct b43_dmaring *ring;
1668 struct b43_dmadesc_meta *meta;
1669 + static const struct b43_txstatus fake; /* filled with 0 */
1670 + const struct b43_txstatus *txstat;
1671 int slot, firstused;
1672 bool frame_succeed;
1673 + int skip;
1674 + static u8 err_out1, err_out2;
1675
1676 ring = parse_cookie(dev, status->cookie, &slot);
1677 if (unlikely(!ring))
1678 @@ -1501,13 +1505,36 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1679 firstused = ring->current_slot - ring->used_slots + 1;
1680 if (firstused < 0)
1681 firstused = ring->nr_slots + firstused;
1682 +
1683 + skip = 0;
1684 if (unlikely(slot != firstused)) {
1685 /* This possibly is a firmware bug and will result in
1686 - * malfunction, memory leaks and/or stall of DMA functionality. */
1687 - b43dbg(dev->wl, "Out of order TX status report on DMA ring %d. "
1688 - "Expected %d, but got %d\n",
1689 - ring->index, firstused, slot);
1690 - return;
1691 + * malfunction, memory leaks and/or stall of DMA functionality.
1692 + */
1693 + if (slot == next_slot(ring, next_slot(ring, firstused))) {
1694 + /* If a single header/data pair was missed, skip over
1695 + * the first two slots in an attempt to recover.
1696 + */
1697 + slot = firstused;
1698 + skip = 2;
1699 + if (!err_out1) {
1700 + /* Report the error once. */
1701 + b43dbg(dev->wl,
1702 + "Skip on DMA ring %d slot %d.\n",
1703 + ring->index, slot);
1704 + err_out1 = 1;
1705 + }
1706 + } else {
1707 + /* More than a single header/data pair were missed.
1708 + * Report this error once.
1709 + */
1710 + if (!err_out2)
1711 + b43dbg(dev->wl,
1712 + "Out of order TX status report on DMA ring %d. Expected %d, but got %d\n",
1713 + ring->index, firstused, slot);
1714 + err_out2 = 1;
1715 + return;
1716 + }
1717 }
1718
1719 ops = ring->ops;
1720 @@ -1522,11 +1549,13 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1721 slot, firstused, ring->index);
1722 break;
1723 }
1724 +
1725 if (meta->skb) {
1726 struct b43_private_tx_info *priv_info =
1727 - b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb));
1728 + b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb));
1729
1730 - unmap_descbuffer(ring, meta->dmaaddr, meta->skb->len, 1);
1731 + unmap_descbuffer(ring, meta->dmaaddr,
1732 + meta->skb->len, 1);
1733 kfree(priv_info->bouncebuffer);
1734 priv_info->bouncebuffer = NULL;
1735 } else {
1736 @@ -1538,8 +1567,9 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1737 struct ieee80211_tx_info *info;
1738
1739 if (unlikely(!meta->skb)) {
1740 - /* This is a scatter-gather fragment of a frame, so
1741 - * the skb pointer must not be NULL. */
1742 + /* This is a scatter-gather fragment of a frame,
1743 + * so the skb pointer must not be NULL.
1744 + */
1745 b43dbg(dev->wl, "TX status unexpected NULL skb "
1746 "at slot %d (first=%d) on ring %d\n",
1747 slot, firstused, ring->index);
1748 @@ -1550,9 +1580,18 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1749
1750 /*
1751 * Call back to inform the ieee80211 subsystem about
1752 - * the status of the transmission.
1753 + * the status of the transmission. When skipping over
1754 + * a missed TX status report, use a status structure
1755 + * filled with zeros to indicate that the frame was not
1756 + * sent (frame_count 0) and not acknowledged
1757 */
1758 - frame_succeed = b43_fill_txstatus_report(dev, info, status);
1759 + if (unlikely(skip))
1760 + txstat = &fake;
1761 + else
1762 + txstat = status;
1763 +
1764 + frame_succeed = b43_fill_txstatus_report(dev, info,
1765 + txstat);
1766 #ifdef CONFIG_B43_DEBUG
1767 if (frame_succeed)
1768 ring->nr_succeed_tx_packets++;
1769 @@ -1580,12 +1619,14 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1770 /* Everything unmapped and free'd. So it's not used anymore. */
1771 ring->used_slots--;
1772
1773 - if (meta->is_last_fragment) {
1774 + if (meta->is_last_fragment && !skip) {
1775 /* This is the last scatter-gather
1776 * fragment of the frame. We are done. */
1777 break;
1778 }
1779 slot = next_slot(ring, slot);
1780 + if (skip > 0)
1781 + --skip;
1782 }
1783 if (ring->stopped) {
1784 B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME);
1785 diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
1786 index 1081188..6be2f73 100644
1787 --- a/drivers/net/wireless/b43/phy_n.c
1788 +++ b/drivers/net/wireless/b43/phy_n.c
1789 @@ -1320,7 +1320,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
1790 u16 clip_off[2] = { 0xFFFF, 0xFFFF };
1791
1792 u8 vcm_final = 0;
1793 - s8 offset[4];
1794 + s32 offset[4];
1795 s32 results[8][4] = { };
1796 s32 results_min[4] = { };
1797 s32 poll_results[4] = { };
1798 @@ -1371,7 +1371,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
1799 }
1800 for (i = 0; i < 4; i++) {
1801 s32 curr;
1802 - s32 mind = 40;
1803 + s32 mind = 0x100000;
1804 s32 minpoll = 249;
1805 u8 minvcm = 0;
1806 if (2 * core != i)
1807 @@ -1487,7 +1487,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
1808 u8 regs_save_radio[2];
1809 u16 regs_save_phy[2];
1810
1811 - s8 offset[4];
1812 + s32 offset[4];
1813 u8 core;
1814 u8 rail;
1815
1816 @@ -1554,7 +1554,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
1817 }
1818
1819 for (i = 0; i < 4; i++) {
1820 - s32 mind = 40;
1821 + s32 mind = 0x100000;
1822 u8 minvcm = 0;
1823 s32 minpoll = 249;
1824 s32 curr;
1825 diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
1826 index 54bb483..f9d9aed 100644
1827 --- a/drivers/net/wireless/mwifiex/init.c
1828 +++ b/drivers/net/wireless/mwifiex/init.c
1829 @@ -584,6 +584,14 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
1830 return ret;
1831 }
1832
1833 + /* cancel current command */
1834 + if (adapter->curr_cmd) {
1835 + dev_warn(adapter->dev, "curr_cmd is still in processing\n");
1836 + del_timer(&adapter->cmd_timer);
1837 + mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd);
1838 + adapter->curr_cmd = NULL;
1839 + }
1840 +
1841 /* shut down mwifiex */
1842 dev_dbg(adapter->dev, "info: shutdown mwifiex...\n");
1843
1844 diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
1845 index 6ce8484..2b6faa0 100644
1846 --- a/drivers/net/wireless/rtlwifi/usb.c
1847 +++ b/drivers/net/wireless/rtlwifi/usb.c
1848 @@ -853,6 +853,7 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb,
1849 if (unlikely(!_urb)) {
1850 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1851 "Can't allocate urb. Drop skb!\n");
1852 + kfree_skb(skb);
1853 return;
1854 }
1855 urb_list = &rtlusb->tx_pending[ep_num];
1856 diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
1857 index c72128f..42cad5c 100644
1858 --- a/drivers/staging/comedi/drivers/s626.c
1859 +++ b/drivers/staging/comedi/drivers/s626.c
1860 @@ -1882,7 +1882,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
1861 case TRIG_NONE:
1862 /* continous acquisition */
1863 devpriv->ai_continous = 1;
1864 - devpriv->ai_sample_count = 0;
1865 + devpriv->ai_sample_count = 1;
1866 break;
1867 }
1868
1869 diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
1870 index 3d7e1ee..ed7cd37 100644
1871 --- a/drivers/tty/serial/atmel_serial.c
1872 +++ b/drivers/tty/serial/atmel_serial.c
1873 @@ -159,7 +159,7 @@ struct atmel_uart_port {
1874 };
1875
1876 static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART];
1877 -static unsigned long atmel_ports_in_use;
1878 +static DECLARE_BITMAP(atmel_ports_in_use, ATMEL_MAX_UART);
1879
1880 #ifdef SUPPORT_SYSRQ
1881 static struct console atmel_console;
1882 @@ -1785,15 +1785,14 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)
1883 if (ret < 0)
1884 /* port id not found in platform data nor device-tree aliases:
1885 * auto-enumerate it */
1886 - ret = find_first_zero_bit(&atmel_ports_in_use,
1887 - sizeof(atmel_ports_in_use));
1888 + ret = find_first_zero_bit(atmel_ports_in_use, ATMEL_MAX_UART);
1889
1890 - if (ret > ATMEL_MAX_UART) {
1891 + if (ret >= ATMEL_MAX_UART) {
1892 ret = -ENODEV;
1893 goto err;
1894 }
1895
1896 - if (test_and_set_bit(ret, &atmel_ports_in_use)) {
1897 + if (test_and_set_bit(ret, atmel_ports_in_use)) {
1898 /* port already in use */
1899 ret = -EBUSY;
1900 goto err;
1901 @@ -1867,7 +1866,7 @@ static int __devexit atmel_serial_remove(struct platform_device *pdev)
1902
1903 /* "port" is allocated statically, so we shouldn't free it */
1904
1905 - clear_bit(port->line, &atmel_ports_in_use);
1906 + clear_bit(port->line, atmel_ports_in_use);
1907
1908 clk_put(atmel_port->clk);
1909
1910 diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
1911 index fa7268a..6abb92c 100644
1912 --- a/drivers/tty/vt/vc_screen.c
1913 +++ b/drivers/tty/vt/vc_screen.c
1914 @@ -93,7 +93,7 @@ vcs_poll_data_free(struct vcs_poll_data *poll)
1915 static struct vcs_poll_data *
1916 vcs_poll_data_get(struct file *file)
1917 {
1918 - struct vcs_poll_data *poll = file->private_data;
1919 + struct vcs_poll_data *poll = file->private_data, *kill = NULL;
1920
1921 if (poll)
1922 return poll;
1923 @@ -122,10 +122,12 @@ vcs_poll_data_get(struct file *file)
1924 file->private_data = poll;
1925 } else {
1926 /* someone else raced ahead of us */
1927 - vcs_poll_data_free(poll);
1928 + kill = poll;
1929 poll = file->private_data;
1930 }
1931 spin_unlock(&file->f_lock);
1932 + if (kill)
1933 + vcs_poll_data_free(kill);
1934
1935 return poll;
1936 }
1937 diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
1938 index e5e44f8..b0af333 100644
1939 --- a/drivers/usb/gadget/udc-core.c
1940 +++ b/drivers/usb/gadget/udc-core.c
1941 @@ -265,7 +265,7 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
1942 udc->driver->disconnect(udc->gadget);
1943 usb_gadget_disconnect(udc->gadget);
1944 udc->driver->unbind(udc->gadget);
1945 - usb_gadget_udc_stop(udc->gadget, udc->driver);
1946 + usb_gadget_udc_stop(udc->gadget, NULL);
1947 } else {
1948 usb_gadget_stop(udc->gadget, udc->driver);
1949 }
1950 diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1951 index 87ee86d..a3c9374 100644
1952 --- a/drivers/usb/host/xhci-ring.c
1953 +++ b/drivers/usb/host/xhci-ring.c
1954 @@ -2027,8 +2027,8 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
1955 if (event_trb != ep_ring->dequeue &&
1956 event_trb != td->last_trb)
1957 td->urb->actual_length =
1958 - td->urb->transfer_buffer_length
1959 - - TRB_LEN(le32_to_cpu(event->transfer_len));
1960 + td->urb->transfer_buffer_length -
1961 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
1962 else
1963 td->urb->actual_length = 0;
1964
1965 @@ -2060,7 +2060,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
1966 /* Maybe the event was for the data stage? */
1967 td->urb->actual_length =
1968 td->urb->transfer_buffer_length -
1969 - TRB_LEN(le32_to_cpu(event->transfer_len));
1970 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
1971 xhci_dbg(xhci, "Waiting for status "
1972 "stage event\n");
1973 return 0;
1974 @@ -2096,7 +2096,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1975 /* handle completion code */
1976 switch (trb_comp_code) {
1977 case COMP_SUCCESS:
1978 - if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) {
1979 + if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) {
1980 frame->status = 0;
1981 break;
1982 }
1983 @@ -2141,7 +2141,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1984 len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2]));
1985 }
1986 len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) -
1987 - TRB_LEN(le32_to_cpu(event->transfer_len));
1988 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
1989
1990 if (trb_comp_code != COMP_STOP_INVAL) {
1991 frame->actual_length = len;
1992 @@ -2199,7 +2199,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
1993 case COMP_SUCCESS:
1994 /* Double check that the HW transferred everything. */
1995 if (event_trb != td->last_trb ||
1996 - TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
1997 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
1998 xhci_warn(xhci, "WARN Successful completion "
1999 "on short TX\n");
2000 if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
2001 @@ -2227,18 +2227,18 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
2002 "%d bytes untransferred\n",
2003 td->urb->ep->desc.bEndpointAddress,
2004 td->urb->transfer_buffer_length,
2005 - TRB_LEN(le32_to_cpu(event->transfer_len)));
2006 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)));
2007 /* Fast path - was this the last TRB in the TD for this URB? */
2008 if (event_trb == td->last_trb) {
2009 - if (TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
2010 + if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
2011 td->urb->actual_length =
2012 td->urb->transfer_buffer_length -
2013 - TRB_LEN(le32_to_cpu(event->transfer_len));
2014 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
2015 if (td->urb->transfer_buffer_length <
2016 td->urb->actual_length) {
2017 xhci_warn(xhci, "HC gave bad length "
2018 "of %d bytes left\n",
2019 - TRB_LEN(le32_to_cpu(event->transfer_len)));
2020 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)));
2021 td->urb->actual_length = 0;
2022 if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
2023 *status = -EREMOTEIO;
2024 @@ -2280,7 +2280,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
2025 if (trb_comp_code != COMP_STOP_INVAL)
2026 td->urb->actual_length +=
2027 TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) -
2028 - TRB_LEN(le32_to_cpu(event->transfer_len));
2029 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
2030 }
2031
2032 return finish_td(xhci, td, event_trb, event, ep, status, false);
2033 @@ -2366,7 +2366,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
2034 * transfer type
2035 */
2036 case COMP_SUCCESS:
2037 - if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
2038 + if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
2039 break;
2040 if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
2041 trb_comp_code = COMP_SHORT_TX;
2042 diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
2043 index 81d839f..15aaf58 100644
2044 --- a/drivers/usb/host/xhci.h
2045 +++ b/drivers/usb/host/xhci.h
2046 @@ -968,6 +968,10 @@ struct xhci_transfer_event {
2047 __le32 flags;
2048 };
2049
2050 +/* Transfer event TRB length bit mask */
2051 +/* bits 0:23 */
2052 +#define EVENT_TRB_LEN(p) ((p) & 0xffffff)
2053 +
2054 /** Transfer Event bit fields **/
2055 #define TRB_TO_EP_ID(p) (((p) >> 16) & 0x1f)
2056
2057 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
2058 index 87ef150..07a4fb0 100644
2059 --- a/drivers/usb/serial/ftdi_sio.c
2060 +++ b/drivers/usb/serial/ftdi_sio.c
2061 @@ -648,6 +648,7 @@ static struct usb_device_id id_table_combined [] = {
2062 { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) },
2063 { USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) },
2064 { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) },
2065 + { USB_DEVICE(MITSUBISHI_VID, MITSUBISHI_FXUSB_PID) },
2066 { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) },
2067 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) },
2068 { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) },
2069 diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
2070 index 9d359e1..e79861e 100644
2071 --- a/drivers/usb/serial/ftdi_sio_ids.h
2072 +++ b/drivers/usb/serial/ftdi_sio_ids.h
2073 @@ -584,6 +584,13 @@
2074 #define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */
2075
2076 /*
2077 + * Mitsubishi Electric Corp. (http://www.meau.com)
2078 + * Submitted by Konstantin Holoborodko
2079 + */
2080 +#define MITSUBISHI_VID 0x06D3
2081 +#define MITSUBISHI_FXUSB_PID 0x0284 /* USB/RS422 converters: FX-USB-AW/-BD */
2082 +
2083 +/*
2084 * Definitions for B&B Electronics products.
2085 */
2086 #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */
2087 diff --git a/fs/block_dev.c b/fs/block_dev.c
2088 index a6e1e06..2f3879c 100644
2089 --- a/fs/block_dev.c
2090 +++ b/fs/block_dev.c
2091 @@ -604,6 +604,7 @@ struct block_device *bdgrab(struct block_device *bdev)
2092 ihold(bdev->bd_inode);
2093 return bdev;
2094 }
2095 +EXPORT_SYMBOL(bdgrab);
2096
2097 long nr_blockdev_pages(void)
2098 {
2099 diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
2100 index 49fd7b6..fef1f21 100644
2101 --- a/fs/btrfs/extent-tree.c
2102 +++ b/fs/btrfs/extent-tree.c
2103 @@ -4217,7 +4217,7 @@ static void update_global_block_rsv(struct btrfs_fs_info *fs_info)
2104 spin_lock(&sinfo->lock);
2105 spin_lock(&block_rsv->lock);
2106
2107 - block_rsv->size = num_bytes;
2108 + block_rsv->size = min_t(u64, num_bytes, 512 * 1024 * 1024);
2109
2110 num_bytes = sinfo->bytes_used + sinfo->bytes_pinned +
2111 sinfo->bytes_reserved + sinfo->bytes_readonly +
2112 @@ -4486,14 +4486,49 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
2113 * If the inodes csum_bytes is the same as the original
2114 * csum_bytes then we know we haven't raced with any free()ers
2115 * so we can just reduce our inodes csum bytes and carry on.
2116 - * Otherwise we have to do the normal free thing to account for
2117 - * the case that the free side didn't free up its reserve
2118 - * because of this outstanding reservation.
2119 */
2120 - if (BTRFS_I(inode)->csum_bytes == csum_bytes)
2121 + if (BTRFS_I(inode)->csum_bytes == csum_bytes) {
2122 calc_csum_metadata_size(inode, num_bytes, 0);
2123 - else
2124 - to_free = calc_csum_metadata_size(inode, num_bytes, 0);
2125 + } else {
2126 + u64 orig_csum_bytes = BTRFS_I(inode)->csum_bytes;
2127 + u64 bytes;
2128 +
2129 + /*
2130 + * This is tricky, but first we need to figure out how much we
2131 + * free'd from any free-ers that occured during this
2132 + * reservation, so we reset ->csum_bytes to the csum_bytes
2133 + * before we dropped our lock, and then call the free for the
2134 + * number of bytes that were freed while we were trying our
2135 + * reservation.
2136 + */
2137 + bytes = csum_bytes - BTRFS_I(inode)->csum_bytes;
2138 + BTRFS_I(inode)->csum_bytes = csum_bytes;
2139 + to_free = calc_csum_metadata_size(inode, bytes, 0);
2140 +
2141 +
2142 + /*
2143 + * Now we need to see how much we would have freed had we not
2144 + * been making this reservation and our ->csum_bytes were not
2145 + * artificially inflated.
2146 + */
2147 + BTRFS_I(inode)->csum_bytes = csum_bytes - num_bytes;
2148 + bytes = csum_bytes - orig_csum_bytes;
2149 + bytes = calc_csum_metadata_size(inode, bytes, 0);
2150 +
2151 + /*
2152 + * Now reset ->csum_bytes to what it should be. If bytes is
2153 + * more than to_free then we would have free'd more space had we
2154 + * not had an artificially high ->csum_bytes, so we need to free
2155 + * the remainder. If bytes is the same or less then we don't
2156 + * need to do anything, the other free-ers did the correct
2157 + * thing.
2158 + */
2159 + BTRFS_I(inode)->csum_bytes = orig_csum_bytes - num_bytes;
2160 + if (bytes > to_free)
2161 + to_free = bytes - to_free;
2162 + else
2163 + to_free = 0;
2164 + }
2165 spin_unlock(&BTRFS_I(inode)->lock);
2166 if (dropped)
2167 to_free += btrfs_calc_trans_metadata_size(root, dropped);
2168 diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
2169 index c9018a0..d64fda5 100644
2170 --- a/fs/btrfs/extent_io.c
2171 +++ b/fs/btrfs/extent_io.c
2172 @@ -1238,6 +1238,39 @@ int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end)
2173 GFP_NOFS);
2174 }
2175
2176 +int extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end)
2177 +{
2178 + unsigned long index = start >> PAGE_CACHE_SHIFT;
2179 + unsigned long end_index = end >> PAGE_CACHE_SHIFT;
2180 + struct page *page;
2181 +
2182 + while (index <= end_index) {
2183 + page = find_get_page(inode->i_mapping, index);
2184 + BUG_ON(!page); /* Pages should be in the extent_io_tree */
2185 + clear_page_dirty_for_io(page);
2186 + page_cache_release(page);
2187 + index++;
2188 + }
2189 + return 0;
2190 +}
2191 +
2192 +int extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end)
2193 +{
2194 + unsigned long index = start >> PAGE_CACHE_SHIFT;
2195 + unsigned long end_index = end >> PAGE_CACHE_SHIFT;
2196 + struct page *page;
2197 +
2198 + while (index <= end_index) {
2199 + page = find_get_page(inode->i_mapping, index);
2200 + BUG_ON(!page); /* Pages should be in the extent_io_tree */
2201 + account_page_redirty(page);
2202 + __set_page_dirty_nobuffers(page);
2203 + page_cache_release(page);
2204 + index++;
2205 + }
2206 + return 0;
2207 +}
2208 +
2209 /*
2210 * helper function to set both pages and extents in the tree writeback
2211 */
2212 diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
2213 index b516c3b..2edf912 100644
2214 --- a/fs/btrfs/extent_io.h
2215 +++ b/fs/btrfs/extent_io.h
2216 @@ -312,6 +312,8 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long offset,
2217 unsigned long *map_len);
2218 int extent_range_uptodate(struct extent_io_tree *tree,
2219 u64 start, u64 end);
2220 +int extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end);
2221 +int extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end);
2222 int extent_clear_unlock_delalloc(struct inode *inode,
2223 struct extent_io_tree *tree,
2224 u64 start, u64 end, struct page *locked_page,
2225 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
2226 index 0df0d1f..9e51325 100644
2227 --- a/fs/btrfs/inode.c
2228 +++ b/fs/btrfs/inode.c
2229 @@ -349,6 +349,7 @@ static noinline int compress_file_range(struct inode *inode,
2230 int i;
2231 int will_compress;
2232 int compress_type = root->fs_info->compress_type;
2233 + int redirty = 0;
2234
2235 /* if this is a small write inside eof, kick off a defrag */
2236 if ((end - start + 1) < 16 * 1024 &&
2237 @@ -411,6 +412,17 @@ again:
2238 if (BTRFS_I(inode)->force_compress)
2239 compress_type = BTRFS_I(inode)->force_compress;
2240
2241 + /*
2242 + * we need to call clear_page_dirty_for_io on each
2243 + * page in the range. Otherwise applications with the file
2244 + * mmap'd can wander in and change the page contents while
2245 + * we are compressing them.
2246 + *
2247 + * If the compression fails for any reason, we set the pages
2248 + * dirty again later on.
2249 + */
2250 + extent_range_clear_dirty_for_io(inode, start, end);
2251 + redirty = 1;
2252 ret = btrfs_compress_pages(compress_type,
2253 inode->i_mapping, start,
2254 total_compressed, pages,
2255 @@ -552,6 +564,8 @@ cleanup_and_bail_uncompressed:
2256 __set_page_dirty_nobuffers(locked_page);
2257 /* unlocked later on in the async handlers */
2258 }
2259 + if (redirty)
2260 + extent_range_redirty_for_io(inode, start, end);
2261 add_async_extent(async_cow, start, end - start + 1,
2262 0, NULL, 0, BTRFS_COMPRESS_NONE);
2263 *num_added += 1;
2264 diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
2265 index 2f3d6f9..682e5da 100644
2266 --- a/fs/btrfs/scrub.c
2267 +++ b/fs/btrfs/scrub.c
2268 @@ -383,7 +383,6 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock)
2269 eb = path->nodes[0];
2270 ei = btrfs_item_ptr(eb, path->slots[0], struct btrfs_extent_item);
2271 item_size = btrfs_item_size_nr(eb, path->slots[0]);
2272 - btrfs_release_path(path);
2273
2274 if (ret & BTRFS_EXTENT_FLAG_TREE_BLOCK) {
2275 do {
2276 @@ -398,7 +397,9 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock)
2277 ret < 0 ? -1 : ref_level,
2278 ret < 0 ? -1 : ref_root);
2279 } while (ret != 1);
2280 + btrfs_release_path(path);
2281 } else {
2282 + btrfs_release_path(path);
2283 swarn.path = path;
2284 iterate_extent_inodes(fs_info, found_key.objectid,
2285 extent_item_pos, 1,
2286 diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
2287 index 3e1018a..d33733e 100644
2288 --- a/fs/ext4/balloc.c
2289 +++ b/fs/ext4/balloc.c
2290 @@ -600,7 +600,7 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb)
2291 brelse(bitmap_bh);
2292 printk(KERN_DEBUG "ext4_count_free_clusters: stored = %llu"
2293 ", computed = %llu, %llu\n",
2294 - EXT4_B2C(EXT4_SB(sb), ext4_free_blocks_count(es)),
2295 + EXT4_NUM_B2C(EXT4_SB(sb), ext4_free_blocks_count(es)),
2296 desc_count, bitmap_count);
2297 return bitmap_count;
2298 #else
2299 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
2300 index 47d1c8c..d918b55 100644
2301 --- a/fs/ext4/ext4.h
2302 +++ b/fs/ext4/ext4.h
2303 @@ -316,9 +316,9 @@ struct ext4_group_desc
2304 */
2305
2306 struct flex_groups {
2307 - atomic_t free_inodes;
2308 - atomic_t free_clusters;
2309 - atomic_t used_dirs;
2310 + atomic64_t free_clusters;
2311 + atomic_t free_inodes;
2312 + atomic_t used_dirs;
2313 };
2314
2315 #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */
2316 diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
2317 index 902544e..e42b468 100644
2318 --- a/fs/ext4/ialloc.c
2319 +++ b/fs/ext4/ialloc.c
2320 @@ -305,8 +305,8 @@ error_return:
2321 }
2322
2323 struct orlov_stats {
2324 + __u64 free_clusters;
2325 __u32 free_inodes;
2326 - __u32 free_clusters;
2327 __u32 used_dirs;
2328 };
2329
2330 @@ -323,7 +323,7 @@ static void get_orlov_stats(struct super_block *sb, ext4_group_t g,
2331
2332 if (flex_size > 1) {
2333 stats->free_inodes = atomic_read(&flex_group[g].free_inodes);
2334 - stats->free_clusters = atomic_read(&flex_group[g].free_clusters);
2335 + stats->free_clusters = atomic64_read(&flex_group[g].free_clusters);
2336 stats->used_dirs = atomic_read(&flex_group[g].used_dirs);
2337 return;
2338 }
2339 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
2340 index 3122ece..6c32dd8 100644
2341 --- a/fs/ext4/mballoc.c
2342 +++ b/fs/ext4/mballoc.c
2343 @@ -2813,8 +2813,8 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2344 if (sbi->s_log_groups_per_flex) {
2345 ext4_group_t flex_group = ext4_flex_group(sbi,
2346 ac->ac_b_ex.fe_group);
2347 - atomic_sub(ac->ac_b_ex.fe_len,
2348 - &sbi->s_flex_groups[flex_group].free_clusters);
2349 + atomic64_sub(ac->ac_b_ex.fe_len,
2350 + &sbi->s_flex_groups[flex_group].free_clusters);
2351 }
2352
2353 err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh);
2354 @@ -3433,7 +3433,7 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
2355 win = offs;
2356
2357 ac->ac_b_ex.fe_logical = ac->ac_o_ex.fe_logical -
2358 - EXT4_B2C(sbi, win);
2359 + EXT4_NUM_B2C(sbi, win);
2360 BUG_ON(ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical);
2361 BUG_ON(ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len);
2362 }
2363 @@ -4577,7 +4577,7 @@ do_more:
2364 EXT4_BLOCKS_PER_GROUP(sb);
2365 count -= overflow;
2366 }
2367 - count_clusters = EXT4_B2C(sbi, count);
2368 + count_clusters = EXT4_NUM_B2C(sbi, count);
2369 bitmap_bh = ext4_read_block_bitmap(sb, block_group);
2370 if (!bitmap_bh) {
2371 err = -EIO;
2372 @@ -4667,8 +4667,8 @@ do_more:
2373
2374 if (sbi->s_log_groups_per_flex) {
2375 ext4_group_t flex_group = ext4_flex_group(sbi, block_group);
2376 - atomic_add(count_clusters,
2377 - &sbi->s_flex_groups[flex_group].free_clusters);
2378 + atomic64_add(count_clusters,
2379 + &sbi->s_flex_groups[flex_group].free_clusters);
2380 }
2381
2382 ext4_mb_unload_buddy(&e4b);
2383 @@ -4808,12 +4808,12 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
2384 desc->bg_checksum = ext4_group_desc_csum(sbi, block_group, desc);
2385 ext4_unlock_group(sb, block_group);
2386 percpu_counter_add(&sbi->s_freeclusters_counter,
2387 - EXT4_B2C(sbi, blocks_freed));
2388 + EXT4_NUM_B2C(sbi, blocks_freed));
2389
2390 if (sbi->s_log_groups_per_flex) {
2391 ext4_group_t flex_group = ext4_flex_group(sbi, block_group);
2392 - atomic_add(EXT4_B2C(sbi, blocks_freed),
2393 - &sbi->s_flex_groups[flex_group].free_clusters);
2394 + atomic64_add(EXT4_NUM_B2C(sbi, blocks_freed),
2395 + &sbi->s_flex_groups[flex_group].free_clusters);
2396 }
2397
2398 ext4_mb_unload_buddy(&e4b);
2399 diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
2400 index 231cacb..3fc0e8b 100644
2401 --- a/fs/ext4/resize.c
2402 +++ b/fs/ext4/resize.c
2403 @@ -1112,7 +1112,7 @@ static int ext4_setup_new_descs(handle_t *handle, struct super_block *sb,
2404 ext4_inode_bitmap_set(sb, gdp, group_data->inode_bitmap);
2405 ext4_inode_table_set(sb, gdp, group_data->inode_table);
2406 ext4_free_group_clusters_set(sb, gdp,
2407 - EXT4_B2C(sbi, group_data->free_blocks_count));
2408 + EXT4_NUM_B2C(sbi, group_data->free_blocks_count));
2409 ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb));
2410 gdp->bg_flags = cpu_to_le16(*bg_flags);
2411 gdp->bg_checksum = ext4_group_desc_csum(sbi, group, gdp);
2412 @@ -1210,7 +1210,7 @@ static void ext4_update_super(struct super_block *sb,
2413
2414 /* Update the free space counts */
2415 percpu_counter_add(&sbi->s_freeclusters_counter,
2416 - EXT4_B2C(sbi, free_blocks));
2417 + EXT4_NUM_B2C(sbi, free_blocks));
2418 percpu_counter_add(&sbi->s_freeinodes_counter,
2419 EXT4_INODES_PER_GROUP(sb) * flex_gd->count);
2420
2421 @@ -1219,8 +1219,8 @@ static void ext4_update_super(struct super_block *sb,
2422 sbi->s_log_groups_per_flex) {
2423 ext4_group_t flex_group;
2424 flex_group = ext4_flex_group(sbi, group_data[0].group);
2425 - atomic_add(EXT4_B2C(sbi, free_blocks),
2426 - &sbi->s_flex_groups[flex_group].free_clusters);
2427 + atomic64_add(EXT4_NUM_B2C(sbi, free_blocks),
2428 + &sbi->s_flex_groups[flex_group].free_clusters);
2429 atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count,
2430 &sbi->s_flex_groups[flex_group].free_inodes);
2431 }
2432 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
2433 index 288f4c6..88bb68d 100644
2434 --- a/fs/ext4/super.c
2435 +++ b/fs/ext4/super.c
2436 @@ -1907,8 +1907,8 @@ static int ext4_fill_flex_info(struct super_block *sb)
2437 flex_group = ext4_flex_group(sbi, i);
2438 atomic_add(ext4_free_inodes_count(sb, gdp),
2439 &sbi->s_flex_groups[flex_group].free_inodes);
2440 - atomic_add(ext4_free_group_clusters(sb, gdp),
2441 - &sbi->s_flex_groups[flex_group].free_clusters);
2442 + atomic64_add(ext4_free_group_clusters(sb, gdp),
2443 + &sbi->s_flex_groups[flex_group].free_clusters);
2444 atomic_add(ext4_used_dirs_count(sb, gdp),
2445 &sbi->s_flex_groups[flex_group].used_dirs);
2446 }
2447 diff --git a/fs/nfs/blocklayout/blocklayoutdm.c b/fs/nfs/blocklayout/blocklayoutdm.c
2448 index 737d839..6fc7b5c 100644
2449 --- a/fs/nfs/blocklayout/blocklayoutdm.c
2450 +++ b/fs/nfs/blocklayout/blocklayoutdm.c
2451 @@ -55,7 +55,8 @@ static void dev_remove(struct net *net, dev_t dev)
2452
2453 bl_pipe_msg.bl_wq = &nn->bl_wq;
2454 memset(msg, 0, sizeof(*msg));
2455 - msg->data = kzalloc(1 + sizeof(bl_umount_request), GFP_NOFS);
2456 + msg->len = sizeof(bl_msg) + bl_msg.totallen;
2457 + msg->data = kzalloc(msg->len, GFP_NOFS);
2458 if (!msg->data)
2459 goto out;
2460
2461 @@ -66,7 +67,6 @@ static void dev_remove(struct net *net, dev_t dev)
2462 memcpy(msg->data, &bl_msg, sizeof(bl_msg));
2463 dataptr = (uint8_t *) msg->data;
2464 memcpy(&dataptr[sizeof(bl_msg)], &bl_umount_request, sizeof(bl_umount_request));
2465 - msg->len = sizeof(bl_msg) + bl_msg.totallen;
2466
2467 add_wait_queue(&nn->bl_wq, &wq);
2468 if (rpc_queue_upcall(nn->bl_device_pipe, msg) < 0) {
2469 diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
2470 index 967d68e..ace6745 100644
2471 --- a/fs/nfsd/nfs4xdr.c
2472 +++ b/fs/nfsd/nfs4xdr.c
2473 @@ -263,7 +263,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
2474 iattr->ia_valid |= ATTR_SIZE;
2475 }
2476 if (bmval[0] & FATTR4_WORD0_ACL) {
2477 - int nace;
2478 + u32 nace;
2479 struct nfs4_ace *ace;
2480
2481 READ_BUF(4); len += 4;
2482 diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
2483 index a545d81..45024ef 100644
2484 --- a/fs/sysfs/dir.c
2485 +++ b/fs/sysfs/dir.c
2486 @@ -1002,6 +1002,8 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
2487 ino = parent_sd->s_ino;
2488 if (filldir(dirent, ".", 1, filp->f_pos, ino, DT_DIR) == 0)
2489 filp->f_pos++;
2490 + else
2491 + return 0;
2492 }
2493 if (filp->f_pos == 1) {
2494 if (parent_sd->s_parent)
2495 @@ -1010,6 +1012,8 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
2496 ino = parent_sd->s_ino;
2497 if (filldir(dirent, "..", 2, filp->f_pos, ino, DT_DIR) == 0)
2498 filp->f_pos++;
2499 + else
2500 + return 0;
2501 }
2502 mutex_lock(&sysfs_mutex);
2503 for (pos = sysfs_dir_pos(ns, parent_sd, filp->f_pos, pos);
2504 @@ -1040,10 +1044,21 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
2505 return 0;
2506 }
2507
2508 +static loff_t sysfs_dir_llseek(struct file *file, loff_t offset, int whence)
2509 +{
2510 + struct inode *inode = file->f_path.dentry->d_inode;
2511 + loff_t ret;
2512 +
2513 + mutex_lock(&inode->i_mutex);
2514 + ret = generic_file_llseek(file, offset, whence);
2515 + mutex_unlock(&inode->i_mutex);
2516 +
2517 + return ret;
2518 +}
2519
2520 const struct file_operations sysfs_dir_operations = {
2521 .read = generic_read_dir,
2522 .readdir = sysfs_readdir,
2523 .release = sysfs_dir_release,
2524 - .llseek = generic_file_llseek,
2525 + .llseek = sysfs_dir_llseek,
2526 };
2527 diff --git a/include/asm-generic/signal.h b/include/asm-generic/signal.h
2528 index 555c0ae..743f7a5 100644
2529 --- a/include/asm-generic/signal.h
2530 +++ b/include/asm-generic/signal.h
2531 @@ -99,6 +99,10 @@ typedef unsigned long old_sigset_t;
2532
2533 #include <asm-generic/signal-defs.h>
2534
2535 +#ifdef SA_RESTORER
2536 +#define __ARCH_HAS_SA_RESTORER
2537 +#endif
2538 +
2539 struct sigaction {
2540 __sighandler_t sa_handler;
2541 unsigned long sa_flags;
2542 diff --git a/include/linux/thermal.h b/include/linux/thermal.h
2543 index 796f1ff..1662047 100644
2544 --- a/include/linux/thermal.h
2545 +++ b/include/linux/thermal.h
2546 @@ -108,7 +108,7 @@ struct thermal_zone_device {
2547 /* Adding event notification support elements */
2548 #define THERMAL_GENL_FAMILY_NAME "thermal_event"
2549 #define THERMAL_GENL_VERSION 0x01
2550 -#define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_group"
2551 +#define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_grp"
2552
2553 enum events {
2554 THERMAL_AUX0,
2555 diff --git a/include/linux/unix_diag.h b/include/linux/unix_diag.h
2556 index b1d2bf1..0ff4d32 100644
2557 --- a/include/linux/unix_diag.h
2558 +++ b/include/linux/unix_diag.h
2559 @@ -38,9 +38,11 @@ enum {
2560 UNIX_DIAG_RQLEN,
2561 UNIX_DIAG_MEMINFO,
2562
2563 - UNIX_DIAG_MAX,
2564 + __UNIX_DIAG_MAX,
2565 };
2566
2567 +#define UNIX_DIAG_MAX (__UNIX_DIAG_MAX - 1)
2568 +
2569 struct unix_diag_vfs {
2570 __u32 udiag_vfs_ino;
2571 __u32 udiag_vfs_dev;
2572 diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h
2573 index ee338bf..2af8fdb 100644
2574 --- a/include/xen/interface/io/blkif.h
2575 +++ b/include/xen/interface/io/blkif.h
2576 @@ -138,11 +138,21 @@ struct blkif_request_discard {
2577 uint8_t _pad3;
2578 } __attribute__((__packed__));
2579
2580 +struct blkif_request_other {
2581 + uint8_t _pad1;
2582 + blkif_vdev_t _pad2; /* only for read/write requests */
2583 +#ifdef CONFIG_X86_64
2584 + uint32_t _pad3; /* offsetof(blkif_req..,u.other.id)==8*/
2585 +#endif
2586 + uint64_t id; /* private guest value, echoed in resp */
2587 +} __attribute__((__packed__));
2588 +
2589 struct blkif_request {
2590 uint8_t operation; /* BLKIF_OP_??? */
2591 union {
2592 struct blkif_request_rw rw;
2593 struct blkif_request_discard discard;
2594 + struct blkif_request_other other;
2595 } u;
2596 } __attribute__((__packed__));
2597
2598 diff --git a/kernel/signal.c b/kernel/signal.c
2599 index 9f70f45..32b10d4 100644
2600 --- a/kernel/signal.c
2601 +++ b/kernel/signal.c
2602 @@ -482,7 +482,7 @@ flush_signal_handlers(struct task_struct *t, int force_default)
2603 if (force_default || ka->sa.sa_handler != SIG_IGN)
2604 ka->sa.sa_handler = SIG_DFL;
2605 ka->sa.sa_flags = 0;
2606 -#ifdef SA_RESTORER
2607 +#ifdef __ARCH_HAS_SA_RESTORER
2608 ka->sa.sa_restorer = NULL;
2609 #endif
2610 sigemptyset(&ka->sa.sa_mask);
2611 diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
2612 index 681a759..8beda39 100644
2613 --- a/kernel/trace/trace.c
2614 +++ b/kernel/trace/trace.c
2615 @@ -2743,11 +2743,25 @@ static int set_tracer_option(struct tracer *trace, char *cmp, int neg)
2616 return -EINVAL;
2617 }
2618
2619 -static void set_tracer_flags(unsigned int mask, int enabled)
2620 +/* Some tracers require overwrite to stay enabled */
2621 +int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set)
2622 +{
2623 + if (tracer->enabled && (mask & TRACE_ITER_OVERWRITE) && !set)
2624 + return -1;
2625 +
2626 + return 0;
2627 +}
2628 +
2629 +int set_tracer_flag(unsigned int mask, int enabled)
2630 {
2631 /* do nothing if flag is already set */
2632 if (!!(trace_flags & mask) == !!enabled)
2633 - return;
2634 + return 0;
2635 +
2636 + /* Give the tracer a chance to approve the change */
2637 + if (current_trace->flag_changed)
2638 + if (current_trace->flag_changed(current_trace, mask, !!enabled))
2639 + return -EINVAL;
2640
2641 if (enabled)
2642 trace_flags |= mask;
2643 @@ -2759,6 +2773,8 @@ static void set_tracer_flags(unsigned int mask, int enabled)
2644
2645 if (mask == TRACE_ITER_OVERWRITE)
2646 ring_buffer_change_overwrite(global_trace.buffer, enabled);
2647 +
2648 + return 0;
2649 }
2650
2651 static ssize_t
2652 @@ -2768,7 +2784,7 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf,
2653 char buf[64];
2654 char *cmp;
2655 int neg = 0;
2656 - int ret;
2657 + int ret = -ENODEV;
2658 int i;
2659
2660 if (cnt >= sizeof(buf))
2661 @@ -2785,21 +2801,23 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf,
2662 cmp += 2;
2663 }
2664
2665 + mutex_lock(&trace_types_lock);
2666 +
2667 for (i = 0; trace_options[i]; i++) {
2668 if (strcmp(cmp, trace_options[i]) == 0) {
2669 - set_tracer_flags(1 << i, !neg);
2670 + ret = set_tracer_flag(1 << i, !neg);
2671 break;
2672 }
2673 }
2674
2675 /* If no option could be set, test the specific tracer options */
2676 - if (!trace_options[i]) {
2677 - mutex_lock(&trace_types_lock);
2678 + if (!trace_options[i])
2679 ret = set_tracer_option(current_trace, cmp, neg);
2680 - mutex_unlock(&trace_types_lock);
2681 - if (ret)
2682 - return ret;
2683 - }
2684 +
2685 + mutex_unlock(&trace_types_lock);
2686 +
2687 + if (ret < 0)
2688 + return ret;
2689
2690 *ppos += cnt;
2691
2692 @@ -3123,6 +3141,9 @@ static int tracing_set_tracer(const char *buf)
2693 goto out;
2694
2695 trace_branch_disable();
2696 +
2697 + current_trace->enabled = false;
2698 +
2699 if (current_trace && current_trace->reset)
2700 current_trace->reset(tr);
2701 if (current_trace && current_trace->use_max_tr) {
2702 @@ -3152,6 +3173,7 @@ static int tracing_set_tracer(const char *buf)
2703 goto out;
2704 }
2705
2706 + current_trace->enabled = true;
2707 trace_branch_enable(tr);
2708 out:
2709 mutex_unlock(&trace_types_lock);
2710 @@ -4486,7 +4508,13 @@ trace_options_core_write(struct file *filp, const char __user *ubuf, size_t cnt,
2711
2712 if (val != 0 && val != 1)
2713 return -EINVAL;
2714 - set_tracer_flags(1 << index, val);
2715 +
2716 + mutex_lock(&trace_types_lock);
2717 + ret = set_tracer_flag(1 << index, val);
2718 + mutex_unlock(&trace_types_lock);
2719 +
2720 + if (ret < 0)
2721 + return ret;
2722
2723 *ppos += cnt;
2724
2725 diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
2726 index f95d65d..7360674 100644
2727 --- a/kernel/trace/trace.h
2728 +++ b/kernel/trace/trace.h
2729 @@ -278,10 +278,14 @@ struct tracer {
2730 enum print_line_t (*print_line)(struct trace_iterator *iter);
2731 /* If you handled the flag setting, return 0 */
2732 int (*set_flag)(u32 old_flags, u32 bit, int set);
2733 + /* Return 0 if OK with change, else return non-zero */
2734 + int (*flag_changed)(struct tracer *tracer,
2735 + u32 mask, int set);
2736 struct tracer *next;
2737 struct tracer_flags *flags;
2738 int print_max;
2739 int use_max_tr;
2740 + bool enabled;
2741 };
2742
2743
2744 @@ -826,6 +830,9 @@ extern struct list_head ftrace_events;
2745 extern const char *__start___trace_bprintk_fmt[];
2746 extern const char *__stop___trace_bprintk_fmt[];
2747
2748 +int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set);
2749 +int set_tracer_flag(unsigned int mask, int enabled);
2750 +
2751 #undef FTRACE_ENTRY
2752 #define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \
2753 extern struct ftrace_event_call \
2754 diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
2755 index 99d20e9..8dd139a 100644
2756 --- a/kernel/trace/trace_irqsoff.c
2757 +++ b/kernel/trace/trace_irqsoff.c
2758 @@ -32,7 +32,7 @@ enum {
2759
2760 static int trace_type __read_mostly;
2761
2762 -static int save_lat_flag;
2763 +static int save_flags;
2764
2765 static void stop_irqsoff_tracer(struct trace_array *tr, int graph);
2766 static int start_irqsoff_tracer(struct trace_array *tr, int graph);
2767 @@ -557,8 +557,11 @@ static void stop_irqsoff_tracer(struct trace_array *tr, int graph)
2768
2769 static void __irqsoff_tracer_init(struct trace_array *tr)
2770 {
2771 - save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT;
2772 - trace_flags |= TRACE_ITER_LATENCY_FMT;
2773 + save_flags = trace_flags;
2774 +
2775 + /* non overwrite screws up the latency tracers */
2776 + set_tracer_flag(TRACE_ITER_OVERWRITE, 1);
2777 + set_tracer_flag(TRACE_ITER_LATENCY_FMT, 1);
2778
2779 tracing_max_latency = 0;
2780 irqsoff_trace = tr;
2781 @@ -572,10 +575,13 @@ static void __irqsoff_tracer_init(struct trace_array *tr)
2782
2783 static void irqsoff_tracer_reset(struct trace_array *tr)
2784 {
2785 + int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT;
2786 + int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE;
2787 +
2788 stop_irqsoff_tracer(tr, is_graph());
2789
2790 - if (!save_lat_flag)
2791 - trace_flags &= ~TRACE_ITER_LATENCY_FMT;
2792 + set_tracer_flag(TRACE_ITER_LATENCY_FMT, lat_flag);
2793 + set_tracer_flag(TRACE_ITER_OVERWRITE, overwrite_flag);
2794 }
2795
2796 static void irqsoff_tracer_start(struct trace_array *tr)
2797 @@ -608,6 +614,7 @@ static struct tracer irqsoff_tracer __read_mostly =
2798 .print_line = irqsoff_print_line,
2799 .flags = &tracer_flags,
2800 .set_flag = irqsoff_set_flag,
2801 + .flag_changed = trace_keep_overwrite,
2802 #ifdef CONFIG_FTRACE_SELFTEST
2803 .selftest = trace_selftest_startup_irqsoff,
2804 #endif
2805 @@ -641,6 +648,7 @@ static struct tracer preemptoff_tracer __read_mostly =
2806 .print_line = irqsoff_print_line,
2807 .flags = &tracer_flags,
2808 .set_flag = irqsoff_set_flag,
2809 + .flag_changed = trace_keep_overwrite,
2810 #ifdef CONFIG_FTRACE_SELFTEST
2811 .selftest = trace_selftest_startup_preemptoff,
2812 #endif
2813 @@ -676,6 +684,7 @@ static struct tracer preemptirqsoff_tracer __read_mostly =
2814 .print_line = irqsoff_print_line,
2815 .flags = &tracer_flags,
2816 .set_flag = irqsoff_set_flag,
2817 + .flag_changed = trace_keep_overwrite,
2818 #ifdef CONFIG_FTRACE_SELFTEST
2819 .selftest = trace_selftest_startup_preemptirqsoff,
2820 #endif
2821 diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c
2822 index ff791ea..9eadedc 100644
2823 --- a/kernel/trace/trace_sched_wakeup.c
2824 +++ b/kernel/trace/trace_sched_wakeup.c
2825 @@ -36,7 +36,7 @@ static void __wakeup_reset(struct trace_array *tr);
2826 static int wakeup_graph_entry(struct ftrace_graph_ent *trace);
2827 static void wakeup_graph_return(struct ftrace_graph_ret *trace);
2828
2829 -static int save_lat_flag;
2830 +static int save_flags;
2831
2832 #define TRACE_DISPLAY_GRAPH 1
2833
2834 @@ -539,8 +539,11 @@ static void stop_wakeup_tracer(struct trace_array *tr)
2835
2836 static int __wakeup_tracer_init(struct trace_array *tr)
2837 {
2838 - save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT;
2839 - trace_flags |= TRACE_ITER_LATENCY_FMT;
2840 + save_flags = trace_flags;
2841 +
2842 + /* non overwrite screws up the latency tracers */
2843 + set_tracer_flag(TRACE_ITER_OVERWRITE, 1);
2844 + set_tracer_flag(TRACE_ITER_LATENCY_FMT, 1);
2845
2846 tracing_max_latency = 0;
2847 wakeup_trace = tr;
2848 @@ -562,12 +565,15 @@ static int wakeup_rt_tracer_init(struct trace_array *tr)
2849
2850 static void wakeup_tracer_reset(struct trace_array *tr)
2851 {
2852 + int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT;
2853 + int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE;
2854 +
2855 stop_wakeup_tracer(tr);
2856 /* make sure we put back any tasks we are tracing */
2857 wakeup_reset(tr);
2858
2859 - if (!save_lat_flag)
2860 - trace_flags &= ~TRACE_ITER_LATENCY_FMT;
2861 + set_tracer_flag(TRACE_ITER_LATENCY_FMT, lat_flag);
2862 + set_tracer_flag(TRACE_ITER_OVERWRITE, overwrite_flag);
2863 }
2864
2865 static void wakeup_tracer_start(struct trace_array *tr)
2866 @@ -593,6 +599,7 @@ static struct tracer wakeup_tracer __read_mostly =
2867 .print_line = wakeup_print_line,
2868 .flags = &tracer_flags,
2869 .set_flag = wakeup_set_flag,
2870 + .flag_changed = trace_keep_overwrite,
2871 #ifdef CONFIG_FTRACE_SELFTEST
2872 .selftest = trace_selftest_startup_wakeup,
2873 #endif
2874 @@ -614,6 +621,7 @@ static struct tracer wakeup_rt_tracer __read_mostly =
2875 .print_line = wakeup_print_line,
2876 .flags = &tracer_flags,
2877 .set_flag = wakeup_set_flag,
2878 + .flag_changed = trace_keep_overwrite,
2879 #ifdef CONFIG_FTRACE_SELFTEST
2880 .selftest = trace_selftest_startup_wakeup,
2881 #endif
2882 diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
2883 index cf4a49c..e22b8ad 100644
2884 --- a/net/8021q/vlan.c
2885 +++ b/net/8021q/vlan.c
2886 @@ -86,13 +86,6 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)
2887
2888 grp = &vlan_info->grp;
2889
2890 - /* Take it out of our own structures, but be sure to interlock with
2891 - * HW accelerating devices or SW vlan input packet processing if
2892 - * VLAN is not 0 (leave it there for 802.1p).
2893 - */
2894 - if (vlan_id)
2895 - vlan_vid_del(real_dev, vlan_id);
2896 -
2897 grp->nr_vlan_devs--;
2898
2899 if (vlan->flags & VLAN_FLAG_GVRP)
2900 @@ -108,6 +101,13 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)
2901 if (grp->nr_vlan_devs == 0)
2902 vlan_gvrp_uninit_applicant(real_dev);
2903
2904 + /* Take it out of our own structures, but be sure to interlock with
2905 + * HW accelerating devices or SW vlan input packet processing if
2906 + * VLAN is not 0 (leave it there for 802.1p).
2907 + */
2908 + if (vlan_id)
2909 + vlan_vid_del(real_dev, vlan_id);
2910 +
2911 /* Get rid of the vlan's reference to real_dev */
2912 dev_put(real_dev);
2913 }
2914 diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
2915 index f6ab129..70c9ef2 100644
2916 --- a/net/bluetooth/sco.c
2917 +++ b/net/bluetooth/sco.c
2918 @@ -378,6 +378,7 @@ static void __sco_sock_close(struct sock *sk)
2919 sco_chan_del(sk, ECONNRESET);
2920 break;
2921
2922 + case BT_CONNECT2:
2923 case BT_CONNECT:
2924 case BT_DISCONN:
2925 sco_chan_del(sk, ECONNRESET);
2926 diff --git a/net/core/dev.c b/net/core/dev.c
2927 index dfa2f49..9e2e29b 100644
2928 --- a/net/core/dev.c
2929 +++ b/net/core/dev.c
2930 @@ -1482,7 +1482,6 @@ void net_enable_timestamp(void)
2931 return;
2932 }
2933 #endif
2934 - WARN_ON(in_interrupt());
2935 static_key_slow_inc(&netstamp_needed);
2936 }
2937 EXPORT_SYMBOL(net_enable_timestamp);
2938 @@ -3125,6 +3124,7 @@ int netdev_rx_handler_register(struct net_device *dev,
2939 if (dev->rx_handler)
2940 return -EBUSY;
2941
2942 + /* Note: rx_handler_data must be set before rx_handler */
2943 rcu_assign_pointer(dev->rx_handler_data, rx_handler_data);
2944 rcu_assign_pointer(dev->rx_handler, rx_handler);
2945
2946 @@ -3145,6 +3145,11 @@ void netdev_rx_handler_unregister(struct net_device *dev)
2947
2948 ASSERT_RTNL();
2949 RCU_INIT_POINTER(dev->rx_handler, NULL);
2950 + /* a reader seeing a non NULL rx_handler in a rcu_read_lock()
2951 + * section has a guarantee to see a non NULL rx_handler_data
2952 + * as well.
2953 + */
2954 + synchronize_net();
2955 RCU_INIT_POINTER(dev->rx_handler_data, NULL);
2956 }
2957 EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister);
2958 diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2959 index fc2fc72..0a1f159 100644
2960 --- a/net/ipv4/tcp_input.c
2961 +++ b/net/ipv4/tcp_input.c
2962 @@ -2260,11 +2260,8 @@ void tcp_enter_loss(struct sock *sk, int how)
2963 if (tcp_is_reno(tp))
2964 tcp_reset_reno_sack(tp);
2965
2966 - if (!how) {
2967 - /* Push undo marker, if it was plain RTO and nothing
2968 - * was retransmitted. */
2969 - tp->undo_marker = tp->snd_una;
2970 - } else {
2971 + tp->undo_marker = tp->snd_una;
2972 + if (how) {
2973 tp->sacked_out = 0;
2974 tp->fackets_out = 0;
2975 }
2976 diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
2977 index 952f7dd..4dca494 100644
2978 --- a/net/ipv4/tcp_output.c
2979 +++ b/net/ipv4/tcp_output.c
2980 @@ -1587,8 +1587,11 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb)
2981 goto send_now;
2982 }
2983
2984 - /* Ok, it looks like it is advisable to defer. */
2985 - tp->tso_deferred = 1 | (jiffies << 1);
2986 + /* Ok, it looks like it is advisable to defer.
2987 + * Do not rearm the timer if already set to not break TCP ACK clocking.
2988 + */
2989 + if (!tp->tso_deferred)
2990 + tp->tso_deferred = 1 | (jiffies << 1);
2991
2992 return 1;
2993
2994 diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
2995 index 81e0ad2..541a719 100644
2996 --- a/net/ipv6/addrconf.c
2997 +++ b/net/ipv6/addrconf.c
2998 @@ -4686,26 +4686,20 @@ static void addrconf_sysctl_unregister(struct inet6_dev *idev)
2999
3000 static int __net_init addrconf_init_net(struct net *net)
3001 {
3002 - int err;
3003 + int err = -ENOMEM;
3004 struct ipv6_devconf *all, *dflt;
3005
3006 - err = -ENOMEM;
3007 - all = &ipv6_devconf;
3008 - dflt = &ipv6_devconf_dflt;
3009 + all = kmemdup(&ipv6_devconf, sizeof(ipv6_devconf), GFP_KERNEL);
3010 + if (all == NULL)
3011 + goto err_alloc_all;
3012
3013 - if (!net_eq(net, &init_net)) {
3014 - all = kmemdup(all, sizeof(ipv6_devconf), GFP_KERNEL);
3015 - if (all == NULL)
3016 - goto err_alloc_all;
3017 + dflt = kmemdup(&ipv6_devconf_dflt, sizeof(ipv6_devconf_dflt), GFP_KERNEL);
3018 + if (dflt == NULL)
3019 + goto err_alloc_dflt;
3020
3021 - dflt = kmemdup(dflt, sizeof(ipv6_devconf_dflt), GFP_KERNEL);
3022 - if (dflt == NULL)
3023 - goto err_alloc_dflt;
3024 - } else {
3025 - /* these will be inherited by all namespaces */
3026 - dflt->autoconf = ipv6_defaults.autoconf;
3027 - dflt->disable_ipv6 = ipv6_defaults.disable_ipv6;
3028 - }
3029 + /* these will be inherited by all namespaces */
3030 + dflt->autoconf = ipv6_defaults.autoconf;
3031 + dflt->disable_ipv6 = ipv6_defaults.disable_ipv6;
3032
3033 net->ipv6.devconf_all = all;
3034 net->ipv6.devconf_dflt = dflt;
3035 diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
3036 index d813575..37aceed 100644
3037 --- a/net/ipv6/ip6_input.c
3038 +++ b/net/ipv6/ip6_input.c
3039 @@ -111,6 +111,27 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
3040 ipv6_addr_loopback(&hdr->daddr))
3041 goto err;
3042
3043 + /* RFC4291 Errata ID: 3480
3044 + * Interface-Local scope spans only a single interface on a
3045 + * node and is useful only for loopback transmission of
3046 + * multicast. Packets with interface-local scope received
3047 + * from another node must be discarded.
3048 + */
3049 + if (!(skb->pkt_type == PACKET_LOOPBACK ||
3050 + dev->flags & IFF_LOOPBACK) &&
3051 + ipv6_addr_is_multicast(&hdr->daddr) &&
3052 + IPV6_ADDR_MC_SCOPE(&hdr->daddr) == 1)
3053 + goto err;
3054 +
3055 + /* RFC4291 2.7
3056 + * Nodes must not originate a packet to a multicast address whose scope
3057 + * field contains the reserved value 0; if such a packet is received, it
3058 + * must be silently dropped.
3059 + */
3060 + if (ipv6_addr_is_multicast(&hdr->daddr) &&
3061 + IPV6_ADDR_MC_SCOPE(&hdr->daddr) == 0)
3062 + goto err;
3063 +
3064 /*
3065 * RFC4291 2.7
3066 * Multicast addresses must not be used as source addresses in IPv6
3067 diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
3068 index bb14c34..d6c291c 100644
3069 --- a/net/irda/af_irda.c
3070 +++ b/net/irda/af_irda.c
3071 @@ -2584,8 +2584,10 @@ bed:
3072 NULL, NULL, NULL);
3073
3074 /* Check if the we got some results */
3075 - if (!self->cachedaddr)
3076 - return -EAGAIN; /* Didn't find any devices */
3077 + if (!self->cachedaddr) {
3078 + err = -EAGAIN; /* Didn't find any devices */
3079 + goto out;
3080 + }
3081 daddr = self->cachedaddr;
3082 /* Cleanup */
3083 self->cachedaddr = 0;
3084 diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
3085 index 9f40441..73d3f0c 100644
3086 --- a/net/netlink/genetlink.c
3087 +++ b/net/netlink/genetlink.c
3088 @@ -142,6 +142,7 @@ int genl_register_mc_group(struct genl_family *family,
3089 int err = 0;
3090
3091 BUG_ON(grp->name[0] == '\0');
3092 + BUG_ON(memchr(grp->name, '\0', GENL_NAMSIZ) == NULL);
3093
3094 genl_lock();
3095
3096 diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
3097 index 85b9235..72d89e1 100644
3098 --- a/net/sunrpc/sched.c
3099 +++ b/net/sunrpc/sched.c
3100 @@ -143,6 +143,8 @@ static void __rpc_add_wait_queue(struct rpc_wait_queue *queue,
3101 list_add_tail(&task->u.tk_wait.list, &queue->tasks[0]);
3102 task->tk_waitqueue = queue;
3103 queue->qlen++;
3104 + /* barrier matches the read in rpc_wake_up_task_queue_locked() */
3105 + smp_wmb();
3106 rpc_set_queued(task);
3107
3108 dprintk("RPC: %5u added to queue %p \"%s\"\n",
3109 @@ -399,8 +401,11 @@ static void __rpc_do_wake_up_task(struct rpc_wait_queue *queue, struct rpc_task
3110 */
3111 static void rpc_wake_up_task_queue_locked(struct rpc_wait_queue *queue, struct rpc_task *task)
3112 {
3113 - if (RPC_IS_QUEUED(task) && task->tk_waitqueue == queue)
3114 - __rpc_do_wake_up_task(queue, task);
3115 + if (RPC_IS_QUEUED(task)) {
3116 + smp_rmb();
3117 + if (task->tk_waitqueue == queue)
3118 + __rpc_do_wake_up_task(queue, task);
3119 + }
3120 }
3121
3122 /*
3123 diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
3124 index 109e30b..fa5289a 100644
3125 --- a/net/unix/af_unix.c
3126 +++ b/net/unix/af_unix.c
3127 @@ -374,7 +374,7 @@ static void unix_sock_destructor(struct sock *sk)
3128 #endif
3129 }
3130
3131 -static int unix_release_sock(struct sock *sk, int embrion)
3132 +static void unix_release_sock(struct sock *sk, int embrion)
3133 {
3134 struct unix_sock *u = unix_sk(sk);
3135 struct path path;
3136 @@ -443,8 +443,6 @@ static int unix_release_sock(struct sock *sk, int embrion)
3137
3138 if (unix_tot_inflight)
3139 unix_gc(); /* Garbage collect fds */
3140 -
3141 - return 0;
3142 }
3143
3144 static void init_peercred(struct sock *sk)
3145 @@ -694,9 +692,10 @@ static int unix_release(struct socket *sock)
3146 if (!sk)
3147 return 0;
3148
3149 + unix_release_sock(sk, 0);
3150 sock->sk = NULL;
3151
3152 - return unix_release_sock(sk, 0);
3153 + return 0;
3154 }
3155
3156 static int unix_autobind(struct socket *sock)