1 |
commit: 1c7a6b1bfbd50f52704f439af51a76744baa1cae |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Dec 2 12:49:30 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 2 12:49:30 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=1c7a6b1b |
7 |
|
8 |
Linux patch 4.19.161 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1160_linux-4.19.161.patch | 2290 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2294 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 4c3c996..bb6e712 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -679,6 +679,10 @@ Patch: 1159_linux-4.19.160.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.19.160 |
23 |
|
24 |
+Patch: 1160_linux-4.19.161.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.19.161 |
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/1160_linux-4.19.161.patch b/1160_linux-4.19.161.patch |
33 |
new file mode 100644 |
34 |
index 0000000..168587e |
35 |
--- /dev/null |
36 |
+++ b/1160_linux-4.19.161.patch |
37 |
@@ -0,0 +1,2290 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index c587114984229..84807cee57b88 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 19 |
46 |
+-SUBLEVEL = 160 |
47 |
++SUBLEVEL = 161 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = "People's Front" |
50 |
+ |
51 |
+diff --git a/arch/arm/boot/dts/dra76x.dtsi b/arch/arm/boot/dts/dra76x.dtsi |
52 |
+index 216e1d1a69c7d..473d6721b7887 100644 |
53 |
+--- a/arch/arm/boot/dts/dra76x.dtsi |
54 |
++++ b/arch/arm/boot/dts/dra76x.dtsi |
55 |
+@@ -35,8 +35,8 @@ |
56 |
+ interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>, |
57 |
+ <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>; |
58 |
+ interrupt-names = "int0", "int1"; |
59 |
+- clocks = <&mcan_clk>, <&l3_iclk_div>; |
60 |
+- clock-names = "cclk", "hclk"; |
61 |
++ clocks = <&l3_iclk_div>, <&mcan_clk>; |
62 |
++ clock-names = "hclk", "cclk"; |
63 |
+ bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>; |
64 |
+ }; |
65 |
+ }; |
66 |
+diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h |
67 |
+index 291fed0a9df82..f43519b710610 100644 |
68 |
+--- a/arch/arm64/include/asm/pgtable.h |
69 |
++++ b/arch/arm64/include/asm/pgtable.h |
70 |
+@@ -107,8 +107,6 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
71 |
+ #define pte_valid(pte) (!!(pte_val(pte) & PTE_VALID)) |
72 |
+ #define pte_valid_not_user(pte) \ |
73 |
+ ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID) |
74 |
+-#define pte_valid_young(pte) \ |
75 |
+- ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF)) |
76 |
+ #define pte_valid_user(pte) \ |
77 |
+ ((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER)) |
78 |
+ |
79 |
+@@ -116,9 +114,12 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
80 |
+ * Could the pte be present in the TLB? We must check mm_tlb_flush_pending |
81 |
+ * so that we don't erroneously return false for pages that have been |
82 |
+ * remapped as PROT_NONE but are yet to be flushed from the TLB. |
83 |
++ * Note that we can't make any assumptions based on the state of the access |
84 |
++ * flag, since ptep_clear_flush_young() elides a DSB when invalidating the |
85 |
++ * TLB. |
86 |
+ */ |
87 |
+ #define pte_accessible(mm, pte) \ |
88 |
+- (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid_young(pte)) |
89 |
++ (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid(pte)) |
90 |
+ |
91 |
+ /* |
92 |
+ * p??_access_permitted() is true for valid user mappings (subject to the |
93 |
+@@ -144,13 +145,6 @@ static inline pte_t set_pte_bit(pte_t pte, pgprot_t prot) |
94 |
+ return pte; |
95 |
+ } |
96 |
+ |
97 |
+-static inline pte_t pte_wrprotect(pte_t pte) |
98 |
+-{ |
99 |
+- pte = clear_pte_bit(pte, __pgprot(PTE_WRITE)); |
100 |
+- pte = set_pte_bit(pte, __pgprot(PTE_RDONLY)); |
101 |
+- return pte; |
102 |
+-} |
103 |
+- |
104 |
+ static inline pte_t pte_mkwrite(pte_t pte) |
105 |
+ { |
106 |
+ pte = set_pte_bit(pte, __pgprot(PTE_WRITE)); |
107 |
+@@ -176,6 +170,20 @@ static inline pte_t pte_mkdirty(pte_t pte) |
108 |
+ return pte; |
109 |
+ } |
110 |
+ |
111 |
++static inline pte_t pte_wrprotect(pte_t pte) |
112 |
++{ |
113 |
++ /* |
114 |
++ * If hardware-dirty (PTE_WRITE/DBM bit set and PTE_RDONLY |
115 |
++ * clear), set the PTE_DIRTY bit. |
116 |
++ */ |
117 |
++ if (pte_hw_dirty(pte)) |
118 |
++ pte = pte_mkdirty(pte); |
119 |
++ |
120 |
++ pte = clear_pte_bit(pte, __pgprot(PTE_WRITE)); |
121 |
++ pte = set_pte_bit(pte, __pgprot(PTE_RDONLY)); |
122 |
++ return pte; |
123 |
++} |
124 |
++ |
125 |
+ static inline pte_t pte_mkold(pte_t pte) |
126 |
+ { |
127 |
+ return clear_pte_bit(pte, __pgprot(PTE_AF)); |
128 |
+@@ -668,12 +676,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres |
129 |
+ pte = READ_ONCE(*ptep); |
130 |
+ do { |
131 |
+ old_pte = pte; |
132 |
+- /* |
133 |
+- * If hardware-dirty (PTE_WRITE/DBM bit set and PTE_RDONLY |
134 |
+- * clear), set the PTE_DIRTY bit. |
135 |
+- */ |
136 |
+- if (pte_hw_dirty(pte)) |
137 |
+- pte = pte_mkdirty(pte); |
138 |
+ pte = pte_wrprotect(pte); |
139 |
+ pte_val(pte) = cmpxchg_relaxed(&pte_val(*ptep), |
140 |
+ pte_val(old_pte), pte_val(pte)); |
141 |
+diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c |
142 |
+index 4a650eb3d94a3..3b3cd12c06920 100644 |
143 |
+--- a/arch/x86/events/intel/cstate.c |
144 |
++++ b/arch/x86/events/intel/cstate.c |
145 |
+@@ -100,14 +100,14 @@ |
146 |
+ MODULE_LICENSE("GPL"); |
147 |
+ |
148 |
+ #define DEFINE_CSTATE_FORMAT_ATTR(_var, _name, _format) \ |
149 |
+-static ssize_t __cstate_##_var##_show(struct kobject *kobj, \ |
150 |
+- struct kobj_attribute *attr, \ |
151 |
++static ssize_t __cstate_##_var##_show(struct device *dev, \ |
152 |
++ struct device_attribute *attr, \ |
153 |
+ char *page) \ |
154 |
+ { \ |
155 |
+ BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ |
156 |
+ return sprintf(page, _format "\n"); \ |
157 |
+ } \ |
158 |
+-static struct kobj_attribute format_attr_##_var = \ |
159 |
++static struct device_attribute format_attr_##_var = \ |
160 |
+ __ATTR(_name, 0444, __cstate_##_var##_show, NULL) |
161 |
+ |
162 |
+ static ssize_t cstate_get_attr_cpumask(struct device *dev, |
163 |
+diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c |
164 |
+index 2413169ce3627..bc348663da94d 100644 |
165 |
+--- a/arch/x86/events/intel/rapl.c |
166 |
++++ b/arch/x86/events/intel/rapl.c |
167 |
+@@ -115,18 +115,6 @@ static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initconst = { |
168 |
+ * any other bit is reserved |
169 |
+ */ |
170 |
+ #define RAPL_EVENT_MASK 0xFFULL |
171 |
+- |
172 |
+-#define DEFINE_RAPL_FORMAT_ATTR(_var, _name, _format) \ |
173 |
+-static ssize_t __rapl_##_var##_show(struct kobject *kobj, \ |
174 |
+- struct kobj_attribute *attr, \ |
175 |
+- char *page) \ |
176 |
+-{ \ |
177 |
+- BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ |
178 |
+- return sprintf(page, _format "\n"); \ |
179 |
+-} \ |
180 |
+-static struct kobj_attribute format_attr_##_var = \ |
181 |
+- __ATTR(_name, 0444, __rapl_##_var##_show, NULL) |
182 |
+- |
183 |
+ #define RAPL_CNTR_WIDTH 32 |
184 |
+ |
185 |
+ #define RAPL_EVENT_ATTR_STR(_name, v, str) \ |
186 |
+@@ -548,7 +536,7 @@ static struct attribute_group rapl_pmu_events_group = { |
187 |
+ .attrs = NULL, /* patched at runtime */ |
188 |
+ }; |
189 |
+ |
190 |
+-DEFINE_RAPL_FORMAT_ATTR(event, event, "config:0-7"); |
191 |
++PMU_FORMAT_ATTR(event, "config:0-7"); |
192 |
+ static struct attribute *rapl_formats_attr[] = { |
193 |
+ &format_attr_event.attr, |
194 |
+ NULL, |
195 |
+diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c |
196 |
+index 7098b9b05d566..2f4ed5aa08bad 100644 |
197 |
+--- a/arch/x86/events/intel/uncore.c |
198 |
++++ b/arch/x86/events/intel/uncore.c |
199 |
+@@ -90,8 +90,8 @@ end: |
200 |
+ return map; |
201 |
+ } |
202 |
+ |
203 |
+-ssize_t uncore_event_show(struct kobject *kobj, |
204 |
+- struct kobj_attribute *attr, char *buf) |
205 |
++ssize_t uncore_event_show(struct device *dev, |
206 |
++ struct device_attribute *attr, char *buf) |
207 |
+ { |
208 |
+ struct uncore_event_desc *event = |
209 |
+ container_of(attr, struct uncore_event_desc, attr); |
210 |
+diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h |
211 |
+index 40e040ec31b50..0fc86ac73b511 100644 |
212 |
+--- a/arch/x86/events/intel/uncore.h |
213 |
++++ b/arch/x86/events/intel/uncore.h |
214 |
+@@ -133,7 +133,7 @@ struct intel_uncore_box { |
215 |
+ #define UNCORE_BOX_FLAG_CTL_OFFS8 1 /* event config registers are 8-byte apart */ |
216 |
+ |
217 |
+ struct uncore_event_desc { |
218 |
+- struct kobj_attribute attr; |
219 |
++ struct device_attribute attr; |
220 |
+ const char *config; |
221 |
+ }; |
222 |
+ |
223 |
+@@ -153,8 +153,8 @@ struct pci2phy_map { |
224 |
+ |
225 |
+ struct pci2phy_map *__find_pci2phy_map(int segment); |
226 |
+ |
227 |
+-ssize_t uncore_event_show(struct kobject *kobj, |
228 |
+- struct kobj_attribute *attr, char *buf); |
229 |
++ssize_t uncore_event_show(struct device *dev, |
230 |
++ struct device_attribute *attr, char *buf); |
231 |
+ |
232 |
+ #define INTEL_UNCORE_EVENT_DESC(_name, _config) \ |
233 |
+ { \ |
234 |
+@@ -163,14 +163,14 @@ ssize_t uncore_event_show(struct kobject *kobj, |
235 |
+ } |
236 |
+ |
237 |
+ #define DEFINE_UNCORE_FORMAT_ATTR(_var, _name, _format) \ |
238 |
+-static ssize_t __uncore_##_var##_show(struct kobject *kobj, \ |
239 |
+- struct kobj_attribute *attr, \ |
240 |
++static ssize_t __uncore_##_var##_show(struct device *dev, \ |
241 |
++ struct device_attribute *attr, \ |
242 |
+ char *page) \ |
243 |
+ { \ |
244 |
+ BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ |
245 |
+ return sprintf(page, _format "\n"); \ |
246 |
+ } \ |
247 |
+-static struct kobj_attribute format_attr_##_var = \ |
248 |
++static struct device_attribute format_attr_##_var = \ |
249 |
+ __ATTR(_name, 0444, __uncore_##_var##_show, NULL) |
250 |
+ |
251 |
+ static inline bool uncore_pmc_fixed(int idx) |
252 |
+diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h |
253 |
+index 4876411a072a7..98b74711e6b74 100644 |
254 |
+--- a/arch/x86/include/asm/kvm_host.h |
255 |
++++ b/arch/x86/include/asm/kvm_host.h |
256 |
+@@ -1472,6 +1472,7 @@ int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); |
257 |
+ void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); |
258 |
+ int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v); |
259 |
+ int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu); |
260 |
++int kvm_cpu_has_extint(struct kvm_vcpu *v); |
261 |
+ int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu); |
262 |
+ int kvm_cpu_get_interrupt(struct kvm_vcpu *v); |
263 |
+ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event); |
264 |
+diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c |
265 |
+index 9e482fbdb28fb..c524fa1f4c0e6 100644 |
266 |
+--- a/arch/x86/kernel/cpu/bugs.c |
267 |
++++ b/arch/x86/kernel/cpu/bugs.c |
268 |
+@@ -733,11 +733,13 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd) |
269 |
+ if (boot_cpu_has(X86_FEATURE_IBPB)) { |
270 |
+ setup_force_cpu_cap(X86_FEATURE_USE_IBPB); |
271 |
+ |
272 |
++ spectre_v2_user_ibpb = mode; |
273 |
+ switch (cmd) { |
274 |
+ case SPECTRE_V2_USER_CMD_FORCE: |
275 |
+ case SPECTRE_V2_USER_CMD_PRCTL_IBPB: |
276 |
+ case SPECTRE_V2_USER_CMD_SECCOMP_IBPB: |
277 |
+ static_branch_enable(&switch_mm_always_ibpb); |
278 |
++ spectre_v2_user_ibpb = SPECTRE_V2_USER_STRICT; |
279 |
+ break; |
280 |
+ case SPECTRE_V2_USER_CMD_PRCTL: |
281 |
+ case SPECTRE_V2_USER_CMD_AUTO: |
282 |
+@@ -751,8 +753,6 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd) |
283 |
+ pr_info("mitigation: Enabling %s Indirect Branch Prediction Barrier\n", |
284 |
+ static_key_enabled(&switch_mm_always_ibpb) ? |
285 |
+ "always-on" : "conditional"); |
286 |
+- |
287 |
+- spectre_v2_user_ibpb = mode; |
288 |
+ } |
289 |
+ |
290 |
+ /* |
291 |
+diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c |
292 |
+index e62e416dd1162..12083f200e096 100644 |
293 |
+--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c |
294 |
++++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c |
295 |
+@@ -515,6 +515,24 @@ unlock: |
296 |
+ return ret ?: nbytes; |
297 |
+ } |
298 |
+ |
299 |
++/** |
300 |
++ * rdtgroup_remove - the helper to remove resource group safely |
301 |
++ * @rdtgrp: resource group to remove |
302 |
++ * |
303 |
++ * On resource group creation via a mkdir, an extra kernfs_node reference is |
304 |
++ * taken to ensure that the rdtgroup structure remains accessible for the |
305 |
++ * rdtgroup_kn_unlock() calls where it is removed. |
306 |
++ * |
307 |
++ * Drop the extra reference here, then free the rdtgroup structure. |
308 |
++ * |
309 |
++ * Return: void |
310 |
++ */ |
311 |
++static void rdtgroup_remove(struct rdtgroup *rdtgrp) |
312 |
++{ |
313 |
++ kernfs_put(rdtgrp->kn); |
314 |
++ kfree(rdtgrp); |
315 |
++} |
316 |
++ |
317 |
+ struct task_move_callback { |
318 |
+ struct callback_head work; |
319 |
+ struct rdtgroup *rdtgrp; |
320 |
+@@ -537,7 +555,7 @@ static void move_myself(struct callback_head *head) |
321 |
+ (rdtgrp->flags & RDT_DELETED)) { |
322 |
+ current->closid = 0; |
323 |
+ current->rmid = 0; |
324 |
+- kfree(rdtgrp); |
325 |
++ rdtgroup_remove(rdtgrp); |
326 |
+ } |
327 |
+ |
328 |
+ preempt_disable(); |
329 |
+@@ -1626,7 +1644,6 @@ static int rdtgroup_mkdir_info_resdir(struct rdt_resource *r, char *name, |
330 |
+ if (IS_ERR(kn_subdir)) |
331 |
+ return PTR_ERR(kn_subdir); |
332 |
+ |
333 |
+- kernfs_get(kn_subdir); |
334 |
+ ret = rdtgroup_kn_set_ugid(kn_subdir); |
335 |
+ if (ret) |
336 |
+ return ret; |
337 |
+@@ -1649,7 +1666,6 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) |
338 |
+ kn_info = kernfs_create_dir(parent_kn, "info", parent_kn->mode, NULL); |
339 |
+ if (IS_ERR(kn_info)) |
340 |
+ return PTR_ERR(kn_info); |
341 |
+- kernfs_get(kn_info); |
342 |
+ |
343 |
+ ret = rdtgroup_add_files(kn_info, RF_TOP_INFO); |
344 |
+ if (ret) |
345 |
+@@ -1670,12 +1686,6 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) |
346 |
+ goto out_destroy; |
347 |
+ } |
348 |
+ |
349 |
+- /* |
350 |
+- * This extra ref will be put in kernfs_remove() and guarantees |
351 |
+- * that @rdtgrp->kn is always accessible. |
352 |
+- */ |
353 |
+- kernfs_get(kn_info); |
354 |
+- |
355 |
+ ret = rdtgroup_kn_set_ugid(kn_info); |
356 |
+ if (ret) |
357 |
+ goto out_destroy; |
358 |
+@@ -1704,12 +1714,6 @@ mongroup_create_dir(struct kernfs_node *parent_kn, struct rdtgroup *prgrp, |
359 |
+ if (dest_kn) |
360 |
+ *dest_kn = kn; |
361 |
+ |
362 |
+- /* |
363 |
+- * This extra ref will be put in kernfs_remove() and guarantees |
364 |
+- * that @rdtgrp->kn is always accessible. |
365 |
+- */ |
366 |
+- kernfs_get(kn); |
367 |
+- |
368 |
+ ret = rdtgroup_kn_set_ugid(kn); |
369 |
+ if (ret) |
370 |
+ goto out_destroy; |
371 |
+@@ -1973,8 +1977,7 @@ void rdtgroup_kn_unlock(struct kernfs_node *kn) |
372 |
+ rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) |
373 |
+ rdtgroup_pseudo_lock_remove(rdtgrp); |
374 |
+ kernfs_unbreak_active_protection(kn); |
375 |
+- kernfs_put(rdtgrp->kn); |
376 |
+- kfree(rdtgrp); |
377 |
++ rdtgroup_remove(rdtgrp); |
378 |
+ } else { |
379 |
+ kernfs_unbreak_active_protection(kn); |
380 |
+ } |
381 |
+@@ -2025,7 +2028,6 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type, |
382 |
+ dentry = ERR_PTR(ret); |
383 |
+ goto out_info; |
384 |
+ } |
385 |
+- kernfs_get(kn_mongrp); |
386 |
+ |
387 |
+ ret = mkdir_mondata_all(rdtgroup_default.kn, |
388 |
+ &rdtgroup_default, &kn_mondata); |
389 |
+@@ -2033,7 +2035,6 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type, |
390 |
+ dentry = ERR_PTR(ret); |
391 |
+ goto out_mongrp; |
392 |
+ } |
393 |
+- kernfs_get(kn_mondata); |
394 |
+ rdtgroup_default.mon.mon_data_kn = kn_mondata; |
395 |
+ } |
396 |
+ |
397 |
+@@ -2185,7 +2186,7 @@ static void free_all_child_rdtgrp(struct rdtgroup *rdtgrp) |
398 |
+ if (atomic_read(&sentry->waitcount) != 0) |
399 |
+ sentry->flags = RDT_DELETED; |
400 |
+ else |
401 |
+- kfree(sentry); |
402 |
++ rdtgroup_remove(sentry); |
403 |
+ } |
404 |
+ } |
405 |
+ |
406 |
+@@ -2227,7 +2228,7 @@ static void rmdir_all_sub(void) |
407 |
+ if (atomic_read(&rdtgrp->waitcount) != 0) |
408 |
+ rdtgrp->flags = RDT_DELETED; |
409 |
+ else |
410 |
+- kfree(rdtgrp); |
411 |
++ rdtgroup_remove(rdtgrp); |
412 |
+ } |
413 |
+ /* Notify online CPUs to update per cpu storage and PQR_ASSOC MSR */ |
414 |
+ update_closid_rmid(cpu_online_mask, &rdtgroup_default); |
415 |
+@@ -2326,11 +2327,6 @@ static int mkdir_mondata_subdir(struct kernfs_node *parent_kn, |
416 |
+ if (IS_ERR(kn)) |
417 |
+ return PTR_ERR(kn); |
418 |
+ |
419 |
+- /* |
420 |
+- * This extra ref will be put in kernfs_remove() and guarantees |
421 |
+- * that kn is always accessible. |
422 |
+- */ |
423 |
+- kernfs_get(kn); |
424 |
+ ret = rdtgroup_kn_set_ugid(kn); |
425 |
+ if (ret) |
426 |
+ goto out_destroy; |
427 |
+@@ -2622,8 +2618,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, |
428 |
+ /* |
429 |
+ * kernfs_remove() will drop the reference count on "kn" which |
430 |
+ * will free it. But we still need it to stick around for the |
431 |
+- * rdtgroup_kn_unlock(kn} call below. Take one extra reference |
432 |
+- * here, which will be dropped inside rdtgroup_kn_unlock(). |
433 |
++ * rdtgroup_kn_unlock(kn) call. Take one extra reference here, |
434 |
++ * which will be dropped by kernfs_put() in rdtgroup_remove(). |
435 |
+ */ |
436 |
+ kernfs_get(kn); |
437 |
+ |
438 |
+@@ -2664,6 +2660,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, |
439 |
+ out_idfree: |
440 |
+ free_rmid(rdtgrp->mon.rmid); |
441 |
+ out_destroy: |
442 |
++ kernfs_put(rdtgrp->kn); |
443 |
+ kernfs_remove(rdtgrp->kn); |
444 |
+ out_free_rgrp: |
445 |
+ kfree(rdtgrp); |
446 |
+@@ -2676,7 +2673,7 @@ static void mkdir_rdt_prepare_clean(struct rdtgroup *rgrp) |
447 |
+ { |
448 |
+ kernfs_remove(rgrp->kn); |
449 |
+ free_rmid(rgrp->mon.rmid); |
450 |
+- kfree(rgrp); |
451 |
++ rdtgroup_remove(rgrp); |
452 |
+ } |
453 |
+ |
454 |
+ /* |
455 |
+@@ -2838,11 +2835,6 @@ static int rdtgroup_rmdir_mon(struct kernfs_node *kn, struct rdtgroup *rdtgrp, |
456 |
+ WARN_ON(list_empty(&prdtgrp->mon.crdtgrp_list)); |
457 |
+ list_del(&rdtgrp->mon.crdtgrp_list); |
458 |
+ |
459 |
+- /* |
460 |
+- * one extra hold on this, will drop when we kfree(rdtgrp) |
461 |
+- * in rdtgroup_kn_unlock() |
462 |
+- */ |
463 |
+- kernfs_get(kn); |
464 |
+ kernfs_remove(rdtgrp->kn); |
465 |
+ |
466 |
+ return 0; |
467 |
+@@ -2854,11 +2846,6 @@ static int rdtgroup_ctrl_remove(struct kernfs_node *kn, |
468 |
+ rdtgrp->flags = RDT_DELETED; |
469 |
+ list_del(&rdtgrp->rdtgroup_list); |
470 |
+ |
471 |
+- /* |
472 |
+- * one extra hold on this, will drop when we kfree(rdtgrp) |
473 |
+- * in rdtgroup_kn_unlock() |
474 |
+- */ |
475 |
+- kernfs_get(kn); |
476 |
+ kernfs_remove(rdtgrp->kn); |
477 |
+ return 0; |
478 |
+ } |
479 |
+diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c |
480 |
+index 007bc654f928a..295ebadb8f2c1 100644 |
481 |
+--- a/arch/x86/kvm/irq.c |
482 |
++++ b/arch/x86/kvm/irq.c |
483 |
+@@ -52,29 +52,10 @@ static int pending_userspace_extint(struct kvm_vcpu *v) |
484 |
+ * check if there is pending interrupt from |
485 |
+ * non-APIC source without intack. |
486 |
+ */ |
487 |
+-static int kvm_cpu_has_extint(struct kvm_vcpu *v) |
488 |
+-{ |
489 |
+- u8 accept = kvm_apic_accept_pic_intr(v); |
490 |
+- |
491 |
+- if (accept) { |
492 |
+- if (irqchip_split(v->kvm)) |
493 |
+- return pending_userspace_extint(v); |
494 |
+- else |
495 |
+- return v->kvm->arch.vpic->output; |
496 |
+- } else |
497 |
+- return 0; |
498 |
+-} |
499 |
+- |
500 |
+-/* |
501 |
+- * check if there is injectable interrupt: |
502 |
+- * when virtual interrupt delivery enabled, |
503 |
+- * interrupt from apic will handled by hardware, |
504 |
+- * we don't need to check it here. |
505 |
+- */ |
506 |
+-int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) |
507 |
++int kvm_cpu_has_extint(struct kvm_vcpu *v) |
508 |
+ { |
509 |
+ /* |
510 |
+- * FIXME: interrupt.injected represents an interrupt that it's |
511 |
++ * FIXME: interrupt.injected represents an interrupt whose |
512 |
+ * side-effects have already been applied (e.g. bit from IRR |
513 |
+ * already moved to ISR). Therefore, it is incorrect to rely |
514 |
+ * on interrupt.injected to know if there is a pending |
515 |
+@@ -87,6 +68,23 @@ int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) |
516 |
+ if (!lapic_in_kernel(v)) |
517 |
+ return v->arch.interrupt.injected; |
518 |
+ |
519 |
++ if (!kvm_apic_accept_pic_intr(v)) |
520 |
++ return 0; |
521 |
++ |
522 |
++ if (irqchip_split(v->kvm)) |
523 |
++ return pending_userspace_extint(v); |
524 |
++ else |
525 |
++ return v->kvm->arch.vpic->output; |
526 |
++} |
527 |
++ |
528 |
++/* |
529 |
++ * check if there is injectable interrupt: |
530 |
++ * when virtual interrupt delivery enabled, |
531 |
++ * interrupt from apic will handled by hardware, |
532 |
++ * we don't need to check it here. |
533 |
++ */ |
534 |
++int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) |
535 |
++{ |
536 |
+ if (kvm_cpu_has_extint(v)) |
537 |
+ return 1; |
538 |
+ |
539 |
+@@ -102,20 +100,6 @@ int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) |
540 |
+ */ |
541 |
+ int kvm_cpu_has_interrupt(struct kvm_vcpu *v) |
542 |
+ { |
543 |
+- /* |
544 |
+- * FIXME: interrupt.injected represents an interrupt that it's |
545 |
+- * side-effects have already been applied (e.g. bit from IRR |
546 |
+- * already moved to ISR). Therefore, it is incorrect to rely |
547 |
+- * on interrupt.injected to know if there is a pending |
548 |
+- * interrupt in the user-mode LAPIC. |
549 |
+- * This leads to nVMX/nSVM not be able to distinguish |
550 |
+- * if it should exit from L2 to L1 on EXTERNAL_INTERRUPT on |
551 |
+- * pending interrupt or should re-inject an injected |
552 |
+- * interrupt. |
553 |
+- */ |
554 |
+- if (!lapic_in_kernel(v)) |
555 |
+- return v->arch.interrupt.injected; |
556 |
+- |
557 |
+ if (kvm_cpu_has_extint(v)) |
558 |
+ return 1; |
559 |
+ |
560 |
+@@ -129,16 +113,21 @@ EXPORT_SYMBOL_GPL(kvm_cpu_has_interrupt); |
561 |
+ */ |
562 |
+ static int kvm_cpu_get_extint(struct kvm_vcpu *v) |
563 |
+ { |
564 |
+- if (kvm_cpu_has_extint(v)) { |
565 |
+- if (irqchip_split(v->kvm)) { |
566 |
+- int vector = v->arch.pending_external_vector; |
567 |
+- |
568 |
+- v->arch.pending_external_vector = -1; |
569 |
+- return vector; |
570 |
+- } else |
571 |
+- return kvm_pic_read_irq(v->kvm); /* PIC */ |
572 |
+- } else |
573 |
++ if (!kvm_cpu_has_extint(v)) { |
574 |
++ WARN_ON(!lapic_in_kernel(v)); |
575 |
+ return -1; |
576 |
++ } |
577 |
++ |
578 |
++ if (!lapic_in_kernel(v)) |
579 |
++ return v->arch.interrupt.nr; |
580 |
++ |
581 |
++ if (irqchip_split(v->kvm)) { |
582 |
++ int vector = v->arch.pending_external_vector; |
583 |
++ |
584 |
++ v->arch.pending_external_vector = -1; |
585 |
++ return vector; |
586 |
++ } else |
587 |
++ return kvm_pic_read_irq(v->kvm); /* PIC */ |
588 |
+ } |
589 |
+ |
590 |
+ /* |
591 |
+@@ -146,13 +135,7 @@ static int kvm_cpu_get_extint(struct kvm_vcpu *v) |
592 |
+ */ |
593 |
+ int kvm_cpu_get_interrupt(struct kvm_vcpu *v) |
594 |
+ { |
595 |
+- int vector; |
596 |
+- |
597 |
+- if (!lapic_in_kernel(v)) |
598 |
+- return v->arch.interrupt.nr; |
599 |
+- |
600 |
+- vector = kvm_cpu_get_extint(v); |
601 |
+- |
602 |
++ int vector = kvm_cpu_get_extint(v); |
603 |
+ if (vector != -1) |
604 |
+ return vector; /* PIC */ |
605 |
+ |
606 |
+diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
607 |
+index bba2f76c356dd..56a4b9762b0c1 100644 |
608 |
+--- a/arch/x86/kvm/lapic.c |
609 |
++++ b/arch/x86/kvm/lapic.c |
610 |
+@@ -2284,7 +2284,7 @@ int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu) |
611 |
+ struct kvm_lapic *apic = vcpu->arch.apic; |
612 |
+ u32 ppr; |
613 |
+ |
614 |
+- if (!kvm_apic_hw_enabled(apic)) |
615 |
++ if (!kvm_apic_present(vcpu)) |
616 |
+ return -1; |
617 |
+ |
618 |
+ __apic_update_ppr(apic, &ppr); |
619 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
620 |
+index dd182228be714..7096578ef7370 100644 |
621 |
+--- a/arch/x86/kvm/x86.c |
622 |
++++ b/arch/x86/kvm/x86.c |
623 |
+@@ -3351,21 +3351,23 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu, |
624 |
+ |
625 |
+ static int kvm_cpu_accept_dm_intr(struct kvm_vcpu *vcpu) |
626 |
+ { |
627 |
++ /* |
628 |
++ * We can accept userspace's request for interrupt injection |
629 |
++ * as long as we have a place to store the interrupt number. |
630 |
++ * The actual injection will happen when the CPU is able to |
631 |
++ * deliver the interrupt. |
632 |
++ */ |
633 |
++ if (kvm_cpu_has_extint(vcpu)) |
634 |
++ return false; |
635 |
++ |
636 |
++ /* Acknowledging ExtINT does not happen if LINT0 is masked. */ |
637 |
+ return (!lapic_in_kernel(vcpu) || |
638 |
+ kvm_apic_accept_pic_intr(vcpu)); |
639 |
+ } |
640 |
+ |
641 |
+-/* |
642 |
+- * if userspace requested an interrupt window, check that the |
643 |
+- * interrupt window is open. |
644 |
+- * |
645 |
+- * No need to exit to userspace if we already have an interrupt queued. |
646 |
+- */ |
647 |
+ static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu *vcpu) |
648 |
+ { |
649 |
+ return kvm_arch_interrupt_allowed(vcpu) && |
650 |
+- !kvm_cpu_has_interrupt(vcpu) && |
651 |
+- !kvm_event_needs_reinjection(vcpu) && |
652 |
+ kvm_cpu_accept_dm_intr(vcpu); |
653 |
+ } |
654 |
+ |
655 |
+diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c |
656 |
+index 717b4847b473f..6fffb86a32add 100644 |
657 |
+--- a/arch/x86/xen/spinlock.c |
658 |
++++ b/arch/x86/xen/spinlock.c |
659 |
+@@ -101,10 +101,20 @@ void xen_init_lock_cpu(int cpu) |
660 |
+ |
661 |
+ void xen_uninit_lock_cpu(int cpu) |
662 |
+ { |
663 |
++ int irq; |
664 |
++ |
665 |
+ if (!xen_pvspin) |
666 |
+ return; |
667 |
+ |
668 |
+- unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL); |
669 |
++ /* |
670 |
++ * When booting the kernel with 'mitigations=auto,nosmt', the secondary |
671 |
++ * CPUs are not activated, and lock_kicker_irq is not initialized. |
672 |
++ */ |
673 |
++ irq = per_cpu(lock_kicker_irq, cpu); |
674 |
++ if (irq == -1) |
675 |
++ return; |
676 |
++ |
677 |
++ unbind_from_irqhandler(irq, NULL); |
678 |
+ per_cpu(lock_kicker_irq, cpu) = -1; |
679 |
+ kfree(per_cpu(irq_name, cpu)); |
680 |
+ per_cpu(irq_name, cpu) = NULL; |
681 |
+diff --git a/arch/xtensa/include/asm/uaccess.h b/arch/xtensa/include/asm/uaccess.h |
682 |
+index f1158b4c629cf..da4effe270072 100644 |
683 |
+--- a/arch/xtensa/include/asm/uaccess.h |
684 |
++++ b/arch/xtensa/include/asm/uaccess.h |
685 |
+@@ -291,7 +291,7 @@ strncpy_from_user(char *dst, const char *src, long count) |
686 |
+ return -EFAULT; |
687 |
+ } |
688 |
+ #else |
689 |
+-long strncpy_from_user(char *dst, const char *src, long count); |
690 |
++long strncpy_from_user(char *dst, const char __user *src, long count); |
691 |
+ #endif |
692 |
+ |
693 |
+ /* |
694 |
+diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c |
695 |
+index c564df713efc3..15b30d2d8f7ed 100644 |
696 |
+--- a/drivers/dma/pl330.c |
697 |
++++ b/drivers/dma/pl330.c |
698 |
+@@ -2774,7 +2774,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, |
699 |
+ * If burst size is smaller than bus width then make sure we only |
700 |
+ * transfer one at a time to avoid a burst stradling an MFIFO entry. |
701 |
+ */ |
702 |
+- if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width) |
703 |
++ if (burst * 8 < pl330->pcfg.data_bus_width) |
704 |
+ desc->rqcfg.brst_len = 1; |
705 |
+ |
706 |
+ desc->bytes_requested = len; |
707 |
+diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c |
708 |
+index d56b6b0e22a84..28592137fb67e 100644 |
709 |
+--- a/drivers/dma/xilinx/xilinx_dma.c |
710 |
++++ b/drivers/dma/xilinx/xilinx_dma.c |
711 |
+@@ -453,8 +453,8 @@ struct xilinx_dma_device { |
712 |
+ #define to_dma_tx_descriptor(tx) \ |
713 |
+ container_of(tx, struct xilinx_dma_tx_descriptor, async_tx) |
714 |
+ #define xilinx_dma_poll_timeout(chan, reg, val, cond, delay_us, timeout_us) \ |
715 |
+- readl_poll_timeout(chan->xdev->regs + chan->ctrl_offset + reg, val, \ |
716 |
+- cond, delay_us, timeout_us) |
717 |
++ readl_poll_timeout_atomic(chan->xdev->regs + chan->ctrl_offset + reg, \ |
718 |
++ val, cond, delay_us, timeout_us) |
719 |
+ |
720 |
+ /* IO accessors */ |
721 |
+ static inline u32 dma_read(struct xilinx_dma_chan *chan, u32 reg) |
722 |
+diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c |
723 |
+index 1a4b44923aeca..281cf9cbb44c4 100644 |
724 |
+--- a/drivers/gpu/drm/drm_atomic.c |
725 |
++++ b/drivers/gpu/drm/drm_atomic.c |
726 |
+@@ -1702,27 +1702,6 @@ drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state, |
727 |
+ struct drm_connector *connector = conn_state->connector; |
728 |
+ struct drm_crtc_state *crtc_state; |
729 |
+ |
730 |
+- /* |
731 |
+- * For compatibility with legacy users, we want to make sure that |
732 |
+- * we allow DPMS On<->Off modesets on unregistered connectors, since |
733 |
+- * legacy modesetting users will not be expecting these to fail. We do |
734 |
+- * not however, want to allow legacy users to assign a connector |
735 |
+- * that's been unregistered from sysfs to another CRTC, since doing |
736 |
+- * this with a now non-existent connector could potentially leave us |
737 |
+- * in an invalid state. |
738 |
+- * |
739 |
+- * Since the connector can be unregistered at any point during an |
740 |
+- * atomic check or commit, this is racy. But that's OK: all we care |
741 |
+- * about is ensuring that userspace can't use this connector for new |
742 |
+- * configurations after it's been notified that the connector is no |
743 |
+- * longer present. |
744 |
+- */ |
745 |
+- if (!READ_ONCE(connector->registered) && crtc) { |
746 |
+- DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] is not registered\n", |
747 |
+- connector->base.id, connector->name); |
748 |
+- return -EINVAL; |
749 |
+- } |
750 |
+- |
751 |
+ if (conn_state->crtc == crtc) |
752 |
+ return 0; |
753 |
+ |
754 |
+diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c |
755 |
+index c22062cc99923..d24a15484e31c 100644 |
756 |
+--- a/drivers/gpu/drm/drm_atomic_helper.c |
757 |
++++ b/drivers/gpu/drm/drm_atomic_helper.c |
758 |
+@@ -307,6 +307,26 @@ update_connector_routing(struct drm_atomic_state *state, |
759 |
+ return 0; |
760 |
+ } |
761 |
+ |
762 |
++ crtc_state = drm_atomic_get_new_crtc_state(state, |
763 |
++ new_connector_state->crtc); |
764 |
++ /* |
765 |
++ * For compatibility with legacy users, we want to make sure that |
766 |
++ * we allow DPMS On->Off modesets on unregistered connectors. Modesets |
767 |
++ * which would result in anything else must be considered invalid, to |
768 |
++ * avoid turning on new displays on dead connectors. |
769 |
++ * |
770 |
++ * Since the connector can be unregistered at any point during an |
771 |
++ * atomic check or commit, this is racy. But that's OK: all we care |
772 |
++ * about is ensuring that userspace can't do anything but shut off the |
773 |
++ * display on a connector that was destroyed after its been notified, |
774 |
++ * not before. |
775 |
++ */ |
776 |
++ if (drm_connector_is_unregistered(connector) && crtc_state->active) { |
777 |
++ DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] is not registered\n", |
778 |
++ connector->base.id, connector->name); |
779 |
++ return -EINVAL; |
780 |
++ } |
781 |
++ |
782 |
+ funcs = connector->helper_private; |
783 |
+ |
784 |
+ if (funcs->atomic_best_encoder) |
785 |
+@@ -351,7 +371,6 @@ update_connector_routing(struct drm_atomic_state *state, |
786 |
+ |
787 |
+ set_best_encoder(state, new_connector_state, new_encoder); |
788 |
+ |
789 |
+- crtc_state = drm_atomic_get_new_crtc_state(state, new_connector_state->crtc); |
790 |
+ crtc_state->connectors_changed = true; |
791 |
+ |
792 |
+ DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d:%s]\n", |
793 |
+diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c |
794 |
+index 6011d769d50bb..7bb68ca4aa0ba 100644 |
795 |
+--- a/drivers/gpu/drm/drm_connector.c |
796 |
++++ b/drivers/gpu/drm/drm_connector.c |
797 |
+@@ -375,7 +375,8 @@ void drm_connector_cleanup(struct drm_connector *connector) |
798 |
+ /* The connector should have been removed from userspace long before |
799 |
+ * it is finally destroyed. |
800 |
+ */ |
801 |
+- if (WARN_ON(connector->registered)) |
802 |
++ if (WARN_ON(connector->registration_state == |
803 |
++ DRM_CONNECTOR_REGISTERED)) |
804 |
+ drm_connector_unregister(connector); |
805 |
+ |
806 |
+ if (connector->tile_group) { |
807 |
+@@ -432,7 +433,7 @@ int drm_connector_register(struct drm_connector *connector) |
808 |
+ return 0; |
809 |
+ |
810 |
+ mutex_lock(&connector->mutex); |
811 |
+- if (connector->registered) |
812 |
++ if (connector->registration_state != DRM_CONNECTOR_INITIALIZING) |
813 |
+ goto unlock; |
814 |
+ |
815 |
+ ret = drm_sysfs_connector_add(connector); |
816 |
+@@ -452,7 +453,7 @@ int drm_connector_register(struct drm_connector *connector) |
817 |
+ |
818 |
+ drm_mode_object_register(connector->dev, &connector->base); |
819 |
+ |
820 |
+- connector->registered = true; |
821 |
++ connector->registration_state = DRM_CONNECTOR_REGISTERED; |
822 |
+ goto unlock; |
823 |
+ |
824 |
+ err_debugfs: |
825 |
+@@ -474,7 +475,7 @@ EXPORT_SYMBOL(drm_connector_register); |
826 |
+ void drm_connector_unregister(struct drm_connector *connector) |
827 |
+ { |
828 |
+ mutex_lock(&connector->mutex); |
829 |
+- if (!connector->registered) { |
830 |
++ if (connector->registration_state != DRM_CONNECTOR_REGISTERED) { |
831 |
+ mutex_unlock(&connector->mutex); |
832 |
+ return; |
833 |
+ } |
834 |
+@@ -485,7 +486,7 @@ void drm_connector_unregister(struct drm_connector *connector) |
835 |
+ drm_sysfs_connector_remove(connector); |
836 |
+ drm_debugfs_connector_remove(connector); |
837 |
+ |
838 |
+- connector->registered = false; |
839 |
++ connector->registration_state = DRM_CONNECTOR_UNREGISTERED; |
840 |
+ mutex_unlock(&connector->mutex); |
841 |
+ } |
842 |
+ EXPORT_SYMBOL(drm_connector_unregister); |
843 |
+diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c |
844 |
+index c7d52c66ff298..8a19cfcfc4f18 100644 |
845 |
+--- a/drivers/gpu/drm/i915/intel_dp_mst.c |
846 |
++++ b/drivers/gpu/drm/i915/intel_dp_mst.c |
847 |
+@@ -77,7 +77,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, |
848 |
+ pipe_config->pbn = mst_pbn; |
849 |
+ |
850 |
+ /* Zombie connectors can't have VCPI slots */ |
851 |
+- if (READ_ONCE(connector->registered)) { |
852 |
++ if (!drm_connector_is_unregistered(connector)) { |
853 |
+ slots = drm_dp_atomic_find_vcpi_slots(state, |
854 |
+ &intel_dp->mst_mgr, |
855 |
+ port, |
856 |
+@@ -317,7 +317,7 @@ static int intel_dp_mst_get_ddc_modes(struct drm_connector *connector) |
857 |
+ struct edid *edid; |
858 |
+ int ret; |
859 |
+ |
860 |
+- if (!READ_ONCE(connector->registered)) |
861 |
++ if (drm_connector_is_unregistered(connector)) |
862 |
+ return intel_connector_update_modes(connector, NULL); |
863 |
+ |
864 |
+ edid = drm_dp_mst_get_edid(connector, &intel_dp->mst_mgr, intel_connector->port); |
865 |
+@@ -333,7 +333,7 @@ intel_dp_mst_detect(struct drm_connector *connector, bool force) |
866 |
+ struct intel_connector *intel_connector = to_intel_connector(connector); |
867 |
+ struct intel_dp *intel_dp = intel_connector->mst_port; |
868 |
+ |
869 |
+- if (!READ_ONCE(connector->registered)) |
870 |
++ if (drm_connector_is_unregistered(connector)) |
871 |
+ return connector_status_disconnected; |
872 |
+ return drm_dp_mst_detect_port(connector, &intel_dp->mst_mgr, |
873 |
+ intel_connector->port); |
874 |
+@@ -376,7 +376,7 @@ intel_dp_mst_mode_valid(struct drm_connector *connector, |
875 |
+ int bpp = 24; /* MST uses fixed bpp */ |
876 |
+ int max_rate, mode_rate, max_lanes, max_link_clock; |
877 |
+ |
878 |
+- if (!READ_ONCE(connector->registered)) |
879 |
++ if (drm_connector_is_unregistered(connector)) |
880 |
+ return MODE_ERROR; |
881 |
+ |
882 |
+ if (mode->flags & DRM_MODE_FLAG_DBLSCAN) |
883 |
+diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c |
884 |
+index 1689568b597d4..12c5d7c96527a 100644 |
885 |
+--- a/drivers/hid/hid-cypress.c |
886 |
++++ b/drivers/hid/hid-cypress.c |
887 |
+@@ -26,19 +26,17 @@ |
888 |
+ #define CP_2WHEEL_MOUSE_HACK 0x02 |
889 |
+ #define CP_2WHEEL_MOUSE_HACK_ON 0x04 |
890 |
+ |
891 |
++#define VA_INVAL_LOGICAL_BOUNDARY 0x08 |
892 |
++ |
893 |
+ /* |
894 |
+ * Some USB barcode readers from cypress have usage min and usage max in |
895 |
+ * the wrong order |
896 |
+ */ |
897 |
+-static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
898 |
++static __u8 *cp_rdesc_fixup(struct hid_device *hdev, __u8 *rdesc, |
899 |
+ unsigned int *rsize) |
900 |
+ { |
901 |
+- unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); |
902 |
+ unsigned int i; |
903 |
+ |
904 |
+- if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX)) |
905 |
+- return rdesc; |
906 |
+- |
907 |
+ if (*rsize < 4) |
908 |
+ return rdesc; |
909 |
+ |
910 |
+@@ -51,6 +49,40 @@ static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
911 |
+ return rdesc; |
912 |
+ } |
913 |
+ |
914 |
++static __u8 *va_logical_boundary_fixup(struct hid_device *hdev, __u8 *rdesc, |
915 |
++ unsigned int *rsize) |
916 |
++{ |
917 |
++ /* |
918 |
++ * Varmilo VA104M (with VID Cypress and device ID 07B1) incorrectly |
919 |
++ * reports Logical Minimum of its Consumer Control device as 572 |
920 |
++ * (0x02 0x3c). Fix this by setting its Logical Minimum to zero. |
921 |
++ */ |
922 |
++ if (*rsize == 25 && |
923 |
++ rdesc[0] == 0x05 && rdesc[1] == 0x0c && |
924 |
++ rdesc[2] == 0x09 && rdesc[3] == 0x01 && |
925 |
++ rdesc[6] == 0x19 && rdesc[7] == 0x00 && |
926 |
++ rdesc[11] == 0x16 && rdesc[12] == 0x3c && rdesc[13] == 0x02) { |
927 |
++ hid_info(hdev, |
928 |
++ "fixing up varmilo VA104M consumer control report descriptor\n"); |
929 |
++ rdesc[12] = 0x00; |
930 |
++ rdesc[13] = 0x00; |
931 |
++ } |
932 |
++ return rdesc; |
933 |
++} |
934 |
++ |
935 |
++static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
936 |
++ unsigned int *rsize) |
937 |
++{ |
938 |
++ unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); |
939 |
++ |
940 |
++ if (quirks & CP_RDESC_SWAPPED_MIN_MAX) |
941 |
++ rdesc = cp_rdesc_fixup(hdev, rdesc, rsize); |
942 |
++ if (quirks & VA_INVAL_LOGICAL_BOUNDARY) |
943 |
++ rdesc = va_logical_boundary_fixup(hdev, rdesc, rsize); |
944 |
++ |
945 |
++ return rdesc; |
946 |
++} |
947 |
++ |
948 |
+ static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi, |
949 |
+ struct hid_field *field, struct hid_usage *usage, |
950 |
+ unsigned long **bit, int *max) |
951 |
+@@ -131,6 +163,8 @@ static const struct hid_device_id cp_devices[] = { |
952 |
+ .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, |
953 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE), |
954 |
+ .driver_data = CP_2WHEEL_MOUSE_HACK }, |
955 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_VARMILO_VA104M_07B1), |
956 |
++ .driver_data = VA_INVAL_LOGICAL_BOUNDARY }, |
957 |
+ { } |
958 |
+ }; |
959 |
+ MODULE_DEVICE_TABLE(hid, cp_devices); |
960 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
961 |
+index e18d796d985f8..6d118da1615d4 100644 |
962 |
+--- a/drivers/hid/hid-ids.h |
963 |
++++ b/drivers/hid/hid-ids.h |
964 |
+@@ -330,6 +330,8 @@ |
965 |
+ #define USB_DEVICE_ID_CYPRESS_BARCODE_4 0xed81 |
966 |
+ #define USB_DEVICE_ID_CYPRESS_TRUETOUCH 0xc001 |
967 |
+ |
968 |
++#define USB_DEVICE_ID_CYPRESS_VARMILO_VA104M_07B1 0X07b1 |
969 |
++ |
970 |
+ #define USB_VENDOR_ID_DATA_MODUL 0x7374 |
971 |
+ #define USB_VENDOR_ID_DATA_MODUL_EASYMAXTOUCH 0x1201 |
972 |
+ |
973 |
+@@ -442,6 +444,10 @@ |
974 |
+ #define USB_VENDOR_ID_FRUCTEL 0x25B6 |
975 |
+ #define USB_DEVICE_ID_GAMETEL_MT_MODE 0x0002 |
976 |
+ |
977 |
++#define USB_VENDOR_ID_GAMEVICE 0x27F8 |
978 |
++#define USB_DEVICE_ID_GAMEVICE_GV186 0x0BBE |
979 |
++#define USB_DEVICE_ID_GAMEVICE_KISHI 0x0BBF |
980 |
++ |
981 |
+ #define USB_VENDOR_ID_GAMERON 0x0810 |
982 |
+ #define USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR 0x0001 |
983 |
+ #define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002 |
984 |
+@@ -477,6 +483,7 @@ |
985 |
+ #define USB_DEVICE_ID_PENPOWER 0x00f4 |
986 |
+ |
987 |
+ #define USB_VENDOR_ID_GREENASIA 0x0e8f |
988 |
++#define USB_DEVICE_ID_GREENASIA_DUAL_SAT_ADAPTOR 0x3010 |
989 |
+ #define USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD 0x3013 |
990 |
+ |
991 |
+ #define USB_VENDOR_ID_GRETAGMACBETH 0x0971 |
992 |
+@@ -726,6 +733,7 @@ |
993 |
+ #define USB_VENDOR_ID_LOGITECH 0x046d |
994 |
+ #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e |
995 |
+ #define USB_DEVICE_ID_LOGITECH_T651 0xb00c |
996 |
++#define USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD 0xb309 |
997 |
+ #define USB_DEVICE_ID_LOGITECH_C007 0xc007 |
998 |
+ #define USB_DEVICE_ID_LOGITECH_C077 0xc077 |
999 |
+ #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 |
1000 |
+diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c |
1001 |
+index 11bd2ca22a2e6..13deb9a676855 100644 |
1002 |
+--- a/drivers/hid/hid-input.c |
1003 |
++++ b/drivers/hid/hid-input.c |
1004 |
+@@ -331,6 +331,9 @@ static const struct hid_device_id hid_battery_quirks[] = { |
1005 |
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ASUSTEK, |
1006 |
+ USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD), |
1007 |
+ HID_BATTERY_QUIRK_IGNORE }, |
1008 |
++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, |
1009 |
++ USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD), |
1010 |
++ HID_BATTERY_QUIRK_IGNORE }, |
1011 |
+ {} |
1012 |
+ }; |
1013 |
+ |
1014 |
+diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
1015 |
+index 2d8d20a7f4574..10cb42a00fe87 100644 |
1016 |
+--- a/drivers/hid/hid-quirks.c |
1017 |
++++ b/drivers/hid/hid-quirks.c |
1018 |
+@@ -85,7 +85,12 @@ static const struct hid_device_id hid_quirks[] = { |
1019 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER), HID_QUIRK_NO_INIT_REPORTS }, |
1020 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28), HID_QUIRK_NOGET }, |
1021 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_FUTABA, USB_DEVICE_ID_LED_DISPLAY), HID_QUIRK_NO_INIT_REPORTS }, |
1022 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_SAT_ADAPTOR), HID_QUIRK_MULTI_INPUT }, |
1023 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD), HID_QUIRK_MULTI_INPUT }, |
1024 |
++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_GAMEVICE, USB_DEVICE_ID_GAMEVICE_GV186), |
1025 |
++ HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
1026 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_GAMEVICE, USB_DEVICE_ID_GAMEVICE_KISHI), |
1027 |
++ HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
1028 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
1029 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
1030 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
1031 |
+diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c |
1032 |
+index 4256fdc5cd6d5..21fbdcde1faa1 100644 |
1033 |
+--- a/drivers/hid/hid-sensor-hub.c |
1034 |
++++ b/drivers/hid/hid-sensor-hub.c |
1035 |
+@@ -496,7 +496,8 @@ static int sensor_hub_raw_event(struct hid_device *hdev, |
1036 |
+ return 1; |
1037 |
+ |
1038 |
+ ptr = raw_data; |
1039 |
+- ptr++; /* Skip report id */ |
1040 |
++ if (report->id) |
1041 |
++ ptr++; /* Skip report id */ |
1042 |
+ |
1043 |
+ spin_lock_irqsave(&pdata->lock, flags); |
1044 |
+ |
1045 |
+diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c |
1046 |
+index a6531ffe29a6f..a5694dec3f2ee 100644 |
1047 |
+--- a/drivers/infiniband/hw/mthca/mthca_cq.c |
1048 |
++++ b/drivers/infiniband/hw/mthca/mthca_cq.c |
1049 |
+@@ -808,8 +808,10 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, |
1050 |
+ } |
1051 |
+ |
1052 |
+ mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); |
1053 |
+- if (IS_ERR(mailbox)) |
1054 |
++ if (IS_ERR(mailbox)) { |
1055 |
++ err = PTR_ERR(mailbox); |
1056 |
+ goto err_out_arm; |
1057 |
++ } |
1058 |
+ |
1059 |
+ cq_context = mailbox->buf; |
1060 |
+ |
1061 |
+@@ -851,9 +853,9 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, |
1062 |
+ } |
1063 |
+ |
1064 |
+ spin_lock_irq(&dev->cq_table.lock); |
1065 |
+- if (mthca_array_set(&dev->cq_table.cq, |
1066 |
+- cq->cqn & (dev->limits.num_cqs - 1), |
1067 |
+- cq)) { |
1068 |
++ err = mthca_array_set(&dev->cq_table.cq, |
1069 |
++ cq->cqn & (dev->limits.num_cqs - 1), cq); |
1070 |
++ if (err) { |
1071 |
+ spin_unlock_irq(&dev->cq_table.lock); |
1072 |
+ goto err_out_free_mr; |
1073 |
+ } |
1074 |
+diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c |
1075 |
+index 95a78ccbd8470..fef3b4064f187 100644 |
1076 |
+--- a/drivers/input/serio/i8042.c |
1077 |
++++ b/drivers/input/serio/i8042.c |
1078 |
+@@ -125,6 +125,7 @@ module_param_named(unmask_kbd_data, i8042_unmask_kbd_data, bool, 0600); |
1079 |
+ MODULE_PARM_DESC(unmask_kbd_data, "Unconditional enable (may reveal sensitive data) of normally sanitize-filtered kbd data traffic debug log [pre-condition: i8042.debug=1 enabled]"); |
1080 |
+ #endif |
1081 |
+ |
1082 |
++static bool i8042_present; |
1083 |
+ static bool i8042_bypass_aux_irq_test; |
1084 |
+ static char i8042_kbd_firmware_id[128]; |
1085 |
+ static char i8042_aux_firmware_id[128]; |
1086 |
+@@ -345,6 +346,9 @@ int i8042_command(unsigned char *param, int command) |
1087 |
+ unsigned long flags; |
1088 |
+ int retval; |
1089 |
+ |
1090 |
++ if (!i8042_present) |
1091 |
++ return -1; |
1092 |
++ |
1093 |
+ spin_lock_irqsave(&i8042_lock, flags); |
1094 |
+ retval = __i8042_command(param, command); |
1095 |
+ spin_unlock_irqrestore(&i8042_lock, flags); |
1096 |
+@@ -1613,12 +1617,15 @@ static int __init i8042_init(void) |
1097 |
+ |
1098 |
+ err = i8042_platform_init(); |
1099 |
+ if (err) |
1100 |
+- return err; |
1101 |
++ return (err == -ENODEV) ? 0 : err; |
1102 |
+ |
1103 |
+ err = i8042_controller_check(); |
1104 |
+ if (err) |
1105 |
+ goto err_platform_exit; |
1106 |
+ |
1107 |
++ /* Set this before creating the dev to allow i8042_command to work right away */ |
1108 |
++ i8042_present = true; |
1109 |
++ |
1110 |
+ pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, NULL, 0); |
1111 |
+ if (IS_ERR(pdev)) { |
1112 |
+ err = PTR_ERR(pdev); |
1113 |
+@@ -1637,6 +1644,9 @@ static int __init i8042_init(void) |
1114 |
+ |
1115 |
+ static void __exit i8042_exit(void) |
1116 |
+ { |
1117 |
++ if (!i8042_present) |
1118 |
++ return; |
1119 |
++ |
1120 |
+ platform_device_unregister(i8042_platform_device); |
1121 |
+ platform_driver_unregister(&i8042_driver); |
1122 |
+ i8042_platform_exit(); |
1123 |
+diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c |
1124 |
+index efaa342600c41..fbb970220c2d7 100644 |
1125 |
+--- a/drivers/net/can/m_can/m_can.c |
1126 |
++++ b/drivers/net/can/m_can/m_can.c |
1127 |
+@@ -976,7 +976,7 @@ static const struct can_bittiming_const m_can_bittiming_const_31X = { |
1128 |
+ .name = KBUILD_MODNAME, |
1129 |
+ .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ |
1130 |
+ .tseg1_max = 256, |
1131 |
+- .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ |
1132 |
++ .tseg2_min = 2, /* Time segment 2 = phase_seg2 */ |
1133 |
+ .tseg2_max = 128, |
1134 |
+ .sjw_max = 128, |
1135 |
+ .brp_min = 1, |
1136 |
+diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c |
1137 |
+index cc2e224661b30..6a57169c27158 100644 |
1138 |
+--- a/drivers/net/can/usb/gs_usb.c |
1139 |
++++ b/drivers/net/can/usb/gs_usb.c |
1140 |
+@@ -71,21 +71,27 @@ enum gs_can_identify_mode { |
1141 |
+ }; |
1142 |
+ |
1143 |
+ /* data types passed between host and device */ |
1144 |
++ |
1145 |
++/* The firmware on the original USB2CAN by Geschwister Schneider |
1146 |
++ * Technologie Entwicklungs- und Vertriebs UG exchanges all data |
1147 |
++ * between the host and the device in host byte order. This is done |
1148 |
++ * with the struct gs_host_config::byte_order member, which is sent |
1149 |
++ * first to indicate the desired byte order. |
1150 |
++ * |
1151 |
++ * The widely used open source firmware candleLight doesn't support |
1152 |
++ * this feature and exchanges the data in little endian byte order. |
1153 |
++ */ |
1154 |
+ struct gs_host_config { |
1155 |
+- u32 byte_order; |
1156 |
++ __le32 byte_order; |
1157 |
+ } __packed; |
1158 |
+-/* All data exchanged between host and device is exchanged in host byte order, |
1159 |
+- * thanks to the struct gs_host_config byte_order member, which is sent first |
1160 |
+- * to indicate the desired byte order. |
1161 |
+- */ |
1162 |
+ |
1163 |
+ struct gs_device_config { |
1164 |
+ u8 reserved1; |
1165 |
+ u8 reserved2; |
1166 |
+ u8 reserved3; |
1167 |
+ u8 icount; |
1168 |
+- u32 sw_version; |
1169 |
+- u32 hw_version; |
1170 |
++ __le32 sw_version; |
1171 |
++ __le32 hw_version; |
1172 |
+ } __packed; |
1173 |
+ |
1174 |
+ #define GS_CAN_MODE_NORMAL 0 |
1175 |
+@@ -95,26 +101,26 @@ struct gs_device_config { |
1176 |
+ #define GS_CAN_MODE_ONE_SHOT BIT(3) |
1177 |
+ |
1178 |
+ struct gs_device_mode { |
1179 |
+- u32 mode; |
1180 |
+- u32 flags; |
1181 |
++ __le32 mode; |
1182 |
++ __le32 flags; |
1183 |
+ } __packed; |
1184 |
+ |
1185 |
+ struct gs_device_state { |
1186 |
+- u32 state; |
1187 |
+- u32 rxerr; |
1188 |
+- u32 txerr; |
1189 |
++ __le32 state; |
1190 |
++ __le32 rxerr; |
1191 |
++ __le32 txerr; |
1192 |
+ } __packed; |
1193 |
+ |
1194 |
+ struct gs_device_bittiming { |
1195 |
+- u32 prop_seg; |
1196 |
+- u32 phase_seg1; |
1197 |
+- u32 phase_seg2; |
1198 |
+- u32 sjw; |
1199 |
+- u32 brp; |
1200 |
++ __le32 prop_seg; |
1201 |
++ __le32 phase_seg1; |
1202 |
++ __le32 phase_seg2; |
1203 |
++ __le32 sjw; |
1204 |
++ __le32 brp; |
1205 |
+ } __packed; |
1206 |
+ |
1207 |
+ struct gs_identify_mode { |
1208 |
+- u32 mode; |
1209 |
++ __le32 mode; |
1210 |
+ } __packed; |
1211 |
+ |
1212 |
+ #define GS_CAN_FEATURE_LISTEN_ONLY BIT(0) |
1213 |
+@@ -125,23 +131,23 @@ struct gs_identify_mode { |
1214 |
+ #define GS_CAN_FEATURE_IDENTIFY BIT(5) |
1215 |
+ |
1216 |
+ struct gs_device_bt_const { |
1217 |
+- u32 feature; |
1218 |
+- u32 fclk_can; |
1219 |
+- u32 tseg1_min; |
1220 |
+- u32 tseg1_max; |
1221 |
+- u32 tseg2_min; |
1222 |
+- u32 tseg2_max; |
1223 |
+- u32 sjw_max; |
1224 |
+- u32 brp_min; |
1225 |
+- u32 brp_max; |
1226 |
+- u32 brp_inc; |
1227 |
++ __le32 feature; |
1228 |
++ __le32 fclk_can; |
1229 |
++ __le32 tseg1_min; |
1230 |
++ __le32 tseg1_max; |
1231 |
++ __le32 tseg2_min; |
1232 |
++ __le32 tseg2_max; |
1233 |
++ __le32 sjw_max; |
1234 |
++ __le32 brp_min; |
1235 |
++ __le32 brp_max; |
1236 |
++ __le32 brp_inc; |
1237 |
+ } __packed; |
1238 |
+ |
1239 |
+ #define GS_CAN_FLAG_OVERFLOW 1 |
1240 |
+ |
1241 |
+ struct gs_host_frame { |
1242 |
+ u32 echo_id; |
1243 |
+- u32 can_id; |
1244 |
++ __le32 can_id; |
1245 |
+ |
1246 |
+ u8 can_dlc; |
1247 |
+ u8 channel; |
1248 |
+@@ -337,13 +343,13 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) |
1249 |
+ if (!skb) |
1250 |
+ return; |
1251 |
+ |
1252 |
+- cf->can_id = hf->can_id; |
1253 |
++ cf->can_id = le32_to_cpu(hf->can_id); |
1254 |
+ |
1255 |
+ cf->can_dlc = get_can_dlc(hf->can_dlc); |
1256 |
+ memcpy(cf->data, hf->data, 8); |
1257 |
+ |
1258 |
+ /* ERROR frames tell us information about the controller */ |
1259 |
+- if (hf->can_id & CAN_ERR_FLAG) |
1260 |
++ if (le32_to_cpu(hf->can_id) & CAN_ERR_FLAG) |
1261 |
+ gs_update_state(dev, cf); |
1262 |
+ |
1263 |
+ netdev->stats.rx_packets++; |
1264 |
+@@ -426,11 +432,11 @@ static int gs_usb_set_bittiming(struct net_device *netdev) |
1265 |
+ if (!dbt) |
1266 |
+ return -ENOMEM; |
1267 |
+ |
1268 |
+- dbt->prop_seg = bt->prop_seg; |
1269 |
+- dbt->phase_seg1 = bt->phase_seg1; |
1270 |
+- dbt->phase_seg2 = bt->phase_seg2; |
1271 |
+- dbt->sjw = bt->sjw; |
1272 |
+- dbt->brp = bt->brp; |
1273 |
++ dbt->prop_seg = cpu_to_le32(bt->prop_seg); |
1274 |
++ dbt->phase_seg1 = cpu_to_le32(bt->phase_seg1); |
1275 |
++ dbt->phase_seg2 = cpu_to_le32(bt->phase_seg2); |
1276 |
++ dbt->sjw = cpu_to_le32(bt->sjw); |
1277 |
++ dbt->brp = cpu_to_le32(bt->brp); |
1278 |
+ |
1279 |
+ /* request bit timings */ |
1280 |
+ rc = usb_control_msg(interface_to_usbdev(intf), |
1281 |
+@@ -511,7 +517,7 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, |
1282 |
+ |
1283 |
+ cf = (struct can_frame *)skb->data; |
1284 |
+ |
1285 |
+- hf->can_id = cf->can_id; |
1286 |
++ hf->can_id = cpu_to_le32(cf->can_id); |
1287 |
+ hf->can_dlc = cf->can_dlc; |
1288 |
+ memcpy(hf->data, cf->data, cf->can_dlc); |
1289 |
+ |
1290 |
+@@ -581,6 +587,7 @@ static int gs_can_open(struct net_device *netdev) |
1291 |
+ int rc, i; |
1292 |
+ struct gs_device_mode *dm; |
1293 |
+ u32 ctrlmode; |
1294 |
++ u32 flags = 0; |
1295 |
+ |
1296 |
+ rc = open_candev(netdev); |
1297 |
+ if (rc) |
1298 |
+@@ -648,24 +655,24 @@ static int gs_can_open(struct net_device *netdev) |
1299 |
+ |
1300 |
+ /* flags */ |
1301 |
+ ctrlmode = dev->can.ctrlmode; |
1302 |
+- dm->flags = 0; |
1303 |
+ |
1304 |
+ if (ctrlmode & CAN_CTRLMODE_LOOPBACK) |
1305 |
+- dm->flags |= GS_CAN_MODE_LOOP_BACK; |
1306 |
++ flags |= GS_CAN_MODE_LOOP_BACK; |
1307 |
+ else if (ctrlmode & CAN_CTRLMODE_LISTENONLY) |
1308 |
+- dm->flags |= GS_CAN_MODE_LISTEN_ONLY; |
1309 |
++ flags |= GS_CAN_MODE_LISTEN_ONLY; |
1310 |
+ |
1311 |
+ /* Controller is not allowed to retry TX |
1312 |
+ * this mode is unavailable on atmels uc3c hardware |
1313 |
+ */ |
1314 |
+ if (ctrlmode & CAN_CTRLMODE_ONE_SHOT) |
1315 |
+- dm->flags |= GS_CAN_MODE_ONE_SHOT; |
1316 |
++ flags |= GS_CAN_MODE_ONE_SHOT; |
1317 |
+ |
1318 |
+ if (ctrlmode & CAN_CTRLMODE_3_SAMPLES) |
1319 |
+- dm->flags |= GS_CAN_MODE_TRIPLE_SAMPLE; |
1320 |
++ flags |= GS_CAN_MODE_TRIPLE_SAMPLE; |
1321 |
+ |
1322 |
+ /* finally start device */ |
1323 |
+- dm->mode = GS_CAN_MODE_START; |
1324 |
++ dm->mode = cpu_to_le32(GS_CAN_MODE_START); |
1325 |
++ dm->flags = cpu_to_le32(flags); |
1326 |
+ rc = usb_control_msg(interface_to_usbdev(dev->iface), |
1327 |
+ usb_sndctrlpipe(interface_to_usbdev(dev->iface), 0), |
1328 |
+ GS_USB_BREQ_MODE, |
1329 |
+@@ -745,9 +752,9 @@ static int gs_usb_set_identify(struct net_device *netdev, bool do_identify) |
1330 |
+ return -ENOMEM; |
1331 |
+ |
1332 |
+ if (do_identify) |
1333 |
+- imode->mode = GS_CAN_IDENTIFY_ON; |
1334 |
++ imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_ON); |
1335 |
+ else |
1336 |
+- imode->mode = GS_CAN_IDENTIFY_OFF; |
1337 |
++ imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_OFF); |
1338 |
+ |
1339 |
+ rc = usb_control_msg(interface_to_usbdev(dev->iface), |
1340 |
+ usb_sndctrlpipe(interface_to_usbdev(dev->iface), |
1341 |
+@@ -798,6 +805,7 @@ static struct gs_can *gs_make_candev(unsigned int channel, |
1342 |
+ struct net_device *netdev; |
1343 |
+ int rc; |
1344 |
+ struct gs_device_bt_const *bt_const; |
1345 |
++ u32 feature; |
1346 |
+ |
1347 |
+ bt_const = kmalloc(sizeof(*bt_const), GFP_KERNEL); |
1348 |
+ if (!bt_const) |
1349 |
+@@ -838,14 +846,14 @@ static struct gs_can *gs_make_candev(unsigned int channel, |
1350 |
+ |
1351 |
+ /* dev settup */ |
1352 |
+ strcpy(dev->bt_const.name, "gs_usb"); |
1353 |
+- dev->bt_const.tseg1_min = bt_const->tseg1_min; |
1354 |
+- dev->bt_const.tseg1_max = bt_const->tseg1_max; |
1355 |
+- dev->bt_const.tseg2_min = bt_const->tseg2_min; |
1356 |
+- dev->bt_const.tseg2_max = bt_const->tseg2_max; |
1357 |
+- dev->bt_const.sjw_max = bt_const->sjw_max; |
1358 |
+- dev->bt_const.brp_min = bt_const->brp_min; |
1359 |
+- dev->bt_const.brp_max = bt_const->brp_max; |
1360 |
+- dev->bt_const.brp_inc = bt_const->brp_inc; |
1361 |
++ dev->bt_const.tseg1_min = le32_to_cpu(bt_const->tseg1_min); |
1362 |
++ dev->bt_const.tseg1_max = le32_to_cpu(bt_const->tseg1_max); |
1363 |
++ dev->bt_const.tseg2_min = le32_to_cpu(bt_const->tseg2_min); |
1364 |
++ dev->bt_const.tseg2_max = le32_to_cpu(bt_const->tseg2_max); |
1365 |
++ dev->bt_const.sjw_max = le32_to_cpu(bt_const->sjw_max); |
1366 |
++ dev->bt_const.brp_min = le32_to_cpu(bt_const->brp_min); |
1367 |
++ dev->bt_const.brp_max = le32_to_cpu(bt_const->brp_max); |
1368 |
++ dev->bt_const.brp_inc = le32_to_cpu(bt_const->brp_inc); |
1369 |
+ |
1370 |
+ dev->udev = interface_to_usbdev(intf); |
1371 |
+ dev->iface = intf; |
1372 |
+@@ -862,28 +870,29 @@ static struct gs_can *gs_make_candev(unsigned int channel, |
1373 |
+ |
1374 |
+ /* can settup */ |
1375 |
+ dev->can.state = CAN_STATE_STOPPED; |
1376 |
+- dev->can.clock.freq = bt_const->fclk_can; |
1377 |
++ dev->can.clock.freq = le32_to_cpu(bt_const->fclk_can); |
1378 |
+ dev->can.bittiming_const = &dev->bt_const; |
1379 |
+ dev->can.do_set_bittiming = gs_usb_set_bittiming; |
1380 |
+ |
1381 |
+ dev->can.ctrlmode_supported = 0; |
1382 |
+ |
1383 |
+- if (bt_const->feature & GS_CAN_FEATURE_LISTEN_ONLY) |
1384 |
++ feature = le32_to_cpu(bt_const->feature); |
1385 |
++ if (feature & GS_CAN_FEATURE_LISTEN_ONLY) |
1386 |
+ dev->can.ctrlmode_supported |= CAN_CTRLMODE_LISTENONLY; |
1387 |
+ |
1388 |
+- if (bt_const->feature & GS_CAN_FEATURE_LOOP_BACK) |
1389 |
++ if (feature & GS_CAN_FEATURE_LOOP_BACK) |
1390 |
+ dev->can.ctrlmode_supported |= CAN_CTRLMODE_LOOPBACK; |
1391 |
+ |
1392 |
+- if (bt_const->feature & GS_CAN_FEATURE_TRIPLE_SAMPLE) |
1393 |
++ if (feature & GS_CAN_FEATURE_TRIPLE_SAMPLE) |
1394 |
+ dev->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES; |
1395 |
+ |
1396 |
+- if (bt_const->feature & GS_CAN_FEATURE_ONE_SHOT) |
1397 |
++ if (feature & GS_CAN_FEATURE_ONE_SHOT) |
1398 |
+ dev->can.ctrlmode_supported |= CAN_CTRLMODE_ONE_SHOT; |
1399 |
+ |
1400 |
+ SET_NETDEV_DEV(netdev, &intf->dev); |
1401 |
+ |
1402 |
+- if (dconf->sw_version > 1) |
1403 |
+- if (bt_const->feature & GS_CAN_FEATURE_IDENTIFY) |
1404 |
++ if (le32_to_cpu(dconf->sw_version) > 1) |
1405 |
++ if (feature & GS_CAN_FEATURE_IDENTIFY) |
1406 |
+ netdev->ethtool_ops = &gs_usb_ethtool_ops; |
1407 |
+ |
1408 |
+ kfree(bt_const); |
1409 |
+@@ -918,7 +927,7 @@ static int gs_usb_probe(struct usb_interface *intf, |
1410 |
+ if (!hconf) |
1411 |
+ return -ENOMEM; |
1412 |
+ |
1413 |
+- hconf->byte_order = 0x0000beef; |
1414 |
++ hconf->byte_order = cpu_to_le32(0x0000beef); |
1415 |
+ |
1416 |
+ /* send host config */ |
1417 |
+ rc = usb_control_msg(interface_to_usbdev(intf), |
1418 |
+diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1419 |
+index 3c3222e2dcfcf..9aea4cf19d0c9 100644 |
1420 |
+--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1421 |
++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1422 |
+@@ -2433,16 +2433,9 @@ static int ena_device_init(struct ena_com_dev *ena_dev, struct pci_dev *pdev, |
1423 |
+ goto err_mmio_read_less; |
1424 |
+ } |
1425 |
+ |
1426 |
+- rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(dma_width)); |
1427 |
++ rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(dma_width)); |
1428 |
+ if (rc) { |
1429 |
+- dev_err(dev, "pci_set_dma_mask failed 0x%x\n", rc); |
1430 |
+- goto err_mmio_read_less; |
1431 |
+- } |
1432 |
+- |
1433 |
+- rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(dma_width)); |
1434 |
+- if (rc) { |
1435 |
+- dev_err(dev, "err_pci_set_consistent_dma_mask failed 0x%x\n", |
1436 |
+- rc); |
1437 |
++ dev_err(dev, "dma_set_mask_and_coherent failed %d\n", rc); |
1438 |
+ goto err_mmio_read_less; |
1439 |
+ } |
1440 |
+ |
1441 |
+@@ -3183,6 +3176,12 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
1442 |
+ return rc; |
1443 |
+ } |
1444 |
+ |
1445 |
++ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(ENA_MAX_PHYS_ADDR_SIZE_BITS)); |
1446 |
++ if (rc) { |
1447 |
++ dev_err(&pdev->dev, "dma_set_mask_and_coherent failed %d\n", rc); |
1448 |
++ goto err_disable_device; |
1449 |
++ } |
1450 |
++ |
1451 |
+ pci_set_master(pdev); |
1452 |
+ |
1453 |
+ ena_dev = vzalloc(sizeof(*ena_dev)); |
1454 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1455 |
+index 01d28ede1fb20..db1a23b8d531d 100644 |
1456 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1457 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1458 |
+@@ -8021,7 +8021,8 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev) |
1459 |
+ if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0 && |
1460 |
+ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) { |
1461 |
+ dev_err(&pdev->dev, "System does not support DMA, aborting\n"); |
1462 |
+- goto init_err_disable; |
1463 |
++ rc = -EIO; |
1464 |
++ goto init_err_release; |
1465 |
+ } |
1466 |
+ |
1467 |
+ pci_set_master(pdev); |
1468 |
+@@ -9120,6 +9121,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1469 |
+ create_singlethread_workqueue("bnxt_pf_wq"); |
1470 |
+ if (!bnxt_pf_wq) { |
1471 |
+ dev_err(&pdev->dev, "Unable to create workqueue.\n"); |
1472 |
++ rc = -ENOMEM; |
1473 |
+ goto init_err_pci_clean; |
1474 |
+ } |
1475 |
+ } |
1476 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c |
1477 |
+index a62c96001761b..9160b44c68bbf 100644 |
1478 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c |
1479 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c |
1480 |
+@@ -626,7 +626,8 @@ int set_filter_wr(struct adapter *adapter, int fidx) |
1481 |
+ FW_FILTER_WR_OVLAN_VLD_V(f->fs.val.ovlan_vld) | |
1482 |
+ FW_FILTER_WR_IVLAN_VLDM_V(f->fs.mask.ivlan_vld) | |
1483 |
+ FW_FILTER_WR_OVLAN_VLDM_V(f->fs.mask.ovlan_vld)); |
1484 |
+- fwr->smac_sel = f->smt->idx; |
1485 |
++ if (f->fs.newsmac) |
1486 |
++ fwr->smac_sel = f->smt->idx; |
1487 |
+ fwr->rx_chan_rx_rpl_iq = |
1488 |
+ htons(FW_FILTER_WR_RX_CHAN_V(0) | |
1489 |
+ FW_FILTER_WR_RX_RPL_IQ_V(adapter->sge.fw_evtq.abs_id)); |
1490 |
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
1491 |
+index d8115a9333e05..2938ac440fb36 100644 |
1492 |
+--- a/drivers/net/ethernet/ibm/ibmvnic.c |
1493 |
++++ b/drivers/net/ethernet/ibm/ibmvnic.c |
1494 |
+@@ -2560,6 +2560,9 @@ static int reset_sub_crq_queues(struct ibmvnic_adapter *adapter) |
1495 |
+ { |
1496 |
+ int i, rc; |
1497 |
+ |
1498 |
++ if (!adapter->tx_scrq || !adapter->rx_scrq) |
1499 |
++ return -EINVAL; |
1500 |
++ |
1501 |
+ for (i = 0; i < adapter->req_tx_queues; i++) { |
1502 |
+ netdev_dbg(adapter->netdev, "Re-setting tx_scrq[%d]\n", i); |
1503 |
+ rc = reset_one_sub_crq_queue(adapter, adapter->tx_scrq[i]); |
1504 |
+@@ -4459,6 +4462,9 @@ static int ibmvnic_reset_crq(struct ibmvnic_adapter *adapter) |
1505 |
+ } while (rc == H_BUSY || H_IS_LONG_BUSY(rc)); |
1506 |
+ |
1507 |
+ /* Clean out the queue */ |
1508 |
++ if (!crq->msgs) |
1509 |
++ return -EINVAL; |
1510 |
++ |
1511 |
+ memset(crq->msgs, 0, PAGE_SIZE); |
1512 |
+ crq->cur = 0; |
1513 |
+ crq->active = false; |
1514 |
+diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c |
1515 |
+index 4da409e77a72e..6c78529a8c89b 100644 |
1516 |
+--- a/drivers/nfc/s3fwrn5/i2c.c |
1517 |
++++ b/drivers/nfc/s3fwrn5/i2c.c |
1518 |
+@@ -37,8 +37,8 @@ struct s3fwrn5_i2c_phy { |
1519 |
+ struct i2c_client *i2c_dev; |
1520 |
+ struct nci_dev *ndev; |
1521 |
+ |
1522 |
+- unsigned int gpio_en; |
1523 |
+- unsigned int gpio_fw_wake; |
1524 |
++ int gpio_en; |
1525 |
++ int gpio_fw_wake; |
1526 |
+ |
1527 |
+ struct mutex mutex; |
1528 |
+ |
1529 |
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
1530 |
+index 3c68a5b35ec1b..a52b2f15f372a 100644 |
1531 |
+--- a/drivers/nvme/host/pci.c |
1532 |
++++ b/drivers/nvme/host/pci.c |
1533 |
+@@ -276,9 +276,21 @@ static void nvme_dbbuf_init(struct nvme_dev *dev, |
1534 |
+ nvmeq->dbbuf_cq_ei = &dev->dbbuf_eis[cq_idx(qid, dev->db_stride)]; |
1535 |
+ } |
1536 |
+ |
1537 |
++static void nvme_dbbuf_free(struct nvme_queue *nvmeq) |
1538 |
++{ |
1539 |
++ if (!nvmeq->qid) |
1540 |
++ return; |
1541 |
++ |
1542 |
++ nvmeq->dbbuf_sq_db = NULL; |
1543 |
++ nvmeq->dbbuf_cq_db = NULL; |
1544 |
++ nvmeq->dbbuf_sq_ei = NULL; |
1545 |
++ nvmeq->dbbuf_cq_ei = NULL; |
1546 |
++} |
1547 |
++ |
1548 |
+ static void nvme_dbbuf_set(struct nvme_dev *dev) |
1549 |
+ { |
1550 |
+ struct nvme_command c; |
1551 |
++ unsigned int i; |
1552 |
+ |
1553 |
+ if (!dev->dbbuf_dbs) |
1554 |
+ return; |
1555 |
+@@ -292,6 +304,9 @@ static void nvme_dbbuf_set(struct nvme_dev *dev) |
1556 |
+ dev_warn(dev->ctrl.device, "unable to set dbbuf\n"); |
1557 |
+ /* Free memory and continue on */ |
1558 |
+ nvme_dbbuf_dma_free(dev); |
1559 |
++ |
1560 |
++ for (i = 1; i <= dev->online_queues; i++) |
1561 |
++ nvme_dbbuf_free(&dev->queues[i]); |
1562 |
+ } |
1563 |
+ } |
1564 |
+ |
1565 |
+diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c |
1566 |
+index de1b4ebe4de28..39c01ef57d83c 100644 |
1567 |
+--- a/drivers/phy/tegra/xusb.c |
1568 |
++++ b/drivers/phy/tegra/xusb.c |
1569 |
+@@ -899,6 +899,7 @@ remove_pads: |
1570 |
+ reset: |
1571 |
+ reset_control_assert(padctl->rst); |
1572 |
+ remove: |
1573 |
++ platform_set_drvdata(pdev, NULL); |
1574 |
+ soc->ops->remove(padctl); |
1575 |
+ return err; |
1576 |
+ } |
1577 |
+diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c |
1578 |
+index 98bd8213b0378..8cc01857bc5c0 100644 |
1579 |
+--- a/drivers/platform/x86/thinkpad_acpi.c |
1580 |
++++ b/drivers/platform/x86/thinkpad_acpi.c |
1581 |
+@@ -4251,6 +4251,7 @@ static void hotkey_resume(void) |
1582 |
+ pr_err("error while attempting to reset the event firmware interface\n"); |
1583 |
+ |
1584 |
+ tpacpi_send_radiosw_update(); |
1585 |
++ tpacpi_input_send_tabletsw(); |
1586 |
+ hotkey_tablet_mode_notify_change(); |
1587 |
+ hotkey_wakeup_reason_notify_change(); |
1588 |
+ hotkey_wakeup_hotunplug_complete_notify_change(); |
1589 |
+diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c |
1590 |
+index e366977bda418..8c3e9bac4754c 100644 |
1591 |
+--- a/drivers/platform/x86/toshiba_acpi.c |
1592 |
++++ b/drivers/platform/x86/toshiba_acpi.c |
1593 |
+@@ -1497,7 +1497,7 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf, |
1594 |
+ struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); |
1595 |
+ char *buffer; |
1596 |
+ char *cmd; |
1597 |
+- int lcd_out, crt_out, tv_out; |
1598 |
++ int lcd_out = -1, crt_out = -1, tv_out = -1; |
1599 |
+ int remain = count; |
1600 |
+ int value; |
1601 |
+ int ret; |
1602 |
+@@ -1529,7 +1529,6 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf, |
1603 |
+ |
1604 |
+ kfree(cmd); |
1605 |
+ |
1606 |
+- lcd_out = crt_out = tv_out = -1; |
1607 |
+ ret = get_video_status(dev, &video_out); |
1608 |
+ if (!ret) { |
1609 |
+ unsigned int new_video_out = video_out; |
1610 |
+diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
1611 |
+index 5f59e2dfc7db9..d0aaef937b0fe 100644 |
1612 |
+--- a/drivers/s390/net/qeth_core_main.c |
1613 |
++++ b/drivers/s390/net/qeth_core_main.c |
1614 |
+@@ -470,12 +470,6 @@ static void qeth_cleanup_handled_pending(struct qeth_qdio_out_q *q, int bidx, |
1615 |
+ |
1616 |
+ } |
1617 |
+ } |
1618 |
+- if (forced_cleanup && (atomic_read(&(q->bufs[bidx]->state)) == |
1619 |
+- QETH_QDIO_BUF_HANDLED_DELAYED)) { |
1620 |
+- /* for recovery situations */ |
1621 |
+- qeth_init_qdio_out_buf(q, bidx); |
1622 |
+- QETH_CARD_TEXT(q->card, 2, "clprecov"); |
1623 |
+- } |
1624 |
+ } |
1625 |
+ |
1626 |
+ |
1627 |
+diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c |
1628 |
+index 7a05c72717666..1c69515e870cb 100644 |
1629 |
+--- a/drivers/scsi/libiscsi.c |
1630 |
++++ b/drivers/scsi/libiscsi.c |
1631 |
+@@ -571,8 +571,8 @@ static void iscsi_complete_task(struct iscsi_task *task, int state) |
1632 |
+ if (conn->task == task) |
1633 |
+ conn->task = NULL; |
1634 |
+ |
1635 |
+- if (conn->ping_task == task) |
1636 |
+- conn->ping_task = NULL; |
1637 |
++ if (READ_ONCE(conn->ping_task) == task) |
1638 |
++ WRITE_ONCE(conn->ping_task, NULL); |
1639 |
+ |
1640 |
+ /* release get from queueing */ |
1641 |
+ __iscsi_put_task(task); |
1642 |
+@@ -781,6 +781,9 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, |
1643 |
+ task->conn->session->age); |
1644 |
+ } |
1645 |
+ |
1646 |
++ if (unlikely(READ_ONCE(conn->ping_task) == INVALID_SCSI_TASK)) |
1647 |
++ WRITE_ONCE(conn->ping_task, task); |
1648 |
++ |
1649 |
+ if (!ihost->workq) { |
1650 |
+ if (iscsi_prep_mgmt_task(conn, task)) |
1651 |
+ goto free_task; |
1652 |
+@@ -988,8 +991,11 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) |
1653 |
+ struct iscsi_nopout hdr; |
1654 |
+ struct iscsi_task *task; |
1655 |
+ |
1656 |
+- if (!rhdr && conn->ping_task) |
1657 |
+- return -EINVAL; |
1658 |
++ if (!rhdr) { |
1659 |
++ if (READ_ONCE(conn->ping_task)) |
1660 |
++ return -EINVAL; |
1661 |
++ WRITE_ONCE(conn->ping_task, INVALID_SCSI_TASK); |
1662 |
++ } |
1663 |
+ |
1664 |
+ memset(&hdr, 0, sizeof(struct iscsi_nopout)); |
1665 |
+ hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE; |
1666 |
+@@ -1004,11 +1010,12 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) |
1667 |
+ |
1668 |
+ task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); |
1669 |
+ if (!task) { |
1670 |
++ if (!rhdr) |
1671 |
++ WRITE_ONCE(conn->ping_task, NULL); |
1672 |
+ iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); |
1673 |
+ return -EIO; |
1674 |
+ } else if (!rhdr) { |
1675 |
+ /* only track our nops */ |
1676 |
+- conn->ping_task = task; |
1677 |
+ conn->last_ping = jiffies; |
1678 |
+ } |
1679 |
+ |
1680 |
+@@ -1021,7 +1028,7 @@ static int iscsi_nop_out_rsp(struct iscsi_task *task, |
1681 |
+ struct iscsi_conn *conn = task->conn; |
1682 |
+ int rc = 0; |
1683 |
+ |
1684 |
+- if (conn->ping_task != task) { |
1685 |
++ if (READ_ONCE(conn->ping_task) != task) { |
1686 |
+ /* |
1687 |
+ * If this is not in response to one of our |
1688 |
+ * nops then it must be from userspace. |
1689 |
+@@ -1961,7 +1968,7 @@ static void iscsi_start_tx(struct iscsi_conn *conn) |
1690 |
+ */ |
1691 |
+ static int iscsi_has_ping_timed_out(struct iscsi_conn *conn) |
1692 |
+ { |
1693 |
+- if (conn->ping_task && |
1694 |
++ if (READ_ONCE(conn->ping_task) && |
1695 |
+ time_before_eq(conn->last_recv + (conn->recv_timeout * HZ) + |
1696 |
+ (conn->ping_timeout * HZ), jiffies)) |
1697 |
+ return 1; |
1698 |
+@@ -2096,7 +2103,7 @@ enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc) |
1699 |
+ * Checking the transport already or nop from a cmd timeout still |
1700 |
+ * running |
1701 |
+ */ |
1702 |
+- if (conn->ping_task) { |
1703 |
++ if (READ_ONCE(conn->ping_task)) { |
1704 |
+ task->have_checked_conn = true; |
1705 |
+ rc = BLK_EH_RESET_TIMER; |
1706 |
+ goto done; |
1707 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
1708 |
+index a63119c35fde8..7e4e6e982055e 100644 |
1709 |
+--- a/drivers/scsi/ufs/ufshcd.c |
1710 |
++++ b/drivers/scsi/ufs/ufshcd.c |
1711 |
+@@ -7926,11 +7926,7 @@ int ufshcd_shutdown(struct ufs_hba *hba) |
1712 |
+ if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba)) |
1713 |
+ goto out; |
1714 |
+ |
1715 |
+- if (pm_runtime_suspended(hba->dev)) { |
1716 |
+- ret = ufshcd_runtime_resume(hba); |
1717 |
+- if (ret) |
1718 |
+- goto out; |
1719 |
+- } |
1720 |
++ pm_runtime_get_sync(hba->dev); |
1721 |
+ |
1722 |
+ ret = ufshcd_suspend(hba, UFS_SHUTDOWN_PM); |
1723 |
+ out: |
1724 |
+diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
1725 |
+index 2602b57936d4b..58ccded1be857 100644 |
1726 |
+--- a/drivers/target/iscsi/iscsi_target.c |
1727 |
++++ b/drivers/target/iscsi/iscsi_target.c |
1728 |
+@@ -492,8 +492,7 @@ EXPORT_SYMBOL(iscsit_queue_rsp); |
1729 |
+ void iscsit_aborted_task(struct iscsi_conn *conn, struct iscsi_cmd *cmd) |
1730 |
+ { |
1731 |
+ spin_lock_bh(&conn->cmd_lock); |
1732 |
+- if (!list_empty(&cmd->i_conn_node) && |
1733 |
+- !(cmd->se_cmd.transport_state & CMD_T_FABRIC_STOP)) |
1734 |
++ if (!list_empty(&cmd->i_conn_node)) |
1735 |
+ list_del_init(&cmd->i_conn_node); |
1736 |
+ spin_unlock_bh(&conn->cmd_lock); |
1737 |
+ |
1738 |
+@@ -4054,12 +4053,22 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) |
1739 |
+ spin_lock_bh(&conn->cmd_lock); |
1740 |
+ list_splice_init(&conn->conn_cmd_list, &tmp_list); |
1741 |
+ |
1742 |
+- list_for_each_entry(cmd, &tmp_list, i_conn_node) { |
1743 |
++ list_for_each_entry_safe(cmd, cmd_tmp, &tmp_list, i_conn_node) { |
1744 |
+ struct se_cmd *se_cmd = &cmd->se_cmd; |
1745 |
+ |
1746 |
+ if (se_cmd->se_tfo != NULL) { |
1747 |
+ spin_lock_irq(&se_cmd->t_state_lock); |
1748 |
+- se_cmd->transport_state |= CMD_T_FABRIC_STOP; |
1749 |
++ if (se_cmd->transport_state & CMD_T_ABORTED) { |
1750 |
++ /* |
1751 |
++ * LIO's abort path owns the cleanup for this, |
1752 |
++ * so put it back on the list and let |
1753 |
++ * aborted_task handle it. |
1754 |
++ */ |
1755 |
++ list_move_tail(&cmd->i_conn_node, |
1756 |
++ &conn->conn_cmd_list); |
1757 |
++ } else { |
1758 |
++ se_cmd->transport_state |= CMD_T_FABRIC_STOP; |
1759 |
++ } |
1760 |
+ spin_unlock_irq(&se_cmd->t_state_lock); |
1761 |
+ } |
1762 |
+ } |
1763 |
+diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c |
1764 |
+index a5afbe6dee686..7cb7efe62b011 100644 |
1765 |
+--- a/drivers/tee/optee/call.c |
1766 |
++++ b/drivers/tee/optee/call.c |
1767 |
+@@ -538,7 +538,8 @@ void optee_free_pages_list(void *list, size_t num_entries) |
1768 |
+ static bool is_normal_memory(pgprot_t p) |
1769 |
+ { |
1770 |
+ #if defined(CONFIG_ARM) |
1771 |
+- return (pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC; |
1772 |
++ return (((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC) || |
1773 |
++ ((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEBACK)); |
1774 |
+ #elif defined(CONFIG_ARM64) |
1775 |
+ return (pgprot_val(p) & PTE_ATTRINDX_MASK) == PTE_ATTRINDX(MT_NORMAL); |
1776 |
+ #else |
1777 |
+diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c |
1778 |
+index 00204824bffd8..732e7f1687dd2 100644 |
1779 |
+--- a/drivers/usb/core/devio.c |
1780 |
++++ b/drivers/usb/core/devio.c |
1781 |
+@@ -463,11 +463,11 @@ static void snoop_urb(struct usb_device *udev, |
1782 |
+ |
1783 |
+ if (userurb) { /* Async */ |
1784 |
+ if (when == SUBMIT) |
1785 |
+- dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, " |
1786 |
++ dev_info(&udev->dev, "userurb %px, ep%d %s-%s, " |
1787 |
+ "length %u\n", |
1788 |
+ userurb, ep, t, d, length); |
1789 |
+ else |
1790 |
+- dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, " |
1791 |
++ dev_info(&udev->dev, "userurb %px, ep%d %s-%s, " |
1792 |
+ "actual_length %u status %d\n", |
1793 |
+ userurb, ep, t, d, length, |
1794 |
+ timeout_or_status); |
1795 |
+@@ -1927,7 +1927,7 @@ static int proc_reapurb(struct usb_dev_state *ps, void __user *arg) |
1796 |
+ if (as) { |
1797 |
+ int retval; |
1798 |
+ |
1799 |
+- snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
1800 |
++ snoop(&ps->dev->dev, "reap %px\n", as->userurb); |
1801 |
+ retval = processcompl(as, (void __user * __user *)arg); |
1802 |
+ free_async(as); |
1803 |
+ return retval; |
1804 |
+@@ -1944,7 +1944,7 @@ static int proc_reapurbnonblock(struct usb_dev_state *ps, void __user *arg) |
1805 |
+ |
1806 |
+ as = async_getcompleted(ps); |
1807 |
+ if (as) { |
1808 |
+- snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
1809 |
++ snoop(&ps->dev->dev, "reap %px\n", as->userurb); |
1810 |
+ retval = processcompl(as, (void __user * __user *)arg); |
1811 |
+ free_async(as); |
1812 |
+ } else { |
1813 |
+@@ -2070,7 +2070,7 @@ static int proc_reapurb_compat(struct usb_dev_state *ps, void __user *arg) |
1814 |
+ if (as) { |
1815 |
+ int retval; |
1816 |
+ |
1817 |
+- snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
1818 |
++ snoop(&ps->dev->dev, "reap %px\n", as->userurb); |
1819 |
+ retval = processcompl_compat(as, (void __user * __user *)arg); |
1820 |
+ free_async(as); |
1821 |
+ return retval; |
1822 |
+@@ -2087,7 +2087,7 @@ static int proc_reapurbnonblock_compat(struct usb_dev_state *ps, void __user *ar |
1823 |
+ |
1824 |
+ as = async_getcompleted(ps); |
1825 |
+ if (as) { |
1826 |
+- snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
1827 |
++ snoop(&ps->dev->dev, "reap %px\n", as->userurb); |
1828 |
+ retval = processcompl_compat(as, (void __user * __user *)arg); |
1829 |
+ free_async(as); |
1830 |
+ } else { |
1831 |
+@@ -2512,7 +2512,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, |
1832 |
+ #endif |
1833 |
+ |
1834 |
+ case USBDEVFS_DISCARDURB: |
1835 |
+- snoop(&dev->dev, "%s: DISCARDURB %pK\n", __func__, p); |
1836 |
++ snoop(&dev->dev, "%s: DISCARDURB %px\n", __func__, p); |
1837 |
+ ret = proc_unlinkurb(ps, p); |
1838 |
+ break; |
1839 |
+ |
1840 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
1841 |
+index 5ad14cdd97623..b55c3a699fc65 100644 |
1842 |
+--- a/drivers/usb/core/quirks.c |
1843 |
++++ b/drivers/usb/core/quirks.c |
1844 |
+@@ -348,6 +348,10 @@ static const struct usb_device_id usb_quirk_list[] = { |
1845 |
+ /* Guillemot Webcam Hercules Dualpix Exchange*/ |
1846 |
+ { USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME }, |
1847 |
+ |
1848 |
++ /* Guillemot Hercules DJ Console audio card (BZ 208357) */ |
1849 |
++ { USB_DEVICE(0x06f8, 0xb000), .driver_info = |
1850 |
++ USB_QUIRK_ENDPOINT_BLACKLIST }, |
1851 |
++ |
1852 |
+ /* Midiman M-Audio Keystation 88es */ |
1853 |
+ { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME }, |
1854 |
+ |
1855 |
+@@ -421,6 +425,10 @@ static const struct usb_device_id usb_quirk_list[] = { |
1856 |
+ { USB_DEVICE(0x1532, 0x0116), .driver_info = |
1857 |
+ USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, |
1858 |
+ |
1859 |
++ /* Lenovo ThinkCenter A630Z TI024Gen3 usb-audio */ |
1860 |
++ { USB_DEVICE(0x17ef, 0xa012), .driver_info = |
1861 |
++ USB_QUIRK_DISCONNECT_SUSPEND }, |
1862 |
++ |
1863 |
+ /* BUILDWIN Photo Frame */ |
1864 |
+ { USB_DEVICE(0x1908, 0x1315), .driver_info = |
1865 |
+ USB_QUIRK_HONOR_BNUMINTERFACES }, |
1866 |
+@@ -521,6 +529,8 @@ static const struct usb_device_id usb_amd_resume_quirk_list[] = { |
1867 |
+ * Matched for devices with USB_QUIRK_ENDPOINT_BLACKLIST. |
1868 |
+ */ |
1869 |
+ static const struct usb_device_id usb_endpoint_blacklist[] = { |
1870 |
++ { USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x01 }, |
1871 |
++ { USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x81 }, |
1872 |
+ { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0202, 1), .driver_info = 0x85 }, |
1873 |
+ { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0208, 1), .driver_info = 0x85 }, |
1874 |
+ { } |
1875 |
+diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c |
1876 |
+index 46af0aa07e2e3..b2b5b0689667b 100644 |
1877 |
+--- a/drivers/usb/gadget/function/f_midi.c |
1878 |
++++ b/drivers/usb/gadget/function/f_midi.c |
1879 |
+@@ -1315,7 +1315,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) |
1880 |
+ midi->id = kstrdup(opts->id, GFP_KERNEL); |
1881 |
+ if (opts->id && !midi->id) { |
1882 |
+ status = -ENOMEM; |
1883 |
+- goto setup_fail; |
1884 |
++ goto midi_free; |
1885 |
+ } |
1886 |
+ midi->in_ports = opts->in_ports; |
1887 |
+ midi->out_ports = opts->out_ports; |
1888 |
+@@ -1327,7 +1327,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) |
1889 |
+ |
1890 |
+ status = kfifo_alloc(&midi->in_req_fifo, midi->qlen, GFP_KERNEL); |
1891 |
+ if (status) |
1892 |
+- goto setup_fail; |
1893 |
++ goto midi_free; |
1894 |
+ |
1895 |
+ spin_lock_init(&midi->transmit_lock); |
1896 |
+ |
1897 |
+@@ -1343,9 +1343,13 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) |
1898 |
+ |
1899 |
+ return &midi->func; |
1900 |
+ |
1901 |
++midi_free: |
1902 |
++ if (midi) |
1903 |
++ kfree(midi->id); |
1904 |
++ kfree(midi); |
1905 |
+ setup_fail: |
1906 |
+ mutex_unlock(&opts->lock); |
1907 |
+- kfree(midi); |
1908 |
++ |
1909 |
+ return ERR_PTR(status); |
1910 |
+ } |
1911 |
+ |
1912 |
+diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c |
1913 |
+index 25d417ad9000c..09ed5f02c24f4 100644 |
1914 |
+--- a/drivers/usb/gadget/legacy/inode.c |
1915 |
++++ b/drivers/usb/gadget/legacy/inode.c |
1916 |
+@@ -2039,6 +2039,9 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) |
1917 |
+ return 0; |
1918 |
+ |
1919 |
+ Enomem: |
1920 |
++ kfree(CHIP); |
1921 |
++ CHIP = NULL; |
1922 |
++ |
1923 |
+ return -ENOMEM; |
1924 |
+ } |
1925 |
+ |
1926 |
+diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c |
1927 |
+index 403d8cd3e5827..56e70f12c9960 100644 |
1928 |
+--- a/drivers/video/fbdev/hyperv_fb.c |
1929 |
++++ b/drivers/video/fbdev/hyperv_fb.c |
1930 |
+@@ -712,7 +712,12 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) |
1931 |
+ goto err1; |
1932 |
+ } |
1933 |
+ |
1934 |
+- fb_virt = ioremap(par->mem->start, screen_fb_size); |
1935 |
++ /* |
1936 |
++ * Map the VRAM cacheable for performance. This is also required for |
1937 |
++ * VM Connect to display properly for ARM64 Linux VM, as the host also |
1938 |
++ * maps the VRAM cacheable. |
1939 |
++ */ |
1940 |
++ fb_virt = ioremap_cache(par->mem->start, screen_fb_size); |
1941 |
+ if (!fb_virt) |
1942 |
+ goto err2; |
1943 |
+ |
1944 |
+diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c |
1945 |
+index c8ed4db73b840..9936e4b991aa3 100644 |
1946 |
+--- a/fs/btrfs/qgroup.c |
1947 |
++++ b/fs/btrfs/qgroup.c |
1948 |
+@@ -488,13 +488,13 @@ next2: |
1949 |
+ break; |
1950 |
+ } |
1951 |
+ out: |
1952 |
++ btrfs_free_path(path); |
1953 |
+ fs_info->qgroup_flags |= flags; |
1954 |
+ if (!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_ON)) |
1955 |
+ clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); |
1956 |
+ else if (fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN && |
1957 |
+ ret >= 0) |
1958 |
+ ret = qgroup_rescan_init(fs_info, rescan_progress, 0); |
1959 |
+- btrfs_free_path(path); |
1960 |
+ |
1961 |
+ if (ret < 0) { |
1962 |
+ ulist_free(fs_info->qgroup_ulist); |
1963 |
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
1964 |
+index 7e000d061813c..95b6a4ea18f7a 100644 |
1965 |
+--- a/fs/btrfs/volumes.c |
1966 |
++++ b/fs/btrfs/volumes.c |
1967 |
+@@ -857,7 +857,13 @@ static noinline struct btrfs_device *device_list_add(const char *path, |
1968 |
+ if (device->bdev != path_bdev) { |
1969 |
+ bdput(path_bdev); |
1970 |
+ mutex_unlock(&fs_devices->device_list_mutex); |
1971 |
+- btrfs_warn_in_rcu(device->fs_info, |
1972 |
++ /* |
1973 |
++ * device->fs_info may not be reliable here, so |
1974 |
++ * pass in a NULL instead. This avoids a |
1975 |
++ * possible use-after-free when the fs_info and |
1976 |
++ * fs_info->sb are already torn down. |
1977 |
++ */ |
1978 |
++ btrfs_warn_in_rcu(NULL, |
1979 |
+ "duplicate device %s devid %llu generation %llu scanned by %s (%d)", |
1980 |
+ path, devid, found_transid, |
1981 |
+ current->comm, |
1982 |
+diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c |
1983 |
+index 8c6ab6c95727e..7f40343b39b05 100644 |
1984 |
+--- a/fs/efivarfs/inode.c |
1985 |
++++ b/fs/efivarfs/inode.c |
1986 |
+@@ -10,6 +10,7 @@ |
1987 |
+ #include <linux/efi.h> |
1988 |
+ #include <linux/fs.h> |
1989 |
+ #include <linux/ctype.h> |
1990 |
++#include <linux/kmemleak.h> |
1991 |
+ #include <linux/slab.h> |
1992 |
+ #include <linux/uuid.h> |
1993 |
+ |
1994 |
+@@ -106,6 +107,7 @@ static int efivarfs_create(struct inode *dir, struct dentry *dentry, |
1995 |
+ var->var.VariableName[i] = '\0'; |
1996 |
+ |
1997 |
+ inode->i_private = var; |
1998 |
++ kmemleak_ignore(var); |
1999 |
+ |
2000 |
+ err = efivar_entry_add(var, &efivarfs_list); |
2001 |
+ if (err) |
2002 |
+diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c |
2003 |
+index 7808a26bd33fa..834615f13f3e3 100644 |
2004 |
+--- a/fs/efivarfs/super.c |
2005 |
++++ b/fs/efivarfs/super.c |
2006 |
+@@ -23,7 +23,6 @@ LIST_HEAD(efivarfs_list); |
2007 |
+ static void efivarfs_evict_inode(struct inode *inode) |
2008 |
+ { |
2009 |
+ clear_inode(inode); |
2010 |
+- kfree(inode->i_private); |
2011 |
+ } |
2012 |
+ |
2013 |
+ static const struct super_operations efivarfs_ops = { |
2014 |
+diff --git a/fs/proc/self.c b/fs/proc/self.c |
2015 |
+index cc6d4253399d1..7922edf70ce1a 100644 |
2016 |
+--- a/fs/proc/self.c |
2017 |
++++ b/fs/proc/self.c |
2018 |
+@@ -16,6 +16,13 @@ static const char *proc_self_get_link(struct dentry *dentry, |
2019 |
+ pid_t tgid = task_tgid_nr_ns(current, ns); |
2020 |
+ char *name; |
2021 |
+ |
2022 |
++ /* |
2023 |
++ * Not currently supported. Once we can inherit all of struct pid, |
2024 |
++ * we can allow this. |
2025 |
++ */ |
2026 |
++ if (current->flags & PF_KTHREAD) |
2027 |
++ return ERR_PTR(-EOPNOTSUPP); |
2028 |
++ |
2029 |
+ if (!tgid) |
2030 |
+ return ERR_PTR(-ENOENT); |
2031 |
+ /* max length of unsigned int in decimal + NULL term */ |
2032 |
+diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h |
2033 |
+index 97ea41dc678fe..e5f641cdab5a4 100644 |
2034 |
+--- a/include/drm/drm_connector.h |
2035 |
++++ b/include/drm/drm_connector.h |
2036 |
+@@ -81,6 +81,53 @@ enum drm_connector_status { |
2037 |
+ connector_status_unknown = 3, |
2038 |
+ }; |
2039 |
+ |
2040 |
++/** |
2041 |
++ * enum drm_connector_registration_status - userspace registration status for |
2042 |
++ * a &drm_connector |
2043 |
++ * |
2044 |
++ * This enum is used to track the status of initializing a connector and |
2045 |
++ * registering it with userspace, so that DRM can prevent bogus modesets on |
2046 |
++ * connectors that no longer exist. |
2047 |
++ */ |
2048 |
++enum drm_connector_registration_state { |
2049 |
++ /** |
2050 |
++ * @DRM_CONNECTOR_INITIALIZING: The connector has just been created, |
2051 |
++ * but has yet to be exposed to userspace. There should be no |
2052 |
++ * additional restrictions to how the state of this connector may be |
2053 |
++ * modified. |
2054 |
++ */ |
2055 |
++ DRM_CONNECTOR_INITIALIZING = 0, |
2056 |
++ |
2057 |
++ /** |
2058 |
++ * @DRM_CONNECTOR_REGISTERED: The connector has been fully initialized |
2059 |
++ * and registered with sysfs, as such it has been exposed to |
2060 |
++ * userspace. There should be no additional restrictions to how the |
2061 |
++ * state of this connector may be modified. |
2062 |
++ */ |
2063 |
++ DRM_CONNECTOR_REGISTERED = 1, |
2064 |
++ |
2065 |
++ /** |
2066 |
++ * @DRM_CONNECTOR_UNREGISTERED: The connector has either been exposed |
2067 |
++ * to userspace and has since been unregistered and removed from |
2068 |
++ * userspace, or the connector was unregistered before it had a chance |
2069 |
++ * to be exposed to userspace (e.g. still in the |
2070 |
++ * @DRM_CONNECTOR_INITIALIZING state). When a connector is |
2071 |
++ * unregistered, there are additional restrictions to how its state |
2072 |
++ * may be modified: |
2073 |
++ * |
2074 |
++ * - An unregistered connector may only have its DPMS changed from |
2075 |
++ * On->Off. Once DPMS is changed to Off, it may not be switched back |
2076 |
++ * to On. |
2077 |
++ * - Modesets are not allowed on unregistered connectors, unless they |
2078 |
++ * would result in disabling its assigned CRTCs. This means |
2079 |
++ * disabling a CRTC on an unregistered connector is OK, but enabling |
2080 |
++ * one is not. |
2081 |
++ * - Removing a CRTC from an unregistered connector is OK, but new |
2082 |
++ * CRTCs may never be assigned to an unregistered connector. |
2083 |
++ */ |
2084 |
++ DRM_CONNECTOR_UNREGISTERED = 2, |
2085 |
++}; |
2086 |
++ |
2087 |
+ enum subpixel_order { |
2088 |
+ SubPixelUnknown = 0, |
2089 |
+ SubPixelHorizontalRGB, |
2090 |
+@@ -852,10 +899,12 @@ struct drm_connector { |
2091 |
+ bool ycbcr_420_allowed; |
2092 |
+ |
2093 |
+ /** |
2094 |
+- * @registered: Is this connector exposed (registered) with userspace? |
2095 |
++ * @registration_state: Is this connector initializing, exposed |
2096 |
++ * (registered) with userspace, or unregistered? |
2097 |
++ * |
2098 |
+ * Protected by @mutex. |
2099 |
+ */ |
2100 |
+- bool registered; |
2101 |
++ enum drm_connector_registration_state registration_state; |
2102 |
+ |
2103 |
+ /** |
2104 |
+ * @modes: |
2105 |
+@@ -1165,6 +1214,24 @@ static inline void drm_connector_unreference(struct drm_connector *connector) |
2106 |
+ drm_connector_put(connector); |
2107 |
+ } |
2108 |
+ |
2109 |
++/** |
2110 |
++ * drm_connector_is_unregistered - has the connector been unregistered from |
2111 |
++ * userspace? |
2112 |
++ * @connector: DRM connector |
2113 |
++ * |
2114 |
++ * Checks whether or not @connector has been unregistered from userspace. |
2115 |
++ * |
2116 |
++ * Returns: |
2117 |
++ * True if the connector was unregistered, false if the connector is |
2118 |
++ * registered or has not yet been registered with userspace. |
2119 |
++ */ |
2120 |
++static inline bool |
2121 |
++drm_connector_is_unregistered(struct drm_connector *connector) |
2122 |
++{ |
2123 |
++ return READ_ONCE(connector->registration_state) == |
2124 |
++ DRM_CONNECTOR_UNREGISTERED; |
2125 |
++} |
2126 |
++ |
2127 |
+ const char *drm_get_connector_status_name(enum drm_connector_status status); |
2128 |
+ const char *drm_get_subpixel_order_name(enum subpixel_order order); |
2129 |
+ const char *drm_get_dpms_name(int val); |
2130 |
+diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h |
2131 |
+index 72cb19c3db6aa..9460a5635c90b 100644 |
2132 |
+--- a/include/linux/netfilter.h |
2133 |
++++ b/include/linux/netfilter.h |
2134 |
+@@ -300,7 +300,7 @@ NF_HOOK_LIST(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, |
2135 |
+ |
2136 |
+ INIT_LIST_HEAD(&sublist); |
2137 |
+ list_for_each_entry_safe(skb, next, head, list) { |
2138 |
+- list_del(&skb->list); |
2139 |
++ skb_list_del_init(skb); |
2140 |
+ if (nf_hook(pf, hook, net, sk, skb, in, out, okfn) == 1) |
2141 |
+ list_add_tail(&skb->list, &sublist); |
2142 |
+ } |
2143 |
+diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h |
2144 |
+index c9bd935f4fd1c..1ee0f30ae190b 100644 |
2145 |
+--- a/include/scsi/libiscsi.h |
2146 |
++++ b/include/scsi/libiscsi.h |
2147 |
+@@ -145,6 +145,9 @@ struct iscsi_task { |
2148 |
+ void *dd_data; /* driver/transport data */ |
2149 |
+ }; |
2150 |
+ |
2151 |
++/* invalid scsi_task pointer */ |
2152 |
++#define INVALID_SCSI_TASK (struct iscsi_task *)-1l |
2153 |
++ |
2154 |
+ static inline int iscsi_task_has_unsol_data(struct iscsi_task *task) |
2155 |
+ { |
2156 |
+ return task->unsol_r2t.data_length > task->unsol_r2t.sent; |
2157 |
+diff --git a/include/uapi/linux/wireless.h b/include/uapi/linux/wireless.h |
2158 |
+index a2c006a364e0b..24f3371ad8262 100644 |
2159 |
+--- a/include/uapi/linux/wireless.h |
2160 |
++++ b/include/uapi/linux/wireless.h |
2161 |
+@@ -74,7 +74,11 @@ |
2162 |
+ #include <linux/socket.h> /* for "struct sockaddr" et al */ |
2163 |
+ #include <linux/if.h> /* for IFNAMSIZ and co... */ |
2164 |
+ |
2165 |
+-#include <stddef.h> /* for offsetof */ |
2166 |
++#ifdef __KERNEL__ |
2167 |
++# include <linux/stddef.h> /* for offsetof */ |
2168 |
++#else |
2169 |
++# include <stddef.h> /* for offsetof */ |
2170 |
++#endif |
2171 |
+ |
2172 |
+ /***************************** VERSION *****************************/ |
2173 |
+ /* |
2174 |
+diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c |
2175 |
+index 853773e45f792..837f67c9fad35 100644 |
2176 |
+--- a/net/batman-adv/log.c |
2177 |
++++ b/net/batman-adv/log.c |
2178 |
+@@ -205,6 +205,7 @@ static const struct file_operations batadv_log_fops = { |
2179 |
+ .read = batadv_log_read, |
2180 |
+ .poll = batadv_log_poll, |
2181 |
+ .llseek = no_llseek, |
2182 |
++ .owner = THIS_MODULE, |
2183 |
+ }; |
2184 |
+ |
2185 |
+ /** |
2186 |
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
2187 |
+index 708efb9b43877..f86b9b0a0607e 100644 |
2188 |
+--- a/sound/pci/hda/patch_hdmi.c |
2189 |
++++ b/sound/pci/hda/patch_hdmi.c |
2190 |
+@@ -1955,20 +1955,23 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, |
2191 |
+ int pinctl; |
2192 |
+ int err = 0; |
2193 |
+ |
2194 |
++ mutex_lock(&spec->pcm_lock); |
2195 |
+ if (hinfo->nid) { |
2196 |
+ pcm_idx = hinfo_to_pcm_index(codec, hinfo); |
2197 |
+- if (snd_BUG_ON(pcm_idx < 0)) |
2198 |
+- return -EINVAL; |
2199 |
++ if (snd_BUG_ON(pcm_idx < 0)) { |
2200 |
++ err = -EINVAL; |
2201 |
++ goto unlock; |
2202 |
++ } |
2203 |
+ cvt_idx = cvt_nid_to_cvt_index(codec, hinfo->nid); |
2204 |
+- if (snd_BUG_ON(cvt_idx < 0)) |
2205 |
+- return -EINVAL; |
2206 |
++ if (snd_BUG_ON(cvt_idx < 0)) { |
2207 |
++ err = -EINVAL; |
2208 |
++ goto unlock; |
2209 |
++ } |
2210 |
+ per_cvt = get_cvt(spec, cvt_idx); |
2211 |
+- |
2212 |
+ snd_BUG_ON(!per_cvt->assigned); |
2213 |
+ per_cvt->assigned = 0; |
2214 |
+ hinfo->nid = 0; |
2215 |
+ |
2216 |
+- mutex_lock(&spec->pcm_lock); |
2217 |
+ snd_hda_spdif_ctls_unassign(codec, pcm_idx); |
2218 |
+ clear_bit(pcm_idx, &spec->pcm_in_use); |
2219 |
+ pin_idx = hinfo_to_pin_index(codec, hinfo); |
2220 |
+@@ -1996,10 +1999,11 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, |
2221 |
+ per_pin->setup = false; |
2222 |
+ per_pin->channels = 0; |
2223 |
+ mutex_unlock(&per_pin->lock); |
2224 |
+- unlock: |
2225 |
+- mutex_unlock(&spec->pcm_lock); |
2226 |
+ } |
2227 |
+ |
2228 |
++unlock: |
2229 |
++ mutex_unlock(&spec->pcm_lock); |
2230 |
++ |
2231 |
+ return err; |
2232 |
+ } |
2233 |
+ |
2234 |
+diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c |
2235 |
+index 29e75c051d045..230e94bf7775a 100644 |
2236 |
+--- a/tools/perf/util/dwarf-aux.c |
2237 |
++++ b/tools/perf/util/dwarf-aux.c |
2238 |
+@@ -332,6 +332,7 @@ bool die_is_func_def(Dwarf_Die *dw_die) |
2239 |
+ int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr) |
2240 |
+ { |
2241 |
+ Dwarf_Addr base, end; |
2242 |
++ Dwarf_Attribute attr; |
2243 |
+ |
2244 |
+ if (!addr) |
2245 |
+ return -EINVAL; |
2246 |
+@@ -339,6 +340,13 @@ int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr) |
2247 |
+ if (dwarf_entrypc(dw_die, addr) == 0) |
2248 |
+ return 0; |
2249 |
+ |
2250 |
++ /* |
2251 |
++ * Since the dwarf_ranges() will return 0 if there is no |
2252 |
++ * DW_AT_ranges attribute, we should check it first. |
2253 |
++ */ |
2254 |
++ if (!dwarf_attr(dw_die, DW_AT_ranges, &attr)) |
2255 |
++ return -ENOENT; |
2256 |
++ |
2257 |
+ return dwarf_ranges(dw_die, 0, &base, addr, &end) < 0 ? -ENOENT : 0; |
2258 |
+ } |
2259 |
+ |
2260 |
+diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c |
2261 |
+index aa9c7df120cae..9c22729e2ad60 100644 |
2262 |
+--- a/tools/perf/util/event.c |
2263 |
++++ b/tools/perf/util/event.c |
2264 |
+@@ -912,11 +912,13 @@ static int __perf_event__synthesize_kernel_mmap(struct perf_tool *tool, |
2265 |
+ int err; |
2266 |
+ union perf_event *event; |
2267 |
+ |
2268 |
+- if (symbol_conf.kptr_restrict) |
2269 |
+- return -1; |
2270 |
+ if (map == NULL) |
2271 |
+ return -1; |
2272 |
+ |
2273 |
++ kmap = map__kmap(map); |
2274 |
++ if (!kmap->ref_reloc_sym) |
2275 |
++ return -1; |
2276 |
++ |
2277 |
+ /* |
2278 |
+ * We should get this from /sys/kernel/sections/.text, but till that is |
2279 |
+ * available use this, and after it is use this as a fallback for older |
2280 |
+@@ -939,7 +941,6 @@ static int __perf_event__synthesize_kernel_mmap(struct perf_tool *tool, |
2281 |
+ event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL; |
2282 |
+ } |
2283 |
+ |
2284 |
+- kmap = map__kmap(map); |
2285 |
+ size = snprintf(event->mmap.filename, sizeof(event->mmap.filename), |
2286 |
+ "%s%s", machine->mmap_name, kmap->ref_reloc_sym->name) + 1; |
2287 |
+ size = PERF_ALIGN(size, sizeof(u64)); |
2288 |
+diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c |
2289 |
+index a2a175b08b172..cbb38a0d1b251 100644 |
2290 |
+--- a/virt/kvm/arm/vgic/vgic-mmio-v3.c |
2291 |
++++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c |
2292 |
+@@ -226,6 +226,23 @@ static unsigned long vgic_mmio_read_v3r_typer(struct kvm_vcpu *vcpu, |
2293 |
+ return extract_bytes(value, addr & 7, len); |
2294 |
+ } |
2295 |
+ |
2296 |
++static unsigned long vgic_uaccess_read_v3r_typer(struct kvm_vcpu *vcpu, |
2297 |
++ gpa_t addr, unsigned int len) |
2298 |
++{ |
2299 |
++ unsigned long mpidr = kvm_vcpu_get_mpidr_aff(vcpu); |
2300 |
++ int target_vcpu_id = vcpu->vcpu_id; |
2301 |
++ u64 value; |
2302 |
++ |
2303 |
++ value = (u64)(mpidr & GENMASK(23, 0)) << 32; |
2304 |
++ value |= ((target_vcpu_id & 0xffff) << 8); |
2305 |
++ |
2306 |
++ if (vgic_has_its(vcpu->kvm)) |
2307 |
++ value |= GICR_TYPER_PLPIS; |
2308 |
++ |
2309 |
++ /* reporting of the Last bit is not supported for userspace */ |
2310 |
++ return extract_bytes(value, addr & 7, len); |
2311 |
++} |
2312 |
++ |
2313 |
+ static unsigned long vgic_mmio_read_v3r_iidr(struct kvm_vcpu *vcpu, |
2314 |
+ gpa_t addr, unsigned int len) |
2315 |
+ { |
2316 |
+@@ -532,8 +549,9 @@ static const struct vgic_register_region vgic_v3_rdbase_registers[] = { |
2317 |
+ REGISTER_DESC_WITH_LENGTH(GICR_IIDR, |
2318 |
+ vgic_mmio_read_v3r_iidr, vgic_mmio_write_wi, 4, |
2319 |
+ VGIC_ACCESS_32bit), |
2320 |
+- REGISTER_DESC_WITH_LENGTH(GICR_TYPER, |
2321 |
+- vgic_mmio_read_v3r_typer, vgic_mmio_write_wi, 8, |
2322 |
++ REGISTER_DESC_WITH_LENGTH_UACCESS(GICR_TYPER, |
2323 |
++ vgic_mmio_read_v3r_typer, vgic_mmio_write_wi, |
2324 |
++ vgic_uaccess_read_v3r_typer, vgic_mmio_uaccess_write_wi, 8, |
2325 |
+ VGIC_ACCESS_64bit | VGIC_ACCESS_32bit), |
2326 |
+ REGISTER_DESC_WITH_LENGTH(GICR_WAKER, |
2327 |
+ vgic_mmio_read_raz, vgic_mmio_write_wi, 4, |