1 |
commit: 4e804abb89c6ffd929494c09f6d4b11bc0b37513 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 8 10:03:35 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 8 10:03:35 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=4e804abb |
7 |
|
8 |
Linux patch 4.9.174 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1173_linux-4.9.174.patch | 2517 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2521 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index b47b2c4..15510bc 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -735,6 +735,10 @@ Patch: 1172_linux-4.9.173.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.9.173 |
23 |
|
24 |
+Patch: 1173_linux-4.9.174.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.9.174 |
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/1173_linux-4.9.174.patch b/1173_linux-4.9.174.patch |
33 |
new file mode 100644 |
34 |
index 0000000..076ee1a |
35 |
--- /dev/null |
36 |
+++ b/1173_linux-4.9.174.patch |
37 |
@@ -0,0 +1,2517 @@ |
38 |
+diff --git a/Documentation/usb/power-management.txt b/Documentation/usb/power-management.txt |
39 |
+index 0a94ffe17ab6..b13e031beaa6 100644 |
40 |
+--- a/Documentation/usb/power-management.txt |
41 |
++++ b/Documentation/usb/power-management.txt |
42 |
+@@ -365,11 +365,15 @@ autosuspend the interface's device. When the usage counter is = 0 |
43 |
+ then the interface is considered to be idle, and the kernel may |
44 |
+ autosuspend the device. |
45 |
+ |
46 |
+-Drivers need not be concerned about balancing changes to the usage |
47 |
+-counter; the USB core will undo any remaining "get"s when a driver |
48 |
+-is unbound from its interface. As a corollary, drivers must not call |
49 |
+-any of the usb_autopm_* functions after their disconnect() routine has |
50 |
+-returned. |
51 |
++Drivers must be careful to balance their overall changes to the usage |
52 |
++counter. Unbalanced "get"s will remain in effect when a driver is |
53 |
++unbound from its interface, preventing the device from going into |
54 |
++runtime suspend should the interface be bound to a driver again. On |
55 |
++the other hand, drivers are allowed to achieve this balance by calling |
56 |
++the ``usb_autopm_*`` functions even after their ``disconnect`` routine |
57 |
++has returned -- say from within a work-queue routine -- provided they |
58 |
++retain an active reference to the interface (via ``usb_get_intf`` and |
59 |
++``usb_put_intf``). |
60 |
+ |
61 |
+ Drivers using the async routines are responsible for their own |
62 |
+ synchronization and mutual exclusion. |
63 |
+diff --git a/Makefile b/Makefile |
64 |
+index a4e35453f9e4..f5836837df15 100644 |
65 |
+--- a/Makefile |
66 |
++++ b/Makefile |
67 |
+@@ -1,6 +1,6 @@ |
68 |
+ VERSION = 4 |
69 |
+ PATCHLEVEL = 9 |
70 |
+-SUBLEVEL = 173 |
71 |
++SUBLEVEL = 174 |
72 |
+ EXTRAVERSION = |
73 |
+ NAME = Roaring Lionus |
74 |
+ |
75 |
+diff --git a/arch/arm/mach-iop13xx/setup.c b/arch/arm/mach-iop13xx/setup.c |
76 |
+index 53c316f7301e..fe4932fda01d 100644 |
77 |
+--- a/arch/arm/mach-iop13xx/setup.c |
78 |
++++ b/arch/arm/mach-iop13xx/setup.c |
79 |
+@@ -300,7 +300,7 @@ static struct resource iop13xx_adma_2_resources[] = { |
80 |
+ } |
81 |
+ }; |
82 |
+ |
83 |
+-static u64 iop13xx_adma_dmamask = DMA_BIT_MASK(64); |
84 |
++static u64 iop13xx_adma_dmamask = DMA_BIT_MASK(32); |
85 |
+ static struct iop_adma_platform_data iop13xx_adma_0_data = { |
86 |
+ .hw_id = 0, |
87 |
+ .pool_size = PAGE_SIZE, |
88 |
+@@ -324,7 +324,7 @@ static struct platform_device iop13xx_adma_0_channel = { |
89 |
+ .resource = iop13xx_adma_0_resources, |
90 |
+ .dev = { |
91 |
+ .dma_mask = &iop13xx_adma_dmamask, |
92 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
93 |
++ .coherent_dma_mask = DMA_BIT_MASK(32), |
94 |
+ .platform_data = (void *) &iop13xx_adma_0_data, |
95 |
+ }, |
96 |
+ }; |
97 |
+@@ -336,7 +336,7 @@ static struct platform_device iop13xx_adma_1_channel = { |
98 |
+ .resource = iop13xx_adma_1_resources, |
99 |
+ .dev = { |
100 |
+ .dma_mask = &iop13xx_adma_dmamask, |
101 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
102 |
++ .coherent_dma_mask = DMA_BIT_MASK(32), |
103 |
+ .platform_data = (void *) &iop13xx_adma_1_data, |
104 |
+ }, |
105 |
+ }; |
106 |
+@@ -348,7 +348,7 @@ static struct platform_device iop13xx_adma_2_channel = { |
107 |
+ .resource = iop13xx_adma_2_resources, |
108 |
+ .dev = { |
109 |
+ .dma_mask = &iop13xx_adma_dmamask, |
110 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
111 |
++ .coherent_dma_mask = DMA_BIT_MASK(32), |
112 |
+ .platform_data = (void *) &iop13xx_adma_2_data, |
113 |
+ }, |
114 |
+ }; |
115 |
+diff --git a/arch/arm/mach-iop13xx/tpmi.c b/arch/arm/mach-iop13xx/tpmi.c |
116 |
+index db511ec2b1df..116feb6b261e 100644 |
117 |
+--- a/arch/arm/mach-iop13xx/tpmi.c |
118 |
++++ b/arch/arm/mach-iop13xx/tpmi.c |
119 |
+@@ -152,7 +152,7 @@ static struct resource iop13xx_tpmi_3_resources[] = { |
120 |
+ } |
121 |
+ }; |
122 |
+ |
123 |
+-u64 iop13xx_tpmi_mask = DMA_BIT_MASK(64); |
124 |
++u64 iop13xx_tpmi_mask = DMA_BIT_MASK(32); |
125 |
+ static struct platform_device iop13xx_tpmi_0_device = { |
126 |
+ .name = "iop-tpmi", |
127 |
+ .id = 0, |
128 |
+@@ -160,7 +160,7 @@ static struct platform_device iop13xx_tpmi_0_device = { |
129 |
+ .resource = iop13xx_tpmi_0_resources, |
130 |
+ .dev = { |
131 |
+ .dma_mask = &iop13xx_tpmi_mask, |
132 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
133 |
++ .coherent_dma_mask = DMA_BIT_MASK(32), |
134 |
+ }, |
135 |
+ }; |
136 |
+ |
137 |
+@@ -171,7 +171,7 @@ static struct platform_device iop13xx_tpmi_1_device = { |
138 |
+ .resource = iop13xx_tpmi_1_resources, |
139 |
+ .dev = { |
140 |
+ .dma_mask = &iop13xx_tpmi_mask, |
141 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
142 |
++ .coherent_dma_mask = DMA_BIT_MASK(32), |
143 |
+ }, |
144 |
+ }; |
145 |
+ |
146 |
+@@ -182,7 +182,7 @@ static struct platform_device iop13xx_tpmi_2_device = { |
147 |
+ .resource = iop13xx_tpmi_2_resources, |
148 |
+ .dev = { |
149 |
+ .dma_mask = &iop13xx_tpmi_mask, |
150 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
151 |
++ .coherent_dma_mask = DMA_BIT_MASK(32), |
152 |
+ }, |
153 |
+ }; |
154 |
+ |
155 |
+@@ -193,7 +193,7 @@ static struct platform_device iop13xx_tpmi_3_device = { |
156 |
+ .resource = iop13xx_tpmi_3_resources, |
157 |
+ .dev = { |
158 |
+ .dma_mask = &iop13xx_tpmi_mask, |
159 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
160 |
++ .coherent_dma_mask = DMA_BIT_MASK(32), |
161 |
+ }, |
162 |
+ }; |
163 |
+ |
164 |
+diff --git a/arch/arm/plat-iop/adma.c b/arch/arm/plat-iop/adma.c |
165 |
+index a4d1f8de3b5b..d9612221e484 100644 |
166 |
+--- a/arch/arm/plat-iop/adma.c |
167 |
++++ b/arch/arm/plat-iop/adma.c |
168 |
+@@ -143,7 +143,7 @@ struct platform_device iop3xx_dma_0_channel = { |
169 |
+ .resource = iop3xx_dma_0_resources, |
170 |
+ .dev = { |
171 |
+ .dma_mask = &iop3xx_adma_dmamask, |
172 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
173 |
++ .coherent_dma_mask = DMA_BIT_MASK(32), |
174 |
+ .platform_data = (void *) &iop3xx_dma_0_data, |
175 |
+ }, |
176 |
+ }; |
177 |
+@@ -155,7 +155,7 @@ struct platform_device iop3xx_dma_1_channel = { |
178 |
+ .resource = iop3xx_dma_1_resources, |
179 |
+ .dev = { |
180 |
+ .dma_mask = &iop3xx_adma_dmamask, |
181 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
182 |
++ .coherent_dma_mask = DMA_BIT_MASK(32), |
183 |
+ .platform_data = (void *) &iop3xx_dma_1_data, |
184 |
+ }, |
185 |
+ }; |
186 |
+@@ -167,7 +167,7 @@ struct platform_device iop3xx_aau_channel = { |
187 |
+ .resource = iop3xx_aau_resources, |
188 |
+ .dev = { |
189 |
+ .dma_mask = &iop3xx_adma_dmamask, |
190 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
191 |
++ .coherent_dma_mask = DMA_BIT_MASK(32), |
192 |
+ .platform_data = (void *) &iop3xx_aau_data, |
193 |
+ }, |
194 |
+ }; |
195 |
+diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c |
196 |
+index 272f49b2c68f..bb29e6ebdc0d 100644 |
197 |
+--- a/arch/arm/plat-orion/common.c |
198 |
++++ b/arch/arm/plat-orion/common.c |
199 |
+@@ -605,7 +605,7 @@ static struct platform_device orion_xor0_shared = { |
200 |
+ .resource = orion_xor0_shared_resources, |
201 |
+ .dev = { |
202 |
+ .dma_mask = &orion_xor_dmamask, |
203 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
204 |
++ .coherent_dma_mask = DMA_BIT_MASK(32), |
205 |
+ .platform_data = &orion_xor0_pdata, |
206 |
+ }, |
207 |
+ }; |
208 |
+@@ -666,7 +666,7 @@ static struct platform_device orion_xor1_shared = { |
209 |
+ .resource = orion_xor1_shared_resources, |
210 |
+ .dev = { |
211 |
+ .dma_mask = &orion_xor_dmamask, |
212 |
+- .coherent_dma_mask = DMA_BIT_MASK(64), |
213 |
++ .coherent_dma_mask = DMA_BIT_MASK(32), |
214 |
+ .platform_data = &orion_xor1_pdata, |
215 |
+ }, |
216 |
+ }; |
217 |
+diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h |
218 |
+index bc812435bc76..d0beefeb6d25 100644 |
219 |
+--- a/arch/arm64/include/asm/system_misc.h |
220 |
++++ b/arch/arm64/include/asm/system_misc.h |
221 |
+@@ -40,7 +40,7 @@ void hook_debug_fault_code(int nr, int (*fn)(unsigned long, unsigned int, |
222 |
+ int sig, int code, const char *name); |
223 |
+ |
224 |
+ struct mm_struct; |
225 |
+-extern void show_pte(struct mm_struct *mm, unsigned long addr); |
226 |
++extern void show_pte(unsigned long addr); |
227 |
+ extern void __show_regs(struct pt_regs *); |
228 |
+ |
229 |
+ extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); |
230 |
+diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c |
231 |
+index 051b32084776..575c11a6f9b6 100644 |
232 |
+--- a/arch/arm64/mm/fault.c |
233 |
++++ b/arch/arm64/mm/fault.c |
234 |
+@@ -79,18 +79,33 @@ static inline int notify_page_fault(struct pt_regs *regs, unsigned int esr) |
235 |
+ #endif |
236 |
+ |
237 |
+ /* |
238 |
+- * Dump out the page tables associated with 'addr' in mm 'mm'. |
239 |
++ * Dump out the page tables associated with 'addr' in the currently active mm. |
240 |
+ */ |
241 |
+-void show_pte(struct mm_struct *mm, unsigned long addr) |
242 |
++void show_pte(unsigned long addr) |
243 |
+ { |
244 |
++ struct mm_struct *mm; |
245 |
+ pgd_t *pgd; |
246 |
+ |
247 |
+- if (!mm) |
248 |
++ if (addr < TASK_SIZE) { |
249 |
++ /* TTBR0 */ |
250 |
++ mm = current->active_mm; |
251 |
++ if (mm == &init_mm) { |
252 |
++ pr_alert("[%016lx] user address but active_mm is swapper\n", |
253 |
++ addr); |
254 |
++ return; |
255 |
++ } |
256 |
++ } else if (addr >= VA_START) { |
257 |
++ /* TTBR1 */ |
258 |
+ mm = &init_mm; |
259 |
++ } else { |
260 |
++ pr_alert("[%016lx] address between user and kernel address ranges\n", |
261 |
++ addr); |
262 |
++ return; |
263 |
++ } |
264 |
+ |
265 |
+ pr_alert("pgd = %p\n", mm->pgd); |
266 |
+ pgd = pgd_offset(mm, addr); |
267 |
+- pr_alert("[%08lx] *pgd=%016llx", addr, pgd_val(*pgd)); |
268 |
++ pr_alert("[%016lx] *pgd=%016llx", addr, pgd_val(*pgd)); |
269 |
+ |
270 |
+ do { |
271 |
+ pud_t *pud; |
272 |
+@@ -176,8 +191,8 @@ static bool is_el1_instruction_abort(unsigned int esr) |
273 |
+ /* |
274 |
+ * The kernel tried to access some page that wasn't present. |
275 |
+ */ |
276 |
+-static void __do_kernel_fault(struct mm_struct *mm, unsigned long addr, |
277 |
+- unsigned int esr, struct pt_regs *regs) |
278 |
++static void __do_kernel_fault(unsigned long addr, unsigned int esr, |
279 |
++ struct pt_regs *regs) |
280 |
+ { |
281 |
+ /* |
282 |
+ * Are we prepared to handle this kernel fault? |
283 |
+@@ -194,7 +209,7 @@ static void __do_kernel_fault(struct mm_struct *mm, unsigned long addr, |
284 |
+ (addr < PAGE_SIZE) ? "NULL pointer dereference" : |
285 |
+ "paging request", addr); |
286 |
+ |
287 |
+- show_pte(mm, addr); |
288 |
++ show_pte(addr); |
289 |
+ die("Oops", regs, esr); |
290 |
+ bust_spinlocks(0); |
291 |
+ do_exit(SIGKILL); |
292 |
+@@ -216,7 +231,6 @@ static void __do_user_fault(struct task_struct *tsk, unsigned long addr, |
293 |
+ pr_info("%s[%d]: unhandled %s (%d) at 0x%08lx, esr 0x%03x\n", |
294 |
+ tsk->comm, task_pid_nr(tsk), inf->name, sig, |
295 |
+ addr, esr); |
296 |
+- show_pte(tsk->mm, addr); |
297 |
+ show_regs(regs); |
298 |
+ } |
299 |
+ |
300 |
+@@ -232,7 +246,6 @@ static void __do_user_fault(struct task_struct *tsk, unsigned long addr, |
301 |
+ static void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *regs) |
302 |
+ { |
303 |
+ struct task_struct *tsk = current; |
304 |
+- struct mm_struct *mm = tsk->active_mm; |
305 |
+ const struct fault_info *inf; |
306 |
+ |
307 |
+ /* |
308 |
+@@ -243,7 +256,7 @@ static void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *re |
309 |
+ inf = esr_to_fault_info(esr); |
310 |
+ __do_user_fault(tsk, addr, esr, inf->sig, inf->code, regs); |
311 |
+ } else |
312 |
+- __do_kernel_fault(mm, addr, esr, regs); |
313 |
++ __do_kernel_fault(addr, esr, regs); |
314 |
+ } |
315 |
+ |
316 |
+ #define VM_FAULT_BADMAP 0x010000 |
317 |
+@@ -454,7 +467,7 @@ retry: |
318 |
+ return 0; |
319 |
+ |
320 |
+ no_context: |
321 |
+- __do_kernel_fault(mm, addr, esr, regs); |
322 |
++ __do_kernel_fault(addr, esr, regs); |
323 |
+ return 0; |
324 |
+ } |
325 |
+ |
326 |
+diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c |
327 |
+index 757009daa9ed..ff43da269fe8 100644 |
328 |
+--- a/arch/arm64/mm/kasan_init.c |
329 |
++++ b/arch/arm64/mm/kasan_init.c |
330 |
+@@ -153,7 +153,7 @@ void __init kasan_init(void) |
331 |
+ clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END); |
332 |
+ |
333 |
+ vmemmap_populate(kimg_shadow_start, kimg_shadow_end, |
334 |
+- pfn_to_nid(virt_to_pfn(_text))); |
335 |
++ pfn_to_nid(virt_to_pfn(lm_alias(_text)))); |
336 |
+ |
337 |
+ /* |
338 |
+ * vmemmap_populate() has populated the shadow region that covers the |
339 |
+diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S |
340 |
+index 18d96d349a8b..f5fde8d389c9 100644 |
341 |
+--- a/arch/arm64/mm/proc.S |
342 |
++++ b/arch/arm64/mm/proc.S |
343 |
+@@ -181,7 +181,8 @@ ENDPROC(idmap_cpu_replace_ttbr1) |
344 |
+ dc cvac, cur_\()\type\()p // Ensure any existing dirty |
345 |
+ dmb sy // lines are written back before |
346 |
+ ldr \type, [cur_\()\type\()p] // loading the entry |
347 |
+- tbz \type, #0, next_\()\type // Skip invalid entries |
348 |
++ tbz \type, #0, skip_\()\type // Skip invalid and |
349 |
++ tbnz \type, #11, skip_\()\type // non-global entries |
350 |
+ .endm |
351 |
+ |
352 |
+ .macro __idmap_kpti_put_pgtable_ent_ng, type |
353 |
+@@ -241,8 +242,9 @@ ENTRY(idmap_kpti_install_ng_mappings) |
354 |
+ add end_pgdp, cur_pgdp, #(PTRS_PER_PGD * 8) |
355 |
+ do_pgd: __idmap_kpti_get_pgtable_ent pgd |
356 |
+ tbnz pgd, #1, walk_puds |
357 |
+- __idmap_kpti_put_pgtable_ent_ng pgd |
358 |
+ next_pgd: |
359 |
++ __idmap_kpti_put_pgtable_ent_ng pgd |
360 |
++skip_pgd: |
361 |
+ add cur_pgdp, cur_pgdp, #8 |
362 |
+ cmp cur_pgdp, end_pgdp |
363 |
+ b.ne do_pgd |
364 |
+@@ -270,8 +272,9 @@ walk_puds: |
365 |
+ add end_pudp, cur_pudp, #(PTRS_PER_PUD * 8) |
366 |
+ do_pud: __idmap_kpti_get_pgtable_ent pud |
367 |
+ tbnz pud, #1, walk_pmds |
368 |
+- __idmap_kpti_put_pgtable_ent_ng pud |
369 |
+ next_pud: |
370 |
++ __idmap_kpti_put_pgtable_ent_ng pud |
371 |
++skip_pud: |
372 |
+ add cur_pudp, cur_pudp, 8 |
373 |
+ cmp cur_pudp, end_pudp |
374 |
+ b.ne do_pud |
375 |
+@@ -290,8 +293,9 @@ walk_pmds: |
376 |
+ add end_pmdp, cur_pmdp, #(PTRS_PER_PMD * 8) |
377 |
+ do_pmd: __idmap_kpti_get_pgtable_ent pmd |
378 |
+ tbnz pmd, #1, walk_ptes |
379 |
+- __idmap_kpti_put_pgtable_ent_ng pmd |
380 |
+ next_pmd: |
381 |
++ __idmap_kpti_put_pgtable_ent_ng pmd |
382 |
++skip_pmd: |
383 |
+ add cur_pmdp, cur_pmdp, #8 |
384 |
+ cmp cur_pmdp, end_pmdp |
385 |
+ b.ne do_pmd |
386 |
+@@ -309,7 +313,7 @@ walk_ptes: |
387 |
+ add end_ptep, cur_ptep, #(PTRS_PER_PTE * 8) |
388 |
+ do_pte: __idmap_kpti_get_pgtable_ent pte |
389 |
+ __idmap_kpti_put_pgtable_ent_ng pte |
390 |
+-next_pte: |
391 |
++skip_pte: |
392 |
+ add cur_ptep, cur_ptep, #8 |
393 |
+ cmp cur_ptep, end_ptep |
394 |
+ b.ne do_pte |
395 |
+diff --git a/arch/sh/boards/of-generic.c b/arch/sh/boards/of-generic.c |
396 |
+index 1fb6d5714bae..fd00566677c9 100644 |
397 |
+--- a/arch/sh/boards/of-generic.c |
398 |
++++ b/arch/sh/boards/of-generic.c |
399 |
+@@ -180,10 +180,10 @@ static struct sh_machine_vector __initmv sh_of_generic_mv = { |
400 |
+ |
401 |
+ struct sh_clk_ops; |
402 |
+ |
403 |
+-void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx) |
404 |
++void __init __weak arch_init_clk_ops(struct sh_clk_ops **ops, int idx) |
405 |
+ { |
406 |
+ } |
407 |
+ |
408 |
+-void __init plat_irq_setup(void) |
409 |
++void __init __weak plat_irq_setup(void) |
410 |
+ { |
411 |
+ } |
412 |
+diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c |
413 |
+index de050d5a4506..00b56cc69d37 100644 |
414 |
+--- a/arch/x86/events/amd/core.c |
415 |
++++ b/arch/x86/events/amd/core.c |
416 |
+@@ -112,6 +112,110 @@ static __initconst const u64 amd_hw_cache_event_ids |
417 |
+ }, |
418 |
+ }; |
419 |
+ |
420 |
++static __initconst const u64 amd_hw_cache_event_ids_f17h |
421 |
++ [PERF_COUNT_HW_CACHE_MAX] |
422 |
++ [PERF_COUNT_HW_CACHE_OP_MAX] |
423 |
++ [PERF_COUNT_HW_CACHE_RESULT_MAX] = { |
424 |
++[C(L1D)] = { |
425 |
++ [C(OP_READ)] = { |
426 |
++ [C(RESULT_ACCESS)] = 0x0040, /* Data Cache Accesses */ |
427 |
++ [C(RESULT_MISS)] = 0xc860, /* L2$ access from DC Miss */ |
428 |
++ }, |
429 |
++ [C(OP_WRITE)] = { |
430 |
++ [C(RESULT_ACCESS)] = 0, |
431 |
++ [C(RESULT_MISS)] = 0, |
432 |
++ }, |
433 |
++ [C(OP_PREFETCH)] = { |
434 |
++ [C(RESULT_ACCESS)] = 0xff5a, /* h/w prefetch DC Fills */ |
435 |
++ [C(RESULT_MISS)] = 0, |
436 |
++ }, |
437 |
++}, |
438 |
++[C(L1I)] = { |
439 |
++ [C(OP_READ)] = { |
440 |
++ [C(RESULT_ACCESS)] = 0x0080, /* Instruction cache fetches */ |
441 |
++ [C(RESULT_MISS)] = 0x0081, /* Instruction cache misses */ |
442 |
++ }, |
443 |
++ [C(OP_WRITE)] = { |
444 |
++ [C(RESULT_ACCESS)] = -1, |
445 |
++ [C(RESULT_MISS)] = -1, |
446 |
++ }, |
447 |
++ [C(OP_PREFETCH)] = { |
448 |
++ [C(RESULT_ACCESS)] = 0, |
449 |
++ [C(RESULT_MISS)] = 0, |
450 |
++ }, |
451 |
++}, |
452 |
++[C(LL)] = { |
453 |
++ [C(OP_READ)] = { |
454 |
++ [C(RESULT_ACCESS)] = 0, |
455 |
++ [C(RESULT_MISS)] = 0, |
456 |
++ }, |
457 |
++ [C(OP_WRITE)] = { |
458 |
++ [C(RESULT_ACCESS)] = 0, |
459 |
++ [C(RESULT_MISS)] = 0, |
460 |
++ }, |
461 |
++ [C(OP_PREFETCH)] = { |
462 |
++ [C(RESULT_ACCESS)] = 0, |
463 |
++ [C(RESULT_MISS)] = 0, |
464 |
++ }, |
465 |
++}, |
466 |
++[C(DTLB)] = { |
467 |
++ [C(OP_READ)] = { |
468 |
++ [C(RESULT_ACCESS)] = 0xff45, /* All L2 DTLB accesses */ |
469 |
++ [C(RESULT_MISS)] = 0xf045, /* L2 DTLB misses (PT walks) */ |
470 |
++ }, |
471 |
++ [C(OP_WRITE)] = { |
472 |
++ [C(RESULT_ACCESS)] = 0, |
473 |
++ [C(RESULT_MISS)] = 0, |
474 |
++ }, |
475 |
++ [C(OP_PREFETCH)] = { |
476 |
++ [C(RESULT_ACCESS)] = 0, |
477 |
++ [C(RESULT_MISS)] = 0, |
478 |
++ }, |
479 |
++}, |
480 |
++[C(ITLB)] = { |
481 |
++ [C(OP_READ)] = { |
482 |
++ [C(RESULT_ACCESS)] = 0x0084, /* L1 ITLB misses, L2 ITLB hits */ |
483 |
++ [C(RESULT_MISS)] = 0xff85, /* L1 ITLB misses, L2 misses */ |
484 |
++ }, |
485 |
++ [C(OP_WRITE)] = { |
486 |
++ [C(RESULT_ACCESS)] = -1, |
487 |
++ [C(RESULT_MISS)] = -1, |
488 |
++ }, |
489 |
++ [C(OP_PREFETCH)] = { |
490 |
++ [C(RESULT_ACCESS)] = -1, |
491 |
++ [C(RESULT_MISS)] = -1, |
492 |
++ }, |
493 |
++}, |
494 |
++[C(BPU)] = { |
495 |
++ [C(OP_READ)] = { |
496 |
++ [C(RESULT_ACCESS)] = 0x00c2, /* Retired Branch Instr. */ |
497 |
++ [C(RESULT_MISS)] = 0x00c3, /* Retired Mispredicted BI */ |
498 |
++ }, |
499 |
++ [C(OP_WRITE)] = { |
500 |
++ [C(RESULT_ACCESS)] = -1, |
501 |
++ [C(RESULT_MISS)] = -1, |
502 |
++ }, |
503 |
++ [C(OP_PREFETCH)] = { |
504 |
++ [C(RESULT_ACCESS)] = -1, |
505 |
++ [C(RESULT_MISS)] = -1, |
506 |
++ }, |
507 |
++}, |
508 |
++[C(NODE)] = { |
509 |
++ [C(OP_READ)] = { |
510 |
++ [C(RESULT_ACCESS)] = 0, |
511 |
++ [C(RESULT_MISS)] = 0, |
512 |
++ }, |
513 |
++ [C(OP_WRITE)] = { |
514 |
++ [C(RESULT_ACCESS)] = -1, |
515 |
++ [C(RESULT_MISS)] = -1, |
516 |
++ }, |
517 |
++ [C(OP_PREFETCH)] = { |
518 |
++ [C(RESULT_ACCESS)] = -1, |
519 |
++ [C(RESULT_MISS)] = -1, |
520 |
++ }, |
521 |
++}, |
522 |
++}; |
523 |
++ |
524 |
+ /* |
525 |
+ * AMD Performance Monitor K7 and later, up to and including Family 16h: |
526 |
+ */ |
527 |
+@@ -731,9 +835,10 @@ __init int amd_pmu_init(void) |
528 |
+ x86_pmu.amd_nb_constraints = 0; |
529 |
+ } |
530 |
+ |
531 |
+- /* Events are common for all AMDs */ |
532 |
+- memcpy(hw_cache_event_ids, amd_hw_cache_event_ids, |
533 |
+- sizeof(hw_cache_event_ids)); |
534 |
++ if (boot_cpu_data.x86 >= 0x17) |
535 |
++ memcpy(hw_cache_event_ids, amd_hw_cache_event_ids_f17h, sizeof(hw_cache_event_ids)); |
536 |
++ else |
537 |
++ memcpy(hw_cache_event_ids, amd_hw_cache_event_ids, sizeof(hw_cache_event_ids)); |
538 |
+ |
539 |
+ return 0; |
540 |
+ } |
541 |
+diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h |
542 |
+index 37f2e0b377ad..4141ead86879 100644 |
543 |
+--- a/arch/x86/include/asm/stacktrace.h |
544 |
++++ b/arch/x86/include/asm/stacktrace.h |
545 |
+@@ -55,13 +55,16 @@ extern int kstack_depth_to_print; |
546 |
+ static inline unsigned long * |
547 |
+ get_frame_pointer(struct task_struct *task, struct pt_regs *regs) |
548 |
+ { |
549 |
++ struct inactive_task_frame *frame; |
550 |
++ |
551 |
+ if (regs) |
552 |
+ return (unsigned long *)regs->bp; |
553 |
+ |
554 |
+ if (task == current) |
555 |
+ return __builtin_frame_address(0); |
556 |
+ |
557 |
+- return (unsigned long *)((struct inactive_task_frame *)task->thread.sp)->bp; |
558 |
++ frame = (struct inactive_task_frame *)task->thread.sp; |
559 |
++ return (unsigned long *)READ_ONCE_NOCHECK(frame->bp); |
560 |
+ } |
561 |
+ #else |
562 |
+ static inline unsigned long * |
563 |
+diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S |
564 |
+index 169963f471bb..50b8ed0317a3 100644 |
565 |
+--- a/arch/x86/kernel/acpi/wakeup_64.S |
566 |
++++ b/arch/x86/kernel/acpi/wakeup_64.S |
567 |
+@@ -109,6 +109,15 @@ ENTRY(do_suspend_lowlevel) |
568 |
+ movq pt_regs_r14(%rax), %r14 |
569 |
+ movq pt_regs_r15(%rax), %r15 |
570 |
+ |
571 |
++#ifdef CONFIG_KASAN |
572 |
++ /* |
573 |
++ * The suspend path may have poisoned some areas deeper in the stack, |
574 |
++ * which we now need to unpoison. |
575 |
++ */ |
576 |
++ movq %rsp, %rdi |
577 |
++ call kasan_unpoison_task_stack_below |
578 |
++#endif |
579 |
++ |
580 |
+ xorl %eax, %eax |
581 |
+ addq $8, %rsp |
582 |
+ FRAME_END |
583 |
+diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c |
584 |
+index 3e0199ee5a2f..0372913e0134 100644 |
585 |
+--- a/arch/x86/kernel/cpu/mcheck/mce-severity.c |
586 |
++++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c |
587 |
+@@ -148,6 +148,11 @@ static struct severity { |
588 |
+ SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_DATA), |
589 |
+ KERNEL |
590 |
+ ), |
591 |
++ MCESEV( |
592 |
++ PANIC, "Instruction fetch error in kernel", |
593 |
++ SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_INSTR), |
594 |
++ KERNEL |
595 |
++ ), |
596 |
+ #endif |
597 |
+ MCESEV( |
598 |
+ PANIC, "Action required: unknown MCACOD", |
599 |
+diff --git a/arch/x86/kernel/unwind_frame.c b/arch/x86/kernel/unwind_frame.c |
600 |
+index a2456d4d286a..9b8b3cb2e934 100644 |
601 |
+--- a/arch/x86/kernel/unwind_frame.c |
602 |
++++ b/arch/x86/kernel/unwind_frame.c |
603 |
+@@ -6,6 +6,21 @@ |
604 |
+ |
605 |
+ #define FRAME_HEADER_SIZE (sizeof(long) * 2) |
606 |
+ |
607 |
++/* |
608 |
++ * This disables KASAN checking when reading a value from another task's stack, |
609 |
++ * since the other task could be running on another CPU and could have poisoned |
610 |
++ * the stack in the meantime. |
611 |
++ */ |
612 |
++#define READ_ONCE_TASK_STACK(task, x) \ |
613 |
++({ \ |
614 |
++ unsigned long val; \ |
615 |
++ if (task == current) \ |
616 |
++ val = READ_ONCE(x); \ |
617 |
++ else \ |
618 |
++ val = READ_ONCE_NOCHECK(x); \ |
619 |
++ val; \ |
620 |
++}) |
621 |
++ |
622 |
+ unsigned long unwind_get_return_address(struct unwind_state *state) |
623 |
+ { |
624 |
+ unsigned long addr; |
625 |
+@@ -14,7 +29,8 @@ unsigned long unwind_get_return_address(struct unwind_state *state) |
626 |
+ if (unwind_done(state)) |
627 |
+ return 0; |
628 |
+ |
629 |
+- addr = ftrace_graph_ret_addr(state->task, &state->graph_idx, *addr_p, |
630 |
++ addr = READ_ONCE_TASK_STACK(state->task, *addr_p); |
631 |
++ addr = ftrace_graph_ret_addr(state->task, &state->graph_idx, addr, |
632 |
+ addr_p); |
633 |
+ |
634 |
+ return __kernel_text_address(addr) ? addr : 0; |
635 |
+@@ -48,7 +64,7 @@ bool unwind_next_frame(struct unwind_state *state) |
636 |
+ if (unwind_done(state)) |
637 |
+ return false; |
638 |
+ |
639 |
+- next_bp = (unsigned long *)*state->bp; |
640 |
++ next_bp = (unsigned long *)READ_ONCE_TASK_STACK(state->task,*state->bp); |
641 |
+ |
642 |
+ /* make sure the next frame's data is accessible */ |
643 |
+ if (!update_stack_state(state, next_bp, FRAME_HEADER_SIZE)) |
644 |
+diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c |
645 |
+index c4328d9d9981..f838119d12b2 100644 |
646 |
+--- a/drivers/block/xsysace.c |
647 |
++++ b/drivers/block/xsysace.c |
648 |
+@@ -1062,6 +1062,8 @@ static int ace_setup(struct ace_device *ace) |
649 |
+ return 0; |
650 |
+ |
651 |
+ err_read: |
652 |
++ /* prevent double queue cleanup */ |
653 |
++ ace->gd->queue = NULL; |
654 |
+ put_disk(ace->gd); |
655 |
+ err_alloc_disk: |
656 |
+ blk_cleanup_queue(ace->queue); |
657 |
+diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c |
658 |
+index d7179dd3c9ef..3cafa1d28fed 100644 |
659 |
+--- a/drivers/hid/hid-debug.c |
660 |
++++ b/drivers/hid/hid-debug.c |
661 |
+@@ -1058,10 +1058,15 @@ static int hid_debug_rdesc_show(struct seq_file *f, void *p) |
662 |
+ seq_printf(f, "\n\n"); |
663 |
+ |
664 |
+ /* dump parsed data and input mappings */ |
665 |
++ if (down_interruptible(&hdev->driver_input_lock)) |
666 |
++ return 0; |
667 |
++ |
668 |
+ hid_dump_device(hdev, f); |
669 |
+ seq_printf(f, "\n"); |
670 |
+ hid_dump_input_mapping(hdev, f); |
671 |
+ |
672 |
++ up(&hdev->driver_input_lock); |
673 |
++ |
674 |
+ return 0; |
675 |
+ } |
676 |
+ |
677 |
+diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c |
678 |
+index 2e2515a4c070..3198faf5cff4 100644 |
679 |
+--- a/drivers/hid/hid-logitech-hidpp.c |
680 |
++++ b/drivers/hid/hid-logitech-hidpp.c |
681 |
+@@ -1282,6 +1282,13 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) |
682 |
+ kfree(data); |
683 |
+ return -ENOMEM; |
684 |
+ } |
685 |
++ data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue"); |
686 |
++ if (!data->wq) { |
687 |
++ kfree(data->effect_ids); |
688 |
++ kfree(data); |
689 |
++ return -ENOMEM; |
690 |
++ } |
691 |
++ |
692 |
+ data->hidpp = hidpp; |
693 |
+ data->feature_index = feature_index; |
694 |
+ data->version = version; |
695 |
+@@ -1326,7 +1333,6 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) |
696 |
+ /* ignore boost value at response.fap.params[2] */ |
697 |
+ |
698 |
+ /* init the hardware command queue */ |
699 |
+- data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue"); |
700 |
+ atomic_set(&data->workqueue_size, 0); |
701 |
+ |
702 |
+ /* initialize with zero autocenter to get wheel in usable state */ |
703 |
+diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c |
704 |
+index 2a44a2c3e859..6914cc18b4a1 100644 |
705 |
+--- a/drivers/infiniband/ulp/srpt/ib_srpt.c |
706 |
++++ b/drivers/infiniband/ulp/srpt/ib_srpt.c |
707 |
+@@ -2368,8 +2368,19 @@ static void srpt_queue_tm_rsp(struct se_cmd *cmd) |
708 |
+ srpt_queue_response(cmd); |
709 |
+ } |
710 |
+ |
711 |
++/* |
712 |
++ * This function is called for aborted commands if no response is sent to the |
713 |
++ * initiator. Make sure that the credits freed by aborting a command are |
714 |
++ * returned to the initiator the next time a response is sent by incrementing |
715 |
++ * ch->req_lim_delta. |
716 |
++ */ |
717 |
+ static void srpt_aborted_task(struct se_cmd *cmd) |
718 |
+ { |
719 |
++ struct srpt_send_ioctx *ioctx = container_of(cmd, |
720 |
++ struct srpt_send_ioctx, cmd); |
721 |
++ struct srpt_rdma_ch *ch = ioctx->ch; |
722 |
++ |
723 |
++ atomic_inc(&ch->req_lim_delta); |
724 |
+ } |
725 |
+ |
726 |
+ static int srpt_queue_status(struct se_cmd *cmd) |
727 |
+diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c |
728 |
+index 7544888c4749..b8dbde746b4e 100644 |
729 |
+--- a/drivers/input/keyboard/snvs_pwrkey.c |
730 |
++++ b/drivers/input/keyboard/snvs_pwrkey.c |
731 |
+@@ -156,6 +156,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) |
732 |
+ return error; |
733 |
+ } |
734 |
+ |
735 |
++ pdata->input = input; |
736 |
++ platform_set_drvdata(pdev, pdata); |
737 |
++ |
738 |
+ error = devm_request_irq(&pdev->dev, pdata->irq, |
739 |
+ imx_snvs_pwrkey_interrupt, |
740 |
+ 0, pdev->name, pdev); |
741 |
+@@ -171,9 +174,6 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) |
742 |
+ return error; |
743 |
+ } |
744 |
+ |
745 |
+- pdata->input = input; |
746 |
+- platform_set_drvdata(pdev, pdata); |
747 |
+- |
748 |
+ device_init_wakeup(&pdev->dev, pdata->wakeup); |
749 |
+ |
750 |
+ return 0; |
751 |
+diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c |
752 |
+index 56cfb5ca9c95..0a72228734ae 100644 |
753 |
+--- a/drivers/media/i2c/ov7670.c |
754 |
++++ b/drivers/media/i2c/ov7670.c |
755 |
+@@ -155,10 +155,10 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); |
756 |
+ #define REG_GFIX 0x69 /* Fix gain control */ |
757 |
+ |
758 |
+ #define REG_DBLV 0x6b /* PLL control an debugging */ |
759 |
+-#define DBLV_BYPASS 0x00 /* Bypass PLL */ |
760 |
+-#define DBLV_X4 0x01 /* clock x4 */ |
761 |
+-#define DBLV_X6 0x10 /* clock x6 */ |
762 |
+-#define DBLV_X8 0x11 /* clock x8 */ |
763 |
++#define DBLV_BYPASS 0x0a /* Bypass PLL */ |
764 |
++#define DBLV_X4 0x4a /* clock x4 */ |
765 |
++#define DBLV_X6 0x8a /* clock x6 */ |
766 |
++#define DBLV_X8 0xca /* clock x8 */ |
767 |
+ |
768 |
+ #define REG_REG76 0x76 /* OV's name */ |
769 |
+ #define R76_BLKPCOR 0x80 /* Black pixel correction enable */ |
770 |
+@@ -833,7 +833,7 @@ static int ov7675_set_framerate(struct v4l2_subdev *sd, |
771 |
+ if (ret < 0) |
772 |
+ return ret; |
773 |
+ |
774 |
+- return ov7670_write(sd, REG_DBLV, DBLV_X4); |
775 |
++ return 0; |
776 |
+ } |
777 |
+ |
778 |
+ static void ov7670_get_framerate_legacy(struct v4l2_subdev *sd, |
779 |
+@@ -1578,11 +1578,7 @@ static int ov7670_probe(struct i2c_client *client, |
780 |
+ if (config->clock_speed) |
781 |
+ info->clock_speed = config->clock_speed; |
782 |
+ |
783 |
+- /* |
784 |
+- * It should be allowed for ov7670 too when it is migrated to |
785 |
+- * the new frame rate formula. |
786 |
+- */ |
787 |
+- if (config->pll_bypass && id->driver_data != MODEL_OV7670) |
788 |
++ if (config->pll_bypass) |
789 |
+ info->pll_bypass = true; |
790 |
+ |
791 |
+ if (config->pclk_hb_disable) |
792 |
+diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c |
793 |
+index 7d16c51e6913..641a532b67cb 100644 |
794 |
+--- a/drivers/net/bonding/bond_sysfs_slave.c |
795 |
++++ b/drivers/net/bonding/bond_sysfs_slave.c |
796 |
+@@ -55,7 +55,9 @@ static SLAVE_ATTR_RO(link_failure_count); |
797 |
+ |
798 |
+ static ssize_t perm_hwaddr_show(struct slave *slave, char *buf) |
799 |
+ { |
800 |
+- return sprintf(buf, "%pM\n", slave->perm_hwaddr); |
801 |
++ return sprintf(buf, "%*phC\n", |
802 |
++ slave->dev->addr_len, |
803 |
++ slave->perm_hwaddr); |
804 |
+ } |
805 |
+ static SLAVE_ATTR_RO(perm_hwaddr); |
806 |
+ |
807 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
808 |
+index 45ea2718c65d..620a470eb4c8 100644 |
809 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
810 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
811 |
+@@ -5954,8 +5954,15 @@ static int bnxt_cfg_rx_mode(struct bnxt *bp) |
812 |
+ |
813 |
+ skip_uc: |
814 |
+ rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0); |
815 |
++ if (rc && vnic->mc_list_count) { |
816 |
++ netdev_info(bp->dev, "Failed setting MC filters rc: %d, turning on ALL_MCAST mode\n", |
817 |
++ rc); |
818 |
++ vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST; |
819 |
++ vnic->mc_list_count = 0; |
820 |
++ rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0); |
821 |
++ } |
822 |
+ if (rc) |
823 |
+- netdev_err(bp->dev, "HWRM cfa l2 rx mask failure rc: %x\n", |
824 |
++ netdev_err(bp->dev, "HWRM cfa l2 rx mask failure rc: %d\n", |
825 |
+ rc); |
826 |
+ |
827 |
+ return rc; |
828 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c b/drivers/net/ethernet/hisilicon/hns/hnae.c |
829 |
+index 06bc8638501e..66e7a5fd4249 100644 |
830 |
+--- a/drivers/net/ethernet/hisilicon/hns/hnae.c |
831 |
++++ b/drivers/net/ethernet/hisilicon/hns/hnae.c |
832 |
+@@ -146,7 +146,6 @@ out_buffer_fail: |
833 |
+ /* free desc along with its attached buffer */ |
834 |
+ static void hnae_free_desc(struct hnae_ring *ring) |
835 |
+ { |
836 |
+- hnae_free_buffers(ring); |
837 |
+ dma_unmap_single(ring_to_dev(ring), ring->desc_dma_addr, |
838 |
+ ring->desc_num * sizeof(ring->desc[0]), |
839 |
+ ring_to_dma_dir(ring)); |
840 |
+@@ -179,6 +178,9 @@ static int hnae_alloc_desc(struct hnae_ring *ring) |
841 |
+ /* fini ring, also free the buffer for the ring */ |
842 |
+ static void hnae_fini_ring(struct hnae_ring *ring) |
843 |
+ { |
844 |
++ if (is_rx_ring(ring)) |
845 |
++ hnae_free_buffers(ring); |
846 |
++ |
847 |
+ hnae_free_desc(ring); |
848 |
+ kfree(ring->desc_cb); |
849 |
+ ring->desc_cb = NULL; |
850 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
851 |
+index ad8681cf5ef0..24a815997ec5 100644 |
852 |
+--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
853 |
++++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c |
854 |
+@@ -28,9 +28,6 @@ |
855 |
+ |
856 |
+ #define SERVICE_TIMER_HZ (1 * HZ) |
857 |
+ |
858 |
+-#define NIC_TX_CLEAN_MAX_NUM 256 |
859 |
+-#define NIC_RX_CLEAN_MAX_NUM 64 |
860 |
+- |
861 |
+ #define RCB_IRQ_NOT_INITED 0 |
862 |
+ #define RCB_IRQ_INITED 1 |
863 |
+ #define HNS_BUFFER_SIZE_2048 2048 |
864 |
+@@ -375,8 +372,6 @@ netdev_tx_t hns_nic_net_xmit_hw(struct net_device *ndev, |
865 |
+ wmb(); /* commit all data before submit */ |
866 |
+ assert(skb->queue_mapping < priv->ae_handle->q_num); |
867 |
+ hnae_queue_xmit(priv->ae_handle->qs[skb->queue_mapping], buf_num); |
868 |
+- ring->stats.tx_pkts++; |
869 |
+- ring->stats.tx_bytes += skb->len; |
870 |
+ |
871 |
+ return NETDEV_TX_OK; |
872 |
+ |
873 |
+@@ -916,6 +911,9 @@ static int hns_nic_tx_poll_one(struct hns_nic_ring_data *ring_data, |
874 |
+ /* issue prefetch for next Tx descriptor */ |
875 |
+ prefetch(&ring->desc_cb[ring->next_to_clean]); |
876 |
+ } |
877 |
++ /* update tx ring statistics. */ |
878 |
++ ring->stats.tx_pkts += pkts; |
879 |
++ ring->stats.tx_bytes += bytes; |
880 |
+ |
881 |
+ NETIF_TX_UNLOCK(ndev); |
882 |
+ |
883 |
+@@ -1821,7 +1819,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv) |
884 |
+ hns_nic_tx_fini_pro_v2; |
885 |
+ |
886 |
+ netif_napi_add(priv->netdev, &rd->napi, |
887 |
+- hns_nic_common_poll, NIC_TX_CLEAN_MAX_NUM); |
888 |
++ hns_nic_common_poll, NAPI_POLL_WEIGHT); |
889 |
+ rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED; |
890 |
+ } |
891 |
+ for (i = h->q_num; i < h->q_num * 2; i++) { |
892 |
+@@ -1834,7 +1832,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv) |
893 |
+ hns_nic_rx_fini_pro_v2; |
894 |
+ |
895 |
+ netif_napi_add(priv->netdev, &rd->napi, |
896 |
+- hns_nic_common_poll, NIC_RX_CLEAN_MAX_NUM); |
897 |
++ hns_nic_common_poll, NAPI_POLL_WEIGHT); |
898 |
+ rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED; |
899 |
+ } |
900 |
+ |
901 |
+diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h |
902 |
+index 2688180a7acd..f948eec7b35f 100644 |
903 |
+--- a/drivers/net/ethernet/intel/igb/e1000_defines.h |
904 |
++++ b/drivers/net/ethernet/intel/igb/e1000_defines.h |
905 |
+@@ -193,6 +193,8 @@ |
906 |
+ /* enable link status from external LINK_0 and LINK_1 pins */ |
907 |
+ #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ |
908 |
+ #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ |
909 |
++#define E1000_CTRL_ADVD3WUC 0x00100000 /* D3 WUC */ |
910 |
++#define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 /* PHY PM enable */ |
911 |
+ #define E1000_CTRL_SDP0_DIR 0x00400000 /* SDP0 Data direction */ |
912 |
+ #define E1000_CTRL_SDP1_DIR 0x00800000 /* SDP1 Data direction */ |
913 |
+ #define E1000_CTRL_RST 0x04000000 /* Global reset */ |
914 |
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c |
915 |
+index 82e48e355fb9..7956176c2c73 100644 |
916 |
+--- a/drivers/net/ethernet/intel/igb/igb_main.c |
917 |
++++ b/drivers/net/ethernet/intel/igb/igb_main.c |
918 |
+@@ -7548,9 +7548,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, |
919 |
+ struct e1000_hw *hw = &adapter->hw; |
920 |
+ u32 ctrl, rctl, status; |
921 |
+ u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; |
922 |
+-#ifdef CONFIG_PM |
923 |
+- int retval = 0; |
924 |
+-#endif |
925 |
++ bool wake; |
926 |
+ |
927 |
+ rtnl_lock(); |
928 |
+ netif_device_detach(netdev); |
929 |
+@@ -7563,14 +7561,6 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, |
930 |
+ igb_clear_interrupt_scheme(adapter); |
931 |
+ rtnl_unlock(); |
932 |
+ |
933 |
+-#ifdef CONFIG_PM |
934 |
+- if (!runtime) { |
935 |
+- retval = pci_save_state(pdev); |
936 |
+- if (retval) |
937 |
+- return retval; |
938 |
+- } |
939 |
+-#endif |
940 |
+- |
941 |
+ status = rd32(E1000_STATUS); |
942 |
+ if (status & E1000_STATUS_LU) |
943 |
+ wufc &= ~E1000_WUFC_LNKC; |
944 |
+@@ -7587,10 +7577,6 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, |
945 |
+ } |
946 |
+ |
947 |
+ ctrl = rd32(E1000_CTRL); |
948 |
+- /* advertise wake from D3Cold */ |
949 |
+- #define E1000_CTRL_ADVD3WUC 0x00100000 |
950 |
+- /* phy power management enable */ |
951 |
+- #define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 |
952 |
+ ctrl |= E1000_CTRL_ADVD3WUC; |
953 |
+ wr32(E1000_CTRL, ctrl); |
954 |
+ |
955 |
+@@ -7604,12 +7590,15 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, |
956 |
+ wr32(E1000_WUFC, 0); |
957 |
+ } |
958 |
+ |
959 |
+- *enable_wake = wufc || adapter->en_mng_pt; |
960 |
+- if (!*enable_wake) |
961 |
++ wake = wufc || adapter->en_mng_pt; |
962 |
++ if (!wake) |
963 |
+ igb_power_down_link(adapter); |
964 |
+ else |
965 |
+ igb_power_up_link(adapter); |
966 |
+ |
967 |
++ if (enable_wake) |
968 |
++ *enable_wake = wake; |
969 |
++ |
970 |
+ /* Release control of h/w to f/w. If f/w is AMT enabled, this |
971 |
+ * would have already happened in close and is redundant. |
972 |
+ */ |
973 |
+@@ -7624,22 +7613,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, |
974 |
+ #ifdef CONFIG_PM_SLEEP |
975 |
+ static int igb_suspend(struct device *dev) |
976 |
+ { |
977 |
+- int retval; |
978 |
+- bool wake; |
979 |
+- struct pci_dev *pdev = to_pci_dev(dev); |
980 |
+- |
981 |
+- retval = __igb_shutdown(pdev, &wake, 0); |
982 |
+- if (retval) |
983 |
+- return retval; |
984 |
+- |
985 |
+- if (wake) { |
986 |
+- pci_prepare_to_sleep(pdev); |
987 |
+- } else { |
988 |
+- pci_wake_from_d3(pdev, false); |
989 |
+- pci_set_power_state(pdev, PCI_D3hot); |
990 |
+- } |
991 |
+- |
992 |
+- return 0; |
993 |
++ return __igb_shutdown(to_pci_dev(dev), NULL, 0); |
994 |
+ } |
995 |
+ #endif /* CONFIG_PM_SLEEP */ |
996 |
+ |
997 |
+@@ -7707,22 +7681,7 @@ static int igb_runtime_idle(struct device *dev) |
998 |
+ |
999 |
+ static int igb_runtime_suspend(struct device *dev) |
1000 |
+ { |
1001 |
+- struct pci_dev *pdev = to_pci_dev(dev); |
1002 |
+- int retval; |
1003 |
+- bool wake; |
1004 |
+- |
1005 |
+- retval = __igb_shutdown(pdev, &wake, 1); |
1006 |
+- if (retval) |
1007 |
+- return retval; |
1008 |
+- |
1009 |
+- if (wake) { |
1010 |
+- pci_prepare_to_sleep(pdev); |
1011 |
+- } else { |
1012 |
+- pci_wake_from_d3(pdev, false); |
1013 |
+- pci_set_power_state(pdev, PCI_D3hot); |
1014 |
+- } |
1015 |
+- |
1016 |
+- return 0; |
1017 |
++ return __igb_shutdown(to_pci_dev(dev), NULL, 1); |
1018 |
+ } |
1019 |
+ |
1020 |
+ static int igb_runtime_resume(struct device *dev) |
1021 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c |
1022 |
+index da9246f6c31e..d1a3a35ba87b 100644 |
1023 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c |
1024 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c |
1025 |
+@@ -92,8 +92,7 @@ static int arm_vport_context_events_cmd(struct mlx5_core_dev *dev, u16 vport, |
1026 |
+ opcode, MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT); |
1027 |
+ MLX5_SET(modify_nic_vport_context_in, in, field_select.change_event, 1); |
1028 |
+ MLX5_SET(modify_nic_vport_context_in, in, vport_number, vport); |
1029 |
+- if (vport) |
1030 |
+- MLX5_SET(modify_nic_vport_context_in, in, other_vport, 1); |
1031 |
++ MLX5_SET(modify_nic_vport_context_in, in, other_vport, 1); |
1032 |
+ nic_vport_ctx = MLX5_ADDR_OF(modify_nic_vport_context_in, |
1033 |
+ in, nic_vport_context); |
1034 |
+ |
1035 |
+@@ -121,8 +120,7 @@ static int modify_esw_vport_context_cmd(struct mlx5_core_dev *dev, u16 vport, |
1036 |
+ MLX5_SET(modify_esw_vport_context_in, in, opcode, |
1037 |
+ MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT); |
1038 |
+ MLX5_SET(modify_esw_vport_context_in, in, vport_number, vport); |
1039 |
+- if (vport) |
1040 |
+- MLX5_SET(modify_esw_vport_context_in, in, other_vport, 1); |
1041 |
++ MLX5_SET(modify_esw_vport_context_in, in, other_vport, 1); |
1042 |
+ return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); |
1043 |
+ } |
1044 |
+ |
1045 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c |
1046 |
+index ce97e522566a..77dc5842bd0b 100644 |
1047 |
+--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c |
1048 |
++++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c |
1049 |
+@@ -205,6 +205,11 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, |
1050 |
+ if (unlikely(rdes0 & RDES0_OWN)) |
1051 |
+ return dma_own; |
1052 |
+ |
1053 |
++ if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) { |
1054 |
++ stats->rx_length_errors++; |
1055 |
++ return discard_frame; |
1056 |
++ } |
1057 |
++ |
1058 |
+ if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) { |
1059 |
+ if (unlikely(rdes0 & RDES0_DESCRIPTOR_ERROR)) { |
1060 |
+ x->rx_desc++; |
1061 |
+@@ -235,9 +240,10 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, |
1062 |
+ * It doesn't match with the information reported into the databook. |
1063 |
+ * At any rate, we need to understand if the CSUM hw computation is ok |
1064 |
+ * and report this info to the upper layers. */ |
1065 |
+- ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR), |
1066 |
+- !!(rdes0 & RDES0_FRAME_TYPE), |
1067 |
+- !!(rdes0 & ERDES0_RX_MAC_ADDR)); |
1068 |
++ if (likely(ret == good_frame)) |
1069 |
++ ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR), |
1070 |
++ !!(rdes0 & RDES0_FRAME_TYPE), |
1071 |
++ !!(rdes0 & ERDES0_RX_MAC_ADDR)); |
1072 |
+ |
1073 |
+ if (unlikely(rdes0 & RDES0_DRIBBLING)) |
1074 |
+ x->dribbling_bit++; |
1075 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c |
1076 |
+index fd78406e2e9a..01f8f2e94c0f 100644 |
1077 |
+--- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c |
1078 |
++++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c |
1079 |
+@@ -95,8 +95,6 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x, |
1080 |
+ return dma_own; |
1081 |
+ |
1082 |
+ if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) { |
1083 |
+- pr_warn("%s: Oversized frame spanned multiple buffers\n", |
1084 |
+- __func__); |
1085 |
+ stats->rx_length_errors++; |
1086 |
+ return discard_frame; |
1087 |
+ } |
1088 |
+diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c |
1089 |
+index 520352327104..77357b07f6c9 100644 |
1090 |
+--- a/drivers/net/phy/marvell.c |
1091 |
++++ b/drivers/net/phy/marvell.c |
1092 |
+@@ -1429,9 +1429,10 @@ static int marvell_get_sset_count(struct phy_device *phydev) |
1093 |
+ |
1094 |
+ static void marvell_get_strings(struct phy_device *phydev, u8 *data) |
1095 |
+ { |
1096 |
++ int count = marvell_get_sset_count(phydev); |
1097 |
+ int i; |
1098 |
+ |
1099 |
+- for (i = 0; i < ARRAY_SIZE(marvell_hw_stats); i++) { |
1100 |
++ for (i = 0; i < count; i++) { |
1101 |
+ memcpy(data + i * ETH_GSTRING_LEN, |
1102 |
+ marvell_hw_stats[i].string, ETH_GSTRING_LEN); |
1103 |
+ } |
1104 |
+@@ -1470,9 +1471,10 @@ static u64 marvell_get_stat(struct phy_device *phydev, int i) |
1105 |
+ static void marvell_get_stats(struct phy_device *phydev, |
1106 |
+ struct ethtool_stats *stats, u64 *data) |
1107 |
+ { |
1108 |
++ int count = marvell_get_sset_count(phydev); |
1109 |
+ int i; |
1110 |
+ |
1111 |
+- for (i = 0; i < ARRAY_SIZE(marvell_hw_stats); i++) |
1112 |
++ for (i = 0; i < count; i++) |
1113 |
+ data[i] = marvell_get_stat(phydev, i); |
1114 |
+ } |
1115 |
+ |
1116 |
+diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c |
1117 |
+index f12753eb3216..96ea6c76be6e 100644 |
1118 |
+--- a/drivers/nvme/target/core.c |
1119 |
++++ b/drivers/nvme/target/core.c |
1120 |
+@@ -709,6 +709,15 @@ bool nvmet_host_allowed(struct nvmet_req *req, struct nvmet_subsys *subsys, |
1121 |
+ return __nvmet_host_allowed(subsys, hostnqn); |
1122 |
+ } |
1123 |
+ |
1124 |
++static void nvmet_fatal_error_handler(struct work_struct *work) |
1125 |
++{ |
1126 |
++ struct nvmet_ctrl *ctrl = |
1127 |
++ container_of(work, struct nvmet_ctrl, fatal_err_work); |
1128 |
++ |
1129 |
++ pr_err("ctrl %d fatal error occurred!\n", ctrl->cntlid); |
1130 |
++ ctrl->ops->delete_ctrl(ctrl); |
1131 |
++} |
1132 |
++ |
1133 |
+ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn, |
1134 |
+ struct nvmet_req *req, u32 kato, struct nvmet_ctrl **ctrlp) |
1135 |
+ { |
1136 |
+@@ -747,6 +756,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn, |
1137 |
+ |
1138 |
+ INIT_WORK(&ctrl->async_event_work, nvmet_async_event_work); |
1139 |
+ INIT_LIST_HEAD(&ctrl->async_events); |
1140 |
++ INIT_WORK(&ctrl->fatal_err_work, nvmet_fatal_error_handler); |
1141 |
+ |
1142 |
+ memcpy(ctrl->subsysnqn, subsysnqn, NVMF_NQN_SIZE); |
1143 |
+ memcpy(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE); |
1144 |
+@@ -849,21 +859,11 @@ void nvmet_ctrl_put(struct nvmet_ctrl *ctrl) |
1145 |
+ kref_put(&ctrl->ref, nvmet_ctrl_free); |
1146 |
+ } |
1147 |
+ |
1148 |
+-static void nvmet_fatal_error_handler(struct work_struct *work) |
1149 |
+-{ |
1150 |
+- struct nvmet_ctrl *ctrl = |
1151 |
+- container_of(work, struct nvmet_ctrl, fatal_err_work); |
1152 |
+- |
1153 |
+- pr_err("ctrl %d fatal error occurred!\n", ctrl->cntlid); |
1154 |
+- ctrl->ops->delete_ctrl(ctrl); |
1155 |
+-} |
1156 |
+- |
1157 |
+ void nvmet_ctrl_fatal_error(struct nvmet_ctrl *ctrl) |
1158 |
+ { |
1159 |
+ mutex_lock(&ctrl->lock); |
1160 |
+ if (!(ctrl->csts & NVME_CSTS_CFS)) { |
1161 |
+ ctrl->csts |= NVME_CSTS_CFS; |
1162 |
+- INIT_WORK(&ctrl->fatal_err_work, nvmet_fatal_error_handler); |
1163 |
+ schedule_work(&ctrl->fatal_err_work); |
1164 |
+ } |
1165 |
+ mutex_unlock(&ctrl->lock); |
1166 |
+diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c |
1167 |
+index f85cae240f12..7e92e491c2e7 100644 |
1168 |
+--- a/drivers/rtc/rtc-da9063.c |
1169 |
++++ b/drivers/rtc/rtc-da9063.c |
1170 |
+@@ -480,6 +480,13 @@ static int da9063_rtc_probe(struct platform_device *pdev) |
1171 |
+ da9063_data_to_tm(data, &rtc->alarm_time, rtc); |
1172 |
+ rtc->rtc_sync = false; |
1173 |
+ |
1174 |
++ /* |
1175 |
++ * TODO: some models have alarms on a minute boundary but still support |
1176 |
++ * real hardware interrupts. Add this once the core supports it. |
1177 |
++ */ |
1178 |
++ if (config->rtc_data_start != RTC_SEC) |
1179 |
++ rtc->rtc_dev->uie_unsupported = 1; |
1180 |
++ |
1181 |
+ irq_alarm = platform_get_irq_byname(pdev, "ALARM"); |
1182 |
+ ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL, |
1183 |
+ da9063_alarm_event, |
1184 |
+diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c |
1185 |
+index 17b6235d67a5..600fb7f93939 100644 |
1186 |
+--- a/drivers/rtc/rtc-sh.c |
1187 |
++++ b/drivers/rtc/rtc-sh.c |
1188 |
+@@ -454,7 +454,7 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm) |
1189 |
+ static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off) |
1190 |
+ { |
1191 |
+ unsigned int byte; |
1192 |
+- int value = 0xff; /* return 0xff for ignored values */ |
1193 |
++ int value = -1; /* return -1 for ignored values */ |
1194 |
+ |
1195 |
+ byte = readb(rtc->regbase + reg_off); |
1196 |
+ if (byte & AR_ENB) { |
1197 |
+diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c |
1198 |
+index 282ea00d0f87..9d555b63d2e2 100644 |
1199 |
+--- a/drivers/scsi/scsi_devinfo.c |
1200 |
++++ b/drivers/scsi/scsi_devinfo.c |
1201 |
+@@ -249,6 +249,7 @@ static struct { |
1202 |
+ {"NETAPP", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, |
1203 |
+ {"LSI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, |
1204 |
+ {"ENGENIO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, |
1205 |
++ {"LENOVO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, |
1206 |
+ {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36}, |
1207 |
+ {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN}, |
1208 |
+ {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */ |
1209 |
+diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c |
1210 |
+index 375cede0c534..c9bc6f058424 100644 |
1211 |
+--- a/drivers/scsi/scsi_dh.c |
1212 |
++++ b/drivers/scsi/scsi_dh.c |
1213 |
+@@ -75,6 +75,7 @@ static const struct scsi_dh_blist scsi_dh_blist[] = { |
1214 |
+ {"NETAPP", "INF-01-00", "rdac", }, |
1215 |
+ {"LSI", "INF-01-00", "rdac", }, |
1216 |
+ {"ENGENIO", "INF-01-00", "rdac", }, |
1217 |
++ {"LENOVO", "DE_Series", "rdac", }, |
1218 |
+ {NULL, NULL, NULL }, |
1219 |
+ }; |
1220 |
+ |
1221 |
+diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c |
1222 |
+index d92b2808d191..6df34d68737f 100644 |
1223 |
+--- a/drivers/scsi/storvsc_drv.c |
1224 |
++++ b/drivers/scsi/storvsc_drv.c |
1225 |
+@@ -641,13 +641,22 @@ static void handle_sc_creation(struct vmbus_channel *new_sc) |
1226 |
+ static void handle_multichannel_storage(struct hv_device *device, int max_chns) |
1227 |
+ { |
1228 |
+ struct storvsc_device *stor_device; |
1229 |
+- int num_cpus = num_online_cpus(); |
1230 |
+ int num_sc; |
1231 |
+ struct storvsc_cmd_request *request; |
1232 |
+ struct vstor_packet *vstor_packet; |
1233 |
+ int ret, t; |
1234 |
+ |
1235 |
+- num_sc = ((max_chns > num_cpus) ? num_cpus : max_chns); |
1236 |
++ /* |
1237 |
++ * If the number of CPUs is artificially restricted, such as |
1238 |
++ * with maxcpus=1 on the kernel boot line, Hyper-V could offer |
1239 |
++ * sub-channels >= the number of CPUs. These sub-channels |
1240 |
++ * should not be created. The primary channel is already created |
1241 |
++ * and assigned to one CPU, so check against # CPUs - 1. |
1242 |
++ */ |
1243 |
++ num_sc = min((int)(num_online_cpus() - 1), max_chns); |
1244 |
++ if (!num_sc) |
1245 |
++ return; |
1246 |
++ |
1247 |
+ stor_device = get_out_stor_device(device); |
1248 |
+ if (!stor_device) |
1249 |
+ return; |
1250 |
+diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c |
1251 |
+index 3faffe59c933..95f5be1cd498 100644 |
1252 |
+--- a/drivers/staging/iio/addac/adt7316.c |
1253 |
++++ b/drivers/staging/iio/addac/adt7316.c |
1254 |
+@@ -47,6 +47,8 @@ |
1255 |
+ #define ADT7516_MSB_AIN3 0xA |
1256 |
+ #define ADT7516_MSB_AIN4 0xB |
1257 |
+ #define ADT7316_DA_DATA_BASE 0x10 |
1258 |
++#define ADT7316_DA_10_BIT_LSB_SHIFT 6 |
1259 |
++#define ADT7316_DA_12_BIT_LSB_SHIFT 4 |
1260 |
+ #define ADT7316_DA_MSB_DATA_REGS 4 |
1261 |
+ #define ADT7316_LSB_DAC_A 0x10 |
1262 |
+ #define ADT7316_MSB_DAC_A 0x11 |
1263 |
+@@ -1089,7 +1091,7 @@ static ssize_t adt7316_store_DAC_internal_Vref(struct device *dev, |
1264 |
+ ldac_config = chip->ldac_config & (~ADT7516_DAC_IN_VREF_MASK); |
1265 |
+ if (data & 0x1) |
1266 |
+ ldac_config |= ADT7516_DAC_AB_IN_VREF; |
1267 |
+- else if (data & 0x2) |
1268 |
++ if (data & 0x2) |
1269 |
+ ldac_config |= ADT7516_DAC_CD_IN_VREF; |
1270 |
+ } else { |
1271 |
+ ret = kstrtou8(buf, 16, &data); |
1272 |
+@@ -1411,7 +1413,7 @@ static IIO_DEVICE_ATTR(ex_analog_temp_offset, S_IRUGO | S_IWUSR, |
1273 |
+ static ssize_t adt7316_show_DAC(struct adt7316_chip_info *chip, |
1274 |
+ int channel, char *buf) |
1275 |
+ { |
1276 |
+- u16 data; |
1277 |
++ u16 data = 0; |
1278 |
+ u8 msb, lsb, offset; |
1279 |
+ int ret; |
1280 |
+ |
1281 |
+@@ -1436,7 +1438,11 @@ static ssize_t adt7316_show_DAC(struct adt7316_chip_info *chip, |
1282 |
+ if (ret) |
1283 |
+ return -EIO; |
1284 |
+ |
1285 |
+- data = (msb << offset) + (lsb & ((1 << offset) - 1)); |
1286 |
++ if (chip->dac_bits == 12) |
1287 |
++ data = lsb >> ADT7316_DA_12_BIT_LSB_SHIFT; |
1288 |
++ else if (chip->dac_bits == 10) |
1289 |
++ data = lsb >> ADT7316_DA_10_BIT_LSB_SHIFT; |
1290 |
++ data |= msb << offset; |
1291 |
+ |
1292 |
+ return sprintf(buf, "%d\n", data); |
1293 |
+ } |
1294 |
+@@ -1444,7 +1450,7 @@ static ssize_t adt7316_show_DAC(struct adt7316_chip_info *chip, |
1295 |
+ static ssize_t adt7316_store_DAC(struct adt7316_chip_info *chip, |
1296 |
+ int channel, const char *buf, size_t len) |
1297 |
+ { |
1298 |
+- u8 msb, lsb, offset; |
1299 |
++ u8 msb, lsb, lsb_reg, offset; |
1300 |
+ u16 data; |
1301 |
+ int ret; |
1302 |
+ |
1303 |
+@@ -1462,9 +1468,13 @@ static ssize_t adt7316_store_DAC(struct adt7316_chip_info *chip, |
1304 |
+ return -EINVAL; |
1305 |
+ |
1306 |
+ if (chip->dac_bits > 8) { |
1307 |
+- lsb = data & (1 << offset); |
1308 |
++ lsb = data & ((1 << offset) - 1); |
1309 |
++ if (chip->dac_bits == 12) |
1310 |
++ lsb_reg = lsb << ADT7316_DA_12_BIT_LSB_SHIFT; |
1311 |
++ else |
1312 |
++ lsb_reg = lsb << ADT7316_DA_10_BIT_LSB_SHIFT; |
1313 |
+ ret = chip->bus.write(chip->bus.client, |
1314 |
+- ADT7316_DA_DATA_BASE + channel * 2, lsb); |
1315 |
++ ADT7316_DA_DATA_BASE + channel * 2, lsb_reg); |
1316 |
+ if (ret) |
1317 |
+ return -EIO; |
1318 |
+ } |
1319 |
+diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c |
1320 |
+index c17b254e4f64..654199c6a36c 100644 |
1321 |
+--- a/drivers/usb/core/driver.c |
1322 |
++++ b/drivers/usb/core/driver.c |
1323 |
+@@ -470,11 +470,6 @@ static int usb_unbind_interface(struct device *dev) |
1324 |
+ pm_runtime_disable(dev); |
1325 |
+ pm_runtime_set_suspended(dev); |
1326 |
+ |
1327 |
+- /* Undo any residual pm_autopm_get_interface_* calls */ |
1328 |
+- for (r = atomic_read(&intf->pm_usage_cnt); r > 0; --r) |
1329 |
+- usb_autopm_put_interface_no_suspend(intf); |
1330 |
+- atomic_set(&intf->pm_usage_cnt, 0); |
1331 |
+- |
1332 |
+ if (!error) |
1333 |
+ usb_autosuspend_device(udev); |
1334 |
+ |
1335 |
+@@ -1625,7 +1620,6 @@ void usb_autopm_put_interface(struct usb_interface *intf) |
1336 |
+ int status; |
1337 |
+ |
1338 |
+ usb_mark_last_busy(udev); |
1339 |
+- atomic_dec(&intf->pm_usage_cnt); |
1340 |
+ status = pm_runtime_put_sync(&intf->dev); |
1341 |
+ dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", |
1342 |
+ __func__, atomic_read(&intf->dev.power.usage_count), |
1343 |
+@@ -1654,7 +1648,6 @@ void usb_autopm_put_interface_async(struct usb_interface *intf) |
1344 |
+ int status; |
1345 |
+ |
1346 |
+ usb_mark_last_busy(udev); |
1347 |
+- atomic_dec(&intf->pm_usage_cnt); |
1348 |
+ status = pm_runtime_put(&intf->dev); |
1349 |
+ dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", |
1350 |
+ __func__, atomic_read(&intf->dev.power.usage_count), |
1351 |
+@@ -1676,7 +1669,6 @@ void usb_autopm_put_interface_no_suspend(struct usb_interface *intf) |
1352 |
+ struct usb_device *udev = interface_to_usbdev(intf); |
1353 |
+ |
1354 |
+ usb_mark_last_busy(udev); |
1355 |
+- atomic_dec(&intf->pm_usage_cnt); |
1356 |
+ pm_runtime_put_noidle(&intf->dev); |
1357 |
+ } |
1358 |
+ EXPORT_SYMBOL_GPL(usb_autopm_put_interface_no_suspend); |
1359 |
+@@ -1707,8 +1699,6 @@ int usb_autopm_get_interface(struct usb_interface *intf) |
1360 |
+ status = pm_runtime_get_sync(&intf->dev); |
1361 |
+ if (status < 0) |
1362 |
+ pm_runtime_put_sync(&intf->dev); |
1363 |
+- else |
1364 |
+- atomic_inc(&intf->pm_usage_cnt); |
1365 |
+ dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", |
1366 |
+ __func__, atomic_read(&intf->dev.power.usage_count), |
1367 |
+ status); |
1368 |
+@@ -1742,8 +1732,6 @@ int usb_autopm_get_interface_async(struct usb_interface *intf) |
1369 |
+ status = pm_runtime_get(&intf->dev); |
1370 |
+ if (status < 0 && status != -EINPROGRESS) |
1371 |
+ pm_runtime_put_noidle(&intf->dev); |
1372 |
+- else |
1373 |
+- atomic_inc(&intf->pm_usage_cnt); |
1374 |
+ dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", |
1375 |
+ __func__, atomic_read(&intf->dev.power.usage_count), |
1376 |
+ status); |
1377 |
+@@ -1767,7 +1755,6 @@ void usb_autopm_get_interface_no_resume(struct usb_interface *intf) |
1378 |
+ struct usb_device *udev = interface_to_usbdev(intf); |
1379 |
+ |
1380 |
+ usb_mark_last_busy(udev); |
1381 |
+- atomic_inc(&intf->pm_usage_cnt); |
1382 |
+ pm_runtime_get_noresume(&intf->dev); |
1383 |
+ } |
1384 |
+ EXPORT_SYMBOL_GPL(usb_autopm_get_interface_no_resume); |
1385 |
+diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c |
1386 |
+index 0e6ab0a17c08..955cd6552e95 100644 |
1387 |
+--- a/drivers/usb/core/message.c |
1388 |
++++ b/drivers/usb/core/message.c |
1389 |
+@@ -817,9 +817,11 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) |
1390 |
+ |
1391 |
+ if (dev->state == USB_STATE_SUSPENDED) |
1392 |
+ return -EHOSTUNREACH; |
1393 |
+- if (size <= 0 || !buf || !index) |
1394 |
++ if (size <= 0 || !buf) |
1395 |
+ return -EINVAL; |
1396 |
+ buf[0] = 0; |
1397 |
++ if (index <= 0 || index >= 256) |
1398 |
++ return -EINVAL; |
1399 |
+ tbuf = kmalloc(256, GFP_NOIO); |
1400 |
+ if (!tbuf) |
1401 |
+ return -ENOMEM; |
1402 |
+diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c |
1403 |
+index 1e672343bcd6..efa3c86bd262 100644 |
1404 |
+--- a/drivers/usb/misc/yurex.c |
1405 |
++++ b/drivers/usb/misc/yurex.c |
1406 |
+@@ -324,6 +324,7 @@ static void yurex_disconnect(struct usb_interface *interface) |
1407 |
+ usb_deregister_dev(interface, &yurex_class); |
1408 |
+ |
1409 |
+ /* prevent more I/O from starting */ |
1410 |
++ usb_poison_urb(dev->urb); |
1411 |
+ mutex_lock(&dev->io_mutex); |
1412 |
+ dev->interface = NULL; |
1413 |
+ mutex_unlock(&dev->io_mutex); |
1414 |
+diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c |
1415 |
+index 4176d1af9bf2..fac3447021b2 100644 |
1416 |
+--- a/drivers/usb/storage/realtek_cr.c |
1417 |
++++ b/drivers/usb/storage/realtek_cr.c |
1418 |
+@@ -776,18 +776,16 @@ static void rts51x_suspend_timer_fn(unsigned long data) |
1419 |
+ break; |
1420 |
+ case RTS51X_STAT_IDLE: |
1421 |
+ case RTS51X_STAT_SS: |
1422 |
+- usb_stor_dbg(us, "RTS51X_STAT_SS, intf->pm_usage_cnt:%d, power.usage:%d\n", |
1423 |
+- atomic_read(&us->pusb_intf->pm_usage_cnt), |
1424 |
++ usb_stor_dbg(us, "RTS51X_STAT_SS, power.usage:%d\n", |
1425 |
+ atomic_read(&us->pusb_intf->dev.power.usage_count)); |
1426 |
+ |
1427 |
+- if (atomic_read(&us->pusb_intf->pm_usage_cnt) > 0) { |
1428 |
++ if (atomic_read(&us->pusb_intf->dev.power.usage_count) > 0) { |
1429 |
+ usb_stor_dbg(us, "Ready to enter SS state\n"); |
1430 |
+ rts51x_set_stat(chip, RTS51X_STAT_SS); |
1431 |
+ /* ignore mass storage interface's children */ |
1432 |
+ pm_suspend_ignore_children(&us->pusb_intf->dev, true); |
1433 |
+ usb_autopm_put_interface_async(us->pusb_intf); |
1434 |
+- usb_stor_dbg(us, "RTS51X_STAT_SS 01, intf->pm_usage_cnt:%d, power.usage:%d\n", |
1435 |
+- atomic_read(&us->pusb_intf->pm_usage_cnt), |
1436 |
++ usb_stor_dbg(us, "RTS51X_STAT_SS 01, power.usage:%d\n", |
1437 |
+ atomic_read(&us->pusb_intf->dev.power.usage_count)); |
1438 |
+ } |
1439 |
+ break; |
1440 |
+@@ -820,11 +818,10 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) |
1441 |
+ int ret; |
1442 |
+ |
1443 |
+ if (working_scsi(srb)) { |
1444 |
+- usb_stor_dbg(us, "working scsi, intf->pm_usage_cnt:%d, power.usage:%d\n", |
1445 |
+- atomic_read(&us->pusb_intf->pm_usage_cnt), |
1446 |
++ usb_stor_dbg(us, "working scsi, power.usage:%d\n", |
1447 |
+ atomic_read(&us->pusb_intf->dev.power.usage_count)); |
1448 |
+ |
1449 |
+- if (atomic_read(&us->pusb_intf->pm_usage_cnt) <= 0) { |
1450 |
++ if (atomic_read(&us->pusb_intf->dev.power.usage_count) <= 0) { |
1451 |
+ ret = usb_autopm_get_interface(us->pusb_intf); |
1452 |
+ usb_stor_dbg(us, "working scsi, ret=%d\n", ret); |
1453 |
+ } |
1454 |
+diff --git a/drivers/usb/usbip/stub_rx.c b/drivers/usb/usbip/stub_rx.c |
1455 |
+index 5b807185f79e..777a4058c407 100644 |
1456 |
+--- a/drivers/usb/usbip/stub_rx.c |
1457 |
++++ b/drivers/usb/usbip/stub_rx.c |
1458 |
+@@ -383,16 +383,10 @@ static int get_pipe(struct stub_device *sdev, struct usbip_header *pdu) |
1459 |
+ } |
1460 |
+ |
1461 |
+ if (usb_endpoint_xfer_isoc(epd)) { |
1462 |
+- /* validate packet size and number of packets */ |
1463 |
+- unsigned int maxp, packets, bytes; |
1464 |
+- |
1465 |
+- maxp = usb_endpoint_maxp(epd); |
1466 |
+- maxp *= usb_endpoint_maxp_mult(epd); |
1467 |
+- bytes = pdu->u.cmd_submit.transfer_buffer_length; |
1468 |
+- packets = DIV_ROUND_UP(bytes, maxp); |
1469 |
+- |
1470 |
++ /* validate number of packets */ |
1471 |
+ if (pdu->u.cmd_submit.number_of_packets < 0 || |
1472 |
+- pdu->u.cmd_submit.number_of_packets > packets) { |
1473 |
++ pdu->u.cmd_submit.number_of_packets > |
1474 |
++ USBIP_MAX_ISO_PACKETS) { |
1475 |
+ dev_err(&sdev->udev->dev, |
1476 |
+ "CMD_SUBMIT: isoc invalid num packets %d\n", |
1477 |
+ pdu->u.cmd_submit.number_of_packets); |
1478 |
+diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h |
1479 |
+index 109e65ba01a0..0b199a2664c0 100644 |
1480 |
+--- a/drivers/usb/usbip/usbip_common.h |
1481 |
++++ b/drivers/usb/usbip/usbip_common.h |
1482 |
+@@ -136,6 +136,13 @@ extern struct device_attribute dev_attr_usbip_debug; |
1483 |
+ #define USBIP_DIR_OUT 0x00 |
1484 |
+ #define USBIP_DIR_IN 0x01 |
1485 |
+ |
1486 |
++/* |
1487 |
++ * Arbitrary limit for the maximum number of isochronous packets in an URB, |
1488 |
++ * compare for example the uhci_submit_isochronous function in |
1489 |
++ * drivers/usb/host/uhci-q.c |
1490 |
++ */ |
1491 |
++#define USBIP_MAX_ISO_PACKETS 1024 |
1492 |
++ |
1493 |
+ /** |
1494 |
+ * struct usbip_header_basic - data pertinent to every request |
1495 |
+ * @command: the usbip request type |
1496 |
+diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c |
1497 |
+index 7338e43faa17..f9a75df2d22d 100644 |
1498 |
+--- a/drivers/vfio/pci/vfio_pci.c |
1499 |
++++ b/drivers/vfio/pci/vfio_pci.c |
1500 |
+@@ -1467,11 +1467,11 @@ static void __init vfio_pci_fill_ids(void) |
1501 |
+ rc = pci_add_dynid(&vfio_pci_driver, vendor, device, |
1502 |
+ subvendor, subdevice, class, class_mask, 0); |
1503 |
+ if (rc) |
1504 |
+- pr_warn("failed to add dynamic id [%04hx:%04hx[%04hx:%04hx]] class %#08x/%08x (%d)\n", |
1505 |
++ pr_warn("failed to add dynamic id [%04x:%04x[%04x:%04x]] class %#08x/%08x (%d)\n", |
1506 |
+ vendor, device, subvendor, subdevice, |
1507 |
+ class, class_mask, rc); |
1508 |
+ else |
1509 |
+- pr_info("add [%04hx:%04hx[%04hx:%04hx]] class %#08x/%08x\n", |
1510 |
++ pr_info("add [%04x:%04x[%04x:%04x]] class %#08x/%08x\n", |
1511 |
+ vendor, device, subvendor, subdevice, |
1512 |
+ class, class_mask); |
1513 |
+ } |
1514 |
+diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c |
1515 |
+index 59d74d1b47a8..2287e1be0e55 100644 |
1516 |
+--- a/drivers/w1/masters/ds2490.c |
1517 |
++++ b/drivers/w1/masters/ds2490.c |
1518 |
+@@ -1039,15 +1039,15 @@ static int ds_probe(struct usb_interface *intf, |
1519 |
+ /* alternative 3, 1ms interrupt (greatly speeds search), 64 byte bulk */ |
1520 |
+ alt = 3; |
1521 |
+ err = usb_set_interface(dev->udev, |
1522 |
+- intf->altsetting[alt].desc.bInterfaceNumber, alt); |
1523 |
++ intf->cur_altsetting->desc.bInterfaceNumber, alt); |
1524 |
+ if (err) { |
1525 |
+ dev_err(&dev->udev->dev, "Failed to set alternative setting %d " |
1526 |
+ "for %d interface: err=%d.\n", alt, |
1527 |
+- intf->altsetting[alt].desc.bInterfaceNumber, err); |
1528 |
++ intf->cur_altsetting->desc.bInterfaceNumber, err); |
1529 |
+ goto err_out_clear; |
1530 |
+ } |
1531 |
+ |
1532 |
+- iface_desc = &intf->altsetting[alt]; |
1533 |
++ iface_desc = intf->cur_altsetting; |
1534 |
+ if (iface_desc->desc.bNumEndpoints != NUM_EP-1) { |
1535 |
+ pr_info("Num endpoints=%d. It is not DS9490R.\n", |
1536 |
+ iface_desc->desc.bNumEndpoints); |
1537 |
+diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c |
1538 |
+index 77e9cd7a0137..20ee612017bf 100644 |
1539 |
+--- a/fs/debugfs/inode.c |
1540 |
++++ b/fs/debugfs/inode.c |
1541 |
+@@ -170,19 +170,24 @@ static int debugfs_show_options(struct seq_file *m, struct dentry *root) |
1542 |
+ return 0; |
1543 |
+ } |
1544 |
+ |
1545 |
+-static void debugfs_evict_inode(struct inode *inode) |
1546 |
++static void debugfs_i_callback(struct rcu_head *head) |
1547 |
+ { |
1548 |
+- truncate_inode_pages_final(&inode->i_data); |
1549 |
+- clear_inode(inode); |
1550 |
++ struct inode *inode = container_of(head, struct inode, i_rcu); |
1551 |
+ if (S_ISLNK(inode->i_mode)) |
1552 |
+ kfree(inode->i_link); |
1553 |
++ free_inode_nonrcu(inode); |
1554 |
++} |
1555 |
++ |
1556 |
++static void debugfs_destroy_inode(struct inode *inode) |
1557 |
++{ |
1558 |
++ call_rcu(&inode->i_rcu, debugfs_i_callback); |
1559 |
+ } |
1560 |
+ |
1561 |
+ static const struct super_operations debugfs_super_operations = { |
1562 |
+ .statfs = simple_statfs, |
1563 |
+ .remount_fs = debugfs_remount, |
1564 |
+ .show_options = debugfs_show_options, |
1565 |
+- .evict_inode = debugfs_evict_inode, |
1566 |
++ .destroy_inode = debugfs_destroy_inode, |
1567 |
+ }; |
1568 |
+ |
1569 |
+ static struct vfsmount *debugfs_automount(struct path *path) |
1570 |
+diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c |
1571 |
+index 001487b230b5..4acc677ac8fb 100644 |
1572 |
+--- a/fs/hugetlbfs/inode.c |
1573 |
++++ b/fs/hugetlbfs/inode.c |
1574 |
+@@ -746,11 +746,17 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, |
1575 |
+ umode_t mode, dev_t dev) |
1576 |
+ { |
1577 |
+ struct inode *inode; |
1578 |
+- struct resv_map *resv_map; |
1579 |
++ struct resv_map *resv_map = NULL; |
1580 |
+ |
1581 |
+- resv_map = resv_map_alloc(); |
1582 |
+- if (!resv_map) |
1583 |
+- return NULL; |
1584 |
++ /* |
1585 |
++ * Reserve maps are only needed for inodes that can have associated |
1586 |
++ * page allocations. |
1587 |
++ */ |
1588 |
++ if (S_ISREG(mode) || S_ISLNK(mode)) { |
1589 |
++ resv_map = resv_map_alloc(); |
1590 |
++ if (!resv_map) |
1591 |
++ return NULL; |
1592 |
++ } |
1593 |
+ |
1594 |
+ inode = new_inode(sb); |
1595 |
+ if (inode) { |
1596 |
+@@ -782,8 +788,10 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, |
1597 |
+ break; |
1598 |
+ } |
1599 |
+ lockdep_annotate_inode_mutex_key(inode); |
1600 |
+- } else |
1601 |
+- kref_put(&resv_map->refs, resv_map_release); |
1602 |
++ } else { |
1603 |
++ if (resv_map) |
1604 |
++ kref_put(&resv_map->refs, resv_map_release); |
1605 |
++ } |
1606 |
+ |
1607 |
+ return inode; |
1608 |
+ } |
1609 |
+diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c |
1610 |
+index 06a71dbd4833..2f236cca6095 100644 |
1611 |
+--- a/fs/jffs2/readinode.c |
1612 |
++++ b/fs/jffs2/readinode.c |
1613 |
+@@ -1414,11 +1414,6 @@ void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f) |
1614 |
+ |
1615 |
+ jffs2_kill_fragtree(&f->fragtree, deleted?c:NULL); |
1616 |
+ |
1617 |
+- if (f->target) { |
1618 |
+- kfree(f->target); |
1619 |
+- f->target = NULL; |
1620 |
+- } |
1621 |
+- |
1622 |
+ fds = f->dents; |
1623 |
+ while(fds) { |
1624 |
+ fd = fds; |
1625 |
+diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c |
1626 |
+index 226640563df3..76aedbc97773 100644 |
1627 |
+--- a/fs/jffs2/super.c |
1628 |
++++ b/fs/jffs2/super.c |
1629 |
+@@ -47,7 +47,10 @@ static struct inode *jffs2_alloc_inode(struct super_block *sb) |
1630 |
+ static void jffs2_i_callback(struct rcu_head *head) |
1631 |
+ { |
1632 |
+ struct inode *inode = container_of(head, struct inode, i_rcu); |
1633 |
+- kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode)); |
1634 |
++ struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); |
1635 |
++ |
1636 |
++ kfree(f->target); |
1637 |
++ kmem_cache_free(jffs2_inode_cachep, f); |
1638 |
+ } |
1639 |
+ |
1640 |
+ static void jffs2_destroy_inode(struct inode *inode) |
1641 |
+diff --git a/include/linux/kasan.h b/include/linux/kasan.h |
1642 |
+index 820c0ad54a01..c9df9e180610 100644 |
1643 |
+--- a/include/linux/kasan.h |
1644 |
++++ b/include/linux/kasan.h |
1645 |
+@@ -7,6 +7,7 @@ |
1646 |
+ struct kmem_cache; |
1647 |
+ struct page; |
1648 |
+ struct vm_struct; |
1649 |
++struct task_struct; |
1650 |
+ |
1651 |
+ #ifdef CONFIG_KASAN |
1652 |
+ |
1653 |
+diff --git a/include/linux/usb.h b/include/linux/usb.h |
1654 |
+index 346665a0c49d..9b5ca59271d9 100644 |
1655 |
+--- a/include/linux/usb.h |
1656 |
++++ b/include/linux/usb.h |
1657 |
+@@ -129,7 +129,6 @@ enum usb_interface_condition { |
1658 |
+ * @dev: driver model's view of this device |
1659 |
+ * @usb_dev: if an interface is bound to the USB major, this will point |
1660 |
+ * to the sysfs representation for that device. |
1661 |
+- * @pm_usage_cnt: PM usage counter for this interface |
1662 |
+ * @reset_ws: Used for scheduling resets from atomic context. |
1663 |
+ * @resetting_device: USB core reset the device, so use alt setting 0 as |
1664 |
+ * current; needs bandwidth alloc after reset. |
1665 |
+@@ -186,7 +185,6 @@ struct usb_interface { |
1666 |
+ |
1667 |
+ struct device dev; /* interface specific device info */ |
1668 |
+ struct device *usb_dev; |
1669 |
+- atomic_t pm_usage_cnt; /* usage counter for autosuspend */ |
1670 |
+ struct work_struct reset_ws; /* for resets in atomic context */ |
1671 |
+ }; |
1672 |
+ #define to_usb_interface(d) container_of(d, struct usb_interface, dev) |
1673 |
+diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h |
1674 |
+index fe328c52c46b..801489bb14c3 100644 |
1675 |
+--- a/include/net/caif/cfpkt.h |
1676 |
++++ b/include/net/caif/cfpkt.h |
1677 |
+@@ -32,6 +32,33 @@ void cfpkt_destroy(struct cfpkt *pkt); |
1678 |
+ */ |
1679 |
+ int cfpkt_extr_head(struct cfpkt *pkt, void *data, u16 len); |
1680 |
+ |
1681 |
++static inline u8 cfpkt_extr_head_u8(struct cfpkt *pkt) |
1682 |
++{ |
1683 |
++ u8 tmp; |
1684 |
++ |
1685 |
++ cfpkt_extr_head(pkt, &tmp, 1); |
1686 |
++ |
1687 |
++ return tmp; |
1688 |
++} |
1689 |
++ |
1690 |
++static inline u16 cfpkt_extr_head_u16(struct cfpkt *pkt) |
1691 |
++{ |
1692 |
++ __le16 tmp; |
1693 |
++ |
1694 |
++ cfpkt_extr_head(pkt, &tmp, 2); |
1695 |
++ |
1696 |
++ return le16_to_cpu(tmp); |
1697 |
++} |
1698 |
++ |
1699 |
++static inline u32 cfpkt_extr_head_u32(struct cfpkt *pkt) |
1700 |
++{ |
1701 |
++ __le32 tmp; |
1702 |
++ |
1703 |
++ cfpkt_extr_head(pkt, &tmp, 4); |
1704 |
++ |
1705 |
++ return le32_to_cpu(tmp); |
1706 |
++} |
1707 |
++ |
1708 |
+ /* |
1709 |
+ * Peek header from packet. |
1710 |
+ * Reads data from packet without changing packet. |
1711 |
+diff --git a/lib/Makefile b/lib/Makefile |
1712 |
+index 50144a3aeebd..2447a218fff8 100644 |
1713 |
+--- a/lib/Makefile |
1714 |
++++ b/lib/Makefile |
1715 |
+@@ -46,6 +46,7 @@ obj-$(CONFIG_TEST_BPF) += test_bpf.o |
1716 |
+ obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o |
1717 |
+ obj-$(CONFIG_TEST_HASH) += test_hash.o |
1718 |
+ obj-$(CONFIG_TEST_KASAN) += test_kasan.o |
1719 |
++CFLAGS_test_kasan.o += -fno-builtin |
1720 |
+ obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o |
1721 |
+ obj-$(CONFIG_TEST_LKM) += test_module.o |
1722 |
+ obj-$(CONFIG_TEST_RHASHTABLE) += test_rhashtable.o |
1723 |
+diff --git a/lib/test_kasan.c b/lib/test_kasan.c |
1724 |
+index fbdf87920093..4ba4cbe169a8 100644 |
1725 |
+--- a/lib/test_kasan.c |
1726 |
++++ b/lib/test_kasan.c |
1727 |
+@@ -355,7 +355,7 @@ static noinline void __init kasan_stack_oob(void) |
1728 |
+ static noinline void __init ksize_unpoisons_memory(void) |
1729 |
+ { |
1730 |
+ char *ptr; |
1731 |
+- size_t size = 123, real_size = size; |
1732 |
++ size_t size = 123, real_size; |
1733 |
+ |
1734 |
+ pr_info("ksize() unpoisons the whole allocated chunk\n"); |
1735 |
+ ptr = kmalloc(size, GFP_KERNEL); |
1736 |
+diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c |
1737 |
+index 4ce386c44cf1..1169c1fe941f 100644 |
1738 |
+--- a/mm/kasan/kasan.c |
1739 |
++++ b/mm/kasan/kasan.c |
1740 |
+@@ -80,7 +80,14 @@ void kasan_unpoison_task_stack(struct task_struct *task) |
1741 |
+ /* Unpoison the stack for the current task beyond a watermark sp value. */ |
1742 |
+ asmlinkage void kasan_unpoison_task_stack_below(const void *watermark) |
1743 |
+ { |
1744 |
+- __kasan_unpoison_stack(current, watermark); |
1745 |
++ /* |
1746 |
++ * Calculate the task stack base address. Avoid using 'current' |
1747 |
++ * because this function is called by early resume code which hasn't |
1748 |
++ * yet set up the percpu register (%gs). |
1749 |
++ */ |
1750 |
++ void *base = (void *)((unsigned long)watermark & ~(THREAD_SIZE - 1)); |
1751 |
++ |
1752 |
++ kasan_unpoison_shadow(base, watermark - base); |
1753 |
+ } |
1754 |
+ |
1755 |
+ /* |
1756 |
+diff --git a/mm/kasan/kasan_init.c b/mm/kasan/kasan_init.c |
1757 |
+index 3f9a41cf0ac6..31238dad85fb 100644 |
1758 |
+--- a/mm/kasan/kasan_init.c |
1759 |
++++ b/mm/kasan/kasan_init.c |
1760 |
+@@ -15,6 +15,7 @@ |
1761 |
+ #include <linux/kasan.h> |
1762 |
+ #include <linux/kernel.h> |
1763 |
+ #include <linux/memblock.h> |
1764 |
++#include <linux/mm.h> |
1765 |
+ #include <linux/pfn.h> |
1766 |
+ |
1767 |
+ #include <asm/page.h> |
1768 |
+@@ -49,7 +50,7 @@ static void __init zero_pte_populate(pmd_t *pmd, unsigned long addr, |
1769 |
+ pte_t *pte = pte_offset_kernel(pmd, addr); |
1770 |
+ pte_t zero_pte; |
1771 |
+ |
1772 |
+- zero_pte = pfn_pte(PFN_DOWN(__pa(kasan_zero_page)), PAGE_KERNEL); |
1773 |
++ zero_pte = pfn_pte(PFN_DOWN(__pa_symbol(kasan_zero_page)), PAGE_KERNEL); |
1774 |
+ zero_pte = pte_wrprotect(zero_pte); |
1775 |
+ |
1776 |
+ while (addr + PAGE_SIZE <= end) { |
1777 |
+@@ -69,7 +70,7 @@ static void __init zero_pmd_populate(pud_t *pud, unsigned long addr, |
1778 |
+ next = pmd_addr_end(addr, end); |
1779 |
+ |
1780 |
+ if (IS_ALIGNED(addr, PMD_SIZE) && end - addr >= PMD_SIZE) { |
1781 |
+- pmd_populate_kernel(&init_mm, pmd, kasan_zero_pte); |
1782 |
++ pmd_populate_kernel(&init_mm, pmd, lm_alias(kasan_zero_pte)); |
1783 |
+ continue; |
1784 |
+ } |
1785 |
+ |
1786 |
+@@ -92,9 +93,9 @@ static void __init zero_pud_populate(pgd_t *pgd, unsigned long addr, |
1787 |
+ if (IS_ALIGNED(addr, PUD_SIZE) && end - addr >= PUD_SIZE) { |
1788 |
+ pmd_t *pmd; |
1789 |
+ |
1790 |
+- pud_populate(&init_mm, pud, kasan_zero_pmd); |
1791 |
++ pud_populate(&init_mm, pud, lm_alias(kasan_zero_pmd)); |
1792 |
+ pmd = pmd_offset(pud, addr); |
1793 |
+- pmd_populate_kernel(&init_mm, pmd, kasan_zero_pte); |
1794 |
++ pmd_populate_kernel(&init_mm, pmd, lm_alias(kasan_zero_pte)); |
1795 |
+ continue; |
1796 |
+ } |
1797 |
+ |
1798 |
+@@ -135,11 +136,11 @@ void __init kasan_populate_zero_shadow(const void *shadow_start, |
1799 |
+ * puds,pmds, so pgd_populate(), pud_populate() |
1800 |
+ * is noops. |
1801 |
+ */ |
1802 |
+- pgd_populate(&init_mm, pgd, kasan_zero_pud); |
1803 |
++ pgd_populate(&init_mm, pgd, lm_alias(kasan_zero_pud)); |
1804 |
+ pud = pud_offset(pgd, addr); |
1805 |
+- pud_populate(&init_mm, pud, kasan_zero_pmd); |
1806 |
++ pud_populate(&init_mm, pud, lm_alias(kasan_zero_pmd)); |
1807 |
+ pmd = pmd_offset(pud, addr); |
1808 |
+- pmd_populate_kernel(&init_mm, pmd, kasan_zero_pte); |
1809 |
++ pmd_populate_kernel(&init_mm, pmd, lm_alias(kasan_zero_pte)); |
1810 |
+ continue; |
1811 |
+ } |
1812 |
+ |
1813 |
+diff --git a/mm/kasan/report.c b/mm/kasan/report.c |
1814 |
+index 8ca412aebcf1..c505ac5b2d46 100644 |
1815 |
+--- a/mm/kasan/report.c |
1816 |
++++ b/mm/kasan/report.c |
1817 |
+@@ -302,6 +302,7 @@ void kasan_report(unsigned long addr, size_t size, |
1818 |
+ disable_trace_on_warning(); |
1819 |
+ |
1820 |
+ info.access_addr = (void *)addr; |
1821 |
++ info.first_bad_addr = (void *)addr; |
1822 |
+ info.access_size = size; |
1823 |
+ info.is_write = is_write; |
1824 |
+ info.ip = ip; |
1825 |
+diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c |
1826 |
+index 8b6f654bc85d..00123064eb26 100644 |
1827 |
+--- a/net/batman-adv/bridge_loop_avoidance.c |
1828 |
++++ b/net/batman-adv/bridge_loop_avoidance.c |
1829 |
+@@ -802,6 +802,8 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv, |
1830 |
+ const u8 *mac, const unsigned short vid) |
1831 |
+ { |
1832 |
+ struct batadv_bla_claim search_claim, *claim; |
1833 |
++ struct batadv_bla_claim *claim_removed_entry; |
1834 |
++ struct hlist_node *claim_removed_node; |
1835 |
+ |
1836 |
+ ether_addr_copy(search_claim.addr, mac); |
1837 |
+ search_claim.vid = vid; |
1838 |
+@@ -812,10 +814,18 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv, |
1839 |
+ batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", |
1840 |
+ mac, BATADV_PRINT_VID(vid)); |
1841 |
+ |
1842 |
+- batadv_hash_remove(bat_priv->bla.claim_hash, batadv_compare_claim, |
1843 |
+- batadv_choose_claim, claim); |
1844 |
+- batadv_claim_put(claim); /* reference from the hash is gone */ |
1845 |
++ claim_removed_node = batadv_hash_remove(bat_priv->bla.claim_hash, |
1846 |
++ batadv_compare_claim, |
1847 |
++ batadv_choose_claim, claim); |
1848 |
++ if (!claim_removed_node) |
1849 |
++ goto free_claim; |
1850 |
+ |
1851 |
++ /* reference from the hash is gone */ |
1852 |
++ claim_removed_entry = hlist_entry(claim_removed_node, |
1853 |
++ struct batadv_bla_claim, hash_entry); |
1854 |
++ batadv_claim_put(claim_removed_entry); |
1855 |
++ |
1856 |
++free_claim: |
1857 |
+ /* don't need the reference from hash_find() anymore */ |
1858 |
+ batadv_claim_put(claim); |
1859 |
+ } |
1860 |
+diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c |
1861 |
+index b9f9a310eb78..af4a02ad8503 100644 |
1862 |
+--- a/net/batman-adv/translation-table.c |
1863 |
++++ b/net/batman-adv/translation-table.c |
1864 |
+@@ -615,14 +615,26 @@ static void batadv_tt_global_free(struct batadv_priv *bat_priv, |
1865 |
+ struct batadv_tt_global_entry *tt_global, |
1866 |
+ const char *message) |
1867 |
+ { |
1868 |
++ struct batadv_tt_global_entry *tt_removed_entry; |
1869 |
++ struct hlist_node *tt_removed_node; |
1870 |
++ |
1871 |
+ batadv_dbg(BATADV_DBG_TT, bat_priv, |
1872 |
+ "Deleting global tt entry %pM (vid: %d): %s\n", |
1873 |
+ tt_global->common.addr, |
1874 |
+ BATADV_PRINT_VID(tt_global->common.vid), message); |
1875 |
+ |
1876 |
+- batadv_hash_remove(bat_priv->tt.global_hash, batadv_compare_tt, |
1877 |
+- batadv_choose_tt, &tt_global->common); |
1878 |
+- batadv_tt_global_entry_put(tt_global); |
1879 |
++ tt_removed_node = batadv_hash_remove(bat_priv->tt.global_hash, |
1880 |
++ batadv_compare_tt, |
1881 |
++ batadv_choose_tt, |
1882 |
++ &tt_global->common); |
1883 |
++ if (!tt_removed_node) |
1884 |
++ return; |
1885 |
++ |
1886 |
++ /* drop reference of remove hash entry */ |
1887 |
++ tt_removed_entry = hlist_entry(tt_removed_node, |
1888 |
++ struct batadv_tt_global_entry, |
1889 |
++ common.hash_entry); |
1890 |
++ batadv_tt_global_entry_put(tt_removed_entry); |
1891 |
+ } |
1892 |
+ |
1893 |
+ /** |
1894 |
+@@ -1308,9 +1320,10 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, |
1895 |
+ unsigned short vid, const char *message, |
1896 |
+ bool roaming) |
1897 |
+ { |
1898 |
++ struct batadv_tt_local_entry *tt_removed_entry; |
1899 |
+ struct batadv_tt_local_entry *tt_local_entry; |
1900 |
+ u16 flags, curr_flags = BATADV_NO_FLAGS; |
1901 |
+- void *tt_entry_exists; |
1902 |
++ struct hlist_node *tt_removed_node; |
1903 |
+ |
1904 |
+ tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); |
1905 |
+ if (!tt_local_entry) |
1906 |
+@@ -1339,15 +1352,18 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, |
1907 |
+ */ |
1908 |
+ batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL); |
1909 |
+ |
1910 |
+- tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash, |
1911 |
++ tt_removed_node = batadv_hash_remove(bat_priv->tt.local_hash, |
1912 |
+ batadv_compare_tt, |
1913 |
+ batadv_choose_tt, |
1914 |
+ &tt_local_entry->common); |
1915 |
+- if (!tt_entry_exists) |
1916 |
++ if (!tt_removed_node) |
1917 |
+ goto out; |
1918 |
+ |
1919 |
+- /* extra call to free the local tt entry */ |
1920 |
+- batadv_tt_local_entry_put(tt_local_entry); |
1921 |
++ /* drop reference of remove hash entry */ |
1922 |
++ tt_removed_entry = hlist_entry(tt_removed_node, |
1923 |
++ struct batadv_tt_local_entry, |
1924 |
++ common.hash_entry); |
1925 |
++ batadv_tt_local_entry_put(tt_removed_entry); |
1926 |
+ |
1927 |
+ out: |
1928 |
+ if (tt_local_entry) |
1929 |
+diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c |
1930 |
+index f5afda1abc76..4dc82e9a855d 100644 |
1931 |
+--- a/net/caif/cfctrl.c |
1932 |
++++ b/net/caif/cfctrl.c |
1933 |
+@@ -352,15 +352,14 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt) |
1934 |
+ u8 cmdrsp; |
1935 |
+ u8 cmd; |
1936 |
+ int ret = -1; |
1937 |
+- u16 tmp16; |
1938 |
+ u8 len; |
1939 |
+ u8 param[255]; |
1940 |
+- u8 linkid; |
1941 |
++ u8 linkid = 0; |
1942 |
+ struct cfctrl *cfctrl = container_obj(layer); |
1943 |
+ struct cfctrl_request_info rsp, *req; |
1944 |
+ |
1945 |
+ |
1946 |
+- cfpkt_extr_head(pkt, &cmdrsp, 1); |
1947 |
++ cmdrsp = cfpkt_extr_head_u8(pkt); |
1948 |
+ cmd = cmdrsp & CFCTRL_CMD_MASK; |
1949 |
+ if (cmd != CFCTRL_CMD_LINK_ERR |
1950 |
+ && CFCTRL_RSP_BIT != (CFCTRL_RSP_BIT & cmdrsp) |
1951 |
+@@ -378,13 +377,12 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt) |
1952 |
+ u8 physlinkid; |
1953 |
+ u8 prio; |
1954 |
+ u8 tmp; |
1955 |
+- u32 tmp32; |
1956 |
+ u8 *cp; |
1957 |
+ int i; |
1958 |
+ struct cfctrl_link_param linkparam; |
1959 |
+ memset(&linkparam, 0, sizeof(linkparam)); |
1960 |
+ |
1961 |
+- cfpkt_extr_head(pkt, &tmp, 1); |
1962 |
++ tmp = cfpkt_extr_head_u8(pkt); |
1963 |
+ |
1964 |
+ serv = tmp & CFCTRL_SRV_MASK; |
1965 |
+ linkparam.linktype = serv; |
1966 |
+@@ -392,13 +390,13 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt) |
1967 |
+ servtype = tmp >> 4; |
1968 |
+ linkparam.chtype = servtype; |
1969 |
+ |
1970 |
+- cfpkt_extr_head(pkt, &tmp, 1); |
1971 |
++ tmp = cfpkt_extr_head_u8(pkt); |
1972 |
+ physlinkid = tmp & 0x07; |
1973 |
+ prio = tmp >> 3; |
1974 |
+ |
1975 |
+ linkparam.priority = prio; |
1976 |
+ linkparam.phyid = physlinkid; |
1977 |
+- cfpkt_extr_head(pkt, &endpoint, 1); |
1978 |
++ endpoint = cfpkt_extr_head_u8(pkt); |
1979 |
+ linkparam.endpoint = endpoint & 0x03; |
1980 |
+ |
1981 |
+ switch (serv) { |
1982 |
+@@ -407,45 +405,43 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt) |
1983 |
+ if (CFCTRL_ERR_BIT & cmdrsp) |
1984 |
+ break; |
1985 |
+ /* Link ID */ |
1986 |
+- cfpkt_extr_head(pkt, &linkid, 1); |
1987 |
++ linkid = cfpkt_extr_head_u8(pkt); |
1988 |
+ break; |
1989 |
+ case CFCTRL_SRV_VIDEO: |
1990 |
+- cfpkt_extr_head(pkt, &tmp, 1); |
1991 |
++ tmp = cfpkt_extr_head_u8(pkt); |
1992 |
+ linkparam.u.video.connid = tmp; |
1993 |
+ if (CFCTRL_ERR_BIT & cmdrsp) |
1994 |
+ break; |
1995 |
+ /* Link ID */ |
1996 |
+- cfpkt_extr_head(pkt, &linkid, 1); |
1997 |
++ linkid = cfpkt_extr_head_u8(pkt); |
1998 |
+ break; |
1999 |
+ |
2000 |
+ case CFCTRL_SRV_DATAGRAM: |
2001 |
+- cfpkt_extr_head(pkt, &tmp32, 4); |
2002 |
+ linkparam.u.datagram.connid = |
2003 |
+- le32_to_cpu(tmp32); |
2004 |
++ cfpkt_extr_head_u32(pkt); |
2005 |
+ if (CFCTRL_ERR_BIT & cmdrsp) |
2006 |
+ break; |
2007 |
+ /* Link ID */ |
2008 |
+- cfpkt_extr_head(pkt, &linkid, 1); |
2009 |
++ linkid = cfpkt_extr_head_u8(pkt); |
2010 |
+ break; |
2011 |
+ case CFCTRL_SRV_RFM: |
2012 |
+ /* Construct a frame, convert |
2013 |
+ * DatagramConnectionID |
2014 |
+ * to network format long and copy it out... |
2015 |
+ */ |
2016 |
+- cfpkt_extr_head(pkt, &tmp32, 4); |
2017 |
+ linkparam.u.rfm.connid = |
2018 |
+- le32_to_cpu(tmp32); |
2019 |
++ cfpkt_extr_head_u32(pkt); |
2020 |
+ cp = (u8 *) linkparam.u.rfm.volume; |
2021 |
+- for (cfpkt_extr_head(pkt, &tmp, 1); |
2022 |
++ for (tmp = cfpkt_extr_head_u8(pkt); |
2023 |
+ cfpkt_more(pkt) && tmp != '\0'; |
2024 |
+- cfpkt_extr_head(pkt, &tmp, 1)) |
2025 |
++ tmp = cfpkt_extr_head_u8(pkt)) |
2026 |
+ *cp++ = tmp; |
2027 |
+ *cp = '\0'; |
2028 |
+ |
2029 |
+ if (CFCTRL_ERR_BIT & cmdrsp) |
2030 |
+ break; |
2031 |
+ /* Link ID */ |
2032 |
+- cfpkt_extr_head(pkt, &linkid, 1); |
2033 |
++ linkid = cfpkt_extr_head_u8(pkt); |
2034 |
+ |
2035 |
+ break; |
2036 |
+ case CFCTRL_SRV_UTIL: |
2037 |
+@@ -454,13 +450,11 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt) |
2038 |
+ * to network format long and copy it out... |
2039 |
+ */ |
2040 |
+ /* Fifosize KB */ |
2041 |
+- cfpkt_extr_head(pkt, &tmp16, 2); |
2042 |
+ linkparam.u.utility.fifosize_kb = |
2043 |
+- le16_to_cpu(tmp16); |
2044 |
++ cfpkt_extr_head_u16(pkt); |
2045 |
+ /* Fifosize bufs */ |
2046 |
+- cfpkt_extr_head(pkt, &tmp16, 2); |
2047 |
+ linkparam.u.utility.fifosize_bufs = |
2048 |
+- le16_to_cpu(tmp16); |
2049 |
++ cfpkt_extr_head_u16(pkt); |
2050 |
+ /* name */ |
2051 |
+ cp = (u8 *) linkparam.u.utility.name; |
2052 |
+ caif_assert(sizeof(linkparam.u.utility.name) |
2053 |
+@@ -468,24 +462,24 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt) |
2054 |
+ for (i = 0; |
2055 |
+ i < UTILITY_NAME_LENGTH |
2056 |
+ && cfpkt_more(pkt); i++) { |
2057 |
+- cfpkt_extr_head(pkt, &tmp, 1); |
2058 |
++ tmp = cfpkt_extr_head_u8(pkt); |
2059 |
+ *cp++ = tmp; |
2060 |
+ } |
2061 |
+ /* Length */ |
2062 |
+- cfpkt_extr_head(pkt, &len, 1); |
2063 |
++ len = cfpkt_extr_head_u8(pkt); |
2064 |
+ linkparam.u.utility.paramlen = len; |
2065 |
+ /* Param Data */ |
2066 |
+ cp = linkparam.u.utility.params; |
2067 |
+ while (cfpkt_more(pkt) && len--) { |
2068 |
+- cfpkt_extr_head(pkt, &tmp, 1); |
2069 |
++ tmp = cfpkt_extr_head_u8(pkt); |
2070 |
+ *cp++ = tmp; |
2071 |
+ } |
2072 |
+ if (CFCTRL_ERR_BIT & cmdrsp) |
2073 |
+ break; |
2074 |
+ /* Link ID */ |
2075 |
+- cfpkt_extr_head(pkt, &linkid, 1); |
2076 |
++ linkid = cfpkt_extr_head_u8(pkt); |
2077 |
+ /* Length */ |
2078 |
+- cfpkt_extr_head(pkt, &len, 1); |
2079 |
++ len = cfpkt_extr_head_u8(pkt); |
2080 |
+ /* Param Data */ |
2081 |
+ cfpkt_extr_head(pkt, ¶m, len); |
2082 |
+ break; |
2083 |
+@@ -522,7 +516,7 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt) |
2084 |
+ } |
2085 |
+ break; |
2086 |
+ case CFCTRL_CMD_LINK_DESTROY: |
2087 |
+- cfpkt_extr_head(pkt, &linkid, 1); |
2088 |
++ linkid = cfpkt_extr_head_u8(pkt); |
2089 |
+ cfctrl->res.linkdestroy_rsp(cfctrl->serv.layer.up, linkid); |
2090 |
+ break; |
2091 |
+ case CFCTRL_CMD_LINK_ERR: |
2092 |
+diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c |
2093 |
+index 100c86f1f547..7f1a85c6a614 100644 |
2094 |
+--- a/net/ipv4/ip_output.c |
2095 |
++++ b/net/ipv4/ip_output.c |
2096 |
+@@ -492,6 +492,7 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from) |
2097 |
+ to->pkt_type = from->pkt_type; |
2098 |
+ to->priority = from->priority; |
2099 |
+ to->protocol = from->protocol; |
2100 |
++ to->skb_iif = from->skb_iif; |
2101 |
+ skb_dst_drop(to); |
2102 |
+ skb_dst_copy(to, from); |
2103 |
+ to->dev = from->dev; |
2104 |
+diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c |
2105 |
+index b82e439804d1..8c2f9aedc2af 100644 |
2106 |
+--- a/net/ipv6/ip6_flowlabel.c |
2107 |
++++ b/net/ipv6/ip6_flowlabel.c |
2108 |
+@@ -94,15 +94,21 @@ static struct ip6_flowlabel *fl_lookup(struct net *net, __be32 label) |
2109 |
+ return fl; |
2110 |
+ } |
2111 |
+ |
2112 |
++static void fl_free_rcu(struct rcu_head *head) |
2113 |
++{ |
2114 |
++ struct ip6_flowlabel *fl = container_of(head, struct ip6_flowlabel, rcu); |
2115 |
++ |
2116 |
++ if (fl->share == IPV6_FL_S_PROCESS) |
2117 |
++ put_pid(fl->owner.pid); |
2118 |
++ kfree(fl->opt); |
2119 |
++ kfree(fl); |
2120 |
++} |
2121 |
++ |
2122 |
+ |
2123 |
+ static void fl_free(struct ip6_flowlabel *fl) |
2124 |
+ { |
2125 |
+- if (fl) { |
2126 |
+- if (fl->share == IPV6_FL_S_PROCESS) |
2127 |
+- put_pid(fl->owner.pid); |
2128 |
+- kfree(fl->opt); |
2129 |
+- kfree_rcu(fl, rcu); |
2130 |
+- } |
2131 |
++ if (fl) |
2132 |
++ call_rcu(&fl->rcu, fl_free_rcu); |
2133 |
+ } |
2134 |
+ |
2135 |
+ static void fl_release(struct ip6_flowlabel *fl) |
2136 |
+@@ -634,9 +640,9 @@ recheck: |
2137 |
+ if (fl1->share == IPV6_FL_S_EXCL || |
2138 |
+ fl1->share != fl->share || |
2139 |
+ ((fl1->share == IPV6_FL_S_PROCESS) && |
2140 |
+- (fl1->owner.pid == fl->owner.pid)) || |
2141 |
++ (fl1->owner.pid != fl->owner.pid)) || |
2142 |
+ ((fl1->share == IPV6_FL_S_USER) && |
2143 |
+- uid_eq(fl1->owner.uid, fl->owner.uid))) |
2144 |
++ !uid_eq(fl1->owner.uid, fl->owner.uid))) |
2145 |
+ goto release; |
2146 |
+ |
2147 |
+ err = -ENOMEM; |
2148 |
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
2149 |
+index 522d4ca715c9..ea37160d5ae2 100644 |
2150 |
+--- a/net/packet/af_packet.c |
2151 |
++++ b/net/packet/af_packet.c |
2152 |
+@@ -2638,8 +2638,8 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) |
2153 |
+ void *ph; |
2154 |
+ DECLARE_SOCKADDR(struct sockaddr_ll *, saddr, msg->msg_name); |
2155 |
+ bool need_wait = !(msg->msg_flags & MSG_DONTWAIT); |
2156 |
++ unsigned char *addr = NULL; |
2157 |
+ int tp_len, size_max; |
2158 |
+- unsigned char *addr; |
2159 |
+ void *data; |
2160 |
+ int len_sum = 0; |
2161 |
+ int status = TP_STATUS_AVAILABLE; |
2162 |
+@@ -2650,7 +2650,6 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) |
2163 |
+ if (likely(saddr == NULL)) { |
2164 |
+ dev = packet_cached_dev_get(po); |
2165 |
+ proto = po->num; |
2166 |
+- addr = NULL; |
2167 |
+ } else { |
2168 |
+ err = -EINVAL; |
2169 |
+ if (msg->msg_namelen < sizeof(struct sockaddr_ll)) |
2170 |
+@@ -2660,10 +2659,13 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) |
2171 |
+ sll_addr))) |
2172 |
+ goto out; |
2173 |
+ proto = saddr->sll_protocol; |
2174 |
+- addr = saddr->sll_halen ? saddr->sll_addr : NULL; |
2175 |
+ dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex); |
2176 |
+- if (addr && dev && saddr->sll_halen < dev->addr_len) |
2177 |
+- goto out_put; |
2178 |
++ if (po->sk.sk_socket->type == SOCK_DGRAM) { |
2179 |
++ if (dev && msg->msg_namelen < dev->addr_len + |
2180 |
++ offsetof(struct sockaddr_ll, sll_addr)) |
2181 |
++ goto out_put; |
2182 |
++ addr = saddr->sll_addr; |
2183 |
++ } |
2184 |
+ } |
2185 |
+ |
2186 |
+ err = -ENXIO; |
2187 |
+@@ -2834,7 +2836,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) |
2188 |
+ struct sk_buff *skb; |
2189 |
+ struct net_device *dev; |
2190 |
+ __be16 proto; |
2191 |
+- unsigned char *addr; |
2192 |
++ unsigned char *addr = NULL; |
2193 |
+ int err, reserve = 0; |
2194 |
+ struct sockcm_cookie sockc; |
2195 |
+ struct virtio_net_hdr vnet_hdr = { 0 }; |
2196 |
+@@ -2851,7 +2853,6 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) |
2197 |
+ if (likely(saddr == NULL)) { |
2198 |
+ dev = packet_cached_dev_get(po); |
2199 |
+ proto = po->num; |
2200 |
+- addr = NULL; |
2201 |
+ } else { |
2202 |
+ err = -EINVAL; |
2203 |
+ if (msg->msg_namelen < sizeof(struct sockaddr_ll)) |
2204 |
+@@ -2859,10 +2860,13 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) |
2205 |
+ if (msg->msg_namelen < (saddr->sll_halen + offsetof(struct sockaddr_ll, sll_addr))) |
2206 |
+ goto out; |
2207 |
+ proto = saddr->sll_protocol; |
2208 |
+- addr = saddr->sll_halen ? saddr->sll_addr : NULL; |
2209 |
+ dev = dev_get_by_index(sock_net(sk), saddr->sll_ifindex); |
2210 |
+- if (addr && dev && saddr->sll_halen < dev->addr_len) |
2211 |
+- goto out_unlock; |
2212 |
++ if (sock->type == SOCK_DGRAM) { |
2213 |
++ if (dev && msg->msg_namelen < dev->addr_len + |
2214 |
++ offsetof(struct sockaddr_ll, sll_addr)) |
2215 |
++ goto out_unlock; |
2216 |
++ addr = saddr->sll_addr; |
2217 |
++ } |
2218 |
+ } |
2219 |
+ |
2220 |
+ err = -ENXIO; |
2221 |
+diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
2222 |
+index 9bd6f97ccd21..772df402c495 100644 |
2223 |
+--- a/security/selinux/hooks.c |
2224 |
++++ b/security/selinux/hooks.c |
2225 |
+@@ -467,21 +467,43 @@ static int may_context_mount_inode_relabel(u32 sid, |
2226 |
+ return rc; |
2227 |
+ } |
2228 |
+ |
2229 |
+-static int selinux_is_sblabel_mnt(struct super_block *sb) |
2230 |
++static int selinux_is_genfs_special_handling(struct super_block *sb) |
2231 |
+ { |
2232 |
+- struct superblock_security_struct *sbsec = sb->s_security; |
2233 |
+- |
2234 |
+- return sbsec->behavior == SECURITY_FS_USE_XATTR || |
2235 |
+- sbsec->behavior == SECURITY_FS_USE_TRANS || |
2236 |
+- sbsec->behavior == SECURITY_FS_USE_TASK || |
2237 |
+- sbsec->behavior == SECURITY_FS_USE_NATIVE || |
2238 |
+- /* Special handling. Genfs but also in-core setxattr handler */ |
2239 |
+- !strcmp(sb->s_type->name, "sysfs") || |
2240 |
++ /* Special handling. Genfs but also in-core setxattr handler */ |
2241 |
++ return !strcmp(sb->s_type->name, "sysfs") || |
2242 |
+ !strcmp(sb->s_type->name, "pstore") || |
2243 |
+ !strcmp(sb->s_type->name, "debugfs") || |
2244 |
+ !strcmp(sb->s_type->name, "rootfs"); |
2245 |
+ } |
2246 |
+ |
2247 |
++static int selinux_is_sblabel_mnt(struct super_block *sb) |
2248 |
++{ |
2249 |
++ struct superblock_security_struct *sbsec = sb->s_security; |
2250 |
++ |
2251 |
++ /* |
2252 |
++ * IMPORTANT: Double-check logic in this function when adding a new |
2253 |
++ * SECURITY_FS_USE_* definition! |
2254 |
++ */ |
2255 |
++ BUILD_BUG_ON(SECURITY_FS_USE_MAX != 7); |
2256 |
++ |
2257 |
++ switch (sbsec->behavior) { |
2258 |
++ case SECURITY_FS_USE_XATTR: |
2259 |
++ case SECURITY_FS_USE_TRANS: |
2260 |
++ case SECURITY_FS_USE_TASK: |
2261 |
++ case SECURITY_FS_USE_NATIVE: |
2262 |
++ return 1; |
2263 |
++ |
2264 |
++ case SECURITY_FS_USE_GENFS: |
2265 |
++ return selinux_is_genfs_special_handling(sb); |
2266 |
++ |
2267 |
++ /* Never allow relabeling on context mounts */ |
2268 |
++ case SECURITY_FS_USE_MNTPOINT: |
2269 |
++ case SECURITY_FS_USE_NONE: |
2270 |
++ default: |
2271 |
++ return 0; |
2272 |
++ } |
2273 |
++} |
2274 |
++ |
2275 |
+ static int sb_finish_set_opts(struct super_block *sb) |
2276 |
+ { |
2277 |
+ struct superblock_security_struct *sbsec = sb->s_security; |
2278 |
+diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c |
2279 |
+index 58d624938a9f..09189249d0d1 100644 |
2280 |
+--- a/sound/usb/line6/driver.c |
2281 |
++++ b/sound/usb/line6/driver.c |
2282 |
+@@ -337,12 +337,16 @@ int line6_read_data(struct usb_line6 *line6, unsigned address, void *data, |
2283 |
+ { |
2284 |
+ struct usb_device *usbdev = line6->usbdev; |
2285 |
+ int ret; |
2286 |
+- unsigned char len; |
2287 |
++ unsigned char *len; |
2288 |
+ unsigned count; |
2289 |
+ |
2290 |
+ if (address > 0xffff || datalen > 0xff) |
2291 |
+ return -EINVAL; |
2292 |
+ |
2293 |
++ len = kmalloc(sizeof(*len), GFP_KERNEL); |
2294 |
++ if (!len) |
2295 |
++ return -ENOMEM; |
2296 |
++ |
2297 |
+ /* query the serial number: */ |
2298 |
+ ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67, |
2299 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
2300 |
+@@ -351,7 +355,7 @@ int line6_read_data(struct usb_line6 *line6, unsigned address, void *data, |
2301 |
+ |
2302 |
+ if (ret < 0) { |
2303 |
+ dev_err(line6->ifcdev, "read request failed (error %d)\n", ret); |
2304 |
+- return ret; |
2305 |
++ goto exit; |
2306 |
+ } |
2307 |
+ |
2308 |
+ /* Wait for data length. We'll get 0xff until length arrives. */ |
2309 |
+@@ -361,28 +365,29 @@ int line6_read_data(struct usb_line6 *line6, unsigned address, void *data, |
2310 |
+ ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67, |
2311 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | |
2312 |
+ USB_DIR_IN, |
2313 |
+- 0x0012, 0x0000, &len, 1, |
2314 |
++ 0x0012, 0x0000, len, 1, |
2315 |
+ LINE6_TIMEOUT * HZ); |
2316 |
+ if (ret < 0) { |
2317 |
+ dev_err(line6->ifcdev, |
2318 |
+ "receive length failed (error %d)\n", ret); |
2319 |
+- return ret; |
2320 |
++ goto exit; |
2321 |
+ } |
2322 |
+ |
2323 |
+- if (len != 0xff) |
2324 |
++ if (*len != 0xff) |
2325 |
+ break; |
2326 |
+ } |
2327 |
+ |
2328 |
+- if (len == 0xff) { |
2329 |
++ ret = -EIO; |
2330 |
++ if (*len == 0xff) { |
2331 |
+ dev_err(line6->ifcdev, "read failed after %d retries\n", |
2332 |
+ count); |
2333 |
+- return -EIO; |
2334 |
+- } else if (len != datalen) { |
2335 |
++ goto exit; |
2336 |
++ } else if (*len != datalen) { |
2337 |
+ /* should be equal or something went wrong */ |
2338 |
+ dev_err(line6->ifcdev, |
2339 |
+ "length mismatch (expected %d, got %d)\n", |
2340 |
+- (int)datalen, (int)len); |
2341 |
+- return -EIO; |
2342 |
++ (int)datalen, (int)*len); |
2343 |
++ goto exit; |
2344 |
+ } |
2345 |
+ |
2346 |
+ /* receive the result: */ |
2347 |
+@@ -391,12 +396,12 @@ int line6_read_data(struct usb_line6 *line6, unsigned address, void *data, |
2348 |
+ 0x0013, 0x0000, data, datalen, |
2349 |
+ LINE6_TIMEOUT * HZ); |
2350 |
+ |
2351 |
+- if (ret < 0) { |
2352 |
++ if (ret < 0) |
2353 |
+ dev_err(line6->ifcdev, "read failed (error %d)\n", ret); |
2354 |
+- return ret; |
2355 |
+- } |
2356 |
+ |
2357 |
+- return 0; |
2358 |
++exit: |
2359 |
++ kfree(len); |
2360 |
++ return ret; |
2361 |
+ } |
2362 |
+ EXPORT_SYMBOL_GPL(line6_read_data); |
2363 |
+ |
2364 |
+@@ -408,12 +413,16 @@ int line6_write_data(struct usb_line6 *line6, unsigned address, void *data, |
2365 |
+ { |
2366 |
+ struct usb_device *usbdev = line6->usbdev; |
2367 |
+ int ret; |
2368 |
+- unsigned char status; |
2369 |
++ unsigned char *status; |
2370 |
+ int count; |
2371 |
+ |
2372 |
+ if (address > 0xffff || datalen > 0xffff) |
2373 |
+ return -EINVAL; |
2374 |
+ |
2375 |
++ status = kmalloc(sizeof(*status), GFP_KERNEL); |
2376 |
++ if (!status) |
2377 |
++ return -ENOMEM; |
2378 |
++ |
2379 |
+ ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67, |
2380 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
2381 |
+ 0x0022, address, data, datalen, |
2382 |
+@@ -422,7 +431,7 @@ int line6_write_data(struct usb_line6 *line6, unsigned address, void *data, |
2383 |
+ if (ret < 0) { |
2384 |
+ dev_err(line6->ifcdev, |
2385 |
+ "write request failed (error %d)\n", ret); |
2386 |
+- return ret; |
2387 |
++ goto exit; |
2388 |
+ } |
2389 |
+ |
2390 |
+ for (count = 0; count < LINE6_READ_WRITE_MAX_RETRIES; count++) { |
2391 |
+@@ -433,28 +442,29 @@ int line6_write_data(struct usb_line6 *line6, unsigned address, void *data, |
2392 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | |
2393 |
+ USB_DIR_IN, |
2394 |
+ 0x0012, 0x0000, |
2395 |
+- &status, 1, LINE6_TIMEOUT * HZ); |
2396 |
++ status, 1, LINE6_TIMEOUT * HZ); |
2397 |
+ |
2398 |
+ if (ret < 0) { |
2399 |
+ dev_err(line6->ifcdev, |
2400 |
+ "receiving status failed (error %d)\n", ret); |
2401 |
+- return ret; |
2402 |
++ goto exit; |
2403 |
+ } |
2404 |
+ |
2405 |
+- if (status != 0xff) |
2406 |
++ if (*status != 0xff) |
2407 |
+ break; |
2408 |
+ } |
2409 |
+ |
2410 |
+- if (status == 0xff) { |
2411 |
++ if (*status == 0xff) { |
2412 |
+ dev_err(line6->ifcdev, "write failed after %d retries\n", |
2413 |
+ count); |
2414 |
+- return -EIO; |
2415 |
+- } else if (status != 0) { |
2416 |
++ ret = -EIO; |
2417 |
++ } else if (*status != 0) { |
2418 |
+ dev_err(line6->ifcdev, "write failed (error %d)\n", ret); |
2419 |
+- return -EIO; |
2420 |
++ ret = -EIO; |
2421 |
+ } |
2422 |
+- |
2423 |
+- return 0; |
2424 |
++exit: |
2425 |
++ kfree(status); |
2426 |
++ return ret; |
2427 |
+ } |
2428 |
+ EXPORT_SYMBOL_GPL(line6_write_data); |
2429 |
+ |
2430 |
+diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c |
2431 |
+index 5ab9e0c89211..c0b6733c0623 100644 |
2432 |
+--- a/sound/usb/line6/podhd.c |
2433 |
++++ b/sound/usb/line6/podhd.c |
2434 |
+@@ -221,28 +221,32 @@ static void podhd_startup_start_workqueue(unsigned long data) |
2435 |
+ static int podhd_dev_start(struct usb_line6_podhd *pod) |
2436 |
+ { |
2437 |
+ int ret; |
2438 |
+- u8 init_bytes[8]; |
2439 |
++ u8 *init_bytes; |
2440 |
+ int i; |
2441 |
+ struct usb_device *usbdev = pod->line6.usbdev; |
2442 |
+ |
2443 |
++ init_bytes = kmalloc(8, GFP_KERNEL); |
2444 |
++ if (!init_bytes) |
2445 |
++ return -ENOMEM; |
2446 |
++ |
2447 |
+ ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), |
2448 |
+ 0x67, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
2449 |
+ 0x11, 0, |
2450 |
+ NULL, 0, LINE6_TIMEOUT * HZ); |
2451 |
+ if (ret < 0) { |
2452 |
+ dev_err(pod->line6.ifcdev, "read request failed (error %d)\n", ret); |
2453 |
+- return ret; |
2454 |
++ goto exit; |
2455 |
+ } |
2456 |
+ |
2457 |
+ /* NOTE: looks like some kind of ping message */ |
2458 |
+ ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67, |
2459 |
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
2460 |
+ 0x11, 0x0, |
2461 |
+- &init_bytes, 3, LINE6_TIMEOUT * HZ); |
2462 |
++ init_bytes, 3, LINE6_TIMEOUT * HZ); |
2463 |
+ if (ret < 0) { |
2464 |
+ dev_err(pod->line6.ifcdev, |
2465 |
+ "receive length failed (error %d)\n", ret); |
2466 |
+- return ret; |
2467 |
++ goto exit; |
2468 |
+ } |
2469 |
+ |
2470 |
+ pod->firmware_version = |
2471 |
+@@ -251,7 +255,7 @@ static int podhd_dev_start(struct usb_line6_podhd *pod) |
2472 |
+ for (i = 0; i <= 16; i++) { |
2473 |
+ ret = line6_read_data(&pod->line6, 0xf000 + 0x08 * i, init_bytes, 8); |
2474 |
+ if (ret < 0) |
2475 |
+- return ret; |
2476 |
++ goto exit; |
2477 |
+ } |
2478 |
+ |
2479 |
+ ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), |
2480 |
+@@ -259,10 +263,9 @@ static int podhd_dev_start(struct usb_line6_podhd *pod) |
2481 |
+ USB_TYPE_STANDARD | USB_RECIP_DEVICE | USB_DIR_OUT, |
2482 |
+ 1, 0, |
2483 |
+ NULL, 0, LINE6_TIMEOUT * HZ); |
2484 |
+- if (ret < 0) |
2485 |
+- return ret; |
2486 |
+- |
2487 |
+- return 0; |
2488 |
++exit: |
2489 |
++ kfree(init_bytes); |
2490 |
++ return ret; |
2491 |
+ } |
2492 |
+ |
2493 |
+ static void podhd_startup_workqueue(struct work_struct *work) |
2494 |
+diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c |
2495 |
+index 8e22f430d700..d3871d99ade4 100644 |
2496 |
+--- a/sound/usb/line6/toneport.c |
2497 |
++++ b/sound/usb/line6/toneport.c |
2498 |
+@@ -365,15 +365,20 @@ static bool toneport_has_source_select(struct usb_line6_toneport *toneport) |
2499 |
+ /* |
2500 |
+ Setup Toneport device. |
2501 |
+ */ |
2502 |
+-static void toneport_setup(struct usb_line6_toneport *toneport) |
2503 |
++static int toneport_setup(struct usb_line6_toneport *toneport) |
2504 |
+ { |
2505 |
+- int ticks; |
2506 |
++ int *ticks; |
2507 |
+ struct usb_line6 *line6 = &toneport->line6; |
2508 |
+ struct usb_device *usbdev = line6->usbdev; |
2509 |
+ |
2510 |
++ ticks = kmalloc(sizeof(*ticks), GFP_KERNEL); |
2511 |
++ if (!ticks) |
2512 |
++ return -ENOMEM; |
2513 |
++ |
2514 |
+ /* sync time on device with host: */ |
2515 |
+- ticks = (int)get_seconds(); |
2516 |
+- line6_write_data(line6, 0x80c6, &ticks, 4); |
2517 |
++ *ticks = (int)get_seconds(); |
2518 |
++ line6_write_data(line6, 0x80c6, ticks, 4); |
2519 |
++ kfree(ticks); |
2520 |
+ |
2521 |
+ /* enable device: */ |
2522 |
+ toneport_send_cmd(usbdev, 0x0301, 0x0000); |
2523 |
+@@ -388,6 +393,7 @@ static void toneport_setup(struct usb_line6_toneport *toneport) |
2524 |
+ toneport_update_led(toneport); |
2525 |
+ |
2526 |
+ mod_timer(&toneport->timer, jiffies + TONEPORT_PCM_DELAY * HZ); |
2527 |
++ return 0; |
2528 |
+ } |
2529 |
+ |
2530 |
+ /* |
2531 |
+@@ -451,7 +457,9 @@ static int toneport_init(struct usb_line6 *line6, |
2532 |
+ return err; |
2533 |
+ } |
2534 |
+ |
2535 |
+- toneport_setup(toneport); |
2536 |
++ err = toneport_setup(toneport); |
2537 |
++ if (err) |
2538 |
++ return err; |
2539 |
+ |
2540 |
+ /* register audio system: */ |
2541 |
+ return snd_card_register(line6->card); |
2542 |
+@@ -463,7 +471,11 @@ static int toneport_init(struct usb_line6 *line6, |
2543 |
+ */ |
2544 |
+ static int toneport_reset_resume(struct usb_interface *interface) |
2545 |
+ { |
2546 |
+- toneport_setup(usb_get_intfdata(interface)); |
2547 |
++ int err; |
2548 |
++ |
2549 |
++ err = toneport_setup(usb_get_intfdata(interface)); |
2550 |
++ if (err) |
2551 |
++ return err; |
2552 |
+ return line6_resume(interface); |
2553 |
+ } |
2554 |
+ #endif |