1 |
commit: 9593c788a9fd6db0807c0d7ce5368460029634e4 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jan 9 11:13:44 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 9 11:13:44 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=9593c788 |
7 |
|
8 |
Linux patch 4.14.163 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1162_linux-4.14.163.patch | 2380 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2384 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index fbedcee..b1304d8 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -691,6 +691,10 @@ Patch: 1161_linux-4.14.162.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.14.162 |
23 |
|
24 |
+Patch: 1162_linux-4.14.163.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.14.163 |
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/1162_linux-4.14.163.patch b/1162_linux-4.14.163.patch |
33 |
new file mode 100644 |
34 |
index 0000000..b009853 |
35 |
--- /dev/null |
36 |
+++ b/1162_linux-4.14.163.patch |
37 |
@@ -0,0 +1,2380 @@ |
38 |
+diff --git a/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt b/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt |
39 |
+index e96e085271c1..83f6c6a7c41c 100644 |
40 |
+--- a/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt |
41 |
++++ b/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt |
42 |
+@@ -46,7 +46,7 @@ Required properties: |
43 |
+ Example (R-Car H3): |
44 |
+ |
45 |
+ usb2_clksel: clock-controller@e6590630 { |
46 |
+- compatible = "renesas,r8a77950-rcar-usb2-clock-sel", |
47 |
++ compatible = "renesas,r8a7795-rcar-usb2-clock-sel", |
48 |
+ "renesas,rcar-gen3-usb2-clock-sel"; |
49 |
+ reg = <0 0xe6590630 0 0x02>; |
50 |
+ clocks = <&cpg CPG_MOD 703>, <&usb_extal>, <&usb_xtal>; |
51 |
+diff --git a/Makefile b/Makefile |
52 |
+index cb57b5c58e2b..35a71a78d1d2 100644 |
53 |
+--- a/Makefile |
54 |
++++ b/Makefile |
55 |
+@@ -1,7 +1,7 @@ |
56 |
+ # SPDX-License-Identifier: GPL-2.0 |
57 |
+ VERSION = 4 |
58 |
+ PATCHLEVEL = 14 |
59 |
+-SUBLEVEL = 162 |
60 |
++SUBLEVEL = 163 |
61 |
+ EXTRAVERSION = |
62 |
+ NAME = Petit Gorille |
63 |
+ |
64 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
65 |
+index 4ea23df81f21..5da604e5cf28 100644 |
66 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
67 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
68 |
+@@ -295,7 +295,7 @@ |
69 |
+ }; |
70 |
+ |
71 |
+ &usb0_phy { |
72 |
+- status = "okay"; |
73 |
++ status = "disabled"; |
74 |
+ phy-supply = <&usb_otg_pwr>; |
75 |
+ }; |
76 |
+ |
77 |
+@@ -305,7 +305,7 @@ |
78 |
+ }; |
79 |
+ |
80 |
+ &usb0 { |
81 |
+- status = "okay"; |
82 |
++ status = "disabled"; |
83 |
+ }; |
84 |
+ |
85 |
+ &usb1 { |
86 |
+diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h |
87 |
+index 20e45733afa4..26efe251f076 100644 |
88 |
+--- a/arch/arm64/include/asm/pgtable-prot.h |
89 |
++++ b/arch/arm64/include/asm/pgtable-prot.h |
90 |
+@@ -76,13 +76,12 @@ |
91 |
+ #define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_WRITE) |
92 |
+ #define PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN) |
93 |
+ #define PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN) |
94 |
+-#define PAGE_EXECONLY __pgprot(_PAGE_DEFAULT | PTE_RDONLY | PTE_NG | PTE_PXN) |
95 |
+ |
96 |
+ #define __P000 PAGE_NONE |
97 |
+ #define __P001 PAGE_READONLY |
98 |
+ #define __P010 PAGE_READONLY |
99 |
+ #define __P011 PAGE_READONLY |
100 |
+-#define __P100 PAGE_EXECONLY |
101 |
++#define __P100 PAGE_READONLY_EXEC |
102 |
+ #define __P101 PAGE_READONLY_EXEC |
103 |
+ #define __P110 PAGE_READONLY_EXEC |
104 |
+ #define __P111 PAGE_READONLY_EXEC |
105 |
+@@ -91,7 +90,7 @@ |
106 |
+ #define __S001 PAGE_READONLY |
107 |
+ #define __S010 PAGE_SHARED |
108 |
+ #define __S011 PAGE_SHARED |
109 |
+-#define __S100 PAGE_EXECONLY |
110 |
++#define __S100 PAGE_READONLY_EXEC |
111 |
+ #define __S101 PAGE_READONLY_EXEC |
112 |
+ #define __S110 PAGE_SHARED_EXEC |
113 |
+ #define __S111 PAGE_SHARED_EXEC |
114 |
+diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h |
115 |
+index aa3b8dd8fc35..9b676c3dd3ce 100644 |
116 |
+--- a/arch/arm64/include/asm/pgtable.h |
117 |
++++ b/arch/arm64/include/asm/pgtable.h |
118 |
+@@ -90,12 +90,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
119 |
+ #define pte_dirty(pte) (pte_sw_dirty(pte) || pte_hw_dirty(pte)) |
120 |
+ |
121 |
+ #define pte_valid(pte) (!!(pte_val(pte) & PTE_VALID)) |
122 |
+-/* |
123 |
+- * Execute-only user mappings do not have the PTE_USER bit set. All valid |
124 |
+- * kernel mappings have the PTE_UXN bit set. |
125 |
+- */ |
126 |
+ #define pte_valid_not_user(pte) \ |
127 |
+- ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == (PTE_VALID | PTE_UXN)) |
128 |
++ ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID) |
129 |
+ #define pte_valid_young(pte) \ |
130 |
+ ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF)) |
131 |
+ #define pte_valid_user(pte) \ |
132 |
+@@ -111,8 +107,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
133 |
+ |
134 |
+ /* |
135 |
+ * p??_access_permitted() is true for valid user mappings (subject to the |
136 |
+- * write permission check) other than user execute-only which do not have the |
137 |
+- * PTE_USER bit set. PROT_NONE mappings do not have the PTE_VALID bit set. |
138 |
++ * write permission check). PROT_NONE mappings do not have the PTE_VALID bit |
139 |
++ * set. |
140 |
+ */ |
141 |
+ #define pte_access_permitted(pte, write) \ |
142 |
+ (pte_valid_user(pte) && (!(write) || pte_write(pte))) |
143 |
+diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c |
144 |
+index bf7c285d0c82..617787e4081f 100644 |
145 |
+--- a/arch/arm64/mm/fault.c |
146 |
++++ b/arch/arm64/mm/fault.c |
147 |
+@@ -400,7 +400,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, |
148 |
+ struct task_struct *tsk; |
149 |
+ struct mm_struct *mm; |
150 |
+ int fault, sig, code, major = 0; |
151 |
+- unsigned long vm_flags = VM_READ | VM_WRITE; |
152 |
++ unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC; |
153 |
+ unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; |
154 |
+ |
155 |
+ if (notify_page_fault(regs, esr)) |
156 |
+diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h |
157 |
+index 5e8927f99a76..a0338dbabeaa 100644 |
158 |
+--- a/arch/mips/include/asm/thread_info.h |
159 |
++++ b/arch/mips/include/asm/thread_info.h |
160 |
+@@ -52,8 +52,26 @@ struct thread_info { |
161 |
+ #define init_thread_info (init_thread_union.thread_info) |
162 |
+ #define init_stack (init_thread_union.stack) |
163 |
+ |
164 |
+-/* How to get the thread information struct from C. */ |
165 |
++/* |
166 |
++ * A pointer to the struct thread_info for the currently executing thread is |
167 |
++ * held in register $28/$gp. |
168 |
++ * |
169 |
++ * We declare __current_thread_info as a global register variable rather than a |
170 |
++ * local register variable within current_thread_info() because clang doesn't |
171 |
++ * support explicit local register variables. |
172 |
++ * |
173 |
++ * When building the VDSO we take care not to declare the global register |
174 |
++ * variable because this causes GCC to not preserve the value of $28/$gp in |
175 |
++ * functions that change its value (which is common in the PIC VDSO when |
176 |
++ * accessing the GOT). Since the VDSO shouldn't be accessing |
177 |
++ * __current_thread_info anyway we declare it extern in order to cause a link |
178 |
++ * failure if it's referenced. |
179 |
++ */ |
180 |
++#ifdef __VDSO__ |
181 |
++extern struct thread_info *__current_thread_info; |
182 |
++#else |
183 |
+ register struct thread_info *__current_thread_info __asm__("$28"); |
184 |
++#endif |
185 |
+ |
186 |
+ static inline struct thread_info *current_thread_info(void) |
187 |
+ { |
188 |
+diff --git a/arch/powerpc/platforms/pseries/hvconsole.c b/arch/powerpc/platforms/pseries/hvconsole.c |
189 |
+index 74da18de853a..73ec15cd2708 100644 |
190 |
+--- a/arch/powerpc/platforms/pseries/hvconsole.c |
191 |
++++ b/arch/powerpc/platforms/pseries/hvconsole.c |
192 |
+@@ -62,7 +62,7 @@ EXPORT_SYMBOL(hvc_get_chars); |
193 |
+ * @vtermno: The vtermno or unit_address of the adapter from which the data |
194 |
+ * originated. |
195 |
+ * @buf: The character buffer that contains the character data to send to |
196 |
+- * firmware. |
197 |
++ * firmware. Must be at least 16 bytes, even if count is less than 16. |
198 |
+ * @count: Send this number of characters. |
199 |
+ */ |
200 |
+ int hvc_put_chars(uint32_t vtermno, const char *buf, int count) |
201 |
+diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c |
202 |
+index 45304085b6ee..b652593d7de6 100644 |
203 |
+--- a/arch/s390/kernel/perf_cpum_sf.c |
204 |
++++ b/arch/s390/kernel/perf_cpum_sf.c |
205 |
+@@ -1294,18 +1294,28 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all) |
206 |
+ */ |
207 |
+ if (flush_all && done) |
208 |
+ break; |
209 |
+- |
210 |
+- /* If an event overflow happened, discard samples by |
211 |
+- * processing any remaining sample-data-blocks. |
212 |
+- */ |
213 |
+- if (event_overflow) |
214 |
+- flush_all = 1; |
215 |
+ } |
216 |
+ |
217 |
+ /* Account sample overflows in the event hardware structure */ |
218 |
+ if (sampl_overflow) |
219 |
+ OVERFLOW_REG(hwc) = DIV_ROUND_UP(OVERFLOW_REG(hwc) + |
220 |
+ sampl_overflow, 1 + num_sdb); |
221 |
++ |
222 |
++ /* Perf_event_overflow() and perf_event_account_interrupt() limit |
223 |
++ * the interrupt rate to an upper limit. Roughly 1000 samples per |
224 |
++ * task tick. |
225 |
++ * Hitting this limit results in a large number |
226 |
++ * of throttled REF_REPORT_THROTTLE entries and the samples |
227 |
++ * are dropped. |
228 |
++ * Slightly increase the interval to avoid hitting this limit. |
229 |
++ */ |
230 |
++ if (event_overflow) { |
231 |
++ SAMPL_RATE(hwc) += DIV_ROUND_UP(SAMPL_RATE(hwc), 10); |
232 |
++ debug_sprintf_event(sfdbg, 1, "%s: rate adjustment %ld\n", |
233 |
++ __func__, |
234 |
++ DIV_ROUND_UP(SAMPL_RATE(hwc), 10)); |
235 |
++ } |
236 |
++ |
237 |
+ if (sampl_overflow || event_overflow) |
238 |
+ debug_sprintf_event(sfdbg, 4, "hw_perf_event_update: " |
239 |
+ "overflow stats: sample=%llu event=%llu\n", |
240 |
+diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c |
241 |
+index 27258db640d7..b649a6538350 100644 |
242 |
+--- a/arch/s390/kernel/smp.c |
243 |
++++ b/arch/s390/kernel/smp.c |
244 |
+@@ -725,39 +725,67 @@ static void __ref smp_get_core_info(struct sclp_core_info *info, int early) |
245 |
+ |
246 |
+ static int smp_add_present_cpu(int cpu); |
247 |
+ |
248 |
+-static int __smp_rescan_cpus(struct sclp_core_info *info, int sysfs_add) |
249 |
++static int smp_add_core(struct sclp_core_entry *core, cpumask_t *avail, |
250 |
++ bool configured, bool early) |
251 |
+ { |
252 |
+ struct pcpu *pcpu; |
253 |
+- cpumask_t avail; |
254 |
+- int cpu, nr, i, j; |
255 |
++ int cpu, nr, i; |
256 |
+ u16 address; |
257 |
+ |
258 |
+ nr = 0; |
259 |
+- cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask); |
260 |
+- cpu = cpumask_first(&avail); |
261 |
+- for (i = 0; (i < info->combined) && (cpu < nr_cpu_ids); i++) { |
262 |
+- if (sclp.has_core_type && info->core[i].type != boot_core_type) |
263 |
++ if (sclp.has_core_type && core->type != boot_core_type) |
264 |
++ return nr; |
265 |
++ cpu = cpumask_first(avail); |
266 |
++ address = core->core_id << smp_cpu_mt_shift; |
267 |
++ for (i = 0; (i <= smp_cpu_mtid) && (cpu < nr_cpu_ids); i++) { |
268 |
++ if (pcpu_find_address(cpu_present_mask, address + i)) |
269 |
+ continue; |
270 |
+- address = info->core[i].core_id << smp_cpu_mt_shift; |
271 |
+- for (j = 0; j <= smp_cpu_mtid; j++) { |
272 |
+- if (pcpu_find_address(cpu_present_mask, address + j)) |
273 |
+- continue; |
274 |
+- pcpu = pcpu_devices + cpu; |
275 |
+- pcpu->address = address + j; |
276 |
+- pcpu->state = |
277 |
+- (cpu >= info->configured*(smp_cpu_mtid + 1)) ? |
278 |
+- CPU_STATE_STANDBY : CPU_STATE_CONFIGURED; |
279 |
+- smp_cpu_set_polarization(cpu, POLARIZATION_UNKNOWN); |
280 |
+- set_cpu_present(cpu, true); |
281 |
+- if (sysfs_add && smp_add_present_cpu(cpu) != 0) |
282 |
+- set_cpu_present(cpu, false); |
283 |
+- else |
284 |
+- nr++; |
285 |
+- cpu = cpumask_next(cpu, &avail); |
286 |
+- if (cpu >= nr_cpu_ids) |
287 |
++ pcpu = pcpu_devices + cpu; |
288 |
++ pcpu->address = address + i; |
289 |
++ if (configured) |
290 |
++ pcpu->state = CPU_STATE_CONFIGURED; |
291 |
++ else |
292 |
++ pcpu->state = CPU_STATE_STANDBY; |
293 |
++ smp_cpu_set_polarization(cpu, POLARIZATION_UNKNOWN); |
294 |
++ set_cpu_present(cpu, true); |
295 |
++ if (!early && smp_add_present_cpu(cpu) != 0) |
296 |
++ set_cpu_present(cpu, false); |
297 |
++ else |
298 |
++ nr++; |
299 |
++ cpumask_clear_cpu(cpu, avail); |
300 |
++ cpu = cpumask_next(cpu, avail); |
301 |
++ } |
302 |
++ return nr; |
303 |
++} |
304 |
++ |
305 |
++static int __smp_rescan_cpus(struct sclp_core_info *info, bool early) |
306 |
++{ |
307 |
++ struct sclp_core_entry *core; |
308 |
++ cpumask_t avail; |
309 |
++ bool configured; |
310 |
++ u16 core_id; |
311 |
++ int nr, i; |
312 |
++ |
313 |
++ nr = 0; |
314 |
++ cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask); |
315 |
++ /* |
316 |
++ * Add IPL core first (which got logical CPU number 0) to make sure |
317 |
++ * that all SMT threads get subsequent logical CPU numbers. |
318 |
++ */ |
319 |
++ if (early) { |
320 |
++ core_id = pcpu_devices[0].address >> smp_cpu_mt_shift; |
321 |
++ for (i = 0; i < info->configured; i++) { |
322 |
++ core = &info->core[i]; |
323 |
++ if (core->core_id == core_id) { |
324 |
++ nr += smp_add_core(core, &avail, true, early); |
325 |
+ break; |
326 |
++ } |
327 |
+ } |
328 |
+ } |
329 |
++ for (i = 0; i < info->combined; i++) { |
330 |
++ configured = i < info->configured; |
331 |
++ nr += smp_add_core(&info->core[i], &avail, configured, early); |
332 |
++ } |
333 |
+ return nr; |
334 |
+ } |
335 |
+ |
336 |
+@@ -803,7 +831,7 @@ void __init smp_detect_cpus(void) |
337 |
+ |
338 |
+ /* Add CPUs present at boot */ |
339 |
+ get_online_cpus(); |
340 |
+- __smp_rescan_cpus(info, 0); |
341 |
++ __smp_rescan_cpus(info, true); |
342 |
+ put_online_cpus(); |
343 |
+ memblock_free_early((unsigned long)info, sizeof(*info)); |
344 |
+ } |
345 |
+@@ -1156,7 +1184,7 @@ int __ref smp_rescan_cpus(void) |
346 |
+ smp_get_core_info(info, 0); |
347 |
+ get_online_cpus(); |
348 |
+ mutex_lock(&smp_cpu_state_mutex); |
349 |
+- nr = __smp_rescan_cpus(info, 1); |
350 |
++ nr = __smp_rescan_cpus(info, false); |
351 |
+ mutex_unlock(&smp_cpu_state_mutex); |
352 |
+ put_online_cpus(); |
353 |
+ kfree(info); |
354 |
+diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c |
355 |
+index 24ffa1e88cf9..4d3399405d06 100644 |
356 |
+--- a/arch/x86/events/intel/bts.c |
357 |
++++ b/arch/x86/events/intel/bts.c |
358 |
+@@ -71,9 +71,17 @@ struct bts_buffer { |
359 |
+ |
360 |
+ static struct pmu bts_pmu; |
361 |
+ |
362 |
++static int buf_nr_pages(struct page *page) |
363 |
++{ |
364 |
++ if (!PagePrivate(page)) |
365 |
++ return 1; |
366 |
++ |
367 |
++ return 1 << page_private(page); |
368 |
++} |
369 |
++ |
370 |
+ static size_t buf_size(struct page *page) |
371 |
+ { |
372 |
+- return 1 << (PAGE_SHIFT + page_private(page)); |
373 |
++ return buf_nr_pages(page) * PAGE_SIZE; |
374 |
+ } |
375 |
+ |
376 |
+ static void * |
377 |
+@@ -89,9 +97,7 @@ bts_buffer_setup_aux(int cpu, void **pages, int nr_pages, bool overwrite) |
378 |
+ /* count all the high order buffers */ |
379 |
+ for (pg = 0, nbuf = 0; pg < nr_pages;) { |
380 |
+ page = virt_to_page(pages[pg]); |
381 |
+- if (WARN_ON_ONCE(!PagePrivate(page) && nr_pages > 1)) |
382 |
+- return NULL; |
383 |
+- pg += 1 << page_private(page); |
384 |
++ pg += buf_nr_pages(page); |
385 |
+ nbuf++; |
386 |
+ } |
387 |
+ |
388 |
+@@ -115,7 +121,7 @@ bts_buffer_setup_aux(int cpu, void **pages, int nr_pages, bool overwrite) |
389 |
+ unsigned int __nr_pages; |
390 |
+ |
391 |
+ page = virt_to_page(pages[pg]); |
392 |
+- __nr_pages = PagePrivate(page) ? 1 << page_private(page) : 1; |
393 |
++ __nr_pages = buf_nr_pages(page); |
394 |
+ buf->buf[nbuf].page = page; |
395 |
+ buf->buf[nbuf].offset = offset; |
396 |
+ buf->buf[nbuf].displacement = (pad ? BTS_RECORD_SIZE - pad : 0); |
397 |
+diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c |
398 |
+index 6ca015f92766..6490b2759bcb 100644 |
399 |
+--- a/block/compat_ioctl.c |
400 |
++++ b/block/compat_ioctl.c |
401 |
+@@ -6,6 +6,7 @@ |
402 |
+ #include <linux/compat.h> |
403 |
+ #include <linux/elevator.h> |
404 |
+ #include <linux/hdreg.h> |
405 |
++#include <linux/pr.h> |
406 |
+ #include <linux/slab.h> |
407 |
+ #include <linux/syscalls.h> |
408 |
+ #include <linux/types.h> |
409 |
+@@ -354,6 +355,8 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
410 |
+ * but we call blkdev_ioctl, which gets the lock for us |
411 |
+ */ |
412 |
+ case BLKRRPART: |
413 |
++ case BLKREPORTZONE: |
414 |
++ case BLKRESETZONE: |
415 |
+ return blkdev_ioctl(bdev, mode, cmd, |
416 |
+ (unsigned long)compat_ptr(arg)); |
417 |
+ case BLKBSZSET_32: |
418 |
+@@ -401,6 +404,14 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
419 |
+ case BLKTRACETEARDOWN: /* compatible */ |
420 |
+ ret = blk_trace_ioctl(bdev, cmd, compat_ptr(arg)); |
421 |
+ return ret; |
422 |
++ case IOC_PR_REGISTER: |
423 |
++ case IOC_PR_RESERVE: |
424 |
++ case IOC_PR_RELEASE: |
425 |
++ case IOC_PR_PREEMPT: |
426 |
++ case IOC_PR_PREEMPT_ABORT: |
427 |
++ case IOC_PR_CLEAR: |
428 |
++ return blkdev_ioctl(bdev, mode, cmd, |
429 |
++ (unsigned long)compat_ptr(arg)); |
430 |
+ default: |
431 |
+ if (disk->fops->compat_ioctl) |
432 |
+ ret = disk->fops->compat_ioctl(bdev, mode, cmd, arg); |
433 |
+diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c |
434 |
+index 5936d1679bf3..8beb81b24f14 100644 |
435 |
+--- a/drivers/ata/ahci_brcm.c |
436 |
++++ b/drivers/ata/ahci_brcm.c |
437 |
+@@ -25,6 +25,7 @@ |
438 |
+ #include <linux/module.h> |
439 |
+ #include <linux/of.h> |
440 |
+ #include <linux/platform_device.h> |
441 |
++#include <linux/reset.h> |
442 |
+ #include <linux/string.h> |
443 |
+ |
444 |
+ #include "ahci.h" |
445 |
+@@ -87,6 +88,7 @@ struct brcm_ahci_priv { |
446 |
+ u32 port_mask; |
447 |
+ u32 quirks; |
448 |
+ enum brcm_ahci_version version; |
449 |
++ struct reset_control *rcdev; |
450 |
+ }; |
451 |
+ |
452 |
+ static const struct ata_port_info ahci_brcm_port_info = { |
453 |
+@@ -221,19 +223,12 @@ static void brcm_sata_phys_disable(struct brcm_ahci_priv *priv) |
454 |
+ brcm_sata_phy_disable(priv, i); |
455 |
+ } |
456 |
+ |
457 |
+-static u32 brcm_ahci_get_portmask(struct platform_device *pdev, |
458 |
++static u32 brcm_ahci_get_portmask(struct ahci_host_priv *hpriv, |
459 |
+ struct brcm_ahci_priv *priv) |
460 |
+ { |
461 |
+- void __iomem *ahci; |
462 |
+- struct resource *res; |
463 |
+ u32 impl; |
464 |
+ |
465 |
+- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ahci"); |
466 |
+- ahci = devm_ioremap_resource(&pdev->dev, res); |
467 |
+- if (IS_ERR(ahci)) |
468 |
+- return 0; |
469 |
+- |
470 |
+- impl = readl(ahci + HOST_PORTS_IMPL); |
471 |
++ impl = readl(hpriv->mmio + HOST_PORTS_IMPL); |
472 |
+ |
473 |
+ if (fls(impl) > SATA_TOP_MAX_PHYS) |
474 |
+ dev_warn(priv->dev, "warning: more ports than PHYs (%#x)\n", |
475 |
+@@ -241,9 +236,6 @@ static u32 brcm_ahci_get_portmask(struct platform_device *pdev, |
476 |
+ else if (!impl) |
477 |
+ dev_info(priv->dev, "no ports found\n"); |
478 |
+ |
479 |
+- devm_iounmap(&pdev->dev, ahci); |
480 |
+- devm_release_mem_region(&pdev->dev, res->start, resource_size(res)); |
481 |
+- |
482 |
+ return impl; |
483 |
+ } |
484 |
+ |
485 |
+@@ -270,11 +262,10 @@ static int brcm_ahci_suspend(struct device *dev) |
486 |
+ struct ata_host *host = dev_get_drvdata(dev); |
487 |
+ struct ahci_host_priv *hpriv = host->private_data; |
488 |
+ struct brcm_ahci_priv *priv = hpriv->plat_data; |
489 |
+- int ret; |
490 |
+ |
491 |
+- ret = ahci_platform_suspend(dev); |
492 |
+ brcm_sata_phys_disable(priv); |
493 |
+- return ret; |
494 |
++ |
495 |
++ return ahci_platform_suspend(dev); |
496 |
+ } |
497 |
+ |
498 |
+ static int brcm_ahci_resume(struct device *dev) |
499 |
+@@ -282,11 +273,44 @@ static int brcm_ahci_resume(struct device *dev) |
500 |
+ struct ata_host *host = dev_get_drvdata(dev); |
501 |
+ struct ahci_host_priv *hpriv = host->private_data; |
502 |
+ struct brcm_ahci_priv *priv = hpriv->plat_data; |
503 |
++ int ret; |
504 |
++ |
505 |
++ /* Make sure clocks are turned on before re-configuration */ |
506 |
++ ret = ahci_platform_enable_clks(hpriv); |
507 |
++ if (ret) |
508 |
++ return ret; |
509 |
+ |
510 |
+ brcm_sata_init(priv); |
511 |
+ brcm_sata_phys_enable(priv); |
512 |
+ brcm_sata_alpm_init(hpriv); |
513 |
+- return ahci_platform_resume(dev); |
514 |
++ |
515 |
++ /* Since we had to enable clocks earlier on, we cannot use |
516 |
++ * ahci_platform_resume() as-is since a second call to |
517 |
++ * ahci_platform_enable_resources() would bump up the resources |
518 |
++ * (regulators, clocks, PHYs) count artificially so we copy the part |
519 |
++ * after ahci_platform_enable_resources(). |
520 |
++ */ |
521 |
++ ret = ahci_platform_enable_phys(hpriv); |
522 |
++ if (ret) |
523 |
++ goto out_disable_phys; |
524 |
++ |
525 |
++ ret = ahci_platform_resume_host(dev); |
526 |
++ if (ret) |
527 |
++ goto out_disable_platform_phys; |
528 |
++ |
529 |
++ /* We resumed so update PM runtime state */ |
530 |
++ pm_runtime_disable(dev); |
531 |
++ pm_runtime_set_active(dev); |
532 |
++ pm_runtime_enable(dev); |
533 |
++ |
534 |
++ return 0; |
535 |
++ |
536 |
++out_disable_platform_phys: |
537 |
++ ahci_platform_disable_phys(hpriv); |
538 |
++out_disable_phys: |
539 |
++ brcm_sata_phys_disable(priv); |
540 |
++ ahci_platform_disable_clks(hpriv); |
541 |
++ return ret; |
542 |
+ } |
543 |
+ #endif |
544 |
+ |
545 |
+@@ -327,44 +351,74 @@ static int brcm_ahci_probe(struct platform_device *pdev) |
546 |
+ if (IS_ERR(priv->top_ctrl)) |
547 |
+ return PTR_ERR(priv->top_ctrl); |
548 |
+ |
549 |
++ /* Reset is optional depending on platform */ |
550 |
++ priv->rcdev = devm_reset_control_get(&pdev->dev, "ahci"); |
551 |
++ if (!IS_ERR_OR_NULL(priv->rcdev)) |
552 |
++ reset_control_deassert(priv->rcdev); |
553 |
++ |
554 |
+ if ((priv->version == BRCM_SATA_BCM7425) || |
555 |
+ (priv->version == BRCM_SATA_NSP)) { |
556 |
+ priv->quirks |= BRCM_AHCI_QUIRK_NO_NCQ; |
557 |
+ priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE; |
558 |
+ } |
559 |
+ |
560 |
++ hpriv = ahci_platform_get_resources(pdev); |
561 |
++ if (IS_ERR(hpriv)) { |
562 |
++ ret = PTR_ERR(hpriv); |
563 |
++ goto out_reset; |
564 |
++ } |
565 |
++ |
566 |
++ ret = ahci_platform_enable_clks(hpriv); |
567 |
++ if (ret) |
568 |
++ goto out_reset; |
569 |
++ |
570 |
++ /* Must be first so as to configure endianness including that |
571 |
++ * of the standard AHCI register space. |
572 |
++ */ |
573 |
+ brcm_sata_init(priv); |
574 |
+ |
575 |
+- priv->port_mask = brcm_ahci_get_portmask(pdev, priv); |
576 |
+- if (!priv->port_mask) |
577 |
+- return -ENODEV; |
578 |
++ /* Initializes priv->port_mask which is used below */ |
579 |
++ priv->port_mask = brcm_ahci_get_portmask(hpriv, priv); |
580 |
++ if (!priv->port_mask) { |
581 |
++ ret = -ENODEV; |
582 |
++ goto out_disable_clks; |
583 |
++ } |
584 |
+ |
585 |
++ /* Must be done before ahci_platform_enable_phys() */ |
586 |
+ brcm_sata_phys_enable(priv); |
587 |
+ |
588 |
+- hpriv = ahci_platform_get_resources(pdev); |
589 |
+- if (IS_ERR(hpriv)) |
590 |
+- return PTR_ERR(hpriv); |
591 |
+ hpriv->plat_data = priv; |
592 |
+ hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP; |
593 |
+ |
594 |
+ brcm_sata_alpm_init(hpriv); |
595 |
+ |
596 |
+- ret = ahci_platform_enable_resources(hpriv); |
597 |
+- if (ret) |
598 |
+- return ret; |
599 |
+- |
600 |
+ if (priv->quirks & BRCM_AHCI_QUIRK_NO_NCQ) |
601 |
+ hpriv->flags |= AHCI_HFLAG_NO_NCQ; |
602 |
+ hpriv->flags |= AHCI_HFLAG_NO_WRITE_TO_RO; |
603 |
+ |
604 |
++ ret = ahci_platform_enable_phys(hpriv); |
605 |
++ if (ret) |
606 |
++ goto out_disable_phys; |
607 |
++ |
608 |
+ ret = ahci_platform_init_host(pdev, hpriv, &ahci_brcm_port_info, |
609 |
+ &ahci_platform_sht); |
610 |
+ if (ret) |
611 |
+- return ret; |
612 |
++ goto out_disable_platform_phys; |
613 |
+ |
614 |
+ dev_info(dev, "Broadcom AHCI SATA3 registered\n"); |
615 |
+ |
616 |
+ return 0; |
617 |
++ |
618 |
++out_disable_platform_phys: |
619 |
++ ahci_platform_disable_phys(hpriv); |
620 |
++out_disable_phys: |
621 |
++ brcm_sata_phys_disable(priv); |
622 |
++out_disable_clks: |
623 |
++ ahci_platform_disable_clks(hpriv); |
624 |
++out_reset: |
625 |
++ if (!IS_ERR_OR_NULL(priv->rcdev)) |
626 |
++ reset_control_assert(priv->rcdev); |
627 |
++ return ret; |
628 |
+ } |
629 |
+ |
630 |
+ static int brcm_ahci_remove(struct platform_device *pdev) |
631 |
+@@ -374,12 +428,12 @@ static int brcm_ahci_remove(struct platform_device *pdev) |
632 |
+ struct brcm_ahci_priv *priv = hpriv->plat_data; |
633 |
+ int ret; |
634 |
+ |
635 |
++ brcm_sata_phys_disable(priv); |
636 |
++ |
637 |
+ ret = ata_platform_remove_one(pdev); |
638 |
+ if (ret) |
639 |
+ return ret; |
640 |
+ |
641 |
+- brcm_sata_phys_disable(priv); |
642 |
+- |
643 |
+ return 0; |
644 |
+ } |
645 |
+ |
646 |
+diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c |
647 |
+index 70cdbf1b0f9a..5929672b809e 100644 |
648 |
+--- a/drivers/ata/libahci_platform.c |
649 |
++++ b/drivers/ata/libahci_platform.c |
650 |
+@@ -46,7 +46,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_ops); |
651 |
+ * RETURNS: |
652 |
+ * 0 on success otherwise a negative error code |
653 |
+ */ |
654 |
+-static int ahci_platform_enable_phys(struct ahci_host_priv *hpriv) |
655 |
++int ahci_platform_enable_phys(struct ahci_host_priv *hpriv) |
656 |
+ { |
657 |
+ int rc, i; |
658 |
+ |
659 |
+@@ -71,6 +71,7 @@ disable_phys: |
660 |
+ } |
661 |
+ return rc; |
662 |
+ } |
663 |
++EXPORT_SYMBOL_GPL(ahci_platform_enable_phys); |
664 |
+ |
665 |
+ /** |
666 |
+ * ahci_platform_disable_phys - Disable PHYs |
667 |
+@@ -78,7 +79,7 @@ disable_phys: |
668 |
+ * |
669 |
+ * This function disables all PHYs found in hpriv->phys. |
670 |
+ */ |
671 |
+-static void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) |
672 |
++void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) |
673 |
+ { |
674 |
+ int i; |
675 |
+ |
676 |
+@@ -87,6 +88,7 @@ static void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) |
677 |
+ phy_exit(hpriv->phys[i]); |
678 |
+ } |
679 |
+ } |
680 |
++EXPORT_SYMBOL_GPL(ahci_platform_disable_phys); |
681 |
+ |
682 |
+ /** |
683 |
+ * ahci_platform_enable_clks - Enable platform clocks |
684 |
+diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c |
685 |
+index 987d665e82de..c1d1b94f71b5 100644 |
686 |
+--- a/drivers/block/xen-blkback/blkback.c |
687 |
++++ b/drivers/block/xen-blkback/blkback.c |
688 |
+@@ -929,6 +929,8 @@ next: |
689 |
+ out_of_memory: |
690 |
+ pr_alert("%s: out of memory\n", __func__); |
691 |
+ put_free_pages(ring, pages_to_gnt, segs_to_map); |
692 |
++ for (i = last_map; i < num; i++) |
693 |
++ pages[i]->handle = BLKBACK_INVALID_HANDLE; |
694 |
+ return -ENOMEM; |
695 |
+ } |
696 |
+ |
697 |
+diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c |
698 |
+index ed4e80779124..e9fa4a1fc791 100644 |
699 |
+--- a/drivers/block/xen-blkback/xenbus.c |
700 |
++++ b/drivers/block/xen-blkback/xenbus.c |
701 |
+@@ -178,6 +178,15 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) |
702 |
+ blkif->domid = domid; |
703 |
+ atomic_set(&blkif->refcnt, 1); |
704 |
+ init_completion(&blkif->drain_complete); |
705 |
++ |
706 |
++ /* |
707 |
++ * Because freeing back to the cache may be deferred, it is not |
708 |
++ * safe to unload the module (and hence destroy the cache) until |
709 |
++ * this has completed. To prevent premature unloading, take an |
710 |
++ * extra module reference here and release only when the object |
711 |
++ * has been freed back to the cache. |
712 |
++ */ |
713 |
++ __module_get(THIS_MODULE); |
714 |
+ INIT_WORK(&blkif->free_work, xen_blkif_deferred_free); |
715 |
+ |
716 |
+ return blkif; |
717 |
+@@ -327,6 +336,7 @@ static void xen_blkif_free(struct xen_blkif *blkif) |
718 |
+ |
719 |
+ /* Make sure everything is drained before shutting down */ |
720 |
+ kmem_cache_free(xen_blkif_cachep, blkif); |
721 |
++ module_put(THIS_MODULE); |
722 |
+ } |
723 |
+ |
724 |
+ int __init xen_blkif_interface_init(void) |
725 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
726 |
+index 73561bfd95d4..424f399cc79b 100644 |
727 |
+--- a/drivers/bluetooth/btusb.c |
728 |
++++ b/drivers/bluetooth/btusb.c |
729 |
+@@ -1123,7 +1123,7 @@ static int btusb_open(struct hci_dev *hdev) |
730 |
+ if (data->setup_on_usb) { |
731 |
+ err = data->setup_on_usb(hdev); |
732 |
+ if (err < 0) |
733 |
+- return err; |
734 |
++ goto setup_fail; |
735 |
+ } |
736 |
+ |
737 |
+ data->intf->needs_remote_wakeup = 1; |
738 |
+@@ -1155,6 +1155,7 @@ done: |
739 |
+ |
740 |
+ failed: |
741 |
+ clear_bit(BTUSB_INTR_RUNNING, &data->flags); |
742 |
++setup_fail: |
743 |
+ usb_autopm_put_interface(data->intf); |
744 |
+ return err; |
745 |
+ } |
746 |
+diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c |
747 |
+index dc9c0032c97b..ad18de955b6c 100644 |
748 |
+--- a/drivers/devfreq/devfreq.c |
749 |
++++ b/drivers/devfreq/devfreq.c |
750 |
+@@ -484,11 +484,6 @@ static void devfreq_dev_release(struct device *dev) |
751 |
+ struct devfreq *devfreq = to_devfreq(dev); |
752 |
+ |
753 |
+ mutex_lock(&devfreq_list_lock); |
754 |
+- if (IS_ERR(find_device_devfreq(devfreq->dev.parent))) { |
755 |
+- mutex_unlock(&devfreq_list_lock); |
756 |
+- dev_warn(&devfreq->dev, "releasing devfreq which doesn't exist\n"); |
757 |
+- return; |
758 |
+- } |
759 |
+ list_del(&devfreq->node); |
760 |
+ mutex_unlock(&devfreq_list_lock); |
761 |
+ |
762 |
+@@ -547,6 +542,7 @@ struct devfreq *devfreq_add_device(struct device *dev, |
763 |
+ devfreq->dev.parent = dev; |
764 |
+ devfreq->dev.class = devfreq_class; |
765 |
+ devfreq->dev.release = devfreq_dev_release; |
766 |
++ INIT_LIST_HEAD(&devfreq->node); |
767 |
+ devfreq->profile = profile; |
768 |
+ strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); |
769 |
+ devfreq->previous_freq = profile->initial_freq; |
770 |
+@@ -978,7 +974,7 @@ static ssize_t available_governors_show(struct device *d, |
771 |
+ * The devfreq with immutable governor (e.g., passive) shows |
772 |
+ * only own governor. |
773 |
+ */ |
774 |
+- if (df->governor->immutable) { |
775 |
++ if (df->governor && df->governor->immutable) { |
776 |
+ count = scnprintf(&buf[count], DEVFREQ_NAME_LEN, |
777 |
+ "%s ", df->governor_name); |
778 |
+ /* |
779 |
+diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c |
780 |
+index 242359c2d1f1..215f4f71b943 100644 |
781 |
+--- a/drivers/firewire/net.c |
782 |
++++ b/drivers/firewire/net.c |
783 |
+@@ -249,7 +249,11 @@ static int fwnet_header_cache(const struct neighbour *neigh, |
784 |
+ h = (struct fwnet_header *)((u8 *)hh->hh_data + HH_DATA_OFF(sizeof(*h))); |
785 |
+ h->h_proto = type; |
786 |
+ memcpy(h->h_dest, neigh->ha, net->addr_len); |
787 |
+- hh->hh_len = FWNET_HLEN; |
788 |
++ |
789 |
++ /* Pairs with the READ_ONCE() in neigh_resolve_output(), |
790 |
++ * neigh_hh_output() and neigh_update_hhs(). |
791 |
++ */ |
792 |
++ smp_store_release(&hh->hh_len, FWNET_HLEN); |
793 |
+ |
794 |
+ return 0; |
795 |
+ } |
796 |
+diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c |
797 |
+index c7f5f0be2d74..2b75aab8b3a0 100644 |
798 |
+--- a/drivers/gpio/gpiolib.c |
799 |
++++ b/drivers/gpio/gpiolib.c |
800 |
+@@ -206,6 +206,14 @@ int gpiod_get_direction(struct gpio_desc *desc) |
801 |
+ chip = gpiod_to_chip(desc); |
802 |
+ offset = gpio_chip_hwgpio(desc); |
803 |
+ |
804 |
++ /* |
805 |
++ * Open drain emulation using input mode may incorrectly report |
806 |
++ * input here, fix that up. |
807 |
++ */ |
808 |
++ if (test_bit(FLAG_OPEN_DRAIN, &desc->flags) && |
809 |
++ test_bit(FLAG_IS_OUT, &desc->flags)) |
810 |
++ return 0; |
811 |
++ |
812 |
+ if (!chip->get_direction) |
813 |
+ return status; |
814 |
+ |
815 |
+diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
816 |
+index bb9a9852ec22..ef86721c06f3 100644 |
817 |
+--- a/drivers/gpu/drm/drm_dp_mst_topology.c |
818 |
++++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
819 |
+@@ -1540,7 +1540,11 @@ static void process_single_up_tx_qlock(struct drm_dp_mst_topology_mgr *mgr, |
820 |
+ if (ret != 1) |
821 |
+ DRM_DEBUG_KMS("failed to send msg in q %d\n", ret); |
822 |
+ |
823 |
+- txmsg->dst->tx_slots[txmsg->seqno] = NULL; |
824 |
++ if (txmsg->seqno != -1) { |
825 |
++ WARN_ON((unsigned int)txmsg->seqno > |
826 |
++ ARRAY_SIZE(txmsg->dst->tx_slots)); |
827 |
++ txmsg->dst->tx_slots[txmsg->seqno] = NULL; |
828 |
++ } |
829 |
+ } |
830 |
+ |
831 |
+ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr, |
832 |
+diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c |
833 |
+index 78e630771214..9decd981d94e 100644 |
834 |
+--- a/drivers/gpu/drm/drm_property.c |
835 |
++++ b/drivers/gpu/drm/drm_property.c |
836 |
+@@ -540,7 +540,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length, |
837 |
+ struct drm_property_blob *blob; |
838 |
+ int ret; |
839 |
+ |
840 |
+- if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob)) |
841 |
++ if (!length || length > INT_MAX - sizeof(struct drm_property_blob)) |
842 |
+ return ERR_PTR(-EINVAL); |
843 |
+ |
844 |
+ blob = kvzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL); |
845 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h |
846 |
+index dc7454e7f19a..b46e99f7641e 100644 |
847 |
+--- a/drivers/gpu/drm/nouveau/nouveau_connector.h |
848 |
++++ b/drivers/gpu/drm/nouveau/nouveau_connector.h |
849 |
+@@ -29,6 +29,7 @@ |
850 |
+ |
851 |
+ #include <nvif/notify.h> |
852 |
+ |
853 |
++#include <drm/drm_crtc.h> |
854 |
+ #include <drm/drm_edid.h> |
855 |
+ #include <drm/drm_encoder.h> |
856 |
+ #include <drm/drm_dp_helper.h> |
857 |
+@@ -37,6 +38,60 @@ |
858 |
+ |
859 |
+ struct nvkm_i2c_port; |
860 |
+ |
861 |
++#define nouveau_conn_atom(p) \ |
862 |
++ container_of((p), struct nouveau_conn_atom, state) |
863 |
++ |
864 |
++struct nouveau_conn_atom { |
865 |
++ struct drm_connector_state state; |
866 |
++ |
867 |
++ struct { |
868 |
++ /* The enum values specifically defined here match nv50/gf119 |
869 |
++ * hw values, and the code relies on this. |
870 |
++ */ |
871 |
++ enum { |
872 |
++ DITHERING_MODE_OFF = 0x00, |
873 |
++ DITHERING_MODE_ON = 0x01, |
874 |
++ DITHERING_MODE_DYNAMIC2X2 = 0x10 | DITHERING_MODE_ON, |
875 |
++ DITHERING_MODE_STATIC2X2 = 0x18 | DITHERING_MODE_ON, |
876 |
++ DITHERING_MODE_TEMPORAL = 0x20 | DITHERING_MODE_ON, |
877 |
++ DITHERING_MODE_AUTO |
878 |
++ } mode; |
879 |
++ enum { |
880 |
++ DITHERING_DEPTH_6BPC = 0x00, |
881 |
++ DITHERING_DEPTH_8BPC = 0x02, |
882 |
++ DITHERING_DEPTH_AUTO |
883 |
++ } depth; |
884 |
++ } dither; |
885 |
++ |
886 |
++ struct { |
887 |
++ int mode; /* DRM_MODE_SCALE_* */ |
888 |
++ struct { |
889 |
++ enum { |
890 |
++ UNDERSCAN_OFF, |
891 |
++ UNDERSCAN_ON, |
892 |
++ UNDERSCAN_AUTO, |
893 |
++ } mode; |
894 |
++ u32 hborder; |
895 |
++ u32 vborder; |
896 |
++ } underscan; |
897 |
++ bool full; |
898 |
++ } scaler; |
899 |
++ |
900 |
++ struct { |
901 |
++ int color_vibrance; |
902 |
++ int vibrant_hue; |
903 |
++ } procamp; |
904 |
++ |
905 |
++ union { |
906 |
++ struct { |
907 |
++ bool dither:1; |
908 |
++ bool scaler:1; |
909 |
++ bool procamp:1; |
910 |
++ }; |
911 |
++ u8 mask; |
912 |
++ } set; |
913 |
++}; |
914 |
++ |
915 |
+ struct nouveau_connector { |
916 |
+ struct drm_connector base; |
917 |
+ enum dcb_connector_type type; |
918 |
+@@ -111,61 +166,6 @@ extern int nouveau_ignorelid; |
919 |
+ extern int nouveau_duallink; |
920 |
+ extern int nouveau_hdmimhz; |
921 |
+ |
922 |
+-#include <drm/drm_crtc.h> |
923 |
+-#define nouveau_conn_atom(p) \ |
924 |
+- container_of((p), struct nouveau_conn_atom, state) |
925 |
+- |
926 |
+-struct nouveau_conn_atom { |
927 |
+- struct drm_connector_state state; |
928 |
+- |
929 |
+- struct { |
930 |
+- /* The enum values specifically defined here match nv50/gf119 |
931 |
+- * hw values, and the code relies on this. |
932 |
+- */ |
933 |
+- enum { |
934 |
+- DITHERING_MODE_OFF = 0x00, |
935 |
+- DITHERING_MODE_ON = 0x01, |
936 |
+- DITHERING_MODE_DYNAMIC2X2 = 0x10 | DITHERING_MODE_ON, |
937 |
+- DITHERING_MODE_STATIC2X2 = 0x18 | DITHERING_MODE_ON, |
938 |
+- DITHERING_MODE_TEMPORAL = 0x20 | DITHERING_MODE_ON, |
939 |
+- DITHERING_MODE_AUTO |
940 |
+- } mode; |
941 |
+- enum { |
942 |
+- DITHERING_DEPTH_6BPC = 0x00, |
943 |
+- DITHERING_DEPTH_8BPC = 0x02, |
944 |
+- DITHERING_DEPTH_AUTO |
945 |
+- } depth; |
946 |
+- } dither; |
947 |
+- |
948 |
+- struct { |
949 |
+- int mode; /* DRM_MODE_SCALE_* */ |
950 |
+- struct { |
951 |
+- enum { |
952 |
+- UNDERSCAN_OFF, |
953 |
+- UNDERSCAN_ON, |
954 |
+- UNDERSCAN_AUTO, |
955 |
+- } mode; |
956 |
+- u32 hborder; |
957 |
+- u32 vborder; |
958 |
+- } underscan; |
959 |
+- bool full; |
960 |
+- } scaler; |
961 |
+- |
962 |
+- struct { |
963 |
+- int color_vibrance; |
964 |
+- int vibrant_hue; |
965 |
+- } procamp; |
966 |
+- |
967 |
+- union { |
968 |
+- struct { |
969 |
+- bool dither:1; |
970 |
+- bool scaler:1; |
971 |
+- bool procamp:1; |
972 |
+- }; |
973 |
+- u8 mask; |
974 |
+- } set; |
975 |
+-}; |
976 |
+- |
977 |
+ void nouveau_conn_attach_properties(struct drm_connector *); |
978 |
+ void nouveau_conn_reset(struct drm_connector *); |
979 |
+ struct drm_connector_state * |
980 |
+diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c |
981 |
+index 3cf1a6932fac..298d6a8bab12 100644 |
982 |
+--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c |
983 |
++++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c |
984 |
+@@ -438,8 +438,6 @@ static void sun4i_hdmi_unbind(struct device *dev, struct device *master, |
985 |
+ struct sun4i_hdmi *hdmi = dev_get_drvdata(dev); |
986 |
+ |
987 |
+ cec_unregister_adapter(hdmi->cec_adap); |
988 |
+- drm_connector_cleanup(&hdmi->connector); |
989 |
+- drm_encoder_cleanup(&hdmi->encoder); |
990 |
+ i2c_del_adapter(hdmi->i2c); |
991 |
+ clk_disable_unprepare(hdmi->mod_clk); |
992 |
+ clk_disable_unprepare(hdmi->bus_clk); |
993 |
+diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c |
994 |
+index 33be07c78b96..8649a61c50bc 100644 |
995 |
+--- a/drivers/iio/adc/max9611.c |
996 |
++++ b/drivers/iio/adc/max9611.c |
997 |
+@@ -92,6 +92,12 @@ |
998 |
+ #define MAX9611_TEMP_SCALE_NUM 1000000 |
999 |
+ #define MAX9611_TEMP_SCALE_DIV 2083 |
1000 |
+ |
1001 |
++/* |
1002 |
++ * Conversion time is 2 ms (typically) at Ta=25 degreeC |
1003 |
++ * No maximum value is known, so play it safe. |
1004 |
++ */ |
1005 |
++#define MAX9611_CONV_TIME_US_RANGE 3000, 3300 |
1006 |
++ |
1007 |
+ struct max9611_dev { |
1008 |
+ struct device *dev; |
1009 |
+ struct i2c_client *i2c_client; |
1010 |
+@@ -239,11 +245,9 @@ static int max9611_read_single(struct max9611_dev *max9611, |
1011 |
+ return ret; |
1012 |
+ } |
1013 |
+ |
1014 |
+- /* |
1015 |
+- * need a delay here to make register configuration |
1016 |
+- * stabilize. 1 msec at least, from empirical testing. |
1017 |
+- */ |
1018 |
+- usleep_range(1000, 2000); |
1019 |
++ /* need a delay here to make register configuration stabilize. */ |
1020 |
++ |
1021 |
++ usleep_range(MAX9611_CONV_TIME_US_RANGE); |
1022 |
+ |
1023 |
+ ret = i2c_smbus_read_word_swapped(max9611->i2c_client, reg_addr); |
1024 |
+ if (ret < 0) { |
1025 |
+@@ -511,7 +515,7 @@ static int max9611_init(struct max9611_dev *max9611) |
1026 |
+ MAX9611_REG_CTRL2, 0); |
1027 |
+ return ret; |
1028 |
+ } |
1029 |
+- usleep_range(1000, 2000); |
1030 |
++ usleep_range(MAX9611_CONV_TIME_US_RANGE); |
1031 |
+ |
1032 |
+ return 0; |
1033 |
+ } |
1034 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
1035 |
+index f698c6a28c14..fc4630e4acdd 100644 |
1036 |
+--- a/drivers/infiniband/core/cma.c |
1037 |
++++ b/drivers/infiniband/core/cma.c |
1038 |
+@@ -4568,6 +4568,7 @@ err: |
1039 |
+ unregister_netdevice_notifier(&cma_nb); |
1040 |
+ rdma_addr_unregister_client(&addr_client); |
1041 |
+ ib_sa_unregister_client(&sa_client); |
1042 |
++ unregister_pernet_subsys(&cma_pernet_operations); |
1043 |
+ err_wq: |
1044 |
+ destroy_workqueue(cma_wq); |
1045 |
+ return ret; |
1046 |
+diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c |
1047 |
+index 0299c0642de8..7e73a1a6cb67 100644 |
1048 |
+--- a/drivers/infiniband/hw/mlx4/main.c |
1049 |
++++ b/drivers/infiniband/hw/mlx4/main.c |
1050 |
+@@ -3073,16 +3073,17 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr) |
1051 |
+ ibdev->ib_active = false; |
1052 |
+ flush_workqueue(wq); |
1053 |
+ |
1054 |
+- mlx4_ib_close_sriov(ibdev); |
1055 |
+- mlx4_ib_mad_cleanup(ibdev); |
1056 |
+- ib_unregister_device(&ibdev->ib_dev); |
1057 |
+- mlx4_ib_diag_cleanup(ibdev); |
1058 |
+ if (ibdev->iboe.nb.notifier_call) { |
1059 |
+ if (unregister_netdevice_notifier(&ibdev->iboe.nb)) |
1060 |
+ pr_warn("failure unregistering notifier\n"); |
1061 |
+ ibdev->iboe.nb.notifier_call = NULL; |
1062 |
+ } |
1063 |
+ |
1064 |
++ mlx4_ib_close_sriov(ibdev); |
1065 |
++ mlx4_ib_mad_cleanup(ibdev); |
1066 |
++ ib_unregister_device(&ibdev->ib_dev); |
1067 |
++ mlx4_ib_diag_cleanup(ibdev); |
1068 |
++ |
1069 |
+ mlx4_qp_release_range(dev, ibdev->steer_qpn_base, |
1070 |
+ ibdev->steer_qpn_count); |
1071 |
+ kfree(ibdev->ib_uc_qpns_bitmap); |
1072 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c |
1073 |
+index 83412df726a5..b7098f7bb30e 100644 |
1074 |
+--- a/drivers/infiniband/sw/rxe/rxe_recv.c |
1075 |
++++ b/drivers/infiniband/sw/rxe/rxe_recv.c |
1076 |
+@@ -393,7 +393,7 @@ int rxe_rcv(struct sk_buff *skb) |
1077 |
+ |
1078 |
+ calc_icrc = rxe_icrc_hdr(pkt, skb); |
1079 |
+ calc_icrc = rxe_crc32(rxe, calc_icrc, (u8 *)payload_addr(pkt), |
1080 |
+- payload_size(pkt)); |
1081 |
++ payload_size(pkt) + bth_pad(pkt)); |
1082 |
+ calc_icrc = (__force u32)cpu_to_be32(~calc_icrc); |
1083 |
+ if (unlikely(calc_icrc != pack_icrc)) { |
1084 |
+ if (skb->protocol == htons(ETH_P_IPV6)) |
1085 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c |
1086 |
+index 9fd4f04df3b3..e6785b1ea85f 100644 |
1087 |
+--- a/drivers/infiniband/sw/rxe/rxe_req.c |
1088 |
++++ b/drivers/infiniband/sw/rxe/rxe_req.c |
1089 |
+@@ -500,6 +500,12 @@ static int fill_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe, |
1090 |
+ if (err) |
1091 |
+ return err; |
1092 |
+ } |
1093 |
++ if (bth_pad(pkt)) { |
1094 |
++ u8 *pad = payload_addr(pkt) + paylen; |
1095 |
++ |
1096 |
++ memset(pad, 0, bth_pad(pkt)); |
1097 |
++ crc = rxe_crc32(rxe, crc, pad, bth_pad(pkt)); |
1098 |
++ } |
1099 |
+ } |
1100 |
+ p = payload_addr(pkt) + paylen + bth_pad(pkt); |
1101 |
+ |
1102 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c |
1103 |
+index 9207682b7a2e..a07a29b48863 100644 |
1104 |
+--- a/drivers/infiniband/sw/rxe/rxe_resp.c |
1105 |
++++ b/drivers/infiniband/sw/rxe/rxe_resp.c |
1106 |
+@@ -738,6 +738,13 @@ static enum resp_states read_reply(struct rxe_qp *qp, |
1107 |
+ if (err) |
1108 |
+ pr_err("Failed copying memory\n"); |
1109 |
+ |
1110 |
++ if (bth_pad(&ack_pkt)) { |
1111 |
++ struct rxe_dev *rxe = to_rdev(qp->ibqp.device); |
1112 |
++ u8 *pad = payload_addr(&ack_pkt) + payload; |
1113 |
++ |
1114 |
++ memset(pad, 0, bth_pad(&ack_pkt)); |
1115 |
++ icrc = rxe_crc32(rxe, icrc, pad, bth_pad(&ack_pkt)); |
1116 |
++ } |
1117 |
+ p = payload_addr(&ack_pkt) + payload + bth_pad(&ack_pkt); |
1118 |
+ *p = ~icrc; |
1119 |
+ |
1120 |
+diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c |
1121 |
+index f46ac9db9edb..0a9d623b13c2 100644 |
1122 |
+--- a/drivers/md/raid1.c |
1123 |
++++ b/drivers/md/raid1.c |
1124 |
+@@ -2749,7 +2749,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, |
1125 |
+ write_targets++; |
1126 |
+ } |
1127 |
+ } |
1128 |
+- if (bio->bi_end_io) { |
1129 |
++ if (rdev && bio->bi_end_io) { |
1130 |
+ atomic_inc(&rdev->nr_pending); |
1131 |
+ bio->bi_iter.bi_sector = sector_nr + rdev->data_offset; |
1132 |
+ bio_set_dev(bio, rdev->bdev); |
1133 |
+diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c |
1134 |
+index 27e57915eb4d..0d7d687aeea0 100644 |
1135 |
+--- a/drivers/media/cec/cec-adap.c |
1136 |
++++ b/drivers/media/cec/cec-adap.c |
1137 |
+@@ -330,7 +330,8 @@ static void cec_data_cancel(struct cec_data *data) |
1138 |
+ } else { |
1139 |
+ list_del_init(&data->list); |
1140 |
+ if (!(data->msg.tx_status & CEC_TX_STATUS_OK)) |
1141 |
+- data->adap->transmit_queue_sz--; |
1142 |
++ if (!WARN_ON(!data->adap->transmit_queue_sz)) |
1143 |
++ data->adap->transmit_queue_sz--; |
1144 |
+ } |
1145 |
+ |
1146 |
+ /* Mark it as an error */ |
1147 |
+@@ -377,6 +378,14 @@ static void cec_flush(struct cec_adapter *adap) |
1148 |
+ * need to do anything special in that case. |
1149 |
+ */ |
1150 |
+ } |
1151 |
++ /* |
1152 |
++ * If something went wrong and this counter isn't what it should |
1153 |
++ * be, then this will reset it back to 0. Warn if it is not 0, |
1154 |
++ * since it indicates a bug, either in this framework or in a |
1155 |
++ * CEC driver. |
1156 |
++ */ |
1157 |
++ if (WARN_ON(adap->transmit_queue_sz)) |
1158 |
++ adap->transmit_queue_sz = 0; |
1159 |
+ } |
1160 |
+ |
1161 |
+ /* |
1162 |
+@@ -465,7 +474,8 @@ int cec_thread_func(void *_adap) |
1163 |
+ data = list_first_entry(&adap->transmit_queue, |
1164 |
+ struct cec_data, list); |
1165 |
+ list_del_init(&data->list); |
1166 |
+- adap->transmit_queue_sz--; |
1167 |
++ if (!WARN_ON(!data->adap->transmit_queue_sz)) |
1168 |
++ adap->transmit_queue_sz--; |
1169 |
+ |
1170 |
+ /* Make this the current transmitting message */ |
1171 |
+ adap->transmitting = data; |
1172 |
+@@ -1031,11 +1041,11 @@ void cec_received_msg_ts(struct cec_adapter *adap, |
1173 |
+ valid_la = false; |
1174 |
+ else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) |
1175 |
+ valid_la = false; |
1176 |
+- else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST1_4)) |
1177 |
++ else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST)) |
1178 |
+ valid_la = false; |
1179 |
+ else if (cec_msg_is_broadcast(msg) && |
1180 |
+- adap->log_addrs.cec_version >= CEC_OP_CEC_VERSION_2_0 && |
1181 |
+- !(dir_fl & BCAST2_0)) |
1182 |
++ adap->log_addrs.cec_version < CEC_OP_CEC_VERSION_2_0 && |
1183 |
++ !(dir_fl & BCAST1_4)) |
1184 |
+ valid_la = false; |
1185 |
+ } |
1186 |
+ if (valid_la && min_len) { |
1187 |
+diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c |
1188 |
+index f1807c16438d..427cda457af6 100644 |
1189 |
+--- a/drivers/media/usb/b2c2/flexcop-usb.c |
1190 |
++++ b/drivers/media/usb/b2c2/flexcop-usb.c |
1191 |
+@@ -294,7 +294,7 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, |
1192 |
+ |
1193 |
+ mutex_unlock(&fc_usb->data_mutex); |
1194 |
+ |
1195 |
+- return 0; |
1196 |
++ return ret; |
1197 |
+ } |
1198 |
+ |
1199 |
+ /* actual bus specific access functions, |
1200 |
+diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c |
1201 |
+index 986763b1b2b3..c047a0bdf91f 100644 |
1202 |
+--- a/drivers/media/usb/dvb-usb/af9005.c |
1203 |
++++ b/drivers/media/usb/dvb-usb/af9005.c |
1204 |
+@@ -985,8 +985,9 @@ static int af9005_identify_state(struct usb_device *udev, |
1205 |
+ else if (reply == 0x02) |
1206 |
+ *cold = 0; |
1207 |
+ else |
1208 |
+- return -EIO; |
1209 |
+- deb_info("Identify state cold = %d\n", *cold); |
1210 |
++ ret = -EIO; |
1211 |
++ if (!ret) |
1212 |
++ deb_info("Identify state cold = %d\n", *cold); |
1213 |
+ |
1214 |
+ err: |
1215 |
+ kfree(buf); |
1216 |
+diff --git a/drivers/media/usb/pulse8-cec/pulse8-cec.c b/drivers/media/usb/pulse8-cec/pulse8-cec.c |
1217 |
+index 12da631c0fda..f1615fb60015 100644 |
1218 |
+--- a/drivers/media/usb/pulse8-cec/pulse8-cec.c |
1219 |
++++ b/drivers/media/usb/pulse8-cec/pulse8-cec.c |
1220 |
+@@ -121,6 +121,7 @@ struct pulse8 { |
1221 |
+ unsigned int vers; |
1222 |
+ struct completion cmd_done; |
1223 |
+ struct work_struct work; |
1224 |
++ u8 work_result; |
1225 |
+ struct delayed_work ping_eeprom_work; |
1226 |
+ struct cec_msg rx_msg; |
1227 |
+ u8 data[DATA_SIZE]; |
1228 |
+@@ -142,8 +143,10 @@ static void pulse8_irq_work_handler(struct work_struct *work) |
1229 |
+ { |
1230 |
+ struct pulse8 *pulse8 = |
1231 |
+ container_of(work, struct pulse8, work); |
1232 |
++ u8 result = pulse8->work_result; |
1233 |
+ |
1234 |
+- switch (pulse8->data[0] & 0x3f) { |
1235 |
++ pulse8->work_result = 0; |
1236 |
++ switch (result & 0x3f) { |
1237 |
+ case MSGCODE_FRAME_DATA: |
1238 |
+ cec_received_msg(pulse8->adap, &pulse8->rx_msg); |
1239 |
+ break; |
1240 |
+@@ -177,12 +180,12 @@ static irqreturn_t pulse8_interrupt(struct serio *serio, unsigned char data, |
1241 |
+ pulse8->escape = false; |
1242 |
+ } else if (data == MSGEND) { |
1243 |
+ struct cec_msg *msg = &pulse8->rx_msg; |
1244 |
++ u8 msgcode = pulse8->buf[0]; |
1245 |
+ |
1246 |
+ if (debug) |
1247 |
+ dev_info(pulse8->dev, "received: %*ph\n", |
1248 |
+ pulse8->idx, pulse8->buf); |
1249 |
+- pulse8->data[0] = pulse8->buf[0]; |
1250 |
+- switch (pulse8->buf[0] & 0x3f) { |
1251 |
++ switch (msgcode & 0x3f) { |
1252 |
+ case MSGCODE_FRAME_START: |
1253 |
+ msg->len = 1; |
1254 |
+ msg->msg[0] = pulse8->buf[1]; |
1255 |
+@@ -191,14 +194,20 @@ static irqreturn_t pulse8_interrupt(struct serio *serio, unsigned char data, |
1256 |
+ if (msg->len == CEC_MAX_MSG_SIZE) |
1257 |
+ break; |
1258 |
+ msg->msg[msg->len++] = pulse8->buf[1]; |
1259 |
+- if (pulse8->buf[0] & MSGCODE_FRAME_EOM) |
1260 |
++ if (msgcode & MSGCODE_FRAME_EOM) { |
1261 |
++ WARN_ON(pulse8->work_result); |
1262 |
++ pulse8->work_result = msgcode; |
1263 |
+ schedule_work(&pulse8->work); |
1264 |
++ break; |
1265 |
++ } |
1266 |
+ break; |
1267 |
+ case MSGCODE_TRANSMIT_SUCCEEDED: |
1268 |
+ case MSGCODE_TRANSMIT_FAILED_LINE: |
1269 |
+ case MSGCODE_TRANSMIT_FAILED_ACK: |
1270 |
+ case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA: |
1271 |
+ case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: |
1272 |
++ WARN_ON(pulse8->work_result); |
1273 |
++ pulse8->work_result = msgcode; |
1274 |
+ schedule_work(&pulse8->work); |
1275 |
+ break; |
1276 |
+ case MSGCODE_HIGH_ERROR: |
1277 |
+diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |
1278 |
+index b38a586ea59a..4748f557c753 100644 |
1279 |
+--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |
1280 |
++++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |
1281 |
+@@ -973,6 +973,8 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, |
1282 |
+ struct ath_htc_rx_status *rxstatus; |
1283 |
+ struct ath_rx_status rx_stats; |
1284 |
+ bool decrypt_error = false; |
1285 |
++ __be16 rs_datalen; |
1286 |
++ bool is_phyerr; |
1287 |
+ |
1288 |
+ if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { |
1289 |
+ ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", |
1290 |
+@@ -982,11 +984,24 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, |
1291 |
+ |
1292 |
+ rxstatus = (struct ath_htc_rx_status *)skb->data; |
1293 |
+ |
1294 |
+- if (be16_to_cpu(rxstatus->rs_datalen) - |
1295 |
+- (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0) { |
1296 |
++ rs_datalen = be16_to_cpu(rxstatus->rs_datalen); |
1297 |
++ if (unlikely(rs_datalen - |
1298 |
++ (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0)) { |
1299 |
+ ath_err(common, |
1300 |
+ "Corrupted RX data len, dropping (dlen: %d, skblen: %d)\n", |
1301 |
+- rxstatus->rs_datalen, skb->len); |
1302 |
++ rs_datalen, skb->len); |
1303 |
++ goto rx_next; |
1304 |
++ } |
1305 |
++ |
1306 |
++ is_phyerr = rxstatus->rs_status & ATH9K_RXERR_PHY; |
1307 |
++ /* |
1308 |
++ * Discard zero-length packets and packets smaller than an ACK |
1309 |
++ * which are not PHY_ERROR (short radar pulses have a length of 3) |
1310 |
++ */ |
1311 |
++ if (unlikely(!rs_datalen || (rs_datalen < 10 && !is_phyerr))) { |
1312 |
++ ath_warn(common, |
1313 |
++ "Short RX data len, dropping (dlen: %d)\n", |
1314 |
++ rs_datalen); |
1315 |
+ goto rx_next; |
1316 |
+ } |
1317 |
+ |
1318 |
+@@ -1011,7 +1026,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, |
1319 |
+ * Process PHY errors and return so that the packet |
1320 |
+ * can be dropped. |
1321 |
+ */ |
1322 |
+- if (rx_stats.rs_status & ATH9K_RXERR_PHY) { |
1323 |
++ if (unlikely(is_phyerr)) { |
1324 |
+ /* TODO: Not using DFS processing now. */ |
1325 |
+ if (ath_cmn_process_fft(&priv->spec_priv, hdr, |
1326 |
+ &rx_stats, rx_status->mactime)) { |
1327 |
+diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c |
1328 |
+index 058d542647dd..9e4d2ecf736d 100644 |
1329 |
+--- a/drivers/nvme/host/fc.c |
1330 |
++++ b/drivers/nvme/host/fc.c |
1331 |
+@@ -337,7 +337,8 @@ nvme_fc_register_localport(struct nvme_fc_port_info *pinfo, |
1332 |
+ !template->ls_req || !template->fcp_io || |
1333 |
+ !template->ls_abort || !template->fcp_abort || |
1334 |
+ !template->max_hw_queues || !template->max_sgl_segments || |
1335 |
+- !template->max_dif_sgl_segments || !template->dma_boundary) { |
1336 |
++ !template->max_dif_sgl_segments || !template->dma_boundary || |
1337 |
++ !template->module) { |
1338 |
+ ret = -EINVAL; |
1339 |
+ goto out_reghost_failed; |
1340 |
+ } |
1341 |
+@@ -1762,6 +1763,7 @@ nvme_fc_ctrl_free(struct kref *ref) |
1342 |
+ { |
1343 |
+ struct nvme_fc_ctrl *ctrl = |
1344 |
+ container_of(ref, struct nvme_fc_ctrl, ref); |
1345 |
++ struct nvme_fc_lport *lport = ctrl->lport; |
1346 |
+ unsigned long flags; |
1347 |
+ |
1348 |
+ if (ctrl->ctrl.tagset) { |
1349 |
+@@ -1787,6 +1789,7 @@ nvme_fc_ctrl_free(struct kref *ref) |
1350 |
+ if (ctrl->ctrl.opts) |
1351 |
+ nvmf_free_options(ctrl->ctrl.opts); |
1352 |
+ kfree(ctrl); |
1353 |
++ module_put(lport->ops->module); |
1354 |
+ } |
1355 |
+ |
1356 |
+ static void |
1357 |
+@@ -2765,10 +2768,15 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, |
1358 |
+ goto out_fail; |
1359 |
+ } |
1360 |
+ |
1361 |
++ if (!try_module_get(lport->ops->module)) { |
1362 |
++ ret = -EUNATCH; |
1363 |
++ goto out_free_ctrl; |
1364 |
++ } |
1365 |
++ |
1366 |
+ idx = ida_simple_get(&nvme_fc_ctrl_cnt, 0, 0, GFP_KERNEL); |
1367 |
+ if (idx < 0) { |
1368 |
+ ret = -ENOSPC; |
1369 |
+- goto out_free_ctrl; |
1370 |
++ goto out_mod_put; |
1371 |
+ } |
1372 |
+ |
1373 |
+ ctrl->ctrl.opts = opts; |
1374 |
+@@ -2915,6 +2923,8 @@ out_free_queues: |
1375 |
+ out_free_ida: |
1376 |
+ put_device(ctrl->dev); |
1377 |
+ ida_simple_remove(&nvme_fc_ctrl_cnt, ctrl->cnum); |
1378 |
++out_mod_put: |
1379 |
++ module_put(lport->ops->module); |
1380 |
+ out_free_ctrl: |
1381 |
+ kfree(ctrl); |
1382 |
+ out_fail: |
1383 |
+diff --git a/drivers/nvme/target/fcloop.c b/drivers/nvme/target/fcloop.c |
1384 |
+index 096523d8dd42..b8fe8702065b 100644 |
1385 |
+--- a/drivers/nvme/target/fcloop.c |
1386 |
++++ b/drivers/nvme/target/fcloop.c |
1387 |
+@@ -693,6 +693,7 @@ fcloop_targetport_delete(struct nvmet_fc_target_port *targetport) |
1388 |
+ #define FCLOOP_DMABOUND_4G 0xFFFFFFFF |
1389 |
+ |
1390 |
+ static struct nvme_fc_port_template fctemplate = { |
1391 |
++ .module = THIS_MODULE, |
1392 |
+ .localport_delete = fcloop_localport_delete, |
1393 |
+ .remoteport_delete = fcloop_remoteport_delete, |
1394 |
+ .create_queue = fcloop_create_queue, |
1395 |
+diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c |
1396 |
+index 971ae892c611..74997194fd88 100644 |
1397 |
+--- a/drivers/platform/x86/pmc_atom.c |
1398 |
++++ b/drivers/platform/x86/pmc_atom.c |
1399 |
+@@ -482,6 +482,14 @@ static const struct dmi_system_id critclk_systems[] = { |
1400 |
+ DMI_MATCH(DMI_PRODUCT_VERSION, "6ES7647-8B"), |
1401 |
+ }, |
1402 |
+ }, |
1403 |
++ { |
1404 |
++ .ident = "CONNECT X300", |
1405 |
++ .matches = { |
1406 |
++ DMI_MATCH(DMI_SYS_VENDOR, "SIEMENS AG"), |
1407 |
++ DMI_MATCH(DMI_PRODUCT_VERSION, "A5E45074588"), |
1408 |
++ }, |
1409 |
++ }, |
1410 |
++ |
1411 |
+ { /*sentinel*/ } |
1412 |
+ }; |
1413 |
+ |
1414 |
+diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c |
1415 |
+index 0f97514e3474..c9f20e1394e3 100644 |
1416 |
+--- a/drivers/regulator/ab8500.c |
1417 |
++++ b/drivers/regulator/ab8500.c |
1418 |
+@@ -1099,23 +1099,6 @@ static struct ab8500_regulator_info |
1419 |
+ .update_val_idle = 0x82, |
1420 |
+ .update_val_normal = 0x02, |
1421 |
+ }, |
1422 |
+- [AB8505_LDO_USB] = { |
1423 |
+- .desc = { |
1424 |
+- .name = "LDO-USB", |
1425 |
+- .ops = &ab8500_regulator_mode_ops, |
1426 |
+- .type = REGULATOR_VOLTAGE, |
1427 |
+- .id = AB8505_LDO_USB, |
1428 |
+- .owner = THIS_MODULE, |
1429 |
+- .n_voltages = 1, |
1430 |
+- .volt_table = fixed_3300000_voltage, |
1431 |
+- }, |
1432 |
+- .update_bank = 0x03, |
1433 |
+- .update_reg = 0x82, |
1434 |
+- .update_mask = 0x03, |
1435 |
+- .update_val = 0x01, |
1436 |
+- .update_val_idle = 0x03, |
1437 |
+- .update_val_normal = 0x01, |
1438 |
+- }, |
1439 |
+ [AB8505_LDO_AUDIO] = { |
1440 |
+ .desc = { |
1441 |
+ .name = "LDO-AUDIO", |
1442 |
+diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c |
1443 |
+index 60de66252fa2..b200edc665a5 100644 |
1444 |
+--- a/drivers/scsi/libsas/sas_discover.c |
1445 |
++++ b/drivers/scsi/libsas/sas_discover.c |
1446 |
+@@ -97,12 +97,21 @@ static int sas_get_port_device(struct asd_sas_port *port) |
1447 |
+ else |
1448 |
+ dev->dev_type = SAS_SATA_DEV; |
1449 |
+ dev->tproto = SAS_PROTOCOL_SATA; |
1450 |
+- } else { |
1451 |
++ } else if (port->oob_mode == SAS_OOB_MODE) { |
1452 |
+ struct sas_identify_frame *id = |
1453 |
+ (struct sas_identify_frame *) dev->frame_rcvd; |
1454 |
+ dev->dev_type = id->dev_type; |
1455 |
+ dev->iproto = id->initiator_bits; |
1456 |
+ dev->tproto = id->target_bits; |
1457 |
++ } else { |
1458 |
++ /* If the oob mode is OOB_NOT_CONNECTED, the port is |
1459 |
++ * disconnected due to race with PHY down. We cannot |
1460 |
++ * continue to discover this port |
1461 |
++ */ |
1462 |
++ sas_put_device(dev); |
1463 |
++ pr_warn("Port %016llx is disconnected when discovering\n", |
1464 |
++ SAS_ADDR(port->attached_sas_addr)); |
1465 |
++ return -ENODEV; |
1466 |
+ } |
1467 |
+ |
1468 |
+ sas_init_dev(dev); |
1469 |
+diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c |
1470 |
+index 6dde21dc82a3..08ed27b0d4c6 100644 |
1471 |
+--- a/drivers/scsi/lpfc/lpfc_bsg.c |
1472 |
++++ b/drivers/scsi/lpfc/lpfc_bsg.c |
1473 |
+@@ -4419,12 +4419,6 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job, |
1474 |
+ phba->mbox_ext_buf_ctx.seqNum++; |
1475 |
+ nemb_tp = phba->mbox_ext_buf_ctx.nembType; |
1476 |
+ |
1477 |
+- dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL); |
1478 |
+- if (!dd_data) { |
1479 |
+- rc = -ENOMEM; |
1480 |
+- goto job_error; |
1481 |
+- } |
1482 |
+- |
1483 |
+ pbuf = (uint8_t *)dmabuf->virt; |
1484 |
+ size = job->request_payload.payload_len; |
1485 |
+ sg_copy_to_buffer(job->request_payload.sg_list, |
1486 |
+@@ -4461,6 +4455,13 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job, |
1487 |
+ "2968 SLI_CONFIG ext-buffer wr all %d " |
1488 |
+ "ebuffers received\n", |
1489 |
+ phba->mbox_ext_buf_ctx.numBuf); |
1490 |
++ |
1491 |
++ dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL); |
1492 |
++ if (!dd_data) { |
1493 |
++ rc = -ENOMEM; |
1494 |
++ goto job_error; |
1495 |
++ } |
1496 |
++ |
1497 |
+ /* mailbox command structure for base driver */ |
1498 |
+ pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
1499 |
+ if (!pmboxq) { |
1500 |
+@@ -4509,6 +4510,8 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job, |
1501 |
+ return SLI_CONFIG_HANDLED; |
1502 |
+ |
1503 |
+ job_error: |
1504 |
++ if (pmboxq) |
1505 |
++ mempool_free(pmboxq, phba->mbox_mem_pool); |
1506 |
+ lpfc_bsg_dma_page_free(phba, dmabuf); |
1507 |
+ kfree(dd_data); |
1508 |
+ |
1509 |
+diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c |
1510 |
+index fcf4b4175d77..af937b91765e 100644 |
1511 |
+--- a/drivers/scsi/lpfc/lpfc_nvme.c |
1512 |
++++ b/drivers/scsi/lpfc/lpfc_nvme.c |
1513 |
+@@ -1591,6 +1591,8 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport, |
1514 |
+ |
1515 |
+ /* Declare and initialization an instance of the FC NVME template. */ |
1516 |
+ static struct nvme_fc_port_template lpfc_nvme_template = { |
1517 |
++ .module = THIS_MODULE, |
1518 |
++ |
1519 |
+ /* initiator-based functions */ |
1520 |
+ .localport_delete = lpfc_nvme_localport_delete, |
1521 |
+ .remoteport_delete = lpfc_nvme_remoteport_delete, |
1522 |
+diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c |
1523 |
+index 59c18ca4cda9..e5927a09f7bc 100644 |
1524 |
+--- a/drivers/scsi/qedf/qedf_els.c |
1525 |
++++ b/drivers/scsi/qedf/qedf_els.c |
1526 |
+@@ -23,8 +23,6 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op, |
1527 |
+ int rc = 0; |
1528 |
+ uint32_t did, sid; |
1529 |
+ uint16_t xid; |
1530 |
+- uint32_t start_time = jiffies / HZ; |
1531 |
+- uint32_t current_time; |
1532 |
+ struct fcoe_wqe *sqe; |
1533 |
+ unsigned long flags; |
1534 |
+ u16 sqe_idx; |
1535 |
+@@ -50,18 +48,12 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op, |
1536 |
+ goto els_err; |
1537 |
+ } |
1538 |
+ |
1539 |
+-retry_els: |
1540 |
+ els_req = qedf_alloc_cmd(fcport, QEDF_ELS); |
1541 |
+ if (!els_req) { |
1542 |
+- current_time = jiffies / HZ; |
1543 |
+- if ((current_time - start_time) > 10) { |
1544 |
+- QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, |
1545 |
+- "els: Failed els 0x%x\n", op); |
1546 |
+- rc = -ENOMEM; |
1547 |
+- goto els_err; |
1548 |
+- } |
1549 |
+- mdelay(20 * USEC_PER_MSEC); |
1550 |
+- goto retry_els; |
1551 |
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_ELS, |
1552 |
++ "Failed to alloc ELS request 0x%x\n", op); |
1553 |
++ rc = -ENOMEM; |
1554 |
++ goto els_err; |
1555 |
+ } |
1556 |
+ |
1557 |
+ QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "initiate_els els_req = " |
1558 |
+diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c |
1559 |
+index ebca1a470e9b..7f2da56274bd 100644 |
1560 |
+--- a/drivers/scsi/qla2xxx/qla_isr.c |
1561 |
++++ b/drivers/scsi/qla2xxx/qla_isr.c |
1562 |
+@@ -1046,8 +1046,6 @@ global_port_update: |
1563 |
+ ql_dbg(ql_dbg_async, vha, 0x5011, |
1564 |
+ "Asynchronous PORT UPDATE ignored %04x/%04x/%04x.\n", |
1565 |
+ mb[1], mb[2], mb[3]); |
1566 |
+- |
1567 |
+- qlt_async_event(mb[0], vha, mb); |
1568 |
+ break; |
1569 |
+ } |
1570 |
+ |
1571 |
+@@ -1065,8 +1063,6 @@ global_port_update: |
1572 |
+ set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); |
1573 |
+ set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); |
1574 |
+ set_bit(VP_CONFIG_OK, &vha->vp_flags); |
1575 |
+- |
1576 |
+- qlt_async_event(mb[0], vha, mb); |
1577 |
+ break; |
1578 |
+ |
1579 |
+ case MBA_RSCN_UPDATE: /* State Change Registration */ |
1580 |
+diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c |
1581 |
+index 6b33a1f24f56..7dceed021236 100644 |
1582 |
+--- a/drivers/scsi/qla2xxx/qla_nvme.c |
1583 |
++++ b/drivers/scsi/qla2xxx/qla_nvme.c |
1584 |
+@@ -578,6 +578,7 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport) |
1585 |
+ } |
1586 |
+ |
1587 |
+ static struct nvme_fc_port_template qla_nvme_fc_transport = { |
1588 |
++ .module = THIS_MODULE, |
1589 |
+ .localport_delete = qla_nvme_localport_delete, |
1590 |
+ .remoteport_delete = qla_nvme_remoteport_delete, |
1591 |
+ .create_queue = qla_nvme_alloc_queue, |
1592 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
1593 |
+index 69ed544d80ef..55227d20496a 100644 |
1594 |
+--- a/drivers/scsi/qla2xxx/qla_target.c |
1595 |
++++ b/drivers/scsi/qla2xxx/qla_target.c |
1596 |
+@@ -1210,7 +1210,6 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess, |
1597 |
+ "Scheduling sess %p for deletion %8phC\n", |
1598 |
+ sess, sess->port_name); |
1599 |
+ |
1600 |
+- INIT_WORK(&sess->del_work, qla24xx_delete_sess_fn); |
1601 |
+ queue_work(sess->vha->hw->wq, &sess->del_work); |
1602 |
+ } |
1603 |
+ |
1604 |
+diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c |
1605 |
+index 4421f9bdfcf7..b0ad60565fe9 100644 |
1606 |
+--- a/drivers/scsi/qla4xxx/ql4_os.c |
1607 |
++++ b/drivers/scsi/qla4xxx/ql4_os.c |
1608 |
+@@ -4285,7 +4285,6 @@ static int qla4xxx_mem_alloc(struct scsi_qla_host *ha) |
1609 |
+ return QLA_SUCCESS; |
1610 |
+ |
1611 |
+ mem_alloc_error_exit: |
1612 |
+- qla4xxx_mem_free(ha); |
1613 |
+ return QLA_ERROR; |
1614 |
+ } |
1615 |
+ |
1616 |
+diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c |
1617 |
+index a1d272ac82bb..c33150fcd964 100644 |
1618 |
+--- a/drivers/tty/hvc/hvc_vio.c |
1619 |
++++ b/drivers/tty/hvc/hvc_vio.c |
1620 |
+@@ -120,6 +120,14 @@ static int hvterm_raw_get_chars(uint32_t vtermno, char *buf, int count) |
1621 |
+ return got; |
1622 |
+ } |
1623 |
+ |
1624 |
++/** |
1625 |
++ * hvterm_raw_put_chars: send characters to firmware for given vterm adapter |
1626 |
++ * @vtermno: The virtual terminal number. |
1627 |
++ * @buf: The characters to send. Because of the underlying hypercall in |
1628 |
++ * hvc_put_chars(), this buffer must be at least 16 bytes long, even if |
1629 |
++ * you are sending fewer chars. |
1630 |
++ * @count: number of chars to send. |
1631 |
++ */ |
1632 |
+ static int hvterm_raw_put_chars(uint32_t vtermno, const char *buf, int count) |
1633 |
+ { |
1634 |
+ struct hvterm_priv *pv = hvterm_privs[vtermno]; |
1635 |
+@@ -232,6 +240,7 @@ static const struct hv_ops hvterm_hvsi_ops = { |
1636 |
+ static void udbg_hvc_putc(char c) |
1637 |
+ { |
1638 |
+ int count = -1; |
1639 |
++ unsigned char bounce_buffer[16]; |
1640 |
+ |
1641 |
+ if (!hvterm_privs[0]) |
1642 |
+ return; |
1643 |
+@@ -242,7 +251,12 @@ static void udbg_hvc_putc(char c) |
1644 |
+ do { |
1645 |
+ switch(hvterm_privs[0]->proto) { |
1646 |
+ case HV_PROTOCOL_RAW: |
1647 |
+- count = hvterm_raw_put_chars(0, &c, 1); |
1648 |
++ /* |
1649 |
++ * hvterm_raw_put_chars requires at least a 16-byte |
1650 |
++ * buffer, so go via the bounce buffer |
1651 |
++ */ |
1652 |
++ bounce_buffer[0] = c; |
1653 |
++ count = hvterm_raw_put_chars(0, bounce_buffer, 1); |
1654 |
+ break; |
1655 |
+ case HV_PROTOCOL_HVSI: |
1656 |
+ count = hvterm_hvsi_put_chars(0, &c, 1); |
1657 |
+diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c |
1658 |
+index e937fb189034..77a1f00fe843 100644 |
1659 |
+--- a/drivers/tty/serial/msm_serial.c |
1660 |
++++ b/drivers/tty/serial/msm_serial.c |
1661 |
+@@ -1588,6 +1588,7 @@ static void __msm_console_write(struct uart_port *port, const char *s, |
1662 |
+ int num_newlines = 0; |
1663 |
+ bool replaced = false; |
1664 |
+ void __iomem *tf; |
1665 |
++ int locked = 1; |
1666 |
+ |
1667 |
+ if (is_uartdm) |
1668 |
+ tf = port->membase + UARTDM_TF; |
1669 |
+@@ -1600,7 +1601,13 @@ static void __msm_console_write(struct uart_port *port, const char *s, |
1670 |
+ num_newlines++; |
1671 |
+ count += num_newlines; |
1672 |
+ |
1673 |
+- spin_lock(&port->lock); |
1674 |
++ if (port->sysrq) |
1675 |
++ locked = 0; |
1676 |
++ else if (oops_in_progress) |
1677 |
++ locked = spin_trylock(&port->lock); |
1678 |
++ else |
1679 |
++ spin_lock(&port->lock); |
1680 |
++ |
1681 |
+ if (is_uartdm) |
1682 |
+ msm_reset_dm_count(port, count); |
1683 |
+ |
1684 |
+@@ -1636,7 +1643,9 @@ static void __msm_console_write(struct uart_port *port, const char *s, |
1685 |
+ iowrite32_rep(tf, buf, 1); |
1686 |
+ i += num_chars; |
1687 |
+ } |
1688 |
+- spin_unlock(&port->lock); |
1689 |
++ |
1690 |
++ if (locked) |
1691 |
++ spin_unlock(&port->lock); |
1692 |
+ } |
1693 |
+ |
1694 |
+ static void msm_console_write(struct console *co, const char *s, |
1695 |
+diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c |
1696 |
+index 4c488d15b6f6..dc99ed94f03d 100644 |
1697 |
+--- a/drivers/usb/gadget/function/f_ecm.c |
1698 |
++++ b/drivers/usb/gadget/function/f_ecm.c |
1699 |
+@@ -625,8 +625,12 @@ static void ecm_disable(struct usb_function *f) |
1700 |
+ |
1701 |
+ DBG(cdev, "ecm deactivated\n"); |
1702 |
+ |
1703 |
+- if (ecm->port.in_ep->enabled) |
1704 |
++ if (ecm->port.in_ep->enabled) { |
1705 |
+ gether_disconnect(&ecm->port); |
1706 |
++ } else { |
1707 |
++ ecm->port.in_ep->desc = NULL; |
1708 |
++ ecm->port.out_ep->desc = NULL; |
1709 |
++ } |
1710 |
+ |
1711 |
+ usb_ep_disable(ecm->notify); |
1712 |
+ ecm->notify->desc = NULL; |
1713 |
+diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c |
1714 |
+index c7c5b3ce1d98..2bde68f5d246 100644 |
1715 |
+--- a/drivers/usb/gadget/function/f_rndis.c |
1716 |
++++ b/drivers/usb/gadget/function/f_rndis.c |
1717 |
+@@ -622,6 +622,7 @@ static void rndis_disable(struct usb_function *f) |
1718 |
+ gether_disconnect(&rndis->port); |
1719 |
+ |
1720 |
+ usb_ep_disable(rndis->notify); |
1721 |
++ rndis->notify->desc = NULL; |
1722 |
+ } |
1723 |
+ |
1724 |
+ /*-------------------------------------------------------------------------*/ |
1725 |
+diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c |
1726 |
+index 71a6deeb4e71..3f9260af701f 100644 |
1727 |
+--- a/drivers/xen/balloon.c |
1728 |
++++ b/drivers/xen/balloon.c |
1729 |
+@@ -401,7 +401,8 @@ static struct notifier_block xen_memory_nb = { |
1730 |
+ #else |
1731 |
+ static enum bp_state reserve_additional_memory(void) |
1732 |
+ { |
1733 |
+- balloon_stats.target_pages = balloon_stats.current_pages; |
1734 |
++ balloon_stats.target_pages = balloon_stats.current_pages + |
1735 |
++ balloon_stats.target_unpopulated; |
1736 |
+ return BP_ECANCELED; |
1737 |
+ } |
1738 |
+ #endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */ |
1739 |
+diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c |
1740 |
+index 033e8e6aabb7..f445bc9cdc94 100644 |
1741 |
+--- a/fs/compat_ioctl.c |
1742 |
++++ b/fs/compat_ioctl.c |
1743 |
+@@ -1577,9 +1577,10 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, |
1744 |
+ #endif |
1745 |
+ |
1746 |
+ case FICLONE: |
1747 |
++ goto do_ioctl; |
1748 |
+ case FICLONERANGE: |
1749 |
+ case FIDEDUPERANGE: |
1750 |
+- goto do_ioctl; |
1751 |
++ goto found_handler; |
1752 |
+ |
1753 |
+ case FIBMAP: |
1754 |
+ case FIGETBSZ: |
1755 |
+diff --git a/fs/locks.c b/fs/locks.c |
1756 |
+index 665e3ce9ab47..1a40e277eb5e 100644 |
1757 |
+--- a/fs/locks.c |
1758 |
++++ b/fs/locks.c |
1759 |
+@@ -2691,7 +2691,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl, |
1760 |
+ } |
1761 |
+ if (inode) { |
1762 |
+ /* userspace relies on this representation of dev_t */ |
1763 |
+- seq_printf(f, "%d %02x:%02x:%ld ", fl_pid, |
1764 |
++ seq_printf(f, "%d %02x:%02x:%lu ", fl_pid, |
1765 |
+ MAJOR(inode->i_sb->s_dev), |
1766 |
+ MINOR(inode->i_sb->s_dev), inode->i_ino); |
1767 |
+ } else { |
1768 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
1769 |
+index 87ee9cbf7dcb..fc13236d1be1 100644 |
1770 |
+--- a/fs/nfsd/nfs4state.c |
1771 |
++++ b/fs/nfsd/nfs4state.c |
1772 |
+@@ -3058,12 +3058,17 @@ static bool replay_matches_cache(struct svc_rqst *rqstp, |
1773 |
+ (bool)seq->cachethis) |
1774 |
+ return false; |
1775 |
+ /* |
1776 |
+- * If there's an error than the reply can have fewer ops than |
1777 |
+- * the call. But if we cached a reply with *more* ops than the |
1778 |
+- * call you're sending us now, then this new call is clearly not |
1779 |
+- * really a replay of the old one: |
1780 |
++ * If there's an error then the reply can have fewer ops than |
1781 |
++ * the call. |
1782 |
+ */ |
1783 |
+- if (slot->sl_opcnt < argp->opcnt) |
1784 |
++ if (slot->sl_opcnt < argp->opcnt && !slot->sl_status) |
1785 |
++ return false; |
1786 |
++ /* |
1787 |
++ * But if we cached a reply with *more* ops than the call you're |
1788 |
++ * sending us now, then this new call is clearly not really a |
1789 |
++ * replay of the old one: |
1790 |
++ */ |
1791 |
++ if (slot->sl_opcnt > argp->opcnt) |
1792 |
+ return false; |
1793 |
+ /* This is the only check explicitly called by spec: */ |
1794 |
+ if (!same_creds(&rqstp->rq_cred, &slot->sl_cred)) |
1795 |
+diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c |
1796 |
+index 1e675be10926..11c7a171c0a1 100644 |
1797 |
+--- a/fs/pstore/ram.c |
1798 |
++++ b/fs/pstore/ram.c |
1799 |
+@@ -433,6 +433,17 @@ static int notrace ramoops_pstore_write(struct pstore_record *record) |
1800 |
+ |
1801 |
+ prz = cxt->dprzs[cxt->dump_write_cnt]; |
1802 |
+ |
1803 |
++ /* |
1804 |
++ * Since this is a new crash dump, we need to reset the buffer in |
1805 |
++ * case it still has an old dump present. Without this, the new dump |
1806 |
++ * will get appended, which would seriously confuse anything trying |
1807 |
++ * to check dump file contents. Specifically, ramoops_read_kmsg_hdr() |
1808 |
++ * expects to find a dump header in the beginning of buffer data, so |
1809 |
++ * we must to reset the buffer values, in order to ensure that the |
1810 |
++ * header will be written to the beginning of the buffer. |
1811 |
++ */ |
1812 |
++ persistent_ram_zap(prz); |
1813 |
++ |
1814 |
+ /* Build header and append record contents. */ |
1815 |
+ hlen = ramoops_write_kmsg_hdr(prz, record); |
1816 |
+ size = record->size; |
1817 |
+diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c |
1818 |
+index 7b25a88569c9..84245d210182 100644 |
1819 |
+--- a/fs/xfs/libxfs/xfs_bmap.c |
1820 |
++++ b/fs/xfs/libxfs/xfs_bmap.c |
1821 |
+@@ -5556,7 +5556,7 @@ __xfs_bunmapi( |
1822 |
+ * Make sure we don't touch multiple AGF headers out of order |
1823 |
+ * in a single transaction, as that could cause AB-BA deadlocks. |
1824 |
+ */ |
1825 |
+- if (!wasdel) { |
1826 |
++ if (!wasdel && !isrt) { |
1827 |
+ agno = XFS_FSB_TO_AGNO(mp, del.br_startblock); |
1828 |
+ if (prev_agno != NULLAGNUMBER && prev_agno > agno) |
1829 |
+ break; |
1830 |
+diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c |
1831 |
+index dc95a49d62e7..4e768e606998 100644 |
1832 |
+--- a/fs/xfs/xfs_log.c |
1833 |
++++ b/fs/xfs/xfs_log.c |
1834 |
+@@ -1539,6 +1539,8 @@ out_free_iclog: |
1835 |
+ if (iclog->ic_bp) |
1836 |
+ xfs_buf_free(iclog->ic_bp); |
1837 |
+ kmem_free(iclog); |
1838 |
++ if (prev_iclog == log->l_iclog) |
1839 |
++ break; |
1840 |
+ } |
1841 |
+ spinlock_destroy(&log->l_icloglock); |
1842 |
+ xfs_buf_free(log->l_xbuf); |
1843 |
+diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h |
1844 |
+index 1b0a17b22cd3..d560580d9cda 100644 |
1845 |
+--- a/include/linux/ahci_platform.h |
1846 |
++++ b/include/linux/ahci_platform.h |
1847 |
+@@ -23,6 +23,8 @@ struct ahci_host_priv; |
1848 |
+ struct platform_device; |
1849 |
+ struct scsi_host_template; |
1850 |
+ |
1851 |
++int ahci_platform_enable_phys(struct ahci_host_priv *hpriv); |
1852 |
++void ahci_platform_disable_phys(struct ahci_host_priv *hpriv); |
1853 |
+ int ahci_platform_enable_clks(struct ahci_host_priv *hpriv); |
1854 |
+ void ahci_platform_disable_clks(struct ahci_host_priv *hpriv); |
1855 |
+ int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv); |
1856 |
+diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h |
1857 |
+index 8319101170fc..087cbe776868 100644 |
1858 |
+--- a/include/linux/dmaengine.h |
1859 |
++++ b/include/linux/dmaengine.h |
1860 |
+@@ -1362,8 +1362,11 @@ static inline int dma_get_slave_caps(struct dma_chan *chan, |
1861 |
+ static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx) |
1862 |
+ { |
1863 |
+ struct dma_slave_caps caps; |
1864 |
++ int ret; |
1865 |
+ |
1866 |
+- dma_get_slave_caps(tx->chan, &caps); |
1867 |
++ ret = dma_get_slave_caps(tx->chan, &caps); |
1868 |
++ if (ret) |
1869 |
++ return ret; |
1870 |
+ |
1871 |
+ if (caps.descriptor_reuse) { |
1872 |
+ tx->flags |= DMA_CTRL_REUSE; |
1873 |
+diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h |
1874 |
+index a726f96010d5..e9c3b98df3e2 100644 |
1875 |
+--- a/include/linux/nvme-fc-driver.h |
1876 |
++++ b/include/linux/nvme-fc-driver.h |
1877 |
+@@ -279,6 +279,8 @@ struct nvme_fc_remote_port { |
1878 |
+ * |
1879 |
+ * Host/Initiator Transport Entrypoints/Parameters: |
1880 |
+ * |
1881 |
++ * @module: The LLDD module using the interface |
1882 |
++ * |
1883 |
+ * @localport_delete: The LLDD initiates deletion of a localport via |
1884 |
+ * nvme_fc_deregister_localport(). However, the teardown is |
1885 |
+ * asynchronous. This routine is called upon the completion of the |
1886 |
+@@ -392,6 +394,8 @@ struct nvme_fc_remote_port { |
1887 |
+ * Value is Mandatory. Allowed to be zero. |
1888 |
+ */ |
1889 |
+ struct nvme_fc_port_template { |
1890 |
++ struct module *module; |
1891 |
++ |
1892 |
+ /* initiator-based functions */ |
1893 |
+ void (*localport_delete)(struct nvme_fc_local_port *); |
1894 |
+ void (*remoteport_delete)(struct nvme_fc_remote_port *); |
1895 |
+diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h |
1896 |
+index d8ecefaf63ca..260c4aa1d976 100644 |
1897 |
+--- a/include/linux/regulator/ab8500.h |
1898 |
++++ b/include/linux/regulator/ab8500.h |
1899 |
+@@ -38,7 +38,6 @@ enum ab8505_regulator_id { |
1900 |
+ AB8505_LDO_AUX6, |
1901 |
+ AB8505_LDO_INTCORE, |
1902 |
+ AB8505_LDO_ADC, |
1903 |
+- AB8505_LDO_USB, |
1904 |
+ AB8505_LDO_AUDIO, |
1905 |
+ AB8505_LDO_ANAMIC1, |
1906 |
+ AB8505_LDO_ANAMIC2, |
1907 |
+diff --git a/include/net/neighbour.h b/include/net/neighbour.h |
1908 |
+index 1d6b98119a1d..e89273f9a0bc 100644 |
1909 |
+--- a/include/net/neighbour.h |
1910 |
++++ b/include/net/neighbour.h |
1911 |
+@@ -458,7 +458,7 @@ static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb |
1912 |
+ |
1913 |
+ do { |
1914 |
+ seq = read_seqbegin(&hh->hh_lock); |
1915 |
+- hh_len = hh->hh_len; |
1916 |
++ hh_len = READ_ONCE(hh->hh_len); |
1917 |
+ if (likely(hh_len <= HH_DATA_MOD)) { |
1918 |
+ hh_alen = HH_DATA_MOD; |
1919 |
+ |
1920 |
+diff --git a/kernel/cred.c b/kernel/cred.c |
1921 |
+index 5ab1f7ec946e..a9f0f8b21d8c 100644 |
1922 |
+--- a/kernel/cred.c |
1923 |
++++ b/kernel/cred.c |
1924 |
+@@ -220,7 +220,7 @@ struct cred *cred_alloc_blank(void) |
1925 |
+ new->magic = CRED_MAGIC; |
1926 |
+ #endif |
1927 |
+ |
1928 |
+- if (security_cred_alloc_blank(new, GFP_KERNEL) < 0) |
1929 |
++ if (security_cred_alloc_blank(new, GFP_KERNEL_ACCOUNT) < 0) |
1930 |
+ goto error; |
1931 |
+ |
1932 |
+ return new; |
1933 |
+@@ -279,7 +279,7 @@ struct cred *prepare_creds(void) |
1934 |
+ new->security = NULL; |
1935 |
+ #endif |
1936 |
+ |
1937 |
+- if (security_prepare_creds(new, old, GFP_KERNEL) < 0) |
1938 |
++ if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) |
1939 |
+ goto error; |
1940 |
+ validate_creds(new); |
1941 |
+ return new; |
1942 |
+@@ -654,7 +654,7 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon) |
1943 |
+ #ifdef CONFIG_SECURITY |
1944 |
+ new->security = NULL; |
1945 |
+ #endif |
1946 |
+- if (security_prepare_creds(new, old, GFP_KERNEL) < 0) |
1947 |
++ if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) |
1948 |
+ goto error; |
1949 |
+ |
1950 |
+ put_cred(old); |
1951 |
+diff --git a/kernel/exit.c b/kernel/exit.c |
1952 |
+index 57cb0eb1271c..d1baf9c96c3e 100644 |
1953 |
+--- a/kernel/exit.c |
1954 |
++++ b/kernel/exit.c |
1955 |
+@@ -577,10 +577,6 @@ static struct task_struct *find_child_reaper(struct task_struct *father, |
1956 |
+ } |
1957 |
+ |
1958 |
+ write_unlock_irq(&tasklist_lock); |
1959 |
+- if (unlikely(pid_ns == &init_pid_ns)) { |
1960 |
+- panic("Attempted to kill init! exitcode=0x%08x\n", |
1961 |
+- father->signal->group_exit_code ?: father->exit_code); |
1962 |
+- } |
1963 |
+ |
1964 |
+ list_for_each_entry_safe(p, n, dead, ptrace_entry) { |
1965 |
+ list_del_init(&p->ptrace_entry); |
1966 |
+@@ -823,6 +819,14 @@ void __noreturn do_exit(long code) |
1967 |
+ acct_update_integrals(tsk); |
1968 |
+ group_dead = atomic_dec_and_test(&tsk->signal->live); |
1969 |
+ if (group_dead) { |
1970 |
++ /* |
1971 |
++ * If the last thread of global init has exited, panic |
1972 |
++ * immediately to get a useable coredump. |
1973 |
++ */ |
1974 |
++ if (unlikely(is_global_init(tsk))) |
1975 |
++ panic("Attempted to kill init! exitcode=0x%08x\n", |
1976 |
++ tsk->signal->group_exit_code ?: (int)code); |
1977 |
++ |
1978 |
+ #ifdef CONFIG_POSIX_TIMERS |
1979 |
+ hrtimer_cancel(&tsk->signal->real_timer); |
1980 |
+ exit_itimers(tsk->signal); |
1981 |
+diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c |
1982 |
+index 0972a8e09d08..ff2aabb70de9 100644 |
1983 |
+--- a/kernel/power/snapshot.c |
1984 |
++++ b/kernel/power/snapshot.c |
1985 |
+@@ -734,8 +734,15 @@ zone_found: |
1986 |
+ * We have found the zone. Now walk the radix tree to find the leaf node |
1987 |
+ * for our PFN. |
1988 |
+ */ |
1989 |
++ |
1990 |
++ /* |
1991 |
++ * If the zone we wish to scan is the the current zone and the |
1992 |
++ * pfn falls into the current node then we do not need to walk |
1993 |
++ * the tree. |
1994 |
++ */ |
1995 |
+ node = bm->cur.node; |
1996 |
+- if (((pfn - zone->start_pfn) & ~BM_BLOCK_MASK) == bm->cur.node_pfn) |
1997 |
++ if (zone == bm->cur.zone && |
1998 |
++ ((pfn - zone->start_pfn) & ~BM_BLOCK_MASK) == bm->cur.node_pfn) |
1999 |
+ goto node_found; |
2000 |
+ |
2001 |
+ node = zone->rtree; |
2002 |
+diff --git a/kernel/taskstats.c b/kernel/taskstats.c |
2003 |
+index 4559e914452b..390c76d4503c 100644 |
2004 |
+--- a/kernel/taskstats.c |
2005 |
++++ b/kernel/taskstats.c |
2006 |
+@@ -568,25 +568,33 @@ static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info) |
2007 |
+ static struct taskstats *taskstats_tgid_alloc(struct task_struct *tsk) |
2008 |
+ { |
2009 |
+ struct signal_struct *sig = tsk->signal; |
2010 |
+- struct taskstats *stats; |
2011 |
++ struct taskstats *stats_new, *stats; |
2012 |
+ |
2013 |
+- if (sig->stats || thread_group_empty(tsk)) |
2014 |
+- goto ret; |
2015 |
++ /* Pairs with smp_store_release() below. */ |
2016 |
++ stats = smp_load_acquire(&sig->stats); |
2017 |
++ if (stats || thread_group_empty(tsk)) |
2018 |
++ return stats; |
2019 |
+ |
2020 |
+ /* No problem if kmem_cache_zalloc() fails */ |
2021 |
+- stats = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL); |
2022 |
++ stats_new = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL); |
2023 |
+ |
2024 |
+ spin_lock_irq(&tsk->sighand->siglock); |
2025 |
+- if (!sig->stats) { |
2026 |
+- sig->stats = stats; |
2027 |
+- stats = NULL; |
2028 |
++ stats = sig->stats; |
2029 |
++ if (!stats) { |
2030 |
++ /* |
2031 |
++ * Pairs with smp_store_release() above and order the |
2032 |
++ * kmem_cache_zalloc(). |
2033 |
++ */ |
2034 |
++ smp_store_release(&sig->stats, stats_new); |
2035 |
++ stats = stats_new; |
2036 |
++ stats_new = NULL; |
2037 |
+ } |
2038 |
+ spin_unlock_irq(&tsk->sighand->siglock); |
2039 |
+ |
2040 |
+- if (stats) |
2041 |
+- kmem_cache_free(taskstats_cache, stats); |
2042 |
+-ret: |
2043 |
+- return sig->stats; |
2044 |
++ if (stats_new) |
2045 |
++ kmem_cache_free(taskstats_cache, stats_new); |
2046 |
++ |
2047 |
++ return stats; |
2048 |
+ } |
2049 |
+ |
2050 |
+ /* Send pid data out on exit */ |
2051 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
2052 |
+index 144d982905fc..3864d2341442 100644 |
2053 |
+--- a/kernel/trace/ftrace.c |
2054 |
++++ b/kernel/trace/ftrace.c |
2055 |
+@@ -622,8 +622,7 @@ static int function_stat_show(struct seq_file *m, void *v) |
2056 |
+ } |
2057 |
+ |
2058 |
+ #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
2059 |
+- avg = rec->time; |
2060 |
+- do_div(avg, rec->counter); |
2061 |
++ avg = div64_ul(rec->time, rec->counter); |
2062 |
+ if (tracing_thresh && (avg < tracing_thresh)) |
2063 |
+ goto out; |
2064 |
+ #endif |
2065 |
+@@ -649,7 +648,8 @@ static int function_stat_show(struct seq_file *m, void *v) |
2066 |
+ * Divide only 1000 for ns^2 -> us^2 conversion. |
2067 |
+ * trace_print_graph_duration will divide 1000 again. |
2068 |
+ */ |
2069 |
+- do_div(stddev, rec->counter * (rec->counter - 1) * 1000); |
2070 |
++ stddev = div64_ul(stddev, |
2071 |
++ rec->counter * (rec->counter - 1) * 1000); |
2072 |
+ } |
2073 |
+ |
2074 |
+ trace_seq_init(&s); |
2075 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
2076 |
+index 286bbad7681b..c456c2b06277 100644 |
2077 |
+--- a/kernel/trace/trace.c |
2078 |
++++ b/kernel/trace/trace.c |
2079 |
+@@ -4368,6 +4368,10 @@ int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set) |
2080 |
+ |
2081 |
+ int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled) |
2082 |
+ { |
2083 |
++ if ((mask == TRACE_ITER_RECORD_TGID) || |
2084 |
++ (mask == TRACE_ITER_RECORD_CMD)) |
2085 |
++ lockdep_assert_held(&event_mutex); |
2086 |
++ |
2087 |
+ /* do nothing if flag is already set */ |
2088 |
+ if (!!(tr->trace_flags & mask) == !!enabled) |
2089 |
+ return 0; |
2090 |
+@@ -4433,6 +4437,7 @@ static int trace_set_options(struct trace_array *tr, char *option) |
2091 |
+ cmp += 2; |
2092 |
+ } |
2093 |
+ |
2094 |
++ mutex_lock(&event_mutex); |
2095 |
+ mutex_lock(&trace_types_lock); |
2096 |
+ |
2097 |
+ for (i = 0; trace_options[i]; i++) { |
2098 |
+@@ -4447,6 +4452,7 @@ static int trace_set_options(struct trace_array *tr, char *option) |
2099 |
+ ret = set_tracer_option(tr, cmp, neg); |
2100 |
+ |
2101 |
+ mutex_unlock(&trace_types_lock); |
2102 |
++ mutex_unlock(&event_mutex); |
2103 |
+ |
2104 |
+ /* |
2105 |
+ * If the first trailing whitespace is replaced with '\0' by strstrip, |
2106 |
+@@ -7373,9 +7379,11 @@ trace_options_core_write(struct file *filp, const char __user *ubuf, size_t cnt, |
2107 |
+ if (val != 0 && val != 1) |
2108 |
+ return -EINVAL; |
2109 |
+ |
2110 |
++ mutex_lock(&event_mutex); |
2111 |
+ mutex_lock(&trace_types_lock); |
2112 |
+ ret = set_tracer_flag(tr, 1 << index, val); |
2113 |
+ mutex_unlock(&trace_types_lock); |
2114 |
++ mutex_unlock(&event_mutex); |
2115 |
+ |
2116 |
+ if (ret < 0) |
2117 |
+ return ret; |
2118 |
+diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c |
2119 |
+index 654a1587f6dd..2b0a01b2be2d 100644 |
2120 |
+--- a/kernel/trace/trace_events.c |
2121 |
++++ b/kernel/trace/trace_events.c |
2122 |
+@@ -326,7 +326,8 @@ void trace_event_enable_cmd_record(bool enable) |
2123 |
+ struct trace_event_file *file; |
2124 |
+ struct trace_array *tr; |
2125 |
+ |
2126 |
+- mutex_lock(&event_mutex); |
2127 |
++ lockdep_assert_held(&event_mutex); |
2128 |
++ |
2129 |
+ do_for_each_event_file(tr, file) { |
2130 |
+ |
2131 |
+ if (!(file->flags & EVENT_FILE_FL_ENABLED)) |
2132 |
+@@ -340,7 +341,6 @@ void trace_event_enable_cmd_record(bool enable) |
2133 |
+ clear_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags); |
2134 |
+ } |
2135 |
+ } while_for_each_event_file(); |
2136 |
+- mutex_unlock(&event_mutex); |
2137 |
+ } |
2138 |
+ |
2139 |
+ void trace_event_enable_tgid_record(bool enable) |
2140 |
+@@ -348,7 +348,8 @@ void trace_event_enable_tgid_record(bool enable) |
2141 |
+ struct trace_event_file *file; |
2142 |
+ struct trace_array *tr; |
2143 |
+ |
2144 |
+- mutex_lock(&event_mutex); |
2145 |
++ lockdep_assert_held(&event_mutex); |
2146 |
++ |
2147 |
+ do_for_each_event_file(tr, file) { |
2148 |
+ if (!(file->flags & EVENT_FILE_FL_ENABLED)) |
2149 |
+ continue; |
2150 |
+@@ -362,7 +363,6 @@ void trace_event_enable_tgid_record(bool enable) |
2151 |
+ &file->flags); |
2152 |
+ } |
2153 |
+ } while_for_each_event_file(); |
2154 |
+- mutex_unlock(&event_mutex); |
2155 |
+ } |
2156 |
+ |
2157 |
+ static int __ftrace_event_enable_disable(struct trace_event_file *file, |
2158 |
+diff --git a/kernel/trace/tracing_map.c b/kernel/trace/tracing_map.c |
2159 |
+index 305039b122fa..35b2ba07f3c6 100644 |
2160 |
+--- a/kernel/trace/tracing_map.c |
2161 |
++++ b/kernel/trace/tracing_map.c |
2162 |
+@@ -90,8 +90,8 @@ static int tracing_map_cmp_atomic64(void *val_a, void *val_b) |
2163 |
+ #define DEFINE_TRACING_MAP_CMP_FN(type) \ |
2164 |
+ static int tracing_map_cmp_##type(void *val_a, void *val_b) \ |
2165 |
+ { \ |
2166 |
+- type a = *(type *)val_a; \ |
2167 |
+- type b = *(type *)val_b; \ |
2168 |
++ type a = (type)(*(u64 *)val_a); \ |
2169 |
++ type b = (type)(*(u64 *)val_b); \ |
2170 |
+ \ |
2171 |
+ return (a > b) ? 1 : ((a < b) ? -1 : 0); \ |
2172 |
+ } |
2173 |
+diff --git a/mm/mmap.c b/mm/mmap.c |
2174 |
+index 59fd53b41c9c..8c6ed06983f9 100644 |
2175 |
+--- a/mm/mmap.c |
2176 |
++++ b/mm/mmap.c |
2177 |
+@@ -89,12 +89,6 @@ static void unmap_region(struct mm_struct *mm, |
2178 |
+ * MAP_PRIVATE r: (no) no r: (yes) yes r: (no) yes r: (no) yes |
2179 |
+ * w: (no) no w: (no) no w: (copy) copy w: (no) no |
2180 |
+ * x: (no) no x: (no) yes x: (no) yes x: (yes) yes |
2181 |
+- * |
2182 |
+- * On arm64, PROT_EXEC has the following behaviour for both MAP_SHARED and |
2183 |
+- * MAP_PRIVATE: |
2184 |
+- * r: (no) no |
2185 |
+- * w: (no) no |
2186 |
+- * x: (yes) yes |
2187 |
+ */ |
2188 |
+ pgprot_t protection_map[16] __ro_after_init = { |
2189 |
+ __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111, |
2190 |
+diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c |
2191 |
+index 3197de2a3896..c6df483b3751 100644 |
2192 |
+--- a/mm/zsmalloc.c |
2193 |
++++ b/mm/zsmalloc.c |
2194 |
+@@ -2088,6 +2088,11 @@ int zs_page_migrate(struct address_space *mapping, struct page *newpage, |
2195 |
+ zs_pool_dec_isolated(pool); |
2196 |
+ } |
2197 |
+ |
2198 |
++ if (page_zone(newpage) != page_zone(page)) { |
2199 |
++ dec_zone_page_state(page, NR_ZSPAGES); |
2200 |
++ inc_zone_page_state(newpage, NR_ZSPAGES); |
2201 |
++ } |
2202 |
++ |
2203 |
+ reset_page(page); |
2204 |
+ put_page(page); |
2205 |
+ page = newpage; |
2206 |
+diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c |
2207 |
+index bd41b78d131d..1d085eed72d0 100644 |
2208 |
+--- a/net/bluetooth/hci_conn.c |
2209 |
++++ b/net/bluetooth/hci_conn.c |
2210 |
+@@ -1054,8 +1054,10 @@ struct hci_conn *hci_connect_le_scan(struct hci_dev *hdev, bdaddr_t *dst, |
2211 |
+ if (!conn) |
2212 |
+ return ERR_PTR(-ENOMEM); |
2213 |
+ |
2214 |
+- if (hci_explicit_conn_params_set(hdev, dst, dst_type) < 0) |
2215 |
++ if (hci_explicit_conn_params_set(hdev, dst, dst_type) < 0) { |
2216 |
++ hci_conn_del(conn); |
2217 |
+ return ERR_PTR(-EBUSY); |
2218 |
++ } |
2219 |
+ |
2220 |
+ conn->state = BT_CONNECT; |
2221 |
+ set_bit(HCI_CONN_SCANNING, &conn->flags); |
2222 |
+diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c |
2223 |
+index f63d9918b15a..ebdf1b0e576a 100644 |
2224 |
+--- a/net/bluetooth/l2cap_core.c |
2225 |
++++ b/net/bluetooth/l2cap_core.c |
2226 |
+@@ -4918,10 +4918,8 @@ void __l2cap_physical_cfm(struct l2cap_chan *chan, int result) |
2227 |
+ BT_DBG("chan %p, result %d, local_amp_id %d, remote_amp_id %d", |
2228 |
+ chan, result, local_amp_id, remote_amp_id); |
2229 |
+ |
2230 |
+- if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) { |
2231 |
+- l2cap_chan_unlock(chan); |
2232 |
++ if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) |
2233 |
+ return; |
2234 |
+- } |
2235 |
+ |
2236 |
+ if (chan->state != BT_CONNECTED) { |
2237 |
+ l2cap_do_create(chan, result, local_amp_id, remote_amp_id); |
2238 |
+diff --git a/net/core/neighbour.c b/net/core/neighbour.c |
2239 |
+index 2664ad58e5c0..16ac50b1b9a7 100644 |
2240 |
+--- a/net/core/neighbour.c |
2241 |
++++ b/net/core/neighbour.c |
2242 |
+@@ -1094,7 +1094,7 @@ static void neigh_update_hhs(struct neighbour *neigh) |
2243 |
+ |
2244 |
+ if (update) { |
2245 |
+ hh = &neigh->hh; |
2246 |
+- if (hh->hh_len) { |
2247 |
++ if (READ_ONCE(hh->hh_len)) { |
2248 |
+ write_seqlock_bh(&hh->hh_lock); |
2249 |
+ update(hh, neigh->dev, neigh->ha); |
2250 |
+ write_sequnlock_bh(&hh->hh_lock); |
2251 |
+@@ -1355,7 +1355,7 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb) |
2252 |
+ struct net_device *dev = neigh->dev; |
2253 |
+ unsigned int seq; |
2254 |
+ |
2255 |
+- if (dev->header_ops->cache && !neigh->hh.hh_len) |
2256 |
++ if (dev->header_ops->cache && !READ_ONCE(neigh->hh.hh_len)) |
2257 |
+ neigh_hh_init(neigh); |
2258 |
+ |
2259 |
+ do { |
2260 |
+diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c |
2261 |
+index eaeba9b99a73..7e0e5f2706ba 100644 |
2262 |
+--- a/net/ethernet/eth.c |
2263 |
++++ b/net/ethernet/eth.c |
2264 |
+@@ -239,7 +239,12 @@ int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 |
2265 |
+ eth->h_proto = type; |
2266 |
+ memcpy(eth->h_source, dev->dev_addr, ETH_ALEN); |
2267 |
+ memcpy(eth->h_dest, neigh->ha, ETH_ALEN); |
2268 |
+- hh->hh_len = ETH_HLEN; |
2269 |
++ |
2270 |
++ /* Pairs with READ_ONCE() in neigh_resolve_output(), |
2271 |
++ * neigh_hh_output() and neigh_update_hhs(). |
2272 |
++ */ |
2273 |
++ smp_store_release(&hh->hh_len, ETH_HLEN); |
2274 |
++ |
2275 |
+ return 0; |
2276 |
+ } |
2277 |
+ EXPORT_SYMBOL(eth_header_cache); |
2278 |
+diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c |
2279 |
+index 7f749505e699..7d73e8ce6660 100644 |
2280 |
+--- a/net/rxrpc/peer_event.c |
2281 |
++++ b/net/rxrpc/peer_event.c |
2282 |
+@@ -150,6 +150,9 @@ void rxrpc_error_report(struct sock *sk) |
2283 |
+ struct rxrpc_peer *peer; |
2284 |
+ struct sk_buff *skb; |
2285 |
+ |
2286 |
++ if (unlikely(!local)) |
2287 |
++ return; |
2288 |
++ |
2289 |
+ _enter("%p{%d}", sk, local->debug_id); |
2290 |
+ |
2291 |
+ skb = sock_dequeue_err_skb(sk); |
2292 |
+diff --git a/net/socket.c b/net/socket.c |
2293 |
+index aab65277314d..5b134a6b6216 100644 |
2294 |
+--- a/net/socket.c |
2295 |
++++ b/net/socket.c |
2296 |
+@@ -891,7 +891,7 @@ static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to) |
2297 |
+ .msg_iocb = iocb}; |
2298 |
+ ssize_t res; |
2299 |
+ |
2300 |
+- if (file->f_flags & O_NONBLOCK) |
2301 |
++ if (file->f_flags & O_NONBLOCK || (iocb->ki_flags & IOCB_NOWAIT)) |
2302 |
+ msg.msg_flags = MSG_DONTWAIT; |
2303 |
+ |
2304 |
+ if (iocb->ki_pos != 0) |
2305 |
+@@ -916,7 +916,7 @@ static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from) |
2306 |
+ if (iocb->ki_pos != 0) |
2307 |
+ return -ESPIPE; |
2308 |
+ |
2309 |
+- if (file->f_flags & O_NONBLOCK) |
2310 |
++ if (file->f_flags & O_NONBLOCK || (iocb->ki_flags & IOCB_NOWAIT)) |
2311 |
+ msg.msg_flags = MSG_DONTWAIT; |
2312 |
+ |
2313 |
+ if (sock->type == SOCK_SEQPACKET) |
2314 |
+diff --git a/sound/firewire/motu/motu-proc.c b/sound/firewire/motu/motu-proc.c |
2315 |
+index 4edc064999ed..706f1e982e36 100644 |
2316 |
+--- a/sound/firewire/motu/motu-proc.c |
2317 |
++++ b/sound/firewire/motu/motu-proc.c |
2318 |
+@@ -17,7 +17,7 @@ static const char *const clock_names[] = { |
2319 |
+ [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT] = "S/PDIF on optical interface", |
2320 |
+ [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_A] = "S/PDIF on optical interface A", |
2321 |
+ [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_B] = "S/PDIF on optical interface B", |
2322 |
+- [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX] = "S/PCIF on coaxial interface", |
2323 |
++ [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX] = "S/PDIF on coaxial interface", |
2324 |
+ [SND_MOTU_CLOCK_SOURCE_AESEBU_ON_XLR] = "AESEBU on XLR interface", |
2325 |
+ [SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC] = "Word clock on BNC interface", |
2326 |
+ }; |
2327 |
+diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c |
2328 |
+index 70559e59d18f..7d4e18cb6351 100644 |
2329 |
+--- a/sound/isa/cs423x/cs4236.c |
2330 |
++++ b/sound/isa/cs423x/cs4236.c |
2331 |
+@@ -293,7 +293,8 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev) |
2332 |
+ } else { |
2333 |
+ mpu_port[dev] = pnp_port_start(pdev, 0); |
2334 |
+ if (mpu_irq[dev] >= 0 && |
2335 |
+- pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) { |
2336 |
++ pnp_irq_valid(pdev, 0) && |
2337 |
++ pnp_irq(pdev, 0) != (resource_size_t)-1) { |
2338 |
+ mpu_irq[dev] = pnp_irq(pdev, 0); |
2339 |
+ } else { |
2340 |
+ mpu_irq[dev] = -1; /* disable interrupt */ |
2341 |
+diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c |
2342 |
+index 057c2f394ea7..41ea8e7b389a 100644 |
2343 |
+--- a/sound/pci/ice1712/ice1724.c |
2344 |
++++ b/sound/pci/ice1712/ice1724.c |
2345 |
+@@ -661,6 +661,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, |
2346 |
+ unsigned long flags; |
2347 |
+ unsigned char mclk_change; |
2348 |
+ unsigned int i, old_rate; |
2349 |
++ bool call_set_rate = false; |
2350 |
+ |
2351 |
+ if (rate > ice->hw_rates->list[ice->hw_rates->count - 1]) |
2352 |
+ return -EINVAL; |
2353 |
+@@ -684,7 +685,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, |
2354 |
+ * setting clock rate for internal clock mode */ |
2355 |
+ old_rate = ice->get_rate(ice); |
2356 |
+ if (force || (old_rate != rate)) |
2357 |
+- ice->set_rate(ice, rate); |
2358 |
++ call_set_rate = true; |
2359 |
+ else if (rate == ice->cur_rate) { |
2360 |
+ spin_unlock_irqrestore(&ice->reg_lock, flags); |
2361 |
+ return 0; |
2362 |
+@@ -692,12 +693,14 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, |
2363 |
+ } |
2364 |
+ |
2365 |
+ ice->cur_rate = rate; |
2366 |
++ spin_unlock_irqrestore(&ice->reg_lock, flags); |
2367 |
++ |
2368 |
++ if (call_set_rate) |
2369 |
++ ice->set_rate(ice, rate); |
2370 |
+ |
2371 |
+ /* setting master clock */ |
2372 |
+ mclk_change = ice->set_mclk(ice, rate); |
2373 |
+ |
2374 |
+- spin_unlock_irqrestore(&ice->reg_lock, flags); |
2375 |
+- |
2376 |
+ if (mclk_change && ice->gpio.i2s_mclk_changed) |
2377 |
+ ice->gpio.i2s_mclk_changed(ice); |
2378 |
+ if (ice->gpio.set_pro_rate) |
2379 |
+diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh |
2380 |
+index 891130daac7c..8a5066d98e72 100755 |
2381 |
+--- a/tools/testing/selftests/net/rtnetlink.sh |
2382 |
++++ b/tools/testing/selftests/net/rtnetlink.sh |
2383 |
+@@ -195,6 +195,26 @@ kci_test_route_get() |
2384 |
+ echo "PASS: route get" |
2385 |
+ } |
2386 |
+ |
2387 |
++kci_test_addrlft() |
2388 |
++{ |
2389 |
++ for i in $(seq 10 100) ;do |
2390 |
++ lft=$(((RANDOM%3) + 1)) |
2391 |
++ ip addr add 10.23.11.$i/32 dev "$devdummy" preferred_lft $lft valid_lft $((lft+1)) |
2392 |
++ check_err $? |
2393 |
++ done |
2394 |
++ |
2395 |
++ sleep 5 |
2396 |
++ |
2397 |
++ ip addr show dev "$devdummy" | grep "10.23.11." |
2398 |
++ if [ $? -eq 0 ]; then |
2399 |
++ echo "FAIL: preferred_lft addresses remaining" |
2400 |
++ check_err 1 |
2401 |
++ return |
2402 |
++ fi |
2403 |
++ |
2404 |
++ echo "PASS: preferred_lft addresses have expired" |
2405 |
++} |
2406 |
++ |
2407 |
+ kci_test_addrlabel() |
2408 |
+ { |
2409 |
+ ret=0 |
2410 |
+@@ -245,6 +265,7 @@ kci_test_rtnl() |
2411 |
+ |
2412 |
+ kci_test_polrouting |
2413 |
+ kci_test_route_get |
2414 |
++ kci_test_addrlft |
2415 |
+ kci_test_tc |
2416 |
+ kci_test_gre |
2417 |
+ kci_test_bridge |