Gentoo Archives: gentoo-commits

From: "Vlastimil Babka (caster)" <caster@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r2804 - genpatches-2.6/trunk/3.12
Date: Tue, 03 Jun 2014 22:01:18
Message-Id: 20140603220112.EA5BA2004E@flycatcher.gentoo.org
1 Author: caster
2 Date: 2014-06-03 22:01:11 +0000 (Tue, 03 Jun 2014)
3 New Revision: 2804
4
5 Added:
6 genpatches-2.6/trunk/3.12/1020_linux-3.12.21.patch
7 Modified:
8 genpatches-2.6/trunk/3.12/0000_README
9 Log:
10 Linux patch 3.12.21
11
12 Modified: genpatches-2.6/trunk/3.12/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/3.12/0000_README 2014-06-02 19:48:24 UTC (rev 2803)
15 +++ genpatches-2.6/trunk/3.12/0000_README 2014-06-03 22:01:11 UTC (rev 2804)
16 @@ -122,6 +122,10 @@
17 From: http://www.kernel.org
18 Desc: Linux 3.12.20
19
20 +Patch: 1020_linux-3.12.21.patch
21 +From: http://www.kernel.org
22 +Desc: Linux 3.12.21
23 +
24 Patch: 1500_XATTR_USER_PREFIX.patch
25 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
26 Desc: Support for namespace user.pax.* on tmpfs.
27
28 Added: genpatches-2.6/trunk/3.12/1020_linux-3.12.21.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/3.12/1020_linux-3.12.21.patch (rev 0)
31 +++ genpatches-2.6/trunk/3.12/1020_linux-3.12.21.patch 2014-06-03 22:01:11 UTC (rev 2804)
32 @@ -0,0 +1,4218 @@
33 +diff --git a/Makefile b/Makefile
34 +index d8adfdbe0344..e4a8804bb609 100644
35 +--- a/Makefile
36 ++++ b/Makefile
37 +@@ -1,6 +1,6 @@
38 + VERSION = 3
39 + PATCHLEVEL = 12
40 +-SUBLEVEL = 20
41 ++SUBLEVEL = 21
42 + EXTRAVERSION =
43 + NAME = One Giant Leap for Frogkind
44 +
45 +diff --git a/arch/powerpc/lib/crtsavres.S b/arch/powerpc/lib/crtsavres.S
46 +index b2c68ce139ae..a5b30c71a8d3 100644
47 +--- a/arch/powerpc/lib/crtsavres.S
48 ++++ b/arch/powerpc/lib/crtsavres.S
49 +@@ -231,6 +231,87 @@ _GLOBAL(_rest32gpr_31_x)
50 + mr 1,11
51 + blr
52 +
53 ++#ifdef CONFIG_ALTIVEC
54 ++/* Called with r0 pointing just beyond the end of the vector save area. */
55 ++
56 ++_GLOBAL(_savevr_20)
57 ++ li r11,-192
58 ++ stvx vr20,r11,r0
59 ++_GLOBAL(_savevr_21)
60 ++ li r11,-176
61 ++ stvx vr21,r11,r0
62 ++_GLOBAL(_savevr_22)
63 ++ li r11,-160
64 ++ stvx vr22,r11,r0
65 ++_GLOBAL(_savevr_23)
66 ++ li r11,-144
67 ++ stvx vr23,r11,r0
68 ++_GLOBAL(_savevr_24)
69 ++ li r11,-128
70 ++ stvx vr24,r11,r0
71 ++_GLOBAL(_savevr_25)
72 ++ li r11,-112
73 ++ stvx vr25,r11,r0
74 ++_GLOBAL(_savevr_26)
75 ++ li r11,-96
76 ++ stvx vr26,r11,r0
77 ++_GLOBAL(_savevr_27)
78 ++ li r11,-80
79 ++ stvx vr27,r11,r0
80 ++_GLOBAL(_savevr_28)
81 ++ li r11,-64
82 ++ stvx vr28,r11,r0
83 ++_GLOBAL(_savevr_29)
84 ++ li r11,-48
85 ++ stvx vr29,r11,r0
86 ++_GLOBAL(_savevr_30)
87 ++ li r11,-32
88 ++ stvx vr30,r11,r0
89 ++_GLOBAL(_savevr_31)
90 ++ li r11,-16
91 ++ stvx vr31,r11,r0
92 ++ blr
93 ++
94 ++_GLOBAL(_restvr_20)
95 ++ li r11,-192
96 ++ lvx vr20,r11,r0
97 ++_GLOBAL(_restvr_21)
98 ++ li r11,-176
99 ++ lvx vr21,r11,r0
100 ++_GLOBAL(_restvr_22)
101 ++ li r11,-160
102 ++ lvx vr22,r11,r0
103 ++_GLOBAL(_restvr_23)
104 ++ li r11,-144
105 ++ lvx vr23,r11,r0
106 ++_GLOBAL(_restvr_24)
107 ++ li r11,-128
108 ++ lvx vr24,r11,r0
109 ++_GLOBAL(_restvr_25)
110 ++ li r11,-112
111 ++ lvx vr25,r11,r0
112 ++_GLOBAL(_restvr_26)
113 ++ li r11,-96
114 ++ lvx vr26,r11,r0
115 ++_GLOBAL(_restvr_27)
116 ++ li r11,-80
117 ++ lvx vr27,r11,r0
118 ++_GLOBAL(_restvr_28)
119 ++ li r11,-64
120 ++ lvx vr28,r11,r0
121 ++_GLOBAL(_restvr_29)
122 ++ li r11,-48
123 ++ lvx vr29,r11,r0
124 ++_GLOBAL(_restvr_30)
125 ++ li r11,-32
126 ++ lvx vr30,r11,r0
127 ++_GLOBAL(_restvr_31)
128 ++ li r11,-16
129 ++ lvx vr31,r11,r0
130 ++ blr
131 ++
132 ++#endif /* CONFIG_ALTIVEC */
133 ++
134 + #else /* CONFIG_PPC64 */
135 +
136 + .section ".text.save.restore","ax",@progbits
137 +@@ -356,6 +437,111 @@ _restgpr0_31:
138 + mtlr r0
139 + blr
140 +
141 ++#ifdef CONFIG_ALTIVEC
142 ++/* Called with r0 pointing just beyond the end of the vector save area. */
143 ++
144 ++.globl _savevr_20
145 ++_savevr_20:
146 ++ li r12,-192
147 ++ stvx vr20,r12,r0
148 ++.globl _savevr_21
149 ++_savevr_21:
150 ++ li r12,-176
151 ++ stvx vr21,r12,r0
152 ++.globl _savevr_22
153 ++_savevr_22:
154 ++ li r12,-160
155 ++ stvx vr22,r12,r0
156 ++.globl _savevr_23
157 ++_savevr_23:
158 ++ li r12,-144
159 ++ stvx vr23,r12,r0
160 ++.globl _savevr_24
161 ++_savevr_24:
162 ++ li r12,-128
163 ++ stvx vr24,r12,r0
164 ++.globl _savevr_25
165 ++_savevr_25:
166 ++ li r12,-112
167 ++ stvx vr25,r12,r0
168 ++.globl _savevr_26
169 ++_savevr_26:
170 ++ li r12,-96
171 ++ stvx vr26,r12,r0
172 ++.globl _savevr_27
173 ++_savevr_27:
174 ++ li r12,-80
175 ++ stvx vr27,r12,r0
176 ++.globl _savevr_28
177 ++_savevr_28:
178 ++ li r12,-64
179 ++ stvx vr28,r12,r0
180 ++.globl _savevr_29
181 ++_savevr_29:
182 ++ li r12,-48
183 ++ stvx vr29,r12,r0
184 ++.globl _savevr_30
185 ++_savevr_30:
186 ++ li r12,-32
187 ++ stvx vr30,r12,r0
188 ++.globl _savevr_31
189 ++_savevr_31:
190 ++ li r12,-16
191 ++ stvx vr31,r12,r0
192 ++ blr
193 ++
194 ++.globl _restvr_20
195 ++_restvr_20:
196 ++ li r12,-192
197 ++ lvx vr20,r12,r0
198 ++.globl _restvr_21
199 ++_restvr_21:
200 ++ li r12,-176
201 ++ lvx vr21,r12,r0
202 ++.globl _restvr_22
203 ++_restvr_22:
204 ++ li r12,-160
205 ++ lvx vr22,r12,r0
206 ++.globl _restvr_23
207 ++_restvr_23:
208 ++ li r12,-144
209 ++ lvx vr23,r12,r0
210 ++.globl _restvr_24
211 ++_restvr_24:
212 ++ li r12,-128
213 ++ lvx vr24,r12,r0
214 ++.globl _restvr_25
215 ++_restvr_25:
216 ++ li r12,-112
217 ++ lvx vr25,r12,r0
218 ++.globl _restvr_26
219 ++_restvr_26:
220 ++ li r12,-96
221 ++ lvx vr26,r12,r0
222 ++.globl _restvr_27
223 ++_restvr_27:
224 ++ li r12,-80
225 ++ lvx vr27,r12,r0
226 ++.globl _restvr_28
227 ++_restvr_28:
228 ++ li r12,-64
229 ++ lvx vr28,r12,r0
230 ++.globl _restvr_29
231 ++_restvr_29:
232 ++ li r12,-48
233 ++ lvx vr29,r12,r0
234 ++.globl _restvr_30
235 ++_restvr_30:
236 ++ li r12,-32
237 ++ lvx vr30,r12,r0
238 ++.globl _restvr_31
239 ++_restvr_31:
240 ++ li r12,-16
241 ++ lvx vr31,r12,r0
242 ++ blr
243 ++
244 ++#endif /* CONFIG_ALTIVEC */
245 ++
246 + #endif /* CONFIG_PPC64 */
247 +
248 + #endif
249 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
250 +index 92af83d79c97..77046f7177d5 100644
251 +--- a/arch/x86/kvm/x86.c
252 ++++ b/arch/x86/kvm/x86.c
253 +@@ -1073,7 +1073,6 @@ static inline u64 get_kernel_ns(void)
254 + {
255 + struct timespec ts;
256 +
257 +- WARN_ON(preemptible());
258 + ktime_get_ts(&ts);
259 + monotonic_to_bootbased(&ts);
260 + return timespec_to_ns(&ts);
261 +diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
262 +index be6b86078957..ba81b546d714 100644
263 +--- a/arch/x86/xen/spinlock.c
264 ++++ b/arch/x86/xen/spinlock.c
265 +@@ -274,7 +274,7 @@ void __init xen_init_spinlocks(void)
266 + printk(KERN_DEBUG "xen: PV spinlocks disabled\n");
267 + return;
268 + }
269 +-
270 ++ printk(KERN_DEBUG "xen: PV spinlocks enabled\n");
271 + pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(xen_lock_spinning);
272 + pv_lock_ops.unlock_kick = xen_unlock_kick;
273 + }
274 +@@ -290,6 +290,9 @@ static __init int xen_init_spinlocks_jump(void)
275 + if (!xen_pvspin)
276 + return 0;
277 +
278 ++ if (!xen_domain())
279 ++ return 0;
280 ++
281 + static_key_slow_inc(&paravirt_ticketlocks_enabled);
282 + return 0;
283 + }
284 +diff --git a/block/blk-core.c b/block/blk-core.c
285 +index fce4b9387f36..bf214ae98937 100644
286 +--- a/block/blk-core.c
287 ++++ b/block/blk-core.c
288 +@@ -2297,7 +2297,7 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
289 + if (!req->bio)
290 + return false;
291 +
292 +- trace_block_rq_complete(req->q, req);
293 ++ trace_block_rq_complete(req->q, req, nr_bytes);
294 +
295 + /*
296 + * For fs requests, rq is just carrier of independent bio's
297 +diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
298 +index cb1db2979d3d..db60c91804c3 100644
299 +--- a/drivers/block/rbd.c
300 ++++ b/drivers/block/rbd.c
301 +@@ -2272,7 +2272,7 @@ out_partial:
302 + rbd_obj_request_put(obj_request);
303 + out_unwind:
304 + for_each_obj_request_safe(img_request, obj_request, next_obj_request)
305 +- rbd_obj_request_put(obj_request);
306 ++ rbd_img_obj_request_del(img_request, obj_request);
307 +
308 + return -ENOMEM;
309 + }
310 +diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
311 +index dd6f84bf6c22..a1e980938fef 100644
312 +--- a/drivers/gpu/drm/i915/intel_tv.c
313 ++++ b/drivers/gpu/drm/i915/intel_tv.c
314 +@@ -1530,9 +1530,14 @@ static int tv_is_present_in_vbt(struct drm_device *dev)
315 + /*
316 + * If the device type is not TV, continue.
317 + */
318 +- if (p_child->device_type != DEVICE_TYPE_INT_TV &&
319 +- p_child->device_type != DEVICE_TYPE_TV)
320 ++ switch (p_child->device_type) {
321 ++ case DEVICE_TYPE_INT_TV:
322 ++ case DEVICE_TYPE_TV:
323 ++ case DEVICE_TYPE_TV_SVIDEO_COMPOSITE:
324 ++ break;
325 ++ default:
326 + continue;
327 ++ }
328 + /* Only when the addin_offset is non-zero, it is regarded
329 + * as present.
330 + */
331 +diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
332 +index 037786d7c1dc..ed90fbe63686 100644
333 +--- a/drivers/gpu/drm/qxl/qxl_ttm.c
334 ++++ b/drivers/gpu/drm/qxl/qxl_ttm.c
335 +@@ -433,6 +433,7 @@ static int qxl_sync_obj_flush(void *sync_obj)
336 +
337 + static void qxl_sync_obj_unref(void **sync_obj)
338 + {
339 ++ *sync_obj = NULL;
340 + }
341 +
342 + static void *qxl_sync_obj_ref(void *sync_obj)
343 +diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
344 +index 25370ac56b4b..bcefa1de3e97 100644
345 +--- a/drivers/gpu/drm/radeon/cik.c
346 ++++ b/drivers/gpu/drm/radeon/cik.c
347 +@@ -1092,7 +1092,7 @@ static const u32 spectre_golden_registers[] =
348 + 0x8a14, 0xf000003f, 0x00000007,
349 + 0x8b24, 0xffffffff, 0x00ffffff,
350 + 0x28350, 0x3f3f3fff, 0x00000082,
351 +- 0x28355, 0x0000003f, 0x00000000,
352 ++ 0x28354, 0x0000003f, 0x00000000,
353 + 0x3e78, 0x00000001, 0x00000002,
354 + 0x913c, 0xffff03df, 0x00000004,
355 + 0xc768, 0x00000008, 0x00000008,
356 +diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
357 +index 0d1aa050d41d..2f7fd3ff12c0 100644
358 +--- a/drivers/gpu/drm/radeon/radeon_display.c
359 ++++ b/drivers/gpu/drm/radeon/radeon_display.c
360 +@@ -745,6 +745,7 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector)
361 + if (radeon_connector->edid) {
362 + drm_mode_connector_update_edid_property(&radeon_connector->base, radeon_connector->edid);
363 + ret = drm_add_edid_modes(&radeon_connector->base, radeon_connector->edid);
364 ++ drm_edid_to_eld(&radeon_connector->base, radeon_connector->edid);
365 + return ret;
366 + }
367 + drm_mode_connector_update_edid_property(&radeon_connector->base, NULL);
368 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
369 +index 8b059eb09d9b..1b9aa982257e 100644
370 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
371 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
372 +@@ -834,14 +834,36 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv,
373 + SVGA3dCmdSurfaceDMA dma;
374 + } *cmd;
375 + int ret;
376 ++ SVGA3dCmdSurfaceDMASuffix *suffix;
377 ++ uint32_t bo_size;
378 +
379 + cmd = container_of(header, struct vmw_dma_cmd, header);
380 ++ suffix = (SVGA3dCmdSurfaceDMASuffix *)((unsigned long) &cmd->dma +
381 ++ header->size - sizeof(*suffix));
382 ++
383 ++ /* Make sure device and verifier stays in sync. */
384 ++ if (unlikely(suffix->suffixSize != sizeof(*suffix))) {
385 ++ DRM_ERROR("Invalid DMA suffix size.\n");
386 ++ return -EINVAL;
387 ++ }
388 ++
389 + ret = vmw_translate_guest_ptr(dev_priv, sw_context,
390 + &cmd->dma.guest.ptr,
391 + &vmw_bo);
392 + if (unlikely(ret != 0))
393 + return ret;
394 +
395 ++ /* Make sure DMA doesn't cross BO boundaries. */
396 ++ bo_size = vmw_bo->base.num_pages * PAGE_SIZE;
397 ++ if (unlikely(cmd->dma.guest.ptr.offset > bo_size)) {
398 ++ DRM_ERROR("Invalid DMA offset.\n");
399 ++ return -EINVAL;
400 ++ }
401 ++
402 ++ bo_size -= cmd->dma.guest.ptr.offset;
403 ++ if (unlikely(suffix->maximumOffset > bo_size))
404 ++ suffix->maximumOffset = bo_size;
405 ++
406 + ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
407 + user_surface_converter, &cmd->dma.host.sid,
408 + NULL);
409 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
410 +index ed5ce2a41bbf..021b5227e783 100644
411 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
412 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
413 +@@ -147,7 +147,7 @@ static int vmw_fb_check_var(struct fb_var_screeninfo *var,
414 + }
415 +
416 + if (!vmw_kms_validate_mode_vram(vmw_priv,
417 +- info->fix.line_length,
418 ++ var->xres * var->bits_per_pixel/8,
419 + var->yoffset + var->yres)) {
420 + DRM_ERROR("Requested geom can not fit in framebuffer\n");
421 + return -EINVAL;
422 +@@ -162,6 +162,8 @@ static int vmw_fb_set_par(struct fb_info *info)
423 + struct vmw_private *vmw_priv = par->vmw_priv;
424 + int ret;
425 +
426 ++ info->fix.line_length = info->var.xres * info->var.bits_per_pixel/8;
427 ++
428 + ret = vmw_kms_write_svga(vmw_priv, info->var.xres, info->var.yres,
429 + info->fix.line_length,
430 + par->bpp, par->depth);
431 +@@ -177,6 +179,7 @@ static int vmw_fb_set_par(struct fb_info *info)
432 + vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset);
433 + vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres);
434 + vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres);
435 ++ vmw_write(vmw_priv, SVGA_REG_BYTES_PER_LINE, info->fix.line_length);
436 + vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID);
437 + }
438 +
439 +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
440 +index aedfe50d557a..0335f86502c2 100644
441 +--- a/drivers/hid/hid-core.c
442 ++++ b/drivers/hid/hid-core.c
443 +@@ -718,6 +718,9 @@ static int hid_scan_main(struct hid_parser *parser, struct hid_item *item)
444 + case HID_MAIN_ITEM_TAG_END_COLLECTION:
445 + break;
446 + case HID_MAIN_ITEM_TAG_INPUT:
447 ++ /* ignore constant inputs, they will be ignored by hid-input */
448 ++ if (data & HID_MAIN_ITEM_CONSTANT)
449 ++ break;
450 + for (i = 0; i < parser->local.usage_index; i++)
451 + hid_scan_input_usage(parser, parser->local.usage[i]);
452 + break;
453 +@@ -1822,8 +1825,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
454 + { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) },
455 + { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
456 + { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
457 +- { HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH) },
458 +- { HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS817_TOUCH) },
459 ++ { HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH) },
460 ++ { HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS817_TOUCH) },
461 ++ { HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS1030_TOUCH) },
462 + { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
463 + { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) },
464 + { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) },
465 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
466 +index aeeea796f595..ca275f47e860 100644
467 +--- a/drivers/hid/hid-ids.h
468 ++++ b/drivers/hid/hid-ids.h
469 +@@ -636,6 +636,7 @@
470 +
471 + #define USB_VENDOR_ID_NEXIO 0x1870
472 + #define USB_DEVICE_ID_NEXIO_MULTITOUCH_420 0x010d
473 ++#define USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750 0x0110
474 +
475 + #define USB_VENDOR_ID_NEXTWINDOW 0x1926
476 + #define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003
477 +@@ -753,9 +754,11 @@
478 + #define USB_VENDOR_ID_SIGMATEL 0x066F
479 + #define USB_DEVICE_ID_SIGMATEL_STMP3780 0x3780
480 +
481 +-#define USB_VENDOR_ID_SIS2_TOUCH 0x0457
482 ++#define USB_VENDOR_ID_SIS_TOUCH 0x0457
483 + #define USB_DEVICE_ID_SIS9200_TOUCH 0x9200
484 + #define USB_DEVICE_ID_SIS817_TOUCH 0x0817
485 ++#define USB_DEVICE_ID_SIS_TS 0x1013
486 ++#define USB_DEVICE_ID_SIS1030_TOUCH 0x1030
487 +
488 + #define USB_VENDOR_ID_SKYCABLE 0x1223
489 + #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07
490 +@@ -807,6 +810,9 @@
491 + #define USB_DEVICE_ID_SYNAPTICS_DPAD 0x0013
492 + #define USB_DEVICE_ID_SYNAPTICS_LTS1 0x0af8
493 + #define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10
494 ++#define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3
495 ++#define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3
496 ++#define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710
497 +
498 + #define USB_VENDOR_ID_THINGM 0x27b8
499 + #define USB_DEVICE_ID_BLINK1 0x01ed
500 +@@ -937,7 +943,5 @@
501 + #define USB_VENDOR_ID_PRIMAX 0x0461
502 + #define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05
503 +
504 +-#define USB_VENDOR_ID_SIS 0x0457
505 +-#define USB_DEVICE_ID_SIS_TS 0x1013
506 +
507 + #endif
508 +diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
509 +index d83b1e8b505b..f134d73beca1 100644
510 +--- a/drivers/hid/hid-multitouch.c
511 ++++ b/drivers/hid/hid-multitouch.c
512 +@@ -1301,11 +1301,14 @@ static const struct hid_device_id mt_devices[] = {
513 +
514 + /* SiS panels */
515 + { .driver_data = MT_CLS_DEFAULT,
516 +- HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH,
517 ++ HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH,
518 + USB_DEVICE_ID_SIS9200_TOUCH) },
519 + { .driver_data = MT_CLS_DEFAULT,
520 +- HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH,
521 ++ HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH,
522 + USB_DEVICE_ID_SIS817_TOUCH) },
523 ++ { .driver_data = MT_CLS_DEFAULT,
524 ++ HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH,
525 ++ USB_DEVICE_ID_SIS1030_TOUCH) },
526 +
527 + /* Stantum panels */
528 + { .driver_data = MT_CLS_CONFIDENCE,
529 +diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
530 +index 0db9a67278ba..8e4ddb369883 100644
531 +--- a/drivers/hid/usbhid/hid-quirks.c
532 ++++ b/drivers/hid/usbhid/hid-quirks.c
533 +@@ -74,6 +74,7 @@ static const struct hid_blacklist {
534 + { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
535 + { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
536 + { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS },
537 ++ { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS },
538 + { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },
539 + { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS },
540 + { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS },
541 +@@ -84,8 +85,10 @@ static const struct hid_blacklist {
542 + { USB_VENDOR_ID_REALTEK, USB_DEVICE_ID_REALTEK_READER, HID_QUIRK_NO_INIT_REPORTS },
543 + { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET },
544 + { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET },
545 +- { USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH, HID_QUIRK_NOGET },
546 +- { USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS817_TOUCH, HID_QUIRK_NOGET },
547 ++ { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH, HID_QUIRK_NOGET },
548 ++ { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS817_TOUCH, HID_QUIRK_NOGET },
549 ++ { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS_TS, HID_QUIRK_NO_INIT_REPORTS },
550 ++ { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS1030_TOUCH, HID_QUIRK_NOGET },
551 + { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },
552 + { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET },
553 + { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET },
554 +@@ -114,7 +117,9 @@ static const struct hid_blacklist {
555 + { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS },
556 + { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS1, HID_QUIRK_NO_INIT_REPORTS },
557 + { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS2, HID_QUIRK_NO_INIT_REPORTS },
558 +- { USB_VENDOR_ID_SIS, USB_DEVICE_ID_SIS_TS, HID_QUIRK_NO_INIT_REPORTS },
559 ++ { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_HD, HID_QUIRK_NO_INIT_REPORTS },
560 ++ { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD, HID_QUIRK_NO_INIT_REPORTS },
561 ++ { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103, HID_QUIRK_NO_INIT_REPORTS },
562 +
563 + { 0, 0 }
564 + };
565 +diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
566 +index 6edc2db428e9..66c4aee20c72 100644
567 +--- a/drivers/md/raid1.c
568 ++++ b/drivers/md/raid1.c
569 +@@ -94,6 +94,7 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data)
570 + struct pool_info *pi = data;
571 + struct r1bio *r1_bio;
572 + struct bio *bio;
573 ++ int need_pages;
574 + int i, j;
575 +
576 + r1_bio = r1bio_pool_alloc(gfp_flags, pi);
577 +@@ -116,15 +117,15 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data)
578 + * RESYNC_PAGES for each bio.
579 + */
580 + if (test_bit(MD_RECOVERY_REQUESTED, &pi->mddev->recovery))
581 +- j = pi->raid_disks;
582 ++ need_pages = pi->raid_disks;
583 + else
584 +- j = 1;
585 +- while(j--) {
586 ++ need_pages = 1;
587 ++ for (j = 0; j < need_pages; j++) {
588 + bio = r1_bio->bios[j];
589 + bio->bi_vcnt = RESYNC_PAGES;
590 +
591 + if (bio_alloc_pages(bio, gfp_flags))
592 +- goto out_free_bio;
593 ++ goto out_free_pages;
594 + }
595 + /* If not user-requests, copy the page pointers to all bios */
596 + if (!test_bit(MD_RECOVERY_REQUESTED, &pi->mddev->recovery)) {
597 +@@ -138,6 +139,14 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data)
598 +
599 + return r1_bio;
600 +
601 ++out_free_pages:
602 ++ while (--j >= 0) {
603 ++ struct bio_vec *bv;
604 ++
605 ++ bio_for_each_segment_all(bv, r1_bio->bios[j], i)
606 ++ __free_page(bv->bv_page);
607 ++ }
608 ++
609 + out_free_bio:
610 + while (++j < pi->raid_disks)
611 + bio_put(r1_bio->bios[j]);
612 +diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
613 +index dd8057d0bae7..f5a8b9c83ca6 100644
614 +--- a/drivers/net/bonding/bond_main.c
615 ++++ b/drivers/net/bonding/bond_main.c
616 +@@ -4623,6 +4623,7 @@ static int __init bonding_init(void)
617 + out:
618 + return res;
619 + err:
620 ++ bond_destroy_debugfs();
621 + rtnl_link_unregister(&bond_link_ops);
622 + err_link:
623 + unregister_pernet_subsys(&bond_net_ops);
624 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
625 +index 9fbeee522d2c..32c92abf5094 100644
626 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
627 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
628 +@@ -1217,9 +1217,6 @@ static void bnx2x_set_one_vlan_mac_e1h(struct bnx2x *bp,
629 + ETH_VLAN_FILTER_CLASSIFY, config);
630 + }
631 +
632 +-#define list_next_entry(pos, member) \
633 +- list_entry((pos)->member.next, typeof(*(pos)), member)
634 +-
635 + /**
636 + * bnx2x_vlan_mac_restore - reconfigure next MAC/VLAN/VLAN-MAC element
637 + *
638 +diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
639 +index aae7ba66e7bb..65a058967cbb 100644
640 +--- a/drivers/net/ethernet/broadcom/tg3.c
641 ++++ b/drivers/net/ethernet/broadcom/tg3.c
642 +@@ -12197,7 +12197,9 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
643 + if (tg3_flag(tp, MAX_RXPEND_64) &&
644 + tp->rx_pending > 63)
645 + tp->rx_pending = 63;
646 +- tp->rx_jumbo_pending = ering->rx_jumbo_pending;
647 ++
648 ++ if (tg3_flag(tp, JUMBO_RING_ENABLE))
649 ++ tp->rx_jumbo_pending = ering->rx_jumbo_pending;
650 +
651 + for (i = 0; i < tp->irq_max; i++)
652 + tp->napi[i].tx_pending = ering->tx_pending;
653 +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
654 +index 3e2d5047cdb3..d9303d8d9280 100644
655 +--- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c
656 ++++ b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
657 +@@ -55,7 +55,6 @@ int mlx4_en_create_cq(struct mlx4_en_priv *priv,
658 +
659 + cq->ring = ring;
660 + cq->is_tx = mode;
661 +- spin_lock_init(&cq->lock);
662 +
663 + err = mlx4_alloc_hwq_res(mdev->dev, &cq->wqres,
664 + cq->buf_size, 2 * PAGE_SIZE);
665 +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
666 +index fa37b7a61213..35d3821bed50 100644
667 +--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
668 ++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
669 +@@ -1219,15 +1219,11 @@ static void mlx4_en_netpoll(struct net_device *dev)
670 + {
671 + struct mlx4_en_priv *priv = netdev_priv(dev);
672 + struct mlx4_en_cq *cq;
673 +- unsigned long flags;
674 + int i;
675 +
676 + for (i = 0; i < priv->rx_ring_num; i++) {
677 + cq = &priv->rx_cq[i];
678 +- spin_lock_irqsave(&cq->lock, flags);
679 +- napi_synchronize(&cq->napi);
680 +- mlx4_en_process_rx_cq(dev, cq, 0);
681 +- spin_unlock_irqrestore(&cq->lock, flags);
682 ++ napi_schedule(&cq->napi);
683 + }
684 + }
685 + #endif
686 +diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
687 +index bf06e3610d27..a47455fcfb56 100644
688 +--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
689 ++++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
690 +@@ -306,7 +306,6 @@ struct mlx4_en_cq {
691 + struct mlx4_cq mcq;
692 + struct mlx4_hwq_resources wqres;
693 + int ring;
694 +- spinlock_t lock;
695 + struct net_device *dev;
696 + struct napi_struct napi;
697 + int size;
698 +diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c
699 +index 9826594c8a48..65087178a0a7 100644
700 +--- a/drivers/net/ethernet/sfc/nic.c
701 ++++ b/drivers/net/ethernet/sfc/nic.c
702 +@@ -155,13 +155,15 @@ void efx_nic_fini_interrupt(struct efx_nic *efx)
703 + efx->net_dev->rx_cpu_rmap = NULL;
704 + #endif
705 +
706 +- /* Disable MSI/MSI-X interrupts */
707 +- efx_for_each_channel(channel, efx)
708 +- free_irq(channel->irq, &efx->msi_context[channel->channel]);
709 +-
710 +- /* Disable legacy interrupt */
711 +- if (efx->legacy_irq)
712 ++ if (EFX_INT_MODE_USE_MSI(efx)) {
713 ++ /* Disable MSI/MSI-X interrupts */
714 ++ efx_for_each_channel(channel, efx)
715 ++ free_irq(channel->irq,
716 ++ &efx->msi_context[channel->channel]);
717 ++ } else {
718 ++ /* Disable legacy interrupt */
719 + free_irq(efx->legacy_irq, efx);
720 ++ }
721 + }
722 +
723 + /* Register dump */
724 +diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
725 +index 9bf46bd19b87..743aa91c853c 100644
726 +--- a/drivers/net/macvlan.c
727 ++++ b/drivers/net/macvlan.c
728 +@@ -263,11 +263,9 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
729 + const struct macvlan_dev *vlan = netdev_priv(dev);
730 + const struct macvlan_port *port = vlan->port;
731 + const struct macvlan_dev *dest;
732 +- __u8 ip_summed = skb->ip_summed;
733 +
734 + if (vlan->mode == MACVLAN_MODE_BRIDGE) {
735 + const struct ethhdr *eth = (void *)skb->data;
736 +- skb->ip_summed = CHECKSUM_UNNECESSARY;
737 +
738 + /* send to other bridge ports directly */
739 + if (is_multicast_ether_addr(eth->h_dest)) {
740 +@@ -285,7 +283,6 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
741 + }
742 +
743 + xmit_world:
744 +- skb->ip_summed = ip_summed;
745 + skb->dev = vlan->lowerdev;
746 + return dev_queue_xmit(skb);
747 + }
748 +@@ -428,8 +425,10 @@ static void macvlan_change_rx_flags(struct net_device *dev, int change)
749 + struct macvlan_dev *vlan = netdev_priv(dev);
750 + struct net_device *lowerdev = vlan->lowerdev;
751 +
752 +- if (change & IFF_ALLMULTI)
753 +- dev_set_allmulti(lowerdev, dev->flags & IFF_ALLMULTI ? 1 : -1);
754 ++ if (dev->flags & IFF_UP) {
755 ++ if (change & IFF_ALLMULTI)
756 ++ dev_set_allmulti(lowerdev, dev->flags & IFF_ALLMULTI ? 1 : -1);
757 ++ }
758 + }
759 +
760 + static void macvlan_set_mac_lists(struct net_device *dev)
761 +diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
762 +index 5895e4dbbf2a..d0f165f2877b 100644
763 +--- a/drivers/net/macvtap.c
764 ++++ b/drivers/net/macvtap.c
765 +@@ -315,6 +315,15 @@ static int macvtap_forward(struct net_device *dev, struct sk_buff *skb)
766 + segs = nskb;
767 + }
768 + } else {
769 ++ /* If we receive a partial checksum and the tap side
770 ++ * doesn't support checksum offload, compute the checksum.
771 ++ * Note: it doesn't matter which checksum feature to
772 ++ * check, we either support them all or none.
773 ++ */
774 ++ if (skb->ip_summed == CHECKSUM_PARTIAL &&
775 ++ !(features & NETIF_F_ALL_CSUM) &&
776 ++ skb_checksum_help(skb))
777 ++ goto drop;
778 + skb_queue_tail(&q->sk.sk_receive_queue, skb);
779 + }
780 +
781 +diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
782 +index cc70ecfc7062..ad4a94e9ff57 100644
783 +--- a/drivers/net/slip/slip.c
784 ++++ b/drivers/net/slip/slip.c
785 +@@ -429,13 +429,13 @@ static void slip_write_wakeup(struct tty_struct *tty)
786 + if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev))
787 + return;
788 +
789 +- spin_lock(&sl->lock);
790 ++ spin_lock_bh(&sl->lock);
791 + if (sl->xleft <= 0) {
792 + /* Now serial buffer is almost free & we can start
793 + * transmission of another packet */
794 + sl->dev->stats.tx_packets++;
795 + clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
796 +- spin_unlock(&sl->lock);
797 ++ spin_unlock_bh(&sl->lock);
798 + sl_unlock(sl);
799 + return;
800 + }
801 +@@ -443,7 +443,7 @@ static void slip_write_wakeup(struct tty_struct *tty)
802 + actual = tty->ops->write(tty, sl->xhead, sl->xleft);
803 + sl->xleft -= actual;
804 + sl->xhead += actual;
805 +- spin_unlock(&sl->lock);
806 ++ spin_unlock_bh(&sl->lock);
807 + }
808 +
809 + static void sl_tx_timeout(struct net_device *dev)
810 +diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
811 +index 25ba7eca9a13..7cabe4583904 100644
812 +--- a/drivers/net/usb/cdc_mbim.c
813 ++++ b/drivers/net/usb/cdc_mbim.c
814 +@@ -120,6 +120,16 @@ static void cdc_mbim_unbind(struct usbnet *dev, struct usb_interface *intf)
815 + cdc_ncm_unbind(dev, intf);
816 + }
817 +
818 ++/* verify that the ethernet protocol is IPv4 or IPv6 */
819 ++static bool is_ip_proto(__be16 proto)
820 ++{
821 ++ switch (proto) {
822 ++ case htons(ETH_P_IP):
823 ++ case htons(ETH_P_IPV6):
824 ++ return true;
825 ++ }
826 ++ return false;
827 ++}
828 +
829 + static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
830 + {
831 +@@ -128,6 +138,7 @@ static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb
832 + struct cdc_ncm_ctx *ctx = info->ctx;
833 + __le32 sign = cpu_to_le32(USB_CDC_MBIM_NDP16_IPS_SIGN);
834 + u16 tci = 0;
835 ++ bool is_ip;
836 + u8 *c;
837 +
838 + if (!ctx)
839 +@@ -137,25 +148,32 @@ static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb
840 + if (skb->len <= ETH_HLEN)
841 + goto error;
842 +
843 ++ /* Some applications using e.g. packet sockets will
844 ++ * bypass the VLAN acceleration and create tagged
845 ++ * ethernet frames directly. We primarily look for
846 ++ * the accelerated out-of-band tag, but fall back if
847 ++ * required
848 ++ */
849 ++ skb_reset_mac_header(skb);
850 ++ if (vlan_get_tag(skb, &tci) < 0 && skb->len > VLAN_ETH_HLEN &&
851 ++ __vlan_get_tag(skb, &tci) == 0) {
852 ++ is_ip = is_ip_proto(vlan_eth_hdr(skb)->h_vlan_encapsulated_proto);
853 ++ skb_pull(skb, VLAN_ETH_HLEN);
854 ++ } else {
855 ++ is_ip = is_ip_proto(eth_hdr(skb)->h_proto);
856 ++ skb_pull(skb, ETH_HLEN);
857 ++ }
858 ++
859 + /* mapping VLANs to MBIM sessions:
860 + * no tag => IPS session <0>
861 + * 1 - 255 => IPS session <vlanid>
862 + * 256 - 511 => DSS session <vlanid - 256>
863 + * 512 - 4095 => unsupported, drop
864 + */
865 +- vlan_get_tag(skb, &tci);
866 +-
867 + switch (tci & 0x0f00) {
868 + case 0x0000: /* VLAN ID 0 - 255 */
869 +- /* verify that datagram is IPv4 or IPv6 */
870 +- skb_reset_mac_header(skb);
871 +- switch (eth_hdr(skb)->h_proto) {
872 +- case htons(ETH_P_IP):
873 +- case htons(ETH_P_IPV6):
874 +- break;
875 +- default:
876 ++ if (!is_ip)
877 + goto error;
878 +- }
879 + c = (u8 *)&sign;
880 + c[3] = tci;
881 + break;
882 +@@ -169,7 +187,6 @@ static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb
883 + "unsupported tci=0x%04x\n", tci);
884 + goto error;
885 + }
886 +- skb_pull(skb, ETH_HLEN);
887 + }
888 +
889 + spin_lock_bh(&ctx->mtx);
890 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
891 +index 558469fda3b7..dca474319c8a 100644
892 +--- a/drivers/net/usb/qmi_wwan.c
893 ++++ b/drivers/net/usb/qmi_wwan.c
894 +@@ -649,6 +649,22 @@ static const struct usb_device_id products[] = {
895 + {QMI_FIXED_INTF(0x05c6, 0x920d, 5)},
896 + {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */
897 + {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */
898 ++ {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */
899 ++ {QMI_FIXED_INTF(0x16d8, 0x6007, 0)}, /* CMOTech CHE-628S */
900 ++ {QMI_FIXED_INTF(0x16d8, 0x6008, 0)}, /* CMOTech CMU-301 */
901 ++ {QMI_FIXED_INTF(0x16d8, 0x6280, 0)}, /* CMOTech CHU-628 */
902 ++ {QMI_FIXED_INTF(0x16d8, 0x7001, 0)}, /* CMOTech CHU-720S */
903 ++ {QMI_FIXED_INTF(0x16d8, 0x7002, 0)}, /* CMOTech 7002 */
904 ++ {QMI_FIXED_INTF(0x16d8, 0x7003, 4)}, /* CMOTech CHU-629K */
905 ++ {QMI_FIXED_INTF(0x16d8, 0x7004, 3)}, /* CMOTech 7004 */
906 ++ {QMI_FIXED_INTF(0x16d8, 0x7006, 5)}, /* CMOTech CGU-629 */
907 ++ {QMI_FIXED_INTF(0x16d8, 0x700a, 4)}, /* CMOTech CHU-629S */
908 ++ {QMI_FIXED_INTF(0x16d8, 0x7211, 0)}, /* CMOTech CHU-720I */
909 ++ {QMI_FIXED_INTF(0x16d8, 0x7212, 0)}, /* CMOTech 7212 */
910 ++ {QMI_FIXED_INTF(0x16d8, 0x7213, 0)}, /* CMOTech 7213 */
911 ++ {QMI_FIXED_INTF(0x16d8, 0x7251, 1)}, /* CMOTech 7251 */
912 ++ {QMI_FIXED_INTF(0x16d8, 0x7252, 1)}, /* CMOTech 7252 */
913 ++ {QMI_FIXED_INTF(0x16d8, 0x7253, 1)}, /* CMOTech 7253 */
914 + {QMI_FIXED_INTF(0x19d2, 0x0002, 1)},
915 + {QMI_FIXED_INTF(0x19d2, 0x0012, 1)},
916 + {QMI_FIXED_INTF(0x19d2, 0x0017, 3)},
917 +@@ -699,6 +715,7 @@ static const struct usb_device_id products[] = {
918 + {QMI_FIXED_INTF(0x19d2, 0x1255, 3)},
919 + {QMI_FIXED_INTF(0x19d2, 0x1255, 4)},
920 + {QMI_FIXED_INTF(0x19d2, 0x1256, 4)},
921 ++ {QMI_FIXED_INTF(0x19d2, 0x1270, 5)}, /* ZTE MF667 */
922 + {QMI_FIXED_INTF(0x19d2, 0x1401, 2)},
923 + {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */
924 + {QMI_FIXED_INTF(0x19d2, 0x1424, 2)},
925 +@@ -709,14 +726,28 @@ static const struct usb_device_id products[] = {
926 + {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
927 + {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
928 + {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */
929 ++ {QMI_FIXED_INTF(0x1199, 0x68c0, 8)}, /* Sierra Wireless MC73xx */
930 ++ {QMI_FIXED_INTF(0x1199, 0x68c0, 10)}, /* Sierra Wireless MC73xx */
931 ++ {QMI_FIXED_INTF(0x1199, 0x68c0, 11)}, /* Sierra Wireless MC73xx */
932 + {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */
933 ++ {QMI_FIXED_INTF(0x1199, 0x901f, 8)}, /* Sierra Wireless EM7355 */
934 ++ {QMI_FIXED_INTF(0x1199, 0x9041, 8)}, /* Sierra Wireless MC7305/MC7355 */
935 + {QMI_FIXED_INTF(0x1199, 0x9051, 8)}, /* Netgear AirCard 340U */
936 + {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
937 ++ {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */
938 + {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
939 + {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */
940 + {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
941 ++ {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */
942 + {QMI_FIXED_INTF(0x0b3c, 0xc005, 6)}, /* Olivetti Olicard 200 */
943 ++ {QMI_FIXED_INTF(0x0b3c, 0xc00b, 4)}, /* Olivetti Olicard 500 */
944 + {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */
945 ++ {QMI_FIXED_INTF(0x1e2d, 0x0053, 4)}, /* Cinterion PHxx,PXxx */
946 ++ {QMI_FIXED_INTF(0x413c, 0x81a2, 8)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */
947 ++ {QMI_FIXED_INTF(0x413c, 0x81a3, 8)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */
948 ++ {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
949 ++ {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */
950 ++ {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
951 +
952 + /* 4. Gobi 1000 devices */
953 + {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
954 +diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
955 +index dfffd0f37916..a70692779a16 100644
956 +--- a/drivers/scsi/megaraid/megaraid_mm.c
957 ++++ b/drivers/scsi/megaraid/megaraid_mm.c
958 +@@ -486,6 +486,8 @@ mimd_to_kioc(mimd_t __user *umimd, mraid_mmadp_t *adp, uioc_t *kioc)
959 +
960 + pthru32->dataxferaddr = kioc->buf_paddr;
961 + if (kioc->data_dir & UIOC_WR) {
962 ++ if (pthru32->dataxferlen > kioc->xferlen)
963 ++ return -EINVAL;
964 + if (copy_from_user(kioc->buf_vaddr, kioc->user_data,
965 + pthru32->dataxferlen)) {
966 + return (-EFAULT);
967 +diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
968 +index 307a81137607..4109530e92a0 100644
969 +--- a/drivers/scsi/scsi_scan.c
970 ++++ b/drivers/scsi/scsi_scan.c
971 +@@ -320,6 +320,7 @@ static void scsi_target_destroy(struct scsi_target *starget)
972 + struct Scsi_Host *shost = dev_to_shost(dev->parent);
973 + unsigned long flags;
974 +
975 ++ starget->state = STARGET_DEL;
976 + transport_destroy_device(dev);
977 + spin_lock_irqsave(shost->host_lock, flags);
978 + if (shost->hostt->target_destroy)
979 +@@ -371,6 +372,37 @@ static struct scsi_target *__scsi_find_target(struct device *parent,
980 + }
981 +
982 + /**
983 ++ * scsi_target_reap_ref_release - remove target from visibility
984 ++ * @kref: the reap_ref in the target being released
985 ++ *
986 ++ * Called on last put of reap_ref, which is the indication that no device
987 ++ * under this target is visible anymore, so render the target invisible in
988 ++ * sysfs. Note: we have to be in user context here because the target reaps
989 ++ * should be done in places where the scsi device visibility is being removed.
990 ++ */
991 ++static void scsi_target_reap_ref_release(struct kref *kref)
992 ++{
993 ++ struct scsi_target *starget
994 ++ = container_of(kref, struct scsi_target, reap_ref);
995 ++
996 ++ /*
997 ++ * if we get here and the target is still in the CREATED state that
998 ++ * means it was allocated but never made visible (because a scan
999 ++ * turned up no LUNs), so don't call device_del() on it.
1000 ++ */
1001 ++ if (starget->state != STARGET_CREATED) {
1002 ++ transport_remove_device(&starget->dev);
1003 ++ device_del(&starget->dev);
1004 ++ }
1005 ++ scsi_target_destroy(starget);
1006 ++}
1007 ++
1008 ++static void scsi_target_reap_ref_put(struct scsi_target *starget)
1009 ++{
1010 ++ kref_put(&starget->reap_ref, scsi_target_reap_ref_release);
1011 ++}
1012 ++
1013 ++/**
1014 + * scsi_alloc_target - allocate a new or find an existing target
1015 + * @parent: parent of the target (need not be a scsi host)
1016 + * @channel: target channel number (zero if no channels)
1017 +@@ -392,7 +424,7 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
1018 + + shost->transportt->target_size;
1019 + struct scsi_target *starget;
1020 + struct scsi_target *found_target;
1021 +- int error;
1022 ++ int error, ref_got;
1023 +
1024 + starget = kzalloc(size, GFP_KERNEL);
1025 + if (!starget) {
1026 +@@ -401,7 +433,7 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
1027 + }
1028 + dev = &starget->dev;
1029 + device_initialize(dev);
1030 +- starget->reap_ref = 1;
1031 ++ kref_init(&starget->reap_ref);
1032 + dev->parent = get_device(parent);
1033 + dev_set_name(dev, "target%d:%d:%d", shost->host_no, channel, id);
1034 + dev->bus = &scsi_bus_type;
1035 +@@ -441,29 +473,36 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
1036 + return starget;
1037 +
1038 + found:
1039 +- found_target->reap_ref++;
1040 ++ /*
1041 ++ * release routine already fired if kref is zero, so if we can still
1042 ++ * take the reference, the target must be alive. If we can't, it must
1043 ++ * be dying and we need to wait for a new target
1044 ++ */
1045 ++ ref_got = kref_get_unless_zero(&found_target->reap_ref);
1046 ++
1047 + spin_unlock_irqrestore(shost->host_lock, flags);
1048 +- if (found_target->state != STARGET_DEL) {
1049 ++ if (ref_got) {
1050 + put_device(dev);
1051 + return found_target;
1052 + }
1053 +- /* Unfortunately, we found a dying target; need to
1054 +- * wait until it's dead before we can get a new one */
1055 ++ /*
1056 ++ * Unfortunately, we found a dying target; need to wait until it's
1057 ++ * dead before we can get a new one. There is an anomaly here. We
1058 ++ * *should* call scsi_target_reap() to balance the kref_get() of the
1059 ++ * reap_ref above. However, since the target being released, it's
1060 ++ * already invisible and the reap_ref is irrelevant. If we call
1061 ++ * scsi_target_reap() we might spuriously do another device_del() on
1062 ++ * an already invisible target.
1063 ++ */
1064 + put_device(&found_target->dev);
1065 +- flush_scheduled_work();
1066 ++ /*
1067 ++ * length of time is irrelevant here, we just want to yield the CPU
1068 ++ * for a tick to avoid busy waiting for the target to die.
1069 ++ */
1070 ++ msleep(1);
1071 + goto retry;
1072 + }
1073 +
1074 +-static void scsi_target_reap_usercontext(struct work_struct *work)
1075 +-{
1076 +- struct scsi_target *starget =
1077 +- container_of(work, struct scsi_target, ew.work);
1078 +-
1079 +- transport_remove_device(&starget->dev);
1080 +- device_del(&starget->dev);
1081 +- scsi_target_destroy(starget);
1082 +-}
1083 +-
1084 + /**
1085 + * scsi_target_reap - check to see if target is in use and destroy if not
1086 + * @starget: target to be checked
1087 +@@ -474,28 +513,13 @@ static void scsi_target_reap_usercontext(struct work_struct *work)
1088 + */
1089 + void scsi_target_reap(struct scsi_target *starget)
1090 + {
1091 +- struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
1092 +- unsigned long flags;
1093 +- enum scsi_target_state state;
1094 +- int empty = 0;
1095 +-
1096 +- spin_lock_irqsave(shost->host_lock, flags);
1097 +- state = starget->state;
1098 +- if (--starget->reap_ref == 0 && list_empty(&starget->devices)) {
1099 +- empty = 1;
1100 +- starget->state = STARGET_DEL;
1101 +- }
1102 +- spin_unlock_irqrestore(shost->host_lock, flags);
1103 +-
1104 +- if (!empty)
1105 +- return;
1106 +-
1107 +- BUG_ON(state == STARGET_DEL);
1108 +- if (state == STARGET_CREATED)
1109 +- scsi_target_destroy(starget);
1110 +- else
1111 +- execute_in_process_context(scsi_target_reap_usercontext,
1112 +- &starget->ew);
1113 ++ /*
1114 ++ * serious problem if this triggers: STARGET_DEL is only set in the if
1115 ++ * the reap_ref drops to zero, so we're trying to do another final put
1116 ++ * on an already released kref
1117 ++ */
1118 ++ BUG_ON(starget->state == STARGET_DEL);
1119 ++ scsi_target_reap_ref_put(starget);
1120 + }
1121 +
1122 + /**
1123 +@@ -1532,6 +1556,10 @@ struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
1124 + }
1125 + mutex_unlock(&shost->scan_mutex);
1126 + scsi_autopm_put_target(starget);
1127 ++ /*
1128 ++ * paired with scsi_alloc_target(). Target will be destroyed unless
1129 ++ * scsi_probe_and_add_lun made an underlying device visible
1130 ++ */
1131 + scsi_target_reap(starget);
1132 + put_device(&starget->dev);
1133 +
1134 +@@ -1612,8 +1640,10 @@ static void __scsi_scan_target(struct device *parent, unsigned int channel,
1135 +
1136 + out_reap:
1137 + scsi_autopm_put_target(starget);
1138 +- /* now determine if the target has any children at all
1139 +- * and if not, nuke it */
1140 ++ /*
1141 ++ * paired with scsi_alloc_target(): determine if the target has
1142 ++ * any children at all and if not, nuke it
1143 ++ */
1144 + scsi_target_reap(starget);
1145 +
1146 + put_device(&starget->dev);
1147 +diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
1148 +index 40c639491b27..dfb007c95b98 100644
1149 +--- a/drivers/scsi/scsi_sysfs.c
1150 ++++ b/drivers/scsi/scsi_sysfs.c
1151 +@@ -332,17 +332,14 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
1152 + {
1153 + struct scsi_device *sdev;
1154 + struct device *parent;
1155 +- struct scsi_target *starget;
1156 + struct list_head *this, *tmp;
1157 + unsigned long flags;
1158 +
1159 + sdev = container_of(work, struct scsi_device, ew.work);
1160 +
1161 + parent = sdev->sdev_gendev.parent;
1162 +- starget = to_scsi_target(parent);
1163 +
1164 + spin_lock_irqsave(sdev->host->host_lock, flags);
1165 +- starget->reap_ref++;
1166 + list_del(&sdev->siblings);
1167 + list_del(&sdev->same_target_siblings);
1168 + list_del(&sdev->starved_entry);
1169 +@@ -362,8 +359,6 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
1170 + /* NULL queue means the device can't be used */
1171 + sdev->request_queue = NULL;
1172 +
1173 +- scsi_target_reap(scsi_target(sdev));
1174 +-
1175 + kfree(sdev->inquiry);
1176 + kfree(sdev);
1177 +
1178 +@@ -1018,6 +1013,13 @@ void __scsi_remove_device(struct scsi_device *sdev)
1179 + sdev->host->hostt->slave_destroy(sdev);
1180 + transport_destroy_device(dev);
1181 +
1182 ++ /*
1183 ++ * Paired with the kref_get() in scsi_sysfs_initialize(). We have
1184 ++ * remoed sysfs visibility from the device, so make the target
1185 ++ * invisible if this was the last device underneath it.
1186 ++ */
1187 ++ scsi_target_reap(scsi_target(sdev));
1188 ++
1189 + put_device(dev);
1190 + }
1191 +
1192 +@@ -1080,7 +1082,7 @@ void scsi_remove_target(struct device *dev)
1193 + continue;
1194 + if (starget->dev.parent == dev || &starget->dev == dev) {
1195 + /* assuming new targets arrive at the end */
1196 +- starget->reap_ref++;
1197 ++ kref_get(&starget->reap_ref);
1198 + spin_unlock_irqrestore(shost->host_lock, flags);
1199 + if (last)
1200 + scsi_target_reap(last);
1201 +@@ -1164,6 +1166,12 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)
1202 + list_add_tail(&sdev->same_target_siblings, &starget->devices);
1203 + list_add_tail(&sdev->siblings, &shost->__devices);
1204 + spin_unlock_irqrestore(shost->host_lock, flags);
1205 ++ /*
1206 ++ * device can now only be removed via __scsi_remove_device() so hold
1207 ++ * the target. Target will be held in CREATED state until something
1208 ++ * beneath it becomes visible (in which case it moves to RUNNING)
1209 ++ */
1210 ++ kref_get(&starget->reap_ref);
1211 + }
1212 +
1213 + int scsi_is_sdev_device(const struct device *dev)
1214 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
1215 +index e8404319ca68..0b5e381bcbe6 100644
1216 +--- a/drivers/usb/class/cdc-acm.c
1217 ++++ b/drivers/usb/class/cdc-acm.c
1218 +@@ -1560,13 +1560,27 @@ static const struct usb_device_id acm_ids[] = {
1219 + },
1220 + /* Motorola H24 HSPA module: */
1221 + { USB_DEVICE(0x22b8, 0x2d91) }, /* modem */
1222 +- { USB_DEVICE(0x22b8, 0x2d92) }, /* modem + diagnostics */
1223 +- { USB_DEVICE(0x22b8, 0x2d93) }, /* modem + AT port */
1224 +- { USB_DEVICE(0x22b8, 0x2d95) }, /* modem + AT port + diagnostics */
1225 +- { USB_DEVICE(0x22b8, 0x2d96) }, /* modem + NMEA */
1226 +- { USB_DEVICE(0x22b8, 0x2d97) }, /* modem + diagnostics + NMEA */
1227 +- { USB_DEVICE(0x22b8, 0x2d99) }, /* modem + AT port + NMEA */
1228 +- { USB_DEVICE(0x22b8, 0x2d9a) }, /* modem + AT port + diagnostics + NMEA */
1229 ++ { USB_DEVICE(0x22b8, 0x2d92), /* modem + diagnostics */
1230 ++ .driver_info = NO_UNION_NORMAL, /* handle only modem interface */
1231 ++ },
1232 ++ { USB_DEVICE(0x22b8, 0x2d93), /* modem + AT port */
1233 ++ .driver_info = NO_UNION_NORMAL, /* handle only modem interface */
1234 ++ },
1235 ++ { USB_DEVICE(0x22b8, 0x2d95), /* modem + AT port + diagnostics */
1236 ++ .driver_info = NO_UNION_NORMAL, /* handle only modem interface */
1237 ++ },
1238 ++ { USB_DEVICE(0x22b8, 0x2d96), /* modem + NMEA */
1239 ++ .driver_info = NO_UNION_NORMAL, /* handle only modem interface */
1240 ++ },
1241 ++ { USB_DEVICE(0x22b8, 0x2d97), /* modem + diagnostics + NMEA */
1242 ++ .driver_info = NO_UNION_NORMAL, /* handle only modem interface */
1243 ++ },
1244 ++ { USB_DEVICE(0x22b8, 0x2d99), /* modem + AT port + NMEA */
1245 ++ .driver_info = NO_UNION_NORMAL, /* handle only modem interface */
1246 ++ },
1247 ++ { USB_DEVICE(0x22b8, 0x2d9a), /* modem + AT port + diagnostics + NMEA */
1248 ++ .driver_info = NO_UNION_NORMAL, /* handle only modem interface */
1249 ++ },
1250 +
1251 + { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */
1252 + .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on
1253 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1254 +index cbecb5ff7d90..1dbfb52dbcd6 100644
1255 +--- a/drivers/usb/host/xhci-ring.c
1256 ++++ b/drivers/usb/host/xhci-ring.c
1257 +@@ -552,9 +552,9 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci,
1258 + struct xhci_dequeue_state *state)
1259 + {
1260 + struct xhci_virt_device *dev = xhci->devs[slot_id];
1261 ++ struct xhci_virt_ep *ep = &dev->eps[ep_index];
1262 + struct xhci_ring *ep_ring;
1263 + struct xhci_generic_trb *trb;
1264 +- struct xhci_ep_ctx *ep_ctx;
1265 + dma_addr_t addr;
1266 + u64 hw_dequeue;
1267 +
1268 +@@ -570,8 +570,16 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci,
1269 + /* Dig out the cycle state saved by the xHC during the stop ep cmd */
1270 + xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
1271 + "Finding endpoint context");
1272 +- ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index);
1273 +- hw_dequeue = le64_to_cpu(ep_ctx->deq);
1274 ++ /* 4.6.9 the css flag is written to the stream context for streams */
1275 ++ if (ep->ep_state & EP_HAS_STREAMS) {
1276 ++ struct xhci_stream_ctx *ctx =
1277 ++ &ep->stream_info->stream_ctx_array[stream_id];
1278 ++ hw_dequeue = le64_to_cpu(ctx->stream_ring);
1279 ++ } else {
1280 ++ struct xhci_ep_ctx *ep_ctx
1281 ++ = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index);
1282 ++ hw_dequeue = le64_to_cpu(ep_ctx->deq);
1283 ++ }
1284 +
1285 + /* Find virtual address and segment of hardware dequeue pointer */
1286 + state->new_deq_seg = ep_ring->deq_seg;
1287 +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1288 +index 6987b535aa98..71873cafb9d3 100644
1289 +--- a/drivers/usb/serial/cp210x.c
1290 ++++ b/drivers/usb/serial/cp210x.c
1291 +@@ -104,6 +104,7 @@ static const struct usb_device_id id_table[] = {
1292 + { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
1293 + { USB_DEVICE(0x10C4, 0x822B) }, /* Modem EDGE(GSM) Comander 2 */
1294 + { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */
1295 ++ { USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */
1296 + { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */
1297 + { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */
1298 + { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
1299 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1300 +index b7f715fead15..c94be8c051c0 100644
1301 +--- a/drivers/usb/serial/ftdi_sio.c
1302 ++++ b/drivers/usb/serial/ftdi_sio.c
1303 +@@ -910,6 +910,39 @@ static struct usb_device_id id_table_combined [] = {
1304 + { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) },
1305 + /* Cressi Devices */
1306 + { USB_DEVICE(FTDI_VID, FTDI_CRESSI_PID) },
1307 ++ /* Brainboxes Devices */
1308 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_001_PID) },
1309 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_012_PID) },
1310 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_023_PID) },
1311 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_034_PID) },
1312 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_101_PID) },
1313 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_1_PID) },
1314 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_2_PID) },
1315 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_3_PID) },
1316 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_4_PID) },
1317 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_5_PID) },
1318 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_6_PID) },
1319 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_7_PID) },
1320 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_8_PID) },
1321 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_257_PID) },
1322 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_1_PID) },
1323 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_2_PID) },
1324 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_3_PID) },
1325 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_4_PID) },
1326 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_313_PID) },
1327 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_324_PID) },
1328 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_346_1_PID) },
1329 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_346_2_PID) },
1330 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_357_PID) },
1331 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_1_PID) },
1332 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_2_PID) },
1333 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_3_PID) },
1334 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_701_1_PID) },
1335 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_701_2_PID) },
1336 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_1_PID) },
1337 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) },
1338 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) },
1339 ++ { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) },
1340 + { } /* Terminating entry */
1341 + };
1342 +
1343 +diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1344 +index e599fbfcde5f..993c93df6874 100644
1345 +--- a/drivers/usb/serial/ftdi_sio_ids.h
1346 ++++ b/drivers/usb/serial/ftdi_sio_ids.h
1347 +@@ -1326,3 +1326,40 @@
1348 + * Manufacturer: Cressi
1349 + */
1350 + #define FTDI_CRESSI_PID 0x87d0
1351 ++
1352 ++/*
1353 ++ * Brainboxes devices
1354 ++ */
1355 ++#define BRAINBOXES_VID 0x05d1
1356 ++#define BRAINBOXES_VX_001_PID 0x1001 /* VX-001 ExpressCard 1 Port RS232 */
1357 ++#define BRAINBOXES_VX_012_PID 0x1002 /* VX-012 ExpressCard 2 Port RS232 */
1358 ++#define BRAINBOXES_VX_023_PID 0x1003 /* VX-023 ExpressCard 1 Port RS422/485 */
1359 ++#define BRAINBOXES_VX_034_PID 0x1004 /* VX-034 ExpressCard 2 Port RS422/485 */
1360 ++#define BRAINBOXES_US_101_PID 0x1011 /* US-101 1xRS232 */
1361 ++#define BRAINBOXES_US_324_PID 0x1013 /* US-324 1xRS422/485 1Mbaud */
1362 ++#define BRAINBOXES_US_606_1_PID 0x2001 /* US-606 6 Port RS232 Serial Port 1 and 2 */
1363 ++#define BRAINBOXES_US_606_2_PID 0x2002 /* US-606 6 Port RS232 Serial Port 3 and 4 */
1364 ++#define BRAINBOXES_US_606_3_PID 0x2003 /* US-606 6 Port RS232 Serial Port 4 and 6 */
1365 ++#define BRAINBOXES_US_701_1_PID 0x2011 /* US-701 4xRS232 1Mbaud Port 1 and 2 */
1366 ++#define BRAINBOXES_US_701_2_PID 0x2012 /* US-701 4xRS422 1Mbaud Port 3 and 4 */
1367 ++#define BRAINBOXES_US_279_1_PID 0x2021 /* US-279 8xRS422 1Mbaud Port 1 and 2 */
1368 ++#define BRAINBOXES_US_279_2_PID 0x2022 /* US-279 8xRS422 1Mbaud Port 3 and 4 */
1369 ++#define BRAINBOXES_US_279_3_PID 0x2023 /* US-279 8xRS422 1Mbaud Port 5 and 6 */
1370 ++#define BRAINBOXES_US_279_4_PID 0x2024 /* US-279 8xRS422 1Mbaud Port 7 and 8 */
1371 ++#define BRAINBOXES_US_346_1_PID 0x3011 /* US-346 4xRS422/485 1Mbaud Port 1 and 2 */
1372 ++#define BRAINBOXES_US_346_2_PID 0x3012 /* US-346 4xRS422/485 1Mbaud Port 3 and 4 */
1373 ++#define BRAINBOXES_US_257_PID 0x5001 /* US-257 2xRS232 1Mbaud */
1374 ++#define BRAINBOXES_US_313_PID 0x6001 /* US-313 2xRS422/485 1Mbaud */
1375 ++#define BRAINBOXES_US_357_PID 0x7001 /* US_357 1xRS232/422/485 */
1376 ++#define BRAINBOXES_US_842_1_PID 0x8001 /* US-842 8xRS422/485 1Mbaud Port 1 and 2 */
1377 ++#define BRAINBOXES_US_842_2_PID 0x8002 /* US-842 8xRS422/485 1Mbaud Port 3 and 4 */
1378 ++#define BRAINBOXES_US_842_3_PID 0x8003 /* US-842 8xRS422/485 1Mbaud Port 5 and 6 */
1379 ++#define BRAINBOXES_US_842_4_PID 0x8004 /* US-842 8xRS422/485 1Mbaud Port 7 and 8 */
1380 ++#define BRAINBOXES_US_160_1_PID 0x9001 /* US-160 16xRS232 1Mbaud Port 1 and 2 */
1381 ++#define BRAINBOXES_US_160_2_PID 0x9002 /* US-160 16xRS232 1Mbaud Port 3 and 4 */
1382 ++#define BRAINBOXES_US_160_3_PID 0x9003 /* US-160 16xRS232 1Mbaud Port 5 and 6 */
1383 ++#define BRAINBOXES_US_160_4_PID 0x9004 /* US-160 16xRS232 1Mbaud Port 7 and 8 */
1384 ++#define BRAINBOXES_US_160_5_PID 0x9005 /* US-160 16xRS232 1Mbaud Port 9 and 10 */
1385 ++#define BRAINBOXES_US_160_6_PID 0x9006 /* US-160 16xRS232 1Mbaud Port 11 and 12 */
1386 ++#define BRAINBOXES_US_160_7_PID 0x9007 /* US-160 16xRS232 1Mbaud Port 13 and 14 */
1387 ++#define BRAINBOXES_US_160_8_PID 0x9008 /* US-160 16xRS232 1Mbaud Port 15 and 16 */
1388 +diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
1389 +index b7187bf32469..1c7bc5249cc1 100644
1390 +--- a/drivers/usb/serial/io_ti.c
1391 ++++ b/drivers/usb/serial/io_ti.c
1392 +@@ -29,6 +29,7 @@
1393 + #include <linux/spinlock.h>
1394 + #include <linux/mutex.h>
1395 + #include <linux/serial.h>
1396 ++#include <linux/swab.h>
1397 + #include <linux/kfifo.h>
1398 + #include <linux/ioctl.h>
1399 + #include <linux/firmware.h>
1400 +@@ -281,7 +282,7 @@ static int read_download_mem(struct usb_device *dev, int start_address,
1401 + {
1402 + int status = 0;
1403 + __u8 read_length;
1404 +- __be16 be_start_address;
1405 ++ u16 be_start_address;
1406 +
1407 + dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, length);
1408 +
1409 +@@ -297,10 +298,14 @@ static int read_download_mem(struct usb_device *dev, int start_address,
1410 + if (read_length > 1) {
1411 + dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, read_length);
1412 + }
1413 +- be_start_address = cpu_to_be16(start_address);
1414 ++ /*
1415 ++ * NOTE: Must use swab as wIndex is sent in little-endian
1416 ++ * byte order regardless of host byte order.
1417 ++ */
1418 ++ be_start_address = swab16((u16)start_address);
1419 + status = ti_vread_sync(dev, UMPC_MEMORY_READ,
1420 + (__u16)address_type,
1421 +- (__force __u16)be_start_address,
1422 ++ be_start_address,
1423 + buffer, read_length);
1424 +
1425 + if (status) {
1426 +@@ -397,7 +402,7 @@ static int write_i2c_mem(struct edgeport_serial *serial,
1427 + struct device *dev = &serial->serial->dev->dev;
1428 + int status = 0;
1429 + int write_length;
1430 +- __be16 be_start_address;
1431 ++ u16 be_start_address;
1432 +
1433 + /* We can only send a maximum of 1 aligned byte page at a time */
1434 +
1435 +@@ -412,11 +417,16 @@ static int write_i2c_mem(struct edgeport_serial *serial,
1436 + __func__, start_address, write_length);
1437 + usb_serial_debug_data(dev, __func__, write_length, buffer);
1438 +
1439 +- /* Write first page */
1440 +- be_start_address = cpu_to_be16(start_address);
1441 ++ /*
1442 ++ * Write first page.
1443 ++ *
1444 ++ * NOTE: Must use swab as wIndex is sent in little-endian byte order
1445 ++ * regardless of host byte order.
1446 ++ */
1447 ++ be_start_address = swab16((u16)start_address);
1448 + status = ti_vsend_sync(serial->serial->dev,
1449 + UMPC_MEMORY_WRITE, (__u16)address_type,
1450 +- (__force __u16)be_start_address,
1451 ++ be_start_address,
1452 + buffer, write_length);
1453 + if (status) {
1454 + dev_dbg(dev, "%s - ERROR %d\n", __func__, status);
1455 +@@ -439,11 +449,16 @@ static int write_i2c_mem(struct edgeport_serial *serial,
1456 + __func__, start_address, write_length);
1457 + usb_serial_debug_data(dev, __func__, write_length, buffer);
1458 +
1459 +- /* Write next page */
1460 +- be_start_address = cpu_to_be16(start_address);
1461 ++ /*
1462 ++ * Write next page.
1463 ++ *
1464 ++ * NOTE: Must use swab as wIndex is sent in little-endian byte
1465 ++ * order regardless of host byte order.
1466 ++ */
1467 ++ be_start_address = swab16((u16)start_address);
1468 + status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE,
1469 + (__u16)address_type,
1470 +- (__force __u16)be_start_address,
1471 ++ be_start_address,
1472 + buffer, write_length);
1473 + if (status) {
1474 + dev_err(dev, "%s - ERROR %d\n", __func__, status);
1475 +@@ -590,8 +605,8 @@ static int get_descriptor_addr(struct edgeport_serial *serial,
1476 + if (rom_desc->Type == desc_type)
1477 + return start_address;
1478 +
1479 +- start_address = start_address + sizeof(struct ti_i2c_desc)
1480 +- + rom_desc->Size;
1481 ++ start_address = start_address + sizeof(struct ti_i2c_desc) +
1482 ++ le16_to_cpu(rom_desc->Size);
1483 +
1484 + } while ((start_address < TI_MAX_I2C_SIZE) && rom_desc->Type);
1485 +
1486 +@@ -604,7 +619,7 @@ static int valid_csum(struct ti_i2c_desc *rom_desc, __u8 *buffer)
1487 + __u16 i;
1488 + __u8 cs = 0;
1489 +
1490 +- for (i = 0; i < rom_desc->Size; i++)
1491 ++ for (i = 0; i < le16_to_cpu(rom_desc->Size); i++)
1492 + cs = (__u8)(cs + buffer[i]);
1493 +
1494 + if (cs != rom_desc->CheckSum) {
1495 +@@ -658,7 +673,7 @@ static int check_i2c_image(struct edgeport_serial *serial)
1496 + break;
1497 +
1498 + if ((start_address + sizeof(struct ti_i2c_desc) +
1499 +- rom_desc->Size) > TI_MAX_I2C_SIZE) {
1500 ++ le16_to_cpu(rom_desc->Size)) > TI_MAX_I2C_SIZE) {
1501 + status = -ENODEV;
1502 + dev_dbg(dev, "%s - structure too big, erroring out.\n", __func__);
1503 + break;
1504 +@@ -673,7 +688,8 @@ static int check_i2c_image(struct edgeport_serial *serial)
1505 + /* Read the descriptor data */
1506 + status = read_rom(serial, start_address +
1507 + sizeof(struct ti_i2c_desc),
1508 +- rom_desc->Size, buffer);
1509 ++ le16_to_cpu(rom_desc->Size),
1510 ++ buffer);
1511 + if (status)
1512 + break;
1513 +
1514 +@@ -682,7 +698,7 @@ static int check_i2c_image(struct edgeport_serial *serial)
1515 + break;
1516 + }
1517 + start_address = start_address + sizeof(struct ti_i2c_desc) +
1518 +- rom_desc->Size;
1519 ++ le16_to_cpu(rom_desc->Size);
1520 +
1521 + } while ((rom_desc->Type != I2C_DESC_TYPE_ION) &&
1522 + (start_address < TI_MAX_I2C_SIZE));
1523 +@@ -721,7 +737,7 @@ static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer)
1524 +
1525 + /* Read the descriptor data */
1526 + status = read_rom(serial, start_address+sizeof(struct ti_i2c_desc),
1527 +- rom_desc->Size, buffer);
1528 ++ le16_to_cpu(rom_desc->Size), buffer);
1529 + if (status)
1530 + goto exit;
1531 +
1532 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1533 +index 68fc9fe65936..f213ee978516 100644
1534 +--- a/drivers/usb/serial/option.c
1535 ++++ b/drivers/usb/serial/option.c
1536 +@@ -234,8 +234,31 @@ static void option_instat_callback(struct urb *urb);
1537 + #define QUALCOMM_VENDOR_ID 0x05C6
1538 +
1539 + #define CMOTECH_VENDOR_ID 0x16d8
1540 +-#define CMOTECH_PRODUCT_6008 0x6008
1541 +-#define CMOTECH_PRODUCT_6280 0x6280
1542 ++#define CMOTECH_PRODUCT_6001 0x6001
1543 ++#define CMOTECH_PRODUCT_CMU_300 0x6002
1544 ++#define CMOTECH_PRODUCT_6003 0x6003
1545 ++#define CMOTECH_PRODUCT_6004 0x6004
1546 ++#define CMOTECH_PRODUCT_6005 0x6005
1547 ++#define CMOTECH_PRODUCT_CGU_628A 0x6006
1548 ++#define CMOTECH_PRODUCT_CHE_628S 0x6007
1549 ++#define CMOTECH_PRODUCT_CMU_301 0x6008
1550 ++#define CMOTECH_PRODUCT_CHU_628 0x6280
1551 ++#define CMOTECH_PRODUCT_CHU_628S 0x6281
1552 ++#define CMOTECH_PRODUCT_CDU_680 0x6803
1553 ++#define CMOTECH_PRODUCT_CDU_685A 0x6804
1554 ++#define CMOTECH_PRODUCT_CHU_720S 0x7001
1555 ++#define CMOTECH_PRODUCT_7002 0x7002
1556 ++#define CMOTECH_PRODUCT_CHU_629K 0x7003
1557 ++#define CMOTECH_PRODUCT_7004 0x7004
1558 ++#define CMOTECH_PRODUCT_7005 0x7005
1559 ++#define CMOTECH_PRODUCT_CGU_629 0x7006
1560 ++#define CMOTECH_PRODUCT_CHU_629S 0x700a
1561 ++#define CMOTECH_PRODUCT_CHU_720I 0x7211
1562 ++#define CMOTECH_PRODUCT_7212 0x7212
1563 ++#define CMOTECH_PRODUCT_7213 0x7213
1564 ++#define CMOTECH_PRODUCT_7251 0x7251
1565 ++#define CMOTECH_PRODUCT_7252 0x7252
1566 ++#define CMOTECH_PRODUCT_7253 0x7253
1567 +
1568 + #define TELIT_VENDOR_ID 0x1bc7
1569 + #define TELIT_PRODUCT_UC864E 0x1003
1570 +@@ -243,6 +266,7 @@ static void option_instat_callback(struct urb *urb);
1571 + #define TELIT_PRODUCT_CC864_DUAL 0x1005
1572 + #define TELIT_PRODUCT_CC864_SINGLE 0x1006
1573 + #define TELIT_PRODUCT_DE910_DUAL 0x1010
1574 ++#define TELIT_PRODUCT_UE910_V2 0x1012
1575 + #define TELIT_PRODUCT_LE920 0x1200
1576 +
1577 + /* ZTE PRODUCTS */
1578 +@@ -286,6 +310,7 @@ static void option_instat_callback(struct urb *urb);
1579 + #define ALCATEL_PRODUCT_X060S_X200 0x0000
1580 + #define ALCATEL_PRODUCT_X220_X500D 0x0017
1581 + #define ALCATEL_PRODUCT_L100V 0x011e
1582 ++#define ALCATEL_PRODUCT_L800MA 0x0203
1583 +
1584 + #define PIRELLI_VENDOR_ID 0x1266
1585 + #define PIRELLI_PRODUCT_C100_1 0x1002
1586 +@@ -348,6 +373,7 @@ static void option_instat_callback(struct urb *urb);
1587 + #define OLIVETTI_PRODUCT_OLICARD100 0xc000
1588 + #define OLIVETTI_PRODUCT_OLICARD145 0xc003
1589 + #define OLIVETTI_PRODUCT_OLICARD200 0xc005
1590 ++#define OLIVETTI_PRODUCT_OLICARD500 0xc00b
1591 +
1592 + /* Celot products */
1593 + #define CELOT_VENDOR_ID 0x211f
1594 +@@ -501,6 +527,10 @@ static const struct option_blacklist_info huawei_cdc12_blacklist = {
1595 + .reserved = BIT(1) | BIT(2),
1596 + };
1597 +
1598 ++static const struct option_blacklist_info net_intf0_blacklist = {
1599 ++ .reserved = BIT(0),
1600 ++};
1601 ++
1602 + static const struct option_blacklist_info net_intf1_blacklist = {
1603 + .reserved = BIT(1),
1604 + };
1605 +@@ -1034,13 +1064,53 @@ static const struct usb_device_id option_ids[] = {
1606 + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
1607 + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */
1608 + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
1609 +- { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */
1610 +- { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) },
1611 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
1612 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
1613 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
1614 ++ .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1615 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6004) },
1616 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6005) },
1617 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CGU_628A) },
1618 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHE_628S),
1619 ++ .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1620 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_301),
1621 ++ .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1622 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_628),
1623 ++ .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1624 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_628S) },
1625 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU_680) },
1626 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU_685A) },
1627 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_720S),
1628 ++ .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1629 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7002),
1630 ++ .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1631 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_629K),
1632 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1633 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7004),
1634 ++ .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1635 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7005) },
1636 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CGU_629),
1637 ++ .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1638 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_629S),
1639 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1640 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_720I),
1641 ++ .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1642 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7212),
1643 ++ .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1644 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7213),
1645 ++ .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1646 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7251),
1647 ++ .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1648 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7252),
1649 ++ .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1650 ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7253),
1651 ++ .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1652 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) },
1653 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864G) },
1654 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_DUAL) },
1655 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) },
1656 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) },
1657 ++ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) },
1658 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
1659 + .driver_info = (kernel_ulong_t)&telit_le920_blacklist },
1660 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
1661 +@@ -1498,6 +1568,8 @@ static const struct usb_device_id option_ids[] = {
1662 + .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1663 + { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V),
1664 + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1665 ++ { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L800MA),
1666 ++ .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1667 + { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
1668 + { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
1669 + { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
1670 +@@ -1543,6 +1615,9 @@ static const struct usb_device_id option_ids[] = {
1671 + { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200),
1672 + .driver_info = (kernel_ulong_t)&net_intf6_blacklist
1673 + },
1674 ++ { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500),
1675 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist
1676 ++ },
1677 + { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
1678 + { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/
1679 + { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) },
1680 +diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
1681 +index 968a40201e5f..7ed681a714a5 100644
1682 +--- a/drivers/usb/serial/qcserial.c
1683 ++++ b/drivers/usb/serial/qcserial.c
1684 +@@ -136,9 +136,18 @@ static const struct usb_device_id id_table[] = {
1685 + {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68a2, 0)}, /* Sierra Wireless MC7710 Device Management */
1686 + {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68a2, 2)}, /* Sierra Wireless MC7710 NMEA */
1687 + {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68a2, 3)}, /* Sierra Wireless MC7710 Modem */
1688 ++ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68c0, 0)}, /* Sierra Wireless MC73xx Device Management */
1689 ++ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68c0, 2)}, /* Sierra Wireless MC73xx NMEA */
1690 ++ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68c0, 3)}, /* Sierra Wireless MC73xx Modem */
1691 + {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 0)}, /* Sierra Wireless EM7700 Device Management */
1692 + {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 2)}, /* Sierra Wireless EM7700 NMEA */
1693 + {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 3)}, /* Sierra Wireless EM7700 Modem */
1694 ++ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901f, 0)}, /* Sierra Wireless EM7355 Device Management */
1695 ++ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901f, 2)}, /* Sierra Wireless EM7355 NMEA */
1696 ++ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901f, 3)}, /* Sierra Wireless EM7355 Modem */
1697 ++ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9041, 0)}, /* Sierra Wireless MC7305/MC7355 Device Management */
1698 ++ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9041, 2)}, /* Sierra Wireless MC7305/MC7355 NMEA */
1699 ++ {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9041, 3)}, /* Sierra Wireless MC7305/MC7355 Modem */
1700 + {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 0)}, /* Netgear AirCard 340U Device Management */
1701 + {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 2)}, /* Netgear AirCard 340U NMEA */
1702 + {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 3)}, /* Netgear AirCard 340U Modem */
1703 +diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
1704 +index de958c5b52e3..b6910b7ab7e2 100644
1705 +--- a/drivers/usb/serial/sierra.c
1706 ++++ b/drivers/usb/serial/sierra.c
1707 +@@ -291,7 +291,6 @@ static const struct usb_device_id id_table[] = {
1708 + { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */
1709 + .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
1710 + },
1711 +- { USB_DEVICE(0x413C, 0x08133) }, /* Dell Computer Corp. Wireless 5720 VZW Mobile Broadband (EVDO Rev-A) Minicard GPS Port */
1712 +
1713 + { }
1714 + };
1715 +diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
1716 +index 6091bd5a1f4f..52260afaa102 100644
1717 +--- a/drivers/usb/serial/usb-serial.c
1718 ++++ b/drivers/usb/serial/usb-serial.c
1719 +@@ -1348,10 +1348,12 @@ static int usb_serial_register(struct usb_serial_driver *driver)
1720 + static void usb_serial_deregister(struct usb_serial_driver *device)
1721 + {
1722 + pr_info("USB Serial deregistering driver %s\n", device->description);
1723 ++
1724 + mutex_lock(&table_lock);
1725 + list_del(&device->driver_list);
1726 +- usb_serial_bus_deregister(device);
1727 + mutex_unlock(&table_lock);
1728 ++
1729 ++ usb_serial_bus_deregister(device);
1730 + }
1731 +
1732 + /**
1733 +diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
1734 +index 85365784040b..6fa78361be56 100644
1735 +--- a/drivers/usb/serial/usb_wwan.c
1736 ++++ b/drivers/usb/serial/usb_wwan.c
1737 +@@ -470,6 +470,9 @@ int usb_wwan_port_probe(struct usb_serial_port *port)
1738 + int err;
1739 + int i;
1740 +
1741 ++ if (!port->bulk_in_size || !port->bulk_out_size)
1742 ++ return -ENODEV;
1743 ++
1744 + portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
1745 + if (!portdata)
1746 + return -ENOMEM;
1747 +@@ -477,9 +480,6 @@ int usb_wwan_port_probe(struct usb_serial_port *port)
1748 + init_usb_anchor(&portdata->delayed);
1749 +
1750 + for (i = 0; i < N_IN_URB; i++) {
1751 +- if (!port->bulk_in_size)
1752 +- break;
1753 +-
1754 + buffer = (u8 *)__get_free_page(GFP_KERNEL);
1755 + if (!buffer)
1756 + goto bail_out_error;
1757 +@@ -493,9 +493,6 @@ int usb_wwan_port_probe(struct usb_serial_port *port)
1758 + }
1759 +
1760 + for (i = 0; i < N_OUT_URB; i++) {
1761 +- if (!port->bulk_out_size)
1762 +- break;
1763 +-
1764 + buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL);
1765 + if (!buffer)
1766 + goto bail_out_error2;
1767 +diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c
1768 +index ba77f753649c..a78ca6a01094 100644
1769 +--- a/drivers/video/tgafb.c
1770 ++++ b/drivers/video/tgafb.c
1771 +@@ -188,6 +188,8 @@ tgafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
1772 +
1773 + if (var->xres_virtual != var->xres || var->yres_virtual != var->yres)
1774 + return -EINVAL;
1775 ++ if (var->xres * var->yres * (var->bits_per_pixel >> 3) > info->fix.smem_len)
1776 ++ return -EINVAL;
1777 + if (var->nonstd)
1778 + return -EINVAL;
1779 + if (1000000000 / var->pixclock > TGA_PLL_MAX_FREQ)
1780 +@@ -268,6 +270,7 @@ tgafb_set_par(struct fb_info *info)
1781 + par->yres = info->var.yres;
1782 + par->pll_freq = pll_freq = 1000000000 / info->var.pixclock;
1783 + par->bits_per_pixel = info->var.bits_per_pixel;
1784 ++ info->fix.line_length = par->xres * (par->bits_per_pixel >> 3);
1785 +
1786 + tga_type = par->tga_type;
1787 +
1788 +@@ -1314,6 +1317,7 @@ tgafb_init_fix(struct fb_info *info)
1789 + int tga_bus_tc = TGA_BUS_TC(par->dev);
1790 + u8 tga_type = par->tga_type;
1791 + const char *tga_type_name = NULL;
1792 ++ unsigned memory_size;
1793 +
1794 + switch (tga_type) {
1795 + case TGA_TYPE_8PLANE:
1796 +@@ -1321,21 +1325,25 @@ tgafb_init_fix(struct fb_info *info)
1797 + tga_type_name = "Digital ZLXp-E1";
1798 + if (tga_bus_tc)
1799 + tga_type_name = "Digital ZLX-E1";
1800 ++ memory_size = 2097152;
1801 + break;
1802 + case TGA_TYPE_24PLANE:
1803 + if (tga_bus_pci)
1804 + tga_type_name = "Digital ZLXp-E2";
1805 + if (tga_bus_tc)
1806 + tga_type_name = "Digital ZLX-E2";
1807 ++ memory_size = 8388608;
1808 + break;
1809 + case TGA_TYPE_24PLUSZ:
1810 + if (tga_bus_pci)
1811 + tga_type_name = "Digital ZLXp-E3";
1812 + if (tga_bus_tc)
1813 + tga_type_name = "Digital ZLX-E3";
1814 ++ memory_size = 16777216;
1815 + break;
1816 + default:
1817 + tga_type_name = "Unknown";
1818 ++ memory_size = 16777216;
1819 + break;
1820 + }
1821 +
1822 +@@ -1347,9 +1355,8 @@ tgafb_init_fix(struct fb_info *info)
1823 + ? FB_VISUAL_PSEUDOCOLOR
1824 + : FB_VISUAL_DIRECTCOLOR);
1825 +
1826 +- info->fix.line_length = par->xres * (par->bits_per_pixel >> 3);
1827 + info->fix.smem_start = (size_t) par->tga_fb_base;
1828 +- info->fix.smem_len = info->fix.line_length * par->yres;
1829 ++ info->fix.smem_len = memory_size;
1830 + info->fix.mmio_start = (size_t) par->tga_regs_base;
1831 + info->fix.mmio_len = 512;
1832 +
1833 +@@ -1473,6 +1480,9 @@ static int tgafb_register(struct device *dev)
1834 + modedb_tga = &modedb_tc;
1835 + modedbsize_tga = 1;
1836 + }
1837 ++
1838 ++ tgafb_init_fix(info);
1839 ++
1840 + ret = fb_find_mode(&info->var, info,
1841 + mode_option ? mode_option : mode_option_tga,
1842 + modedb_tga, modedbsize_tga, NULL,
1843 +@@ -1490,7 +1500,6 @@ static int tgafb_register(struct device *dev)
1844 + }
1845 +
1846 + tgafb_set_par(info);
1847 +- tgafb_init_fix(info);
1848 +
1849 + if (register_framebuffer(info) < 0) {
1850 + printk(KERN_ERR "tgafb: Could not register framebuffer\n");
1851 +diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
1852 +index 77fc5e181077..b38bd052ce6d 100644
1853 +--- a/fs/cifs/cifsfs.c
1854 ++++ b/fs/cifs/cifsfs.c
1855 +@@ -253,6 +253,11 @@ cifs_alloc_inode(struct super_block *sb)
1856 + cifs_set_oplock_level(cifs_inode, 0);
1857 + cifs_inode->delete_pending = false;
1858 + cifs_inode->invalid_mapping = false;
1859 ++ clear_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cifs_inode->flags);
1860 ++ clear_bit(CIFS_INODE_PENDING_WRITERS, &cifs_inode->flags);
1861 ++ clear_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, &cifs_inode->flags);
1862 ++ spin_lock_init(&cifs_inode->writers_lock);
1863 ++ cifs_inode->writers = 0;
1864 + cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */
1865 + cifs_inode->server_eof = 0;
1866 + cifs_inode->uniqueid = 0;
1867 +@@ -731,19 +736,26 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
1868 + unsigned long nr_segs, loff_t pos)
1869 + {
1870 + struct inode *inode = file_inode(iocb->ki_filp);
1871 ++ struct cifsInodeInfo *cinode = CIFS_I(inode);
1872 + ssize_t written;
1873 + int rc;
1874 +
1875 ++ written = cifs_get_writer(cinode);
1876 ++ if (written)
1877 ++ return written;
1878 ++
1879 + written = generic_file_aio_write(iocb, iov, nr_segs, pos);
1880 +
1881 + if (CIFS_CACHE_WRITE(CIFS_I(inode)))
1882 +- return written;
1883 ++ goto out;
1884 +
1885 + rc = filemap_fdatawrite(inode->i_mapping);
1886 + if (rc)
1887 + cifs_dbg(FYI, "cifs_file_aio_write: %d rc on %p inode\n",
1888 + rc, inode);
1889 +
1890 ++out:
1891 ++ cifs_put_writer(cinode);
1892 + return written;
1893 + }
1894 +
1895 +diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
1896 +index db95dca335ca..2f6f1ac52d3f 100644
1897 +--- a/fs/cifs/cifsglob.h
1898 ++++ b/fs/cifs/cifsglob.h
1899 +@@ -228,6 +228,8 @@ struct smb_version_operations {
1900 + /* verify the message */
1901 + int (*check_message)(char *, unsigned int);
1902 + bool (*is_oplock_break)(char *, struct TCP_Server_Info *);
1903 ++ void (*downgrade_oplock)(struct TCP_Server_Info *,
1904 ++ struct cifsInodeInfo *, bool);
1905 + /* process transaction2 response */
1906 + bool (*check_trans2)(struct mid_q_entry *, struct TCP_Server_Info *,
1907 + char *, int);
1908 +@@ -1072,6 +1074,12 @@ struct cifsInodeInfo {
1909 + unsigned int epoch; /* used to track lease state changes */
1910 + bool delete_pending; /* DELETE_ON_CLOSE is set */
1911 + bool invalid_mapping; /* pagecache is invalid */
1912 ++ unsigned long flags;
1913 ++#define CIFS_INODE_PENDING_OPLOCK_BREAK (0) /* oplock break in progress */
1914 ++#define CIFS_INODE_PENDING_WRITERS (1) /* Writes in progress */
1915 ++#define CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2 (2) /* Downgrade oplock to L2 */
1916 ++ spinlock_t writers_lock;
1917 ++ unsigned int writers; /* Number of writers on this inode */
1918 + unsigned long time; /* jiffies of last update of inode */
1919 + u64 server_eof; /* current file size on server -- protected by i_lock */
1920 + u64 uniqueid; /* server inode number */
1921 +diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
1922 +index 45ccfbd8ea5f..c6bfe5b368f9 100644
1923 +--- a/fs/cifs/cifsproto.h
1924 ++++ b/fs/cifs/cifsproto.h
1925 +@@ -127,6 +127,9 @@ extern u64 cifs_UnixTimeToNT(struct timespec);
1926 + extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
1927 + int offset);
1928 + extern void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock);
1929 ++extern int cifs_get_writer(struct cifsInodeInfo *cinode);
1930 ++extern void cifs_put_writer(struct cifsInodeInfo *cinode);
1931 ++extern void cifs_done_oplock_break(struct cifsInodeInfo *cinode);
1932 + extern int cifs_unlock_range(struct cifsFileInfo *cfile,
1933 + struct file_lock *flock, const unsigned int xid);
1934 + extern int cifs_push_mandatory_locks(struct cifsFileInfo *cfile);
1935 +diff --git a/fs/cifs/file.c b/fs/cifs/file.c
1936 +index 81476e18a789..643a18491bed 100644
1937 +--- a/fs/cifs/file.c
1938 ++++ b/fs/cifs/file.c
1939 +@@ -2611,12 +2611,20 @@ cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
1940 + struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
1941 + ssize_t written;
1942 +
1943 ++ written = cifs_get_writer(cinode);
1944 ++ if (written)
1945 ++ return written;
1946 ++
1947 + if (CIFS_CACHE_WRITE(cinode)) {
1948 + if (cap_unix(tcon->ses) &&
1949 + (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability))
1950 +- && ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0))
1951 +- return generic_file_aio_write(iocb, iov, nr_segs, pos);
1952 +- return cifs_writev(iocb, iov, nr_segs, pos);
1953 ++ && ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0)) {
1954 ++ written = generic_file_aio_write(
1955 ++ iocb, iov, nr_segs, pos);
1956 ++ goto out;
1957 ++ }
1958 ++ written = cifs_writev(iocb, iov, nr_segs, pos);
1959 ++ goto out;
1960 + }
1961 + /*
1962 + * For non-oplocked files in strict cache mode we need to write the data
1963 +@@ -2636,6 +2644,8 @@ cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
1964 + inode);
1965 + cinode->oplock = 0;
1966 + }
1967 ++out:
1968 ++ cifs_put_writer(cinode);
1969 + return written;
1970 + }
1971 +
1972 +@@ -3647,6 +3657,13 @@ static int cifs_launder_page(struct page *page)
1973 + return rc;
1974 + }
1975 +
1976 ++static int
1977 ++cifs_pending_writers_wait(void *unused)
1978 ++{
1979 ++ schedule();
1980 ++ return 0;
1981 ++}
1982 ++
1983 + void cifs_oplock_break(struct work_struct *work)
1984 + {
1985 + struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo,
1986 +@@ -3654,8 +3671,15 @@ void cifs_oplock_break(struct work_struct *work)
1987 + struct inode *inode = cfile->dentry->d_inode;
1988 + struct cifsInodeInfo *cinode = CIFS_I(inode);
1989 + struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
1990 ++ struct TCP_Server_Info *server = tcon->ses->server;
1991 + int rc = 0;
1992 +
1993 ++ wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS,
1994 ++ cifs_pending_writers_wait, TASK_UNINTERRUPTIBLE);
1995 ++
1996 ++ server->ops->downgrade_oplock(server, cinode,
1997 ++ test_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, &cinode->flags));
1998 ++
1999 + if (!CIFS_CACHE_WRITE(cinode) && CIFS_CACHE_READ(cinode) &&
2000 + cifs_has_mand_locks(cinode)) {
2001 + cifs_dbg(FYI, "Reset oplock to None for inode=%p due to mand locks\n",
2002 +@@ -3692,6 +3716,7 @@ void cifs_oplock_break(struct work_struct *work)
2003 + cinode);
2004 + cifs_dbg(FYI, "Oplock release rc = %d\n", rc);
2005 + }
2006 ++ cifs_done_oplock_break(cinode);
2007 + }
2008 +
2009 + const struct address_space_operations cifs_addr_ops = {
2010 +diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
2011 +index 138a011633fe..912a52e5e8cc 100644
2012 +--- a/fs/cifs/misc.c
2013 ++++ b/fs/cifs/misc.c
2014 +@@ -472,8 +472,22 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
2015 + cifs_dbg(FYI, "file id match, oplock break\n");
2016 + pCifsInode = CIFS_I(netfile->dentry->d_inode);
2017 +
2018 +- cifs_set_oplock_level(pCifsInode,
2019 +- pSMB->OplockLevel ? OPLOCK_READ : 0);
2020 ++ set_bit(CIFS_INODE_PENDING_OPLOCK_BREAK,
2021 ++ &pCifsInode->flags);
2022 ++
2023 ++ /*
2024 ++ * Set flag if the server downgrades the oplock
2025 ++ * to L2 else clear.
2026 ++ */
2027 ++ if (pSMB->OplockLevel)
2028 ++ set_bit(
2029 ++ CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2,
2030 ++ &pCifsInode->flags);
2031 ++ else
2032 ++ clear_bit(
2033 ++ CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2,
2034 ++ &pCifsInode->flags);
2035 ++
2036 + queue_work(cifsiod_wq,
2037 + &netfile->oplock_break);
2038 + netfile->oplock_break_cancelled = false;
2039 +@@ -557,6 +571,62 @@ void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock)
2040 + cinode->oplock = 0;
2041 + }
2042 +
2043 ++static int
2044 ++cifs_oplock_break_wait(void *unused)
2045 ++{
2046 ++ schedule();
2047 ++ return signal_pending(current) ? -ERESTARTSYS : 0;
2048 ++}
2049 ++
2050 ++/*
2051 ++ * We wait for oplock breaks to be processed before we attempt to perform
2052 ++ * writes.
2053 ++ */
2054 ++int cifs_get_writer(struct cifsInodeInfo *cinode)
2055 ++{
2056 ++ int rc;
2057 ++
2058 ++start:
2059 ++ rc = wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_OPLOCK_BREAK,
2060 ++ cifs_oplock_break_wait, TASK_KILLABLE);
2061 ++ if (rc)
2062 ++ return rc;
2063 ++
2064 ++ spin_lock(&cinode->writers_lock);
2065 ++ if (!cinode->writers)
2066 ++ set_bit(CIFS_INODE_PENDING_WRITERS, &cinode->flags);
2067 ++ cinode->writers++;
2068 ++ /* Check to see if we have started servicing an oplock break */
2069 ++ if (test_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags)) {
2070 ++ cinode->writers--;
2071 ++ if (cinode->writers == 0) {
2072 ++ clear_bit(CIFS_INODE_PENDING_WRITERS, &cinode->flags);
2073 ++ wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS);
2074 ++ }
2075 ++ spin_unlock(&cinode->writers_lock);
2076 ++ goto start;
2077 ++ }
2078 ++ spin_unlock(&cinode->writers_lock);
2079 ++ return 0;
2080 ++}
2081 ++
2082 ++void cifs_put_writer(struct cifsInodeInfo *cinode)
2083 ++{
2084 ++ spin_lock(&cinode->writers_lock);
2085 ++ cinode->writers--;
2086 ++ if (cinode->writers == 0) {
2087 ++ clear_bit(CIFS_INODE_PENDING_WRITERS, &cinode->flags);
2088 ++ wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS);
2089 ++ }
2090 ++ spin_unlock(&cinode->writers_lock);
2091 ++}
2092 ++
2093 ++void cifs_done_oplock_break(struct cifsInodeInfo *cinode)
2094 ++{
2095 ++ clear_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags);
2096 ++ wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_OPLOCK_BREAK);
2097 ++}
2098 ++
2099 + bool
2100 + backup_cred(struct cifs_sb_info *cifs_sb)
2101 + {
2102 +diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
2103 +index e6ed0dc3071b..58bd01efa05b 100644
2104 +--- a/fs/cifs/smb1ops.c
2105 ++++ b/fs/cifs/smb1ops.c
2106 +@@ -372,6 +372,16 @@ coalesce_t2(char *second_buf, struct smb_hdr *target_hdr)
2107 + return 0;
2108 + }
2109 +
2110 ++static void
2111 ++cifs_downgrade_oplock(struct TCP_Server_Info *server,
2112 ++ struct cifsInodeInfo *cinode, bool set_level2)
2113 ++{
2114 ++ if (set_level2)
2115 ++ cifs_set_oplock_level(cinode, OPLOCK_READ);
2116 ++ else
2117 ++ cifs_set_oplock_level(cinode, 0);
2118 ++}
2119 ++
2120 + static bool
2121 + cifs_check_trans2(struct mid_q_entry *mid, struct TCP_Server_Info *server,
2122 + char *buf, int malformed)
2123 +@@ -957,6 +967,7 @@ struct smb_version_operations smb1_operations = {
2124 + .clear_stats = cifs_clear_stats,
2125 + .print_stats = cifs_print_stats,
2126 + .is_oplock_break = is_valid_oplock_break,
2127 ++ .downgrade_oplock = cifs_downgrade_oplock,
2128 + .check_trans2 = cifs_check_trans2,
2129 + .need_neg = cifs_need_neg,
2130 + .negotiate = cifs_negotiate,
2131 +diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
2132 +index fb3966265b6e..b8021fde987d 100644
2133 +--- a/fs/cifs/smb2misc.c
2134 ++++ b/fs/cifs/smb2misc.c
2135 +@@ -575,9 +575,21 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
2136 + else
2137 + cfile->oplock_break_cancelled = false;
2138 +
2139 +- server->ops->set_oplock_level(cinode,
2140 +- rsp->OplockLevel ? SMB2_OPLOCK_LEVEL_II : 0,
2141 +- 0, NULL);
2142 ++ set_bit(CIFS_INODE_PENDING_OPLOCK_BREAK,
2143 ++ &cinode->flags);
2144 ++
2145 ++ /*
2146 ++ * Set flag if the server downgrades the oplock
2147 ++ * to L2 else clear.
2148 ++ */
2149 ++ if (rsp->OplockLevel)
2150 ++ set_bit(
2151 ++ CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2,
2152 ++ &cinode->flags);
2153 ++ else
2154 ++ clear_bit(
2155 ++ CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2,
2156 ++ &cinode->flags);
2157 +
2158 + queue_work(cifsiod_wq, &cfile->oplock_break);
2159 +
2160 +diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
2161 +index 027a0c6f7ca0..13e505191364 100644
2162 +--- a/fs/cifs/smb2ops.c
2163 ++++ b/fs/cifs/smb2ops.c
2164 +@@ -646,6 +646,17 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
2165 + }
2166 +
2167 + static void
2168 ++smb2_downgrade_oplock(struct TCP_Server_Info *server,
2169 ++ struct cifsInodeInfo *cinode, bool set_level2)
2170 ++{
2171 ++ if (set_level2)
2172 ++ server->ops->set_oplock_level(cinode, SMB2_OPLOCK_LEVEL_II,
2173 ++ 0, NULL);
2174 ++ else
2175 ++ server->ops->set_oplock_level(cinode, 0, 0, NULL);
2176 ++}
2177 ++
2178 ++static void
2179 + smb2_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
2180 + unsigned int epoch, bool *purge_cache)
2181 + {
2182 +@@ -851,6 +862,7 @@ struct smb_version_operations smb20_operations = {
2183 + .clear_stats = smb2_clear_stats,
2184 + .print_stats = smb2_print_stats,
2185 + .is_oplock_break = smb2_is_valid_oplock_break,
2186 ++ .downgrade_oplock = smb2_downgrade_oplock,
2187 + .need_neg = smb2_need_neg,
2188 + .negotiate = smb2_negotiate,
2189 + .negotiate_wsize = smb2_negotiate_wsize,
2190 +@@ -922,6 +934,7 @@ struct smb_version_operations smb21_operations = {
2191 + .clear_stats = smb2_clear_stats,
2192 + .print_stats = smb2_print_stats,
2193 + .is_oplock_break = smb2_is_valid_oplock_break,
2194 ++ .downgrade_oplock = smb2_downgrade_oplock,
2195 + .need_neg = smb2_need_neg,
2196 + .negotiate = smb2_negotiate,
2197 + .negotiate_wsize = smb2_negotiate_wsize,
2198 +@@ -994,6 +1007,7 @@ struct smb_version_operations smb30_operations = {
2199 + .print_stats = smb2_print_stats,
2200 + .dump_share_caps = smb2_dump_share_caps,
2201 + .is_oplock_break = smb2_is_valid_oplock_break,
2202 ++ .downgrade_oplock = smb2_downgrade_oplock,
2203 + .need_neg = smb2_need_neg,
2204 + .negotiate = smb2_negotiate,
2205 + .negotiate_wsize = smb2_negotiate_wsize,
2206 +diff --git a/fs/file_table.c b/fs/file_table.c
2207 +index e900ca518635..05e2ac19b6c4 100644
2208 +--- a/fs/file_table.c
2209 ++++ b/fs/file_table.c
2210 +@@ -211,10 +211,10 @@ static void drop_file_write_access(struct file *file)
2211 + struct dentry *dentry = file->f_path.dentry;
2212 + struct inode *inode = dentry->d_inode;
2213 +
2214 +- put_write_access(inode);
2215 +-
2216 + if (special_file(inode->i_mode))
2217 + return;
2218 ++
2219 ++ put_write_access(inode);
2220 + if (file_check_writeable(file) != 0)
2221 + return;
2222 + __mnt_drop_write(mnt);
2223 +diff --git a/fs/open.c b/fs/open.c
2224 +index d420331ca32a..730a5870895d 100644
2225 +--- a/fs/open.c
2226 ++++ b/fs/open.c
2227 +@@ -627,23 +627,12 @@ out:
2228 + static inline int __get_file_write_access(struct inode *inode,
2229 + struct vfsmount *mnt)
2230 + {
2231 +- int error;
2232 +- error = get_write_access(inode);
2233 ++ int error = get_write_access(inode);
2234 + if (error)
2235 + return error;
2236 +- /*
2237 +- * Do not take mount writer counts on
2238 +- * special files since no writes to
2239 +- * the mount itself will occur.
2240 +- */
2241 +- if (!special_file(inode->i_mode)) {
2242 +- /*
2243 +- * Balanced in __fput()
2244 +- */
2245 +- error = __mnt_want_write(mnt);
2246 +- if (error)
2247 +- put_write_access(inode);
2248 +- }
2249 ++ error = __mnt_want_write(mnt);
2250 ++ if (error)
2251 ++ put_write_access(inode);
2252 + return error;
2253 + }
2254 +
2255 +@@ -676,12 +665,11 @@ static int do_dentry_open(struct file *f,
2256 +
2257 + path_get(&f->f_path);
2258 + inode = f->f_inode = f->f_path.dentry->d_inode;
2259 +- if (f->f_mode & FMODE_WRITE) {
2260 ++ if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) {
2261 + error = __get_file_write_access(inode, f->f_path.mnt);
2262 + if (error)
2263 + goto cleanup_file;
2264 +- if (!special_file(inode->i_mode))
2265 +- file_take_write(f);
2266 ++ file_take_write(f);
2267 + }
2268 +
2269 + f->f_mapping = inode->i_mapping;
2270 +@@ -722,7 +710,6 @@ cleanup_all:
2271 + fops_put(f->f_op);
2272 + file_sb_list_del(f);
2273 + if (f->f_mode & FMODE_WRITE) {
2274 +- put_write_access(inode);
2275 + if (!special_file(inode->i_mode)) {
2276 + /*
2277 + * We don't consider this a real
2278 +@@ -730,6 +717,7 @@ cleanup_all:
2279 + * because it all happenend right
2280 + * here, so just reset the state.
2281 + */
2282 ++ put_write_access(inode);
2283 + file_reset_write(f);
2284 + __mnt_drop_write(f->f_path.mnt);
2285 + }
2286 +diff --git a/fs/super.c b/fs/super.c
2287 +index 0225c20f8770..d127de207376 100644
2288 +--- a/fs/super.c
2289 ++++ b/fs/super.c
2290 +@@ -845,7 +845,10 @@ void emergency_remount(void)
2291 +
2292 + static DEFINE_IDA(unnamed_dev_ida);
2293 + static DEFINE_SPINLOCK(unnamed_dev_lock);/* protects the above */
2294 +-static int unnamed_dev_start = 0; /* don't bother trying below it */
2295 ++/* Many userspace utilities consider an FSID of 0 invalid.
2296 ++ * Always return at least 1 from get_anon_bdev.
2297 ++ */
2298 ++static int unnamed_dev_start = 1;
2299 +
2300 + int get_anon_bdev(dev_t *p)
2301 + {
2302 +diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
2303 +index b12079afbd5f..a52136ce13ad 100644
2304 +--- a/include/asm-generic/pgtable.h
2305 ++++ b/include/asm-generic/pgtable.h
2306 +@@ -669,32 +669,47 @@ static inline int pmd_numa(pmd_t pmd)
2307 + #ifndef pte_mknonnuma
2308 + static inline pte_t pte_mknonnuma(pte_t pte)
2309 + {
2310 +- pte = pte_clear_flags(pte, _PAGE_NUMA);
2311 +- return pte_set_flags(pte, _PAGE_PRESENT|_PAGE_ACCESSED);
2312 ++ pteval_t val = pte_val(pte);
2313 ++
2314 ++ val &= ~_PAGE_NUMA;
2315 ++ val |= (_PAGE_PRESENT|_PAGE_ACCESSED);
2316 ++ return __pte(val);
2317 + }
2318 + #endif
2319 +
2320 + #ifndef pmd_mknonnuma
2321 + static inline pmd_t pmd_mknonnuma(pmd_t pmd)
2322 + {
2323 +- pmd = pmd_clear_flags(pmd, _PAGE_NUMA);
2324 +- return pmd_set_flags(pmd, _PAGE_PRESENT|_PAGE_ACCESSED);
2325 ++ pmdval_t val = pmd_val(pmd);
2326 ++
2327 ++ val &= ~_PAGE_NUMA;
2328 ++ val |= (_PAGE_PRESENT|_PAGE_ACCESSED);
2329 ++
2330 ++ return __pmd(val);
2331 + }
2332 + #endif
2333 +
2334 + #ifndef pte_mknuma
2335 + static inline pte_t pte_mknuma(pte_t pte)
2336 + {
2337 +- pte = pte_set_flags(pte, _PAGE_NUMA);
2338 +- return pte_clear_flags(pte, _PAGE_PRESENT);
2339 ++ pteval_t val = pte_val(pte);
2340 ++
2341 ++ val &= ~_PAGE_PRESENT;
2342 ++ val |= _PAGE_NUMA;
2343 ++
2344 ++ return __pte(val);
2345 + }
2346 + #endif
2347 +
2348 + #ifndef pmd_mknuma
2349 + static inline pmd_t pmd_mknuma(pmd_t pmd)
2350 + {
2351 +- pmd = pmd_set_flags(pmd, _PAGE_NUMA);
2352 +- return pmd_clear_flags(pmd, _PAGE_PRESENT);
2353 ++ pmdval_t val = pmd_val(pmd);
2354 ++
2355 ++ val &= ~_PAGE_PRESENT;
2356 ++ val |= _PAGE_NUMA;
2357 ++
2358 ++ return __pmd(val);
2359 + }
2360 + #endif
2361 + #else
2362 +diff --git a/include/linux/list.h b/include/linux/list.h
2363 +index f4d8a2f12a33..2ece63847001 100644
2364 +--- a/include/linux/list.h
2365 ++++ b/include/linux/list.h
2366 +@@ -373,6 +373,22 @@ static inline void list_splice_tail_init(struct list_head *list,
2367 + (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
2368 +
2369 + /**
2370 ++ * list_next_entry - get the next element in list
2371 ++ * @pos: the type * to cursor
2372 ++ * @member: the name of the list_struct within the struct.
2373 ++ */
2374 ++#define list_next_entry(pos, member) \
2375 ++ list_entry((pos)->member.next, typeof(*(pos)), member)
2376 ++
2377 ++/**
2378 ++ * list_prev_entry - get the prev element in list
2379 ++ * @pos: the type * to cursor
2380 ++ * @member: the name of the list_struct within the struct.
2381 ++ */
2382 ++#define list_prev_entry(pos, member) \
2383 ++ list_entry((pos)->member.prev, typeof(*(pos)), member)
2384 ++
2385 ++/**
2386 + * list_for_each - iterate over a list
2387 + * @pos: the &struct list_head to use as a loop cursor.
2388 + * @head: the head for your list.
2389 +diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
2390 +index f28544b2f9af..321f4ec71f6f 100644
2391 +--- a/include/linux/rtnetlink.h
2392 ++++ b/include/linux/rtnetlink.h
2393 +@@ -4,6 +4,7 @@
2394 +
2395 + #include <linux/mutex.h>
2396 + #include <linux/netdevice.h>
2397 ++#include <linux/wait.h>
2398 + #include <uapi/linux/rtnetlink.h>
2399 +
2400 + extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
2401 +@@ -22,6 +23,10 @@ extern void rtnl_lock(void);
2402 + extern void rtnl_unlock(void);
2403 + extern int rtnl_trylock(void);
2404 + extern int rtnl_is_locked(void);
2405 ++
2406 ++extern wait_queue_head_t netdev_unregistering_wq;
2407 ++extern struct mutex net_mutex;
2408 ++
2409 + #ifdef CONFIG_PROVE_LOCKING
2410 + extern int lockdep_rtnl_is_held(void);
2411 + #endif /* #ifdef CONFIG_PROVE_LOCKING */
2412 +diff --git a/include/linux/sched.h b/include/linux/sched.h
2413 +index b1e963efbde8..8594b065d3a8 100644
2414 +--- a/include/linux/sched.h
2415 ++++ b/include/linux/sched.h
2416 +@@ -1501,6 +1501,24 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk)
2417 + }
2418 +
2419 +
2420 ++static inline int pid_alive(const struct task_struct *p);
2421 ++static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
2422 ++{
2423 ++ pid_t pid = 0;
2424 ++
2425 ++ rcu_read_lock();
2426 ++ if (pid_alive(tsk))
2427 ++ pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
2428 ++ rcu_read_unlock();
2429 ++
2430 ++ return pid;
2431 ++}
2432 ++
2433 ++static inline pid_t task_ppid_nr(const struct task_struct *tsk)
2434 ++{
2435 ++ return task_ppid_nr_ns(tsk, &init_pid_ns);
2436 ++}
2437 ++
2438 + static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk,
2439 + struct pid_namespace *ns)
2440 + {
2441 +@@ -1540,7 +1558,7 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk)
2442 + *
2443 + * Return: 1 if the process is alive. 0 otherwise.
2444 + */
2445 +-static inline int pid_alive(struct task_struct *p)
2446 ++static inline int pid_alive(const struct task_struct *p)
2447 + {
2448 + return p->pids[PIDTYPE_PID].pid != NULL;
2449 + }
2450 +diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
2451 +index 54f91d35e5fd..302ab805b0bb 100644
2452 +--- a/include/linux/sock_diag.h
2453 ++++ b/include/linux/sock_diag.h
2454 +@@ -23,7 +23,7 @@ int sock_diag_check_cookie(void *sk, __u32 *cookie);
2455 + void sock_diag_save_cookie(void *sk, __u32 *cookie);
2456 +
2457 + int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr);
2458 +-int sock_diag_put_filterinfo(struct user_namespace *user_ns, struct sock *sk,
2459 ++int sock_diag_put_filterinfo(struct sock *sk,
2460 + struct sk_buff *skb, int attrtype);
2461 +
2462 + #endif
2463 +diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
2464 +index 7d64d3609ec9..428277869400 100644
2465 +--- a/include/net/af_vsock.h
2466 ++++ b/include/net/af_vsock.h
2467 +@@ -155,7 +155,11 @@ struct vsock_transport {
2468 +
2469 + /**** CORE ****/
2470 +
2471 +-int vsock_core_init(const struct vsock_transport *t);
2472 ++int __vsock_core_init(const struct vsock_transport *t, struct module *owner);
2473 ++static inline int vsock_core_init(const struct vsock_transport *t)
2474 ++{
2475 ++ return __vsock_core_init(t, THIS_MODULE);
2476 ++}
2477 + void vsock_core_exit(void);
2478 +
2479 + /**** UTILS ****/
2480 +diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
2481 +index 2b786b7e3585..a210b33fc8e2 100644
2482 +--- a/include/net/ip6_route.h
2483 ++++ b/include/net/ip6_route.h
2484 +@@ -32,6 +32,11 @@ struct route_info {
2485 + #define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010
2486 + #define RT6_LOOKUP_F_SRCPREF_COA 0x00000020
2487 +
2488 ++/* We do not (yet ?) support IPv6 jumbograms (RFC 2675)
2489 ++ * Unlike IPv4, hdr->seg_len doesn't include the IPv6 header
2490 ++ */
2491 ++#define IP6_MAX_MTU (0xFFFF + sizeof(struct ipv6hdr))
2492 ++
2493 + /*
2494 + * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate
2495 + * between IPV6_ADDR_PREFERENCES socket option values
2496 +diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
2497 +index 88a1d4060d52..88877224473f 100644
2498 +--- a/include/net/netfilter/nf_conntrack_extend.h
2499 ++++ b/include/net/netfilter/nf_conntrack_extend.h
2500 +@@ -47,8 +47,8 @@ enum nf_ct_ext_id {
2501 + /* Extensions: optional stuff which isn't permanently in struct. */
2502 + struct nf_ct_ext {
2503 + struct rcu_head rcu;
2504 +- u8 offset[NF_CT_EXT_NUM];
2505 +- u8 len;
2506 ++ u16 offset[NF_CT_EXT_NUM];
2507 ++ u16 len;
2508 + char data[0];
2509 + };
2510 +
2511 +diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
2512 +index 2174d8da0770..8b31f09dd695 100644
2513 +--- a/include/net/sctp/structs.h
2514 ++++ b/include/net/sctp/structs.h
2515 +@@ -1245,6 +1245,7 @@ struct sctp_endpoint {
2516 + /* SCTP-AUTH: endpoint shared keys */
2517 + struct list_head endpoint_shared_keys;
2518 + __u16 active_key_id;
2519 ++ __u8 auth_enable;
2520 + };
2521 +
2522 + /* Recover the outter endpoint structure. */
2523 +@@ -1273,7 +1274,8 @@ struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *,
2524 + int sctp_has_association(struct net *net, const union sctp_addr *laddr,
2525 + const union sctp_addr *paddr);
2526 +
2527 +-int sctp_verify_init(struct net *net, const struct sctp_association *asoc,
2528 ++int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep,
2529 ++ const struct sctp_association *asoc,
2530 + sctp_cid_t, sctp_init_chunk_t *peer_init,
2531 + struct sctp_chunk *chunk, struct sctp_chunk **err_chunk);
2532 + int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk,
2533 +diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
2534 +index d65fbec2533d..b4f1effc9216 100644
2535 +--- a/include/scsi/scsi_device.h
2536 ++++ b/include/scsi/scsi_device.h
2537 +@@ -257,7 +257,7 @@ struct scsi_target {
2538 + struct list_head siblings;
2539 + struct list_head devices;
2540 + struct device dev;
2541 +- unsigned int reap_ref; /* protected by the host lock */
2542 ++ struct kref reap_ref; /* last put renders target invisible */
2543 + unsigned int channel;
2544 + unsigned int id; /* target id ... replace
2545 + * scsi_device.id eventually */
2546 +@@ -284,7 +284,6 @@ struct scsi_target {
2547 + #define SCSI_DEFAULT_TARGET_BLOCKED 3
2548 +
2549 + char scsi_level;
2550 +- struct execute_work ew;
2551 + enum scsi_target_state state;
2552 + void *hostdata; /* available to low-level driver */
2553 + unsigned long starget_data[0]; /* for the transport */
2554 +diff --git a/include/trace/events/block.h b/include/trace/events/block.h
2555 +index 4c2301d2ef1a..2aaf370c462b 100644
2556 +--- a/include/trace/events/block.h
2557 ++++ b/include/trace/events/block.h
2558 +@@ -132,6 +132,7 @@ DEFINE_EVENT(block_rq_with_error, block_rq_requeue,
2559 + * block_rq_complete - block IO operation completed by device driver
2560 + * @q: queue containing the block operation request
2561 + * @rq: block operations request
2562 ++ * @nr_bytes: number of completed bytes
2563 + *
2564 + * The block_rq_complete tracepoint event indicates that some portion
2565 + * of operation request has been completed by the device driver. If
2566 +@@ -139,11 +140,37 @@ DEFINE_EVENT(block_rq_with_error, block_rq_requeue,
2567 + * do for the request. If @rq->bio is non-NULL then there is
2568 + * additional work required to complete the request.
2569 + */
2570 +-DEFINE_EVENT(block_rq_with_error, block_rq_complete,
2571 ++TRACE_EVENT(block_rq_complete,
2572 +
2573 +- TP_PROTO(struct request_queue *q, struct request *rq),
2574 ++ TP_PROTO(struct request_queue *q, struct request *rq,
2575 ++ unsigned int nr_bytes),
2576 +
2577 +- TP_ARGS(q, rq)
2578 ++ TP_ARGS(q, rq, nr_bytes),
2579 ++
2580 ++ TP_STRUCT__entry(
2581 ++ __field( dev_t, dev )
2582 ++ __field( sector_t, sector )
2583 ++ __field( unsigned int, nr_sector )
2584 ++ __field( int, errors )
2585 ++ __array( char, rwbs, RWBS_LEN )
2586 ++ __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
2587 ++ ),
2588 ++
2589 ++ TP_fast_assign(
2590 ++ __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
2591 ++ __entry->sector = blk_rq_pos(rq);
2592 ++ __entry->nr_sector = nr_bytes >> 9;
2593 ++ __entry->errors = rq->errors;
2594 ++
2595 ++ blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, nr_bytes);
2596 ++ blk_dump_cmd(__get_str(cmd), rq);
2597 ++ ),
2598 ++
2599 ++ TP_printk("%d,%d %s (%s) %llu + %u [%d]",
2600 ++ MAJOR(__entry->dev), MINOR(__entry->dev),
2601 ++ __entry->rwbs, __get_str(cmd),
2602 ++ (unsigned long long)__entry->sector,
2603 ++ __entry->nr_sector, __entry->errors)
2604 + );
2605 +
2606 + DECLARE_EVENT_CLASS(block_rq,
2607 +diff --git a/kernel/audit.c b/kernel/audit.c
2608 +index 6def25f1b351..50512d11a445 100644
2609 +--- a/kernel/audit.c
2610 ++++ b/kernel/audit.c
2611 +@@ -1613,10 +1613,10 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
2612 + spin_unlock_irq(&tsk->sighand->siglock);
2613 +
2614 + audit_log_format(ab,
2615 +- " ppid=%ld pid=%d auid=%u uid=%u gid=%u"
2616 ++ " ppid=%d pid=%d auid=%u uid=%u gid=%u"
2617 + " euid=%u suid=%u fsuid=%u"
2618 +- " egid=%u sgid=%u fsgid=%u ses=%u tty=%s",
2619 +- sys_getppid(),
2620 ++ " egid=%u sgid=%u fsgid=%u tty=%s ses=%u",
2621 ++ task_ppid_nr(tsk),
2622 + tsk->pid,
2623 + from_kuid(&init_user_ns, audit_get_loginuid(tsk)),
2624 + from_kuid(&init_user_ns, cred->uid),
2625 +@@ -1627,7 +1627,7 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
2626 + from_kgid(&init_user_ns, cred->egid),
2627 + from_kgid(&init_user_ns, cred->sgid),
2628 + from_kgid(&init_user_ns, cred->fsgid),
2629 +- audit_get_sessionid(tsk), tty);
2630 ++ tty, audit_get_sessionid(tsk));
2631 +
2632 + get_task_comm(name, tsk);
2633 + audit_log_format(ab, " comm=");
2634 +diff --git a/kernel/auditsc.c b/kernel/auditsc.c
2635 +index 9845cb32b60a..3b79a47ddb13 100644
2636 +--- a/kernel/auditsc.c
2637 ++++ b/kernel/auditsc.c
2638 +@@ -472,7 +472,7 @@ static int audit_filter_rules(struct task_struct *tsk,
2639 + case AUDIT_PPID:
2640 + if (ctx) {
2641 + if (!ctx->ppid)
2642 +- ctx->ppid = sys_getppid();
2643 ++ ctx->ppid = task_ppid_nr(tsk);
2644 + result = audit_comparator(ctx->ppid, f->op, f->val);
2645 + }
2646 + break;
2647 +diff --git a/kernel/events/core.c b/kernel/events/core.c
2648 +index fea4f6cf7e90..6c318bc71be5 100644
2649 +--- a/kernel/events/core.c
2650 ++++ b/kernel/events/core.c
2651 +@@ -2210,9 +2210,6 @@ static void __perf_event_sync_stat(struct perf_event *event,
2652 + perf_event_update_userpage(next_event);
2653 + }
2654 +
2655 +-#define list_next_entry(pos, member) \
2656 +- list_entry(pos->member.next, typeof(*pos), member)
2657 +-
2658 + static void perf_event_sync_stat(struct perf_event_context *ctx,
2659 + struct perf_event_context *next_ctx)
2660 + {
2661 +diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
2662 +index 64522ecdfe0e..271ce26faa21 100644
2663 +--- a/kernel/time/tick-common.c
2664 ++++ b/kernel/time/tick-common.c
2665 +@@ -260,7 +260,7 @@ static bool tick_check_preferred(struct clock_event_device *curdev,
2666 + bool tick_check_replacement(struct clock_event_device *curdev,
2667 + struct clock_event_device *newdev)
2668 + {
2669 +- if (tick_check_percpu(curdev, newdev, smp_processor_id()))
2670 ++ if (!tick_check_percpu(curdev, newdev, smp_processor_id()))
2671 + return false;
2672 +
2673 + return tick_check_preferred(curdev, newdev);
2674 +diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
2675 +index 7f727b34280d..e0e5f73db5a4 100644
2676 +--- a/kernel/trace/blktrace.c
2677 ++++ b/kernel/trace/blktrace.c
2678 +@@ -703,6 +703,7 @@ void blk_trace_shutdown(struct request_queue *q)
2679 + * blk_add_trace_rq - Add a trace for a request oriented action
2680 + * @q: queue the io is for
2681 + * @rq: the source request
2682 ++ * @nr_bytes: number of completed bytes
2683 + * @what: the action
2684 + *
2685 + * Description:
2686 +@@ -710,7 +711,7 @@ void blk_trace_shutdown(struct request_queue *q)
2687 + *
2688 + **/
2689 + static void blk_add_trace_rq(struct request_queue *q, struct request *rq,
2690 +- u32 what)
2691 ++ unsigned int nr_bytes, u32 what)
2692 + {
2693 + struct blk_trace *bt = q->blk_trace;
2694 +
2695 +@@ -719,11 +720,11 @@ static void blk_add_trace_rq(struct request_queue *q, struct request *rq,
2696 +
2697 + if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
2698 + what |= BLK_TC_ACT(BLK_TC_PC);
2699 +- __blk_add_trace(bt, 0, blk_rq_bytes(rq), rq->cmd_flags,
2700 ++ __blk_add_trace(bt, 0, nr_bytes, rq->cmd_flags,
2701 + what, rq->errors, rq->cmd_len, rq->cmd);
2702 + } else {
2703 + what |= BLK_TC_ACT(BLK_TC_FS);
2704 +- __blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq),
2705 ++ __blk_add_trace(bt, blk_rq_pos(rq), nr_bytes,
2706 + rq->cmd_flags, what, rq->errors, 0, NULL);
2707 + }
2708 + }
2709 +@@ -731,33 +732,34 @@ static void blk_add_trace_rq(struct request_queue *q, struct request *rq,
2710 + static void blk_add_trace_rq_abort(void *ignore,
2711 + struct request_queue *q, struct request *rq)
2712 + {
2713 +- blk_add_trace_rq(q, rq, BLK_TA_ABORT);
2714 ++ blk_add_trace_rq(q, rq, blk_rq_bytes(rq), BLK_TA_ABORT);
2715 + }
2716 +
2717 + static void blk_add_trace_rq_insert(void *ignore,
2718 + struct request_queue *q, struct request *rq)
2719 + {
2720 +- blk_add_trace_rq(q, rq, BLK_TA_INSERT);
2721 ++ blk_add_trace_rq(q, rq, blk_rq_bytes(rq), BLK_TA_INSERT);
2722 + }
2723 +
2724 + static void blk_add_trace_rq_issue(void *ignore,
2725 + struct request_queue *q, struct request *rq)
2726 + {
2727 +- blk_add_trace_rq(q, rq, BLK_TA_ISSUE);
2728 ++ blk_add_trace_rq(q, rq, blk_rq_bytes(rq), BLK_TA_ISSUE);
2729 + }
2730 +
2731 + static void blk_add_trace_rq_requeue(void *ignore,
2732 + struct request_queue *q,
2733 + struct request *rq)
2734 + {
2735 +- blk_add_trace_rq(q, rq, BLK_TA_REQUEUE);
2736 ++ blk_add_trace_rq(q, rq, blk_rq_bytes(rq), BLK_TA_REQUEUE);
2737 + }
2738 +
2739 + static void blk_add_trace_rq_complete(void *ignore,
2740 + struct request_queue *q,
2741 +- struct request *rq)
2742 ++ struct request *rq,
2743 ++ unsigned int nr_bytes)
2744 + {
2745 +- blk_add_trace_rq(q, rq, BLK_TA_COMPLETE);
2746 ++ blk_add_trace_rq(q, rq, nr_bytes, BLK_TA_COMPLETE);
2747 + }
2748 +
2749 + /**
2750 +diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
2751 +index 031cc5655a51..63630aef3bd3 100644
2752 +--- a/kernel/tracepoint.c
2753 ++++ b/kernel/tracepoint.c
2754 +@@ -641,6 +641,9 @@ static int tracepoint_module_coming(struct module *mod)
2755 + struct tp_module *tp_mod, *iter;
2756 + int ret = 0;
2757 +
2758 ++ if (!mod->num_tracepoints)
2759 ++ return 0;
2760 ++
2761 + /*
2762 + * We skip modules that taint the kernel, especially those with different
2763 + * module headers (for forced load), to make sure we don't cause a crash.
2764 +@@ -684,6 +687,9 @@ static int tracepoint_module_going(struct module *mod)
2765 + {
2766 + struct tp_module *pos;
2767 +
2768 ++ if (!mod->num_tracepoints)
2769 ++ return 0;
2770 ++
2771 + mutex_lock(&tracepoints_mutex);
2772 + tracepoint_update_probe_range(mod->tracepoints_ptrs,
2773 + mod->tracepoints_ptrs + mod->num_tracepoints);
2774 +diff --git a/mm/hugetlb.c b/mm/hugetlb.c
2775 +index efbb9dc67f2f..92e103b72dcb 100644
2776 +--- a/mm/hugetlb.c
2777 ++++ b/mm/hugetlb.c
2778 +@@ -1177,6 +1177,7 @@ static void return_unused_surplus_pages(struct hstate *h,
2779 + while (nr_pages--) {
2780 + if (!free_pool_huge_page(h, &node_states[N_MEMORY], 1))
2781 + break;
2782 ++ cond_resched_lock(&hugetlb_lock);
2783 + }
2784 + }
2785 +
2786 +diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
2787 +index d1537dcd4df8..1b89bc7468de 100644
2788 +--- a/net/8021q/vlan_dev.c
2789 ++++ b/net/8021q/vlan_dev.c
2790 +@@ -512,10 +512,48 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change)
2791 + }
2792 + }
2793 +
2794 ++static int vlan_calculate_locking_subclass(struct net_device *real_dev)
2795 ++{
2796 ++ int subclass = 0;
2797 ++
2798 ++ while (is_vlan_dev(real_dev)) {
2799 ++ subclass++;
2800 ++ real_dev = vlan_dev_priv(real_dev)->real_dev;
2801 ++ }
2802 ++
2803 ++ return subclass;
2804 ++}
2805 ++
2806 ++static void vlan_dev_mc_sync(struct net_device *to, struct net_device *from)
2807 ++{
2808 ++ int err = 0, subclass;
2809 ++
2810 ++ subclass = vlan_calculate_locking_subclass(to);
2811 ++
2812 ++ spin_lock_nested(&to->addr_list_lock, subclass);
2813 ++ err = __hw_addr_sync(&to->mc, &from->mc, to->addr_len);
2814 ++ if (!err)
2815 ++ __dev_set_rx_mode(to);
2816 ++ spin_unlock(&to->addr_list_lock);
2817 ++}
2818 ++
2819 ++static void vlan_dev_uc_sync(struct net_device *to, struct net_device *from)
2820 ++{
2821 ++ int err = 0, subclass;
2822 ++
2823 ++ subclass = vlan_calculate_locking_subclass(to);
2824 ++
2825 ++ spin_lock_nested(&to->addr_list_lock, subclass);
2826 ++ err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len);
2827 ++ if (!err)
2828 ++ __dev_set_rx_mode(to);
2829 ++ spin_unlock(&to->addr_list_lock);
2830 ++}
2831 ++
2832 + static void vlan_dev_set_rx_mode(struct net_device *vlan_dev)
2833 + {
2834 +- dev_mc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev);
2835 +- dev_uc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev);
2836 ++ vlan_dev_mc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev);
2837 ++ vlan_dev_uc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev);
2838 + }
2839 +
2840 + /*
2841 +@@ -624,9 +662,7 @@ static int vlan_dev_init(struct net_device *dev)
2842 +
2843 + SET_NETDEV_DEVTYPE(dev, &vlan_type);
2844 +
2845 +- if (is_vlan_dev(real_dev))
2846 +- subclass = 1;
2847 +-
2848 ++ subclass = vlan_calculate_locking_subclass(dev);
2849 + vlan_dev_set_lockdep_class(dev, subclass);
2850 +
2851 + vlan_dev_priv(dev)->vlan_pcpu_stats = alloc_percpu(struct vlan_pcpu_stats);
2852 +diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
2853 +index 1ce4b8763ef2..067996091638 100644
2854 +--- a/net/batman-adv/gateway_client.c
2855 ++++ b/net/batman-adv/gateway_client.c
2856 +@@ -38,8 +38,10 @@
2857 +
2858 + static void batadv_gw_node_free_ref(struct batadv_gw_node *gw_node)
2859 + {
2860 +- if (atomic_dec_and_test(&gw_node->refcount))
2861 ++ if (atomic_dec_and_test(&gw_node->refcount)) {
2862 ++ batadv_orig_node_free_ref(gw_node->orig_node);
2863 + kfree_rcu(gw_node, rcu);
2864 ++ }
2865 + }
2866 +
2867 + static struct batadv_gw_node *
2868 +@@ -344,9 +346,14 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv,
2869 + struct batadv_gw_node *gw_node;
2870 + int down, up;
2871 +
2872 ++ if (!atomic_inc_not_zero(&orig_node->refcount))
2873 ++ return;
2874 ++
2875 + gw_node = kzalloc(sizeof(*gw_node), GFP_ATOMIC);
2876 +- if (!gw_node)
2877 ++ if (!gw_node) {
2878 ++ batadv_orig_node_free_ref(orig_node);
2879 + return;
2880 ++ }
2881 +
2882 + INIT_HLIST_NODE(&gw_node->list);
2883 + gw_node->orig_node = orig_node;
2884 +diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
2885 +index a2fd37ec35f7..c378750602cd 100644
2886 +--- a/net/bridge/br_input.c
2887 ++++ b/net/bridge/br_input.c
2888 +@@ -72,7 +72,7 @@ int br_handle_frame_finish(struct sk_buff *skb)
2889 + goto drop;
2890 +
2891 + if (!br_allowed_ingress(p->br, nbp_get_vlan_info(p), skb, &vid))
2892 +- goto drop;
2893 ++ goto out;
2894 +
2895 + /* insert into forwarding database after filtering to avoid spoofing */
2896 + br = p->br;
2897 +diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
2898 +index f75d92e4f96b..b47b344e0963 100644
2899 +--- a/net/bridge/br_netlink.c
2900 ++++ b/net/bridge/br_netlink.c
2901 +@@ -446,6 +446,20 @@ static int br_validate(struct nlattr *tb[], struct nlattr *data[])
2902 + return 0;
2903 + }
2904 +
2905 ++static int br_dev_newlink(struct net *src_net, struct net_device *dev,
2906 ++ struct nlattr *tb[], struct nlattr *data[])
2907 ++{
2908 ++ struct net_bridge *br = netdev_priv(dev);
2909 ++
2910 ++ if (tb[IFLA_ADDRESS]) {
2911 ++ spin_lock_bh(&br->lock);
2912 ++ br_stp_change_bridge_id(br, nla_data(tb[IFLA_ADDRESS]));
2913 ++ spin_unlock_bh(&br->lock);
2914 ++ }
2915 ++
2916 ++ return register_netdevice(dev);
2917 ++}
2918 ++
2919 + static size_t br_get_link_af_size(const struct net_device *dev)
2920 + {
2921 + struct net_port_vlans *pv;
2922 +@@ -474,6 +488,7 @@ struct rtnl_link_ops br_link_ops __read_mostly = {
2923 + .priv_size = sizeof(struct net_bridge),
2924 + .setup = br_dev_setup,
2925 + .validate = br_validate,
2926 ++ .newlink = br_dev_newlink,
2927 + .dellink = br_dev_delete,
2928 + };
2929 +
2930 +diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
2931 +index 53f0990eab58..45a26debe64e 100644
2932 +--- a/net/bridge/br_vlan.c
2933 ++++ b/net/bridge/br_vlan.c
2934 +@@ -201,7 +201,7 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
2935 + * rejected.
2936 + */
2937 + if (!v)
2938 +- return false;
2939 ++ goto drop;
2940 +
2941 + err = br_vlan_get_tag(skb, vid);
2942 + if (!*vid) {
2943 +@@ -212,7 +212,7 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
2944 + * vlan untagged or priority-tagged traffic belongs to.
2945 + */
2946 + if (pvid == VLAN_N_VID)
2947 +- return false;
2948 ++ goto drop;
2949 +
2950 + /* PVID is set on this port. Any untagged or priority-tagged
2951 + * ingress frame is considered to belong to this vlan.
2952 +@@ -235,7 +235,8 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
2953 + /* Frame had a valid vlan tag. See if vlan is allowed */
2954 + if (test_bit(*vid, v->vlan_bitmap))
2955 + return true;
2956 +-
2957 ++drop:
2958 ++ kfree_skb(skb);
2959 + return false;
2960 + }
2961 +
2962 +diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
2963 +index ac7802428384..b166fc2ec4b9 100644
2964 +--- a/net/bridge/netfilter/ebtables.c
2965 ++++ b/net/bridge/netfilter/ebtables.c
2966 +@@ -1044,10 +1044,9 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl,
2967 + if (repl->num_counters &&
2968 + copy_to_user(repl->counters, counterstmp,
2969 + repl->num_counters * sizeof(struct ebt_counter))) {
2970 +- ret = -EFAULT;
2971 ++ /* Silent error, can't fail, new table is already in place */
2972 ++ net_warn_ratelimited("ebtables: counters copy to user failed while replacing table\n");
2973 + }
2974 +- else
2975 +- ret = 0;
2976 +
2977 + /* decrease module count and free resources */
2978 + EBT_ENTRY_ITERATE(table->entries, table->entries_size,
2979 +diff --git a/net/core/dev.c b/net/core/dev.c
2980 +index b32797590b40..01d53d62a2ec 100644
2981 +--- a/net/core/dev.c
2982 ++++ b/net/core/dev.c
2983 +@@ -3959,6 +3959,7 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
2984 + skb->vlan_tci = 0;
2985 + skb->dev = napi->dev;
2986 + skb->skb_iif = 0;
2987 ++ skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
2988 +
2989 + napi->skb = skb;
2990 + }
2991 +@@ -4968,6 +4969,7 @@ void __dev_set_rx_mode(struct net_device *dev)
2992 + if (ops->ndo_set_rx_mode)
2993 + ops->ndo_set_rx_mode(dev);
2994 + }
2995 ++EXPORT_SYMBOL(__dev_set_rx_mode);
2996 +
2997 + void dev_set_rx_mode(struct net_device *dev)
2998 + {
2999 +@@ -5246,7 +5248,7 @@ static int dev_new_index(struct net *net)
3000 +
3001 + /* Delayed registration/unregisteration */
3002 + static LIST_HEAD(net_todo_list);
3003 +-static DECLARE_WAIT_QUEUE_HEAD(netdev_unregistering_wq);
3004 ++DECLARE_WAIT_QUEUE_HEAD(netdev_unregistering_wq);
3005 +
3006 + static void net_set_todo(struct net_device *dev)
3007 + {
3008 +diff --git a/net/core/filter.c b/net/core/filter.c
3009 +index ad30d626a5bd..ebce437678fc 100644
3010 +--- a/net/core/filter.c
3011 ++++ b/net/core/filter.c
3012 +@@ -355,6 +355,8 @@ load_b:
3013 +
3014 + if (skb_is_nonlinear(skb))
3015 + return 0;
3016 ++ if (skb->len < sizeof(struct nlattr))
3017 ++ return 0;
3018 + if (A > skb->len - sizeof(struct nlattr))
3019 + return 0;
3020 +
3021 +@@ -371,11 +373,13 @@ load_b:
3022 +
3023 + if (skb_is_nonlinear(skb))
3024 + return 0;
3025 ++ if (skb->len < sizeof(struct nlattr))
3026 ++ return 0;
3027 + if (A > skb->len - sizeof(struct nlattr))
3028 + return 0;
3029 +
3030 + nla = (struct nlattr *)&skb->data[A];
3031 +- if (nla->nla_len > A - skb->len)
3032 ++ if (nla->nla_len > skb->len - A)
3033 + return 0;
3034 +
3035 + nla = nla_find_nested(nla, X);
3036 +diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
3037 +index 81d3a9a08453..7c8ffd974961 100644
3038 +--- a/net/core/net_namespace.c
3039 ++++ b/net/core/net_namespace.c
3040 +@@ -24,7 +24,7 @@
3041 +
3042 + static LIST_HEAD(pernet_list);
3043 + static struct list_head *first_device = &pernet_list;
3044 +-static DEFINE_MUTEX(net_mutex);
3045 ++DEFINE_MUTEX(net_mutex);
3046 +
3047 + LIST_HEAD(net_namespace_list);
3048 + EXPORT_SYMBOL_GPL(net_namespace_list);
3049 +diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
3050 +index 37b492eaa4f8..7b03d44b7be4 100644
3051 +--- a/net/core/rtnetlink.c
3052 ++++ b/net/core/rtnetlink.c
3053 +@@ -353,15 +353,46 @@ void __rtnl_link_unregister(struct rtnl_link_ops *ops)
3054 + }
3055 + EXPORT_SYMBOL_GPL(__rtnl_link_unregister);
3056 +
3057 ++/* Return with the rtnl_lock held when there are no network
3058 ++ * devices unregistering in any network namespace.
3059 ++ */
3060 ++static void rtnl_lock_unregistering_all(void)
3061 ++{
3062 ++ struct net *net;
3063 ++ bool unregistering;
3064 ++ DEFINE_WAIT(wait);
3065 ++
3066 ++ for (;;) {
3067 ++ prepare_to_wait(&netdev_unregistering_wq, &wait,
3068 ++ TASK_UNINTERRUPTIBLE);
3069 ++ unregistering = false;
3070 ++ rtnl_lock();
3071 ++ for_each_net(net) {
3072 ++ if (net->dev_unreg_count > 0) {
3073 ++ unregistering = true;
3074 ++ break;
3075 ++ }
3076 ++ }
3077 ++ if (!unregistering)
3078 ++ break;
3079 ++ __rtnl_unlock();
3080 ++ schedule();
3081 ++ }
3082 ++ finish_wait(&netdev_unregistering_wq, &wait);
3083 ++}
3084 ++
3085 + /**
3086 + * rtnl_link_unregister - Unregister rtnl_link_ops from rtnetlink.
3087 + * @ops: struct rtnl_link_ops * to unregister
3088 + */
3089 + void rtnl_link_unregister(struct rtnl_link_ops *ops)
3090 + {
3091 +- rtnl_lock();
3092 ++ /* Close the race with cleanup_net() */
3093 ++ mutex_lock(&net_mutex);
3094 ++ rtnl_lock_unregistering_all();
3095 + __rtnl_link_unregister(ops);
3096 + rtnl_unlock();
3097 ++ mutex_unlock(&net_mutex);
3098 + }
3099 + EXPORT_SYMBOL_GPL(rtnl_link_unregister);
3100 +
3101 +@@ -714,7 +745,8 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev,
3102 + return 0;
3103 + }
3104 +
3105 +-static size_t rtnl_port_size(const struct net_device *dev)
3106 ++static size_t rtnl_port_size(const struct net_device *dev,
3107 ++ u32 ext_filter_mask)
3108 + {
3109 + size_t port_size = nla_total_size(4) /* PORT_VF */
3110 + + nla_total_size(PORT_PROFILE_MAX) /* PORT_PROFILE */
3111 +@@ -730,7 +762,8 @@ static size_t rtnl_port_size(const struct net_device *dev)
3112 + size_t port_self_size = nla_total_size(sizeof(struct nlattr))
3113 + + port_size;
3114 +
3115 +- if (!dev->netdev_ops->ndo_get_vf_port || !dev->dev.parent)
3116 ++ if (!dev->netdev_ops->ndo_get_vf_port || !dev->dev.parent ||
3117 ++ !(ext_filter_mask & RTEXT_FILTER_VF))
3118 + return 0;
3119 + if (dev_num_vf(dev->dev.parent))
3120 + return port_self_size + vf_ports_size +
3121 +@@ -765,7 +798,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
3122 + + nla_total_size(ext_filter_mask
3123 + & RTEXT_FILTER_VF ? 4 : 0) /* IFLA_NUM_VF */
3124 + + rtnl_vfinfo_size(dev, ext_filter_mask) /* IFLA_VFINFO_LIST */
3125 +- + rtnl_port_size(dev) /* IFLA_VF_PORTS + IFLA_PORT_SELF */
3126 ++ + rtnl_port_size(dev, ext_filter_mask) /* IFLA_VF_PORTS + IFLA_PORT_SELF */
3127 + + rtnl_link_get_size(dev) /* IFLA_LINKINFO */
3128 + + rtnl_link_get_af_size(dev) /* IFLA_AF_SPEC */
3129 + + nla_total_size(MAX_PHYS_PORT_ID_LEN); /* IFLA_PHYS_PORT_ID */
3130 +@@ -827,11 +860,13 @@ static int rtnl_port_self_fill(struct sk_buff *skb, struct net_device *dev)
3131 + return 0;
3132 + }
3133 +
3134 +-static int rtnl_port_fill(struct sk_buff *skb, struct net_device *dev)
3135 ++static int rtnl_port_fill(struct sk_buff *skb, struct net_device *dev,
3136 ++ u32 ext_filter_mask)
3137 + {
3138 + int err;
3139 +
3140 +- if (!dev->netdev_ops->ndo_get_vf_port || !dev->dev.parent)
3141 ++ if (!dev->netdev_ops->ndo_get_vf_port || !dev->dev.parent ||
3142 ++ !(ext_filter_mask & RTEXT_FILTER_VF))
3143 + return 0;
3144 +
3145 + err = rtnl_port_self_fill(skb, dev);
3146 +@@ -1016,7 +1051,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
3147 + nla_nest_end(skb, vfinfo);
3148 + }
3149 +
3150 +- if (rtnl_port_fill(skb, dev))
3151 ++ if (rtnl_port_fill(skb, dev, ext_filter_mask))
3152 + goto nla_put_failure;
3153 +
3154 + if (dev->rtnl_link_ops) {
3155 +@@ -1070,6 +1105,7 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
3156 + struct hlist_head *head;
3157 + struct nlattr *tb[IFLA_MAX+1];
3158 + u32 ext_filter_mask = 0;
3159 ++ int err;
3160 +
3161 + s_h = cb->args[0];
3162 + s_idx = cb->args[1];
3163 +@@ -1090,11 +1126,17 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
3164 + hlist_for_each_entry_rcu(dev, head, index_hlist) {
3165 + if (idx < s_idx)
3166 + goto cont;
3167 +- if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK,
3168 +- NETLINK_CB(cb->skb).portid,
3169 +- cb->nlh->nlmsg_seq, 0,
3170 +- NLM_F_MULTI,
3171 +- ext_filter_mask) <= 0)
3172 ++ err = rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK,
3173 ++ NETLINK_CB(cb->skb).portid,
3174 ++ cb->nlh->nlmsg_seq, 0,
3175 ++ NLM_F_MULTI,
3176 ++ ext_filter_mask);
3177 ++ /* If we ran out of room on the first message,
3178 ++ * we're in trouble
3179 ++ */
3180 ++ WARN_ON((err == -EMSGSIZE) && (skb->len == 0));
3181 ++
3182 ++ if (err <= 0)
3183 + goto out;
3184 +
3185 + nl_dump_check_consistent(cb, nlmsg_hdr(skb));
3186 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
3187 +index 21571dc4f2df..f69f2ed1dbc3 100644
3188 +--- a/net/core/skbuff.c
3189 ++++ b/net/core/skbuff.c
3190 +@@ -3535,12 +3535,14 @@ EXPORT_SYMBOL_GPL(skb_scrub_packet);
3191 + unsigned int skb_gso_transport_seglen(const struct sk_buff *skb)
3192 + {
3193 + const struct skb_shared_info *shinfo = skb_shinfo(skb);
3194 +- unsigned int hdr_len;
3195 +
3196 + if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
3197 +- hdr_len = tcp_hdrlen(skb);
3198 +- else
3199 +- hdr_len = sizeof(struct udphdr);
3200 +- return hdr_len + shinfo->gso_size;
3201 ++ return tcp_hdrlen(skb) + shinfo->gso_size;
3202 ++
3203 ++ /* UFO sets gso_size to the size of the fragmentation
3204 ++ * payload, i.e. the size of the L4 (UDP) header is already
3205 ++ * accounted for.
3206 ++ */
3207 ++ return shinfo->gso_size;
3208 + }
3209 + EXPORT_SYMBOL_GPL(skb_gso_transport_seglen);
3210 +diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c
3211 +index a0e9cf6379de..6a7fae228634 100644
3212 +--- a/net/core/sock_diag.c
3213 ++++ b/net/core/sock_diag.c
3214 +@@ -49,7 +49,7 @@ int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attrtype)
3215 + }
3216 + EXPORT_SYMBOL_GPL(sock_diag_put_meminfo);
3217 +
3218 +-int sock_diag_put_filterinfo(struct user_namespace *user_ns, struct sock *sk,
3219 ++int sock_diag_put_filterinfo(struct sock *sk,
3220 + struct sk_buff *skb, int attrtype)
3221 + {
3222 + struct nlattr *attr;
3223 +@@ -57,7 +57,7 @@ int sock_diag_put_filterinfo(struct user_namespace *user_ns, struct sock *sk,
3224 + unsigned int len;
3225 + int err = 0;
3226 +
3227 +- if (!ns_capable(user_ns, CAP_NET_ADMIN)) {
3228 ++ if (!ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN)) {
3229 + nla_reserve(skb, attrtype, 0);
3230 + return 0;
3231 + }
3232 +diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
3233 +index d5dbca5ecf62..9f1014ab86c6 100644
3234 +--- a/net/ipv4/fib_semantics.c
3235 ++++ b/net/ipv4/fib_semantics.c
3236 +@@ -819,13 +819,13 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
3237 + fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL);
3238 + if (fi == NULL)
3239 + goto failure;
3240 ++ fib_info_cnt++;
3241 + if (cfg->fc_mx) {
3242 + fi->fib_metrics = kzalloc(sizeof(u32) * RTAX_MAX, GFP_KERNEL);
3243 + if (!fi->fib_metrics)
3244 + goto failure;
3245 + } else
3246 + fi->fib_metrics = (u32 *) dst_default_metrics;
3247 +- fib_info_cnt++;
3248 +
3249 + fi->fib_net = hold_net(net);
3250 + fi->fib_protocol = cfg->fc_protocol;
3251 +diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
3252 +index 98d7e53d2afd..bd1c5baf69be 100644
3253 +--- a/net/ipv4/ip_forward.c
3254 ++++ b/net/ipv4/ip_forward.c
3255 +@@ -42,12 +42,12 @@
3256 + static bool ip_may_fragment(const struct sk_buff *skb)
3257 + {
3258 + return unlikely((ip_hdr(skb)->frag_off & htons(IP_DF)) == 0) ||
3259 +- !skb->local_df;
3260 ++ skb->local_df;
3261 + }
3262 +
3263 + static bool ip_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu)
3264 + {
3265 +- if (skb->len <= mtu || skb->local_df)
3266 ++ if (skb->len <= mtu)
3267 + return false;
3268 +
3269 + if (skb_is_gso(skb) && skb_gso_network_seglen(skb) <= mtu)
3270 +diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
3271 +index d30636080a11..b3becd0727db 100644
3272 +--- a/net/ipv4/ip_gre.c
3273 ++++ b/net/ipv4/ip_gre.c
3274 +@@ -463,6 +463,7 @@ static const struct net_device_ops ipgre_netdev_ops = {
3275 + static void ipgre_tunnel_setup(struct net_device *dev)
3276 + {
3277 + dev->netdev_ops = &ipgre_netdev_ops;
3278 ++ dev->type = ARPHRD_IPGRE;
3279 + ip_tunnel_setup(dev, ipgre_net_id);
3280 + }
3281 +
3282 +@@ -501,7 +502,6 @@ static int ipgre_tunnel_init(struct net_device *dev)
3283 + memcpy(dev->dev_addr, &iph->saddr, 4);
3284 + memcpy(dev->broadcast, &iph->daddr, 4);
3285 +
3286 +- dev->type = ARPHRD_IPGRE;
3287 + dev->flags = IFF_NOARP;
3288 + dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
3289 + dev->addr_len = 4;
3290 +diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
3291 +index 3bedb26cfb53..d9dbe0f78612 100644
3292 +--- a/net/ipv4/ip_tunnel.c
3293 ++++ b/net/ipv4/ip_tunnel.c
3294 +@@ -433,6 +433,8 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
3295 + tunnel->i_seqno = ntohl(tpi->seq) + 1;
3296 + }
3297 +
3298 ++ skb_reset_network_header(skb);
3299 ++
3300 + err = IP_ECN_decapsulate(iph, skb);
3301 + if (unlikely(err)) {
3302 + if (log_ecn_error)
3303 +@@ -853,6 +855,7 @@ int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
3304 + */
3305 + if (!IS_ERR(itn->fb_tunnel_dev)) {
3306 + itn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
3307 ++ itn->fb_tunnel_dev->mtu = ip_tunnel_bind_dev(itn->fb_tunnel_dev);
3308 + ip_tunnel_add(itn, netdev_priv(itn->fb_tunnel_dev));
3309 + }
3310 + rtnl_unlock();
3311 +diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
3312 +index 26847e189c04..33e2bf806249 100644
3313 +--- a/net/ipv4/ip_vti.c
3314 ++++ b/net/ipv4/ip_vti.c
3315 +@@ -271,6 +271,7 @@ static const struct net_device_ops vti_netdev_ops = {
3316 + static void vti_tunnel_setup(struct net_device *dev)
3317 + {
3318 + dev->netdev_ops = &vti_netdev_ops;
3319 ++ dev->type = ARPHRD_TUNNEL;
3320 + ip_tunnel_setup(dev, vti_net_id);
3321 + }
3322 +
3323 +@@ -282,7 +283,6 @@ static int vti_tunnel_init(struct net_device *dev)
3324 + memcpy(dev->dev_addr, &iph->saddr, 4);
3325 + memcpy(dev->broadcast, &iph->daddr, 4);
3326 +
3327 +- dev->type = ARPHRD_TUNNEL;
3328 + dev->hard_header_len = LL_MAX_HEADER + sizeof(struct iphdr);
3329 + dev->mtu = ETH_DATA_LEN;
3330 + dev->flags = IFF_NOARP;
3331 +diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
3332 +index 85a4f21aac1a..c8abe31961ed 100644
3333 +--- a/net/ipv4/netfilter/arp_tables.c
3334 ++++ b/net/ipv4/netfilter/arp_tables.c
3335 +@@ -1039,8 +1039,10 @@ static int __do_replace(struct net *net, const char *name,
3336 +
3337 + xt_free_table_info(oldinfo);
3338 + if (copy_to_user(counters_ptr, counters,
3339 +- sizeof(struct xt_counters) * num_counters) != 0)
3340 +- ret = -EFAULT;
3341 ++ sizeof(struct xt_counters) * num_counters) != 0) {
3342 ++ /* Silent error, can't fail, new table is already in place */
3343 ++ net_warn_ratelimited("arptables: counters copy to user failed while replacing table\n");
3344 ++ }
3345 + vfree(counters);
3346 + xt_table_unlock(t);
3347 + return ret;
3348 +diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
3349 +index d23118d95ff9..651c10774d58 100644
3350 +--- a/net/ipv4/netfilter/ip_tables.c
3351 ++++ b/net/ipv4/netfilter/ip_tables.c
3352 +@@ -1226,8 +1226,10 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks,
3353 +
3354 + xt_free_table_info(oldinfo);
3355 + if (copy_to_user(counters_ptr, counters,
3356 +- sizeof(struct xt_counters) * num_counters) != 0)
3357 +- ret = -EFAULT;
3358 ++ sizeof(struct xt_counters) * num_counters) != 0) {
3359 ++ /* Silent error, can't fail, new table is already in place */
3360 ++ net_warn_ratelimited("iptables: counters copy to user failed while replacing table\n");
3361 ++ }
3362 + vfree(counters);
3363 + xt_table_unlock(t);
3364 + return ret;
3365 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
3366 +index 2557b9a52373..2b681867164d 100644
3367 +--- a/net/ipv4/route.c
3368 ++++ b/net/ipv4/route.c
3369 +@@ -1525,7 +1525,7 @@ static int __mkroute_input(struct sk_buff *skb,
3370 + struct in_device *out_dev;
3371 + unsigned int flags = 0;
3372 + bool do_cache;
3373 +- u32 itag;
3374 ++ u32 itag = 0;
3375 +
3376 + /* get a working reference to the output device */
3377 + out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res));
3378 +@@ -2358,7 +2358,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
3379 + }
3380 + } else
3381 + #endif
3382 +- if (nla_put_u32(skb, RTA_IIF, rt->rt_iif))
3383 ++ if (nla_put_u32(skb, RTA_IIF, skb->dev->ifindex))
3384 + goto nla_put_failure;
3385 + }
3386 +
3387 +diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
3388 +index b6ae92a51f58..894b7cea5d7b 100644
3389 +--- a/net/ipv4/tcp_cubic.c
3390 ++++ b/net/ipv4/tcp_cubic.c
3391 +@@ -408,7 +408,7 @@ static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us)
3392 + ratio -= ca->delayed_ack >> ACK_RATIO_SHIFT;
3393 + ratio += cnt;
3394 +
3395 +- ca->delayed_ack = min(ratio, ACK_RATIO_LIMIT);
3396 ++ ca->delayed_ack = clamp(ratio, 1U, ACK_RATIO_LIMIT);
3397 + }
3398 +
3399 + /* Some calls are for duplicates without timetamps */
3400 +diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
3401 +index 5bec666aba61..5e30677953d7 100644
3402 +--- a/net/ipv6/ip6_fib.c
3403 ++++ b/net/ipv6/ip6_fib.c
3404 +@@ -1418,7 +1418,7 @@ static int fib6_walk_continue(struct fib6_walker_t *w)
3405 +
3406 + if (w->skip) {
3407 + w->skip--;
3408 +- continue;
3409 ++ goto skip;
3410 + }
3411 +
3412 + err = w->func(w);
3413 +@@ -1428,6 +1428,7 @@ static int fib6_walk_continue(struct fib6_walker_t *w)
3414 + w->count++;
3415 + continue;
3416 + }
3417 ++skip:
3418 + w->state = FWS_U;
3419 + case FWS_U:
3420 + if (fn == w->root)
3421 +diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
3422 +index bf4a9a084de5..994d73cc2fe0 100644
3423 +--- a/net/ipv6/ip6_gre.c
3424 ++++ b/net/ipv6/ip6_gre.c
3425 +@@ -1554,6 +1554,15 @@ static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[],
3426 + return 0;
3427 + }
3428 +
3429 ++static void ip6gre_dellink(struct net_device *dev, struct list_head *head)
3430 ++{
3431 ++ struct net *net = dev_net(dev);
3432 ++ struct ip6gre_net *ign = net_generic(net, ip6gre_net_id);
3433 ++
3434 ++ if (dev != ign->fb_tunnel_dev)
3435 ++ unregister_netdevice_queue(dev, head);
3436 ++}
3437 ++
3438 + static size_t ip6gre_get_size(const struct net_device *dev)
3439 + {
3440 + return
3441 +@@ -1631,6 +1640,7 @@ static struct rtnl_link_ops ip6gre_link_ops __read_mostly = {
3442 + .validate = ip6gre_tunnel_validate,
3443 + .newlink = ip6gre_newlink,
3444 + .changelink = ip6gre_changelink,
3445 ++ .dellink = ip6gre_dellink,
3446 + .get_size = ip6gre_get_size,
3447 + .fill_info = ip6gre_fill_info,
3448 + };
3449 +diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
3450 +index 516e136f15ca..45010f0d1167 100644
3451 +--- a/net/ipv6/ip6_output.c
3452 ++++ b/net/ipv6/ip6_output.c
3453 +@@ -323,12 +323,16 @@ static inline int ip6_forward_finish(struct sk_buff *skb)
3454 +
3455 + static bool ip6_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)
3456 + {
3457 +- if (skb->len <= mtu || skb->local_df)
3458 ++ if (skb->len <= mtu)
3459 + return false;
3460 +
3461 ++ /* ipv6 conntrack defrag sets max_frag_size + local_df */
3462 + if (IP6CB(skb)->frag_max_size && IP6CB(skb)->frag_max_size > mtu)
3463 + return true;
3464 +
3465 ++ if (skb->local_df)
3466 ++ return false;
3467 ++
3468 + if (skb_is_gso(skb) && skb_gso_network_seglen(skb) <= mtu)
3469 + return false;
3470 +
3471 +diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
3472 +index c1e11b5d6ccc..aac89c3c6af4 100644
3473 +--- a/net/ipv6/ip6_tunnel.c
3474 ++++ b/net/ipv6/ip6_tunnel.c
3475 +@@ -1549,7 +1549,7 @@ static int ip6_tnl_validate(struct nlattr *tb[], struct nlattr *data[])
3476 + {
3477 + u8 proto;
3478 +
3479 +- if (!data)
3480 ++ if (!data || !data[IFLA_IPTUN_PROTO])
3481 + return 0;
3482 +
3483 + proto = nla_get_u8(data[IFLA_IPTUN_PROTO]);
3484 +diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
3485 +index 44400c216dc6..89a4e4ddd8bb 100644
3486 +--- a/net/ipv6/netfilter/ip6_tables.c
3487 ++++ b/net/ipv6/netfilter/ip6_tables.c
3488 +@@ -1236,8 +1236,10 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks,
3489 +
3490 + xt_free_table_info(oldinfo);
3491 + if (copy_to_user(counters_ptr, counters,
3492 +- sizeof(struct xt_counters) * num_counters) != 0)
3493 +- ret = -EFAULT;
3494 ++ sizeof(struct xt_counters) * num_counters) != 0) {
3495 ++ /* Silent error, can't fail, new table is already in place */
3496 ++ net_warn_ratelimited("ip6tables: counters copy to user failed while replacing table\n");
3497 ++ }
3498 + vfree(counters);
3499 + xt_table_unlock(t);
3500 + return ret;
3501 +diff --git a/net/ipv6/route.c b/net/ipv6/route.c
3502 +index 77f81beabbd3..b4bb6a29aa16 100644
3503 +--- a/net/ipv6/route.c
3504 ++++ b/net/ipv6/route.c
3505 +@@ -1329,7 +1329,7 @@ static unsigned int ip6_mtu(const struct dst_entry *dst)
3506 + unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
3507 +
3508 + if (mtu)
3509 +- return mtu;
3510 ++ goto out;
3511 +
3512 + mtu = IPV6_MIN_MTU;
3513 +
3514 +@@ -1339,7 +1339,8 @@ static unsigned int ip6_mtu(const struct dst_entry *dst)
3515 + mtu = idev->cnf.mtu6;
3516 + rcu_read_unlock();
3517 +
3518 +- return mtu;
3519 ++out:
3520 ++ return min_t(unsigned int, mtu, IP6_MAX_MTU);
3521 + }
3522 +
3523 + static struct dst_entry *icmp6_dst_gc_list;
3524 +diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
3525 +index 44441c0c5037..9a0e5874e73e 100644
3526 +--- a/net/l2tp/l2tp_ppp.c
3527 ++++ b/net/l2tp/l2tp_ppp.c
3528 +@@ -754,9 +754,9 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
3529 + session->deref = pppol2tp_session_sock_put;
3530 +
3531 + /* If PMTU discovery was enabled, use the MTU that was discovered */
3532 +- dst = sk_dst_get(sk);
3533 ++ dst = sk_dst_get(tunnel->sock);
3534 + if (dst != NULL) {
3535 +- u32 pmtu = dst_mtu(__sk_dst_get(sk));
3536 ++ u32 pmtu = dst_mtu(__sk_dst_get(tunnel->sock));
3537 + if (pmtu != 0)
3538 + session->mtu = session->mru = pmtu -
3539 + PPPOL2TP_HEADER_OVERHEAD;
3540 +diff --git a/net/packet/diag.c b/net/packet/diag.c
3541 +index a9584a2f6d69..ec8b6e8a80b1 100644
3542 +--- a/net/packet/diag.c
3543 ++++ b/net/packet/diag.c
3544 +@@ -171,7 +171,7 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
3545 + goto out_nlmsg_trim;
3546 +
3547 + if ((req->pdiag_show & PACKET_SHOW_FILTER) &&
3548 +- sock_diag_put_filterinfo(user_ns, sk, skb, PACKET_DIAG_FILTER))
3549 ++ sock_diag_put_filterinfo(sk, skb, PACKET_DIAG_FILTER))
3550 + goto out_nlmsg_trim;
3551 +
3552 + return nlmsg_end(skb, nlh);
3553 +diff --git a/net/sctp/auth.c b/net/sctp/auth.c
3554 +index 8c4fa5dec824..43b871f6cddf 100644
3555 +--- a/net/sctp/auth.c
3556 ++++ b/net/sctp/auth.c
3557 +@@ -387,14 +387,13 @@ nomem:
3558 + */
3559 + int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp)
3560 + {
3561 +- struct net *net = sock_net(asoc->base.sk);
3562 + struct sctp_auth_bytes *secret;
3563 + struct sctp_shared_key *ep_key;
3564 +
3565 + /* If we don't support AUTH, or peer is not capable
3566 + * we don't need to do anything.
3567 + */
3568 +- if (!net->sctp.auth_enable || !asoc->peer.auth_capable)
3569 ++ if (!asoc->ep->auth_enable || !asoc->peer.auth_capable)
3570 + return 0;
3571 +
3572 + /* If the key_id is non-zero and we couldn't find an
3573 +@@ -441,16 +440,16 @@ struct sctp_shared_key *sctp_auth_get_shkey(
3574 + */
3575 + int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp)
3576 + {
3577 +- struct net *net = sock_net(ep->base.sk);
3578 + struct crypto_hash *tfm = NULL;
3579 + __u16 id;
3580 +
3581 +- /* if the transforms are already allocted, we are done */
3582 +- if (!net->sctp.auth_enable) {
3583 ++ /* If AUTH extension is disabled, we are done */
3584 ++ if (!ep->auth_enable) {
3585 + ep->auth_hmacs = NULL;
3586 + return 0;
3587 + }
3588 +
3589 ++ /* If the transforms are already allocated, we are done */
3590 + if (ep->auth_hmacs)
3591 + return 0;
3592 +
3593 +@@ -671,12 +670,10 @@ static int __sctp_auth_cid(sctp_cid_t chunk, struct sctp_chunks_param *param)
3594 + /* Check if peer requested that this chunk is authenticated */
3595 + int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc)
3596 + {
3597 +- struct net *net;
3598 + if (!asoc)
3599 + return 0;
3600 +
3601 +- net = sock_net(asoc->base.sk);
3602 +- if (!net->sctp.auth_enable || !asoc->peer.auth_capable)
3603 ++ if (!asoc->ep->auth_enable || !asoc->peer.auth_capable)
3604 + return 0;
3605 +
3606 + return __sctp_auth_cid(chunk, asoc->peer.peer_chunks);
3607 +@@ -685,12 +682,10 @@ int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc)
3608 + /* Check if we requested that peer authenticate this chunk. */
3609 + int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc)
3610 + {
3611 +- struct net *net;
3612 + if (!asoc)
3613 + return 0;
3614 +
3615 +- net = sock_net(asoc->base.sk);
3616 +- if (!net->sctp.auth_enable)
3617 ++ if (!asoc->ep->auth_enable)
3618 + return 0;
3619 +
3620 + return __sctp_auth_cid(chunk,
3621 +diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
3622 +index 09b8daac87c8..477dd23a9864 100644
3623 +--- a/net/sctp/endpointola.c
3624 ++++ b/net/sctp/endpointola.c
3625 +@@ -69,7 +69,8 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
3626 + if (!ep->digest)
3627 + return NULL;
3628 +
3629 +- if (net->sctp.auth_enable) {
3630 ++ ep->auth_enable = net->sctp.auth_enable;
3631 ++ if (ep->auth_enable) {
3632 + /* Allocate space for HMACS and CHUNKS authentication
3633 + * variables. There are arrays that we encode directly
3634 + * into parameters to make the rest of the operations easier.
3635 +diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
3636 +index 5e17092f4ada..2b216f1f6b23 100644
3637 +--- a/net/sctp/protocol.c
3638 ++++ b/net/sctp/protocol.c
3639 +@@ -492,8 +492,13 @@ static void sctp_v4_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
3640 + continue;
3641 + if ((laddr->state == SCTP_ADDR_SRC) &&
3642 + (AF_INET == laddr->a.sa.sa_family)) {
3643 +- fl4->saddr = laddr->a.v4.sin_addr.s_addr;
3644 + fl4->fl4_sport = laddr->a.v4.sin_port;
3645 ++ flowi4_update_output(fl4,
3646 ++ asoc->base.sk->sk_bound_dev_if,
3647 ++ RT_CONN_FLAGS(asoc->base.sk),
3648 ++ daddr->v4.sin_addr.s_addr,
3649 ++ laddr->a.v4.sin_addr.s_addr);
3650 ++
3651 + rt = ip_route_output_key(sock_net(sk), fl4);
3652 + if (!IS_ERR(rt)) {
3653 + dst = &rt->dst;
3654 +diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
3655 +index 26be077b8267..1e06f3b23108 100644
3656 +--- a/net/sctp/sm_make_chunk.c
3657 ++++ b/net/sctp/sm_make_chunk.c
3658 +@@ -218,6 +218,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
3659 + gfp_t gfp, int vparam_len)
3660 + {
3661 + struct net *net = sock_net(asoc->base.sk);
3662 ++ struct sctp_endpoint *ep = asoc->ep;
3663 + sctp_inithdr_t init;
3664 + union sctp_params addrs;
3665 + size_t chunksize;
3666 +@@ -277,7 +278,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
3667 + chunksize += vparam_len;
3668 +
3669 + /* Account for AUTH related parameters */
3670 +- if (net->sctp.auth_enable) {
3671 ++ if (ep->auth_enable) {
3672 + /* Add random parameter length*/
3673 + chunksize += sizeof(asoc->c.auth_random);
3674 +
3675 +@@ -362,7 +363,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
3676 + }
3677 +
3678 + /* Add SCTP-AUTH chunks to the parameter list */
3679 +- if (net->sctp.auth_enable) {
3680 ++ if (ep->auth_enable) {
3681 + sctp_addto_chunk(retval, sizeof(asoc->c.auth_random),
3682 + asoc->c.auth_random);
3683 + if (auth_hmacs)
3684 +@@ -2023,7 +2024,7 @@ static void sctp_process_ext_param(struct sctp_association *asoc,
3685 + /* if the peer reports AUTH, assume that he
3686 + * supports AUTH.
3687 + */
3688 +- if (net->sctp.auth_enable)
3689 ++ if (asoc->ep->auth_enable)
3690 + asoc->peer.auth_capable = 1;
3691 + break;
3692 + case SCTP_CID_ASCONF:
3693 +@@ -2115,6 +2116,7 @@ static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc,
3694 + * SCTP_IERROR_NO_ERROR - continue with the chunk
3695 + */
3696 + static sctp_ierror_t sctp_verify_param(struct net *net,
3697 ++ const struct sctp_endpoint *ep,
3698 + const struct sctp_association *asoc,
3699 + union sctp_params param,
3700 + sctp_cid_t cid,
3701 +@@ -2165,7 +2167,7 @@ static sctp_ierror_t sctp_verify_param(struct net *net,
3702 + goto fallthrough;
3703 +
3704 + case SCTP_PARAM_RANDOM:
3705 +- if (!net->sctp.auth_enable)
3706 ++ if (!ep->auth_enable)
3707 + goto fallthrough;
3708 +
3709 + /* SCTP-AUTH: Secion 6.1
3710 +@@ -2182,7 +2184,7 @@ static sctp_ierror_t sctp_verify_param(struct net *net,
3711 + break;
3712 +
3713 + case SCTP_PARAM_CHUNKS:
3714 +- if (!net->sctp.auth_enable)
3715 ++ if (!ep->auth_enable)
3716 + goto fallthrough;
3717 +
3718 + /* SCTP-AUTH: Section 3.2
3719 +@@ -2198,7 +2200,7 @@ static sctp_ierror_t sctp_verify_param(struct net *net,
3720 + break;
3721 +
3722 + case SCTP_PARAM_HMAC_ALGO:
3723 +- if (!net->sctp.auth_enable)
3724 ++ if (!ep->auth_enable)
3725 + goto fallthrough;
3726 +
3727 + hmacs = (struct sctp_hmac_algo_param *)param.p;
3728 +@@ -2233,10 +2235,9 @@ fallthrough:
3729 + }
3730 +
3731 + /* Verify the INIT packet before we process it. */
3732 +-int sctp_verify_init(struct net *net, const struct sctp_association *asoc,
3733 +- sctp_cid_t cid,
3734 +- sctp_init_chunk_t *peer_init,
3735 +- struct sctp_chunk *chunk,
3736 ++int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep,
3737 ++ const struct sctp_association *asoc, sctp_cid_t cid,
3738 ++ sctp_init_chunk_t *peer_init, struct sctp_chunk *chunk,
3739 + struct sctp_chunk **errp)
3740 + {
3741 + union sctp_params param;
3742 +@@ -2277,8 +2278,8 @@ int sctp_verify_init(struct net *net, const struct sctp_association *asoc,
3743 +
3744 + /* Verify all the variable length parameters */
3745 + sctp_walk_params(param, peer_init, init_hdr.params) {
3746 +-
3747 +- result = sctp_verify_param(net, asoc, param, cid, chunk, errp);
3748 ++ result = sctp_verify_param(net, ep, asoc, param, cid,
3749 ++ chunk, errp);
3750 + switch (result) {
3751 + case SCTP_IERROR_ABORT:
3752 + case SCTP_IERROR_NOMEM:
3753 +@@ -2510,6 +2511,7 @@ static int sctp_process_param(struct sctp_association *asoc,
3754 + struct sctp_af *af;
3755 + union sctp_addr_param *addr_param;
3756 + struct sctp_transport *t;
3757 ++ struct sctp_endpoint *ep = asoc->ep;
3758 +
3759 + /* We maintain all INIT parameters in network byte order all the
3760 + * time. This allows us to not worry about whether the parameters
3761 +@@ -2649,7 +2651,7 @@ do_addr_param:
3762 + goto fall_through;
3763 +
3764 + case SCTP_PARAM_RANDOM:
3765 +- if (!net->sctp.auth_enable)
3766 ++ if (!ep->auth_enable)
3767 + goto fall_through;
3768 +
3769 + /* Save peer's random parameter */
3770 +@@ -2662,7 +2664,7 @@ do_addr_param:
3771 + break;
3772 +
3773 + case SCTP_PARAM_HMAC_ALGO:
3774 +- if (!net->sctp.auth_enable)
3775 ++ if (!ep->auth_enable)
3776 + goto fall_through;
3777 +
3778 + /* Save peer's HMAC list */
3779 +@@ -2678,7 +2680,7 @@ do_addr_param:
3780 + break;
3781 +
3782 + case SCTP_PARAM_CHUNKS:
3783 +- if (!net->sctp.auth_enable)
3784 ++ if (!ep->auth_enable)
3785 + goto fall_through;
3786 +
3787 + asoc->peer.peer_chunks = kmemdup(param.p,
3788 +diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
3789 +index 0a5f0508c43a..5dcfe8ca7f69 100644
3790 +--- a/net/sctp/sm_statefuns.c
3791 ++++ b/net/sctp/sm_statefuns.c
3792 +@@ -358,7 +358,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net,
3793 +
3794 + /* Verify the INIT chunk before processing it. */
3795 + err_chunk = NULL;
3796 +- if (!sctp_verify_init(net, asoc, chunk->chunk_hdr->type,
3797 ++ if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type,
3798 + (sctp_init_chunk_t *)chunk->chunk_hdr, chunk,
3799 + &err_chunk)) {
3800 + /* This chunk contains fatal error. It is to be discarded.
3801 +@@ -525,7 +525,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(struct net *net,
3802 +
3803 + /* Verify the INIT chunk before processing it. */
3804 + err_chunk = NULL;
3805 +- if (!sctp_verify_init(net, asoc, chunk->chunk_hdr->type,
3806 ++ if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type,
3807 + (sctp_init_chunk_t *)chunk->chunk_hdr, chunk,
3808 + &err_chunk)) {
3809 +
3810 +@@ -1431,7 +1431,7 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
3811 +
3812 + /* Verify the INIT chunk before processing it. */
3813 + err_chunk = NULL;
3814 +- if (!sctp_verify_init(net, asoc, chunk->chunk_hdr->type,
3815 ++ if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type,
3816 + (sctp_init_chunk_t *)chunk->chunk_hdr, chunk,
3817 + &err_chunk)) {
3818 + /* This chunk contains fatal error. It is to be discarded.
3819 +diff --git a/net/sctp/socket.c b/net/sctp/socket.c
3820 +index 14c801528da8..e00a041129c2 100644
3821 +--- a/net/sctp/socket.c
3822 ++++ b/net/sctp/socket.c
3823 +@@ -3296,10 +3296,10 @@ static int sctp_setsockopt_auth_chunk(struct sock *sk,
3824 + char __user *optval,
3825 + unsigned int optlen)
3826 + {
3827 +- struct net *net = sock_net(sk);
3828 ++ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
3829 + struct sctp_authchunk val;
3830 +
3831 +- if (!net->sctp.auth_enable)
3832 ++ if (!ep->auth_enable)
3833 + return -EACCES;
3834 +
3835 + if (optlen != sizeof(struct sctp_authchunk))
3836 +@@ -3316,7 +3316,7 @@ static int sctp_setsockopt_auth_chunk(struct sock *sk,
3837 + }
3838 +
3839 + /* add this chunk id to the endpoint */
3840 +- return sctp_auth_ep_add_chunkid(sctp_sk(sk)->ep, val.sauth_chunk);
3841 ++ return sctp_auth_ep_add_chunkid(ep, val.sauth_chunk);
3842 + }
3843 +
3844 + /*
3845 +@@ -3329,12 +3329,12 @@ static int sctp_setsockopt_hmac_ident(struct sock *sk,
3846 + char __user *optval,
3847 + unsigned int optlen)
3848 + {
3849 +- struct net *net = sock_net(sk);
3850 ++ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
3851 + struct sctp_hmacalgo *hmacs;
3852 + u32 idents;
3853 + int err;
3854 +
3855 +- if (!net->sctp.auth_enable)
3856 ++ if (!ep->auth_enable)
3857 + return -EACCES;
3858 +
3859 + if (optlen < sizeof(struct sctp_hmacalgo))
3860 +@@ -3351,7 +3351,7 @@ static int sctp_setsockopt_hmac_ident(struct sock *sk,
3861 + goto out;
3862 + }
3863 +
3864 +- err = sctp_auth_ep_set_hmacs(sctp_sk(sk)->ep, hmacs);
3865 ++ err = sctp_auth_ep_set_hmacs(ep, hmacs);
3866 + out:
3867 + kfree(hmacs);
3868 + return err;
3869 +@@ -3367,12 +3367,12 @@ static int sctp_setsockopt_auth_key(struct sock *sk,
3870 + char __user *optval,
3871 + unsigned int optlen)
3872 + {
3873 +- struct net *net = sock_net(sk);
3874 ++ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
3875 + struct sctp_authkey *authkey;
3876 + struct sctp_association *asoc;
3877 + int ret;
3878 +
3879 +- if (!net->sctp.auth_enable)
3880 ++ if (!ep->auth_enable)
3881 + return -EACCES;
3882 +
3883 + if (optlen <= sizeof(struct sctp_authkey))
3884 +@@ -3393,7 +3393,7 @@ static int sctp_setsockopt_auth_key(struct sock *sk,
3885 + goto out;
3886 + }
3887 +
3888 +- ret = sctp_auth_set_key(sctp_sk(sk)->ep, asoc, authkey);
3889 ++ ret = sctp_auth_set_key(ep, asoc, authkey);
3890 + out:
3891 + kzfree(authkey);
3892 + return ret;
3893 +@@ -3409,11 +3409,11 @@ static int sctp_setsockopt_active_key(struct sock *sk,
3894 + char __user *optval,
3895 + unsigned int optlen)
3896 + {
3897 +- struct net *net = sock_net(sk);
3898 ++ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
3899 + struct sctp_authkeyid val;
3900 + struct sctp_association *asoc;
3901 +
3902 +- if (!net->sctp.auth_enable)
3903 ++ if (!ep->auth_enable)
3904 + return -EACCES;
3905 +
3906 + if (optlen != sizeof(struct sctp_authkeyid))
3907 +@@ -3425,8 +3425,7 @@ static int sctp_setsockopt_active_key(struct sock *sk,
3908 + if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP))
3909 + return -EINVAL;
3910 +
3911 +- return sctp_auth_set_active_key(sctp_sk(sk)->ep, asoc,
3912 +- val.scact_keynumber);
3913 ++ return sctp_auth_set_active_key(ep, asoc, val.scact_keynumber);
3914 + }
3915 +
3916 + /*
3917 +@@ -3438,11 +3437,11 @@ static int sctp_setsockopt_del_key(struct sock *sk,
3918 + char __user *optval,
3919 + unsigned int optlen)
3920 + {
3921 +- struct net *net = sock_net(sk);
3922 ++ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
3923 + struct sctp_authkeyid val;
3924 + struct sctp_association *asoc;
3925 +
3926 +- if (!net->sctp.auth_enable)
3927 ++ if (!ep->auth_enable)
3928 + return -EACCES;
3929 +
3930 + if (optlen != sizeof(struct sctp_authkeyid))
3931 +@@ -3454,8 +3453,7 @@ static int sctp_setsockopt_del_key(struct sock *sk,
3932 + if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP))
3933 + return -EINVAL;
3934 +
3935 +- return sctp_auth_del_key_id(sctp_sk(sk)->ep, asoc,
3936 +- val.scact_keynumber);
3937 ++ return sctp_auth_del_key_id(ep, asoc, val.scact_keynumber);
3938 +
3939 + }
3940 +
3941 +@@ -5353,16 +5351,16 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len,
3942 + static int sctp_getsockopt_hmac_ident(struct sock *sk, int len,
3943 + char __user *optval, int __user *optlen)
3944 + {
3945 +- struct net *net = sock_net(sk);
3946 ++ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
3947 + struct sctp_hmacalgo __user *p = (void __user *)optval;
3948 + struct sctp_hmac_algo_param *hmacs;
3949 + __u16 data_len = 0;
3950 + u32 num_idents;
3951 +
3952 +- if (!net->sctp.auth_enable)
3953 ++ if (!ep->auth_enable)
3954 + return -EACCES;
3955 +
3956 +- hmacs = sctp_sk(sk)->ep->auth_hmacs_list;
3957 ++ hmacs = ep->auth_hmacs_list;
3958 + data_len = ntohs(hmacs->param_hdr.length) - sizeof(sctp_paramhdr_t);
3959 +
3960 + if (len < sizeof(struct sctp_hmacalgo) + data_len)
3961 +@@ -5383,11 +5381,11 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len,
3962 + static int sctp_getsockopt_active_key(struct sock *sk, int len,
3963 + char __user *optval, int __user *optlen)
3964 + {
3965 +- struct net *net = sock_net(sk);
3966 ++ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
3967 + struct sctp_authkeyid val;
3968 + struct sctp_association *asoc;
3969 +
3970 +- if (!net->sctp.auth_enable)
3971 ++ if (!ep->auth_enable)
3972 + return -EACCES;
3973 +
3974 + if (len < sizeof(struct sctp_authkeyid))
3975 +@@ -5402,7 +5400,7 @@ static int sctp_getsockopt_active_key(struct sock *sk, int len,
3976 + if (asoc)
3977 + val.scact_keynumber = asoc->active_key_id;
3978 + else
3979 +- val.scact_keynumber = sctp_sk(sk)->ep->active_key_id;
3980 ++ val.scact_keynumber = ep->active_key_id;
3981 +
3982 + len = sizeof(struct sctp_authkeyid);
3983 + if (put_user(len, optlen))
3984 +@@ -5416,7 +5414,7 @@ static int sctp_getsockopt_active_key(struct sock *sk, int len,
3985 + static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
3986 + char __user *optval, int __user *optlen)
3987 + {
3988 +- struct net *net = sock_net(sk);
3989 ++ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
3990 + struct sctp_authchunks __user *p = (void __user *)optval;
3991 + struct sctp_authchunks val;
3992 + struct sctp_association *asoc;
3993 +@@ -5424,7 +5422,7 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
3994 + u32 num_chunks = 0;
3995 + char __user *to;
3996 +
3997 +- if (!net->sctp.auth_enable)
3998 ++ if (!ep->auth_enable)
3999 + return -EACCES;
4000 +
4001 + if (len < sizeof(struct sctp_authchunks))
4002 +@@ -5460,7 +5458,7 @@ num:
4003 + static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
4004 + char __user *optval, int __user *optlen)
4005 + {
4006 +- struct net *net = sock_net(sk);
4007 ++ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
4008 + struct sctp_authchunks __user *p = (void __user *)optval;
4009 + struct sctp_authchunks val;
4010 + struct sctp_association *asoc;
4011 +@@ -5468,7 +5466,7 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
4012 + u32 num_chunks = 0;
4013 + char __user *to;
4014 +
4015 +- if (!net->sctp.auth_enable)
4016 ++ if (!ep->auth_enable)
4017 + return -EACCES;
4018 +
4019 + if (len < sizeof(struct sctp_authchunks))
4020 +@@ -5485,7 +5483,7 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
4021 + if (asoc)
4022 + ch = (struct sctp_chunks_param*)asoc->c.auth_chunks;
4023 + else
4024 +- ch = sctp_sk(sk)->ep->auth_chunk_list;
4025 ++ ch = ep->auth_chunk_list;
4026 +
4027 + if (!ch)
4028 + goto num;
4029 +@@ -6564,6 +6562,46 @@ static void __sctp_write_space(struct sctp_association *asoc)
4030 + }
4031 + }
4032 +
4033 ++static void sctp_wake_up_waiters(struct sock *sk,
4034 ++ struct sctp_association *asoc)
4035 ++{
4036 ++ struct sctp_association *tmp = asoc;
4037 ++
4038 ++ /* We do accounting for the sndbuf space per association,
4039 ++ * so we only need to wake our own association.
4040 ++ */
4041 ++ if (asoc->ep->sndbuf_policy)
4042 ++ return __sctp_write_space(asoc);
4043 ++
4044 ++ /* If association goes down and is just flushing its
4045 ++ * outq, then just normally notify others.
4046 ++ */
4047 ++ if (asoc->base.dead)
4048 ++ return sctp_write_space(sk);
4049 ++
4050 ++ /* Accounting for the sndbuf space is per socket, so we
4051 ++ * need to wake up others, try to be fair and in case of
4052 ++ * other associations, let them have a go first instead
4053 ++ * of just doing a sctp_write_space() call.
4054 ++ *
4055 ++ * Note that we reach sctp_wake_up_waiters() only when
4056 ++ * associations free up queued chunks, thus we are under
4057 ++ * lock and the list of associations on a socket is
4058 ++ * guaranteed not to change.
4059 ++ */
4060 ++ for (tmp = list_next_entry(tmp, asocs); 1;
4061 ++ tmp = list_next_entry(tmp, asocs)) {
4062 ++ /* Manually skip the head element. */
4063 ++ if (&tmp->asocs == &((sctp_sk(sk))->ep->asocs))
4064 ++ continue;
4065 ++ /* Wake up association. */
4066 ++ __sctp_write_space(tmp);
4067 ++ /* We've reached the end. */
4068 ++ if (tmp == asoc)
4069 ++ break;
4070 ++ }
4071 ++}
4072 ++
4073 + /* Do accounting for the sndbuf space.
4074 + * Decrement the used sndbuf space of the corresponding association by the
4075 + * data size which was just transmitted(freed).
4076 +@@ -6591,7 +6629,7 @@ static void sctp_wfree(struct sk_buff *skb)
4077 + sk_mem_uncharge(sk, skb->truesize);
4078 +
4079 + sock_wfree(skb);
4080 +- __sctp_write_space(asoc);
4081 ++ sctp_wake_up_waiters(sk, asoc);
4082 +
4083 + sctp_association_put(asoc);
4084 + }
4085 +diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
4086 +index 6b36561a1b3b..3e5ac1948607 100644
4087 +--- a/net/sctp/sysctl.c
4088 ++++ b/net/sctp/sysctl.c
4089 +@@ -59,8 +59,11 @@ extern int sysctl_sctp_wmem[3];
4090 + static int proc_sctp_do_hmac_alg(struct ctl_table *ctl,
4091 + int write,
4092 + void __user *buffer, size_t *lenp,
4093 +-
4094 + loff_t *ppos);
4095 ++static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
4096 ++ void __user *buffer, size_t *lenp,
4097 ++ loff_t *ppos);
4098 ++
4099 + static struct ctl_table sctp_table[] = {
4100 + {
4101 + .procname = "sctp_mem",
4102 +@@ -261,7 +264,7 @@ static struct ctl_table sctp_net_table[] = {
4103 + .data = &init_net.sctp.auth_enable,
4104 + .maxlen = sizeof(int),
4105 + .mode = 0644,
4106 +- .proc_handler = proc_dointvec,
4107 ++ .proc_handler = proc_sctp_do_auth,
4108 + },
4109 + {
4110 + .procname = "addr_scope_policy",
4111 +@@ -342,6 +345,37 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl,
4112 + return ret;
4113 + }
4114 +
4115 ++static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
4116 ++ void __user *buffer, size_t *lenp,
4117 ++ loff_t *ppos)
4118 ++{
4119 ++ struct net *net = current->nsproxy->net_ns;
4120 ++ struct ctl_table tbl;
4121 ++ int new_value, ret;
4122 ++
4123 ++ memset(&tbl, 0, sizeof(struct ctl_table));
4124 ++ tbl.maxlen = sizeof(unsigned int);
4125 ++
4126 ++ if (write)
4127 ++ tbl.data = &new_value;
4128 ++ else
4129 ++ tbl.data = &net->sctp.auth_enable;
4130 ++
4131 ++ ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
4132 ++
4133 ++ if (write) {
4134 ++ struct sock *sk = net->sctp.ctl_sock;
4135 ++
4136 ++ net->sctp.auth_enable = new_value;
4137 ++ /* Update the value in the control socket */
4138 ++ lock_sock(sk);
4139 ++ sctp_sk(sk)->ep->auth_enable = new_value;
4140 ++ release_sock(sk);
4141 ++ }
4142 ++
4143 ++ return ret;
4144 ++}
4145 ++
4146 + int sctp_sysctl_net_register(struct net *net)
4147 + {
4148 + struct ctl_table *table;
4149 +diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
4150 +index 5adfd94c5b85..85d232bed87d 100644
4151 +--- a/net/vmw_vsock/af_vsock.c
4152 ++++ b/net/vmw_vsock/af_vsock.c
4153 +@@ -1925,9 +1925,23 @@ static struct miscdevice vsock_device = {
4154 + .fops = &vsock_device_ops,
4155 + };
4156 +
4157 +-static int __vsock_core_init(void)
4158 ++int __vsock_core_init(const struct vsock_transport *t, struct module *owner)
4159 + {
4160 +- int err;
4161 ++ int err = mutex_lock_interruptible(&vsock_register_mutex);
4162 ++
4163 ++ if (err)
4164 ++ return err;
4165 ++
4166 ++ if (transport) {
4167 ++ err = -EBUSY;
4168 ++ goto err_busy;
4169 ++ }
4170 ++
4171 ++ /* Transport must be the owner of the protocol so that it can't
4172 ++ * unload while there are open sockets.
4173 ++ */
4174 ++ vsock_proto.owner = owner;
4175 ++ transport = t;
4176 +
4177 + vsock_init_tables();
4178 +
4179 +@@ -1951,36 +1965,19 @@ static int __vsock_core_init(void)
4180 + goto err_unregister_proto;
4181 + }
4182 +
4183 ++ mutex_unlock(&vsock_register_mutex);
4184 + return 0;
4185 +
4186 + err_unregister_proto:
4187 + proto_unregister(&vsock_proto);
4188 + err_misc_deregister:
4189 + misc_deregister(&vsock_device);
4190 +- return err;
4191 +-}
4192 +-
4193 +-int vsock_core_init(const struct vsock_transport *t)
4194 +-{
4195 +- int retval = mutex_lock_interruptible(&vsock_register_mutex);
4196 +- if (retval)
4197 +- return retval;
4198 +-
4199 +- if (transport) {
4200 +- retval = -EBUSY;
4201 +- goto out;
4202 +- }
4203 +-
4204 +- transport = t;
4205 +- retval = __vsock_core_init();
4206 +- if (retval)
4207 +- transport = NULL;
4208 +-
4209 +-out:
4210 ++ transport = NULL;
4211 ++err_busy:
4212 + mutex_unlock(&vsock_register_mutex);
4213 +- return retval;
4214 ++ return err;
4215 + }
4216 +-EXPORT_SYMBOL_GPL(vsock_core_init);
4217 ++EXPORT_SYMBOL_GPL(__vsock_core_init);
4218 +
4219 + void vsock_core_exit(void)
4220 + {
4221 +@@ -2000,5 +1997,5 @@ EXPORT_SYMBOL_GPL(vsock_core_exit);
4222 +
4223 + MODULE_AUTHOR("VMware, Inc.");
4224 + MODULE_DESCRIPTION("VMware Virtual Socket Family");
4225 +-MODULE_VERSION("1.0.0.0-k");
4226 ++MODULE_VERSION("1.0.1.0-k");
4227 + MODULE_LICENSE("GPL v2");
4228 +diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
4229 +index 8247979e8f64..78c2169a4f59 100644
4230 +--- a/scripts/mod/modpost.c
4231 ++++ b/scripts/mod/modpost.c
4232 +@@ -573,12 +573,16 @@ static int ignore_undef_symbol(struct elf_info *info, const char *symname)
4233 + if (strncmp(symname, "_restgpr_", sizeof("_restgpr_") - 1) == 0 ||
4234 + strncmp(symname, "_savegpr_", sizeof("_savegpr_") - 1) == 0 ||
4235 + strncmp(symname, "_rest32gpr_", sizeof("_rest32gpr_") - 1) == 0 ||
4236 +- strncmp(symname, "_save32gpr_", sizeof("_save32gpr_") - 1) == 0)
4237 ++ strncmp(symname, "_save32gpr_", sizeof("_save32gpr_") - 1) == 0 ||
4238 ++ strncmp(symname, "_restvr_", sizeof("_restvr_") - 1) == 0 ||
4239 ++ strncmp(symname, "_savevr_", sizeof("_savevr_") - 1) == 0)
4240 + return 1;
4241 + if (info->hdr->e_machine == EM_PPC64)
4242 + /* Special register function linked on all modules during final link of .ko */
4243 + if (strncmp(symname, "_restgpr0_", sizeof("_restgpr0_") - 1) == 0 ||
4244 +- strncmp(symname, "_savegpr0_", sizeof("_savegpr0_") - 1) == 0)
4245 ++ strncmp(symname, "_savegpr0_", sizeof("_savegpr0_") - 1) == 0 ||
4246 ++ strncmp(symname, "_restvr_", sizeof("_restvr_") - 1) == 0 ||
4247 ++ strncmp(symname, "_savevr_", sizeof("_savevr_") - 1) == 0)
4248 + return 1;
4249 + /* Do not ignore this symbol */
4250 + return 0;