Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Mon, 11 Jul 2016 19:59:37
Message-Id: 1468267179.c9aae51312f49294f6c20c309824b39d38803b9a.mpagano@gentoo
1 commit: c9aae51312f49294f6c20c309824b39d38803b9a
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 11 19:59:39 2016 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 11 19:59:39 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=c9aae513
7
8 Linux patch 4.4.15
9
10 0000_README | 4 +
11 1014_linux-4.4.15.patch | 1204 +++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 1208 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 9f33955..4eca9f9 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -95,6 +95,10 @@ Patch: 1012_linux-4.4.13.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.4.13
21
22 +Patch: 1014_linux-4.4.15.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.4.15
25 +
26 Patch: 1013_linux-4.4.14.patch
27 From: http://www.kernel.org
28 Desc: Linux 4.4.14
29
30 diff --git a/1014_linux-4.4.15.patch b/1014_linux-4.4.15.patch
31 new file mode 100644
32 index 0000000..e0685ae
33 --- /dev/null
34 +++ b/1014_linux-4.4.15.patch
35 @@ -0,0 +1,1204 @@
36 +diff --git a/Makefile b/Makefile
37 +index fadbb9d73c6d..979088079338 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 4
42 + PATCHLEVEL = 4
43 +-SUBLEVEL = 14
44 ++SUBLEVEL = 15
45 + EXTRAVERSION =
46 + NAME = Blurry Fish Butt
47 +
48 +diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
49 +index 43fe85f20d57..7097a3395b25 100644
50 +--- a/crypto/crypto_user.c
51 ++++ b/crypto/crypto_user.c
52 +@@ -455,6 +455,7 @@ static const int crypto_msg_min[CRYPTO_NR_MSGTYPES] = {
53 + [CRYPTO_MSG_NEWALG - CRYPTO_MSG_BASE] = MSGSIZE(crypto_user_alg),
54 + [CRYPTO_MSG_DELALG - CRYPTO_MSG_BASE] = MSGSIZE(crypto_user_alg),
55 + [CRYPTO_MSG_UPDATEALG - CRYPTO_MSG_BASE] = MSGSIZE(crypto_user_alg),
56 ++ [CRYPTO_MSG_GETALG - CRYPTO_MSG_BASE] = MSGSIZE(crypto_user_alg),
57 + [CRYPTO_MSG_DELRNG - CRYPTO_MSG_BASE] = 0,
58 + };
59 +
60 +diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c
61 +index 66b1c3313e2e..cd4398498495 100644
62 +--- a/drivers/crypto/ux500/hash/hash_core.c
63 ++++ b/drivers/crypto/ux500/hash/hash_core.c
64 +@@ -797,7 +797,7 @@ static int hash_process_data(struct hash_device_data *device_data,
65 + &device_data->state);
66 + memmove(req_ctx->state.buffer,
67 + device_data->state.buffer,
68 +- HASH_BLOCK_SIZE / sizeof(u32));
69 ++ HASH_BLOCK_SIZE);
70 + if (ret) {
71 + dev_err(device_data->dev,
72 + "%s: hash_resume_state() failed!\n",
73 +@@ -848,7 +848,7 @@ static int hash_process_data(struct hash_device_data *device_data,
74 +
75 + memmove(device_data->state.buffer,
76 + req_ctx->state.buffer,
77 +- HASH_BLOCK_SIZE / sizeof(u32));
78 ++ HASH_BLOCK_SIZE);
79 + if (ret) {
80 + dev_err(device_data->dev, "%s: hash_save_state() failed!\n",
81 + __func__);
82 +diff --git a/drivers/crypto/vmx/aes_cbc.c b/drivers/crypto/vmx/aes_cbc.c
83 +index 0b8fe2ec5315..f3801b983f42 100644
84 +--- a/drivers/crypto/vmx/aes_cbc.c
85 ++++ b/drivers/crypto/vmx/aes_cbc.c
86 +@@ -182,7 +182,7 @@ struct crypto_alg p8_aes_cbc_alg = {
87 + .cra_name = "cbc(aes)",
88 + .cra_driver_name = "p8_aes_cbc",
89 + .cra_module = THIS_MODULE,
90 +- .cra_priority = 1000,
91 ++ .cra_priority = 2000,
92 + .cra_type = &crypto_blkcipher_type,
93 + .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_NEED_FALLBACK,
94 + .cra_alignmask = 0,
95 +diff --git a/drivers/crypto/vmx/aes_ctr.c b/drivers/crypto/vmx/aes_ctr.c
96 +index ee1306cd8f59..404a1b69a3ab 100644
97 +--- a/drivers/crypto/vmx/aes_ctr.c
98 ++++ b/drivers/crypto/vmx/aes_ctr.c
99 +@@ -166,7 +166,7 @@ struct crypto_alg p8_aes_ctr_alg = {
100 + .cra_name = "ctr(aes)",
101 + .cra_driver_name = "p8_aes_ctr",
102 + .cra_module = THIS_MODULE,
103 +- .cra_priority = 1000,
104 ++ .cra_priority = 2000,
105 + .cra_type = &crypto_blkcipher_type,
106 + .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_NEED_FALLBACK,
107 + .cra_alignmask = 0,
108 +diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
109 +index bd377a6b067d..df54475d163b 100644
110 +--- a/drivers/net/ethernet/atheros/alx/main.c
111 ++++ b/drivers/net/ethernet/atheros/alx/main.c
112 +@@ -86,9 +86,14 @@ static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp)
113 + while (!cur_buf->skb && next != rxq->read_idx) {
114 + struct alx_rfd *rfd = &rxq->rfd[cur];
115 +
116 +- skb = __netdev_alloc_skb(alx->dev, alx->rxbuf_size, gfp);
117 ++ skb = __netdev_alloc_skb(alx->dev, alx->rxbuf_size + 64, gfp);
118 + if (!skb)
119 + break;
120 ++
121 ++ /* Workround for the HW RX DMA overflow issue */
122 ++ if (((unsigned long)skb->data & 0xfff) == 0xfc0)
123 ++ skb_reserve(skb, 64);
124 ++
125 + dma = dma_map_single(&alx->hw.pdev->dev,
126 + skb->data, alx->rxbuf_size,
127 + DMA_FROM_DEVICE);
128 +diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
129 +index 169059c92f80..8d54e7b41bbf 100644
130 +--- a/drivers/net/ethernet/cadence/macb.c
131 ++++ b/drivers/net/ethernet/cadence/macb.c
132 +@@ -2405,9 +2405,9 @@ static int macb_init(struct platform_device *pdev)
133 + if (bp->phy_interface == PHY_INTERFACE_MODE_RGMII)
134 + val = GEM_BIT(RGMII);
135 + else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII &&
136 +- (bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII))
137 ++ (bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII))
138 + val = MACB_BIT(RMII);
139 +- else if (!(bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII))
140 ++ else if (!(bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII))
141 + val = MACB_BIT(MII);
142 +
143 + if (bp->caps & MACB_CAPS_USRIO_HAS_CLKEN)
144 +@@ -2738,7 +2738,7 @@ static int at91ether_init(struct platform_device *pdev)
145 + }
146 +
147 + static const struct macb_config at91sam9260_config = {
148 +- .caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII,
149 ++ .caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
150 + .clk_init = macb_clk_init,
151 + .init = macb_init,
152 + };
153 +@@ -2751,21 +2751,22 @@ static const struct macb_config pc302gem_config = {
154 + };
155 +
156 + static const struct macb_config sama5d2_config = {
157 +- .caps = 0,
158 ++ .caps = MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
159 + .dma_burst_length = 16,
160 + .clk_init = macb_clk_init,
161 + .init = macb_init,
162 + };
163 +
164 + static const struct macb_config sama5d3_config = {
165 +- .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE,
166 ++ .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE
167 ++ | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
168 + .dma_burst_length = 16,
169 + .clk_init = macb_clk_init,
170 + .init = macb_init,
171 + };
172 +
173 + static const struct macb_config sama5d4_config = {
174 +- .caps = 0,
175 ++ .caps = MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
176 + .dma_burst_length = 4,
177 + .clk_init = macb_clk_init,
178 + .init = macb_init,
179 +diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
180 +index d83b0db77821..3f385ab94988 100644
181 +--- a/drivers/net/ethernet/cadence/macb.h
182 ++++ b/drivers/net/ethernet/cadence/macb.h
183 +@@ -398,7 +398,7 @@
184 + /* Capability mask bits */
185 + #define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x00000001
186 + #define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002
187 +-#define MACB_CAPS_USRIO_DEFAULT_IS_MII 0x00000004
188 ++#define MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII 0x00000004
189 + #define MACB_CAPS_NO_GIGABIT_HALF 0x00000008
190 + #define MACB_CAPS_FIFO_MODE 0x10000000
191 + #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000
192 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
193 +index 6dc810bce295..944a6dca0fcb 100644
194 +--- a/drivers/usb/core/quirks.c
195 ++++ b/drivers/usb/core/quirks.c
196 +@@ -44,6 +44,9 @@ static const struct usb_device_id usb_quirk_list[] = {
197 + /* Creative SB Audigy 2 NX */
198 + { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
199 +
200 ++ /* USB3503 */
201 ++ { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME },
202 ++
203 + /* Microsoft Wireless Laser Mouse 6000 Receiver */
204 + { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME },
205 +
206 +@@ -173,6 +176,10 @@ static const struct usb_device_id usb_quirk_list[] = {
207 + /* MAYA44USB sound device */
208 + { USB_DEVICE(0x0a92, 0x0091), .driver_info = USB_QUIRK_RESET_RESUME },
209 +
210 ++ /* ASUS Base Station(T100) */
211 ++ { USB_DEVICE(0x0b05, 0x17e0), .driver_info =
212 ++ USB_QUIRK_IGNORE_REMOTE_WAKEUP },
213 ++
214 + /* Action Semiconductor flash disk */
215 + { USB_DEVICE(0x10d6, 0x2200), .driver_info =
216 + USB_QUIRK_STRING_FETCH_255 },
217 +@@ -188,26 +195,22 @@ static const struct usb_device_id usb_quirk_list[] = {
218 + { USB_DEVICE(0x1908, 0x1315), .driver_info =
219 + USB_QUIRK_HONOR_BNUMINTERFACES },
220 +
221 +- /* INTEL VALUE SSD */
222 +- { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
223 +-
224 +- /* USB3503 */
225 +- { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME },
226 +-
227 +- /* ASUS Base Station(T100) */
228 +- { USB_DEVICE(0x0b05, 0x17e0), .driver_info =
229 +- USB_QUIRK_IGNORE_REMOTE_WAKEUP },
230 +-
231 + /* Protocol and OTG Electrical Test Device */
232 + { USB_DEVICE(0x1a0a, 0x0200), .driver_info =
233 + USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL },
234 +
235 ++ /* Acer C120 LED Projector */
236 ++ { USB_DEVICE(0x1de1, 0xc102), .driver_info = USB_QUIRK_NO_LPM },
237 ++
238 + /* Blackmagic Design Intensity Shuttle */
239 + { USB_DEVICE(0x1edb, 0xbd3b), .driver_info = USB_QUIRK_NO_LPM },
240 +
241 + /* Blackmagic Design UltraStudio SDI */
242 + { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM },
243 +
244 ++ /* INTEL VALUE SSD */
245 ++ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
246 ++
247 + { } /* terminating entry must be last */
248 + };
249 +
250 +diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
251 +index dd5cb5577dca..2f1fb7e7aa54 100644
252 +--- a/drivers/usb/dwc3/dwc3-exynos.c
253 ++++ b/drivers/usb/dwc3/dwc3-exynos.c
254 +@@ -128,12 +128,6 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
255 +
256 + platform_set_drvdata(pdev, exynos);
257 +
258 +- ret = dwc3_exynos_register_phys(exynos);
259 +- if (ret) {
260 +- dev_err(dev, "couldn't register PHYs\n");
261 +- return ret;
262 +- }
263 +-
264 + exynos->dev = dev;
265 +
266 + exynos->clk = devm_clk_get(dev, "usbdrd30");
267 +@@ -183,20 +177,29 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
268 + goto err3;
269 + }
270 +
271 ++ ret = dwc3_exynos_register_phys(exynos);
272 ++ if (ret) {
273 ++ dev_err(dev, "couldn't register PHYs\n");
274 ++ goto err4;
275 ++ }
276 ++
277 + if (node) {
278 + ret = of_platform_populate(node, NULL, NULL, dev);
279 + if (ret) {
280 + dev_err(dev, "failed to add dwc3 core\n");
281 +- goto err4;
282 ++ goto err5;
283 + }
284 + } else {
285 + dev_err(dev, "no device node, failed to add dwc3 core\n");
286 + ret = -ENODEV;
287 +- goto err4;
288 ++ goto err5;
289 + }
290 +
291 + return 0;
292 +
293 ++err5:
294 ++ platform_device_unregister(exynos->usb2_phy);
295 ++ platform_device_unregister(exynos->usb3_phy);
296 + err4:
297 + regulator_disable(exynos->vdd10);
298 + err3:
299 +diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
300 +index f454c7af489c..55386619a0f1 100644
301 +--- a/drivers/usb/gadget/legacy/inode.c
302 ++++ b/drivers/usb/gadget/legacy/inode.c
303 +@@ -937,8 +937,11 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr)
304 + struct usb_ep *ep = dev->gadget->ep0;
305 + struct usb_request *req = dev->req;
306 +
307 +- if ((retval = setup_req (ep, req, 0)) == 0)
308 +- retval = usb_ep_queue (ep, req, GFP_ATOMIC);
309 ++ if ((retval = setup_req (ep, req, 0)) == 0) {
310 ++ spin_unlock_irq (&dev->lock);
311 ++ retval = usb_ep_queue (ep, req, GFP_KERNEL);
312 ++ spin_lock_irq (&dev->lock);
313 ++ }
314 + dev->state = STATE_DEV_CONNECTED;
315 +
316 + /* assume that was SET_CONFIGURATION */
317 +@@ -1456,8 +1459,11 @@ delegate:
318 + w_length);
319 + if (value < 0)
320 + break;
321 ++
322 ++ spin_unlock (&dev->lock);
323 + value = usb_ep_queue (gadget->ep0, dev->req,
324 +- GFP_ATOMIC);
325 ++ GFP_KERNEL);
326 ++ spin_lock (&dev->lock);
327 + if (value < 0) {
328 + clean_req (gadget->ep0, dev->req);
329 + break;
330 +@@ -1480,11 +1486,14 @@ delegate:
331 + if (value >= 0 && dev->state != STATE_DEV_SETUP) {
332 + req->length = value;
333 + req->zero = value < w_length;
334 +- value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC);
335 ++
336 ++ spin_unlock (&dev->lock);
337 ++ value = usb_ep_queue (gadget->ep0, req, GFP_KERNEL);
338 + if (value < 0) {
339 + DBG (dev, "ep_queue --> %d\n", value);
340 + req->status = 0;
341 + }
342 ++ return value;
343 + }
344 +
345 + /* device stalls when value < 0 */
346 +diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
347 +index 4031b372008e..c1c1024a054c 100644
348 +--- a/drivers/usb/host/ehci-tegra.c
349 ++++ b/drivers/usb/host/ehci-tegra.c
350 +@@ -89,7 +89,7 @@ static int tegra_reset_usb_controller(struct platform_device *pdev)
351 + if (!usb1_reset_attempted) {
352 + struct reset_control *usb1_reset;
353 +
354 +- usb1_reset = of_reset_control_get(phy_np, "usb");
355 ++ usb1_reset = of_reset_control_get(phy_np, "utmi-pads");
356 + if (IS_ERR(usb1_reset)) {
357 + dev_warn(&pdev->dev,
358 + "can't get utmi-pads reset from the PHY\n");
359 +diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
360 +index ea4fb4b0cd44..de644e56aa3b 100644
361 +--- a/drivers/usb/host/xhci-pci.c
362 ++++ b/drivers/usb/host/xhci-pci.c
363 +@@ -37,6 +37,7 @@
364 + /* Device for a quirk */
365 + #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73
366 + #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000
367 ++#define PCI_DEVICE_ID_FRESCO_LOGIC_FL1009 0x1009
368 + #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x1400
369 +
370 + #define PCI_VENDOR_ID_ETRON 0x1b6f
371 +@@ -115,6 +116,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
372 + xhci->quirks |= XHCI_TRUST_TX_LENGTH;
373 + }
374 +
375 ++ if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
376 ++ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009)
377 ++ xhci->quirks |= XHCI_BROKEN_STREAMS;
378 ++
379 + if (pdev->vendor == PCI_VENDOR_ID_NEC)
380 + xhci->quirks |= XHCI_NEC_HOST;
381 +
382 +diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
383 +index 05647e6753cd..4fe7c9b56bc0 100644
384 +--- a/drivers/usb/host/xhci-plat.c
385 ++++ b/drivers/usb/host/xhci-plat.c
386 +@@ -132,6 +132,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
387 + ret = clk_prepare_enable(clk);
388 + if (ret)
389 + goto put_hcd;
390 ++ } else if (PTR_ERR(clk) == -EPROBE_DEFER) {
391 ++ ret = -EPROBE_DEFER;
392 ++ goto put_hcd;
393 + }
394 +
395 + if (of_device_is_compatible(pdev->dev.of_node,
396 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
397 +index 2b63969c2bbf..34cd23724bed 100644
398 +--- a/drivers/usb/host/xhci-ring.c
399 ++++ b/drivers/usb/host/xhci-ring.c
400 +@@ -289,6 +289,14 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci)
401 +
402 + temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
403 + xhci->cmd_ring_state = CMD_RING_STATE_ABORTED;
404 ++
405 ++ /*
406 ++ * Writing the CMD_RING_ABORT bit should cause a cmd completion event,
407 ++ * however on some host hw the CMD_RING_RUNNING bit is correctly cleared
408 ++ * but the completion event in never sent. Use the cmd timeout timer to
409 ++ * handle those cases. Use twice the time to cover the bit polling retry
410 ++ */
411 ++ mod_timer(&xhci->cmd_timer, jiffies + (2 * XHCI_CMD_DEFAULT_TIMEOUT));
412 + xhci_write_64(xhci, temp_64 | CMD_RING_ABORT,
413 + &xhci->op_regs->cmd_ring);
414 +
415 +@@ -313,6 +321,7 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci)
416 +
417 + xhci_err(xhci, "Stopped the command ring failed, "
418 + "maybe the host is dead\n");
419 ++ del_timer(&xhci->cmd_timer);
420 + xhci->xhc_state |= XHCI_STATE_DYING;
421 + xhci_quiesce(xhci);
422 + xhci_halt(xhci);
423 +@@ -1252,22 +1261,21 @@ void xhci_handle_command_timeout(unsigned long data)
424 + int ret;
425 + unsigned long flags;
426 + u64 hw_ring_state;
427 +- struct xhci_command *cur_cmd = NULL;
428 ++ bool second_timeout = false;
429 + xhci = (struct xhci_hcd *) data;
430 +
431 + /* mark this command to be cancelled */
432 + spin_lock_irqsave(&xhci->lock, flags);
433 + if (xhci->current_cmd) {
434 +- cur_cmd = xhci->current_cmd;
435 +- cur_cmd->status = COMP_CMD_ABORT;
436 ++ if (xhci->current_cmd->status == COMP_CMD_ABORT)
437 ++ second_timeout = true;
438 ++ xhci->current_cmd->status = COMP_CMD_ABORT;
439 + }
440 +
441 +-
442 + /* Make sure command ring is running before aborting it */
443 + hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
444 + if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) &&
445 + (hw_ring_state & CMD_RING_RUNNING)) {
446 +-
447 + spin_unlock_irqrestore(&xhci->lock, flags);
448 + xhci_dbg(xhci, "Command timeout\n");
449 + ret = xhci_abort_cmd_ring(xhci);
450 +@@ -1279,6 +1287,15 @@ void xhci_handle_command_timeout(unsigned long data)
451 + }
452 + return;
453 + }
454 ++
455 ++ /* command ring failed to restart, or host removed. Bail out */
456 ++ if (second_timeout || xhci->xhc_state & XHCI_STATE_REMOVING) {
457 ++ spin_unlock_irqrestore(&xhci->lock, flags);
458 ++ xhci_dbg(xhci, "command timed out twice, ring start fail?\n");
459 ++ xhci_cleanup_command_queue(xhci);
460 ++ return;
461 ++ }
462 ++
463 + /* command timeout on stopped ring, ring can't be aborted */
464 + xhci_dbg(xhci, "Command timeout on stopped ring\n");
465 + xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd);
466 +@@ -2727,7 +2744,8 @@ hw_died:
467 + writel(irq_pending, &xhci->ir_set->irq_pending);
468 + }
469 +
470 +- if (xhci->xhc_state & XHCI_STATE_DYING) {
471 ++ if (xhci->xhc_state & XHCI_STATE_DYING ||
472 ++ xhci->xhc_state & XHCI_STATE_HALTED) {
473 + xhci_dbg(xhci, "xHCI dying, ignoring interrupt. "
474 + "Shouldn't IRQs be disabled?\n");
475 + /* Clear the event handler busy flag (RW1C);
476 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
477 +index ec9e758d5fcd..6fe0174da226 100644
478 +--- a/drivers/usb/host/xhci.c
479 ++++ b/drivers/usb/host/xhci.c
480 +@@ -680,20 +680,23 @@ void xhci_stop(struct usb_hcd *hcd)
481 + u32 temp;
482 + struct xhci_hcd *xhci = hcd_to_xhci(hcd);
483 +
484 +- if (xhci->xhc_state & XHCI_STATE_HALTED)
485 +- return;
486 +-
487 + mutex_lock(&xhci->mutex);
488 +- spin_lock_irq(&xhci->lock);
489 +- xhci->xhc_state |= XHCI_STATE_HALTED;
490 +- xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
491 +
492 +- /* Make sure the xHC is halted for a USB3 roothub
493 +- * (xhci_stop() could be called as part of failed init).
494 +- */
495 +- xhci_halt(xhci);
496 +- xhci_reset(xhci);
497 +- spin_unlock_irq(&xhci->lock);
498 ++ if (!(xhci->xhc_state & XHCI_STATE_HALTED)) {
499 ++ spin_lock_irq(&xhci->lock);
500 ++
501 ++ xhci->xhc_state |= XHCI_STATE_HALTED;
502 ++ xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
503 ++ xhci_halt(xhci);
504 ++ xhci_reset(xhci);
505 ++
506 ++ spin_unlock_irq(&xhci->lock);
507 ++ }
508 ++
509 ++ if (!usb_hcd_is_primary_hcd(hcd)) {
510 ++ mutex_unlock(&xhci->mutex);
511 ++ return;
512 ++ }
513 +
514 + xhci_cleanup_msix(xhci);
515 +
516 +diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
517 +index ee9ff7028b92..00eed5d66fda 100644
518 +--- a/drivers/usb/musb/musb_core.c
519 ++++ b/drivers/usb/musb/musb_core.c
520 +@@ -2401,7 +2401,8 @@ static void musb_restore_context(struct musb *musb)
521 + musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe);
522 + musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe);
523 + musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe);
524 +- musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl);
525 ++ if (musb->context.devctl & MUSB_DEVCTL_SESSION)
526 ++ musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl);
527 +
528 + for (i = 0; i < musb->config->num_eps; ++i) {
529 + struct musb_hw_ep *hw_ep;
530 +diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
531 +index 795a45b1b25b..59a63a0b7985 100644
532 +--- a/drivers/usb/musb/musb_host.c
533 ++++ b/drivers/usb/musb/musb_host.c
534 +@@ -594,14 +594,13 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, u8 epnum)
535 + musb_writew(ep->regs, MUSB_TXCSR, 0);
536 +
537 + /* scrub all previous state, clearing toggle */
538 +- } else {
539 +- csr = musb_readw(ep->regs, MUSB_RXCSR);
540 +- if (csr & MUSB_RXCSR_RXPKTRDY)
541 +- WARNING("rx%d, packet/%d ready?\n", ep->epnum,
542 +- musb_readw(ep->regs, MUSB_RXCOUNT));
543 +-
544 +- musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG);
545 + }
546 ++ csr = musb_readw(ep->regs, MUSB_RXCSR);
547 ++ if (csr & MUSB_RXCSR_RXPKTRDY)
548 ++ WARNING("rx%d, packet/%d ready?\n", ep->epnum,
549 ++ musb_readw(ep->regs, MUSB_RXCOUNT));
550 ++
551 ++ musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG);
552 +
553 + /* target addr and (for multipoint) hub addr/port */
554 + if (musb->is_multipoint) {
555 +@@ -995,9 +994,15 @@ static void musb_bulk_nak_timeout(struct musb *musb, struct musb_hw_ep *ep,
556 + if (is_in) {
557 + dma = is_dma_capable() ? ep->rx_channel : NULL;
558 +
559 +- /* clear nak timeout bit */
560 ++ /*
561 ++ * Need to stop the transaction by clearing REQPKT first
562 ++ * then the NAK Timeout bit ref MUSBMHDRC USB 2.0 HIGH-SPEED
563 ++ * DUAL-ROLE CONTROLLER Programmer's Guide, section 9.2.2
564 ++ */
565 + rx_csr = musb_readw(epio, MUSB_RXCSR);
566 + rx_csr |= MUSB_RXCSR_H_WZC_BITS;
567 ++ rx_csr &= ~MUSB_RXCSR_H_REQPKT;
568 ++ musb_writew(epio, MUSB_RXCSR, rx_csr);
569 + rx_csr &= ~MUSB_RXCSR_DATAERROR;
570 + musb_writew(epio, MUSB_RXCSR, rx_csr);
571 +
572 +@@ -1551,7 +1556,7 @@ static int musb_rx_dma_iso_cppi41(struct dma_controller *dma,
573 + struct urb *urb,
574 + size_t len)
575 + {
576 +- struct dma_channel *channel = hw_ep->tx_channel;
577 ++ struct dma_channel *channel = hw_ep->rx_channel;
578 + void __iomem *epio = hw_ep->regs;
579 + dma_addr_t *buf;
580 + u32 length, res;
581 +diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
582 +index 78b4f64c6b00..06c7dbc1c802 100644
583 +--- a/drivers/usb/serial/mos7720.c
584 ++++ b/drivers/usb/serial/mos7720.c
585 +@@ -2007,6 +2007,7 @@ static void mos7720_release(struct usb_serial *serial)
586 + urblist_entry)
587 + usb_unlink_urb(urbtrack->urb);
588 + spin_unlock_irqrestore(&mos_parport->listlock, flags);
589 ++ parport_del_port(mos_parport->pp);
590 +
591 + kref_put(&mos_parport->ref_count, destroy_mos_parport);
592 + }
593 +diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
594 +index 9baf081174ce..e26e32169a36 100644
595 +--- a/drivers/usb/storage/uas.c
596 ++++ b/drivers/usb/storage/uas.c
597 +@@ -811,6 +811,7 @@ static int uas_slave_configure(struct scsi_device *sdev)
598 + if (devinfo->flags & US_FL_BROKEN_FUA)
599 + sdev->broken_fua = 1;
600 +
601 ++ scsi_change_queue_depth(sdev, devinfo->qdepth - 2);
602 + return 0;
603 + }
604 +
605 +diff --git a/include/linux/bpf.h b/include/linux/bpf.h
606 +index 67bc2da5d233..4f6d29c8e3d8 100644
607 +--- a/include/linux/bpf.h
608 ++++ b/include/linux/bpf.h
609 +@@ -198,6 +198,10 @@ static inline struct bpf_prog *bpf_prog_get(u32 ufd)
610 + static inline void bpf_prog_put(struct bpf_prog *prog)
611 + {
612 + }
613 ++
614 ++static inline void bpf_prog_put_rcu(struct bpf_prog *prog)
615 ++{
616 ++}
617 + #endif /* CONFIG_BPF_SYSCALL */
618 +
619 + /* verifier prototypes for helper functions called from eBPF programs */
620 +diff --git a/include/linux/net.h b/include/linux/net.h
621 +index 25ef630f1bd6..c00b8d182226 100644
622 +--- a/include/linux/net.h
623 ++++ b/include/linux/net.h
624 +@@ -251,7 +251,8 @@ do { \
625 + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
626 + if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
627 + net_ratelimit()) \
628 +- __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \
629 ++ __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
630 ++ ##__VA_ARGS__); \
631 + } while (0)
632 + #elif defined(DEBUG)
633 + #define net_dbg_ratelimited(fmt, ...) \
634 +diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
635 +index 4fde61804191..1716f9395010 100644
636 +--- a/include/linux/skbuff.h
637 ++++ b/include/linux/skbuff.h
638 +@@ -2564,6 +2564,13 @@ static inline int skb_clone_writable(const struct sk_buff *skb, unsigned int len
639 + skb_headroom(skb) + len <= skb->hdr_len;
640 + }
641 +
642 ++static inline int skb_try_make_writable(struct sk_buff *skb,
643 ++ unsigned int write_len)
644 ++{
645 ++ return skb_cloned(skb) && !skb_clone_writable(skb, write_len) &&
646 ++ pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
647 ++}
648 ++
649 + static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom,
650 + int cloned)
651 + {
652 +diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
653 +index fddebc617469..8ff34ed1ae8a 100644
654 +--- a/include/linux/sock_diag.h
655 ++++ b/include/linux/sock_diag.h
656 +@@ -35,6 +35,9 @@ enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk)
657 + {
658 + switch (sk->sk_family) {
659 + case AF_INET:
660 ++ if (sk->sk_type == SOCK_RAW)
661 ++ return SKNLGRP_NONE;
662 ++
663 + switch (sk->sk_protocol) {
664 + case IPPROTO_TCP:
665 + return SKNLGRP_INET_TCP_DESTROY;
666 +@@ -44,6 +47,9 @@ enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk)
667 + return SKNLGRP_NONE;
668 + }
669 + case AF_INET6:
670 ++ if (sk->sk_type == SOCK_RAW)
671 ++ return SKNLGRP_NONE;
672 ++
673 + switch (sk->sk_protocol) {
674 + case IPPROTO_TCP:
675 + return SKNLGRP_INET6_TCP_DESTROY;
676 +diff --git a/kernel/events/core.c b/kernel/events/core.c
677 +index 95e47d2f2c67..12ecd4f0329f 100644
678 +--- a/kernel/events/core.c
679 ++++ b/kernel/events/core.c
680 +@@ -7101,7 +7101,7 @@ static void perf_event_free_bpf_prog(struct perf_event *event)
681 + prog = event->tp_event->prog;
682 + if (prog) {
683 + event->tp_event->prog = NULL;
684 +- bpf_prog_put(prog);
685 ++ bpf_prog_put_rcu(prog);
686 + }
687 + }
688 +
689 +diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
690 +index fbd0acf80b13..2fdebabbfacd 100644
691 +--- a/net/ax25/af_ax25.c
692 ++++ b/net/ax25/af_ax25.c
693 +@@ -976,7 +976,8 @@ static int ax25_release(struct socket *sock)
694 + release_sock(sk);
695 + ax25_disconnect(ax25, 0);
696 + lock_sock(sk);
697 +- ax25_destroy_socket(ax25);
698 ++ if (!sock_flag(ax25->sk, SOCK_DESTROY))
699 ++ ax25_destroy_socket(ax25);
700 + break;
701 +
702 + case AX25_STATE_3:
703 +diff --git a/net/ax25/ax25_ds_timer.c b/net/ax25/ax25_ds_timer.c
704 +index 951cd57bb07d..5237dff6941d 100644
705 +--- a/net/ax25/ax25_ds_timer.c
706 ++++ b/net/ax25/ax25_ds_timer.c
707 +@@ -102,6 +102,7 @@ void ax25_ds_heartbeat_expiry(ax25_cb *ax25)
708 + switch (ax25->state) {
709 +
710 + case AX25_STATE_0:
711 ++ case AX25_STATE_2:
712 + /* Magic here: If we listen() and a new link dies before it
713 + is accepted() it isn't 'dead' so doesn't get removed. */
714 + if (!sk || sock_flag(sk, SOCK_DESTROY) ||
715 +@@ -111,6 +112,7 @@ void ax25_ds_heartbeat_expiry(ax25_cb *ax25)
716 + sock_hold(sk);
717 + ax25_destroy_socket(ax25);
718 + bh_unlock_sock(sk);
719 ++ /* Ungrab socket and destroy it */
720 + sock_put(sk);
721 + } else
722 + ax25_destroy_socket(ax25);
723 +@@ -213,7 +215,8 @@ void ax25_ds_t1_timeout(ax25_cb *ax25)
724 + case AX25_STATE_2:
725 + if (ax25->n2count == ax25->n2) {
726 + ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND);
727 +- ax25_disconnect(ax25, ETIMEDOUT);
728 ++ if (!sock_flag(ax25->sk, SOCK_DESTROY))
729 ++ ax25_disconnect(ax25, ETIMEDOUT);
730 + return;
731 + } else {
732 + ax25->n2count++;
733 +diff --git a/net/ax25/ax25_std_timer.c b/net/ax25/ax25_std_timer.c
734 +index 004467c9e6e1..2c0d6ef66f9d 100644
735 +--- a/net/ax25/ax25_std_timer.c
736 ++++ b/net/ax25/ax25_std_timer.c
737 +@@ -38,6 +38,7 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25)
738 +
739 + switch (ax25->state) {
740 + case AX25_STATE_0:
741 ++ case AX25_STATE_2:
742 + /* Magic here: If we listen() and a new link dies before it
743 + is accepted() it isn't 'dead' so doesn't get removed. */
744 + if (!sk || sock_flag(sk, SOCK_DESTROY) ||
745 +@@ -47,6 +48,7 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25)
746 + sock_hold(sk);
747 + ax25_destroy_socket(ax25);
748 + bh_unlock_sock(sk);
749 ++ /* Ungrab socket and destroy it */
750 + sock_put(sk);
751 + } else
752 + ax25_destroy_socket(ax25);
753 +@@ -144,7 +146,8 @@ void ax25_std_t1timer_expiry(ax25_cb *ax25)
754 + case AX25_STATE_2:
755 + if (ax25->n2count == ax25->n2) {
756 + ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND);
757 +- ax25_disconnect(ax25, ETIMEDOUT);
758 ++ if (!sock_flag(ax25->sk, SOCK_DESTROY))
759 ++ ax25_disconnect(ax25, ETIMEDOUT);
760 + return;
761 + } else {
762 + ax25->n2count++;
763 +diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c
764 +index 3b78e8473a01..655a7d4c96e1 100644
765 +--- a/net/ax25/ax25_subr.c
766 ++++ b/net/ax25/ax25_subr.c
767 +@@ -264,7 +264,8 @@ void ax25_disconnect(ax25_cb *ax25, int reason)
768 + {
769 + ax25_clear_queues(ax25);
770 +
771 +- ax25_stop_heartbeat(ax25);
772 ++ if (!sock_flag(ax25->sk, SOCK_DESTROY))
773 ++ ax25_stop_heartbeat(ax25);
774 + ax25_stop_t1timer(ax25);
775 + ax25_stop_t2timer(ax25);
776 + ax25_stop_t3timer(ax25);
777 +diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
778 +index ea9893743a0f..7173a685309a 100644
779 +--- a/net/bridge/br_multicast.c
780 ++++ b/net/bridge/br_multicast.c
781 +@@ -464,8 +464,11 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br,
782 + if (ipv6_dev_get_saddr(dev_net(br->dev), br->dev, &ip6h->daddr, 0,
783 + &ip6h->saddr)) {
784 + kfree_skb(skb);
785 ++ br->has_ipv6_addr = 0;
786 + return NULL;
787 + }
788 ++
789 ++ br->has_ipv6_addr = 1;
790 + ipv6_eth_mc_map(&ip6h->daddr, eth->h_dest);
791 +
792 + hopopt = (u8 *)(ip6h + 1);
793 +@@ -1736,6 +1739,7 @@ void br_multicast_init(struct net_bridge *br)
794 + br->ip6_other_query.delay_time = 0;
795 + br->ip6_querier.port = NULL;
796 + #endif
797 ++ br->has_ipv6_addr = 1;
798 +
799 + spin_lock_init(&br->multicast_lock);
800 + setup_timer(&br->multicast_router_timer,
801 +diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
802 +index 216018c76018..1001a1b7df9b 100644
803 +--- a/net/bridge/br_private.h
804 ++++ b/net/bridge/br_private.h
805 +@@ -301,6 +301,7 @@ struct net_bridge
806 + u8 multicast_disabled:1;
807 + u8 multicast_querier:1;
808 + u8 multicast_query_use_ifaddr:1;
809 ++ u8 has_ipv6_addr:1;
810 +
811 + u32 hash_elasticity;
812 + u32 hash_max;
813 +@@ -574,10 +575,22 @@ static inline bool br_multicast_is_router(struct net_bridge *br)
814 +
815 + static inline bool
816 + __br_multicast_querier_exists(struct net_bridge *br,
817 +- struct bridge_mcast_other_query *querier)
818 ++ struct bridge_mcast_other_query *querier,
819 ++ const bool is_ipv6)
820 + {
821 ++ bool own_querier_enabled;
822 ++
823 ++ if (br->multicast_querier) {
824 ++ if (is_ipv6 && !br->has_ipv6_addr)
825 ++ own_querier_enabled = false;
826 ++ else
827 ++ own_querier_enabled = true;
828 ++ } else {
829 ++ own_querier_enabled = false;
830 ++ }
831 ++
832 + return time_is_before_jiffies(querier->delay_time) &&
833 +- (br->multicast_querier || timer_pending(&querier->timer));
834 ++ (own_querier_enabled || timer_pending(&querier->timer));
835 + }
836 +
837 + static inline bool br_multicast_querier_exists(struct net_bridge *br,
838 +@@ -585,10 +598,12 @@ static inline bool br_multicast_querier_exists(struct net_bridge *br,
839 + {
840 + switch (eth->h_proto) {
841 + case (htons(ETH_P_IP)):
842 +- return __br_multicast_querier_exists(br, &br->ip4_other_query);
843 ++ return __br_multicast_querier_exists(br,
844 ++ &br->ip4_other_query, false);
845 + #if IS_ENABLED(CONFIG_IPV6)
846 + case (htons(ETH_P_IPV6)):
847 +- return __br_multicast_querier_exists(br, &br->ip6_other_query);
848 ++ return __br_multicast_querier_exists(br,
849 ++ &br->ip6_other_query, true);
850 + #endif
851 + default:
852 + return false;
853 +diff --git a/net/core/filter.c b/net/core/filter.c
854 +index f393a22b9d50..75e9b2b2336d 100644
855 +--- a/net/core/filter.c
856 ++++ b/net/core/filter.c
857 +@@ -1275,9 +1275,7 @@ static u64 bpf_skb_store_bytes(u64 r1, u64 r2, u64 r3, u64 r4, u64 flags)
858 + */
859 + if (unlikely((u32) offset > 0xffff || len > sizeof(buf)))
860 + return -EFAULT;
861 +-
862 +- if (unlikely(skb_cloned(skb) &&
863 +- !skb_clone_writable(skb, offset + len)))
864 ++ if (unlikely(skb_try_make_writable(skb, offset + len)))
865 + return -EFAULT;
866 +
867 + ptr = skb_header_pointer(skb, offset, len, buf);
868 +@@ -1321,8 +1319,7 @@ static u64 bpf_l3_csum_replace(u64 r1, u64 r2, u64 from, u64 to, u64 flags)
869 + if (unlikely((u32) offset > 0xffff))
870 + return -EFAULT;
871 +
872 +- if (unlikely(skb_cloned(skb) &&
873 +- !skb_clone_writable(skb, offset + sizeof(sum))))
874 ++ if (unlikely(skb_try_make_writable(skb, offset + sizeof(sum))))
875 + return -EFAULT;
876 +
877 + ptr = skb_header_pointer(skb, offset, sizeof(sum), &sum);
878 +@@ -1367,9 +1364,7 @@ static u64 bpf_l4_csum_replace(u64 r1, u64 r2, u64 from, u64 to, u64 flags)
879 +
880 + if (unlikely((u32) offset > 0xffff))
881 + return -EFAULT;
882 +-
883 +- if (unlikely(skb_cloned(skb) &&
884 +- !skb_clone_writable(skb, offset + sizeof(sum))))
885 ++ if (unlikely(skb_try_make_writable(skb, offset + sizeof(sum))))
886 + return -EFAULT;
887 +
888 + ptr = skb_header_pointer(skb, offset, sizeof(sum), &sum);
889 +@@ -1554,6 +1549,13 @@ bool bpf_helper_changes_skb_data(void *func)
890 + return true;
891 + if (func == bpf_skb_vlan_pop)
892 + return true;
893 ++ if (func == bpf_skb_store_bytes)
894 ++ return true;
895 ++ if (func == bpf_l3_csum_replace)
896 ++ return true;
897 ++ if (func == bpf_l4_csum_replace)
898 ++ return true;
899 ++
900 + return false;
901 + }
902 +
903 +diff --git a/net/core/neighbour.c b/net/core/neighbour.c
904 +index f18ae91b652e..769cece9b00b 100644
905 +--- a/net/core/neighbour.c
906 ++++ b/net/core/neighbour.c
907 +@@ -2467,13 +2467,17 @@ int neigh_xmit(int index, struct net_device *dev,
908 + tbl = neigh_tables[index];
909 + if (!tbl)
910 + goto out;
911 ++ rcu_read_lock_bh();
912 + neigh = __neigh_lookup_noref(tbl, addr, dev);
913 + if (!neigh)
914 + neigh = __neigh_create(tbl, addr, dev, false);
915 + err = PTR_ERR(neigh);
916 +- if (IS_ERR(neigh))
917 ++ if (IS_ERR(neigh)) {
918 ++ rcu_read_unlock_bh();
919 + goto out_kfree_skb;
920 ++ }
921 + err = neigh->output(neigh, skb);
922 ++ rcu_read_unlock_bh();
923 + }
924 + else if (index == NEIGH_LINK_TABLE) {
925 + err = dev_hard_header(skb, dev, ntohs(skb->protocol),
926 +diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
927 +index 477937465a20..d95631d09248 100644
928 +--- a/net/ipv4/esp4.c
929 ++++ b/net/ipv4/esp4.c
930 +@@ -23,6 +23,11 @@ struct esp_skb_cb {
931 + void *tmp;
932 + };
933 +
934 ++struct esp_output_extra {
935 ++ __be32 seqhi;
936 ++ u32 esphoff;
937 ++};
938 ++
939 + #define ESP_SKB_CB(__skb) ((struct esp_skb_cb *)&((__skb)->cb[0]))
940 +
941 + static u32 esp4_get_mtu(struct xfrm_state *x, int mtu);
942 +@@ -35,11 +40,11 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu);
943 + *
944 + * TODO: Use spare space in skb for this where possible.
945 + */
946 +-static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags, int seqhilen)
947 ++static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags, int extralen)
948 + {
949 + unsigned int len;
950 +
951 +- len = seqhilen;
952 ++ len = extralen;
953 +
954 + len += crypto_aead_ivsize(aead);
955 +
956 +@@ -57,15 +62,16 @@ static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags, int seqhilen)
957 + return kmalloc(len, GFP_ATOMIC);
958 + }
959 +
960 +-static inline __be32 *esp_tmp_seqhi(void *tmp)
961 ++static inline void *esp_tmp_extra(void *tmp)
962 + {
963 +- return PTR_ALIGN((__be32 *)tmp, __alignof__(__be32));
964 ++ return PTR_ALIGN(tmp, __alignof__(struct esp_output_extra));
965 + }
966 +-static inline u8 *esp_tmp_iv(struct crypto_aead *aead, void *tmp, int seqhilen)
967 ++
968 ++static inline u8 *esp_tmp_iv(struct crypto_aead *aead, void *tmp, int extralen)
969 + {
970 + return crypto_aead_ivsize(aead) ?
971 +- PTR_ALIGN((u8 *)tmp + seqhilen,
972 +- crypto_aead_alignmask(aead) + 1) : tmp + seqhilen;
973 ++ PTR_ALIGN((u8 *)tmp + extralen,
974 ++ crypto_aead_alignmask(aead) + 1) : tmp + extralen;
975 + }
976 +
977 + static inline struct aead_request *esp_tmp_req(struct crypto_aead *aead, u8 *iv)
978 +@@ -99,7 +105,7 @@ static void esp_restore_header(struct sk_buff *skb, unsigned int offset)
979 + {
980 + struct ip_esp_hdr *esph = (void *)(skb->data + offset);
981 + void *tmp = ESP_SKB_CB(skb)->tmp;
982 +- __be32 *seqhi = esp_tmp_seqhi(tmp);
983 ++ __be32 *seqhi = esp_tmp_extra(tmp);
984 +
985 + esph->seq_no = esph->spi;
986 + esph->spi = *seqhi;
987 +@@ -107,7 +113,11 @@ static void esp_restore_header(struct sk_buff *skb, unsigned int offset)
988 +
989 + static void esp_output_restore_header(struct sk_buff *skb)
990 + {
991 +- esp_restore_header(skb, skb_transport_offset(skb) - sizeof(__be32));
992 ++ void *tmp = ESP_SKB_CB(skb)->tmp;
993 ++ struct esp_output_extra *extra = esp_tmp_extra(tmp);
994 ++
995 ++ esp_restore_header(skb, skb_transport_offset(skb) + extra->esphoff -
996 ++ sizeof(__be32));
997 + }
998 +
999 + static void esp_output_done_esn(struct crypto_async_request *base, int err)
1000 +@@ -121,6 +131,7 @@ static void esp_output_done_esn(struct crypto_async_request *base, int err)
1001 + static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
1002 + {
1003 + int err;
1004 ++ struct esp_output_extra *extra;
1005 + struct ip_esp_hdr *esph;
1006 + struct crypto_aead *aead;
1007 + struct aead_request *req;
1008 +@@ -137,8 +148,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
1009 + int tfclen;
1010 + int nfrags;
1011 + int assoclen;
1012 +- int seqhilen;
1013 +- __be32 *seqhi;
1014 ++ int extralen;
1015 + __be64 seqno;
1016 +
1017 + /* skb is pure payload to encrypt */
1018 +@@ -166,21 +176,21 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
1019 + nfrags = err;
1020 +
1021 + assoclen = sizeof(*esph);
1022 +- seqhilen = 0;
1023 ++ extralen = 0;
1024 +
1025 + if (x->props.flags & XFRM_STATE_ESN) {
1026 +- seqhilen += sizeof(__be32);
1027 +- assoclen += seqhilen;
1028 ++ extralen += sizeof(*extra);
1029 ++ assoclen += sizeof(__be32);
1030 + }
1031 +
1032 +- tmp = esp_alloc_tmp(aead, nfrags, seqhilen);
1033 ++ tmp = esp_alloc_tmp(aead, nfrags, extralen);
1034 + if (!tmp) {
1035 + err = -ENOMEM;
1036 + goto error;
1037 + }
1038 +
1039 +- seqhi = esp_tmp_seqhi(tmp);
1040 +- iv = esp_tmp_iv(aead, tmp, seqhilen);
1041 ++ extra = esp_tmp_extra(tmp);
1042 ++ iv = esp_tmp_iv(aead, tmp, extralen);
1043 + req = esp_tmp_req(aead, iv);
1044 + sg = esp_req_sg(aead, req);
1045 +
1046 +@@ -247,8 +257,10 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
1047 + * encryption.
1048 + */
1049 + if ((x->props.flags & XFRM_STATE_ESN)) {
1050 +- esph = (void *)(skb_transport_header(skb) - sizeof(__be32));
1051 +- *seqhi = esph->spi;
1052 ++ extra->esphoff = (unsigned char *)esph -
1053 ++ skb_transport_header(skb);
1054 ++ esph = (struct ip_esp_hdr *)((unsigned char *)esph - 4);
1055 ++ extra->seqhi = esph->spi;
1056 + esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output.hi);
1057 + aead_request_set_callback(req, 0, esp_output_done_esn, skb);
1058 + }
1059 +@@ -445,7 +457,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
1060 + goto out;
1061 +
1062 + ESP_SKB_CB(skb)->tmp = tmp;
1063 +- seqhi = esp_tmp_seqhi(tmp);
1064 ++ seqhi = esp_tmp_extra(tmp);
1065 + iv = esp_tmp_iv(aead, tmp, seqhilen);
1066 + req = esp_tmp_req(aead, iv);
1067 + sg = esp_req_sg(aead, req);
1068 +diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
1069 +index c3a38353f5dc..9d1e555496e3 100644
1070 +--- a/net/ipv4/ipmr.c
1071 ++++ b/net/ipv4/ipmr.c
1072 +@@ -882,8 +882,10 @@ static struct mfc_cache *ipmr_cache_alloc(void)
1073 + {
1074 + struct mfc_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL);
1075 +
1076 +- if (c)
1077 ++ if (c) {
1078 ++ c->mfc_un.res.last_assert = jiffies - MFC_ASSERT_THRESH - 1;
1079 + c->mfc_un.res.minvif = MAXVIFS;
1080 ++ }
1081 + return c;
1082 + }
1083 +
1084 +diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
1085 +index a10e77103c88..e207cb2468da 100644
1086 +--- a/net/ipv6/ip6mr.c
1087 ++++ b/net/ipv6/ip6mr.c
1088 +@@ -1074,6 +1074,7 @@ static struct mfc6_cache *ip6mr_cache_alloc(void)
1089 + struct mfc6_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL);
1090 + if (!c)
1091 + return NULL;
1092 ++ c->mfc_un.res.last_assert = jiffies - MFC_ASSERT_THRESH - 1;
1093 + c->mfc_un.res.minvif = MAXMIFS;
1094 + return c;
1095 + }
1096 +diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
1097 +index dcccae86190f..ba3d2f3d66d2 100644
1098 +--- a/net/ipv6/sit.c
1099 ++++ b/net/ipv6/sit.c
1100 +@@ -560,13 +560,13 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
1101 +
1102 + if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) {
1103 + ipv4_update_pmtu(skb, dev_net(skb->dev), info,
1104 +- t->parms.link, 0, IPPROTO_IPV6, 0);
1105 ++ t->parms.link, 0, iph->protocol, 0);
1106 + err = 0;
1107 + goto out;
1108 + }
1109 + if (type == ICMP_REDIRECT) {
1110 + ipv4_redirect(skb, dev_net(skb->dev), t->parms.link, 0,
1111 +- IPPROTO_IPV6, 0);
1112 ++ iph->protocol, 0);
1113 + err = 0;
1114 + goto out;
1115 + }
1116 +diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
1117 +index b07c535ba8e7..eeb3eb3ea9eb 100644
1118 +--- a/net/sched/act_csum.c
1119 ++++ b/net/sched/act_csum.c
1120 +@@ -105,9 +105,7 @@ static void *tcf_csum_skb_nextlayer(struct sk_buff *skb,
1121 + int hl = ihl + jhl;
1122 +
1123 + if (!pskb_may_pull(skb, ipl + ntkoff) || (ipl < hl) ||
1124 +- (skb_cloned(skb) &&
1125 +- !skb_clone_writable(skb, hl + ntkoff) &&
1126 +- pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
1127 ++ skb_try_make_writable(skb, hl + ntkoff))
1128 + return NULL;
1129 + else
1130 + return (void *)(skb_network_header(skb) + ihl);
1131 +@@ -365,9 +363,7 @@ static int tcf_csum_ipv4(struct sk_buff *skb, u32 update_flags)
1132 + }
1133 +
1134 + if (update_flags & TCA_CSUM_UPDATE_FLAG_IPV4HDR) {
1135 +- if (skb_cloned(skb) &&
1136 +- !skb_clone_writable(skb, sizeof(*iph) + ntkoff) &&
1137 +- pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
1138 ++ if (skb_try_make_writable(skb, sizeof(*iph) + ntkoff))
1139 + goto fail;
1140 +
1141 + ip_send_check(ip_hdr(skb));
1142 +diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
1143 +index b7c4ead8b5a8..27607b863aba 100644
1144 +--- a/net/sched/act_nat.c
1145 ++++ b/net/sched/act_nat.c
1146 +@@ -126,9 +126,7 @@ static int tcf_nat(struct sk_buff *skb, const struct tc_action *a,
1147 + addr = iph->daddr;
1148 +
1149 + if (!((old_addr ^ addr) & mask)) {
1150 +- if (skb_cloned(skb) &&
1151 +- !skb_clone_writable(skb, sizeof(*iph) + noff) &&
1152 +- pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
1153 ++ if (skb_try_make_writable(skb, sizeof(*iph) + noff))
1154 + goto drop;
1155 +
1156 + new_addr &= mask;
1157 +@@ -156,9 +154,7 @@ static int tcf_nat(struct sk_buff *skb, const struct tc_action *a,
1158 + struct tcphdr *tcph;
1159 +
1160 + if (!pskb_may_pull(skb, ihl + sizeof(*tcph) + noff) ||
1161 +- (skb_cloned(skb) &&
1162 +- !skb_clone_writable(skb, ihl + sizeof(*tcph) + noff) &&
1163 +- pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
1164 ++ skb_try_make_writable(skb, ihl + sizeof(*tcph) + noff))
1165 + goto drop;
1166 +
1167 + tcph = (void *)(skb_network_header(skb) + ihl);
1168 +@@ -171,9 +167,7 @@ static int tcf_nat(struct sk_buff *skb, const struct tc_action *a,
1169 + struct udphdr *udph;
1170 +
1171 + if (!pskb_may_pull(skb, ihl + sizeof(*udph) + noff) ||
1172 +- (skb_cloned(skb) &&
1173 +- !skb_clone_writable(skb, ihl + sizeof(*udph) + noff) &&
1174 +- pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
1175 ++ skb_try_make_writable(skb, ihl + sizeof(*udph) + noff))
1176 + goto drop;
1177 +
1178 + udph = (void *)(skb_network_header(skb) + ihl);
1179 +@@ -213,10 +207,8 @@ static int tcf_nat(struct sk_buff *skb, const struct tc_action *a,
1180 + if ((old_addr ^ addr) & mask)
1181 + break;
1182 +
1183 +- if (skb_cloned(skb) &&
1184 +- !skb_clone_writable(skb, ihl + sizeof(*icmph) +
1185 +- sizeof(*iph) + noff) &&
1186 +- pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
1187 ++ if (skb_try_make_writable(skb, ihl + sizeof(*icmph) +
1188 ++ sizeof(*iph) + noff))
1189 + goto drop;
1190 +
1191 + icmph = (void *)(skb_network_header(skb) + ihl);
1192 +diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c
1193 +index 2177eac0a61e..2e4bd2c0a50c 100644
1194 +--- a/net/sched/sch_fifo.c
1195 ++++ b/net/sched/sch_fifo.c
1196 +@@ -37,14 +37,18 @@ static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc *sch)
1197 +
1198 + static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc *sch)
1199 + {
1200 ++ unsigned int prev_backlog;
1201 ++
1202 + if (likely(skb_queue_len(&sch->q) < sch->limit))
1203 + return qdisc_enqueue_tail(skb, sch);
1204 +
1205 ++ prev_backlog = sch->qstats.backlog;
1206 + /* queue full, remove one skb to fulfill the limit */
1207 + __qdisc_queue_drop_head(sch, &sch->q);
1208 + qdisc_qstats_drop(sch);
1209 + qdisc_enqueue_tail(skb, sch);
1210 +
1211 ++ qdisc_tree_reduce_backlog(sch, 0, prev_backlog - sch->qstats.backlog);
1212 + return NET_XMIT_CN;
1213 + }
1214 +
1215 +diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
1216 +index 4befe97a9034..b7c29d5b6f04 100644
1217 +--- a/net/sched/sch_netem.c
1218 ++++ b/net/sched/sch_netem.c
1219 +@@ -650,14 +650,14 @@ deliver:
1220 + #endif
1221 +
1222 + if (q->qdisc) {
1223 ++ unsigned int pkt_len = qdisc_pkt_len(skb);
1224 + int err = qdisc_enqueue(skb, q->qdisc);
1225 +
1226 +- if (unlikely(err != NET_XMIT_SUCCESS)) {
1227 +- if (net_xmit_drop_count(err)) {
1228 +- qdisc_qstats_drop(sch);
1229 +- qdisc_tree_reduce_backlog(sch, 1,
1230 +- qdisc_pkt_len(skb));
1231 +- }
1232 ++ if (err != NET_XMIT_SUCCESS &&
1233 ++ net_xmit_drop_count(err)) {
1234 ++ qdisc_qstats_drop(sch);
1235 ++ qdisc_tree_reduce_backlog(sch, 1,
1236 ++ pkt_len);
1237 + }
1238 + goto tfifo_dequeue;
1239 + }