1 |
commit: 04d89d0f4edaf324768e6d860f4ec6546d043725 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jul 11 19:56:55 2016 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jul 11 19:57:24 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=04d89d0f |
7 |
|
8 |
Linux patch 4.6.4 |
9 |
|
10 |
0000_README | 4 + |
11 |
1003_linux-4.6.4.patch | 1008 ++++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 1012 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 8feba45..5c841a9 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -55,6 +55,10 @@ Patch: 1002_linux-4.6.3.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.6.3 |
21 |
|
22 |
+Patch: 1003_linux-4.6.4.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.6.4 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1003_linux-4.6.4.patch b/1003_linux-4.6.4.patch |
31 |
new file mode 100644 |
32 |
index 0000000..5c5a062 |
33 |
--- /dev/null |
34 |
+++ b/1003_linux-4.6.4.patch |
35 |
@@ -0,0 +1,1008 @@ |
36 |
+diff --git a/Makefile b/Makefile |
37 |
+index c62b531d5a85..cd374426114a 100644 |
38 |
+--- a/Makefile |
39 |
++++ b/Makefile |
40 |
+@@ -1,6 +1,6 @@ |
41 |
+ VERSION = 4 |
42 |
+ PATCHLEVEL = 6 |
43 |
+-SUBLEVEL = 3 |
44 |
++SUBLEVEL = 4 |
45 |
+ EXTRAVERSION = |
46 |
+ NAME = Charred Weasel |
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 574e87c7f2b8..9acccad26928 100644 |
62 |
+--- a/drivers/crypto/ux500/hash/hash_core.c |
63 |
++++ b/drivers/crypto/ux500/hash/hash_core.c |
64 |
+@@ -781,7 +781,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 |
+@@ -832,7 +832,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 495577b6d31b..94ad5c0adbcb 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 0a3c1b04cf3c..38ed10d761d0 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/usb/core/quirks.c b/drivers/usb/core/quirks.c |
109 |
+index 6dc810bce295..944a6dca0fcb 100644 |
110 |
+--- a/drivers/usb/core/quirks.c |
111 |
++++ b/drivers/usb/core/quirks.c |
112 |
+@@ -44,6 +44,9 @@ static const struct usb_device_id usb_quirk_list[] = { |
113 |
+ /* Creative SB Audigy 2 NX */ |
114 |
+ { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, |
115 |
+ |
116 |
++ /* USB3503 */ |
117 |
++ { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME }, |
118 |
++ |
119 |
+ /* Microsoft Wireless Laser Mouse 6000 Receiver */ |
120 |
+ { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME }, |
121 |
+ |
122 |
+@@ -173,6 +176,10 @@ static const struct usb_device_id usb_quirk_list[] = { |
123 |
+ /* MAYA44USB sound device */ |
124 |
+ { USB_DEVICE(0x0a92, 0x0091), .driver_info = USB_QUIRK_RESET_RESUME }, |
125 |
+ |
126 |
++ /* ASUS Base Station(T100) */ |
127 |
++ { USB_DEVICE(0x0b05, 0x17e0), .driver_info = |
128 |
++ USB_QUIRK_IGNORE_REMOTE_WAKEUP }, |
129 |
++ |
130 |
+ /* Action Semiconductor flash disk */ |
131 |
+ { USB_DEVICE(0x10d6, 0x2200), .driver_info = |
132 |
+ USB_QUIRK_STRING_FETCH_255 }, |
133 |
+@@ -188,26 +195,22 @@ static const struct usb_device_id usb_quirk_list[] = { |
134 |
+ { USB_DEVICE(0x1908, 0x1315), .driver_info = |
135 |
+ USB_QUIRK_HONOR_BNUMINTERFACES }, |
136 |
+ |
137 |
+- /* INTEL VALUE SSD */ |
138 |
+- { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, |
139 |
+- |
140 |
+- /* USB3503 */ |
141 |
+- { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME }, |
142 |
+- |
143 |
+- /* ASUS Base Station(T100) */ |
144 |
+- { USB_DEVICE(0x0b05, 0x17e0), .driver_info = |
145 |
+- USB_QUIRK_IGNORE_REMOTE_WAKEUP }, |
146 |
+- |
147 |
+ /* Protocol and OTG Electrical Test Device */ |
148 |
+ { USB_DEVICE(0x1a0a, 0x0200), .driver_info = |
149 |
+ USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, |
150 |
+ |
151 |
++ /* Acer C120 LED Projector */ |
152 |
++ { USB_DEVICE(0x1de1, 0xc102), .driver_info = USB_QUIRK_NO_LPM }, |
153 |
++ |
154 |
+ /* Blackmagic Design Intensity Shuttle */ |
155 |
+ { USB_DEVICE(0x1edb, 0xbd3b), .driver_info = USB_QUIRK_NO_LPM }, |
156 |
+ |
157 |
+ /* Blackmagic Design UltraStudio SDI */ |
158 |
+ { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM }, |
159 |
+ |
160 |
++ /* INTEL VALUE SSD */ |
161 |
++ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, |
162 |
++ |
163 |
+ { } /* terminating entry must be last */ |
164 |
+ }; |
165 |
+ |
166 |
+diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c |
167 |
+index dd5cb5577dca..2f1fb7e7aa54 100644 |
168 |
+--- a/drivers/usb/dwc3/dwc3-exynos.c |
169 |
++++ b/drivers/usb/dwc3/dwc3-exynos.c |
170 |
+@@ -128,12 +128,6 @@ static int dwc3_exynos_probe(struct platform_device *pdev) |
171 |
+ |
172 |
+ platform_set_drvdata(pdev, exynos); |
173 |
+ |
174 |
+- ret = dwc3_exynos_register_phys(exynos); |
175 |
+- if (ret) { |
176 |
+- dev_err(dev, "couldn't register PHYs\n"); |
177 |
+- return ret; |
178 |
+- } |
179 |
+- |
180 |
+ exynos->dev = dev; |
181 |
+ |
182 |
+ exynos->clk = devm_clk_get(dev, "usbdrd30"); |
183 |
+@@ -183,20 +177,29 @@ static int dwc3_exynos_probe(struct platform_device *pdev) |
184 |
+ goto err3; |
185 |
+ } |
186 |
+ |
187 |
++ ret = dwc3_exynos_register_phys(exynos); |
188 |
++ if (ret) { |
189 |
++ dev_err(dev, "couldn't register PHYs\n"); |
190 |
++ goto err4; |
191 |
++ } |
192 |
++ |
193 |
+ if (node) { |
194 |
+ ret = of_platform_populate(node, NULL, NULL, dev); |
195 |
+ if (ret) { |
196 |
+ dev_err(dev, "failed to add dwc3 core\n"); |
197 |
+- goto err4; |
198 |
++ goto err5; |
199 |
+ } |
200 |
+ } else { |
201 |
+ dev_err(dev, "no device node, failed to add dwc3 core\n"); |
202 |
+ ret = -ENODEV; |
203 |
+- goto err4; |
204 |
++ goto err5; |
205 |
+ } |
206 |
+ |
207 |
+ return 0; |
208 |
+ |
209 |
++err5: |
210 |
++ platform_device_unregister(exynos->usb2_phy); |
211 |
++ platform_device_unregister(exynos->usb3_phy); |
212 |
+ err4: |
213 |
+ regulator_disable(exynos->vdd10); |
214 |
+ err3: |
215 |
+diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c |
216 |
+index e64479f882a5..aa3707bdebb4 100644 |
217 |
+--- a/drivers/usb/gadget/legacy/inode.c |
218 |
++++ b/drivers/usb/gadget/legacy/inode.c |
219 |
+@@ -938,8 +938,11 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr) |
220 |
+ struct usb_ep *ep = dev->gadget->ep0; |
221 |
+ struct usb_request *req = dev->req; |
222 |
+ |
223 |
+- if ((retval = setup_req (ep, req, 0)) == 0) |
224 |
+- retval = usb_ep_queue (ep, req, GFP_ATOMIC); |
225 |
++ if ((retval = setup_req (ep, req, 0)) == 0) { |
226 |
++ spin_unlock_irq (&dev->lock); |
227 |
++ retval = usb_ep_queue (ep, req, GFP_KERNEL); |
228 |
++ spin_lock_irq (&dev->lock); |
229 |
++ } |
230 |
+ dev->state = STATE_DEV_CONNECTED; |
231 |
+ |
232 |
+ /* assume that was SET_CONFIGURATION */ |
233 |
+@@ -1457,8 +1460,11 @@ delegate: |
234 |
+ w_length); |
235 |
+ if (value < 0) |
236 |
+ break; |
237 |
++ |
238 |
++ spin_unlock (&dev->lock); |
239 |
+ value = usb_ep_queue (gadget->ep0, dev->req, |
240 |
+- GFP_ATOMIC); |
241 |
++ GFP_KERNEL); |
242 |
++ spin_lock (&dev->lock); |
243 |
+ if (value < 0) { |
244 |
+ clean_req (gadget->ep0, dev->req); |
245 |
+ break; |
246 |
+@@ -1481,11 +1487,14 @@ delegate: |
247 |
+ if (value >= 0 && dev->state != STATE_DEV_SETUP) { |
248 |
+ req->length = value; |
249 |
+ req->zero = value < w_length; |
250 |
+- value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC); |
251 |
++ |
252 |
++ spin_unlock (&dev->lock); |
253 |
++ value = usb_ep_queue (gadget->ep0, req, GFP_KERNEL); |
254 |
+ if (value < 0) { |
255 |
+ DBG (dev, "ep_queue --> %d\n", value); |
256 |
+ req->status = 0; |
257 |
+ } |
258 |
++ return value; |
259 |
+ } |
260 |
+ |
261 |
+ /* device stalls when value < 0 */ |
262 |
+diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c |
263 |
+index 4031b372008e..c1c1024a054c 100644 |
264 |
+--- a/drivers/usb/host/ehci-tegra.c |
265 |
++++ b/drivers/usb/host/ehci-tegra.c |
266 |
+@@ -89,7 +89,7 @@ static int tegra_reset_usb_controller(struct platform_device *pdev) |
267 |
+ if (!usb1_reset_attempted) { |
268 |
+ struct reset_control *usb1_reset; |
269 |
+ |
270 |
+- usb1_reset = of_reset_control_get(phy_np, "usb"); |
271 |
++ usb1_reset = of_reset_control_get(phy_np, "utmi-pads"); |
272 |
+ if (IS_ERR(usb1_reset)) { |
273 |
+ dev_warn(&pdev->dev, |
274 |
+ "can't get utmi-pads reset from the PHY\n"); |
275 |
+diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c |
276 |
+index 48672fac7ff3..c10972fcc8e4 100644 |
277 |
+--- a/drivers/usb/host/xhci-pci.c |
278 |
++++ b/drivers/usb/host/xhci-pci.c |
279 |
+@@ -37,6 +37,7 @@ |
280 |
+ /* Device for a quirk */ |
281 |
+ #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 |
282 |
+ #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 |
283 |
++#define PCI_DEVICE_ID_FRESCO_LOGIC_FL1009 0x1009 |
284 |
+ #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x1400 |
285 |
+ |
286 |
+ #define PCI_VENDOR_ID_ETRON 0x1b6f |
287 |
+@@ -114,6 +115,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) |
288 |
+ xhci->quirks |= XHCI_TRUST_TX_LENGTH; |
289 |
+ } |
290 |
+ |
291 |
++ if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && |
292 |
++ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009) |
293 |
++ xhci->quirks |= XHCI_BROKEN_STREAMS; |
294 |
++ |
295 |
+ if (pdev->vendor == PCI_VENDOR_ID_NEC) |
296 |
+ xhci->quirks |= XHCI_NEC_HOST; |
297 |
+ |
298 |
+diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c |
299 |
+index 474b5fa14900..d6e2b2751e50 100644 |
300 |
+--- a/drivers/usb/host/xhci-plat.c |
301 |
++++ b/drivers/usb/host/xhci-plat.c |
302 |
+@@ -194,6 +194,9 @@ static int xhci_plat_probe(struct platform_device *pdev) |
303 |
+ ret = clk_prepare_enable(clk); |
304 |
+ if (ret) |
305 |
+ goto put_hcd; |
306 |
++ } else if (PTR_ERR(clk) == -EPROBE_DEFER) { |
307 |
++ ret = -EPROBE_DEFER; |
308 |
++ goto put_hcd; |
309 |
+ } |
310 |
+ |
311 |
+ xhci = hcd_to_xhci(hcd); |
312 |
+diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
313 |
+index 99b4ff42f7a0..8b5b2aca277d 100644 |
314 |
+--- a/drivers/usb/host/xhci-ring.c |
315 |
++++ b/drivers/usb/host/xhci-ring.c |
316 |
+@@ -290,6 +290,14 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) |
317 |
+ |
318 |
+ temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); |
319 |
+ xhci->cmd_ring_state = CMD_RING_STATE_ABORTED; |
320 |
++ |
321 |
++ /* |
322 |
++ * Writing the CMD_RING_ABORT bit should cause a cmd completion event, |
323 |
++ * however on some host hw the CMD_RING_RUNNING bit is correctly cleared |
324 |
++ * but the completion event in never sent. Use the cmd timeout timer to |
325 |
++ * handle those cases. Use twice the time to cover the bit polling retry |
326 |
++ */ |
327 |
++ mod_timer(&xhci->cmd_timer, jiffies + (2 * XHCI_CMD_DEFAULT_TIMEOUT)); |
328 |
+ xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, |
329 |
+ &xhci->op_regs->cmd_ring); |
330 |
+ |
331 |
+@@ -314,6 +322,7 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) |
332 |
+ |
333 |
+ xhci_err(xhci, "Stopped the command ring failed, " |
334 |
+ "maybe the host is dead\n"); |
335 |
++ del_timer(&xhci->cmd_timer); |
336 |
+ xhci->xhc_state |= XHCI_STATE_DYING; |
337 |
+ xhci_quiesce(xhci); |
338 |
+ xhci_halt(xhci); |
339 |
+@@ -1253,22 +1262,21 @@ void xhci_handle_command_timeout(unsigned long data) |
340 |
+ int ret; |
341 |
+ unsigned long flags; |
342 |
+ u64 hw_ring_state; |
343 |
+- struct xhci_command *cur_cmd = NULL; |
344 |
++ bool second_timeout = false; |
345 |
+ xhci = (struct xhci_hcd *) data; |
346 |
+ |
347 |
+ /* mark this command to be cancelled */ |
348 |
+ spin_lock_irqsave(&xhci->lock, flags); |
349 |
+ if (xhci->current_cmd) { |
350 |
+- cur_cmd = xhci->current_cmd; |
351 |
+- cur_cmd->status = COMP_CMD_ABORT; |
352 |
++ if (xhci->current_cmd->status == COMP_CMD_ABORT) |
353 |
++ second_timeout = true; |
354 |
++ xhci->current_cmd->status = COMP_CMD_ABORT; |
355 |
+ } |
356 |
+ |
357 |
+- |
358 |
+ /* Make sure command ring is running before aborting it */ |
359 |
+ hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); |
360 |
+ if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) && |
361 |
+ (hw_ring_state & CMD_RING_RUNNING)) { |
362 |
+- |
363 |
+ spin_unlock_irqrestore(&xhci->lock, flags); |
364 |
+ xhci_dbg(xhci, "Command timeout\n"); |
365 |
+ ret = xhci_abort_cmd_ring(xhci); |
366 |
+@@ -1280,6 +1288,15 @@ void xhci_handle_command_timeout(unsigned long data) |
367 |
+ } |
368 |
+ return; |
369 |
+ } |
370 |
++ |
371 |
++ /* command ring failed to restart, or host removed. Bail out */ |
372 |
++ if (second_timeout || xhci->xhc_state & XHCI_STATE_REMOVING) { |
373 |
++ spin_unlock_irqrestore(&xhci->lock, flags); |
374 |
++ xhci_dbg(xhci, "command timed out twice, ring start fail?\n"); |
375 |
++ xhci_cleanup_command_queue(xhci); |
376 |
++ return; |
377 |
++ } |
378 |
++ |
379 |
+ /* command timeout on stopped ring, ring can't be aborted */ |
380 |
+ xhci_dbg(xhci, "Command timeout on stopped ring\n"); |
381 |
+ xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd); |
382 |
+@@ -2728,7 +2745,8 @@ hw_died: |
383 |
+ writel(irq_pending, &xhci->ir_set->irq_pending); |
384 |
+ } |
385 |
+ |
386 |
+- if (xhci->xhc_state & XHCI_STATE_DYING) { |
387 |
++ if (xhci->xhc_state & XHCI_STATE_DYING || |
388 |
++ xhci->xhc_state & XHCI_STATE_HALTED) { |
389 |
+ xhci_dbg(xhci, "xHCI dying, ignoring interrupt. " |
390 |
+ "Shouldn't IRQs be disabled?\n"); |
391 |
+ /* Clear the event handler busy flag (RW1C); |
392 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
393 |
+index 9e71c96ad74a..327280535848 100644 |
394 |
+--- a/drivers/usb/host/xhci.c |
395 |
++++ b/drivers/usb/host/xhci.c |
396 |
+@@ -685,20 +685,23 @@ void xhci_stop(struct usb_hcd *hcd) |
397 |
+ u32 temp; |
398 |
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
399 |
+ |
400 |
+- if (xhci->xhc_state & XHCI_STATE_HALTED) |
401 |
+- return; |
402 |
+- |
403 |
+ mutex_lock(&xhci->mutex); |
404 |
+- spin_lock_irq(&xhci->lock); |
405 |
+- xhci->xhc_state |= XHCI_STATE_HALTED; |
406 |
+- xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; |
407 |
+ |
408 |
+- /* Make sure the xHC is halted for a USB3 roothub |
409 |
+- * (xhci_stop() could be called as part of failed init). |
410 |
+- */ |
411 |
+- xhci_halt(xhci); |
412 |
+- xhci_reset(xhci); |
413 |
+- spin_unlock_irq(&xhci->lock); |
414 |
++ if (!(xhci->xhc_state & XHCI_STATE_HALTED)) { |
415 |
++ spin_lock_irq(&xhci->lock); |
416 |
++ |
417 |
++ xhci->xhc_state |= XHCI_STATE_HALTED; |
418 |
++ xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; |
419 |
++ xhci_halt(xhci); |
420 |
++ xhci_reset(xhci); |
421 |
++ |
422 |
++ spin_unlock_irq(&xhci->lock); |
423 |
++ } |
424 |
++ |
425 |
++ if (!usb_hcd_is_primary_hcd(hcd)) { |
426 |
++ mutex_unlock(&xhci->mutex); |
427 |
++ return; |
428 |
++ } |
429 |
+ |
430 |
+ xhci_cleanup_msix(xhci); |
431 |
+ |
432 |
+diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c |
433 |
+index 39fd95833eb8..c84f4d0816e5 100644 |
434 |
+--- a/drivers/usb/musb/musb_core.c |
435 |
++++ b/drivers/usb/musb/musb_core.c |
436 |
+@@ -2429,7 +2429,8 @@ static void musb_restore_context(struct musb *musb) |
437 |
+ musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe); |
438 |
+ musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe); |
439 |
+ musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe); |
440 |
+- musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); |
441 |
++ if (musb->context.devctl & MUSB_DEVCTL_SESSION) |
442 |
++ musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); |
443 |
+ |
444 |
+ for (i = 0; i < musb->config->num_eps; ++i) { |
445 |
+ struct musb_hw_ep *hw_ep; |
446 |
+diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c |
447 |
+index 2f8ad7f1f482..8ff03228540a 100644 |
448 |
+--- a/drivers/usb/musb/musb_host.c |
449 |
++++ b/drivers/usb/musb/musb_host.c |
450 |
+@@ -594,14 +594,13 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, u8 epnum) |
451 |
+ musb_writew(ep->regs, MUSB_TXCSR, 0); |
452 |
+ |
453 |
+ /* scrub all previous state, clearing toggle */ |
454 |
+- } else { |
455 |
+- csr = musb_readw(ep->regs, MUSB_RXCSR); |
456 |
+- if (csr & MUSB_RXCSR_RXPKTRDY) |
457 |
+- WARNING("rx%d, packet/%d ready?\n", ep->epnum, |
458 |
+- musb_readw(ep->regs, MUSB_RXCOUNT)); |
459 |
+- |
460 |
+- musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG); |
461 |
+ } |
462 |
++ csr = musb_readw(ep->regs, MUSB_RXCSR); |
463 |
++ if (csr & MUSB_RXCSR_RXPKTRDY) |
464 |
++ WARNING("rx%d, packet/%d ready?\n", ep->epnum, |
465 |
++ musb_readw(ep->regs, MUSB_RXCOUNT)); |
466 |
++ |
467 |
++ musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG); |
468 |
+ |
469 |
+ /* target addr and (for multipoint) hub addr/port */ |
470 |
+ if (musb->is_multipoint) { |
471 |
+@@ -995,9 +994,15 @@ static void musb_bulk_nak_timeout(struct musb *musb, struct musb_hw_ep *ep, |
472 |
+ if (is_in) { |
473 |
+ dma = is_dma_capable() ? ep->rx_channel : NULL; |
474 |
+ |
475 |
+- /* clear nak timeout bit */ |
476 |
++ /* |
477 |
++ * Need to stop the transaction by clearing REQPKT first |
478 |
++ * then the NAK Timeout bit ref MUSBMHDRC USB 2.0 HIGH-SPEED |
479 |
++ * DUAL-ROLE CONTROLLER Programmer's Guide, section 9.2.2 |
480 |
++ */ |
481 |
+ rx_csr = musb_readw(epio, MUSB_RXCSR); |
482 |
+ rx_csr |= MUSB_RXCSR_H_WZC_BITS; |
483 |
++ rx_csr &= ~MUSB_RXCSR_H_REQPKT; |
484 |
++ musb_writew(epio, MUSB_RXCSR, rx_csr); |
485 |
+ rx_csr &= ~MUSB_RXCSR_DATAERROR; |
486 |
+ musb_writew(epio, MUSB_RXCSR, rx_csr); |
487 |
+ |
488 |
+@@ -1551,7 +1556,7 @@ static int musb_rx_dma_iso_cppi41(struct dma_controller *dma, |
489 |
+ struct urb *urb, |
490 |
+ size_t len) |
491 |
+ { |
492 |
+- struct dma_channel *channel = hw_ep->tx_channel; |
493 |
++ struct dma_channel *channel = hw_ep->rx_channel; |
494 |
+ void __iomem *epio = hw_ep->regs; |
495 |
+ dma_addr_t *buf; |
496 |
+ u32 length, res; |
497 |
+diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c |
498 |
+index 2eddbe538cda..5608af4a369d 100644 |
499 |
+--- a/drivers/usb/serial/mos7720.c |
500 |
++++ b/drivers/usb/serial/mos7720.c |
501 |
+@@ -2007,6 +2007,7 @@ static void mos7720_release(struct usb_serial *serial) |
502 |
+ urblist_entry) |
503 |
+ usb_unlink_urb(urbtrack->urb); |
504 |
+ spin_unlock_irqrestore(&mos_parport->listlock, flags); |
505 |
++ parport_del_port(mos_parport->pp); |
506 |
+ |
507 |
+ kref_put(&mos_parport->ref_count, destroy_mos_parport); |
508 |
+ } |
509 |
+diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c |
510 |
+index 16bc679dc2fc..ecc7d4b1dfa3 100644 |
511 |
+--- a/drivers/usb/storage/uas.c |
512 |
++++ b/drivers/usb/storage/uas.c |
513 |
+@@ -835,6 +835,7 @@ static int uas_slave_configure(struct scsi_device *sdev) |
514 |
+ if (devinfo->flags & US_FL_BROKEN_FUA) |
515 |
+ sdev->broken_fua = 1; |
516 |
+ |
517 |
++ scsi_change_queue_depth(sdev, devinfo->qdepth - 2); |
518 |
+ return 0; |
519 |
+ } |
520 |
+ |
521 |
+diff --git a/include/linux/bpf.h b/include/linux/bpf.h |
522 |
+index f1d5c5acc8dd..ca80d5830bfd 100644 |
523 |
+--- a/include/linux/bpf.h |
524 |
++++ b/include/linux/bpf.h |
525 |
+@@ -229,6 +229,10 @@ static inline struct bpf_prog *bpf_prog_get(u32 ufd) |
526 |
+ static inline void bpf_prog_put(struct bpf_prog *prog) |
527 |
+ { |
528 |
+ } |
529 |
++ |
530 |
++static inline void bpf_prog_put_rcu(struct bpf_prog *prog) |
531 |
++{ |
532 |
++} |
533 |
+ #endif /* CONFIG_BPF_SYSCALL */ |
534 |
+ |
535 |
+ /* verifier prototypes for helper functions called from eBPF programs */ |
536 |
+diff --git a/include/linux/net.h b/include/linux/net.h |
537 |
+index f840d77c6c31..9d90efe6a708 100644 |
538 |
+--- a/include/linux/net.h |
539 |
++++ b/include/linux/net.h |
540 |
+@@ -252,7 +252,8 @@ do { \ |
541 |
+ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
542 |
+ if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ |
543 |
+ net_ratelimit()) \ |
544 |
+- __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \ |
545 |
++ __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ |
546 |
++ ##__VA_ARGS__); \ |
547 |
+ } while (0) |
548 |
+ #elif defined(DEBUG) |
549 |
+ #define net_dbg_ratelimited(fmt, ...) \ |
550 |
+diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h |
551 |
+index 4018b48f2b3b..a0596ca0e80a 100644 |
552 |
+--- a/include/linux/sock_diag.h |
553 |
++++ b/include/linux/sock_diag.h |
554 |
+@@ -36,6 +36,9 @@ enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk) |
555 |
+ { |
556 |
+ switch (sk->sk_family) { |
557 |
+ case AF_INET: |
558 |
++ if (sk->sk_type == SOCK_RAW) |
559 |
++ return SKNLGRP_NONE; |
560 |
++ |
561 |
+ switch (sk->sk_protocol) { |
562 |
+ case IPPROTO_TCP: |
563 |
+ return SKNLGRP_INET_TCP_DESTROY; |
564 |
+@@ -45,6 +48,9 @@ enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk) |
565 |
+ return SKNLGRP_NONE; |
566 |
+ } |
567 |
+ case AF_INET6: |
568 |
++ if (sk->sk_type == SOCK_RAW) |
569 |
++ return SKNLGRP_NONE; |
570 |
++ |
571 |
+ switch (sk->sk_protocol) { |
572 |
+ case IPPROTO_TCP: |
573 |
+ return SKNLGRP_INET6_TCP_DESTROY; |
574 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
575 |
+index c0ded2416615..a69c90cea05d 100644 |
576 |
+--- a/kernel/events/core.c |
577 |
++++ b/kernel/events/core.c |
578 |
+@@ -7143,7 +7143,7 @@ static void perf_event_free_bpf_prog(struct perf_event *event) |
579 |
+ prog = event->tp_event->prog; |
580 |
+ if (prog) { |
581 |
+ event->tp_event->prog = NULL; |
582 |
+- bpf_prog_put(prog); |
583 |
++ bpf_prog_put_rcu(prog); |
584 |
+ } |
585 |
+ } |
586 |
+ |
587 |
+diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c |
588 |
+index fbd0acf80b13..2fdebabbfacd 100644 |
589 |
+--- a/net/ax25/af_ax25.c |
590 |
++++ b/net/ax25/af_ax25.c |
591 |
+@@ -976,7 +976,8 @@ static int ax25_release(struct socket *sock) |
592 |
+ release_sock(sk); |
593 |
+ ax25_disconnect(ax25, 0); |
594 |
+ lock_sock(sk); |
595 |
+- ax25_destroy_socket(ax25); |
596 |
++ if (!sock_flag(ax25->sk, SOCK_DESTROY)) |
597 |
++ ax25_destroy_socket(ax25); |
598 |
+ break; |
599 |
+ |
600 |
+ case AX25_STATE_3: |
601 |
+diff --git a/net/ax25/ax25_ds_timer.c b/net/ax25/ax25_ds_timer.c |
602 |
+index 951cd57bb07d..5237dff6941d 100644 |
603 |
+--- a/net/ax25/ax25_ds_timer.c |
604 |
++++ b/net/ax25/ax25_ds_timer.c |
605 |
+@@ -102,6 +102,7 @@ void ax25_ds_heartbeat_expiry(ax25_cb *ax25) |
606 |
+ switch (ax25->state) { |
607 |
+ |
608 |
+ case AX25_STATE_0: |
609 |
++ case AX25_STATE_2: |
610 |
+ /* Magic here: If we listen() and a new link dies before it |
611 |
+ is accepted() it isn't 'dead' so doesn't get removed. */ |
612 |
+ if (!sk || sock_flag(sk, SOCK_DESTROY) || |
613 |
+@@ -111,6 +112,7 @@ void ax25_ds_heartbeat_expiry(ax25_cb *ax25) |
614 |
+ sock_hold(sk); |
615 |
+ ax25_destroy_socket(ax25); |
616 |
+ bh_unlock_sock(sk); |
617 |
++ /* Ungrab socket and destroy it */ |
618 |
+ sock_put(sk); |
619 |
+ } else |
620 |
+ ax25_destroy_socket(ax25); |
621 |
+@@ -213,7 +215,8 @@ void ax25_ds_t1_timeout(ax25_cb *ax25) |
622 |
+ case AX25_STATE_2: |
623 |
+ if (ax25->n2count == ax25->n2) { |
624 |
+ ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); |
625 |
+- ax25_disconnect(ax25, ETIMEDOUT); |
626 |
++ if (!sock_flag(ax25->sk, SOCK_DESTROY)) |
627 |
++ ax25_disconnect(ax25, ETIMEDOUT); |
628 |
+ return; |
629 |
+ } else { |
630 |
+ ax25->n2count++; |
631 |
+diff --git a/net/ax25/ax25_std_timer.c b/net/ax25/ax25_std_timer.c |
632 |
+index 004467c9e6e1..2c0d6ef66f9d 100644 |
633 |
+--- a/net/ax25/ax25_std_timer.c |
634 |
++++ b/net/ax25/ax25_std_timer.c |
635 |
+@@ -38,6 +38,7 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25) |
636 |
+ |
637 |
+ switch (ax25->state) { |
638 |
+ case AX25_STATE_0: |
639 |
++ case AX25_STATE_2: |
640 |
+ /* Magic here: If we listen() and a new link dies before it |
641 |
+ is accepted() it isn't 'dead' so doesn't get removed. */ |
642 |
+ if (!sk || sock_flag(sk, SOCK_DESTROY) || |
643 |
+@@ -47,6 +48,7 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25) |
644 |
+ sock_hold(sk); |
645 |
+ ax25_destroy_socket(ax25); |
646 |
+ bh_unlock_sock(sk); |
647 |
++ /* Ungrab socket and destroy it */ |
648 |
+ sock_put(sk); |
649 |
+ } else |
650 |
+ ax25_destroy_socket(ax25); |
651 |
+@@ -144,7 +146,8 @@ void ax25_std_t1timer_expiry(ax25_cb *ax25) |
652 |
+ case AX25_STATE_2: |
653 |
+ if (ax25->n2count == ax25->n2) { |
654 |
+ ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); |
655 |
+- ax25_disconnect(ax25, ETIMEDOUT); |
656 |
++ if (!sock_flag(ax25->sk, SOCK_DESTROY)) |
657 |
++ ax25_disconnect(ax25, ETIMEDOUT); |
658 |
+ return; |
659 |
+ } else { |
660 |
+ ax25->n2count++; |
661 |
+diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c |
662 |
+index 3b78e8473a01..655a7d4c96e1 100644 |
663 |
+--- a/net/ax25/ax25_subr.c |
664 |
++++ b/net/ax25/ax25_subr.c |
665 |
+@@ -264,7 +264,8 @@ void ax25_disconnect(ax25_cb *ax25, int reason) |
666 |
+ { |
667 |
+ ax25_clear_queues(ax25); |
668 |
+ |
669 |
+- ax25_stop_heartbeat(ax25); |
670 |
++ if (!sock_flag(ax25->sk, SOCK_DESTROY)) |
671 |
++ ax25_stop_heartbeat(ax25); |
672 |
+ ax25_stop_t1timer(ax25); |
673 |
+ ax25_stop_t2timer(ax25); |
674 |
+ ax25_stop_t3timer(ax25); |
675 |
+diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c |
676 |
+index 6852f3c7009c..43844144c9c4 100644 |
677 |
+--- a/net/bridge/br_multicast.c |
678 |
++++ b/net/bridge/br_multicast.c |
679 |
+@@ -464,8 +464,11 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br, |
680 |
+ if (ipv6_dev_get_saddr(dev_net(br->dev), br->dev, &ip6h->daddr, 0, |
681 |
+ &ip6h->saddr)) { |
682 |
+ kfree_skb(skb); |
683 |
++ br->has_ipv6_addr = 0; |
684 |
+ return NULL; |
685 |
+ } |
686 |
++ |
687 |
++ br->has_ipv6_addr = 1; |
688 |
+ ipv6_eth_mc_map(&ip6h->daddr, eth->h_dest); |
689 |
+ |
690 |
+ hopopt = (u8 *)(ip6h + 1); |
691 |
+@@ -1745,6 +1748,7 @@ void br_multicast_init(struct net_bridge *br) |
692 |
+ br->ip6_other_query.delay_time = 0; |
693 |
+ br->ip6_querier.port = NULL; |
694 |
+ #endif |
695 |
++ br->has_ipv6_addr = 1; |
696 |
+ |
697 |
+ spin_lock_init(&br->multicast_lock); |
698 |
+ setup_timer(&br->multicast_router_timer, |
699 |
+diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h |
700 |
+index d9da857182ef..f516c53bafb6 100644 |
701 |
+--- a/net/bridge/br_private.h |
702 |
++++ b/net/bridge/br_private.h |
703 |
+@@ -304,6 +304,7 @@ struct net_bridge |
704 |
+ u8 multicast_disabled:1; |
705 |
+ u8 multicast_querier:1; |
706 |
+ u8 multicast_query_use_ifaddr:1; |
707 |
++ u8 has_ipv6_addr:1; |
708 |
+ |
709 |
+ u32 hash_elasticity; |
710 |
+ u32 hash_max; |
711 |
+@@ -577,10 +578,22 @@ static inline bool br_multicast_is_router(struct net_bridge *br) |
712 |
+ |
713 |
+ static inline bool |
714 |
+ __br_multicast_querier_exists(struct net_bridge *br, |
715 |
+- struct bridge_mcast_other_query *querier) |
716 |
++ struct bridge_mcast_other_query *querier, |
717 |
++ const bool is_ipv6) |
718 |
+ { |
719 |
++ bool own_querier_enabled; |
720 |
++ |
721 |
++ if (br->multicast_querier) { |
722 |
++ if (is_ipv6 && !br->has_ipv6_addr) |
723 |
++ own_querier_enabled = false; |
724 |
++ else |
725 |
++ own_querier_enabled = true; |
726 |
++ } else { |
727 |
++ own_querier_enabled = false; |
728 |
++ } |
729 |
++ |
730 |
+ return time_is_before_jiffies(querier->delay_time) && |
731 |
+- (br->multicast_querier || timer_pending(&querier->timer)); |
732 |
++ (own_querier_enabled || timer_pending(&querier->timer)); |
733 |
+ } |
734 |
+ |
735 |
+ static inline bool br_multicast_querier_exists(struct net_bridge *br, |
736 |
+@@ -588,10 +601,12 @@ static inline bool br_multicast_querier_exists(struct net_bridge *br, |
737 |
+ { |
738 |
+ switch (eth->h_proto) { |
739 |
+ case (htons(ETH_P_IP)): |
740 |
+- return __br_multicast_querier_exists(br, &br->ip4_other_query); |
741 |
++ return __br_multicast_querier_exists(br, |
742 |
++ &br->ip4_other_query, false); |
743 |
+ #if IS_ENABLED(CONFIG_IPV6) |
744 |
+ case (htons(ETH_P_IPV6)): |
745 |
+- return __br_multicast_querier_exists(br, &br->ip6_other_query); |
746 |
++ return __br_multicast_querier_exists(br, |
747 |
++ &br->ip6_other_query, true); |
748 |
+ #endif |
749 |
+ default: |
750 |
+ return false; |
751 |
+diff --git a/net/core/neighbour.c b/net/core/neighbour.c |
752 |
+index f18ae91b652e..769cece9b00b 100644 |
753 |
+--- a/net/core/neighbour.c |
754 |
++++ b/net/core/neighbour.c |
755 |
+@@ -2467,13 +2467,17 @@ int neigh_xmit(int index, struct net_device *dev, |
756 |
+ tbl = neigh_tables[index]; |
757 |
+ if (!tbl) |
758 |
+ goto out; |
759 |
++ rcu_read_lock_bh(); |
760 |
+ neigh = __neigh_lookup_noref(tbl, addr, dev); |
761 |
+ if (!neigh) |
762 |
+ neigh = __neigh_create(tbl, addr, dev, false); |
763 |
+ err = PTR_ERR(neigh); |
764 |
+- if (IS_ERR(neigh)) |
765 |
++ if (IS_ERR(neigh)) { |
766 |
++ rcu_read_unlock_bh(); |
767 |
+ goto out_kfree_skb; |
768 |
++ } |
769 |
+ err = neigh->output(neigh, skb); |
770 |
++ rcu_read_unlock_bh(); |
771 |
+ } |
772 |
+ else if (index == NEIGH_LINK_TABLE) { |
773 |
+ err = dev_hard_header(skb, dev, ntohs(skb->protocol), |
774 |
+diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c |
775 |
+index 477937465a20..d95631d09248 100644 |
776 |
+--- a/net/ipv4/esp4.c |
777 |
++++ b/net/ipv4/esp4.c |
778 |
+@@ -23,6 +23,11 @@ struct esp_skb_cb { |
779 |
+ void *tmp; |
780 |
+ }; |
781 |
+ |
782 |
++struct esp_output_extra { |
783 |
++ __be32 seqhi; |
784 |
++ u32 esphoff; |
785 |
++}; |
786 |
++ |
787 |
+ #define ESP_SKB_CB(__skb) ((struct esp_skb_cb *)&((__skb)->cb[0])) |
788 |
+ |
789 |
+ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu); |
790 |
+@@ -35,11 +40,11 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu); |
791 |
+ * |
792 |
+ * TODO: Use spare space in skb for this where possible. |
793 |
+ */ |
794 |
+-static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags, int seqhilen) |
795 |
++static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags, int extralen) |
796 |
+ { |
797 |
+ unsigned int len; |
798 |
+ |
799 |
+- len = seqhilen; |
800 |
++ len = extralen; |
801 |
+ |
802 |
+ len += crypto_aead_ivsize(aead); |
803 |
+ |
804 |
+@@ -57,15 +62,16 @@ static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags, int seqhilen) |
805 |
+ return kmalloc(len, GFP_ATOMIC); |
806 |
+ } |
807 |
+ |
808 |
+-static inline __be32 *esp_tmp_seqhi(void *tmp) |
809 |
++static inline void *esp_tmp_extra(void *tmp) |
810 |
+ { |
811 |
+- return PTR_ALIGN((__be32 *)tmp, __alignof__(__be32)); |
812 |
++ return PTR_ALIGN(tmp, __alignof__(struct esp_output_extra)); |
813 |
+ } |
814 |
+-static inline u8 *esp_tmp_iv(struct crypto_aead *aead, void *tmp, int seqhilen) |
815 |
++ |
816 |
++static inline u8 *esp_tmp_iv(struct crypto_aead *aead, void *tmp, int extralen) |
817 |
+ { |
818 |
+ return crypto_aead_ivsize(aead) ? |
819 |
+- PTR_ALIGN((u8 *)tmp + seqhilen, |
820 |
+- crypto_aead_alignmask(aead) + 1) : tmp + seqhilen; |
821 |
++ PTR_ALIGN((u8 *)tmp + extralen, |
822 |
++ crypto_aead_alignmask(aead) + 1) : tmp + extralen; |
823 |
+ } |
824 |
+ |
825 |
+ static inline struct aead_request *esp_tmp_req(struct crypto_aead *aead, u8 *iv) |
826 |
+@@ -99,7 +105,7 @@ static void esp_restore_header(struct sk_buff *skb, unsigned int offset) |
827 |
+ { |
828 |
+ struct ip_esp_hdr *esph = (void *)(skb->data + offset); |
829 |
+ void *tmp = ESP_SKB_CB(skb)->tmp; |
830 |
+- __be32 *seqhi = esp_tmp_seqhi(tmp); |
831 |
++ __be32 *seqhi = esp_tmp_extra(tmp); |
832 |
+ |
833 |
+ esph->seq_no = esph->spi; |
834 |
+ esph->spi = *seqhi; |
835 |
+@@ -107,7 +113,11 @@ static void esp_restore_header(struct sk_buff *skb, unsigned int offset) |
836 |
+ |
837 |
+ static void esp_output_restore_header(struct sk_buff *skb) |
838 |
+ { |
839 |
+- esp_restore_header(skb, skb_transport_offset(skb) - sizeof(__be32)); |
840 |
++ void *tmp = ESP_SKB_CB(skb)->tmp; |
841 |
++ struct esp_output_extra *extra = esp_tmp_extra(tmp); |
842 |
++ |
843 |
++ esp_restore_header(skb, skb_transport_offset(skb) + extra->esphoff - |
844 |
++ sizeof(__be32)); |
845 |
+ } |
846 |
+ |
847 |
+ static void esp_output_done_esn(struct crypto_async_request *base, int err) |
848 |
+@@ -121,6 +131,7 @@ static void esp_output_done_esn(struct crypto_async_request *base, int err) |
849 |
+ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) |
850 |
+ { |
851 |
+ int err; |
852 |
++ struct esp_output_extra *extra; |
853 |
+ struct ip_esp_hdr *esph; |
854 |
+ struct crypto_aead *aead; |
855 |
+ struct aead_request *req; |
856 |
+@@ -137,8 +148,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) |
857 |
+ int tfclen; |
858 |
+ int nfrags; |
859 |
+ int assoclen; |
860 |
+- int seqhilen; |
861 |
+- __be32 *seqhi; |
862 |
++ int extralen; |
863 |
+ __be64 seqno; |
864 |
+ |
865 |
+ /* skb is pure payload to encrypt */ |
866 |
+@@ -166,21 +176,21 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) |
867 |
+ nfrags = err; |
868 |
+ |
869 |
+ assoclen = sizeof(*esph); |
870 |
+- seqhilen = 0; |
871 |
++ extralen = 0; |
872 |
+ |
873 |
+ if (x->props.flags & XFRM_STATE_ESN) { |
874 |
+- seqhilen += sizeof(__be32); |
875 |
+- assoclen += seqhilen; |
876 |
++ extralen += sizeof(*extra); |
877 |
++ assoclen += sizeof(__be32); |
878 |
+ } |
879 |
+ |
880 |
+- tmp = esp_alloc_tmp(aead, nfrags, seqhilen); |
881 |
++ tmp = esp_alloc_tmp(aead, nfrags, extralen); |
882 |
+ if (!tmp) { |
883 |
+ err = -ENOMEM; |
884 |
+ goto error; |
885 |
+ } |
886 |
+ |
887 |
+- seqhi = esp_tmp_seqhi(tmp); |
888 |
+- iv = esp_tmp_iv(aead, tmp, seqhilen); |
889 |
++ extra = esp_tmp_extra(tmp); |
890 |
++ iv = esp_tmp_iv(aead, tmp, extralen); |
891 |
+ req = esp_tmp_req(aead, iv); |
892 |
+ sg = esp_req_sg(aead, req); |
893 |
+ |
894 |
+@@ -247,8 +257,10 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) |
895 |
+ * encryption. |
896 |
+ */ |
897 |
+ if ((x->props.flags & XFRM_STATE_ESN)) { |
898 |
+- esph = (void *)(skb_transport_header(skb) - sizeof(__be32)); |
899 |
+- *seqhi = esph->spi; |
900 |
++ extra->esphoff = (unsigned char *)esph - |
901 |
++ skb_transport_header(skb); |
902 |
++ esph = (struct ip_esp_hdr *)((unsigned char *)esph - 4); |
903 |
++ extra->seqhi = esph->spi; |
904 |
+ esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output.hi); |
905 |
+ aead_request_set_callback(req, 0, esp_output_done_esn, skb); |
906 |
+ } |
907 |
+@@ -445,7 +457,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) |
908 |
+ goto out; |
909 |
+ |
910 |
+ ESP_SKB_CB(skb)->tmp = tmp; |
911 |
+- seqhi = esp_tmp_seqhi(tmp); |
912 |
++ seqhi = esp_tmp_extra(tmp); |
913 |
+ iv = esp_tmp_iv(aead, tmp, seqhilen); |
914 |
+ req = esp_tmp_req(aead, iv); |
915 |
+ sg = esp_req_sg(aead, req); |
916 |
+diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c |
917 |
+index 395e2814a46d..a42dd8021b6b 100644 |
918 |
+--- a/net/ipv4/ipmr.c |
919 |
++++ b/net/ipv4/ipmr.c |
920 |
+@@ -891,8 +891,10 @@ static struct mfc_cache *ipmr_cache_alloc(void) |
921 |
+ { |
922 |
+ struct mfc_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL); |
923 |
+ |
924 |
+- if (c) |
925 |
++ if (c) { |
926 |
++ c->mfc_un.res.last_assert = jiffies - MFC_ASSERT_THRESH - 1; |
927 |
+ c->mfc_un.res.minvif = MAXVIFS; |
928 |
++ } |
929 |
+ return c; |
930 |
+ } |
931 |
+ |
932 |
+diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c |
933 |
+index a10e77103c88..e207cb2468da 100644 |
934 |
+--- a/net/ipv6/ip6mr.c |
935 |
++++ b/net/ipv6/ip6mr.c |
936 |
+@@ -1074,6 +1074,7 @@ static struct mfc6_cache *ip6mr_cache_alloc(void) |
937 |
+ struct mfc6_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL); |
938 |
+ if (!c) |
939 |
+ return NULL; |
940 |
++ c->mfc_un.res.last_assert = jiffies - MFC_ASSERT_THRESH - 1; |
941 |
+ c->mfc_un.res.minvif = MAXMIFS; |
942 |
+ return c; |
943 |
+ } |
944 |
+diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c |
945 |
+index 83384308d032..6c53e4eb0f09 100644 |
946 |
+--- a/net/ipv6/sit.c |
947 |
++++ b/net/ipv6/sit.c |
948 |
+@@ -560,13 +560,13 @@ static int ipip6_err(struct sk_buff *skb, u32 info) |
949 |
+ |
950 |
+ if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { |
951 |
+ ipv4_update_pmtu(skb, dev_net(skb->dev), info, |
952 |
+- t->parms.link, 0, IPPROTO_IPV6, 0); |
953 |
++ t->parms.link, 0, iph->protocol, 0); |
954 |
+ err = 0; |
955 |
+ goto out; |
956 |
+ } |
957 |
+ if (type == ICMP_REDIRECT) { |
958 |
+ ipv4_redirect(skb, dev_net(skb->dev), t->parms.link, 0, |
959 |
+- IPPROTO_IPV6, 0); |
960 |
++ iph->protocol, 0); |
961 |
+ err = 0; |
962 |
+ goto out; |
963 |
+ } |
964 |
+diff --git a/net/kcm/kcmproc.c b/net/kcm/kcmproc.c |
965 |
+index 738008726cc6..fda7f4715c58 100644 |
966 |
+--- a/net/kcm/kcmproc.c |
967 |
++++ b/net/kcm/kcmproc.c |
968 |
+@@ -241,6 +241,7 @@ static const struct file_operations kcm_seq_fops = { |
969 |
+ .open = kcm_seq_open, |
970 |
+ .read = seq_read, |
971 |
+ .llseek = seq_lseek, |
972 |
++ .release = seq_release_net, |
973 |
+ }; |
974 |
+ |
975 |
+ static struct kcm_seq_muxinfo kcm_seq_muxinfo = { |
976 |
+diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c |
977 |
+index 8b5270008a6e..606323339e1f 100644 |
978 |
+--- a/net/sched/act_ipt.c |
979 |
++++ b/net/sched/act_ipt.c |
980 |
+@@ -121,10 +121,13 @@ static int __tcf_ipt_init(struct tc_action_net *tn, struct nlattr *nla, |
981 |
+ } |
982 |
+ |
983 |
+ td = (struct xt_entry_target *)nla_data(tb[TCA_IPT_TARG]); |
984 |
+- if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size) |
985 |
++ if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size) { |
986 |
++ if (exists) |
987 |
++ tcf_hash_release(a, bind); |
988 |
+ return -EINVAL; |
989 |
++ } |
990 |
+ |
991 |
+- if (!tcf_hash_check(tn, index, a, bind)) { |
992 |
++ if (!exists) { |
993 |
+ ret = tcf_hash_create(tn, index, est, a, sizeof(*ipt), bind, |
994 |
+ false); |
995 |
+ if (ret) |
996 |
+diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c |
997 |
+index 2177eac0a61e..2e4bd2c0a50c 100644 |
998 |
+--- a/net/sched/sch_fifo.c |
999 |
++++ b/net/sched/sch_fifo.c |
1000 |
+@@ -37,14 +37,18 @@ static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
1001 |
+ |
1002 |
+ static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
1003 |
+ { |
1004 |
++ unsigned int prev_backlog; |
1005 |
++ |
1006 |
+ if (likely(skb_queue_len(&sch->q) < sch->limit)) |
1007 |
+ return qdisc_enqueue_tail(skb, sch); |
1008 |
+ |
1009 |
++ prev_backlog = sch->qstats.backlog; |
1010 |
+ /* queue full, remove one skb to fulfill the limit */ |
1011 |
+ __qdisc_queue_drop_head(sch, &sch->q); |
1012 |
+ qdisc_qstats_drop(sch); |
1013 |
+ qdisc_enqueue_tail(skb, sch); |
1014 |
+ |
1015 |
++ qdisc_tree_reduce_backlog(sch, 0, prev_backlog - sch->qstats.backlog); |
1016 |
+ return NET_XMIT_CN; |
1017 |
+ } |
1018 |
+ |
1019 |
+diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c |
1020 |
+index 4befe97a9034..b7c29d5b6f04 100644 |
1021 |
+--- a/net/sched/sch_netem.c |
1022 |
++++ b/net/sched/sch_netem.c |
1023 |
+@@ -650,14 +650,14 @@ deliver: |
1024 |
+ #endif |
1025 |
+ |
1026 |
+ if (q->qdisc) { |
1027 |
++ unsigned int pkt_len = qdisc_pkt_len(skb); |
1028 |
+ int err = qdisc_enqueue(skb, q->qdisc); |
1029 |
+ |
1030 |
+- if (unlikely(err != NET_XMIT_SUCCESS)) { |
1031 |
+- if (net_xmit_drop_count(err)) { |
1032 |
+- qdisc_qstats_drop(sch); |
1033 |
+- qdisc_tree_reduce_backlog(sch, 1, |
1034 |
+- qdisc_pkt_len(skb)); |
1035 |
+- } |
1036 |
++ if (err != NET_XMIT_SUCCESS && |
1037 |
++ net_xmit_drop_count(err)) { |
1038 |
++ qdisc_qstats_drop(sch); |
1039 |
++ qdisc_tree_reduce_backlog(sch, 1, |
1040 |
++ pkt_len); |
1041 |
+ } |
1042 |
+ goto tfifo_dequeue; |
1043 |
+ } |