1 |
commit: 29e88f502141f67ffa62d56460bd8a873e160f31 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Oct 20 12:36:21 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 14 11:36:27 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=29e88f50 |
7 |
|
8 |
Linux patch 4.18.16 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1015_linux-4.18.16.patch | 2439 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2443 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 5676b13..52e9ca9 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -103,6 +103,10 @@ Patch: 1014_linux-4.18.15.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.18.15 |
23 |
|
24 |
+Patch: 1015_linux-4.18.16.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.18.16 |
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/1015_linux-4.18.16.patch b/1015_linux-4.18.16.patch |
33 |
new file mode 100644 |
34 |
index 0000000..9bc7017 |
35 |
--- /dev/null |
36 |
+++ b/1015_linux-4.18.16.patch |
37 |
@@ -0,0 +1,2439 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 968eb96a0553..034dd990b0ae 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 18 |
46 |
+-SUBLEVEL = 15 |
47 |
++SUBLEVEL = 16 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Merciless Moray |
50 |
+ |
51 |
+diff --git a/arch/arc/Makefile b/arch/arc/Makefile |
52 |
+index 6c1b20dd76ad..7c6c97782022 100644 |
53 |
+--- a/arch/arc/Makefile |
54 |
++++ b/arch/arc/Makefile |
55 |
+@@ -6,34 +6,12 @@ |
56 |
+ # published by the Free Software Foundation. |
57 |
+ # |
58 |
+ |
59 |
+-ifeq ($(CROSS_COMPILE),) |
60 |
+-ifndef CONFIG_CPU_BIG_ENDIAN |
61 |
+-CROSS_COMPILE := arc-linux- |
62 |
+-else |
63 |
+-CROSS_COMPILE := arceb-linux- |
64 |
+-endif |
65 |
+-endif |
66 |
+- |
67 |
+ KBUILD_DEFCONFIG := nsim_700_defconfig |
68 |
+ |
69 |
+ cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ |
70 |
+ cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 |
71 |
+ cflags-$(CONFIG_ISA_ARCV2) += -mcpu=archs |
72 |
+ |
73 |
+-is_700 = $(shell $(CC) -dM -E - < /dev/null | grep -q "ARC700" && echo 1 || echo 0) |
74 |
+- |
75 |
+-ifdef CONFIG_ISA_ARCOMPACT |
76 |
+-ifeq ($(is_700), 0) |
77 |
+- $(error Toolchain not configured for ARCompact builds) |
78 |
+-endif |
79 |
+-endif |
80 |
+- |
81 |
+-ifdef CONFIG_ISA_ARCV2 |
82 |
+-ifeq ($(is_700), 1) |
83 |
+- $(error Toolchain not configured for ARCv2 builds) |
84 |
+-endif |
85 |
+-endif |
86 |
+- |
87 |
+ ifdef CONFIG_ARC_CURR_IN_REG |
88 |
+ # For a global register defintion, make sure it gets passed to every file |
89 |
+ # We had a customer reported bug where some code built in kernel was NOT using |
90 |
+@@ -87,7 +65,7 @@ ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB |
91 |
+ # --build-id w/o "-marclinux". Default arc-elf32-ld is OK |
92 |
+ ldflags-$(upto_gcc44) += -marclinux |
93 |
+ |
94 |
+-LIBGCC := $(shell $(CC) $(cflags-y) --print-libgcc-file-name) |
95 |
++LIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name) |
96 |
+ |
97 |
+ # Modules with short calls might break for calls into builtin-kernel |
98 |
+ KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode |
99 |
+diff --git a/arch/powerpc/kernel/tm.S b/arch/powerpc/kernel/tm.S |
100 |
+index ff12f47a96b6..09d347b61218 100644 |
101 |
+--- a/arch/powerpc/kernel/tm.S |
102 |
++++ b/arch/powerpc/kernel/tm.S |
103 |
+@@ -175,13 +175,27 @@ _GLOBAL(tm_reclaim) |
104 |
+ std r1, PACATMSCRATCH(r13) |
105 |
+ ld r1, PACAR1(r13) |
106 |
+ |
107 |
+- /* Store the PPR in r11 and reset to decent value */ |
108 |
+ std r11, GPR11(r1) /* Temporary stash */ |
109 |
+ |
110 |
++ /* |
111 |
++ * Move the saved user r1 to the kernel stack in case PACATMSCRATCH is |
112 |
++ * clobbered by an exception once we turn on MSR_RI below. |
113 |
++ */ |
114 |
++ ld r11, PACATMSCRATCH(r13) |
115 |
++ std r11, GPR1(r1) |
116 |
++ |
117 |
++ /* |
118 |
++ * Store r13 away so we can free up the scratch SPR for the SLB fault |
119 |
++ * handler (needed once we start accessing the thread_struct). |
120 |
++ */ |
121 |
++ GET_SCRATCH0(r11) |
122 |
++ std r11, GPR13(r1) |
123 |
++ |
124 |
+ /* Reset MSR RI so we can take SLB faults again */ |
125 |
+ li r11, MSR_RI |
126 |
+ mtmsrd r11, 1 |
127 |
+ |
128 |
++ /* Store the PPR in r11 and reset to decent value */ |
129 |
+ mfspr r11, SPRN_PPR |
130 |
+ HMT_MEDIUM |
131 |
+ |
132 |
+@@ -206,11 +220,11 @@ _GLOBAL(tm_reclaim) |
133 |
+ SAVE_GPR(8, r7) /* user r8 */ |
134 |
+ SAVE_GPR(9, r7) /* user r9 */ |
135 |
+ SAVE_GPR(10, r7) /* user r10 */ |
136 |
+- ld r3, PACATMSCRATCH(r13) /* user r1 */ |
137 |
++ ld r3, GPR1(r1) /* user r1 */ |
138 |
+ ld r4, GPR7(r1) /* user r7 */ |
139 |
+ ld r5, GPR11(r1) /* user r11 */ |
140 |
+ ld r6, GPR12(r1) /* user r12 */ |
141 |
+- GET_SCRATCH0(8) /* user r13 */ |
142 |
++ ld r8, GPR13(r1) /* user r13 */ |
143 |
+ std r3, GPR1(r7) |
144 |
+ std r4, GPR7(r7) |
145 |
+ std r5, GPR11(r7) |
146 |
+diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c |
147 |
+index b5a71baedbc2..59d07bd5374a 100644 |
148 |
+--- a/arch/powerpc/mm/numa.c |
149 |
++++ b/arch/powerpc/mm/numa.c |
150 |
+@@ -1204,7 +1204,9 @@ int find_and_online_cpu_nid(int cpu) |
151 |
+ int new_nid; |
152 |
+ |
153 |
+ /* Use associativity from first thread for all siblings */ |
154 |
+- vphn_get_associativity(cpu, associativity); |
155 |
++ if (vphn_get_associativity(cpu, associativity)) |
156 |
++ return cpu_to_node(cpu); |
157 |
++ |
158 |
+ new_nid = associativity_to_nid(associativity); |
159 |
+ if (new_nid < 0 || !node_possible(new_nid)) |
160 |
+ new_nid = first_online_node; |
161 |
+diff --git a/arch/riscv/include/asm/asm-prototypes.h b/arch/riscv/include/asm/asm-prototypes.h |
162 |
+new file mode 100644 |
163 |
+index 000000000000..c9fecd120d18 |
164 |
+--- /dev/null |
165 |
++++ b/arch/riscv/include/asm/asm-prototypes.h |
166 |
+@@ -0,0 +1,7 @@ |
167 |
++/* SPDX-License-Identifier: GPL-2.0 */ |
168 |
++#ifndef _ASM_RISCV_PROTOTYPES_H |
169 |
++ |
170 |
++#include <linux/ftrace.h> |
171 |
++#include <asm-generic/asm-prototypes.h> |
172 |
++ |
173 |
++#endif /* _ASM_RISCV_PROTOTYPES_H */ |
174 |
+diff --git a/arch/x86/boot/compressed/mem_encrypt.S b/arch/x86/boot/compressed/mem_encrypt.S |
175 |
+index eaa843a52907..a480356e0ed8 100644 |
176 |
+--- a/arch/x86/boot/compressed/mem_encrypt.S |
177 |
++++ b/arch/x86/boot/compressed/mem_encrypt.S |
178 |
+@@ -25,20 +25,6 @@ ENTRY(get_sev_encryption_bit) |
179 |
+ push %ebx |
180 |
+ push %ecx |
181 |
+ push %edx |
182 |
+- push %edi |
183 |
+- |
184 |
+- /* |
185 |
+- * RIP-relative addressing is needed to access the encryption bit |
186 |
+- * variable. Since we are running in 32-bit mode we need this call/pop |
187 |
+- * sequence to get the proper relative addressing. |
188 |
+- */ |
189 |
+- call 1f |
190 |
+-1: popl %edi |
191 |
+- subl $1b, %edi |
192 |
+- |
193 |
+- movl enc_bit(%edi), %eax |
194 |
+- cmpl $0, %eax |
195 |
+- jge .Lsev_exit |
196 |
+ |
197 |
+ /* Check if running under a hypervisor */ |
198 |
+ movl $1, %eax |
199 |
+@@ -69,15 +55,12 @@ ENTRY(get_sev_encryption_bit) |
200 |
+ |
201 |
+ movl %ebx, %eax |
202 |
+ andl $0x3f, %eax /* Return the encryption bit location */ |
203 |
+- movl %eax, enc_bit(%edi) |
204 |
+ jmp .Lsev_exit |
205 |
+ |
206 |
+ .Lno_sev: |
207 |
+ xor %eax, %eax |
208 |
+- movl %eax, enc_bit(%edi) |
209 |
+ |
210 |
+ .Lsev_exit: |
211 |
+- pop %edi |
212 |
+ pop %edx |
213 |
+ pop %ecx |
214 |
+ pop %ebx |
215 |
+@@ -113,8 +96,6 @@ ENTRY(set_sev_encryption_mask) |
216 |
+ ENDPROC(set_sev_encryption_mask) |
217 |
+ |
218 |
+ .data |
219 |
+-enc_bit: |
220 |
+- .int 0xffffffff |
221 |
+ |
222 |
+ #ifdef CONFIG_AMD_MEM_ENCRYPT |
223 |
+ .balign 8 |
224 |
+diff --git a/drivers/clocksource/timer-fttmr010.c b/drivers/clocksource/timer-fttmr010.c |
225 |
+index c020038ebfab..cf93f6419b51 100644 |
226 |
+--- a/drivers/clocksource/timer-fttmr010.c |
227 |
++++ b/drivers/clocksource/timer-fttmr010.c |
228 |
+@@ -130,13 +130,17 @@ static int fttmr010_timer_set_next_event(unsigned long cycles, |
229 |
+ cr &= ~fttmr010->t1_enable_val; |
230 |
+ writel(cr, fttmr010->base + TIMER_CR); |
231 |
+ |
232 |
+- /* Setup the match register forward/backward in time */ |
233 |
+- cr = readl(fttmr010->base + TIMER1_COUNT); |
234 |
+- if (fttmr010->count_down) |
235 |
+- cr -= cycles; |
236 |
+- else |
237 |
+- cr += cycles; |
238 |
+- writel(cr, fttmr010->base + TIMER1_MATCH1); |
239 |
++ if (fttmr010->count_down) { |
240 |
++ /* |
241 |
++ * ASPEED Timer Controller will load TIMER1_LOAD register |
242 |
++ * into TIMER1_COUNT register when the timer is re-enabled. |
243 |
++ */ |
244 |
++ writel(cycles, fttmr010->base + TIMER1_LOAD); |
245 |
++ } else { |
246 |
++ /* Setup the match register forward in time */ |
247 |
++ cr = readl(fttmr010->base + TIMER1_COUNT); |
248 |
++ writel(cr + cycles, fttmr010->base + TIMER1_MATCH1); |
249 |
++ } |
250 |
+ |
251 |
+ /* Start */ |
252 |
+ cr = readl(fttmr010->base + TIMER_CR); |
253 |
+diff --git a/drivers/clocksource/timer-ti-32k.c b/drivers/clocksource/timer-ti-32k.c |
254 |
+index 880a861ab3c8..713214d085e0 100644 |
255 |
+--- a/drivers/clocksource/timer-ti-32k.c |
256 |
++++ b/drivers/clocksource/timer-ti-32k.c |
257 |
+@@ -98,6 +98,9 @@ static int __init ti_32k_timer_init(struct device_node *np) |
258 |
+ return -ENXIO; |
259 |
+ } |
260 |
+ |
261 |
++ if (!of_machine_is_compatible("ti,am43")) |
262 |
++ ti_32k_timer.cs.flags |= CLOCK_SOURCE_SUSPEND_NONSTOP; |
263 |
++ |
264 |
+ ti_32k_timer.counter = ti_32k_timer.base; |
265 |
+ |
266 |
+ /* |
267 |
+diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c |
268 |
+index 0a788d76ed5f..0ec4659795f1 100644 |
269 |
+--- a/drivers/gpu/drm/arm/malidp_drv.c |
270 |
++++ b/drivers/gpu/drm/arm/malidp_drv.c |
271 |
+@@ -615,6 +615,7 @@ static int malidp_bind(struct device *dev) |
272 |
+ drm->irq_enabled = true; |
273 |
+ |
274 |
+ ret = drm_vblank_init(drm, drm->mode_config.num_crtc); |
275 |
++ drm_crtc_vblank_reset(&malidp->crtc); |
276 |
+ if (ret < 0) { |
277 |
+ DRM_ERROR("failed to initialise vblank\n"); |
278 |
+ goto vblank_fail; |
279 |
+diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c |
280 |
+index c2e55e5d97f6..1cf6290d6435 100644 |
281 |
+--- a/drivers/hwtracing/intel_th/pci.c |
282 |
++++ b/drivers/hwtracing/intel_th/pci.c |
283 |
+@@ -160,6 +160,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { |
284 |
+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x18e1), |
285 |
+ .driver_data = (kernel_ulong_t)&intel_th_2x, |
286 |
+ }, |
287 |
++ { |
288 |
++ /* Ice Lake PCH */ |
289 |
++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x34a6), |
290 |
++ .driver_data = (kernel_ulong_t)&intel_th_2x, |
291 |
++ }, |
292 |
+ { 0 }, |
293 |
+ }; |
294 |
+ |
295 |
+diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c |
296 |
+index 0e5eb0f547d3..b83348416885 100644 |
297 |
+--- a/drivers/infiniband/core/uverbs_cmd.c |
298 |
++++ b/drivers/infiniband/core/uverbs_cmd.c |
299 |
+@@ -2048,33 +2048,55 @@ static int modify_qp(struct ib_uverbs_file *file, |
300 |
+ |
301 |
+ if ((cmd->base.attr_mask & IB_QP_CUR_STATE && |
302 |
+ cmd->base.cur_qp_state > IB_QPS_ERR) || |
303 |
+- cmd->base.qp_state > IB_QPS_ERR) { |
304 |
++ (cmd->base.attr_mask & IB_QP_STATE && |
305 |
++ cmd->base.qp_state > IB_QPS_ERR)) { |
306 |
+ ret = -EINVAL; |
307 |
+ goto release_qp; |
308 |
+ } |
309 |
+ |
310 |
+- attr->qp_state = cmd->base.qp_state; |
311 |
+- attr->cur_qp_state = cmd->base.cur_qp_state; |
312 |
+- attr->path_mtu = cmd->base.path_mtu; |
313 |
+- attr->path_mig_state = cmd->base.path_mig_state; |
314 |
+- attr->qkey = cmd->base.qkey; |
315 |
+- attr->rq_psn = cmd->base.rq_psn; |
316 |
+- attr->sq_psn = cmd->base.sq_psn; |
317 |
+- attr->dest_qp_num = cmd->base.dest_qp_num; |
318 |
+- attr->qp_access_flags = cmd->base.qp_access_flags; |
319 |
+- attr->pkey_index = cmd->base.pkey_index; |
320 |
+- attr->alt_pkey_index = cmd->base.alt_pkey_index; |
321 |
+- attr->en_sqd_async_notify = cmd->base.en_sqd_async_notify; |
322 |
+- attr->max_rd_atomic = cmd->base.max_rd_atomic; |
323 |
+- attr->max_dest_rd_atomic = cmd->base.max_dest_rd_atomic; |
324 |
+- attr->min_rnr_timer = cmd->base.min_rnr_timer; |
325 |
+- attr->port_num = cmd->base.port_num; |
326 |
+- attr->timeout = cmd->base.timeout; |
327 |
+- attr->retry_cnt = cmd->base.retry_cnt; |
328 |
+- attr->rnr_retry = cmd->base.rnr_retry; |
329 |
+- attr->alt_port_num = cmd->base.alt_port_num; |
330 |
+- attr->alt_timeout = cmd->base.alt_timeout; |
331 |
+- attr->rate_limit = cmd->rate_limit; |
332 |
++ if (cmd->base.attr_mask & IB_QP_STATE) |
333 |
++ attr->qp_state = cmd->base.qp_state; |
334 |
++ if (cmd->base.attr_mask & IB_QP_CUR_STATE) |
335 |
++ attr->cur_qp_state = cmd->base.cur_qp_state; |
336 |
++ if (cmd->base.attr_mask & IB_QP_PATH_MTU) |
337 |
++ attr->path_mtu = cmd->base.path_mtu; |
338 |
++ if (cmd->base.attr_mask & IB_QP_PATH_MIG_STATE) |
339 |
++ attr->path_mig_state = cmd->base.path_mig_state; |
340 |
++ if (cmd->base.attr_mask & IB_QP_QKEY) |
341 |
++ attr->qkey = cmd->base.qkey; |
342 |
++ if (cmd->base.attr_mask & IB_QP_RQ_PSN) |
343 |
++ attr->rq_psn = cmd->base.rq_psn; |
344 |
++ if (cmd->base.attr_mask & IB_QP_SQ_PSN) |
345 |
++ attr->sq_psn = cmd->base.sq_psn; |
346 |
++ if (cmd->base.attr_mask & IB_QP_DEST_QPN) |
347 |
++ attr->dest_qp_num = cmd->base.dest_qp_num; |
348 |
++ if (cmd->base.attr_mask & IB_QP_ACCESS_FLAGS) |
349 |
++ attr->qp_access_flags = cmd->base.qp_access_flags; |
350 |
++ if (cmd->base.attr_mask & IB_QP_PKEY_INDEX) |
351 |
++ attr->pkey_index = cmd->base.pkey_index; |
352 |
++ if (cmd->base.attr_mask & IB_QP_EN_SQD_ASYNC_NOTIFY) |
353 |
++ attr->en_sqd_async_notify = cmd->base.en_sqd_async_notify; |
354 |
++ if (cmd->base.attr_mask & IB_QP_MAX_QP_RD_ATOMIC) |
355 |
++ attr->max_rd_atomic = cmd->base.max_rd_atomic; |
356 |
++ if (cmd->base.attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) |
357 |
++ attr->max_dest_rd_atomic = cmd->base.max_dest_rd_atomic; |
358 |
++ if (cmd->base.attr_mask & IB_QP_MIN_RNR_TIMER) |
359 |
++ attr->min_rnr_timer = cmd->base.min_rnr_timer; |
360 |
++ if (cmd->base.attr_mask & IB_QP_PORT) |
361 |
++ attr->port_num = cmd->base.port_num; |
362 |
++ if (cmd->base.attr_mask & IB_QP_TIMEOUT) |
363 |
++ attr->timeout = cmd->base.timeout; |
364 |
++ if (cmd->base.attr_mask & IB_QP_RETRY_CNT) |
365 |
++ attr->retry_cnt = cmd->base.retry_cnt; |
366 |
++ if (cmd->base.attr_mask & IB_QP_RNR_RETRY) |
367 |
++ attr->rnr_retry = cmd->base.rnr_retry; |
368 |
++ if (cmd->base.attr_mask & IB_QP_ALT_PATH) { |
369 |
++ attr->alt_port_num = cmd->base.alt_port_num; |
370 |
++ attr->alt_timeout = cmd->base.alt_timeout; |
371 |
++ attr->alt_pkey_index = cmd->base.alt_pkey_index; |
372 |
++ } |
373 |
++ if (cmd->base.attr_mask & IB_QP_RATE_LIMIT) |
374 |
++ attr->rate_limit = cmd->rate_limit; |
375 |
+ |
376 |
+ if (cmd->base.attr_mask & IB_QP_AV) |
377 |
+ copy_ah_attr_from_uverbs(qp->device, &attr->ah_attr, |
378 |
+diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c |
379 |
+index 20b9f31052bf..85cd1a3593d6 100644 |
380 |
+--- a/drivers/infiniband/hw/bnxt_re/main.c |
381 |
++++ b/drivers/infiniband/hw/bnxt_re/main.c |
382 |
+@@ -78,7 +78,7 @@ static struct list_head bnxt_re_dev_list = LIST_HEAD_INIT(bnxt_re_dev_list); |
383 |
+ /* Mutex to protect the list of bnxt_re devices added */ |
384 |
+ static DEFINE_MUTEX(bnxt_re_dev_lock); |
385 |
+ static struct workqueue_struct *bnxt_re_wq; |
386 |
+-static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait); |
387 |
++static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev); |
388 |
+ |
389 |
+ /* SR-IOV helper functions */ |
390 |
+ |
391 |
+@@ -182,7 +182,7 @@ static void bnxt_re_shutdown(void *p) |
392 |
+ if (!rdev) |
393 |
+ return; |
394 |
+ |
395 |
+- bnxt_re_ib_unreg(rdev, false); |
396 |
++ bnxt_re_ib_unreg(rdev); |
397 |
+ } |
398 |
+ |
399 |
+ static void bnxt_re_stop_irq(void *handle) |
400 |
+@@ -251,7 +251,7 @@ static struct bnxt_ulp_ops bnxt_re_ulp_ops = { |
401 |
+ /* Driver registration routines used to let the networking driver (bnxt_en) |
402 |
+ * to know that the RoCE driver is now installed |
403 |
+ */ |
404 |
+-static int bnxt_re_unregister_netdev(struct bnxt_re_dev *rdev, bool lock_wait) |
405 |
++static int bnxt_re_unregister_netdev(struct bnxt_re_dev *rdev) |
406 |
+ { |
407 |
+ struct bnxt_en_dev *en_dev; |
408 |
+ int rc; |
409 |
+@@ -260,14 +260,9 @@ static int bnxt_re_unregister_netdev(struct bnxt_re_dev *rdev, bool lock_wait) |
410 |
+ return -EINVAL; |
411 |
+ |
412 |
+ en_dev = rdev->en_dev; |
413 |
+- /* Acquire rtnl lock if it is not invokded from netdev event */ |
414 |
+- if (lock_wait) |
415 |
+- rtnl_lock(); |
416 |
+ |
417 |
+ rc = en_dev->en_ops->bnxt_unregister_device(rdev->en_dev, |
418 |
+ BNXT_ROCE_ULP); |
419 |
+- if (lock_wait) |
420 |
+- rtnl_unlock(); |
421 |
+ return rc; |
422 |
+ } |
423 |
+ |
424 |
+@@ -281,14 +276,12 @@ static int bnxt_re_register_netdev(struct bnxt_re_dev *rdev) |
425 |
+ |
426 |
+ en_dev = rdev->en_dev; |
427 |
+ |
428 |
+- rtnl_lock(); |
429 |
+ rc = en_dev->en_ops->bnxt_register_device(en_dev, BNXT_ROCE_ULP, |
430 |
+ &bnxt_re_ulp_ops, rdev); |
431 |
+- rtnl_unlock(); |
432 |
+ return rc; |
433 |
+ } |
434 |
+ |
435 |
+-static int bnxt_re_free_msix(struct bnxt_re_dev *rdev, bool lock_wait) |
436 |
++static int bnxt_re_free_msix(struct bnxt_re_dev *rdev) |
437 |
+ { |
438 |
+ struct bnxt_en_dev *en_dev; |
439 |
+ int rc; |
440 |
+@@ -298,13 +291,9 @@ static int bnxt_re_free_msix(struct bnxt_re_dev *rdev, bool lock_wait) |
441 |
+ |
442 |
+ en_dev = rdev->en_dev; |
443 |
+ |
444 |
+- if (lock_wait) |
445 |
+- rtnl_lock(); |
446 |
+ |
447 |
+ rc = en_dev->en_ops->bnxt_free_msix(rdev->en_dev, BNXT_ROCE_ULP); |
448 |
+ |
449 |
+- if (lock_wait) |
450 |
+- rtnl_unlock(); |
451 |
+ return rc; |
452 |
+ } |
453 |
+ |
454 |
+@@ -320,7 +309,6 @@ static int bnxt_re_request_msix(struct bnxt_re_dev *rdev) |
455 |
+ |
456 |
+ num_msix_want = min_t(u32, BNXT_RE_MAX_MSIX, num_online_cpus()); |
457 |
+ |
458 |
+- rtnl_lock(); |
459 |
+ num_msix_got = en_dev->en_ops->bnxt_request_msix(en_dev, BNXT_ROCE_ULP, |
460 |
+ rdev->msix_entries, |
461 |
+ num_msix_want); |
462 |
+@@ -335,7 +323,6 @@ static int bnxt_re_request_msix(struct bnxt_re_dev *rdev) |
463 |
+ } |
464 |
+ rdev->num_msix = num_msix_got; |
465 |
+ done: |
466 |
+- rtnl_unlock(); |
467 |
+ return rc; |
468 |
+ } |
469 |
+ |
470 |
+@@ -358,24 +345,18 @@ static void bnxt_re_fill_fw_msg(struct bnxt_fw_msg *fw_msg, void *msg, |
471 |
+ fw_msg->timeout = timeout; |
472 |
+ } |
473 |
+ |
474 |
+-static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev, u16 fw_ring_id, |
475 |
+- bool lock_wait) |
476 |
++static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev, u16 fw_ring_id) |
477 |
+ { |
478 |
+ struct bnxt_en_dev *en_dev = rdev->en_dev; |
479 |
+ struct hwrm_ring_free_input req = {0}; |
480 |
+ struct hwrm_ring_free_output resp; |
481 |
+ struct bnxt_fw_msg fw_msg; |
482 |
+- bool do_unlock = false; |
483 |
+ int rc = -EINVAL; |
484 |
+ |
485 |
+ if (!en_dev) |
486 |
+ return rc; |
487 |
+ |
488 |
+ memset(&fw_msg, 0, sizeof(fw_msg)); |
489 |
+- if (lock_wait) { |
490 |
+- rtnl_lock(); |
491 |
+- do_unlock = true; |
492 |
+- } |
493 |
+ |
494 |
+ bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_RING_FREE, -1, -1); |
495 |
+ req.ring_type = RING_ALLOC_REQ_RING_TYPE_L2_CMPL; |
496 |
+@@ -386,8 +367,6 @@ static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev, u16 fw_ring_id, |
497 |
+ if (rc) |
498 |
+ dev_err(rdev_to_dev(rdev), |
499 |
+ "Failed to free HW ring:%d :%#x", req.ring_id, rc); |
500 |
+- if (do_unlock) |
501 |
+- rtnl_unlock(); |
502 |
+ return rc; |
503 |
+ } |
504 |
+ |
505 |
+@@ -405,7 +384,6 @@ static int bnxt_re_net_ring_alloc(struct bnxt_re_dev *rdev, dma_addr_t *dma_arr, |
506 |
+ return rc; |
507 |
+ |
508 |
+ memset(&fw_msg, 0, sizeof(fw_msg)); |
509 |
+- rtnl_lock(); |
510 |
+ bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_RING_ALLOC, -1, -1); |
511 |
+ req.enables = 0; |
512 |
+ req.page_tbl_addr = cpu_to_le64(dma_arr[0]); |
513 |
+@@ -426,27 +404,21 @@ static int bnxt_re_net_ring_alloc(struct bnxt_re_dev *rdev, dma_addr_t *dma_arr, |
514 |
+ if (!rc) |
515 |
+ *fw_ring_id = le16_to_cpu(resp.ring_id); |
516 |
+ |
517 |
+- rtnl_unlock(); |
518 |
+ return rc; |
519 |
+ } |
520 |
+ |
521 |
+ static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev, |
522 |
+- u32 fw_stats_ctx_id, bool lock_wait) |
523 |
++ u32 fw_stats_ctx_id) |
524 |
+ { |
525 |
+ struct bnxt_en_dev *en_dev = rdev->en_dev; |
526 |
+ struct hwrm_stat_ctx_free_input req = {0}; |
527 |
+ struct bnxt_fw_msg fw_msg; |
528 |
+- bool do_unlock = false; |
529 |
+ int rc = -EINVAL; |
530 |
+ |
531 |
+ if (!en_dev) |
532 |
+ return rc; |
533 |
+ |
534 |
+ memset(&fw_msg, 0, sizeof(fw_msg)); |
535 |
+- if (lock_wait) { |
536 |
+- rtnl_lock(); |
537 |
+- do_unlock = true; |
538 |
+- } |
539 |
+ |
540 |
+ bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_FREE, -1, -1); |
541 |
+ req.stat_ctx_id = cpu_to_le32(fw_stats_ctx_id); |
542 |
+@@ -457,8 +429,6 @@ static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev, |
543 |
+ dev_err(rdev_to_dev(rdev), |
544 |
+ "Failed to free HW stats context %#x", rc); |
545 |
+ |
546 |
+- if (do_unlock) |
547 |
+- rtnl_unlock(); |
548 |
+ return rc; |
549 |
+ } |
550 |
+ |
551 |
+@@ -478,7 +448,6 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev, |
552 |
+ return rc; |
553 |
+ |
554 |
+ memset(&fw_msg, 0, sizeof(fw_msg)); |
555 |
+- rtnl_lock(); |
556 |
+ |
557 |
+ bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_ALLOC, -1, -1); |
558 |
+ req.update_period_ms = cpu_to_le32(1000); |
559 |
+@@ -490,7 +459,6 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev, |
560 |
+ if (!rc) |
561 |
+ *fw_stats_ctx_id = le32_to_cpu(resp.stat_ctx_id); |
562 |
+ |
563 |
+- rtnl_unlock(); |
564 |
+ return rc; |
565 |
+ } |
566 |
+ |
567 |
+@@ -929,19 +897,19 @@ fail: |
568 |
+ return rc; |
569 |
+ } |
570 |
+ |
571 |
+-static void bnxt_re_free_nq_res(struct bnxt_re_dev *rdev, bool lock_wait) |
572 |
++static void bnxt_re_free_nq_res(struct bnxt_re_dev *rdev) |
573 |
+ { |
574 |
+ int i; |
575 |
+ |
576 |
+ for (i = 0; i < rdev->num_msix - 1; i++) { |
577 |
+- bnxt_re_net_ring_free(rdev, rdev->nq[i].ring_id, lock_wait); |
578 |
++ bnxt_re_net_ring_free(rdev, rdev->nq[i].ring_id); |
579 |
+ bnxt_qplib_free_nq(&rdev->nq[i]); |
580 |
+ } |
581 |
+ } |
582 |
+ |
583 |
+-static void bnxt_re_free_res(struct bnxt_re_dev *rdev, bool lock_wait) |
584 |
++static void bnxt_re_free_res(struct bnxt_re_dev *rdev) |
585 |
+ { |
586 |
+- bnxt_re_free_nq_res(rdev, lock_wait); |
587 |
++ bnxt_re_free_nq_res(rdev); |
588 |
+ |
589 |
+ if (rdev->qplib_res.dpi_tbl.max) { |
590 |
+ bnxt_qplib_dealloc_dpi(&rdev->qplib_res, |
591 |
+@@ -1219,7 +1187,7 @@ static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev) |
592 |
+ return 0; |
593 |
+ } |
594 |
+ |
595 |
+-static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait) |
596 |
++static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev) |
597 |
+ { |
598 |
+ int i, rc; |
599 |
+ |
600 |
+@@ -1234,28 +1202,27 @@ static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait) |
601 |
+ cancel_delayed_work(&rdev->worker); |
602 |
+ |
603 |
+ bnxt_re_cleanup_res(rdev); |
604 |
+- bnxt_re_free_res(rdev, lock_wait); |
605 |
++ bnxt_re_free_res(rdev); |
606 |
+ |
607 |
+ if (test_and_clear_bit(BNXT_RE_FLAG_RCFW_CHANNEL_EN, &rdev->flags)) { |
608 |
+ rc = bnxt_qplib_deinit_rcfw(&rdev->rcfw); |
609 |
+ if (rc) |
610 |
+ dev_warn(rdev_to_dev(rdev), |
611 |
+ "Failed to deinitialize RCFW: %#x", rc); |
612 |
+- bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id, |
613 |
+- lock_wait); |
614 |
++ bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id); |
615 |
+ bnxt_qplib_free_ctx(rdev->en_dev->pdev, &rdev->qplib_ctx); |
616 |
+ bnxt_qplib_disable_rcfw_channel(&rdev->rcfw); |
617 |
+- bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id, lock_wait); |
618 |
++ bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id); |
619 |
+ bnxt_qplib_free_rcfw_channel(&rdev->rcfw); |
620 |
+ } |
621 |
+ if (test_and_clear_bit(BNXT_RE_FLAG_GOT_MSIX, &rdev->flags)) { |
622 |
+- rc = bnxt_re_free_msix(rdev, lock_wait); |
623 |
++ rc = bnxt_re_free_msix(rdev); |
624 |
+ if (rc) |
625 |
+ dev_warn(rdev_to_dev(rdev), |
626 |
+ "Failed to free MSI-X vectors: %#x", rc); |
627 |
+ } |
628 |
+ if (test_and_clear_bit(BNXT_RE_FLAG_NETDEV_REGISTERED, &rdev->flags)) { |
629 |
+- rc = bnxt_re_unregister_netdev(rdev, lock_wait); |
630 |
++ rc = bnxt_re_unregister_netdev(rdev); |
631 |
+ if (rc) |
632 |
+ dev_warn(rdev_to_dev(rdev), |
633 |
+ "Failed to unregister with netdev: %#x", rc); |
634 |
+@@ -1276,6 +1243,12 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) |
635 |
+ { |
636 |
+ int i, j, rc; |
637 |
+ |
638 |
++ bool locked; |
639 |
++ |
640 |
++ /* Acquire rtnl lock through out this function */ |
641 |
++ rtnl_lock(); |
642 |
++ locked = true; |
643 |
++ |
644 |
+ /* Registered a new RoCE device instance to netdev */ |
645 |
+ rc = bnxt_re_register_netdev(rdev); |
646 |
+ if (rc) { |
647 |
+@@ -1374,12 +1347,16 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) |
648 |
+ schedule_delayed_work(&rdev->worker, msecs_to_jiffies(30000)); |
649 |
+ } |
650 |
+ |
651 |
++ rtnl_unlock(); |
652 |
++ locked = false; |
653 |
++ |
654 |
+ /* Register ib dev */ |
655 |
+ rc = bnxt_re_register_ib(rdev); |
656 |
+ if (rc) { |
657 |
+ pr_err("Failed to register with IB: %#x\n", rc); |
658 |
+ goto fail; |
659 |
+ } |
660 |
++ set_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags); |
661 |
+ dev_info(rdev_to_dev(rdev), "Device registered successfully"); |
662 |
+ for (i = 0; i < ARRAY_SIZE(bnxt_re_attributes); i++) { |
663 |
+ rc = device_create_file(&rdev->ibdev.dev, |
664 |
+@@ -1395,7 +1372,6 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) |
665 |
+ goto fail; |
666 |
+ } |
667 |
+ } |
668 |
+- set_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags); |
669 |
+ ib_get_eth_speed(&rdev->ibdev, 1, &rdev->active_speed, |
670 |
+ &rdev->active_width); |
671 |
+ set_bit(BNXT_RE_FLAG_ISSUE_ROCE_STATS, &rdev->flags); |
672 |
+@@ -1404,17 +1380,21 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) |
673 |
+ |
674 |
+ return 0; |
675 |
+ free_sctx: |
676 |
+- bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id, true); |
677 |
++ bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id); |
678 |
+ free_ctx: |
679 |
+ bnxt_qplib_free_ctx(rdev->en_dev->pdev, &rdev->qplib_ctx); |
680 |
+ disable_rcfw: |
681 |
+ bnxt_qplib_disable_rcfw_channel(&rdev->rcfw); |
682 |
+ free_ring: |
683 |
+- bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id, true); |
684 |
++ bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id); |
685 |
+ free_rcfw: |
686 |
+ bnxt_qplib_free_rcfw_channel(&rdev->rcfw); |
687 |
+ fail: |
688 |
+- bnxt_re_ib_unreg(rdev, true); |
689 |
++ if (!locked) |
690 |
++ rtnl_lock(); |
691 |
++ bnxt_re_ib_unreg(rdev); |
692 |
++ rtnl_unlock(); |
693 |
++ |
694 |
+ return rc; |
695 |
+ } |
696 |
+ |
697 |
+@@ -1567,7 +1547,7 @@ static int bnxt_re_netdev_event(struct notifier_block *notifier, |
698 |
+ */ |
699 |
+ if (atomic_read(&rdev->sched_count) > 0) |
700 |
+ goto exit; |
701 |
+- bnxt_re_ib_unreg(rdev, false); |
702 |
++ bnxt_re_ib_unreg(rdev); |
703 |
+ bnxt_re_remove_one(rdev); |
704 |
+ bnxt_re_dev_unreg(rdev); |
705 |
+ break; |
706 |
+@@ -1646,7 +1626,10 @@ static void __exit bnxt_re_mod_exit(void) |
707 |
+ */ |
708 |
+ flush_workqueue(bnxt_re_wq); |
709 |
+ bnxt_re_dev_stop(rdev); |
710 |
+- bnxt_re_ib_unreg(rdev, true); |
711 |
++ /* Acquire the rtnl_lock as the L2 resources are freed here */ |
712 |
++ rtnl_lock(); |
713 |
++ bnxt_re_ib_unreg(rdev); |
714 |
++ rtnl_unlock(); |
715 |
+ bnxt_re_remove_one(rdev); |
716 |
+ bnxt_re_dev_unreg(rdev); |
717 |
+ } |
718 |
+diff --git a/drivers/input/keyboard/atakbd.c b/drivers/input/keyboard/atakbd.c |
719 |
+index f1235831283d..fdeda0b0fbd6 100644 |
720 |
+--- a/drivers/input/keyboard/atakbd.c |
721 |
++++ b/drivers/input/keyboard/atakbd.c |
722 |
+@@ -79,8 +79,7 @@ MODULE_LICENSE("GPL"); |
723 |
+ */ |
724 |
+ |
725 |
+ |
726 |
+-static unsigned char atakbd_keycode[0x72] = { /* American layout */ |
727 |
+- [0] = KEY_GRAVE, |
728 |
++static unsigned char atakbd_keycode[0x73] = { /* American layout */ |
729 |
+ [1] = KEY_ESC, |
730 |
+ [2] = KEY_1, |
731 |
+ [3] = KEY_2, |
732 |
+@@ -121,9 +120,9 @@ static unsigned char atakbd_keycode[0x72] = { /* American layout */ |
733 |
+ [38] = KEY_L, |
734 |
+ [39] = KEY_SEMICOLON, |
735 |
+ [40] = KEY_APOSTROPHE, |
736 |
+- [41] = KEY_BACKSLASH, /* FIXME, '#' */ |
737 |
++ [41] = KEY_GRAVE, |
738 |
+ [42] = KEY_LEFTSHIFT, |
739 |
+- [43] = KEY_GRAVE, /* FIXME: '~' */ |
740 |
++ [43] = KEY_BACKSLASH, |
741 |
+ [44] = KEY_Z, |
742 |
+ [45] = KEY_X, |
743 |
+ [46] = KEY_C, |
744 |
+@@ -149,45 +148,34 @@ static unsigned char atakbd_keycode[0x72] = { /* American layout */ |
745 |
+ [66] = KEY_F8, |
746 |
+ [67] = KEY_F9, |
747 |
+ [68] = KEY_F10, |
748 |
+- [69] = KEY_ESC, |
749 |
+- [70] = KEY_DELETE, |
750 |
+- [71] = KEY_KP7, |
751 |
+- [72] = KEY_KP8, |
752 |
+- [73] = KEY_KP9, |
753 |
++ [71] = KEY_HOME, |
754 |
++ [72] = KEY_UP, |
755 |
+ [74] = KEY_KPMINUS, |
756 |
+- [75] = KEY_KP4, |
757 |
+- [76] = KEY_KP5, |
758 |
+- [77] = KEY_KP6, |
759 |
++ [75] = KEY_LEFT, |
760 |
++ [77] = KEY_RIGHT, |
761 |
+ [78] = KEY_KPPLUS, |
762 |
+- [79] = KEY_KP1, |
763 |
+- [80] = KEY_KP2, |
764 |
+- [81] = KEY_KP3, |
765 |
+- [82] = KEY_KP0, |
766 |
+- [83] = KEY_KPDOT, |
767 |
+- [90] = KEY_KPLEFTPAREN, |
768 |
+- [91] = KEY_KPRIGHTPAREN, |
769 |
+- [92] = KEY_KPASTERISK, /* FIXME */ |
770 |
+- [93] = KEY_KPASTERISK, |
771 |
+- [94] = KEY_KPPLUS, |
772 |
+- [95] = KEY_HELP, |
773 |
++ [80] = KEY_DOWN, |
774 |
++ [82] = KEY_INSERT, |
775 |
++ [83] = KEY_DELETE, |
776 |
+ [96] = KEY_102ND, |
777 |
+- [97] = KEY_KPASTERISK, /* FIXME */ |
778 |
+- [98] = KEY_KPSLASH, |
779 |
++ [97] = KEY_UNDO, |
780 |
++ [98] = KEY_HELP, |
781 |
+ [99] = KEY_KPLEFTPAREN, |
782 |
+ [100] = KEY_KPRIGHTPAREN, |
783 |
+ [101] = KEY_KPSLASH, |
784 |
+ [102] = KEY_KPASTERISK, |
785 |
+- [103] = KEY_UP, |
786 |
+- [104] = KEY_KPASTERISK, /* FIXME */ |
787 |
+- [105] = KEY_LEFT, |
788 |
+- [106] = KEY_RIGHT, |
789 |
+- [107] = KEY_KPASTERISK, /* FIXME */ |
790 |
+- [108] = KEY_DOWN, |
791 |
+- [109] = KEY_KPASTERISK, /* FIXME */ |
792 |
+- [110] = KEY_KPASTERISK, /* FIXME */ |
793 |
+- [111] = KEY_KPASTERISK, /* FIXME */ |
794 |
+- [112] = KEY_KPASTERISK, /* FIXME */ |
795 |
+- [113] = KEY_KPASTERISK /* FIXME */ |
796 |
++ [103] = KEY_KP7, |
797 |
++ [104] = KEY_KP8, |
798 |
++ [105] = KEY_KP9, |
799 |
++ [106] = KEY_KP4, |
800 |
++ [107] = KEY_KP5, |
801 |
++ [108] = KEY_KP6, |
802 |
++ [109] = KEY_KP1, |
803 |
++ [110] = KEY_KP2, |
804 |
++ [111] = KEY_KP3, |
805 |
++ [112] = KEY_KP0, |
806 |
++ [113] = KEY_KPDOT, |
807 |
++ [114] = KEY_KPENTER, |
808 |
+ }; |
809 |
+ |
810 |
+ static struct input_dev *atakbd_dev; |
811 |
+@@ -195,21 +183,15 @@ static struct input_dev *atakbd_dev; |
812 |
+ static void atakbd_interrupt(unsigned char scancode, char down) |
813 |
+ { |
814 |
+ |
815 |
+- if (scancode < 0x72) { /* scancodes < 0xf2 are keys */ |
816 |
++ if (scancode < 0x73) { /* scancodes < 0xf3 are keys */ |
817 |
+ |
818 |
+ // report raw events here? |
819 |
+ |
820 |
+ scancode = atakbd_keycode[scancode]; |
821 |
+ |
822 |
+- if (scancode == KEY_CAPSLOCK) { /* CapsLock is a toggle switch key on Amiga */ |
823 |
+- input_report_key(atakbd_dev, scancode, 1); |
824 |
+- input_report_key(atakbd_dev, scancode, 0); |
825 |
+- input_sync(atakbd_dev); |
826 |
+- } else { |
827 |
+- input_report_key(atakbd_dev, scancode, down); |
828 |
+- input_sync(atakbd_dev); |
829 |
+- } |
830 |
+- } else /* scancodes >= 0xf2 are mouse data, most likely */ |
831 |
++ input_report_key(atakbd_dev, scancode, down); |
832 |
++ input_sync(atakbd_dev); |
833 |
++ } else /* scancodes >= 0xf3 are mouse data, most likely */ |
834 |
+ printk(KERN_INFO "atakbd: unhandled scancode %x\n", scancode); |
835 |
+ |
836 |
+ return; |
837 |
+diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
838 |
+index c53363443280..c2b511a16b0e 100644 |
839 |
+--- a/drivers/iommu/amd_iommu.c |
840 |
++++ b/drivers/iommu/amd_iommu.c |
841 |
+@@ -246,7 +246,13 @@ static u16 get_alias(struct device *dev) |
842 |
+ |
843 |
+ /* The callers make sure that get_device_id() does not fail here */ |
844 |
+ devid = get_device_id(dev); |
845 |
++ |
846 |
++ /* For ACPI HID devices, we simply return the devid as such */ |
847 |
++ if (!dev_is_pci(dev)) |
848 |
++ return devid; |
849 |
++ |
850 |
+ ivrs_alias = amd_iommu_alias_table[devid]; |
851 |
++ |
852 |
+ pci_for_each_dma_alias(pdev, __last_alias, &pci_alias); |
853 |
+ |
854 |
+ if (ivrs_alias == pci_alias) |
855 |
+diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c |
856 |
+index 2b1724e8d307..701820b39fd1 100644 |
857 |
+--- a/drivers/iommu/rockchip-iommu.c |
858 |
++++ b/drivers/iommu/rockchip-iommu.c |
859 |
+@@ -1242,6 +1242,12 @@ err_unprepare_clocks: |
860 |
+ |
861 |
+ static void rk_iommu_shutdown(struct platform_device *pdev) |
862 |
+ { |
863 |
++ struct rk_iommu *iommu = platform_get_drvdata(pdev); |
864 |
++ int i = 0, irq; |
865 |
++ |
866 |
++ while ((irq = platform_get_irq(pdev, i++)) != -ENXIO) |
867 |
++ devm_free_irq(iommu->dev, irq, iommu); |
868 |
++ |
869 |
+ pm_runtime_force_suspend(&pdev->dev); |
870 |
+ } |
871 |
+ |
872 |
+diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c |
873 |
+index 666d319d3d1a..1f6c1eefe389 100644 |
874 |
+--- a/drivers/media/usb/dvb-usb-v2/af9035.c |
875 |
++++ b/drivers/media/usb/dvb-usb-v2/af9035.c |
876 |
+@@ -402,8 +402,10 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, |
877 |
+ if (msg[0].addr == state->af9033_i2c_addr[1]) |
878 |
+ reg |= 0x100000; |
879 |
+ |
880 |
+- ret = af9035_wr_regs(d, reg, &msg[0].buf[3], |
881 |
+- msg[0].len - 3); |
882 |
++ ret = (msg[0].len >= 3) ? af9035_wr_regs(d, reg, |
883 |
++ &msg[0].buf[3], |
884 |
++ msg[0].len - 3) |
885 |
++ : -EOPNOTSUPP; |
886 |
+ } else { |
887 |
+ /* I2C write */ |
888 |
+ u8 buf[MAX_XFER_SIZE]; |
889 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h |
890 |
+index 09e38f0733bd..10b9cb2185b1 100644 |
891 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h |
892 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h |
893 |
+@@ -753,7 +753,6 @@ struct cpl_abort_req_rss { |
894 |
+ }; |
895 |
+ |
896 |
+ struct cpl_abort_req_rss6 { |
897 |
+- WR_HDR; |
898 |
+ union opcode_tid ot; |
899 |
+ __u32 srqidx_status; |
900 |
+ }; |
901 |
+diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c |
902 |
+index 372664686309..129f4e9f38da 100644 |
903 |
+--- a/drivers/net/ethernet/ibm/emac/core.c |
904 |
++++ b/drivers/net/ethernet/ibm/emac/core.c |
905 |
+@@ -2677,12 +2677,17 @@ static int emac_init_phy(struct emac_instance *dev) |
906 |
+ if (of_phy_is_fixed_link(np)) { |
907 |
+ int res = emac_dt_mdio_probe(dev); |
908 |
+ |
909 |
+- if (!res) { |
910 |
+- res = of_phy_register_fixed_link(np); |
911 |
+- if (res) |
912 |
+- mdiobus_unregister(dev->mii_bus); |
913 |
++ if (res) |
914 |
++ return res; |
915 |
++ |
916 |
++ res = of_phy_register_fixed_link(np); |
917 |
++ dev->phy_dev = of_phy_find_device(np); |
918 |
++ if (res || !dev->phy_dev) { |
919 |
++ mdiobus_unregister(dev->mii_bus); |
920 |
++ return res ? res : -EINVAL; |
921 |
+ } |
922 |
+- return res; |
923 |
++ emac_adjust_link(dev->ndev); |
924 |
++ put_device(&dev->phy_dev->mdio.dev); |
925 |
+ } |
926 |
+ return 0; |
927 |
+ } |
928 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c |
929 |
+index 1f3372c1802e..2df92dbd38e1 100644 |
930 |
+--- a/drivers/net/ethernet/mellanox/mlx4/eq.c |
931 |
++++ b/drivers/net/ethernet/mellanox/mlx4/eq.c |
932 |
+@@ -240,7 +240,8 @@ static void mlx4_set_eq_affinity_hint(struct mlx4_priv *priv, int vec) |
933 |
+ struct mlx4_dev *dev = &priv->dev; |
934 |
+ struct mlx4_eq *eq = &priv->eq_table.eq[vec]; |
935 |
+ |
936 |
+- if (!eq->affinity_mask || cpumask_empty(eq->affinity_mask)) |
937 |
++ if (!cpumask_available(eq->affinity_mask) || |
938 |
++ cpumask_empty(eq->affinity_mask)) |
939 |
+ return; |
940 |
+ |
941 |
+ hint_err = irq_set_affinity_hint(eq->irq, eq->affinity_mask); |
942 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c |
943 |
+index e0680ce91328..09ed0ba4225a 100644 |
944 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c |
945 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c |
946 |
+@@ -190,6 +190,7 @@ qed_dcbx_dp_protocol(struct qed_hwfn *p_hwfn, struct qed_dcbx_results *p_data) |
947 |
+ |
948 |
+ static void |
949 |
+ qed_dcbx_set_params(struct qed_dcbx_results *p_data, |
950 |
++ struct qed_hwfn *p_hwfn, |
951 |
+ struct qed_hw_info *p_info, |
952 |
+ bool enable, |
953 |
+ u8 prio, |
954 |
+@@ -206,6 +207,11 @@ qed_dcbx_set_params(struct qed_dcbx_results *p_data, |
955 |
+ else |
956 |
+ p_data->arr[type].update = DONT_UPDATE_DCB_DSCP; |
957 |
+ |
958 |
++ /* Do not add vlan tag 0 when DCB is enabled and port in UFP/OV mode */ |
959 |
++ if ((test_bit(QED_MF_8021Q_TAGGING, &p_hwfn->cdev->mf_bits) || |
960 |
++ test_bit(QED_MF_8021AD_TAGGING, &p_hwfn->cdev->mf_bits))) |
961 |
++ p_data->arr[type].dont_add_vlan0 = true; |
962 |
++ |
963 |
+ /* QM reconf data */ |
964 |
+ if (p_info->personality == personality) |
965 |
+ p_info->offload_tc = tc; |
966 |
+@@ -233,7 +239,7 @@ qed_dcbx_update_app_info(struct qed_dcbx_results *p_data, |
967 |
+ personality = qed_dcbx_app_update[i].personality; |
968 |
+ name = qed_dcbx_app_update[i].name; |
969 |
+ |
970 |
+- qed_dcbx_set_params(p_data, p_info, enable, |
971 |
++ qed_dcbx_set_params(p_data, p_hwfn, p_info, enable, |
972 |
+ prio, tc, type, personality); |
973 |
+ } |
974 |
+ } |
975 |
+@@ -956,6 +962,7 @@ static void qed_dcbx_update_protocol_data(struct protocol_dcb_data *p_data, |
976 |
+ p_data->dcb_enable_flag = p_src->arr[type].enable; |
977 |
+ p_data->dcb_priority = p_src->arr[type].priority; |
978 |
+ p_data->dcb_tc = p_src->arr[type].tc; |
979 |
++ p_data->dcb_dont_add_vlan0 = p_src->arr[type].dont_add_vlan0; |
980 |
+ } |
981 |
+ |
982 |
+ /* Set pf update ramrod command params */ |
983 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.h b/drivers/net/ethernet/qlogic/qed/qed_dcbx.h |
984 |
+index 5feb90e049e0..d950d836858c 100644 |
985 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.h |
986 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.h |
987 |
+@@ -55,6 +55,7 @@ struct qed_dcbx_app_data { |
988 |
+ u8 update; /* Update indication */ |
989 |
+ u8 priority; /* Priority */ |
990 |
+ u8 tc; /* Traffic Class */ |
991 |
++ bool dont_add_vlan0; /* Do not insert a vlan tag with id 0 */ |
992 |
+ }; |
993 |
+ |
994 |
+ #define QED_DCBX_VERSION_DISABLED 0 |
995 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c |
996 |
+index e5249b4741d0..194f4dbe57d3 100644 |
997 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c |
998 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c |
999 |
+@@ -1636,7 +1636,7 @@ static int qed_vf_start(struct qed_hwfn *p_hwfn, |
1000 |
+ int qed_hw_init(struct qed_dev *cdev, struct qed_hw_init_params *p_params) |
1001 |
+ { |
1002 |
+ struct qed_load_req_params load_req_params; |
1003 |
+- u32 load_code, param, drv_mb_param; |
1004 |
++ u32 load_code, resp, param, drv_mb_param; |
1005 |
+ bool b_default_mtu = true; |
1006 |
+ struct qed_hwfn *p_hwfn; |
1007 |
+ int rc = 0, mfw_rc, i; |
1008 |
+@@ -1782,6 +1782,19 @@ int qed_hw_init(struct qed_dev *cdev, struct qed_hw_init_params *p_params) |
1009 |
+ |
1010 |
+ if (IS_PF(cdev)) { |
1011 |
+ p_hwfn = QED_LEADING_HWFN(cdev); |
1012 |
++ |
1013 |
++ /* Get pre-negotiated values for stag, bandwidth etc. */ |
1014 |
++ DP_VERBOSE(p_hwfn, |
1015 |
++ QED_MSG_SPQ, |
1016 |
++ "Sending GET_OEM_UPDATES command to trigger stag/bandwidth attention handling\n"); |
1017 |
++ drv_mb_param = 1 << DRV_MB_PARAM_DUMMY_OEM_UPDATES_OFFSET; |
1018 |
++ rc = qed_mcp_cmd(p_hwfn, p_hwfn->p_main_ptt, |
1019 |
++ DRV_MSG_CODE_GET_OEM_UPDATES, |
1020 |
++ drv_mb_param, &resp, ¶m); |
1021 |
++ if (rc) |
1022 |
++ DP_NOTICE(p_hwfn, |
1023 |
++ "Failed to send GET_OEM_UPDATES attention request\n"); |
1024 |
++ |
1025 |
+ drv_mb_param = STORM_FW_VERSION; |
1026 |
+ rc = qed_mcp_cmd(p_hwfn, p_hwfn->p_main_ptt, |
1027 |
+ DRV_MSG_CODE_OV_UPDATE_STORM_FW_VER, |
1028 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_hsi.h b/drivers/net/ethernet/qlogic/qed/qed_hsi.h |
1029 |
+index 463ffa83685f..ec5de7cf1af4 100644 |
1030 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_hsi.h |
1031 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_hsi.h |
1032 |
+@@ -12415,6 +12415,7 @@ struct public_drv_mb { |
1033 |
+ #define DRV_MSG_SET_RESOURCE_VALUE_MSG 0x35000000 |
1034 |
+ #define DRV_MSG_CODE_OV_UPDATE_WOL 0x38000000 |
1035 |
+ #define DRV_MSG_CODE_OV_UPDATE_ESWITCH_MODE 0x39000000 |
1036 |
++#define DRV_MSG_CODE_GET_OEM_UPDATES 0x41000000 |
1037 |
+ |
1038 |
+ #define DRV_MSG_CODE_BW_UPDATE_ACK 0x32000000 |
1039 |
+ #define DRV_MSG_CODE_NIG_DRAIN 0x30000000 |
1040 |
+@@ -12540,6 +12541,9 @@ struct public_drv_mb { |
1041 |
+ #define DRV_MB_PARAM_ESWITCH_MODE_VEB 0x1 |
1042 |
+ #define DRV_MB_PARAM_ESWITCH_MODE_VEPA 0x2 |
1043 |
+ |
1044 |
++#define DRV_MB_PARAM_DUMMY_OEM_UPDATES_MASK 0x1 |
1045 |
++#define DRV_MB_PARAM_DUMMY_OEM_UPDATES_OFFSET 0 |
1046 |
++ |
1047 |
+ #define DRV_MB_PARAM_SET_LED_MODE_OPER 0x0 |
1048 |
+ #define DRV_MB_PARAM_SET_LED_MODE_ON 0x1 |
1049 |
+ #define DRV_MB_PARAM_SET_LED_MODE_OFF 0x2 |
1050 |
+diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h |
1051 |
+index b81f4faf7b10..1c40989479bd 100644 |
1052 |
+--- a/drivers/net/ethernet/renesas/ravb.h |
1053 |
++++ b/drivers/net/ethernet/renesas/ravb.h |
1054 |
+@@ -431,6 +431,7 @@ enum EIS_BIT { |
1055 |
+ EIS_CULF1 = 0x00000080, |
1056 |
+ EIS_TFFF = 0x00000100, |
1057 |
+ EIS_QFS = 0x00010000, |
1058 |
++ EIS_RESERVED = (GENMASK(31, 17) | GENMASK(15, 11)), |
1059 |
+ }; |
1060 |
+ |
1061 |
+ /* RIC0 */ |
1062 |
+@@ -475,6 +476,7 @@ enum RIS0_BIT { |
1063 |
+ RIS0_FRF15 = 0x00008000, |
1064 |
+ RIS0_FRF16 = 0x00010000, |
1065 |
+ RIS0_FRF17 = 0x00020000, |
1066 |
++ RIS0_RESERVED = GENMASK(31, 18), |
1067 |
+ }; |
1068 |
+ |
1069 |
+ /* RIC1 */ |
1070 |
+@@ -531,6 +533,7 @@ enum RIS2_BIT { |
1071 |
+ RIS2_QFF16 = 0x00010000, |
1072 |
+ RIS2_QFF17 = 0x00020000, |
1073 |
+ RIS2_RFFF = 0x80000000, |
1074 |
++ RIS2_RESERVED = GENMASK(30, 18), |
1075 |
+ }; |
1076 |
+ |
1077 |
+ /* TIC */ |
1078 |
+@@ -547,6 +550,7 @@ enum TIS_BIT { |
1079 |
+ TIS_FTF1 = 0x00000002, /* Undocumented? */ |
1080 |
+ TIS_TFUF = 0x00000100, |
1081 |
+ TIS_TFWF = 0x00000200, |
1082 |
++ TIS_RESERVED = (GENMASK(31, 20) | GENMASK(15, 12) | GENMASK(7, 4)) |
1083 |
+ }; |
1084 |
+ |
1085 |
+ /* ISS */ |
1086 |
+@@ -620,6 +624,7 @@ enum GIC_BIT { |
1087 |
+ enum GIS_BIT { |
1088 |
+ GIS_PTCF = 0x00000001, /* Undocumented? */ |
1089 |
+ GIS_PTMF = 0x00000004, |
1090 |
++ GIS_RESERVED = GENMASK(15, 10), |
1091 |
+ }; |
1092 |
+ |
1093 |
+ /* GIE (R-Car Gen3 only) */ |
1094 |
+diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c |
1095 |
+index 0d811c02ff34..db4e306ca996 100644 |
1096 |
+--- a/drivers/net/ethernet/renesas/ravb_main.c |
1097 |
++++ b/drivers/net/ethernet/renesas/ravb_main.c |
1098 |
+@@ -742,10 +742,11 @@ static void ravb_error_interrupt(struct net_device *ndev) |
1099 |
+ u32 eis, ris2; |
1100 |
+ |
1101 |
+ eis = ravb_read(ndev, EIS); |
1102 |
+- ravb_write(ndev, ~EIS_QFS, EIS); |
1103 |
++ ravb_write(ndev, ~(EIS_QFS | EIS_RESERVED), EIS); |
1104 |
+ if (eis & EIS_QFS) { |
1105 |
+ ris2 = ravb_read(ndev, RIS2); |
1106 |
+- ravb_write(ndev, ~(RIS2_QFF0 | RIS2_RFFF), RIS2); |
1107 |
++ ravb_write(ndev, ~(RIS2_QFF0 | RIS2_RFFF | RIS2_RESERVED), |
1108 |
++ RIS2); |
1109 |
+ |
1110 |
+ /* Receive Descriptor Empty int */ |
1111 |
+ if (ris2 & RIS2_QFF0) |
1112 |
+@@ -798,7 +799,7 @@ static bool ravb_timestamp_interrupt(struct net_device *ndev) |
1113 |
+ u32 tis = ravb_read(ndev, TIS); |
1114 |
+ |
1115 |
+ if (tis & TIS_TFUF) { |
1116 |
+- ravb_write(ndev, ~TIS_TFUF, TIS); |
1117 |
++ ravb_write(ndev, ~(TIS_TFUF | TIS_RESERVED), TIS); |
1118 |
+ ravb_get_tx_tstamp(ndev); |
1119 |
+ return true; |
1120 |
+ } |
1121 |
+@@ -933,7 +934,7 @@ static int ravb_poll(struct napi_struct *napi, int budget) |
1122 |
+ /* Processing RX Descriptor Ring */ |
1123 |
+ if (ris0 & mask) { |
1124 |
+ /* Clear RX interrupt */ |
1125 |
+- ravb_write(ndev, ~mask, RIS0); |
1126 |
++ ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); |
1127 |
+ if (ravb_rx(ndev, "a, q)) |
1128 |
+ goto out; |
1129 |
+ } |
1130 |
+@@ -941,7 +942,7 @@ static int ravb_poll(struct napi_struct *napi, int budget) |
1131 |
+ if (tis & mask) { |
1132 |
+ spin_lock_irqsave(&priv->lock, flags); |
1133 |
+ /* Clear TX interrupt */ |
1134 |
+- ravb_write(ndev, ~mask, TIS); |
1135 |
++ ravb_write(ndev, ~(mask | TIS_RESERVED), TIS); |
1136 |
+ ravb_tx_free(ndev, q, true); |
1137 |
+ netif_wake_subqueue(ndev, q); |
1138 |
+ mmiowb(); |
1139 |
+diff --git a/drivers/net/ethernet/renesas/ravb_ptp.c b/drivers/net/ethernet/renesas/ravb_ptp.c |
1140 |
+index eede70ec37f8..9e3222fd69f9 100644 |
1141 |
+--- a/drivers/net/ethernet/renesas/ravb_ptp.c |
1142 |
++++ b/drivers/net/ethernet/renesas/ravb_ptp.c |
1143 |
+@@ -319,7 +319,7 @@ void ravb_ptp_interrupt(struct net_device *ndev) |
1144 |
+ } |
1145 |
+ } |
1146 |
+ |
1147 |
+- ravb_write(ndev, ~gis, GIS); |
1148 |
++ ravb_write(ndev, ~(gis | GIS_RESERVED), GIS); |
1149 |
+ } |
1150 |
+ |
1151 |
+ void ravb_ptp_init(struct net_device *ndev, struct platform_device *pdev) |
1152 |
+diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c |
1153 |
+index 778c4f76a884..2153956a0b20 100644 |
1154 |
+--- a/drivers/pci/controller/dwc/pcie-designware.c |
1155 |
++++ b/drivers/pci/controller/dwc/pcie-designware.c |
1156 |
+@@ -135,7 +135,7 @@ static void dw_pcie_prog_outbound_atu_unroll(struct dw_pcie *pci, int index, |
1157 |
+ if (val & PCIE_ATU_ENABLE) |
1158 |
+ return; |
1159 |
+ |
1160 |
+- usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX); |
1161 |
++ mdelay(LINK_WAIT_IATU); |
1162 |
+ } |
1163 |
+ dev_err(pci->dev, "Outbound iATU is not being enabled\n"); |
1164 |
+ } |
1165 |
+@@ -178,7 +178,7 @@ void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, |
1166 |
+ if (val & PCIE_ATU_ENABLE) |
1167 |
+ return; |
1168 |
+ |
1169 |
+- usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX); |
1170 |
++ mdelay(LINK_WAIT_IATU); |
1171 |
+ } |
1172 |
+ dev_err(pci->dev, "Outbound iATU is not being enabled\n"); |
1173 |
+ } |
1174 |
+@@ -236,7 +236,7 @@ static int dw_pcie_prog_inbound_atu_unroll(struct dw_pcie *pci, int index, |
1175 |
+ if (val & PCIE_ATU_ENABLE) |
1176 |
+ return 0; |
1177 |
+ |
1178 |
+- usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX); |
1179 |
++ mdelay(LINK_WAIT_IATU); |
1180 |
+ } |
1181 |
+ dev_err(pci->dev, "Inbound iATU is not being enabled\n"); |
1182 |
+ |
1183 |
+@@ -282,7 +282,7 @@ int dw_pcie_prog_inbound_atu(struct dw_pcie *pci, int index, int bar, |
1184 |
+ if (val & PCIE_ATU_ENABLE) |
1185 |
+ return 0; |
1186 |
+ |
1187 |
+- usleep_range(LINK_WAIT_IATU_MIN, LINK_WAIT_IATU_MAX); |
1188 |
++ mdelay(LINK_WAIT_IATU); |
1189 |
+ } |
1190 |
+ dev_err(pci->dev, "Inbound iATU is not being enabled\n"); |
1191 |
+ |
1192 |
+diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h |
1193 |
+index bee4e2535a61..b99d1d72dd12 100644 |
1194 |
+--- a/drivers/pci/controller/dwc/pcie-designware.h |
1195 |
++++ b/drivers/pci/controller/dwc/pcie-designware.h |
1196 |
+@@ -26,8 +26,7 @@ |
1197 |
+ |
1198 |
+ /* Parameters for the waiting for iATU enabled routine */ |
1199 |
+ #define LINK_WAIT_MAX_IATU_RETRIES 5 |
1200 |
+-#define LINK_WAIT_IATU_MIN 9000 |
1201 |
+-#define LINK_WAIT_IATU_MAX 10000 |
1202 |
++#define LINK_WAIT_IATU 9 |
1203 |
+ |
1204 |
+ /* Synopsys-specific PCIe configuration registers */ |
1205 |
+ #define PCIE_PORT_LINK_CONTROL 0x710 |
1206 |
+diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c |
1207 |
+index b91db89eb924..d3ba867d01f0 100644 |
1208 |
+--- a/drivers/pinctrl/pinctrl-amd.c |
1209 |
++++ b/drivers/pinctrl/pinctrl-amd.c |
1210 |
+@@ -348,21 +348,12 @@ static void amd_gpio_irq_enable(struct irq_data *d) |
1211 |
+ unsigned long flags; |
1212 |
+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
1213 |
+ struct amd_gpio *gpio_dev = gpiochip_get_data(gc); |
1214 |
+- u32 mask = BIT(INTERRUPT_ENABLE_OFF) | BIT(INTERRUPT_MASK_OFF); |
1215 |
+ |
1216 |
+ raw_spin_lock_irqsave(&gpio_dev->lock, flags); |
1217 |
+ pin_reg = readl(gpio_dev->base + (d->hwirq)*4); |
1218 |
+ pin_reg |= BIT(INTERRUPT_ENABLE_OFF); |
1219 |
+ pin_reg |= BIT(INTERRUPT_MASK_OFF); |
1220 |
+ writel(pin_reg, gpio_dev->base + (d->hwirq)*4); |
1221 |
+- /* |
1222 |
+- * When debounce logic is enabled it takes ~900 us before interrupts |
1223 |
+- * can be enabled. During this "debounce warm up" period the |
1224 |
+- * "INTERRUPT_ENABLE" bit will read as 0. Poll the bit here until it |
1225 |
+- * reads back as 1, signaling that interrupts are now enabled. |
1226 |
+- */ |
1227 |
+- while ((readl(gpio_dev->base + (d->hwirq)*4) & mask) != mask) |
1228 |
+- continue; |
1229 |
+ raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); |
1230 |
+ } |
1231 |
+ |
1232 |
+@@ -426,7 +417,7 @@ static void amd_gpio_irq_eoi(struct irq_data *d) |
1233 |
+ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type) |
1234 |
+ { |
1235 |
+ int ret = 0; |
1236 |
+- u32 pin_reg; |
1237 |
++ u32 pin_reg, pin_reg_irq_en, mask; |
1238 |
+ unsigned long flags, irq_flags; |
1239 |
+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
1240 |
+ struct amd_gpio *gpio_dev = gpiochip_get_data(gc); |
1241 |
+@@ -495,6 +486,28 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type) |
1242 |
+ } |
1243 |
+ |
1244 |
+ pin_reg |= CLR_INTR_STAT << INTERRUPT_STS_OFF; |
1245 |
++ /* |
1246 |
++ * If WAKE_INT_MASTER_REG.MaskStsEn is set, a software write to the |
1247 |
++ * debounce registers of any GPIO will block wake/interrupt status |
1248 |
++ * generation for *all* GPIOs for a lenght of time that depends on |
1249 |
++ * WAKE_INT_MASTER_REG.MaskStsLength[11:0]. During this period the |
1250 |
++ * INTERRUPT_ENABLE bit will read as 0. |
1251 |
++ * |
1252 |
++ * We temporarily enable irq for the GPIO whose configuration is |
1253 |
++ * changing, and then wait for it to read back as 1 to know when |
1254 |
++ * debounce has settled and then disable the irq again. |
1255 |
++ * We do this polling with the spinlock held to ensure other GPIO |
1256 |
++ * access routines do not read an incorrect value for the irq enable |
1257 |
++ * bit of other GPIOs. We keep the GPIO masked while polling to avoid |
1258 |
++ * spurious irqs, and disable the irq again after polling. |
1259 |
++ */ |
1260 |
++ mask = BIT(INTERRUPT_ENABLE_OFF); |
1261 |
++ pin_reg_irq_en = pin_reg; |
1262 |
++ pin_reg_irq_en |= mask; |
1263 |
++ pin_reg_irq_en &= ~BIT(INTERRUPT_MASK_OFF); |
1264 |
++ writel(pin_reg_irq_en, gpio_dev->base + (d->hwirq)*4); |
1265 |
++ while ((readl(gpio_dev->base + (d->hwirq)*4) & mask) != mask) |
1266 |
++ continue; |
1267 |
+ writel(pin_reg, gpio_dev->base + (d->hwirq)*4); |
1268 |
+ raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); |
1269 |
+ |
1270 |
+diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c |
1271 |
+index c3a76af9f5fa..ada1ebebd325 100644 |
1272 |
+--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c |
1273 |
++++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c |
1274 |
+@@ -3475,11 +3475,10 @@ static int ibmvscsis_probe(struct vio_dev *vdev, |
1275 |
+ vscsi->dds.window[LOCAL].liobn, |
1276 |
+ vscsi->dds.window[REMOTE].liobn); |
1277 |
+ |
1278 |
+- strcpy(vscsi->eye, "VSCSI "); |
1279 |
+- strncat(vscsi->eye, vdev->name, MAX_EYE); |
1280 |
++ snprintf(vscsi->eye, sizeof(vscsi->eye), "VSCSI %s", vdev->name); |
1281 |
+ |
1282 |
+ vscsi->dds.unit_id = vdev->unit_address; |
1283 |
+- strncpy(vscsi->dds.partition_name, partition_name, |
1284 |
++ strscpy(vscsi->dds.partition_name, partition_name, |
1285 |
+ sizeof(vscsi->dds.partition_name)); |
1286 |
+ vscsi->dds.partition_num = partition_number; |
1287 |
+ |
1288 |
+diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c |
1289 |
+index 02d65dce74e5..2e8a91341254 100644 |
1290 |
+--- a/drivers/scsi/ipr.c |
1291 |
++++ b/drivers/scsi/ipr.c |
1292 |
+@@ -3310,6 +3310,65 @@ static void ipr_release_dump(struct kref *kref) |
1293 |
+ LEAVE; |
1294 |
+ } |
1295 |
+ |
1296 |
++static void ipr_add_remove_thread(struct work_struct *work) |
1297 |
++{ |
1298 |
++ unsigned long lock_flags; |
1299 |
++ struct ipr_resource_entry *res; |
1300 |
++ struct scsi_device *sdev; |
1301 |
++ struct ipr_ioa_cfg *ioa_cfg = |
1302 |
++ container_of(work, struct ipr_ioa_cfg, scsi_add_work_q); |
1303 |
++ u8 bus, target, lun; |
1304 |
++ int did_work; |
1305 |
++ |
1306 |
++ ENTER; |
1307 |
++ spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
1308 |
++ |
1309 |
++restart: |
1310 |
++ do { |
1311 |
++ did_work = 0; |
1312 |
++ if (!ioa_cfg->hrrq[IPR_INIT_HRRQ].allow_cmds) { |
1313 |
++ spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
1314 |
++ return; |
1315 |
++ } |
1316 |
++ |
1317 |
++ list_for_each_entry(res, &ioa_cfg->used_res_q, queue) { |
1318 |
++ if (res->del_from_ml && res->sdev) { |
1319 |
++ did_work = 1; |
1320 |
++ sdev = res->sdev; |
1321 |
++ if (!scsi_device_get(sdev)) { |
1322 |
++ if (!res->add_to_ml) |
1323 |
++ list_move_tail(&res->queue, &ioa_cfg->free_res_q); |
1324 |
++ else |
1325 |
++ res->del_from_ml = 0; |
1326 |
++ spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
1327 |
++ scsi_remove_device(sdev); |
1328 |
++ scsi_device_put(sdev); |
1329 |
++ spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
1330 |
++ } |
1331 |
++ break; |
1332 |
++ } |
1333 |
++ } |
1334 |
++ } while (did_work); |
1335 |
++ |
1336 |
++ list_for_each_entry(res, &ioa_cfg->used_res_q, queue) { |
1337 |
++ if (res->add_to_ml) { |
1338 |
++ bus = res->bus; |
1339 |
++ target = res->target; |
1340 |
++ lun = res->lun; |
1341 |
++ res->add_to_ml = 0; |
1342 |
++ spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
1343 |
++ scsi_add_device(ioa_cfg->host, bus, target, lun); |
1344 |
++ spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
1345 |
++ goto restart; |
1346 |
++ } |
1347 |
++ } |
1348 |
++ |
1349 |
++ ioa_cfg->scan_done = 1; |
1350 |
++ spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
1351 |
++ kobject_uevent(&ioa_cfg->host->shost_dev.kobj, KOBJ_CHANGE); |
1352 |
++ LEAVE; |
1353 |
++} |
1354 |
++ |
1355 |
+ /** |
1356 |
+ * ipr_worker_thread - Worker thread |
1357 |
+ * @work: ioa config struct |
1358 |
+@@ -3324,13 +3383,9 @@ static void ipr_release_dump(struct kref *kref) |
1359 |
+ static void ipr_worker_thread(struct work_struct *work) |
1360 |
+ { |
1361 |
+ unsigned long lock_flags; |
1362 |
+- struct ipr_resource_entry *res; |
1363 |
+- struct scsi_device *sdev; |
1364 |
+ struct ipr_dump *dump; |
1365 |
+ struct ipr_ioa_cfg *ioa_cfg = |
1366 |
+ container_of(work, struct ipr_ioa_cfg, work_q); |
1367 |
+- u8 bus, target, lun; |
1368 |
+- int did_work; |
1369 |
+ |
1370 |
+ ENTER; |
1371 |
+ spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
1372 |
+@@ -3368,49 +3423,9 @@ static void ipr_worker_thread(struct work_struct *work) |
1373 |
+ return; |
1374 |
+ } |
1375 |
+ |
1376 |
+-restart: |
1377 |
+- do { |
1378 |
+- did_work = 0; |
1379 |
+- if (!ioa_cfg->hrrq[IPR_INIT_HRRQ].allow_cmds) { |
1380 |
+- spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
1381 |
+- return; |
1382 |
+- } |
1383 |
++ schedule_work(&ioa_cfg->scsi_add_work_q); |
1384 |
+ |
1385 |
+- list_for_each_entry(res, &ioa_cfg->used_res_q, queue) { |
1386 |
+- if (res->del_from_ml && res->sdev) { |
1387 |
+- did_work = 1; |
1388 |
+- sdev = res->sdev; |
1389 |
+- if (!scsi_device_get(sdev)) { |
1390 |
+- if (!res->add_to_ml) |
1391 |
+- list_move_tail(&res->queue, &ioa_cfg->free_res_q); |
1392 |
+- else |
1393 |
+- res->del_from_ml = 0; |
1394 |
+- spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
1395 |
+- scsi_remove_device(sdev); |
1396 |
+- scsi_device_put(sdev); |
1397 |
+- spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
1398 |
+- } |
1399 |
+- break; |
1400 |
+- } |
1401 |
+- } |
1402 |
+- } while (did_work); |
1403 |
+- |
1404 |
+- list_for_each_entry(res, &ioa_cfg->used_res_q, queue) { |
1405 |
+- if (res->add_to_ml) { |
1406 |
+- bus = res->bus; |
1407 |
+- target = res->target; |
1408 |
+- lun = res->lun; |
1409 |
+- res->add_to_ml = 0; |
1410 |
+- spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
1411 |
+- scsi_add_device(ioa_cfg->host, bus, target, lun); |
1412 |
+- spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
1413 |
+- goto restart; |
1414 |
+- } |
1415 |
+- } |
1416 |
+- |
1417 |
+- ioa_cfg->scan_done = 1; |
1418 |
+ spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
1419 |
+- kobject_uevent(&ioa_cfg->host->shost_dev.kobj, KOBJ_CHANGE); |
1420 |
+ LEAVE; |
1421 |
+ } |
1422 |
+ |
1423 |
+@@ -9908,6 +9923,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, |
1424 |
+ INIT_LIST_HEAD(&ioa_cfg->free_res_q); |
1425 |
+ INIT_LIST_HEAD(&ioa_cfg->used_res_q); |
1426 |
+ INIT_WORK(&ioa_cfg->work_q, ipr_worker_thread); |
1427 |
++ INIT_WORK(&ioa_cfg->scsi_add_work_q, ipr_add_remove_thread); |
1428 |
+ init_waitqueue_head(&ioa_cfg->reset_wait_q); |
1429 |
+ init_waitqueue_head(&ioa_cfg->msi_wait_q); |
1430 |
+ init_waitqueue_head(&ioa_cfg->eeh_wait_q); |
1431 |
+diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h |
1432 |
+index 93570734cbfb..a98cfd24035a 100644 |
1433 |
+--- a/drivers/scsi/ipr.h |
1434 |
++++ b/drivers/scsi/ipr.h |
1435 |
+@@ -1568,6 +1568,7 @@ struct ipr_ioa_cfg { |
1436 |
+ u8 saved_mode_page_len; |
1437 |
+ |
1438 |
+ struct work_struct work_q; |
1439 |
++ struct work_struct scsi_add_work_q; |
1440 |
+ struct workqueue_struct *reset_work_q; |
1441 |
+ |
1442 |
+ wait_queue_head_t reset_wait_q; |
1443 |
+diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c |
1444 |
+index 729d343861f4..de64cbb0e3d5 100644 |
1445 |
+--- a/drivers/scsi/lpfc/lpfc_attr.c |
1446 |
++++ b/drivers/scsi/lpfc/lpfc_attr.c |
1447 |
+@@ -320,12 +320,12 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, |
1448 |
+ localport->port_id, statep); |
1449 |
+ |
1450 |
+ list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { |
1451 |
++ nrport = NULL; |
1452 |
++ spin_lock(&vport->phba->hbalock); |
1453 |
+ rport = lpfc_ndlp_get_nrport(ndlp); |
1454 |
+- if (!rport) |
1455 |
+- continue; |
1456 |
+- |
1457 |
+- /* local short-hand pointer. */ |
1458 |
+- nrport = rport->remoteport; |
1459 |
++ if (rport) |
1460 |
++ nrport = rport->remoteport; |
1461 |
++ spin_unlock(&vport->phba->hbalock); |
1462 |
+ if (!nrport) |
1463 |
+ continue; |
1464 |
+ |
1465 |
+@@ -3304,6 +3304,7 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) |
1466 |
+ struct lpfc_nodelist *ndlp; |
1467 |
+ #if (IS_ENABLED(CONFIG_NVME_FC)) |
1468 |
+ struct lpfc_nvme_rport *rport; |
1469 |
++ struct nvme_fc_remote_port *remoteport = NULL; |
1470 |
+ #endif |
1471 |
+ |
1472 |
+ shost = lpfc_shost_from_vport(vport); |
1473 |
+@@ -3314,8 +3315,12 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) |
1474 |
+ if (ndlp->rport) |
1475 |
+ ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; |
1476 |
+ #if (IS_ENABLED(CONFIG_NVME_FC)) |
1477 |
++ spin_lock(&vport->phba->hbalock); |
1478 |
+ rport = lpfc_ndlp_get_nrport(ndlp); |
1479 |
+ if (rport) |
1480 |
++ remoteport = rport->remoteport; |
1481 |
++ spin_unlock(&vport->phba->hbalock); |
1482 |
++ if (remoteport) |
1483 |
+ nvme_fc_set_remoteport_devloss(rport->remoteport, |
1484 |
+ vport->cfg_devloss_tmo); |
1485 |
+ #endif |
1486 |
+diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c |
1487 |
+index 9df0c051349f..aec5b10a8c85 100644 |
1488 |
+--- a/drivers/scsi/lpfc/lpfc_debugfs.c |
1489 |
++++ b/drivers/scsi/lpfc/lpfc_debugfs.c |
1490 |
+@@ -551,7 +551,7 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) |
1491 |
+ unsigned char *statep; |
1492 |
+ struct nvme_fc_local_port *localport; |
1493 |
+ struct lpfc_nvmet_tgtport *tgtp; |
1494 |
+- struct nvme_fc_remote_port *nrport; |
1495 |
++ struct nvme_fc_remote_port *nrport = NULL; |
1496 |
+ struct lpfc_nvme_rport *rport; |
1497 |
+ |
1498 |
+ cnt = (LPFC_NODELIST_SIZE / LPFC_NODELIST_ENTRY_SIZE); |
1499 |
+@@ -696,11 +696,11 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) |
1500 |
+ len += snprintf(buf + len, size - len, "\tRport List:\n"); |
1501 |
+ list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { |
1502 |
+ /* local short-hand pointer. */ |
1503 |
++ spin_lock(&phba->hbalock); |
1504 |
+ rport = lpfc_ndlp_get_nrport(ndlp); |
1505 |
+- if (!rport) |
1506 |
+- continue; |
1507 |
+- |
1508 |
+- nrport = rport->remoteport; |
1509 |
++ if (rport) |
1510 |
++ nrport = rport->remoteport; |
1511 |
++ spin_unlock(&phba->hbalock); |
1512 |
+ if (!nrport) |
1513 |
+ continue; |
1514 |
+ |
1515 |
+diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c |
1516 |
+index cab1fb087e6a..0960dcaf1684 100644 |
1517 |
+--- a/drivers/scsi/lpfc/lpfc_nvme.c |
1518 |
++++ b/drivers/scsi/lpfc/lpfc_nvme.c |
1519 |
+@@ -2718,7 +2718,9 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
1520 |
+ rpinfo.port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn); |
1521 |
+ rpinfo.node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn); |
1522 |
+ |
1523 |
++ spin_lock_irq(&vport->phba->hbalock); |
1524 |
+ oldrport = lpfc_ndlp_get_nrport(ndlp); |
1525 |
++ spin_unlock_irq(&vport->phba->hbalock); |
1526 |
+ if (!oldrport) |
1527 |
+ lpfc_nlp_get(ndlp); |
1528 |
+ |
1529 |
+@@ -2833,7 +2835,7 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
1530 |
+ struct nvme_fc_local_port *localport; |
1531 |
+ struct lpfc_nvme_lport *lport; |
1532 |
+ struct lpfc_nvme_rport *rport; |
1533 |
+- struct nvme_fc_remote_port *remoteport; |
1534 |
++ struct nvme_fc_remote_port *remoteport = NULL; |
1535 |
+ |
1536 |
+ localport = vport->localport; |
1537 |
+ |
1538 |
+@@ -2847,11 +2849,14 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
1539 |
+ if (!lport) |
1540 |
+ goto input_err; |
1541 |
+ |
1542 |
++ spin_lock_irq(&vport->phba->hbalock); |
1543 |
+ rport = lpfc_ndlp_get_nrport(ndlp); |
1544 |
+- if (!rport) |
1545 |
++ if (rport) |
1546 |
++ remoteport = rport->remoteport; |
1547 |
++ spin_unlock_irq(&vport->phba->hbalock); |
1548 |
++ if (!remoteport) |
1549 |
+ goto input_err; |
1550 |
+ |
1551 |
+- remoteport = rport->remoteport; |
1552 |
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, |
1553 |
+ "6033 Unreg nvme remoteport %p, portname x%llx, " |
1554 |
+ "port_id x%06x, portstate x%x port type x%x\n", |
1555 |
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c |
1556 |
+index 9421d9877730..0949d3db56e7 100644 |
1557 |
+--- a/drivers/scsi/sd.c |
1558 |
++++ b/drivers/scsi/sd.c |
1559 |
+@@ -1277,7 +1277,8 @@ static int sd_init_command(struct scsi_cmnd *cmd) |
1560 |
+ case REQ_OP_ZONE_RESET: |
1561 |
+ return sd_zbc_setup_reset_cmnd(cmd); |
1562 |
+ default: |
1563 |
+- BUG(); |
1564 |
++ WARN_ON_ONCE(1); |
1565 |
++ return BLKPREP_KILL; |
1566 |
+ } |
1567 |
+ } |
1568 |
+ |
1569 |
+diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c |
1570 |
+index 4b5e250e8615..e5c7e1ef6318 100644 |
1571 |
+--- a/drivers/soundwire/stream.c |
1572 |
++++ b/drivers/soundwire/stream.c |
1573 |
+@@ -899,9 +899,10 @@ static void sdw_release_master_stream(struct sdw_stream_runtime *stream) |
1574 |
+ struct sdw_master_runtime *m_rt = stream->m_rt; |
1575 |
+ struct sdw_slave_runtime *s_rt, *_s_rt; |
1576 |
+ |
1577 |
+- list_for_each_entry_safe(s_rt, _s_rt, |
1578 |
+- &m_rt->slave_rt_list, m_rt_node) |
1579 |
+- sdw_stream_remove_slave(s_rt->slave, stream); |
1580 |
++ list_for_each_entry_safe(s_rt, _s_rt, &m_rt->slave_rt_list, m_rt_node) { |
1581 |
++ sdw_slave_port_release(s_rt->slave->bus, s_rt->slave, stream); |
1582 |
++ sdw_release_slave_stream(s_rt->slave, stream); |
1583 |
++ } |
1584 |
+ |
1585 |
+ list_del(&m_rt->bus_node); |
1586 |
+ } |
1587 |
+@@ -1112,7 +1113,7 @@ int sdw_stream_add_master(struct sdw_bus *bus, |
1588 |
+ "Master runtime config failed for stream:%s", |
1589 |
+ stream->name); |
1590 |
+ ret = -ENOMEM; |
1591 |
+- goto error; |
1592 |
++ goto unlock; |
1593 |
+ } |
1594 |
+ |
1595 |
+ ret = sdw_config_stream(bus->dev, stream, stream_config, false); |
1596 |
+@@ -1123,11 +1124,11 @@ int sdw_stream_add_master(struct sdw_bus *bus, |
1597 |
+ if (ret) |
1598 |
+ goto stream_error; |
1599 |
+ |
1600 |
+- stream->state = SDW_STREAM_CONFIGURED; |
1601 |
++ goto unlock; |
1602 |
+ |
1603 |
+ stream_error: |
1604 |
+ sdw_release_master_stream(stream); |
1605 |
+-error: |
1606 |
++unlock: |
1607 |
+ mutex_unlock(&bus->bus_lock); |
1608 |
+ return ret; |
1609 |
+ } |
1610 |
+@@ -1141,6 +1142,10 @@ EXPORT_SYMBOL(sdw_stream_add_master); |
1611 |
+ * @stream: SoundWire stream |
1612 |
+ * @port_config: Port configuration for audio stream |
1613 |
+ * @num_ports: Number of ports |
1614 |
++ * |
1615 |
++ * It is expected that Slave is added before adding Master |
1616 |
++ * to the Stream. |
1617 |
++ * |
1618 |
+ */ |
1619 |
+ int sdw_stream_add_slave(struct sdw_slave *slave, |
1620 |
+ struct sdw_stream_config *stream_config, |
1621 |
+@@ -1186,6 +1191,12 @@ int sdw_stream_add_slave(struct sdw_slave *slave, |
1622 |
+ if (ret) |
1623 |
+ goto stream_error; |
1624 |
+ |
1625 |
++ /* |
1626 |
++ * Change stream state to CONFIGURED on first Slave add. |
1627 |
++ * Bus is not aware of number of Slave(s) in a stream at this |
1628 |
++ * point so cannot depend on all Slave(s) to be added in order to |
1629 |
++ * change stream state to CONFIGURED. |
1630 |
++ */ |
1631 |
+ stream->state = SDW_STREAM_CONFIGURED; |
1632 |
+ goto error; |
1633 |
+ |
1634 |
+diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c |
1635 |
+index 6ae92d4dca19..3b518ead504e 100644 |
1636 |
+--- a/drivers/spi/spi-gpio.c |
1637 |
++++ b/drivers/spi/spi-gpio.c |
1638 |
+@@ -287,8 +287,8 @@ static int spi_gpio_request(struct device *dev, |
1639 |
+ *mflags |= SPI_MASTER_NO_RX; |
1640 |
+ |
1641 |
+ spi_gpio->sck = devm_gpiod_get(dev, "sck", GPIOD_OUT_LOW); |
1642 |
+- if (IS_ERR(spi_gpio->mosi)) |
1643 |
+- return PTR_ERR(spi_gpio->mosi); |
1644 |
++ if (IS_ERR(spi_gpio->sck)) |
1645 |
++ return PTR_ERR(spi_gpio->sck); |
1646 |
+ |
1647 |
+ for (i = 0; i < num_chipselects; i++) { |
1648 |
+ spi_gpio->cs_gpios[i] = devm_gpiod_get_index(dev, "cs", |
1649 |
+diff --git a/fs/namespace.c b/fs/namespace.c |
1650 |
+index 1949e0939d40..bd2f4c68506a 100644 |
1651 |
+--- a/fs/namespace.c |
1652 |
++++ b/fs/namespace.c |
1653 |
+@@ -446,10 +446,10 @@ int mnt_want_write_file_path(struct file *file) |
1654 |
+ { |
1655 |
+ int ret; |
1656 |
+ |
1657 |
+- sb_start_write(file_inode(file)->i_sb); |
1658 |
++ sb_start_write(file->f_path.mnt->mnt_sb); |
1659 |
+ ret = __mnt_want_write_file(file); |
1660 |
+ if (ret) |
1661 |
+- sb_end_write(file_inode(file)->i_sb); |
1662 |
++ sb_end_write(file->f_path.mnt->mnt_sb); |
1663 |
+ return ret; |
1664 |
+ } |
1665 |
+ |
1666 |
+@@ -540,8 +540,7 @@ void __mnt_drop_write_file(struct file *file) |
1667 |
+ |
1668 |
+ void mnt_drop_write_file_path(struct file *file) |
1669 |
+ { |
1670 |
+- __mnt_drop_write_file(file); |
1671 |
+- sb_end_write(file_inode(file)->i_sb); |
1672 |
++ mnt_drop_write(file->f_path.mnt); |
1673 |
+ } |
1674 |
+ |
1675 |
+ void mnt_drop_write_file(struct file *file) |
1676 |
+diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h |
1677 |
+index a8a126259bc4..0bec79ae4c2d 100644 |
1678 |
+--- a/include/linux/huge_mm.h |
1679 |
++++ b/include/linux/huge_mm.h |
1680 |
+@@ -42,7 +42,7 @@ extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, |
1681 |
+ unsigned char *vec); |
1682 |
+ extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, |
1683 |
+ unsigned long new_addr, unsigned long old_end, |
1684 |
+- pmd_t *old_pmd, pmd_t *new_pmd, bool *need_flush); |
1685 |
++ pmd_t *old_pmd, pmd_t *new_pmd); |
1686 |
+ extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, |
1687 |
+ unsigned long addr, pgprot_t newprot, |
1688 |
+ int prot_numa); |
1689 |
+diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c |
1690 |
+index f833a60699ad..e60078ffb302 100644 |
1691 |
+--- a/kernel/bpf/sockmap.c |
1692 |
++++ b/kernel/bpf/sockmap.c |
1693 |
+@@ -132,6 +132,7 @@ struct smap_psock { |
1694 |
+ struct work_struct gc_work; |
1695 |
+ |
1696 |
+ struct proto *sk_proto; |
1697 |
++ void (*save_unhash)(struct sock *sk); |
1698 |
+ void (*save_close)(struct sock *sk, long timeout); |
1699 |
+ void (*save_data_ready)(struct sock *sk); |
1700 |
+ void (*save_write_space)(struct sock *sk); |
1701 |
+@@ -143,6 +144,7 @@ static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, |
1702 |
+ static int bpf_tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size); |
1703 |
+ static int bpf_tcp_sendpage(struct sock *sk, struct page *page, |
1704 |
+ int offset, size_t size, int flags); |
1705 |
++static void bpf_tcp_unhash(struct sock *sk); |
1706 |
+ static void bpf_tcp_close(struct sock *sk, long timeout); |
1707 |
+ |
1708 |
+ static inline struct smap_psock *smap_psock_sk(const struct sock *sk) |
1709 |
+@@ -184,6 +186,7 @@ static void build_protos(struct proto prot[SOCKMAP_NUM_CONFIGS], |
1710 |
+ struct proto *base) |
1711 |
+ { |
1712 |
+ prot[SOCKMAP_BASE] = *base; |
1713 |
++ prot[SOCKMAP_BASE].unhash = bpf_tcp_unhash; |
1714 |
+ prot[SOCKMAP_BASE].close = bpf_tcp_close; |
1715 |
+ prot[SOCKMAP_BASE].recvmsg = bpf_tcp_recvmsg; |
1716 |
+ prot[SOCKMAP_BASE].stream_memory_read = bpf_tcp_stream_read; |
1717 |
+@@ -217,6 +220,7 @@ static int bpf_tcp_init(struct sock *sk) |
1718 |
+ return -EBUSY; |
1719 |
+ } |
1720 |
+ |
1721 |
++ psock->save_unhash = sk->sk_prot->unhash; |
1722 |
+ psock->save_close = sk->sk_prot->close; |
1723 |
+ psock->sk_proto = sk->sk_prot; |
1724 |
+ |
1725 |
+@@ -305,30 +309,12 @@ static struct smap_psock_map_entry *psock_map_pop(struct sock *sk, |
1726 |
+ return e; |
1727 |
+ } |
1728 |
+ |
1729 |
+-static void bpf_tcp_close(struct sock *sk, long timeout) |
1730 |
++static void bpf_tcp_remove(struct sock *sk, struct smap_psock *psock) |
1731 |
+ { |
1732 |
+- void (*close_fun)(struct sock *sk, long timeout); |
1733 |
+ struct smap_psock_map_entry *e; |
1734 |
+ struct sk_msg_buff *md, *mtmp; |
1735 |
+- struct smap_psock *psock; |
1736 |
+ struct sock *osk; |
1737 |
+ |
1738 |
+- lock_sock(sk); |
1739 |
+- rcu_read_lock(); |
1740 |
+- psock = smap_psock_sk(sk); |
1741 |
+- if (unlikely(!psock)) { |
1742 |
+- rcu_read_unlock(); |
1743 |
+- release_sock(sk); |
1744 |
+- return sk->sk_prot->close(sk, timeout); |
1745 |
+- } |
1746 |
+- |
1747 |
+- /* The psock may be destroyed anytime after exiting the RCU critial |
1748 |
+- * section so by the time we use close_fun the psock may no longer |
1749 |
+- * be valid. However, bpf_tcp_close is called with the sock lock |
1750 |
+- * held so the close hook and sk are still valid. |
1751 |
+- */ |
1752 |
+- close_fun = psock->save_close; |
1753 |
+- |
1754 |
+ if (psock->cork) { |
1755 |
+ free_start_sg(psock->sock, psock->cork, true); |
1756 |
+ kfree(psock->cork); |
1757 |
+@@ -379,6 +365,42 @@ static void bpf_tcp_close(struct sock *sk, long timeout) |
1758 |
+ kfree(e); |
1759 |
+ e = psock_map_pop(sk, psock); |
1760 |
+ } |
1761 |
++} |
1762 |
++ |
1763 |
++static void bpf_tcp_unhash(struct sock *sk) |
1764 |
++{ |
1765 |
++ void (*unhash_fun)(struct sock *sk); |
1766 |
++ struct smap_psock *psock; |
1767 |
++ |
1768 |
++ rcu_read_lock(); |
1769 |
++ psock = smap_psock_sk(sk); |
1770 |
++ if (unlikely(!psock)) { |
1771 |
++ rcu_read_unlock(); |
1772 |
++ if (sk->sk_prot->unhash) |
1773 |
++ sk->sk_prot->unhash(sk); |
1774 |
++ return; |
1775 |
++ } |
1776 |
++ unhash_fun = psock->save_unhash; |
1777 |
++ bpf_tcp_remove(sk, psock); |
1778 |
++ rcu_read_unlock(); |
1779 |
++ unhash_fun(sk); |
1780 |
++} |
1781 |
++ |
1782 |
++static void bpf_tcp_close(struct sock *sk, long timeout) |
1783 |
++{ |
1784 |
++ void (*close_fun)(struct sock *sk, long timeout); |
1785 |
++ struct smap_psock *psock; |
1786 |
++ |
1787 |
++ lock_sock(sk); |
1788 |
++ rcu_read_lock(); |
1789 |
++ psock = smap_psock_sk(sk); |
1790 |
++ if (unlikely(!psock)) { |
1791 |
++ rcu_read_unlock(); |
1792 |
++ release_sock(sk); |
1793 |
++ return sk->sk_prot->close(sk, timeout); |
1794 |
++ } |
1795 |
++ close_fun = psock->save_close; |
1796 |
++ bpf_tcp_remove(sk, psock); |
1797 |
+ rcu_read_unlock(); |
1798 |
+ release_sock(sk); |
1799 |
+ close_fun(sk, timeout); |
1800 |
+@@ -2100,8 +2122,12 @@ static int sock_map_update_elem(struct bpf_map *map, |
1801 |
+ return -EINVAL; |
1802 |
+ } |
1803 |
+ |
1804 |
++ /* ULPs are currently supported only for TCP sockets in ESTABLISHED |
1805 |
++ * state. |
1806 |
++ */ |
1807 |
+ if (skops.sk->sk_type != SOCK_STREAM || |
1808 |
+- skops.sk->sk_protocol != IPPROTO_TCP) { |
1809 |
++ skops.sk->sk_protocol != IPPROTO_TCP || |
1810 |
++ skops.sk->sk_state != TCP_ESTABLISHED) { |
1811 |
+ fput(socket->file); |
1812 |
+ return -EOPNOTSUPP; |
1813 |
+ } |
1814 |
+@@ -2456,6 +2482,16 @@ static int sock_hash_update_elem(struct bpf_map *map, |
1815 |
+ return -EINVAL; |
1816 |
+ } |
1817 |
+ |
1818 |
++ /* ULPs are currently supported only for TCP sockets in ESTABLISHED |
1819 |
++ * state. |
1820 |
++ */ |
1821 |
++ if (skops.sk->sk_type != SOCK_STREAM || |
1822 |
++ skops.sk->sk_protocol != IPPROTO_TCP || |
1823 |
++ skops.sk->sk_state != TCP_ESTABLISHED) { |
1824 |
++ fput(socket->file); |
1825 |
++ return -EOPNOTSUPP; |
1826 |
++ } |
1827 |
++ |
1828 |
+ lock_sock(skops.sk); |
1829 |
+ preempt_disable(); |
1830 |
+ rcu_read_lock(); |
1831 |
+@@ -2544,10 +2580,22 @@ const struct bpf_map_ops sock_hash_ops = { |
1832 |
+ .map_release_uref = sock_map_release, |
1833 |
+ }; |
1834 |
+ |
1835 |
++static bool bpf_is_valid_sock_op(struct bpf_sock_ops_kern *ops) |
1836 |
++{ |
1837 |
++ return ops->op == BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB || |
1838 |
++ ops->op == BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB; |
1839 |
++} |
1840 |
+ BPF_CALL_4(bpf_sock_map_update, struct bpf_sock_ops_kern *, bpf_sock, |
1841 |
+ struct bpf_map *, map, void *, key, u64, flags) |
1842 |
+ { |
1843 |
+ WARN_ON_ONCE(!rcu_read_lock_held()); |
1844 |
++ |
1845 |
++ /* ULPs are currently supported only for TCP sockets in ESTABLISHED |
1846 |
++ * state. This checks that the sock ops triggering the update is |
1847 |
++ * one indicating we are (or will be soon) in an ESTABLISHED state. |
1848 |
++ */ |
1849 |
++ if (!bpf_is_valid_sock_op(bpf_sock)) |
1850 |
++ return -EOPNOTSUPP; |
1851 |
+ return sock_map_ctx_update_elem(bpf_sock, map, key, flags); |
1852 |
+ } |
1853 |
+ |
1854 |
+@@ -2566,6 +2614,9 @@ BPF_CALL_4(bpf_sock_hash_update, struct bpf_sock_ops_kern *, bpf_sock, |
1855 |
+ struct bpf_map *, map, void *, key, u64, flags) |
1856 |
+ { |
1857 |
+ WARN_ON_ONCE(!rcu_read_lock_held()); |
1858 |
++ |
1859 |
++ if (!bpf_is_valid_sock_op(bpf_sock)) |
1860 |
++ return -EOPNOTSUPP; |
1861 |
+ return sock_hash_ctx_update_elem(bpf_sock, map, key, flags); |
1862 |
+ } |
1863 |
+ |
1864 |
+diff --git a/mm/huge_memory.c b/mm/huge_memory.c |
1865 |
+index f7274e0c8bdc..3238bb2d0c93 100644 |
1866 |
+--- a/mm/huge_memory.c |
1867 |
++++ b/mm/huge_memory.c |
1868 |
+@@ -1778,7 +1778,7 @@ static pmd_t move_soft_dirty_pmd(pmd_t pmd) |
1869 |
+ |
1870 |
+ bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, |
1871 |
+ unsigned long new_addr, unsigned long old_end, |
1872 |
+- pmd_t *old_pmd, pmd_t *new_pmd, bool *need_flush) |
1873 |
++ pmd_t *old_pmd, pmd_t *new_pmd) |
1874 |
+ { |
1875 |
+ spinlock_t *old_ptl, *new_ptl; |
1876 |
+ pmd_t pmd; |
1877 |
+@@ -1809,7 +1809,7 @@ bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, |
1878 |
+ if (new_ptl != old_ptl) |
1879 |
+ spin_lock_nested(new_ptl, SINGLE_DEPTH_NESTING); |
1880 |
+ pmd = pmdp_huge_get_and_clear(mm, old_addr, old_pmd); |
1881 |
+- if (pmd_present(pmd) && pmd_dirty(pmd)) |
1882 |
++ if (pmd_present(pmd)) |
1883 |
+ force_flush = true; |
1884 |
+ VM_BUG_ON(!pmd_none(*new_pmd)); |
1885 |
+ |
1886 |
+@@ -1820,12 +1820,10 @@ bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, |
1887 |
+ } |
1888 |
+ pmd = move_soft_dirty_pmd(pmd); |
1889 |
+ set_pmd_at(mm, new_addr, new_pmd, pmd); |
1890 |
+- if (new_ptl != old_ptl) |
1891 |
+- spin_unlock(new_ptl); |
1892 |
+ if (force_flush) |
1893 |
+ flush_tlb_range(vma, old_addr, old_addr + PMD_SIZE); |
1894 |
+- else |
1895 |
+- *need_flush = true; |
1896 |
++ if (new_ptl != old_ptl) |
1897 |
++ spin_unlock(new_ptl); |
1898 |
+ spin_unlock(old_ptl); |
1899 |
+ return true; |
1900 |
+ } |
1901 |
+diff --git a/mm/mremap.c b/mm/mremap.c |
1902 |
+index 5c2e18505f75..a9617e72e6b7 100644 |
1903 |
+--- a/mm/mremap.c |
1904 |
++++ b/mm/mremap.c |
1905 |
+@@ -115,7 +115,7 @@ static pte_t move_soft_dirty_pte(pte_t pte) |
1906 |
+ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, |
1907 |
+ unsigned long old_addr, unsigned long old_end, |
1908 |
+ struct vm_area_struct *new_vma, pmd_t *new_pmd, |
1909 |
+- unsigned long new_addr, bool need_rmap_locks, bool *need_flush) |
1910 |
++ unsigned long new_addr, bool need_rmap_locks) |
1911 |
+ { |
1912 |
+ struct mm_struct *mm = vma->vm_mm; |
1913 |
+ pte_t *old_pte, *new_pte, pte; |
1914 |
+@@ -163,15 +163,17 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, |
1915 |
+ |
1916 |
+ pte = ptep_get_and_clear(mm, old_addr, old_pte); |
1917 |
+ /* |
1918 |
+- * If we are remapping a dirty PTE, make sure |
1919 |
++ * If we are remapping a valid PTE, make sure |
1920 |
+ * to flush TLB before we drop the PTL for the |
1921 |
+- * old PTE or we may race with page_mkclean(). |
1922 |
++ * PTE. |
1923 |
+ * |
1924 |
+- * This check has to be done after we removed the |
1925 |
+- * old PTE from page tables or another thread may |
1926 |
+- * dirty it after the check and before the removal. |
1927 |
++ * NOTE! Both old and new PTL matter: the old one |
1928 |
++ * for racing with page_mkclean(), the new one to |
1929 |
++ * make sure the physical page stays valid until |
1930 |
++ * the TLB entry for the old mapping has been |
1931 |
++ * flushed. |
1932 |
+ */ |
1933 |
+- if (pte_present(pte) && pte_dirty(pte)) |
1934 |
++ if (pte_present(pte)) |
1935 |
+ force_flush = true; |
1936 |
+ pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr); |
1937 |
+ pte = move_soft_dirty_pte(pte); |
1938 |
+@@ -179,13 +181,11 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, |
1939 |
+ } |
1940 |
+ |
1941 |
+ arch_leave_lazy_mmu_mode(); |
1942 |
++ if (force_flush) |
1943 |
++ flush_tlb_range(vma, old_end - len, old_end); |
1944 |
+ if (new_ptl != old_ptl) |
1945 |
+ spin_unlock(new_ptl); |
1946 |
+ pte_unmap(new_pte - 1); |
1947 |
+- if (force_flush) |
1948 |
+- flush_tlb_range(vma, old_end - len, old_end); |
1949 |
+- else |
1950 |
+- *need_flush = true; |
1951 |
+ pte_unmap_unlock(old_pte - 1, old_ptl); |
1952 |
+ if (need_rmap_locks) |
1953 |
+ drop_rmap_locks(vma); |
1954 |
+@@ -198,7 +198,6 @@ unsigned long move_page_tables(struct vm_area_struct *vma, |
1955 |
+ { |
1956 |
+ unsigned long extent, next, old_end; |
1957 |
+ pmd_t *old_pmd, *new_pmd; |
1958 |
+- bool need_flush = false; |
1959 |
+ unsigned long mmun_start; /* For mmu_notifiers */ |
1960 |
+ unsigned long mmun_end; /* For mmu_notifiers */ |
1961 |
+ |
1962 |
+@@ -229,8 +228,7 @@ unsigned long move_page_tables(struct vm_area_struct *vma, |
1963 |
+ if (need_rmap_locks) |
1964 |
+ take_rmap_locks(vma); |
1965 |
+ moved = move_huge_pmd(vma, old_addr, new_addr, |
1966 |
+- old_end, old_pmd, new_pmd, |
1967 |
+- &need_flush); |
1968 |
++ old_end, old_pmd, new_pmd); |
1969 |
+ if (need_rmap_locks) |
1970 |
+ drop_rmap_locks(vma); |
1971 |
+ if (moved) |
1972 |
+@@ -246,10 +244,8 @@ unsigned long move_page_tables(struct vm_area_struct *vma, |
1973 |
+ if (extent > next - new_addr) |
1974 |
+ extent = next - new_addr; |
1975 |
+ move_ptes(vma, old_pmd, old_addr, old_addr + extent, new_vma, |
1976 |
+- new_pmd, new_addr, need_rmap_locks, &need_flush); |
1977 |
++ new_pmd, new_addr, need_rmap_locks); |
1978 |
+ } |
1979 |
+- if (need_flush) |
1980 |
+- flush_tlb_range(vma, old_end-len, old_addr); |
1981 |
+ |
1982 |
+ mmu_notifier_invalidate_range_end(vma->vm_mm, mmun_start, mmun_end); |
1983 |
+ |
1984 |
+diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c |
1985 |
+index 71c20c1d4002..9f481cfdf77d 100644 |
1986 |
+--- a/net/batman-adv/bat_v_elp.c |
1987 |
++++ b/net/batman-adv/bat_v_elp.c |
1988 |
+@@ -241,7 +241,7 @@ batadv_v_elp_wifi_neigh_probe(struct batadv_hardif_neigh_node *neigh) |
1989 |
+ * the packet to be exactly of that size to make the link |
1990 |
+ * throughput estimation effective. |
1991 |
+ */ |
1992 |
+- skb_put(skb, probe_len - hard_iface->bat_v.elp_skb->len); |
1993 |
++ skb_put_zero(skb, probe_len - hard_iface->bat_v.elp_skb->len); |
1994 |
+ |
1995 |
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv, |
1996 |
+ "Sending unicast (probe) ELP packet on interface %s to %pM\n", |
1997 |
+@@ -268,6 +268,7 @@ static void batadv_v_elp_periodic_work(struct work_struct *work) |
1998 |
+ struct batadv_priv *bat_priv; |
1999 |
+ struct sk_buff *skb; |
2000 |
+ u32 elp_interval; |
2001 |
++ bool ret; |
2002 |
+ |
2003 |
+ bat_v = container_of(work, struct batadv_hard_iface_bat_v, elp_wq.work); |
2004 |
+ hard_iface = container_of(bat_v, struct batadv_hard_iface, bat_v); |
2005 |
+@@ -329,8 +330,11 @@ static void batadv_v_elp_periodic_work(struct work_struct *work) |
2006 |
+ * may sleep and that is not allowed in an rcu protected |
2007 |
+ * context. Therefore schedule a task for that. |
2008 |
+ */ |
2009 |
+- queue_work(batadv_event_workqueue, |
2010 |
+- &hardif_neigh->bat_v.metric_work); |
2011 |
++ ret = queue_work(batadv_event_workqueue, |
2012 |
++ &hardif_neigh->bat_v.metric_work); |
2013 |
++ |
2014 |
++ if (!ret) |
2015 |
++ batadv_hardif_neigh_put(hardif_neigh); |
2016 |
+ } |
2017 |
+ rcu_read_unlock(); |
2018 |
+ |
2019 |
+diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c |
2020 |
+index a2de5a44bd41..58c093caf49e 100644 |
2021 |
+--- a/net/batman-adv/bridge_loop_avoidance.c |
2022 |
++++ b/net/batman-adv/bridge_loop_avoidance.c |
2023 |
+@@ -1772,6 +1772,7 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb, |
2024 |
+ { |
2025 |
+ struct batadv_bla_backbone_gw *backbone_gw; |
2026 |
+ struct ethhdr *ethhdr; |
2027 |
++ bool ret; |
2028 |
+ |
2029 |
+ ethhdr = eth_hdr(skb); |
2030 |
+ |
2031 |
+@@ -1795,8 +1796,13 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb, |
2032 |
+ if (unlikely(!backbone_gw)) |
2033 |
+ return true; |
2034 |
+ |
2035 |
+- queue_work(batadv_event_workqueue, &backbone_gw->report_work); |
2036 |
+- /* backbone_gw is unreferenced in the report work function function */ |
2037 |
++ ret = queue_work(batadv_event_workqueue, &backbone_gw->report_work); |
2038 |
++ |
2039 |
++ /* backbone_gw is unreferenced in the report work function function |
2040 |
++ * if queue_work() call was successful |
2041 |
++ */ |
2042 |
++ if (!ret) |
2043 |
++ batadv_backbone_gw_put(backbone_gw); |
2044 |
+ |
2045 |
+ return true; |
2046 |
+ } |
2047 |
+diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c |
2048 |
+index 8b198ee798c9..140c61a3f1ec 100644 |
2049 |
+--- a/net/batman-adv/gateway_client.c |
2050 |
++++ b/net/batman-adv/gateway_client.c |
2051 |
+@@ -32,6 +32,7 @@ |
2052 |
+ #include <linux/kernel.h> |
2053 |
+ #include <linux/kref.h> |
2054 |
+ #include <linux/list.h> |
2055 |
++#include <linux/lockdep.h> |
2056 |
+ #include <linux/netdevice.h> |
2057 |
+ #include <linux/netlink.h> |
2058 |
+ #include <linux/rculist.h> |
2059 |
+@@ -348,6 +349,9 @@ out: |
2060 |
+ * @bat_priv: the bat priv with all the soft interface information |
2061 |
+ * @orig_node: originator announcing gateway capabilities |
2062 |
+ * @gateway: announced bandwidth information |
2063 |
++ * |
2064 |
++ * Has to be called with the appropriate locks being acquired |
2065 |
++ * (gw.list_lock). |
2066 |
+ */ |
2067 |
+ static void batadv_gw_node_add(struct batadv_priv *bat_priv, |
2068 |
+ struct batadv_orig_node *orig_node, |
2069 |
+@@ -355,6 +359,8 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv, |
2070 |
+ { |
2071 |
+ struct batadv_gw_node *gw_node; |
2072 |
+ |
2073 |
++ lockdep_assert_held(&bat_priv->gw.list_lock); |
2074 |
++ |
2075 |
+ if (gateway->bandwidth_down == 0) |
2076 |
+ return; |
2077 |
+ |
2078 |
+@@ -369,10 +375,8 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv, |
2079 |
+ gw_node->bandwidth_down = ntohl(gateway->bandwidth_down); |
2080 |
+ gw_node->bandwidth_up = ntohl(gateway->bandwidth_up); |
2081 |
+ |
2082 |
+- spin_lock_bh(&bat_priv->gw.list_lock); |
2083 |
+ kref_get(&gw_node->refcount); |
2084 |
+ hlist_add_head_rcu(&gw_node->list, &bat_priv->gw.gateway_list); |
2085 |
+- spin_unlock_bh(&bat_priv->gw.list_lock); |
2086 |
+ |
2087 |
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv, |
2088 |
+ "Found new gateway %pM -> gw bandwidth: %u.%u/%u.%u MBit\n", |
2089 |
+@@ -428,11 +432,14 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv, |
2090 |
+ { |
2091 |
+ struct batadv_gw_node *gw_node, *curr_gw = NULL; |
2092 |
+ |
2093 |
++ spin_lock_bh(&bat_priv->gw.list_lock); |
2094 |
+ gw_node = batadv_gw_node_get(bat_priv, orig_node); |
2095 |
+ if (!gw_node) { |
2096 |
+ batadv_gw_node_add(bat_priv, orig_node, gateway); |
2097 |
++ spin_unlock_bh(&bat_priv->gw.list_lock); |
2098 |
+ goto out; |
2099 |
+ } |
2100 |
++ spin_unlock_bh(&bat_priv->gw.list_lock); |
2101 |
+ |
2102 |
+ if (gw_node->bandwidth_down == ntohl(gateway->bandwidth_down) && |
2103 |
+ gw_node->bandwidth_up == ntohl(gateway->bandwidth_up)) |
2104 |
+diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c |
2105 |
+index c3578444f3cb..34caf129a9bf 100644 |
2106 |
+--- a/net/batman-adv/network-coding.c |
2107 |
++++ b/net/batman-adv/network-coding.c |
2108 |
+@@ -854,16 +854,27 @@ batadv_nc_get_nc_node(struct batadv_priv *bat_priv, |
2109 |
+ spinlock_t *lock; /* Used to lock list selected by "int in_coding" */ |
2110 |
+ struct list_head *list; |
2111 |
+ |
2112 |
++ /* Select ingoing or outgoing coding node */ |
2113 |
++ if (in_coding) { |
2114 |
++ lock = &orig_neigh_node->in_coding_list_lock; |
2115 |
++ list = &orig_neigh_node->in_coding_list; |
2116 |
++ } else { |
2117 |
++ lock = &orig_neigh_node->out_coding_list_lock; |
2118 |
++ list = &orig_neigh_node->out_coding_list; |
2119 |
++ } |
2120 |
++ |
2121 |
++ spin_lock_bh(lock); |
2122 |
++ |
2123 |
+ /* Check if nc_node is already added */ |
2124 |
+ nc_node = batadv_nc_find_nc_node(orig_node, orig_neigh_node, in_coding); |
2125 |
+ |
2126 |
+ /* Node found */ |
2127 |
+ if (nc_node) |
2128 |
+- return nc_node; |
2129 |
++ goto unlock; |
2130 |
+ |
2131 |
+ nc_node = kzalloc(sizeof(*nc_node), GFP_ATOMIC); |
2132 |
+ if (!nc_node) |
2133 |
+- return NULL; |
2134 |
++ goto unlock; |
2135 |
+ |
2136 |
+ /* Initialize nc_node */ |
2137 |
+ INIT_LIST_HEAD(&nc_node->list); |
2138 |
+@@ -872,22 +883,14 @@ batadv_nc_get_nc_node(struct batadv_priv *bat_priv, |
2139 |
+ kref_get(&orig_neigh_node->refcount); |
2140 |
+ nc_node->orig_node = orig_neigh_node; |
2141 |
+ |
2142 |
+- /* Select ingoing or outgoing coding node */ |
2143 |
+- if (in_coding) { |
2144 |
+- lock = &orig_neigh_node->in_coding_list_lock; |
2145 |
+- list = &orig_neigh_node->in_coding_list; |
2146 |
+- } else { |
2147 |
+- lock = &orig_neigh_node->out_coding_list_lock; |
2148 |
+- list = &orig_neigh_node->out_coding_list; |
2149 |
+- } |
2150 |
+- |
2151 |
+ batadv_dbg(BATADV_DBG_NC, bat_priv, "Adding nc_node %pM -> %pM\n", |
2152 |
+ nc_node->addr, nc_node->orig_node->orig); |
2153 |
+ |
2154 |
+ /* Add nc_node to orig_node */ |
2155 |
+- spin_lock_bh(lock); |
2156 |
+ kref_get(&nc_node->refcount); |
2157 |
+ list_add_tail_rcu(&nc_node->list, list); |
2158 |
++ |
2159 |
++unlock: |
2160 |
+ spin_unlock_bh(lock); |
2161 |
+ |
2162 |
+ return nc_node; |
2163 |
+diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c |
2164 |
+index 1485263a348b..626ddca332db 100644 |
2165 |
+--- a/net/batman-adv/soft-interface.c |
2166 |
++++ b/net/batman-adv/soft-interface.c |
2167 |
+@@ -574,15 +574,20 @@ int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid) |
2168 |
+ struct batadv_softif_vlan *vlan; |
2169 |
+ int err; |
2170 |
+ |
2171 |
++ spin_lock_bh(&bat_priv->softif_vlan_list_lock); |
2172 |
++ |
2173 |
+ vlan = batadv_softif_vlan_get(bat_priv, vid); |
2174 |
+ if (vlan) { |
2175 |
+ batadv_softif_vlan_put(vlan); |
2176 |
++ spin_unlock_bh(&bat_priv->softif_vlan_list_lock); |
2177 |
+ return -EEXIST; |
2178 |
+ } |
2179 |
+ |
2180 |
+ vlan = kzalloc(sizeof(*vlan), GFP_ATOMIC); |
2181 |
+- if (!vlan) |
2182 |
++ if (!vlan) { |
2183 |
++ spin_unlock_bh(&bat_priv->softif_vlan_list_lock); |
2184 |
+ return -ENOMEM; |
2185 |
++ } |
2186 |
+ |
2187 |
+ vlan->bat_priv = bat_priv; |
2188 |
+ vlan->vid = vid; |
2189 |
+@@ -590,17 +595,23 @@ int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid) |
2190 |
+ |
2191 |
+ atomic_set(&vlan->ap_isolation, 0); |
2192 |
+ |
2193 |
++ kref_get(&vlan->refcount); |
2194 |
++ hlist_add_head_rcu(&vlan->list, &bat_priv->softif_vlan_list); |
2195 |
++ spin_unlock_bh(&bat_priv->softif_vlan_list_lock); |
2196 |
++ |
2197 |
++ /* batadv_sysfs_add_vlan cannot be in the spinlock section due to the |
2198 |
++ * sleeping behavior of the sysfs functions and the fs_reclaim lock |
2199 |
++ */ |
2200 |
+ err = batadv_sysfs_add_vlan(bat_priv->soft_iface, vlan); |
2201 |
+ if (err) { |
2202 |
+- kfree(vlan); |
2203 |
++ /* ref for the function */ |
2204 |
++ batadv_softif_vlan_put(vlan); |
2205 |
++ |
2206 |
++ /* ref for the list */ |
2207 |
++ batadv_softif_vlan_put(vlan); |
2208 |
+ return err; |
2209 |
+ } |
2210 |
+ |
2211 |
+- spin_lock_bh(&bat_priv->softif_vlan_list_lock); |
2212 |
+- kref_get(&vlan->refcount); |
2213 |
+- hlist_add_head_rcu(&vlan->list, &bat_priv->softif_vlan_list); |
2214 |
+- spin_unlock_bh(&bat_priv->softif_vlan_list_lock); |
2215 |
+- |
2216 |
+ /* add a new TT local entry. This one will be marked with the NOPURGE |
2217 |
+ * flag |
2218 |
+ */ |
2219 |
+diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c |
2220 |
+index f2eef43bd2ec..09427fc6494a 100644 |
2221 |
+--- a/net/batman-adv/sysfs.c |
2222 |
++++ b/net/batman-adv/sysfs.c |
2223 |
+@@ -188,7 +188,8 @@ ssize_t batadv_store_##_name(struct kobject *kobj, \ |
2224 |
+ \ |
2225 |
+ return __batadv_store_uint_attr(buff, count, _min, _max, \ |
2226 |
+ _post_func, attr, \ |
2227 |
+- &bat_priv->_var, net_dev); \ |
2228 |
++ &bat_priv->_var, net_dev, \ |
2229 |
++ NULL); \ |
2230 |
+ } |
2231 |
+ |
2232 |
+ #define BATADV_ATTR_SIF_SHOW_UINT(_name, _var) \ |
2233 |
+@@ -262,7 +263,9 @@ ssize_t batadv_store_##_name(struct kobject *kobj, \ |
2234 |
+ \ |
2235 |
+ length = __batadv_store_uint_attr(buff, count, _min, _max, \ |
2236 |
+ _post_func, attr, \ |
2237 |
+- &hard_iface->_var, net_dev); \ |
2238 |
++ &hard_iface->_var, \ |
2239 |
++ hard_iface->soft_iface, \ |
2240 |
++ net_dev); \ |
2241 |
+ \ |
2242 |
+ batadv_hardif_put(hard_iface); \ |
2243 |
+ return length; \ |
2244 |
+@@ -356,10 +359,12 @@ __batadv_store_bool_attr(char *buff, size_t count, |
2245 |
+ |
2246 |
+ static int batadv_store_uint_attr(const char *buff, size_t count, |
2247 |
+ struct net_device *net_dev, |
2248 |
++ struct net_device *slave_dev, |
2249 |
+ const char *attr_name, |
2250 |
+ unsigned int min, unsigned int max, |
2251 |
+ atomic_t *attr) |
2252 |
+ { |
2253 |
++ char ifname[IFNAMSIZ + 3] = ""; |
2254 |
+ unsigned long uint_val; |
2255 |
+ int ret; |
2256 |
+ |
2257 |
+@@ -385,8 +390,11 @@ static int batadv_store_uint_attr(const char *buff, size_t count, |
2258 |
+ if (atomic_read(attr) == uint_val) |
2259 |
+ return count; |
2260 |
+ |
2261 |
+- batadv_info(net_dev, "%s: Changing from: %i to: %lu\n", |
2262 |
+- attr_name, atomic_read(attr), uint_val); |
2263 |
++ if (slave_dev) |
2264 |
++ snprintf(ifname, sizeof(ifname), "%s: ", slave_dev->name); |
2265 |
++ |
2266 |
++ batadv_info(net_dev, "%s: %sChanging from: %i to: %lu\n", |
2267 |
++ attr_name, ifname, atomic_read(attr), uint_val); |
2268 |
+ |
2269 |
+ atomic_set(attr, uint_val); |
2270 |
+ return count; |
2271 |
+@@ -397,12 +405,13 @@ static ssize_t __batadv_store_uint_attr(const char *buff, size_t count, |
2272 |
+ void (*post_func)(struct net_device *), |
2273 |
+ const struct attribute *attr, |
2274 |
+ atomic_t *attr_store, |
2275 |
+- struct net_device *net_dev) |
2276 |
++ struct net_device *net_dev, |
2277 |
++ struct net_device *slave_dev) |
2278 |
+ { |
2279 |
+ int ret; |
2280 |
+ |
2281 |
+- ret = batadv_store_uint_attr(buff, count, net_dev, attr->name, min, max, |
2282 |
+- attr_store); |
2283 |
++ ret = batadv_store_uint_attr(buff, count, net_dev, slave_dev, |
2284 |
++ attr->name, min, max, attr_store); |
2285 |
+ if (post_func && ret) |
2286 |
+ post_func(net_dev); |
2287 |
+ |
2288 |
+@@ -571,7 +580,7 @@ static ssize_t batadv_store_gw_sel_class(struct kobject *kobj, |
2289 |
+ return __batadv_store_uint_attr(buff, count, 1, BATADV_TQ_MAX_VALUE, |
2290 |
+ batadv_post_gw_reselect, attr, |
2291 |
+ &bat_priv->gw.sel_class, |
2292 |
+- bat_priv->soft_iface); |
2293 |
++ bat_priv->soft_iface, NULL); |
2294 |
+ } |
2295 |
+ |
2296 |
+ static ssize_t batadv_show_gw_bwidth(struct kobject *kobj, |
2297 |
+@@ -1090,8 +1099,9 @@ static ssize_t batadv_store_throughput_override(struct kobject *kobj, |
2298 |
+ if (old_tp_override == tp_override) |
2299 |
+ goto out; |
2300 |
+ |
2301 |
+- batadv_info(net_dev, "%s: Changing from: %u.%u MBit to: %u.%u MBit\n", |
2302 |
+- "throughput_override", |
2303 |
++ batadv_info(hard_iface->soft_iface, |
2304 |
++ "%s: %s: Changing from: %u.%u MBit to: %u.%u MBit\n", |
2305 |
++ "throughput_override", net_dev->name, |
2306 |
+ old_tp_override / 10, old_tp_override % 10, |
2307 |
+ tp_override / 10, tp_override % 10); |
2308 |
+ |
2309 |
+diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c |
2310 |
+index 12a2b7d21376..d21624c44665 100644 |
2311 |
+--- a/net/batman-adv/translation-table.c |
2312 |
++++ b/net/batman-adv/translation-table.c |
2313 |
+@@ -1613,6 +1613,8 @@ batadv_tt_global_orig_entry_add(struct batadv_tt_global_entry *tt_global, |
2314 |
+ { |
2315 |
+ struct batadv_tt_orig_list_entry *orig_entry; |
2316 |
+ |
2317 |
++ spin_lock_bh(&tt_global->list_lock); |
2318 |
++ |
2319 |
+ orig_entry = batadv_tt_global_orig_entry_find(tt_global, orig_node); |
2320 |
+ if (orig_entry) { |
2321 |
+ /* refresh the ttvn: the current value could be a bogus one that |
2322 |
+@@ -1635,11 +1637,9 @@ batadv_tt_global_orig_entry_add(struct batadv_tt_global_entry *tt_global, |
2323 |
+ orig_entry->flags = flags; |
2324 |
+ kref_init(&orig_entry->refcount); |
2325 |
+ |
2326 |
+- spin_lock_bh(&tt_global->list_lock); |
2327 |
+ kref_get(&orig_entry->refcount); |
2328 |
+ hlist_add_head_rcu(&orig_entry->list, |
2329 |
+ &tt_global->orig_list); |
2330 |
+- spin_unlock_bh(&tt_global->list_lock); |
2331 |
+ atomic_inc(&tt_global->orig_list_count); |
2332 |
+ |
2333 |
+ sync_flags: |
2334 |
+@@ -1647,6 +1647,8 @@ sync_flags: |
2335 |
+ out: |
2336 |
+ if (orig_entry) |
2337 |
+ batadv_tt_orig_list_entry_put(orig_entry); |
2338 |
++ |
2339 |
++ spin_unlock_bh(&tt_global->list_lock); |
2340 |
+ } |
2341 |
+ |
2342 |
+ /** |
2343 |
+diff --git a/net/batman-adv/tvlv.c b/net/batman-adv/tvlv.c |
2344 |
+index a637458205d1..40e69c9346d2 100644 |
2345 |
+--- a/net/batman-adv/tvlv.c |
2346 |
++++ b/net/batman-adv/tvlv.c |
2347 |
+@@ -529,15 +529,20 @@ void batadv_tvlv_handler_register(struct batadv_priv *bat_priv, |
2348 |
+ { |
2349 |
+ struct batadv_tvlv_handler *tvlv_handler; |
2350 |
+ |
2351 |
++ spin_lock_bh(&bat_priv->tvlv.handler_list_lock); |
2352 |
++ |
2353 |
+ tvlv_handler = batadv_tvlv_handler_get(bat_priv, type, version); |
2354 |
+ if (tvlv_handler) { |
2355 |
++ spin_unlock_bh(&bat_priv->tvlv.handler_list_lock); |
2356 |
+ batadv_tvlv_handler_put(tvlv_handler); |
2357 |
+ return; |
2358 |
+ } |
2359 |
+ |
2360 |
+ tvlv_handler = kzalloc(sizeof(*tvlv_handler), GFP_ATOMIC); |
2361 |
+- if (!tvlv_handler) |
2362 |
++ if (!tvlv_handler) { |
2363 |
++ spin_unlock_bh(&bat_priv->tvlv.handler_list_lock); |
2364 |
+ return; |
2365 |
++ } |
2366 |
+ |
2367 |
+ tvlv_handler->ogm_handler = optr; |
2368 |
+ tvlv_handler->unicast_handler = uptr; |
2369 |
+@@ -547,7 +552,6 @@ void batadv_tvlv_handler_register(struct batadv_priv *bat_priv, |
2370 |
+ kref_init(&tvlv_handler->refcount); |
2371 |
+ INIT_HLIST_NODE(&tvlv_handler->list); |
2372 |
+ |
2373 |
+- spin_lock_bh(&bat_priv->tvlv.handler_list_lock); |
2374 |
+ kref_get(&tvlv_handler->refcount); |
2375 |
+ hlist_add_head_rcu(&tvlv_handler->list, &bat_priv->tvlv.handler_list); |
2376 |
+ spin_unlock_bh(&bat_priv->tvlv.handler_list_lock); |
2377 |
+diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c |
2378 |
+index e7de5f282722..effa87858b21 100644 |
2379 |
+--- a/net/smc/af_smc.c |
2380 |
++++ b/net/smc/af_smc.c |
2381 |
+@@ -612,7 +612,10 @@ static void smc_connect_work(struct work_struct *work) |
2382 |
+ smc->sk.sk_err = -rc; |
2383 |
+ |
2384 |
+ out: |
2385 |
+- smc->sk.sk_state_change(&smc->sk); |
2386 |
++ if (smc->sk.sk_err) |
2387 |
++ smc->sk.sk_state_change(&smc->sk); |
2388 |
++ else |
2389 |
++ smc->sk.sk_write_space(&smc->sk); |
2390 |
+ kfree(smc->connect_info); |
2391 |
+ smc->connect_info = NULL; |
2392 |
+ release_sock(&smc->sk); |
2393 |
+@@ -1345,7 +1348,7 @@ static __poll_t smc_poll(struct file *file, struct socket *sock, |
2394 |
+ return EPOLLNVAL; |
2395 |
+ |
2396 |
+ smc = smc_sk(sock->sk); |
2397 |
+- if ((sk->sk_state == SMC_INIT) || smc->use_fallback) { |
2398 |
++ if (smc->use_fallback) { |
2399 |
+ /* delegate to CLC child sock */ |
2400 |
+ mask = smc->clcsock->ops->poll(file, smc->clcsock, wait); |
2401 |
+ sk->sk_err = smc->clcsock->sk->sk_err; |
2402 |
+diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c |
2403 |
+index ae5d168653ce..086157555ac3 100644 |
2404 |
+--- a/net/smc/smc_clc.c |
2405 |
++++ b/net/smc/smc_clc.c |
2406 |
+@@ -405,14 +405,12 @@ int smc_clc_send_proposal(struct smc_sock *smc, |
2407 |
+ vec[i++].iov_len = sizeof(trl); |
2408 |
+ /* due to the few bytes needed for clc-handshake this cannot block */ |
2409 |
+ len = kernel_sendmsg(smc->clcsock, &msg, vec, i, plen); |
2410 |
+- if (len < sizeof(pclc)) { |
2411 |
+- if (len >= 0) { |
2412 |
+- reason_code = -ENETUNREACH; |
2413 |
+- smc->sk.sk_err = -reason_code; |
2414 |
+- } else { |
2415 |
+- smc->sk.sk_err = smc->clcsock->sk->sk_err; |
2416 |
+- reason_code = -smc->sk.sk_err; |
2417 |
+- } |
2418 |
++ if (len < 0) { |
2419 |
++ smc->sk.sk_err = smc->clcsock->sk->sk_err; |
2420 |
++ reason_code = -smc->sk.sk_err; |
2421 |
++ } else if (len < (int)sizeof(pclc)) { |
2422 |
++ reason_code = -ENETUNREACH; |
2423 |
++ smc->sk.sk_err = -reason_code; |
2424 |
+ } |
2425 |
+ |
2426 |
+ return reason_code; |
2427 |
+diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c |
2428 |
+index 6c253343a6f9..70d18d0d39ff 100644 |
2429 |
+--- a/tools/testing/selftests/bpf/test_maps.c |
2430 |
++++ b/tools/testing/selftests/bpf/test_maps.c |
2431 |
+@@ -566,7 +566,11 @@ static void test_sockmap(int tasks, void *data) |
2432 |
+ /* Test update without programs */ |
2433 |
+ for (i = 0; i < 6; i++) { |
2434 |
+ err = bpf_map_update_elem(fd, &i, &sfd[i], BPF_ANY); |
2435 |
+- if (err) { |
2436 |
++ if (i < 2 && !err) { |
2437 |
++ printf("Allowed update sockmap '%i:%i' not in ESTABLISHED\n", |
2438 |
++ i, sfd[i]); |
2439 |
++ goto out_sockmap; |
2440 |
++ } else if (i >= 2 && err) { |
2441 |
+ printf("Failed noprog update sockmap '%i:%i'\n", |
2442 |
+ i, sfd[i]); |
2443 |
+ goto out_sockmap; |
2444 |
+@@ -727,7 +731,7 @@ static void test_sockmap(int tasks, void *data) |
2445 |
+ } |
2446 |
+ |
2447 |
+ /* Test map update elem afterwards fd lives in fd and map_fd */ |
2448 |
+- for (i = 0; i < 6; i++) { |
2449 |
++ for (i = 2; i < 6; i++) { |
2450 |
+ err = bpf_map_update_elem(map_fd_rx, &i, &sfd[i], BPF_ANY); |
2451 |
+ if (err) { |
2452 |
+ printf("Failed map_fd_rx update sockmap %i '%i:%i'\n", |
2453 |
+@@ -831,7 +835,7 @@ static void test_sockmap(int tasks, void *data) |
2454 |
+ } |
2455 |
+ |
2456 |
+ /* Delete the elems without programs */ |
2457 |
+- for (i = 0; i < 6; i++) { |
2458 |
++ for (i = 2; i < 6; i++) { |
2459 |
+ err = bpf_map_delete_elem(fd, &i); |
2460 |
+ if (err) { |
2461 |
+ printf("Failed delete sockmap %i '%i:%i'\n", |
2462 |
+diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh |
2463 |
+index 32a194e3e07a..0ab9423d009f 100755 |
2464 |
+--- a/tools/testing/selftests/net/pmtu.sh |
2465 |
++++ b/tools/testing/selftests/net/pmtu.sh |
2466 |
+@@ -178,8 +178,8 @@ setup() { |
2467 |
+ |
2468 |
+ cleanup() { |
2469 |
+ [ ${cleanup_done} -eq 1 ] && return |
2470 |
+- ip netns del ${NS_A} 2 > /dev/null |
2471 |
+- ip netns del ${NS_B} 2 > /dev/null |
2472 |
++ ip netns del ${NS_A} 2> /dev/null |
2473 |
++ ip netns del ${NS_B} 2> /dev/null |
2474 |
+ cleanup_done=1 |
2475 |
+ } |
2476 |
+ |