1 |
commit: 91c9d0b074d39361d5e1acf4a654db751f57cabc |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 22 15:15:27 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 21 15:01:00 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=91c9d0b0 |
7 |
|
8 |
Linux patch 4.4.143 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1142_linux-4.4.143.patch | 1060 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1064 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 3d85018..42e6d1f 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -611,6 +611,10 @@ Patch: 1141_linux-4.4.142.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.4.142 |
23 |
|
24 |
+Patch: 1142_linux-4.4.143.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.4.143 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1142_linux-4.4.143.patch b/1142_linux-4.4.143.patch |
33 |
new file mode 100644 |
34 |
index 0000000..022f040 |
35 |
--- /dev/null |
36 |
+++ b/1142_linux-4.4.143.patch |
37 |
@@ -0,0 +1,1060 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 75d6176c8786..54690fee0485 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,6 +1,6 @@ |
43 |
+ VERSION = 4 |
44 |
+ PATCHLEVEL = 4 |
45 |
+-SUBLEVEL = 142 |
46 |
++SUBLEVEL = 143 |
47 |
+ EXTRAVERSION = |
48 |
+ NAME = Blurry Fish Butt |
49 |
+ |
50 |
+diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c |
51 |
+index 1ee603d07847..354b99f56c1e 100644 |
52 |
+--- a/arch/mips/kernel/process.c |
53 |
++++ b/arch/mips/kernel/process.c |
54 |
+@@ -629,21 +629,48 @@ unsigned long arch_align_stack(unsigned long sp) |
55 |
+ return sp & ALMASK; |
56 |
+ } |
57 |
+ |
58 |
++static DEFINE_PER_CPU(struct call_single_data, backtrace_csd); |
59 |
++static struct cpumask backtrace_csd_busy; |
60 |
++ |
61 |
+ static void arch_dump_stack(void *info) |
62 |
+ { |
63 |
+ struct pt_regs *regs; |
64 |
++ static arch_spinlock_t lock = __ARCH_SPIN_LOCK_UNLOCKED; |
65 |
+ |
66 |
++ arch_spin_lock(&lock); |
67 |
+ regs = get_irq_regs(); |
68 |
+ |
69 |
+ if (regs) |
70 |
+ show_regs(regs); |
71 |
++ else |
72 |
++ dump_stack(); |
73 |
++ arch_spin_unlock(&lock); |
74 |
+ |
75 |
+- dump_stack(); |
76 |
++ cpumask_clear_cpu(smp_processor_id(), &backtrace_csd_busy); |
77 |
+ } |
78 |
+ |
79 |
+ void arch_trigger_all_cpu_backtrace(bool include_self) |
80 |
+ { |
81 |
+- smp_call_function(arch_dump_stack, NULL, 1); |
82 |
++ struct call_single_data *csd; |
83 |
++ int cpu; |
84 |
++ |
85 |
++ for_each_cpu(cpu, cpu_online_mask) { |
86 |
++ /* |
87 |
++ * If we previously sent an IPI to the target CPU & it hasn't |
88 |
++ * cleared its bit in the busy cpumask then it didn't handle |
89 |
++ * our previous IPI & it's not safe for us to reuse the |
90 |
++ * call_single_data_t. |
91 |
++ */ |
92 |
++ if (cpumask_test_and_set_cpu(cpu, &backtrace_csd_busy)) { |
93 |
++ pr_warn("Unable to send backtrace IPI to CPU%u - perhaps it hung?\n", |
94 |
++ cpu); |
95 |
++ continue; |
96 |
++ } |
97 |
++ |
98 |
++ csd = &per_cpu(backtrace_csd, cpu); |
99 |
++ csd->func = arch_dump_stack; |
100 |
++ smp_call_function_single_async(cpu, csd); |
101 |
++ } |
102 |
+ } |
103 |
+ |
104 |
+ int mips_get_process_fp_mode(struct task_struct *task) |
105 |
+diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c |
106 |
+index 31ca2edd7218..1b901218e3ae 100644 |
107 |
+--- a/arch/mips/kernel/traps.c |
108 |
++++ b/arch/mips/kernel/traps.c |
109 |
+@@ -344,6 +344,7 @@ static void __show_regs(const struct pt_regs *regs) |
110 |
+ void show_regs(struct pt_regs *regs) |
111 |
+ { |
112 |
+ __show_regs((struct pt_regs *)regs); |
113 |
++ dump_stack(); |
114 |
+ } |
115 |
+ |
116 |
+ void show_registers(struct pt_regs *regs) |
117 |
+diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h |
118 |
+index 1c79c8add0eb..21e84a31d211 100644 |
119 |
+--- a/arch/x86/include/asm/asm.h |
120 |
++++ b/arch/x86/include/asm/asm.h |
121 |
+@@ -44,6 +44,65 @@ |
122 |
+ #define _ASM_SI __ASM_REG(si) |
123 |
+ #define _ASM_DI __ASM_REG(di) |
124 |
+ |
125 |
++#ifndef __x86_64__ |
126 |
++/* 32 bit */ |
127 |
++ |
128 |
++#define _ASM_ARG1 _ASM_AX |
129 |
++#define _ASM_ARG2 _ASM_DX |
130 |
++#define _ASM_ARG3 _ASM_CX |
131 |
++ |
132 |
++#define _ASM_ARG1L eax |
133 |
++#define _ASM_ARG2L edx |
134 |
++#define _ASM_ARG3L ecx |
135 |
++ |
136 |
++#define _ASM_ARG1W ax |
137 |
++#define _ASM_ARG2W dx |
138 |
++#define _ASM_ARG3W cx |
139 |
++ |
140 |
++#define _ASM_ARG1B al |
141 |
++#define _ASM_ARG2B dl |
142 |
++#define _ASM_ARG3B cl |
143 |
++ |
144 |
++#else |
145 |
++/* 64 bit */ |
146 |
++ |
147 |
++#define _ASM_ARG1 _ASM_DI |
148 |
++#define _ASM_ARG2 _ASM_SI |
149 |
++#define _ASM_ARG3 _ASM_DX |
150 |
++#define _ASM_ARG4 _ASM_CX |
151 |
++#define _ASM_ARG5 r8 |
152 |
++#define _ASM_ARG6 r9 |
153 |
++ |
154 |
++#define _ASM_ARG1Q rdi |
155 |
++#define _ASM_ARG2Q rsi |
156 |
++#define _ASM_ARG3Q rdx |
157 |
++#define _ASM_ARG4Q rcx |
158 |
++#define _ASM_ARG5Q r8 |
159 |
++#define _ASM_ARG6Q r9 |
160 |
++ |
161 |
++#define _ASM_ARG1L edi |
162 |
++#define _ASM_ARG2L esi |
163 |
++#define _ASM_ARG3L edx |
164 |
++#define _ASM_ARG4L ecx |
165 |
++#define _ASM_ARG5L r8d |
166 |
++#define _ASM_ARG6L r9d |
167 |
++ |
168 |
++#define _ASM_ARG1W di |
169 |
++#define _ASM_ARG2W si |
170 |
++#define _ASM_ARG3W dx |
171 |
++#define _ASM_ARG4W cx |
172 |
++#define _ASM_ARG5W r8w |
173 |
++#define _ASM_ARG6W r9w |
174 |
++ |
175 |
++#define _ASM_ARG1B dil |
176 |
++#define _ASM_ARG2B sil |
177 |
++#define _ASM_ARG3B dl |
178 |
++#define _ASM_ARG4B cl |
179 |
++#define _ASM_ARG5B r8b |
180 |
++#define _ASM_ARG6B r9b |
181 |
++ |
182 |
++#endif |
183 |
++ |
184 |
+ /* Exception table entry */ |
185 |
+ #ifdef __ASSEMBLY__ |
186 |
+ # define _ASM_EXTABLE(from,to) \ |
187 |
+diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c |
188 |
+index c302f47f6323..94712e1c5cf9 100644 |
189 |
+--- a/drivers/atm/zatm.c |
190 |
++++ b/drivers/atm/zatm.c |
191 |
+@@ -1481,6 +1481,8 @@ static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) |
192 |
+ return -EFAULT; |
193 |
+ if (pool < 0 || pool > ZATM_LAST_POOL) |
194 |
+ return -EINVAL; |
195 |
++ pool = array_index_nospec(pool, |
196 |
++ ZATM_LAST_POOL + 1); |
197 |
+ if (copy_from_user(&info, |
198 |
+ &((struct zatm_pool_req __user *) arg)->info, |
199 |
+ sizeof(info))) return -EFAULT; |
200 |
+diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c |
201 |
+index 58a630e55d5d..78d0722feacb 100644 |
202 |
+--- a/drivers/crypto/amcc/crypto4xx_core.c |
203 |
++++ b/drivers/crypto/amcc/crypto4xx_core.c |
204 |
+@@ -207,7 +207,7 @@ static u32 crypto4xx_build_pdr(struct crypto4xx_device *dev) |
205 |
+ dev->pdr_pa); |
206 |
+ return -ENOMEM; |
207 |
+ } |
208 |
+- memset(dev->pdr, 0, sizeof(struct ce_pd) * PPC4XX_NUM_PD); |
209 |
++ memset(dev->pdr, 0, sizeof(struct ce_pd) * PPC4XX_NUM_PD); |
210 |
+ dev->shadow_sa_pool = dma_alloc_coherent(dev->core_dev->device, |
211 |
+ 256 * PPC4XX_NUM_PD, |
212 |
+ &dev->shadow_sa_pool_pa, |
213 |
+@@ -240,13 +240,15 @@ static u32 crypto4xx_build_pdr(struct crypto4xx_device *dev) |
214 |
+ |
215 |
+ static void crypto4xx_destroy_pdr(struct crypto4xx_device *dev) |
216 |
+ { |
217 |
+- if (dev->pdr != NULL) |
218 |
++ if (dev->pdr) |
219 |
+ dma_free_coherent(dev->core_dev->device, |
220 |
+ sizeof(struct ce_pd) * PPC4XX_NUM_PD, |
221 |
+ dev->pdr, dev->pdr_pa); |
222 |
++ |
223 |
+ if (dev->shadow_sa_pool) |
224 |
+ dma_free_coherent(dev->core_dev->device, 256 * PPC4XX_NUM_PD, |
225 |
+ dev->shadow_sa_pool, dev->shadow_sa_pool_pa); |
226 |
++ |
227 |
+ if (dev->shadow_sr_pool) |
228 |
+ dma_free_coherent(dev->core_dev->device, |
229 |
+ sizeof(struct sa_state_record) * PPC4XX_NUM_PD, |
230 |
+@@ -416,12 +418,12 @@ static u32 crypto4xx_build_sdr(struct crypto4xx_device *dev) |
231 |
+ |
232 |
+ static void crypto4xx_destroy_sdr(struct crypto4xx_device *dev) |
233 |
+ { |
234 |
+- if (dev->sdr != NULL) |
235 |
++ if (dev->sdr) |
236 |
+ dma_free_coherent(dev->core_dev->device, |
237 |
+ sizeof(struct ce_sd) * PPC4XX_NUM_SD, |
238 |
+ dev->sdr, dev->sdr_pa); |
239 |
+ |
240 |
+- if (dev->scatter_buffer_va != NULL) |
241 |
++ if (dev->scatter_buffer_va) |
242 |
+ dma_free_coherent(dev->core_dev->device, |
243 |
+ dev->scatter_buffer_size * PPC4XX_NUM_SD, |
244 |
+ dev->scatter_buffer_va, |
245 |
+@@ -1029,12 +1031,10 @@ int crypto4xx_register_alg(struct crypto4xx_device *sec_dev, |
246 |
+ break; |
247 |
+ } |
248 |
+ |
249 |
+- if (rc) { |
250 |
+- list_del(&alg->entry); |
251 |
++ if (rc) |
252 |
+ kfree(alg); |
253 |
+- } else { |
254 |
++ else |
255 |
+ list_add_tail(&alg->entry, &sec_dev->alg_list); |
256 |
+- } |
257 |
+ } |
258 |
+ |
259 |
+ return 0; |
260 |
+@@ -1188,7 +1188,7 @@ static int crypto4xx_probe(struct platform_device *ofdev) |
261 |
+ |
262 |
+ rc = crypto4xx_build_gdr(core_dev->dev); |
263 |
+ if (rc) |
264 |
+- goto err_build_gdr; |
265 |
++ goto err_build_pdr; |
266 |
+ |
267 |
+ rc = crypto4xx_build_sdr(core_dev->dev); |
268 |
+ if (rc) |
269 |
+@@ -1230,12 +1230,11 @@ err_iomap: |
270 |
+ err_request_irq: |
271 |
+ irq_dispose_mapping(core_dev->irq); |
272 |
+ tasklet_kill(&core_dev->tasklet); |
273 |
+- crypto4xx_destroy_sdr(core_dev->dev); |
274 |
+ err_build_sdr: |
275 |
++ crypto4xx_destroy_sdr(core_dev->dev); |
276 |
+ crypto4xx_destroy_gdr(core_dev->dev); |
277 |
+-err_build_gdr: |
278 |
+- crypto4xx_destroy_pdr(core_dev->dev); |
279 |
+ err_build_pdr: |
280 |
++ crypto4xx_destroy_pdr(core_dev->dev); |
281 |
+ kfree(core_dev->dev); |
282 |
+ err_alloc_dev: |
283 |
+ kfree(core_dev); |
284 |
+diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c |
285 |
+index 8b1929e9f698..ec5834087e4b 100644 |
286 |
+--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c |
287 |
++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c |
288 |
+@@ -1063,7 +1063,8 @@ static int bcm_enet_open(struct net_device *dev) |
289 |
+ val = enet_readl(priv, ENET_CTL_REG); |
290 |
+ val |= ENET_CTL_ENABLE_MASK; |
291 |
+ enet_writel(priv, val, ENET_CTL_REG); |
292 |
+- enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG); |
293 |
++ if (priv->dma_has_sram) |
294 |
++ enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG); |
295 |
+ enet_dmac_writel(priv, priv->dma_chan_en_mask, |
296 |
+ ENETDMAC_CHANCFG, priv->rx_chan); |
297 |
+ |
298 |
+@@ -1787,7 +1788,9 @@ static int bcm_enet_probe(struct platform_device *pdev) |
299 |
+ ret = PTR_ERR(priv->mac_clk); |
300 |
+ goto out; |
301 |
+ } |
302 |
+- clk_prepare_enable(priv->mac_clk); |
303 |
++ ret = clk_prepare_enable(priv->mac_clk); |
304 |
++ if (ret) |
305 |
++ goto out_put_clk_mac; |
306 |
+ |
307 |
+ /* initialize default and fetch platform data */ |
308 |
+ priv->rx_ring_size = BCMENET_DEF_RX_DESC; |
309 |
+@@ -1819,9 +1822,11 @@ static int bcm_enet_probe(struct platform_device *pdev) |
310 |
+ if (IS_ERR(priv->phy_clk)) { |
311 |
+ ret = PTR_ERR(priv->phy_clk); |
312 |
+ priv->phy_clk = NULL; |
313 |
+- goto out_put_clk_mac; |
314 |
++ goto out_disable_clk_mac; |
315 |
+ } |
316 |
+- clk_prepare_enable(priv->phy_clk); |
317 |
++ ret = clk_prepare_enable(priv->phy_clk); |
318 |
++ if (ret) |
319 |
++ goto out_put_clk_phy; |
320 |
+ } |
321 |
+ |
322 |
+ /* do minimal hardware init to be able to probe mii bus */ |
323 |
+@@ -1921,13 +1926,16 @@ out_free_mdio: |
324 |
+ out_uninit_hw: |
325 |
+ /* turn off mdc clock */ |
326 |
+ enet_writel(priv, 0, ENET_MIISC_REG); |
327 |
+- if (priv->phy_clk) { |
328 |
++ if (priv->phy_clk) |
329 |
+ clk_disable_unprepare(priv->phy_clk); |
330 |
++ |
331 |
++out_put_clk_phy: |
332 |
++ if (priv->phy_clk) |
333 |
+ clk_put(priv->phy_clk); |
334 |
+- } |
335 |
+ |
336 |
+-out_put_clk_mac: |
337 |
++out_disable_clk_mac: |
338 |
+ clk_disable_unprepare(priv->mac_clk); |
339 |
++out_put_clk_mac: |
340 |
+ clk_put(priv->mac_clk); |
341 |
+ out: |
342 |
+ free_netdev(dev); |
343 |
+@@ -2772,7 +2780,9 @@ static int bcm_enetsw_probe(struct platform_device *pdev) |
344 |
+ ret = PTR_ERR(priv->mac_clk); |
345 |
+ goto out_unmap; |
346 |
+ } |
347 |
+- clk_enable(priv->mac_clk); |
348 |
++ ret = clk_prepare_enable(priv->mac_clk); |
349 |
++ if (ret) |
350 |
++ goto out_put_clk; |
351 |
+ |
352 |
+ priv->rx_chan = 0; |
353 |
+ priv->tx_chan = 1; |
354 |
+@@ -2793,7 +2803,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev) |
355 |
+ |
356 |
+ ret = register_netdev(dev); |
357 |
+ if (ret) |
358 |
+- goto out_put_clk; |
359 |
++ goto out_disable_clk; |
360 |
+ |
361 |
+ netif_carrier_off(dev); |
362 |
+ platform_set_drvdata(pdev, dev); |
363 |
+@@ -2802,6 +2812,9 @@ static int bcm_enetsw_probe(struct platform_device *pdev) |
364 |
+ |
365 |
+ return 0; |
366 |
+ |
367 |
++out_disable_clk: |
368 |
++ clk_disable_unprepare(priv->mac_clk); |
369 |
++ |
370 |
+ out_put_clk: |
371 |
+ clk_put(priv->mac_clk); |
372 |
+ |
373 |
+@@ -2833,6 +2846,9 @@ static int bcm_enetsw_remove(struct platform_device *pdev) |
374 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
375 |
+ release_mem_region(res->start, resource_size(res)); |
376 |
+ |
377 |
++ clk_disable_unprepare(priv->mac_clk); |
378 |
++ clk_put(priv->mac_clk); |
379 |
++ |
380 |
+ free_netdev(dev); |
381 |
+ return 0; |
382 |
+ } |
383 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c |
384 |
+index 8f7aa53a4c4b..7ae8374bff13 100644 |
385 |
+--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c |
386 |
++++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c |
387 |
+@@ -50,6 +50,7 @@ |
388 |
+ #include <linux/stringify.h> |
389 |
+ #include <linux/sched.h> |
390 |
+ #include <linux/slab.h> |
391 |
++#include <linux/nospec.h> |
392 |
+ #include <asm/uaccess.h> |
393 |
+ |
394 |
+ #include "common.h" |
395 |
+@@ -2256,6 +2257,7 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) |
396 |
+ |
397 |
+ if (t.qset_idx >= nqsets) |
398 |
+ return -EINVAL; |
399 |
++ t.qset_idx = array_index_nospec(t.qset_idx, nqsets); |
400 |
+ |
401 |
+ q = &adapter->params.sge.qset[q1 + t.qset_idx]; |
402 |
+ t.rspq_size = q->rspq_size; |
403 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
404 |
+index 16bd585365a8..9ac14df0ca3b 100644 |
405 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
406 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
407 |
+@@ -643,6 +643,7 @@ static void cmd_work_handler(struct work_struct *work) |
408 |
+ struct semaphore *sem; |
409 |
+ unsigned long flags; |
410 |
+ int alloc_ret; |
411 |
++ int cmd_mode; |
412 |
+ |
413 |
+ sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem; |
414 |
+ down(sem); |
415 |
+@@ -688,6 +689,7 @@ static void cmd_work_handler(struct work_struct *work) |
416 |
+ set_signature(ent, !cmd->checksum_disabled); |
417 |
+ dump_command(dev, ent, 1); |
418 |
+ ent->ts1 = ktime_get_ns(); |
419 |
++ cmd_mode = cmd->mode; |
420 |
+ |
421 |
+ /* ring doorbell after the descriptor is valid */ |
422 |
+ mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx); |
423 |
+@@ -695,7 +697,7 @@ static void cmd_work_handler(struct work_struct *work) |
424 |
+ iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell); |
425 |
+ mmiowb(); |
426 |
+ /* if not in polling don't use ent after this point */ |
427 |
+- if (cmd->mode == CMD_MODE_POLLING) { |
428 |
++ if (cmd_mode == CMD_MODE_POLLING) { |
429 |
+ poll_timeout(ent); |
430 |
+ /* make sure we read the descriptor after ownership is SW */ |
431 |
+ rmb(); |
432 |
+@@ -1126,7 +1128,7 @@ static ssize_t outlen_write(struct file *filp, const char __user *buf, |
433 |
+ { |
434 |
+ struct mlx5_core_dev *dev = filp->private_data; |
435 |
+ struct mlx5_cmd_debug *dbg = &dev->cmd.dbg; |
436 |
+- char outlen_str[8]; |
437 |
++ char outlen_str[8] = {0}; |
438 |
+ int outlen; |
439 |
+ void *ptr; |
440 |
+ int err; |
441 |
+@@ -1141,8 +1143,6 @@ static ssize_t outlen_write(struct file *filp, const char __user *buf, |
442 |
+ if (copy_from_user(outlen_str, buf, count)) |
443 |
+ return -EFAULT; |
444 |
+ |
445 |
+- outlen_str[7] = 0; |
446 |
+- |
447 |
+ err = sscanf(outlen_str, "%d", &outlen); |
448 |
+ if (err < 0) |
449 |
+ return err; |
450 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c |
451 |
+index 174f7341c5c3..688b6da5a9bb 100644 |
452 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_main.c |
453 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c |
454 |
+@@ -22,6 +22,7 @@ |
455 |
+ #include <linux/etherdevice.h> |
456 |
+ #include <linux/vmalloc.h> |
457 |
+ #include <linux/qed/qed_if.h> |
458 |
++#include <linux/crash_dump.h> |
459 |
+ |
460 |
+ #include "qed.h" |
461 |
+ #include "qed_sp.h" |
462 |
+@@ -634,6 +635,14 @@ static int qed_slowpath_setup_int(struct qed_dev *cdev, |
463 |
+ /* We want a minimum of one slowpath and one fastpath vector per hwfn */ |
464 |
+ cdev->int_params.in.min_msix_cnt = cdev->num_hwfns * 2; |
465 |
+ |
466 |
++ if (is_kdump_kernel()) { |
467 |
++ DP_INFO(cdev, |
468 |
++ "Kdump kernel: Limit the max number of requested MSI-X vectors to %hd\n", |
469 |
++ cdev->int_params.in.min_msix_cnt); |
470 |
++ cdev->int_params.in.num_vectors = |
471 |
++ cdev->int_params.in.min_msix_cnt; |
472 |
++ } |
473 |
++ |
474 |
+ rc = qed_set_int_mode(cdev, false); |
475 |
+ if (rc) { |
476 |
+ DP_ERR(cdev, "qed_slowpath_setup_int ERR\n"); |
477 |
+diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c |
478 |
+index e23a642357e7..eb4d8df49399 100644 |
479 |
+--- a/drivers/net/ethernet/sun/sungem.c |
480 |
++++ b/drivers/net/ethernet/sun/sungem.c |
481 |
+@@ -60,8 +60,7 @@ |
482 |
+ #include <linux/sungem_phy.h> |
483 |
+ #include "sungem.h" |
484 |
+ |
485 |
+-/* Stripping FCS is causing problems, disabled for now */ |
486 |
+-#undef STRIP_FCS |
487 |
++#define STRIP_FCS |
488 |
+ |
489 |
+ #define DEFAULT_MSG (NETIF_MSG_DRV | \ |
490 |
+ NETIF_MSG_PROBE | \ |
491 |
+@@ -435,7 +434,7 @@ static int gem_rxmac_reset(struct gem *gp) |
492 |
+ writel(desc_dma & 0xffffffff, gp->regs + RXDMA_DBLOW); |
493 |
+ writel(RX_RING_SIZE - 4, gp->regs + RXDMA_KICK); |
494 |
+ val = (RXDMA_CFG_BASE | (RX_OFFSET << 10) | |
495 |
+- ((14 / 2) << 13) | RXDMA_CFG_FTHRESH_128); |
496 |
++ (ETH_HLEN << 13) | RXDMA_CFG_FTHRESH_128); |
497 |
+ writel(val, gp->regs + RXDMA_CFG); |
498 |
+ if (readl(gp->regs + GREG_BIFCFG) & GREG_BIFCFG_M66EN) |
499 |
+ writel(((5 & RXDMA_BLANK_IPKTS) | |
500 |
+@@ -760,7 +759,6 @@ static int gem_rx(struct gem *gp, int work_to_do) |
501 |
+ struct net_device *dev = gp->dev; |
502 |
+ int entry, drops, work_done = 0; |
503 |
+ u32 done; |
504 |
+- __sum16 csum; |
505 |
+ |
506 |
+ if (netif_msg_rx_status(gp)) |
507 |
+ printk(KERN_DEBUG "%s: rx interrupt, done: %d, rx_new: %d\n", |
508 |
+@@ -855,9 +853,13 @@ static int gem_rx(struct gem *gp, int work_to_do) |
509 |
+ skb = copy_skb; |
510 |
+ } |
511 |
+ |
512 |
+- csum = (__force __sum16)htons((status & RXDCTRL_TCPCSUM) ^ 0xffff); |
513 |
+- skb->csum = csum_unfold(csum); |
514 |
+- skb->ip_summed = CHECKSUM_COMPLETE; |
515 |
++ if (likely(dev->features & NETIF_F_RXCSUM)) { |
516 |
++ __sum16 csum; |
517 |
++ |
518 |
++ csum = (__force __sum16)htons((status & RXDCTRL_TCPCSUM) ^ 0xffff); |
519 |
++ skb->csum = csum_unfold(csum); |
520 |
++ skb->ip_summed = CHECKSUM_COMPLETE; |
521 |
++ } |
522 |
+ skb->protocol = eth_type_trans(skb, gp->dev); |
523 |
+ |
524 |
+ napi_gro_receive(&gp->napi, skb); |
525 |
+@@ -1755,7 +1757,7 @@ static void gem_init_dma(struct gem *gp) |
526 |
+ writel(0, gp->regs + TXDMA_KICK); |
527 |
+ |
528 |
+ val = (RXDMA_CFG_BASE | (RX_OFFSET << 10) | |
529 |
+- ((14 / 2) << 13) | RXDMA_CFG_FTHRESH_128); |
530 |
++ (ETH_HLEN << 13) | RXDMA_CFG_FTHRESH_128); |
531 |
+ writel(val, gp->regs + RXDMA_CFG); |
532 |
+ |
533 |
+ writel(desc_dma >> 32, gp->regs + RXDMA_DBHI); |
534 |
+@@ -2973,8 +2975,8 @@ static int gem_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
535 |
+ pci_set_drvdata(pdev, dev); |
536 |
+ |
537 |
+ /* We can do scatter/gather and HW checksum */ |
538 |
+- dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM; |
539 |
+- dev->features |= dev->hw_features | NETIF_F_RXCSUM; |
540 |
++ dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; |
541 |
++ dev->features = dev->hw_features; |
542 |
+ if (pci_using_dac) |
543 |
+ dev->features |= NETIF_F_HIGHDMA; |
544 |
+ |
545 |
+diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c |
546 |
+index 2991d7155540..2bb336cb13ee 100644 |
547 |
+--- a/drivers/net/usb/r8152.c |
548 |
++++ b/drivers/net/usb/r8152.c |
549 |
+@@ -3139,7 +3139,8 @@ static int rtl8152_close(struct net_device *netdev) |
550 |
+ #ifdef CONFIG_PM_SLEEP |
551 |
+ unregister_pm_notifier(&tp->pm_notifier); |
552 |
+ #endif |
553 |
+- napi_disable(&tp->napi); |
554 |
++ if (!test_bit(RTL8152_UNPLUG, &tp->flags)) |
555 |
++ napi_disable(&tp->napi); |
556 |
+ clear_bit(WORK_ENABLE, &tp->flags); |
557 |
+ usb_kill_urb(tp->intr_urb); |
558 |
+ cancel_delayed_work_sync(&tp->schedule); |
559 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c |
560 |
+index 8b537a5a4b01..8006f0972ad1 100644 |
561 |
+--- a/drivers/net/wireless/realtek/rtlwifi/core.c |
562 |
++++ b/drivers/net/wireless/realtek/rtlwifi/core.c |
563 |
+@@ -135,7 +135,6 @@ found_alt: |
564 |
+ firmware->size); |
565 |
+ rtlpriv->rtlhal.wowlan_fwsize = firmware->size; |
566 |
+ } |
567 |
+- rtlpriv->rtlhal.fwsize = firmware->size; |
568 |
+ release_firmware(firmware); |
569 |
+ } |
570 |
+ |
571 |
+diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c |
572 |
+index 44a5a8777053..645b2197930e 100644 |
573 |
+--- a/drivers/vhost/net.c |
574 |
++++ b/drivers/vhost/net.c |
575 |
+@@ -955,7 +955,8 @@ err_used: |
576 |
+ if (ubufs) |
577 |
+ vhost_net_ubuf_put_wait_and_free(ubufs); |
578 |
+ err_ubufs: |
579 |
+- sockfd_put(sock); |
580 |
++ if (sock) |
581 |
++ sockfd_put(sock); |
582 |
+ err_vq: |
583 |
+ mutex_unlock(&vq->mutex); |
584 |
+ err: |
585 |
+diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c |
586 |
+index 72afdca3cea7..3c45a9301a09 100644 |
587 |
+--- a/fs/ocfs2/cluster/nodemanager.c |
588 |
++++ b/fs/ocfs2/cluster/nodemanager.c |
589 |
+@@ -40,6 +40,9 @@ char *o2nm_fence_method_desc[O2NM_FENCE_METHODS] = { |
590 |
+ "panic", /* O2NM_FENCE_PANIC */ |
591 |
+ }; |
592 |
+ |
593 |
++static inline void o2nm_lock_subsystem(void); |
594 |
++static inline void o2nm_unlock_subsystem(void); |
595 |
++ |
596 |
+ struct o2nm_node *o2nm_get_node_by_num(u8 node_num) |
597 |
+ { |
598 |
+ struct o2nm_node *node = NULL; |
599 |
+@@ -181,7 +184,10 @@ static struct o2nm_cluster *to_o2nm_cluster_from_node(struct o2nm_node *node) |
600 |
+ { |
601 |
+ /* through the first node_set .parent |
602 |
+ * mycluster/nodes/mynode == o2nm_cluster->o2nm_node_group->o2nm_node */ |
603 |
+- return to_o2nm_cluster(node->nd_item.ci_parent->ci_parent); |
604 |
++ if (node->nd_item.ci_parent) |
605 |
++ return to_o2nm_cluster(node->nd_item.ci_parent->ci_parent); |
606 |
++ else |
607 |
++ return NULL; |
608 |
+ } |
609 |
+ |
610 |
+ enum { |
611 |
+@@ -194,7 +200,7 @@ static ssize_t o2nm_node_num_store(struct config_item *item, const char *page, |
612 |
+ size_t count) |
613 |
+ { |
614 |
+ struct o2nm_node *node = to_o2nm_node(item); |
615 |
+- struct o2nm_cluster *cluster = to_o2nm_cluster_from_node(node); |
616 |
++ struct o2nm_cluster *cluster; |
617 |
+ unsigned long tmp; |
618 |
+ char *p = (char *)page; |
619 |
+ int ret = 0; |
620 |
+@@ -214,6 +220,13 @@ static ssize_t o2nm_node_num_store(struct config_item *item, const char *page, |
621 |
+ !test_bit(O2NM_NODE_ATTR_PORT, &node->nd_set_attributes)) |
622 |
+ return -EINVAL; /* XXX */ |
623 |
+ |
624 |
++ o2nm_lock_subsystem(); |
625 |
++ cluster = to_o2nm_cluster_from_node(node); |
626 |
++ if (!cluster) { |
627 |
++ o2nm_unlock_subsystem(); |
628 |
++ return -EINVAL; |
629 |
++ } |
630 |
++ |
631 |
+ write_lock(&cluster->cl_nodes_lock); |
632 |
+ if (cluster->cl_nodes[tmp]) |
633 |
+ ret = -EEXIST; |
634 |
+@@ -226,6 +239,8 @@ static ssize_t o2nm_node_num_store(struct config_item *item, const char *page, |
635 |
+ set_bit(tmp, cluster->cl_nodes_bitmap); |
636 |
+ } |
637 |
+ write_unlock(&cluster->cl_nodes_lock); |
638 |
++ o2nm_unlock_subsystem(); |
639 |
++ |
640 |
+ if (ret) |
641 |
+ return ret; |
642 |
+ |
643 |
+@@ -269,7 +284,7 @@ static ssize_t o2nm_node_ipv4_address_store(struct config_item *item, |
644 |
+ size_t count) |
645 |
+ { |
646 |
+ struct o2nm_node *node = to_o2nm_node(item); |
647 |
+- struct o2nm_cluster *cluster = to_o2nm_cluster_from_node(node); |
648 |
++ struct o2nm_cluster *cluster; |
649 |
+ int ret, i; |
650 |
+ struct rb_node **p, *parent; |
651 |
+ unsigned int octets[4]; |
652 |
+@@ -286,6 +301,13 @@ static ssize_t o2nm_node_ipv4_address_store(struct config_item *item, |
653 |
+ be32_add_cpu(&ipv4_addr, octets[i] << (i * 8)); |
654 |
+ } |
655 |
+ |
656 |
++ o2nm_lock_subsystem(); |
657 |
++ cluster = to_o2nm_cluster_from_node(node); |
658 |
++ if (!cluster) { |
659 |
++ o2nm_unlock_subsystem(); |
660 |
++ return -EINVAL; |
661 |
++ } |
662 |
++ |
663 |
+ ret = 0; |
664 |
+ write_lock(&cluster->cl_nodes_lock); |
665 |
+ if (o2nm_node_ip_tree_lookup(cluster, ipv4_addr, &p, &parent)) |
666 |
+@@ -298,6 +320,8 @@ static ssize_t o2nm_node_ipv4_address_store(struct config_item *item, |
667 |
+ rb_insert_color(&node->nd_ip_node, &cluster->cl_node_ip_tree); |
668 |
+ } |
669 |
+ write_unlock(&cluster->cl_nodes_lock); |
670 |
++ o2nm_unlock_subsystem(); |
671 |
++ |
672 |
+ if (ret) |
673 |
+ return ret; |
674 |
+ |
675 |
+@@ -315,7 +339,7 @@ static ssize_t o2nm_node_local_store(struct config_item *item, const char *page, |
676 |
+ size_t count) |
677 |
+ { |
678 |
+ struct o2nm_node *node = to_o2nm_node(item); |
679 |
+- struct o2nm_cluster *cluster = to_o2nm_cluster_from_node(node); |
680 |
++ struct o2nm_cluster *cluster; |
681 |
+ unsigned long tmp; |
682 |
+ char *p = (char *)page; |
683 |
+ ssize_t ret; |
684 |
+@@ -333,17 +357,26 @@ static ssize_t o2nm_node_local_store(struct config_item *item, const char *page, |
685 |
+ !test_bit(O2NM_NODE_ATTR_PORT, &node->nd_set_attributes)) |
686 |
+ return -EINVAL; /* XXX */ |
687 |
+ |
688 |
++ o2nm_lock_subsystem(); |
689 |
++ cluster = to_o2nm_cluster_from_node(node); |
690 |
++ if (!cluster) { |
691 |
++ ret = -EINVAL; |
692 |
++ goto out; |
693 |
++ } |
694 |
++ |
695 |
+ /* the only failure case is trying to set a new local node |
696 |
+ * when a different one is already set */ |
697 |
+ if (tmp && tmp == cluster->cl_has_local && |
698 |
+- cluster->cl_local_node != node->nd_num) |
699 |
+- return -EBUSY; |
700 |
++ cluster->cl_local_node != node->nd_num) { |
701 |
++ ret = -EBUSY; |
702 |
++ goto out; |
703 |
++ } |
704 |
+ |
705 |
+ /* bring up the rx thread if we're setting the new local node. */ |
706 |
+ if (tmp && !cluster->cl_has_local) { |
707 |
+ ret = o2net_start_listening(node); |
708 |
+ if (ret) |
709 |
+- return ret; |
710 |
++ goto out; |
711 |
+ } |
712 |
+ |
713 |
+ if (!tmp && cluster->cl_has_local && |
714 |
+@@ -358,7 +391,11 @@ static ssize_t o2nm_node_local_store(struct config_item *item, const char *page, |
715 |
+ cluster->cl_local_node = node->nd_num; |
716 |
+ } |
717 |
+ |
718 |
+- return count; |
719 |
++ ret = count; |
720 |
++ |
721 |
++out: |
722 |
++ o2nm_unlock_subsystem(); |
723 |
++ return ret; |
724 |
+ } |
725 |
+ |
726 |
+ CONFIGFS_ATTR(o2nm_node_, num); |
727 |
+@@ -750,6 +787,16 @@ static struct o2nm_cluster_group o2nm_cluster_group = { |
728 |
+ }, |
729 |
+ }; |
730 |
+ |
731 |
++static inline void o2nm_lock_subsystem(void) |
732 |
++{ |
733 |
++ mutex_lock(&o2nm_cluster_group.cs_subsys.su_mutex); |
734 |
++} |
735 |
++ |
736 |
++static inline void o2nm_unlock_subsystem(void) |
737 |
++{ |
738 |
++ mutex_unlock(&o2nm_cluster_group.cs_subsys.su_mutex); |
739 |
++} |
740 |
++ |
741 |
+ int o2nm_depend_item(struct config_item *item) |
742 |
+ { |
743 |
+ return configfs_depend_item(&o2nm_cluster_group.cs_subsys, item); |
744 |
+diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h |
745 |
+index 287e698c28de..143d40e8a1ea 100644 |
746 |
+--- a/include/linux/compiler-gcc.h |
747 |
++++ b/include/linux/compiler-gcc.h |
748 |
+@@ -64,22 +64,41 @@ |
749 |
+ #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) |
750 |
+ #endif |
751 |
+ |
752 |
++/* |
753 |
++ * Feature detection for gnu_inline (gnu89 extern inline semantics). Either |
754 |
++ * __GNUC_STDC_INLINE__ is defined (not using gnu89 extern inline semantics, |
755 |
++ * and we opt in to the gnu89 semantics), or __GNUC_STDC_INLINE__ is not |
756 |
++ * defined so the gnu89 semantics are the default. |
757 |
++ */ |
758 |
++#ifdef __GNUC_STDC_INLINE__ |
759 |
++# define __gnu_inline __attribute__((gnu_inline)) |
760 |
++#else |
761 |
++# define __gnu_inline |
762 |
++#endif |
763 |
++ |
764 |
+ /* |
765 |
+ * Force always-inline if the user requests it so via the .config, |
766 |
+- * or if gcc is too old: |
767 |
++ * or if gcc is too old. |
768 |
++ * GCC does not warn about unused static inline functions for |
769 |
++ * -Wunused-function. This turns out to avoid the need for complex #ifdef |
770 |
++ * directives. Suppress the warning in clang as well by using "unused" |
771 |
++ * function attribute, which is redundant but not harmful for gcc. |
772 |
++ * Prefer gnu_inline, so that extern inline functions do not emit an |
773 |
++ * externally visible function. This makes extern inline behave as per gnu89 |
774 |
++ * semantics rather than c99. This prevents multiple symbol definition errors |
775 |
++ * of extern inline functions at link time. |
776 |
++ * A lot of inline functions can cause havoc with function tracing. |
777 |
+ */ |
778 |
+ #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ |
779 |
+ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) |
780 |
+-#define inline inline __attribute__((always_inline)) notrace |
781 |
+-#define __inline__ __inline__ __attribute__((always_inline)) notrace |
782 |
+-#define __inline __inline __attribute__((always_inline)) notrace |
783 |
++#define inline \ |
784 |
++ inline __attribute__((always_inline, unused)) notrace __gnu_inline |
785 |
+ #else |
786 |
+-/* A lot of inline functions can cause havoc with function tracing */ |
787 |
+-#define inline inline notrace |
788 |
+-#define __inline__ __inline__ notrace |
789 |
+-#define __inline __inline notrace |
790 |
++#define inline inline __attribute__((unused)) notrace __gnu_inline |
791 |
+ #endif |
792 |
+ |
793 |
++#define __inline__ inline |
794 |
++#define __inline inline |
795 |
+ #define __always_inline inline __attribute__((always_inline)) |
796 |
+ #define noinline __attribute__((noinline)) |
797 |
+ |
798 |
+diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c |
799 |
+index 665fd87cc105..8b8a43fda6ca 100644 |
800 |
+--- a/net/bridge/netfilter/ebtables.c |
801 |
++++ b/net/bridge/netfilter/ebtables.c |
802 |
+@@ -404,6 +404,12 @@ ebt_check_watcher(struct ebt_entry_watcher *w, struct xt_tgchk_param *par, |
803 |
+ watcher = xt_request_find_target(NFPROTO_BRIDGE, w->u.name, 0); |
804 |
+ if (IS_ERR(watcher)) |
805 |
+ return PTR_ERR(watcher); |
806 |
++ |
807 |
++ if (watcher->family != NFPROTO_BRIDGE) { |
808 |
++ module_put(watcher->me); |
809 |
++ return -ENOENT; |
810 |
++ } |
811 |
++ |
812 |
+ w->u.watcher = watcher; |
813 |
+ |
814 |
+ par->target = watcher; |
815 |
+@@ -724,6 +730,13 @@ ebt_check_entry(struct ebt_entry *e, struct net *net, |
816 |
+ goto cleanup_watchers; |
817 |
+ } |
818 |
+ |
819 |
++ /* Reject UNSPEC, xtables verdicts/return values are incompatible */ |
820 |
++ if (target->family != NFPROTO_BRIDGE) { |
821 |
++ module_put(target->me); |
822 |
++ ret = -ENOENT; |
823 |
++ goto cleanup_watchers; |
824 |
++ } |
825 |
++ |
826 |
+ t->u.target = target; |
827 |
+ if (t->u.target == &ebt_standard_target) { |
828 |
+ if (gap < sizeof(struct ebt_standard_target)) { |
829 |
+diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c |
830 |
+index 119c04317d48..03fcf3ee1534 100644 |
831 |
+--- a/net/dccp/ccids/ccid3.c |
832 |
++++ b/net/dccp/ccids/ccid3.c |
833 |
+@@ -599,7 +599,7 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk, |
834 |
+ { |
835 |
+ struct ccid3_hc_rx_sock *hc = ccid3_hc_rx_sk(sk); |
836 |
+ struct dccp_sock *dp = dccp_sk(sk); |
837 |
+- ktime_t now = ktime_get_real(); |
838 |
++ ktime_t now = ktime_get(); |
839 |
+ s64 delta = 0; |
840 |
+ |
841 |
+ switch (fbtype) { |
842 |
+@@ -624,15 +624,14 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk, |
843 |
+ case CCID3_FBACK_PERIODIC: |
844 |
+ delta = ktime_us_delta(now, hc->rx_tstamp_last_feedback); |
845 |
+ if (delta <= 0) |
846 |
+- DCCP_BUG("delta (%ld) <= 0", (long)delta); |
847 |
+- else |
848 |
+- hc->rx_x_recv = scaled_div32(hc->rx_bytes_recv, delta); |
849 |
++ delta = 1; |
850 |
++ hc->rx_x_recv = scaled_div32(hc->rx_bytes_recv, delta); |
851 |
+ break; |
852 |
+ default: |
853 |
+ return; |
854 |
+ } |
855 |
+ |
856 |
+- ccid3_pr_debug("Interval %ldusec, X_recv=%u, 1/p=%u\n", (long)delta, |
857 |
++ ccid3_pr_debug("Interval %lldusec, X_recv=%u, 1/p=%u\n", delta, |
858 |
+ hc->rx_x_recv, hc->rx_pinv); |
859 |
+ |
860 |
+ hc->rx_tstamp_last_feedback = now; |
861 |
+@@ -679,7 +678,8 @@ static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb) |
862 |
+ static u32 ccid3_first_li(struct sock *sk) |
863 |
+ { |
864 |
+ struct ccid3_hc_rx_sock *hc = ccid3_hc_rx_sk(sk); |
865 |
+- u32 x_recv, p, delta; |
866 |
++ u32 x_recv, p; |
867 |
++ s64 delta; |
868 |
+ u64 fval; |
869 |
+ |
870 |
+ if (hc->rx_rtt == 0) { |
871 |
+@@ -687,7 +687,9 @@ static u32 ccid3_first_li(struct sock *sk) |
872 |
+ hc->rx_rtt = DCCP_FALLBACK_RTT; |
873 |
+ } |
874 |
+ |
875 |
+- delta = ktime_to_us(net_timedelta(hc->rx_tstamp_last_feedback)); |
876 |
++ delta = ktime_us_delta(ktime_get(), hc->rx_tstamp_last_feedback); |
877 |
++ if (delta <= 0) |
878 |
++ delta = 1; |
879 |
+ x_recv = scaled_div32(hc->rx_bytes_recv, delta); |
880 |
+ if (x_recv == 0) { /* would also trigger divide-by-zero */ |
881 |
+ DCCP_WARN("X_recv==0\n"); |
882 |
+diff --git a/net/dns_resolver/dns_key.c b/net/dns_resolver/dns_key.c |
883 |
+index e26df2764e83..1689c7bdf1c9 100644 |
884 |
+--- a/net/dns_resolver/dns_key.c |
885 |
++++ b/net/dns_resolver/dns_key.c |
886 |
+@@ -87,35 +87,39 @@ dns_resolver_preparse(struct key_preparsed_payload *prep) |
887 |
+ opt++; |
888 |
+ kdebug("options: '%s'", opt); |
889 |
+ do { |
890 |
++ int opt_len, opt_nlen; |
891 |
+ const char *eq; |
892 |
+- int opt_len, opt_nlen, opt_vlen, tmp; |
893 |
++ char optval[128]; |
894 |
+ |
895 |
+ next_opt = memchr(opt, '#', end - opt) ?: end; |
896 |
+ opt_len = next_opt - opt; |
897 |
+- if (opt_len <= 0 || opt_len > 128) { |
898 |
++ if (opt_len <= 0 || opt_len > sizeof(optval)) { |
899 |
+ pr_warn_ratelimited("Invalid option length (%d) for dns_resolver key\n", |
900 |
+ opt_len); |
901 |
+ return -EINVAL; |
902 |
+ } |
903 |
+ |
904 |
+- eq = memchr(opt, '=', opt_len) ?: end; |
905 |
+- opt_nlen = eq - opt; |
906 |
+- eq++; |
907 |
+- opt_vlen = next_opt - eq; /* will be -1 if no value */ |
908 |
++ eq = memchr(opt, '=', opt_len); |
909 |
++ if (eq) { |
910 |
++ opt_nlen = eq - opt; |
911 |
++ eq++; |
912 |
++ memcpy(optval, eq, next_opt - eq); |
913 |
++ optval[next_opt - eq] = '\0'; |
914 |
++ } else { |
915 |
++ opt_nlen = opt_len; |
916 |
++ optval[0] = '\0'; |
917 |
++ } |
918 |
+ |
919 |
+- tmp = opt_vlen >= 0 ? opt_vlen : 0; |
920 |
+- kdebug("option '%*.*s' val '%*.*s'", |
921 |
+- opt_nlen, opt_nlen, opt, tmp, tmp, eq); |
922 |
++ kdebug("option '%*.*s' val '%s'", |
923 |
++ opt_nlen, opt_nlen, opt, optval); |
924 |
+ |
925 |
+ /* see if it's an error number representing a DNS error |
926 |
+ * that's to be recorded as the result in this key */ |
927 |
+ if (opt_nlen == sizeof(DNS_ERRORNO_OPTION) - 1 && |
928 |
+ memcmp(opt, DNS_ERRORNO_OPTION, opt_nlen) == 0) { |
929 |
+ kdebug("dns error number option"); |
930 |
+- if (opt_vlen <= 0) |
931 |
+- goto bad_option_value; |
932 |
+ |
933 |
+- ret = kstrtoul(eq, 10, &derrno); |
934 |
++ ret = kstrtoul(optval, 10, &derrno); |
935 |
+ if (ret < 0) |
936 |
+ goto bad_option_value; |
937 |
+ |
938 |
+diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c |
939 |
+index 70fb352e317f..75abf978ef30 100644 |
940 |
+--- a/net/ipv4/sysctl_net_ipv4.c |
941 |
++++ b/net/ipv4/sysctl_net_ipv4.c |
942 |
+@@ -213,8 +213,9 @@ static int proc_tcp_fastopen_key(struct ctl_table *ctl, int write, |
943 |
+ { |
944 |
+ struct ctl_table tbl = { .maxlen = (TCP_FASTOPEN_KEY_LENGTH * 2 + 10) }; |
945 |
+ struct tcp_fastopen_context *ctxt; |
946 |
+- int ret; |
947 |
+ u32 user_key[4]; /* 16 bytes, matching TCP_FASTOPEN_KEY_LENGTH */ |
948 |
++ __le32 key[4]; |
949 |
++ int ret, i; |
950 |
+ |
951 |
+ tbl.data = kmalloc(tbl.maxlen, GFP_KERNEL); |
952 |
+ if (!tbl.data) |
953 |
+@@ -223,11 +224,14 @@ static int proc_tcp_fastopen_key(struct ctl_table *ctl, int write, |
954 |
+ rcu_read_lock(); |
955 |
+ ctxt = rcu_dereference(tcp_fastopen_ctx); |
956 |
+ if (ctxt) |
957 |
+- memcpy(user_key, ctxt->key, TCP_FASTOPEN_KEY_LENGTH); |
958 |
++ memcpy(key, ctxt->key, TCP_FASTOPEN_KEY_LENGTH); |
959 |
+ else |
960 |
+- memset(user_key, 0, sizeof(user_key)); |
961 |
++ memset(key, 0, sizeof(key)); |
962 |
+ rcu_read_unlock(); |
963 |
+ |
964 |
++ for (i = 0; i < ARRAY_SIZE(key); i++) |
965 |
++ user_key[i] = le32_to_cpu(key[i]); |
966 |
++ |
967 |
+ snprintf(tbl.data, tbl.maxlen, "%08x-%08x-%08x-%08x", |
968 |
+ user_key[0], user_key[1], user_key[2], user_key[3]); |
969 |
+ ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
970 |
+@@ -243,12 +247,16 @@ static int proc_tcp_fastopen_key(struct ctl_table *ctl, int write, |
971 |
+ * first invocation of tcp_fastopen_cookie_gen |
972 |
+ */ |
973 |
+ tcp_fastopen_init_key_once(false); |
974 |
+- tcp_fastopen_reset_cipher(user_key, TCP_FASTOPEN_KEY_LENGTH); |
975 |
++ |
976 |
++ for (i = 0; i < ARRAY_SIZE(user_key); i++) |
977 |
++ key[i] = cpu_to_le32(user_key[i]); |
978 |
++ |
979 |
++ tcp_fastopen_reset_cipher(key, TCP_FASTOPEN_KEY_LENGTH); |
980 |
+ } |
981 |
+ |
982 |
+ bad_key: |
983 |
+ pr_debug("proc FO key set 0x%x-%x-%x-%x <- 0x%s: %u\n", |
984 |
+- user_key[0], user_key[1], user_key[2], user_key[3], |
985 |
++ user_key[0], user_key[1], user_key[2], user_key[3], |
986 |
+ (char *)tbl.data, ret); |
987 |
+ kfree(tbl.data); |
988 |
+ return ret; |
989 |
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
990 |
+index a9041915afc0..4350ee058441 100644 |
991 |
+--- a/net/ipv4/tcp_input.c |
992 |
++++ b/net/ipv4/tcp_input.c |
993 |
+@@ -3218,6 +3218,15 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, |
994 |
+ |
995 |
+ if (tcp_is_reno(tp)) { |
996 |
+ tcp_remove_reno_sacks(sk, pkts_acked); |
997 |
++ |
998 |
++ /* If any of the cumulatively ACKed segments was |
999 |
++ * retransmitted, non-SACK case cannot confirm that |
1000 |
++ * progress was due to original transmission due to |
1001 |
++ * lack of TCPCB_SACKED_ACKED bits even if some of |
1002 |
++ * the packets may have been never retransmitted. |
1003 |
++ */ |
1004 |
++ if (flag & FLAG_RETRANS_DATA_ACKED) |
1005 |
++ flag &= ~FLAG_ORIG_SACK_ACKED; |
1006 |
+ } else { |
1007 |
+ int delta; |
1008 |
+ |
1009 |
+diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c |
1010 |
+index dec4e7bda5f3..11282ffca567 100644 |
1011 |
+--- a/net/ipv6/sit.c |
1012 |
++++ b/net/ipv6/sit.c |
1013 |
+@@ -692,7 +692,6 @@ static int ipip6_rcv(struct sk_buff *skb) |
1014 |
+ |
1015 |
+ if (iptunnel_pull_header(skb, 0, htons(ETH_P_IPV6))) |
1016 |
+ goto out; |
1017 |
+- iph = ip_hdr(skb); |
1018 |
+ |
1019 |
+ err = IP_ECN_decapsulate(iph, skb); |
1020 |
+ if (unlikely(err)) { |
1021 |
+diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c |
1022 |
+index d25212b135ea..04f060488686 100644 |
1023 |
+--- a/net/nfc/llcp_commands.c |
1024 |
++++ b/net/nfc/llcp_commands.c |
1025 |
+@@ -754,11 +754,14 @@ int nfc_llcp_send_ui_frame(struct nfc_llcp_sock *sock, u8 ssap, u8 dsap, |
1026 |
+ pr_debug("Fragment %zd bytes remaining %zd", |
1027 |
+ frag_len, remaining_len); |
1028 |
+ |
1029 |
+- pdu = nfc_alloc_send_skb(sock->dev, &sock->sk, MSG_DONTWAIT, |
1030 |
++ pdu = nfc_alloc_send_skb(sock->dev, &sock->sk, 0, |
1031 |
+ frag_len + LLCP_HEADER_SIZE, &err); |
1032 |
+ if (pdu == NULL) { |
1033 |
+- pr_err("Could not allocate PDU\n"); |
1034 |
+- continue; |
1035 |
++ pr_err("Could not allocate PDU (error=%d)\n", err); |
1036 |
++ len -= remaining_len; |
1037 |
++ if (len == 0) |
1038 |
++ len = err; |
1039 |
++ break; |
1040 |
+ } |
1041 |
+ |
1042 |
+ pdu = llcp_add_header(pdu, dsap, ssap, LLCP_PDU_UI); |
1043 |
+diff --git a/net/rds/loop.c b/net/rds/loop.c |
1044 |
+index 6b12b68541ae..05cab8c5a379 100644 |
1045 |
+--- a/net/rds/loop.c |
1046 |
++++ b/net/rds/loop.c |
1047 |
+@@ -191,4 +191,5 @@ struct rds_transport rds_loop_transport = { |
1048 |
+ .inc_copy_to_user = rds_message_inc_copy_to_user, |
1049 |
+ .inc_free = rds_loop_inc_free, |
1050 |
+ .t_name = "loopback", |
1051 |
++ .t_type = RDS_TRANS_LOOP, |
1052 |
+ }; |
1053 |
+diff --git a/net/rds/rds.h b/net/rds/rds.h |
1054 |
+index 4588860f4c3b..254f1345cf7e 100644 |
1055 |
+--- a/net/rds/rds.h |
1056 |
++++ b/net/rds/rds.h |
1057 |
+@@ -401,6 +401,11 @@ struct rds_notifier { |
1058 |
+ int n_status; |
1059 |
+ }; |
1060 |
+ |
1061 |
++/* Available as part of RDS core, so doesn't need to participate |
1062 |
++ * in get_preferred transport etc |
1063 |
++ */ |
1064 |
++#define RDS_TRANS_LOOP 3 |
1065 |
++ |
1066 |
+ /** |
1067 |
+ * struct rds_transport - transport specific behavioural hooks |
1068 |
+ * |
1069 |
+diff --git a/net/rds/recv.c b/net/rds/recv.c |
1070 |
+index 0514af3ab378..6275de19689c 100644 |
1071 |
+--- a/net/rds/recv.c |
1072 |
++++ b/net/rds/recv.c |
1073 |
+@@ -76,6 +76,11 @@ static void rds_recv_rcvbuf_delta(struct rds_sock *rs, struct sock *sk, |
1074 |
+ return; |
1075 |
+ |
1076 |
+ rs->rs_rcv_bytes += delta; |
1077 |
++ |
1078 |
++ /* loop transport doesn't send/recv congestion updates */ |
1079 |
++ if (rs->rs_transport->t_type == RDS_TRANS_LOOP) |
1080 |
++ return; |
1081 |
++ |
1082 |
+ now_congested = rs->rs_rcv_bytes > rds_sk_rcvbuf(rs); |
1083 |
+ |
1084 |
+ rdsdebug("rs %p (%pI4:%u) recv bytes %d buf %d " |
1085 |
+diff --git a/net/sched/sch_blackhole.c b/net/sched/sch_blackhole.c |
1086 |
+index 3fee70d9814f..562edd50fa94 100644 |
1087 |
+--- a/net/sched/sch_blackhole.c |
1088 |
++++ b/net/sched/sch_blackhole.c |
1089 |
+@@ -20,7 +20,7 @@ |
1090 |
+ static int blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
1091 |
+ { |
1092 |
+ qdisc_drop(skb, sch); |
1093 |
+- return NET_XMIT_SUCCESS; |
1094 |
++ return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; |
1095 |
+ } |
1096 |
+ |
1097 |
+ static struct sk_buff *blackhole_dequeue(struct Qdisc *sch) |