1 |
commit: 417939a07acf5a68a4765909fc6bf3564be0a050 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Dec 2 12:48:38 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 2 12:48:38 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=417939a0 |
7 |
|
8 |
Linux patch 4.14.210 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1209_linux-4.14.210.patch | 2119 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2123 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 35d5c39..fef350e 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -879,6 +879,10 @@ Patch: 1208_linux-4.14.209.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.14.209 |
23 |
|
24 |
+Patch: 1209_linux-4.14.210.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.14.210 |
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/1209_linux-4.14.210.patch b/1209_linux-4.14.210.patch |
33 |
new file mode 100644 |
34 |
index 0000000..e119a49 |
35 |
--- /dev/null |
36 |
+++ b/1209_linux-4.14.210.patch |
37 |
@@ -0,0 +1,2119 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 653e6472a8dc6..fa6ea54e2604a 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 14 |
46 |
+-SUBLEVEL = 209 |
47 |
++SUBLEVEL = 210 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Petit Gorille |
50 |
+ |
51 |
+diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h |
52 |
+index 324db23b37de4..6147e58babf00 100644 |
53 |
+--- a/arch/arm64/include/asm/pgtable.h |
54 |
++++ b/arch/arm64/include/asm/pgtable.h |
55 |
+@@ -92,8 +92,6 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
56 |
+ #define pte_valid(pte) (!!(pte_val(pte) & PTE_VALID)) |
57 |
+ #define pte_valid_not_user(pte) \ |
58 |
+ ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID) |
59 |
+-#define pte_valid_young(pte) \ |
60 |
+- ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF)) |
61 |
+ #define pte_valid_user(pte) \ |
62 |
+ ((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER)) |
63 |
+ |
64 |
+@@ -101,9 +99,12 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
65 |
+ * Could the pte be present in the TLB? We must check mm_tlb_flush_pending |
66 |
+ * so that we don't erroneously return false for pages that have been |
67 |
+ * remapped as PROT_NONE but are yet to be flushed from the TLB. |
68 |
++ * Note that we can't make any assumptions based on the state of the access |
69 |
++ * flag, since ptep_clear_flush_young() elides a DSB when invalidating the |
70 |
++ * TLB. |
71 |
+ */ |
72 |
+ #define pte_accessible(mm, pte) \ |
73 |
+- (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid_young(pte)) |
74 |
++ (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid(pte)) |
75 |
+ |
76 |
+ /* |
77 |
+ * p??_access_permitted() is true for valid user mappings (subject to the |
78 |
+@@ -129,13 +130,6 @@ static inline pte_t set_pte_bit(pte_t pte, pgprot_t prot) |
79 |
+ return pte; |
80 |
+ } |
81 |
+ |
82 |
+-static inline pte_t pte_wrprotect(pte_t pte) |
83 |
+-{ |
84 |
+- pte = clear_pte_bit(pte, __pgprot(PTE_WRITE)); |
85 |
+- pte = set_pte_bit(pte, __pgprot(PTE_RDONLY)); |
86 |
+- return pte; |
87 |
+-} |
88 |
+- |
89 |
+ static inline pte_t pte_mkwrite(pte_t pte) |
90 |
+ { |
91 |
+ pte = set_pte_bit(pte, __pgprot(PTE_WRITE)); |
92 |
+@@ -161,6 +155,20 @@ static inline pte_t pte_mkdirty(pte_t pte) |
93 |
+ return pte; |
94 |
+ } |
95 |
+ |
96 |
++static inline pte_t pte_wrprotect(pte_t pte) |
97 |
++{ |
98 |
++ /* |
99 |
++ * If hardware-dirty (PTE_WRITE/DBM bit set and PTE_RDONLY |
100 |
++ * clear), set the PTE_DIRTY bit. |
101 |
++ */ |
102 |
++ if (pte_hw_dirty(pte)) |
103 |
++ pte = pte_mkdirty(pte); |
104 |
++ |
105 |
++ pte = clear_pte_bit(pte, __pgprot(PTE_WRITE)); |
106 |
++ pte = set_pte_bit(pte, __pgprot(PTE_RDONLY)); |
107 |
++ return pte; |
108 |
++} |
109 |
++ |
110 |
+ static inline pte_t pte_mkold(pte_t pte) |
111 |
+ { |
112 |
+ return clear_pte_bit(pte, __pgprot(PTE_AF)); |
113 |
+@@ -642,12 +650,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres |
114 |
+ pte = READ_ONCE(*ptep); |
115 |
+ do { |
116 |
+ old_pte = pte; |
117 |
+- /* |
118 |
+- * If hardware-dirty (PTE_WRITE/DBM bit set and PTE_RDONLY |
119 |
+- * clear), set the PTE_DIRTY bit. |
120 |
+- */ |
121 |
+- if (pte_hw_dirty(pte)) |
122 |
+- pte = pte_mkdirty(pte); |
123 |
+ pte = pte_wrprotect(pte); |
124 |
+ pte_val(pte) = cmpxchg_relaxed(&pte_val(*ptep), |
125 |
+ pte_val(old_pte), pte_val(pte)); |
126 |
+diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c |
127 |
+index 59521c71c98a4..4ebeaa3c67100 100644 |
128 |
+--- a/arch/x86/events/intel/cstate.c |
129 |
++++ b/arch/x86/events/intel/cstate.c |
130 |
+@@ -99,14 +99,14 @@ |
131 |
+ MODULE_LICENSE("GPL"); |
132 |
+ |
133 |
+ #define DEFINE_CSTATE_FORMAT_ATTR(_var, _name, _format) \ |
134 |
+-static ssize_t __cstate_##_var##_show(struct kobject *kobj, \ |
135 |
+- struct kobj_attribute *attr, \ |
136 |
++static ssize_t __cstate_##_var##_show(struct device *dev, \ |
137 |
++ struct device_attribute *attr, \ |
138 |
+ char *page) \ |
139 |
+ { \ |
140 |
+ BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ |
141 |
+ return sprintf(page, _format "\n"); \ |
142 |
+ } \ |
143 |
+-static struct kobj_attribute format_attr_##_var = \ |
144 |
++static struct device_attribute format_attr_##_var = \ |
145 |
+ __ATTR(_name, 0444, __cstate_##_var##_show, NULL) |
146 |
+ |
147 |
+ static ssize_t cstate_get_attr_cpumask(struct device *dev, |
148 |
+diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c |
149 |
+index d36a5fac6a18b..7d3f861e31654 100644 |
150 |
+--- a/arch/x86/events/intel/rapl.c |
151 |
++++ b/arch/x86/events/intel/rapl.c |
152 |
+@@ -115,18 +115,6 @@ static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initconst = { |
153 |
+ * any other bit is reserved |
154 |
+ */ |
155 |
+ #define RAPL_EVENT_MASK 0xFFULL |
156 |
+- |
157 |
+-#define DEFINE_RAPL_FORMAT_ATTR(_var, _name, _format) \ |
158 |
+-static ssize_t __rapl_##_var##_show(struct kobject *kobj, \ |
159 |
+- struct kobj_attribute *attr, \ |
160 |
+- char *page) \ |
161 |
+-{ \ |
162 |
+- BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ |
163 |
+- return sprintf(page, _format "\n"); \ |
164 |
+-} \ |
165 |
+-static struct kobj_attribute format_attr_##_var = \ |
166 |
+- __ATTR(_name, 0444, __rapl_##_var##_show, NULL) |
167 |
+- |
168 |
+ #define RAPL_CNTR_WIDTH 32 |
169 |
+ |
170 |
+ #define RAPL_EVENT_ATTR_STR(_name, v, str) \ |
171 |
+@@ -548,7 +536,7 @@ static struct attribute_group rapl_pmu_events_group = { |
172 |
+ .attrs = NULL, /* patched at runtime */ |
173 |
+ }; |
174 |
+ |
175 |
+-DEFINE_RAPL_FORMAT_ATTR(event, event, "config:0-7"); |
176 |
++PMU_FORMAT_ATTR(event, "config:0-7"); |
177 |
+ static struct attribute *rapl_formats_attr[] = { |
178 |
+ &format_attr_event.attr, |
179 |
+ NULL, |
180 |
+diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c |
181 |
+index c56cb37b88e33..4ad93871508cd 100644 |
182 |
+--- a/arch/x86/events/intel/uncore.c |
183 |
++++ b/arch/x86/events/intel/uncore.c |
184 |
+@@ -90,8 +90,8 @@ end: |
185 |
+ return map; |
186 |
+ } |
187 |
+ |
188 |
+-ssize_t uncore_event_show(struct kobject *kobj, |
189 |
+- struct kobj_attribute *attr, char *buf) |
190 |
++ssize_t uncore_event_show(struct device *dev, |
191 |
++ struct device_attribute *attr, char *buf) |
192 |
+ { |
193 |
+ struct uncore_event_desc *event = |
194 |
+ container_of(attr, struct uncore_event_desc, attr); |
195 |
+diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h |
196 |
+index 4364191e7c6b2..ae4ab89e16c7d 100644 |
197 |
+--- a/arch/x86/events/intel/uncore.h |
198 |
++++ b/arch/x86/events/intel/uncore.h |
199 |
+@@ -125,7 +125,7 @@ struct intel_uncore_box { |
200 |
+ #define UNCORE_BOX_FLAG_CTL_OFFS8 1 /* event config registers are 8-byte apart */ |
201 |
+ |
202 |
+ struct uncore_event_desc { |
203 |
+- struct kobj_attribute attr; |
204 |
++ struct device_attribute attr; |
205 |
+ const char *config; |
206 |
+ }; |
207 |
+ |
208 |
+@@ -137,8 +137,8 @@ struct pci2phy_map { |
209 |
+ |
210 |
+ struct pci2phy_map *__find_pci2phy_map(int segment); |
211 |
+ |
212 |
+-ssize_t uncore_event_show(struct kobject *kobj, |
213 |
+- struct kobj_attribute *attr, char *buf); |
214 |
++ssize_t uncore_event_show(struct device *dev, |
215 |
++ struct device_attribute *attr, char *buf); |
216 |
+ |
217 |
+ #define INTEL_UNCORE_EVENT_DESC(_name, _config) \ |
218 |
+ { \ |
219 |
+@@ -147,14 +147,14 @@ ssize_t uncore_event_show(struct kobject *kobj, |
220 |
+ } |
221 |
+ |
222 |
+ #define DEFINE_UNCORE_FORMAT_ATTR(_var, _name, _format) \ |
223 |
+-static ssize_t __uncore_##_var##_show(struct kobject *kobj, \ |
224 |
+- struct kobj_attribute *attr, \ |
225 |
++static ssize_t __uncore_##_var##_show(struct device *dev, \ |
226 |
++ struct device_attribute *attr, \ |
227 |
+ char *page) \ |
228 |
+ { \ |
229 |
+ BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ |
230 |
+ return sprintf(page, _format "\n"); \ |
231 |
+ } \ |
232 |
+-static struct kobj_attribute format_attr_##_var = \ |
233 |
++static struct device_attribute format_attr_##_var = \ |
234 |
+ __ATTR(_name, 0444, __uncore_##_var##_show, NULL) |
235 |
+ |
236 |
+ static inline unsigned uncore_pci_box_ctl(struct intel_uncore_box *box) |
237 |
+diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c |
238 |
+index 1dbc64bbd8668..fcea3aa19c23a 100644 |
239 |
+--- a/arch/x86/kernel/cpu/bugs.c |
240 |
++++ b/arch/x86/kernel/cpu/bugs.c |
241 |
+@@ -733,11 +733,13 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd) |
242 |
+ if (boot_cpu_has(X86_FEATURE_IBPB)) { |
243 |
+ setup_force_cpu_cap(X86_FEATURE_USE_IBPB); |
244 |
+ |
245 |
++ spectre_v2_user_ibpb = mode; |
246 |
+ switch (cmd) { |
247 |
+ case SPECTRE_V2_USER_CMD_FORCE: |
248 |
+ case SPECTRE_V2_USER_CMD_PRCTL_IBPB: |
249 |
+ case SPECTRE_V2_USER_CMD_SECCOMP_IBPB: |
250 |
+ static_branch_enable(&switch_mm_always_ibpb); |
251 |
++ spectre_v2_user_ibpb = SPECTRE_V2_USER_STRICT; |
252 |
+ break; |
253 |
+ case SPECTRE_V2_USER_CMD_PRCTL: |
254 |
+ case SPECTRE_V2_USER_CMD_AUTO: |
255 |
+@@ -751,8 +753,6 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd) |
256 |
+ pr_info("mitigation: Enabling %s Indirect Branch Prediction Barrier\n", |
257 |
+ static_key_enabled(&switch_mm_always_ibpb) ? |
258 |
+ "always-on" : "conditional"); |
259 |
+- |
260 |
+- spectre_v2_user_ibpb = mode; |
261 |
+ } |
262 |
+ |
263 |
+ /* |
264 |
+diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c |
265 |
+index 60c63b23e3baa..bb33888151fb0 100644 |
266 |
+--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c |
267 |
++++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c |
268 |
+@@ -393,6 +393,24 @@ unlock: |
269 |
+ return ret ?: nbytes; |
270 |
+ } |
271 |
+ |
272 |
++/** |
273 |
++ * rdtgroup_remove - the helper to remove resource group safely |
274 |
++ * @rdtgrp: resource group to remove |
275 |
++ * |
276 |
++ * On resource group creation via a mkdir, an extra kernfs_node reference is |
277 |
++ * taken to ensure that the rdtgroup structure remains accessible for the |
278 |
++ * rdtgroup_kn_unlock() calls where it is removed. |
279 |
++ * |
280 |
++ * Drop the extra reference here, then free the rdtgroup structure. |
281 |
++ * |
282 |
++ * Return: void |
283 |
++ */ |
284 |
++static void rdtgroup_remove(struct rdtgroup *rdtgrp) |
285 |
++{ |
286 |
++ kernfs_put(rdtgrp->kn); |
287 |
++ kfree(rdtgrp); |
288 |
++} |
289 |
++ |
290 |
+ struct task_move_callback { |
291 |
+ struct callback_head work; |
292 |
+ struct rdtgroup *rdtgrp; |
293 |
+@@ -415,7 +433,7 @@ static void move_myself(struct callback_head *head) |
294 |
+ (rdtgrp->flags & RDT_DELETED)) { |
295 |
+ current->closid = 0; |
296 |
+ current->rmid = 0; |
297 |
+- kfree(rdtgrp); |
298 |
++ rdtgroup_remove(rdtgrp); |
299 |
+ } |
300 |
+ |
301 |
+ preempt_disable(); |
302 |
+@@ -830,7 +848,6 @@ static int rdtgroup_mkdir_info_resdir(struct rdt_resource *r, char *name, |
303 |
+ if (IS_ERR(kn_subdir)) |
304 |
+ return PTR_ERR(kn_subdir); |
305 |
+ |
306 |
+- kernfs_get(kn_subdir); |
307 |
+ ret = rdtgroup_kn_set_ugid(kn_subdir); |
308 |
+ if (ret) |
309 |
+ return ret; |
310 |
+@@ -853,7 +870,6 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) |
311 |
+ kn_info = kernfs_create_dir(parent_kn, "info", parent_kn->mode, NULL); |
312 |
+ if (IS_ERR(kn_info)) |
313 |
+ return PTR_ERR(kn_info); |
314 |
+- kernfs_get(kn_info); |
315 |
+ |
316 |
+ for_each_alloc_enabled_rdt_resource(r) { |
317 |
+ fflags = r->fflags | RF_CTRL_INFO; |
318 |
+@@ -870,12 +886,6 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) |
319 |
+ goto out_destroy; |
320 |
+ } |
321 |
+ |
322 |
+- /* |
323 |
+- * This extra ref will be put in kernfs_remove() and guarantees |
324 |
+- * that @rdtgrp->kn is always accessible. |
325 |
+- */ |
326 |
+- kernfs_get(kn_info); |
327 |
+- |
328 |
+ ret = rdtgroup_kn_set_ugid(kn_info); |
329 |
+ if (ret) |
330 |
+ goto out_destroy; |
331 |
+@@ -904,12 +914,6 @@ mongroup_create_dir(struct kernfs_node *parent_kn, struct rdtgroup *prgrp, |
332 |
+ if (dest_kn) |
333 |
+ *dest_kn = kn; |
334 |
+ |
335 |
+- /* |
336 |
+- * This extra ref will be put in kernfs_remove() and guarantees |
337 |
+- * that @rdtgrp->kn is always accessible. |
338 |
+- */ |
339 |
+- kernfs_get(kn); |
340 |
+- |
341 |
+ ret = rdtgroup_kn_set_ugid(kn); |
342 |
+ if (ret) |
343 |
+ goto out_destroy; |
344 |
+@@ -1126,8 +1130,7 @@ void rdtgroup_kn_unlock(struct kernfs_node *kn) |
345 |
+ if (atomic_dec_and_test(&rdtgrp->waitcount) && |
346 |
+ (rdtgrp->flags & RDT_DELETED)) { |
347 |
+ kernfs_unbreak_active_protection(kn); |
348 |
+- kernfs_put(rdtgrp->kn); |
349 |
+- kfree(rdtgrp); |
350 |
++ rdtgroup_remove(rdtgrp); |
351 |
+ } else { |
352 |
+ kernfs_unbreak_active_protection(kn); |
353 |
+ } |
354 |
+@@ -1178,7 +1181,6 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type, |
355 |
+ dentry = ERR_PTR(ret); |
356 |
+ goto out_info; |
357 |
+ } |
358 |
+- kernfs_get(kn_mongrp); |
359 |
+ |
360 |
+ ret = mkdir_mondata_all(rdtgroup_default.kn, |
361 |
+ &rdtgroup_default, &kn_mondata); |
362 |
+@@ -1186,7 +1188,6 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type, |
363 |
+ dentry = ERR_PTR(ret); |
364 |
+ goto out_mongrp; |
365 |
+ } |
366 |
+- kernfs_get(kn_mondata); |
367 |
+ rdtgroup_default.mon.mon_data_kn = kn_mondata; |
368 |
+ } |
369 |
+ |
370 |
+@@ -1329,7 +1330,7 @@ static void free_all_child_rdtgrp(struct rdtgroup *rdtgrp) |
371 |
+ if (atomic_read(&sentry->waitcount) != 0) |
372 |
+ sentry->flags = RDT_DELETED; |
373 |
+ else |
374 |
+- kfree(sentry); |
375 |
++ rdtgroup_remove(sentry); |
376 |
+ } |
377 |
+ } |
378 |
+ |
379 |
+@@ -1367,7 +1368,7 @@ static void rmdir_all_sub(void) |
380 |
+ if (atomic_read(&rdtgrp->waitcount) != 0) |
381 |
+ rdtgrp->flags = RDT_DELETED; |
382 |
+ else |
383 |
+- kfree(rdtgrp); |
384 |
++ rdtgroup_remove(rdtgrp); |
385 |
+ } |
386 |
+ /* Notify online CPUs to update per cpu storage and PQR_ASSOC MSR */ |
387 |
+ update_closid_rmid(cpu_online_mask, &rdtgroup_default); |
388 |
+@@ -1461,11 +1462,6 @@ static int mkdir_mondata_subdir(struct kernfs_node *parent_kn, |
389 |
+ if (IS_ERR(kn)) |
390 |
+ return PTR_ERR(kn); |
391 |
+ |
392 |
+- /* |
393 |
+- * This extra ref will be put in kernfs_remove() and guarantees |
394 |
+- * that kn is always accessible. |
395 |
+- */ |
396 |
+- kernfs_get(kn); |
397 |
+ ret = rdtgroup_kn_set_ugid(kn); |
398 |
+ if (ret) |
399 |
+ goto out_destroy; |
400 |
+@@ -1626,8 +1622,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, |
401 |
+ /* |
402 |
+ * kernfs_remove() will drop the reference count on "kn" which |
403 |
+ * will free it. But we still need it to stick around for the |
404 |
+- * rdtgroup_kn_unlock(kn} call below. Take one extra reference |
405 |
+- * here, which will be dropped inside rdtgroup_kn_unlock(). |
406 |
++ * rdtgroup_kn_unlock(kn) call. Take one extra reference here, |
407 |
++ * which will be dropped by kernfs_put() in rdtgroup_remove(). |
408 |
+ */ |
409 |
+ kernfs_get(kn); |
410 |
+ |
411 |
+@@ -1661,6 +1657,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, |
412 |
+ out_idfree: |
413 |
+ free_rmid(rdtgrp->mon.rmid); |
414 |
+ out_destroy: |
415 |
++ kernfs_put(rdtgrp->kn); |
416 |
+ kernfs_remove(rdtgrp->kn); |
417 |
+ out_free_rgrp: |
418 |
+ kfree(rdtgrp); |
419 |
+@@ -1673,7 +1670,7 @@ static void mkdir_rdt_prepare_clean(struct rdtgroup *rgrp) |
420 |
+ { |
421 |
+ kernfs_remove(rgrp->kn); |
422 |
+ free_rmid(rgrp->mon.rmid); |
423 |
+- kfree(rgrp); |
424 |
++ rdtgroup_remove(rgrp); |
425 |
+ } |
426 |
+ |
427 |
+ /* |
428 |
+@@ -1839,11 +1836,6 @@ static int rdtgroup_rmdir_mon(struct kernfs_node *kn, struct rdtgroup *rdtgrp, |
429 |
+ WARN_ON(list_empty(&prdtgrp->mon.crdtgrp_list)); |
430 |
+ list_del(&rdtgrp->mon.crdtgrp_list); |
431 |
+ |
432 |
+- /* |
433 |
+- * one extra hold on this, will drop when we kfree(rdtgrp) |
434 |
+- * in rdtgroup_kn_unlock() |
435 |
+- */ |
436 |
+- kernfs_get(kn); |
437 |
+ kernfs_remove(rdtgrp->kn); |
438 |
+ |
439 |
+ return 0; |
440 |
+@@ -1880,11 +1872,6 @@ static int rdtgroup_rmdir_ctrl(struct kernfs_node *kn, struct rdtgroup *rdtgrp, |
441 |
+ |
442 |
+ list_del(&rdtgrp->rdtgroup_list); |
443 |
+ |
444 |
+- /* |
445 |
+- * one extra hold on this, will drop when we kfree(rdtgrp) |
446 |
+- * in rdtgroup_kn_unlock() |
447 |
+- */ |
448 |
+- kernfs_get(kn); |
449 |
+ kernfs_remove(rdtgrp->kn); |
450 |
+ |
451 |
+ /* |
452 |
+diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c |
453 |
+index 2527540051ff0..e22ee24396158 100644 |
454 |
+--- a/arch/x86/xen/spinlock.c |
455 |
++++ b/arch/x86/xen/spinlock.c |
456 |
+@@ -99,10 +99,20 @@ void xen_init_lock_cpu(int cpu) |
457 |
+ |
458 |
+ void xen_uninit_lock_cpu(int cpu) |
459 |
+ { |
460 |
++ int irq; |
461 |
++ |
462 |
+ if (!xen_pvspin) |
463 |
+ return; |
464 |
+ |
465 |
+- unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL); |
466 |
++ /* |
467 |
++ * When booting the kernel with 'mitigations=auto,nosmt', the secondary |
468 |
++ * CPUs are not activated, and lock_kicker_irq is not initialized. |
469 |
++ */ |
470 |
++ irq = per_cpu(lock_kicker_irq, cpu); |
471 |
++ if (irq == -1) |
472 |
++ return; |
473 |
++ |
474 |
++ unbind_from_irqhandler(irq, NULL); |
475 |
+ per_cpu(lock_kicker_irq, cpu) = -1; |
476 |
+ kfree(per_cpu(irq_name, cpu)); |
477 |
+ per_cpu(irq_name, cpu) = NULL; |
478 |
+diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c |
479 |
+index ff8b7042d28f4..c034f506e015a 100644 |
480 |
+--- a/drivers/dma/pl330.c |
481 |
++++ b/drivers/dma/pl330.c |
482 |
+@@ -2666,7 +2666,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, |
483 |
+ * If burst size is smaller than bus width then make sure we only |
484 |
+ * transfer one at a time to avoid a burst stradling an MFIFO entry. |
485 |
+ */ |
486 |
+- if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width) |
487 |
++ if (burst * 8 < pl330->pcfg.data_bus_width) |
488 |
+ desc->rqcfg.brst_len = 1; |
489 |
+ |
490 |
+ desc->bytes_requested = len; |
491 |
+diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c |
492 |
+index 2db352308e5c0..314f175cf8d05 100644 |
493 |
+--- a/drivers/dma/xilinx/xilinx_dma.c |
494 |
++++ b/drivers/dma/xilinx/xilinx_dma.c |
495 |
+@@ -422,8 +422,8 @@ struct xilinx_dma_device { |
496 |
+ #define to_dma_tx_descriptor(tx) \ |
497 |
+ container_of(tx, struct xilinx_dma_tx_descriptor, async_tx) |
498 |
+ #define xilinx_dma_poll_timeout(chan, reg, val, cond, delay_us, timeout_us) \ |
499 |
+- readl_poll_timeout(chan->xdev->regs + chan->ctrl_offset + reg, val, \ |
500 |
+- cond, delay_us, timeout_us) |
501 |
++ readl_poll_timeout_atomic(chan->xdev->regs + chan->ctrl_offset + reg, \ |
502 |
++ val, cond, delay_us, timeout_us) |
503 |
+ |
504 |
+ /* IO accessors */ |
505 |
+ static inline u32 dma_read(struct xilinx_dma_chan *chan, u32 reg) |
506 |
+diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c |
507 |
+index 1689568b597d4..12c5d7c96527a 100644 |
508 |
+--- a/drivers/hid/hid-cypress.c |
509 |
++++ b/drivers/hid/hid-cypress.c |
510 |
+@@ -26,19 +26,17 @@ |
511 |
+ #define CP_2WHEEL_MOUSE_HACK 0x02 |
512 |
+ #define CP_2WHEEL_MOUSE_HACK_ON 0x04 |
513 |
+ |
514 |
++#define VA_INVAL_LOGICAL_BOUNDARY 0x08 |
515 |
++ |
516 |
+ /* |
517 |
+ * Some USB barcode readers from cypress have usage min and usage max in |
518 |
+ * the wrong order |
519 |
+ */ |
520 |
+-static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
521 |
++static __u8 *cp_rdesc_fixup(struct hid_device *hdev, __u8 *rdesc, |
522 |
+ unsigned int *rsize) |
523 |
+ { |
524 |
+- unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); |
525 |
+ unsigned int i; |
526 |
+ |
527 |
+- if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX)) |
528 |
+- return rdesc; |
529 |
+- |
530 |
+ if (*rsize < 4) |
531 |
+ return rdesc; |
532 |
+ |
533 |
+@@ -51,6 +49,40 @@ static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
534 |
+ return rdesc; |
535 |
+ } |
536 |
+ |
537 |
++static __u8 *va_logical_boundary_fixup(struct hid_device *hdev, __u8 *rdesc, |
538 |
++ unsigned int *rsize) |
539 |
++{ |
540 |
++ /* |
541 |
++ * Varmilo VA104M (with VID Cypress and device ID 07B1) incorrectly |
542 |
++ * reports Logical Minimum of its Consumer Control device as 572 |
543 |
++ * (0x02 0x3c). Fix this by setting its Logical Minimum to zero. |
544 |
++ */ |
545 |
++ if (*rsize == 25 && |
546 |
++ rdesc[0] == 0x05 && rdesc[1] == 0x0c && |
547 |
++ rdesc[2] == 0x09 && rdesc[3] == 0x01 && |
548 |
++ rdesc[6] == 0x19 && rdesc[7] == 0x00 && |
549 |
++ rdesc[11] == 0x16 && rdesc[12] == 0x3c && rdesc[13] == 0x02) { |
550 |
++ hid_info(hdev, |
551 |
++ "fixing up varmilo VA104M consumer control report descriptor\n"); |
552 |
++ rdesc[12] = 0x00; |
553 |
++ rdesc[13] = 0x00; |
554 |
++ } |
555 |
++ return rdesc; |
556 |
++} |
557 |
++ |
558 |
++static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
559 |
++ unsigned int *rsize) |
560 |
++{ |
561 |
++ unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); |
562 |
++ |
563 |
++ if (quirks & CP_RDESC_SWAPPED_MIN_MAX) |
564 |
++ rdesc = cp_rdesc_fixup(hdev, rdesc, rsize); |
565 |
++ if (quirks & VA_INVAL_LOGICAL_BOUNDARY) |
566 |
++ rdesc = va_logical_boundary_fixup(hdev, rdesc, rsize); |
567 |
++ |
568 |
++ return rdesc; |
569 |
++} |
570 |
++ |
571 |
+ static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi, |
572 |
+ struct hid_field *field, struct hid_usage *usage, |
573 |
+ unsigned long **bit, int *max) |
574 |
+@@ -131,6 +163,8 @@ static const struct hid_device_id cp_devices[] = { |
575 |
+ .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, |
576 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE), |
577 |
+ .driver_data = CP_2WHEEL_MOUSE_HACK }, |
578 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_VARMILO_VA104M_07B1), |
579 |
++ .driver_data = VA_INVAL_LOGICAL_BOUNDARY }, |
580 |
+ { } |
581 |
+ }; |
582 |
+ MODULE_DEVICE_TABLE(hid, cp_devices); |
583 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
584 |
+index a1e5e0529545b..be0707cfc0fd1 100644 |
585 |
+--- a/drivers/hid/hid-ids.h |
586 |
++++ b/drivers/hid/hid-ids.h |
587 |
+@@ -322,6 +322,8 @@ |
588 |
+ #define USB_DEVICE_ID_CYPRESS_BARCODE_4 0xed81 |
589 |
+ #define USB_DEVICE_ID_CYPRESS_TRUETOUCH 0xc001 |
590 |
+ |
591 |
++#define USB_DEVICE_ID_CYPRESS_VARMILO_VA104M_07B1 0X07b1 |
592 |
++ |
593 |
+ #define USB_VENDOR_ID_DATA_MODUL 0x7374 |
594 |
+ #define USB_VENDOR_ID_DATA_MODUL_EASYMAXTOUCH 0x1201 |
595 |
+ |
596 |
+@@ -694,6 +696,7 @@ |
597 |
+ #define USB_VENDOR_ID_LOGITECH 0x046d |
598 |
+ #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e |
599 |
+ #define USB_DEVICE_ID_LOGITECH_T651 0xb00c |
600 |
++#define USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD 0xb309 |
601 |
+ #define USB_DEVICE_ID_LOGITECH_C007 0xc007 |
602 |
+ #define USB_DEVICE_ID_LOGITECH_C077 0xc077 |
603 |
+ #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 |
604 |
+diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c |
605 |
+index 07a043ae69f12..0e63cedcc3b51 100644 |
606 |
+--- a/drivers/hid/hid-input.c |
607 |
++++ b/drivers/hid/hid-input.c |
608 |
+@@ -331,6 +331,9 @@ static const struct hid_device_id hid_battery_quirks[] = { |
609 |
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ASUSTEK, |
610 |
+ USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD), |
611 |
+ HID_BATTERY_QUIRK_IGNORE }, |
612 |
++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, |
613 |
++ USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD), |
614 |
++ HID_BATTERY_QUIRK_IGNORE }, |
615 |
+ {} |
616 |
+ }; |
617 |
+ |
618 |
+diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c |
619 |
+index b5bd5cb7d5324..aa078c1dad14f 100644 |
620 |
+--- a/drivers/hid/hid-sensor-hub.c |
621 |
++++ b/drivers/hid/hid-sensor-hub.c |
622 |
+@@ -496,7 +496,8 @@ static int sensor_hub_raw_event(struct hid_device *hdev, |
623 |
+ return 1; |
624 |
+ |
625 |
+ ptr = raw_data; |
626 |
+- ptr++; /* Skip report id */ |
627 |
++ if (report->id) |
628 |
++ ptr++; /* Skip report id */ |
629 |
+ |
630 |
+ spin_lock_irqsave(&pdata->lock, flags); |
631 |
+ |
632 |
+diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c |
633 |
+index a6531ffe29a6f..a5694dec3f2ee 100644 |
634 |
+--- a/drivers/infiniband/hw/mthca/mthca_cq.c |
635 |
++++ b/drivers/infiniband/hw/mthca/mthca_cq.c |
636 |
+@@ -808,8 +808,10 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, |
637 |
+ } |
638 |
+ |
639 |
+ mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); |
640 |
+- if (IS_ERR(mailbox)) |
641 |
++ if (IS_ERR(mailbox)) { |
642 |
++ err = PTR_ERR(mailbox); |
643 |
+ goto err_out_arm; |
644 |
++ } |
645 |
+ |
646 |
+ cq_context = mailbox->buf; |
647 |
+ |
648 |
+@@ -851,9 +853,9 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, |
649 |
+ } |
650 |
+ |
651 |
+ spin_lock_irq(&dev->cq_table.lock); |
652 |
+- if (mthca_array_set(&dev->cq_table.cq, |
653 |
+- cq->cqn & (dev->limits.num_cqs - 1), |
654 |
+- cq)) { |
655 |
++ err = mthca_array_set(&dev->cq_table.cq, |
656 |
++ cq->cqn & (dev->limits.num_cqs - 1), cq); |
657 |
++ if (err) { |
658 |
+ spin_unlock_irq(&dev->cq_table.lock); |
659 |
+ goto err_out_free_mr; |
660 |
+ } |
661 |
+diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c |
662 |
+index 824f4c1c1f310..0e9f248370a3f 100644 |
663 |
+--- a/drivers/input/serio/i8042.c |
664 |
++++ b/drivers/input/serio/i8042.c |
665 |
+@@ -125,6 +125,7 @@ module_param_named(unmask_kbd_data, i8042_unmask_kbd_data, bool, 0600); |
666 |
+ 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]"); |
667 |
+ #endif |
668 |
+ |
669 |
++static bool i8042_present; |
670 |
+ static bool i8042_bypass_aux_irq_test; |
671 |
+ static char i8042_kbd_firmware_id[128]; |
672 |
+ static char i8042_aux_firmware_id[128]; |
673 |
+@@ -345,6 +346,9 @@ int i8042_command(unsigned char *param, int command) |
674 |
+ unsigned long flags; |
675 |
+ int retval; |
676 |
+ |
677 |
++ if (!i8042_present) |
678 |
++ return -1; |
679 |
++ |
680 |
+ spin_lock_irqsave(&i8042_lock, flags); |
681 |
+ retval = __i8042_command(param, command); |
682 |
+ spin_unlock_irqrestore(&i8042_lock, flags); |
683 |
+@@ -1599,12 +1603,15 @@ static int __init i8042_init(void) |
684 |
+ |
685 |
+ err = i8042_platform_init(); |
686 |
+ if (err) |
687 |
+- return err; |
688 |
++ return (err == -ENODEV) ? 0 : err; |
689 |
+ |
690 |
+ err = i8042_controller_check(); |
691 |
+ if (err) |
692 |
+ goto err_platform_exit; |
693 |
+ |
694 |
++ /* Set this before creating the dev to allow i8042_command to work right away */ |
695 |
++ i8042_present = true; |
696 |
++ |
697 |
+ pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, NULL, 0); |
698 |
+ if (IS_ERR(pdev)) { |
699 |
+ err = PTR_ERR(pdev); |
700 |
+@@ -1623,6 +1630,9 @@ static int __init i8042_init(void) |
701 |
+ |
702 |
+ static void __exit i8042_exit(void) |
703 |
+ { |
704 |
++ if (!i8042_present) |
705 |
++ return; |
706 |
++ |
707 |
+ platform_device_unregister(i8042_platform_device); |
708 |
+ platform_driver_unregister(&i8042_driver); |
709 |
+ i8042_platform_exit(); |
710 |
+diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c |
711 |
+index 680ee8345211f..a3f2548c5548c 100644 |
712 |
+--- a/drivers/net/can/m_can/m_can.c |
713 |
++++ b/drivers/net/can/m_can/m_can.c |
714 |
+@@ -972,7 +972,7 @@ static const struct can_bittiming_const m_can_bittiming_const_31X = { |
715 |
+ .name = KBUILD_MODNAME, |
716 |
+ .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ |
717 |
+ .tseg1_max = 256, |
718 |
+- .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ |
719 |
++ .tseg2_min = 2, /* Time segment 2 = phase_seg2 */ |
720 |
+ .tseg2_max = 128, |
721 |
+ .sjw_max = 128, |
722 |
+ .brp_min = 1, |
723 |
+diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c |
724 |
+index aed8ab6d6c5b0..99c42f297afdf 100644 |
725 |
+--- a/drivers/net/can/usb/gs_usb.c |
726 |
++++ b/drivers/net/can/usb/gs_usb.c |
727 |
+@@ -71,21 +71,27 @@ enum gs_can_identify_mode { |
728 |
+ }; |
729 |
+ |
730 |
+ /* data types passed between host and device */ |
731 |
++ |
732 |
++/* The firmware on the original USB2CAN by Geschwister Schneider |
733 |
++ * Technologie Entwicklungs- und Vertriebs UG exchanges all data |
734 |
++ * between the host and the device in host byte order. This is done |
735 |
++ * with the struct gs_host_config::byte_order member, which is sent |
736 |
++ * first to indicate the desired byte order. |
737 |
++ * |
738 |
++ * The widely used open source firmware candleLight doesn't support |
739 |
++ * this feature and exchanges the data in little endian byte order. |
740 |
++ */ |
741 |
+ struct gs_host_config { |
742 |
+- u32 byte_order; |
743 |
++ __le32 byte_order; |
744 |
+ } __packed; |
745 |
+-/* All data exchanged between host and device is exchanged in host byte order, |
746 |
+- * thanks to the struct gs_host_config byte_order member, which is sent first |
747 |
+- * to indicate the desired byte order. |
748 |
+- */ |
749 |
+ |
750 |
+ struct gs_device_config { |
751 |
+ u8 reserved1; |
752 |
+ u8 reserved2; |
753 |
+ u8 reserved3; |
754 |
+ u8 icount; |
755 |
+- u32 sw_version; |
756 |
+- u32 hw_version; |
757 |
++ __le32 sw_version; |
758 |
++ __le32 hw_version; |
759 |
+ } __packed; |
760 |
+ |
761 |
+ #define GS_CAN_MODE_NORMAL 0 |
762 |
+@@ -95,26 +101,26 @@ struct gs_device_config { |
763 |
+ #define GS_CAN_MODE_ONE_SHOT BIT(3) |
764 |
+ |
765 |
+ struct gs_device_mode { |
766 |
+- u32 mode; |
767 |
+- u32 flags; |
768 |
++ __le32 mode; |
769 |
++ __le32 flags; |
770 |
+ } __packed; |
771 |
+ |
772 |
+ struct gs_device_state { |
773 |
+- u32 state; |
774 |
+- u32 rxerr; |
775 |
+- u32 txerr; |
776 |
++ __le32 state; |
777 |
++ __le32 rxerr; |
778 |
++ __le32 txerr; |
779 |
+ } __packed; |
780 |
+ |
781 |
+ struct gs_device_bittiming { |
782 |
+- u32 prop_seg; |
783 |
+- u32 phase_seg1; |
784 |
+- u32 phase_seg2; |
785 |
+- u32 sjw; |
786 |
+- u32 brp; |
787 |
++ __le32 prop_seg; |
788 |
++ __le32 phase_seg1; |
789 |
++ __le32 phase_seg2; |
790 |
++ __le32 sjw; |
791 |
++ __le32 brp; |
792 |
+ } __packed; |
793 |
+ |
794 |
+ struct gs_identify_mode { |
795 |
+- u32 mode; |
796 |
++ __le32 mode; |
797 |
+ } __packed; |
798 |
+ |
799 |
+ #define GS_CAN_FEATURE_LISTEN_ONLY BIT(0) |
800 |
+@@ -125,23 +131,23 @@ struct gs_identify_mode { |
801 |
+ #define GS_CAN_FEATURE_IDENTIFY BIT(5) |
802 |
+ |
803 |
+ struct gs_device_bt_const { |
804 |
+- u32 feature; |
805 |
+- u32 fclk_can; |
806 |
+- u32 tseg1_min; |
807 |
+- u32 tseg1_max; |
808 |
+- u32 tseg2_min; |
809 |
+- u32 tseg2_max; |
810 |
+- u32 sjw_max; |
811 |
+- u32 brp_min; |
812 |
+- u32 brp_max; |
813 |
+- u32 brp_inc; |
814 |
++ __le32 feature; |
815 |
++ __le32 fclk_can; |
816 |
++ __le32 tseg1_min; |
817 |
++ __le32 tseg1_max; |
818 |
++ __le32 tseg2_min; |
819 |
++ __le32 tseg2_max; |
820 |
++ __le32 sjw_max; |
821 |
++ __le32 brp_min; |
822 |
++ __le32 brp_max; |
823 |
++ __le32 brp_inc; |
824 |
+ } __packed; |
825 |
+ |
826 |
+ #define GS_CAN_FLAG_OVERFLOW 1 |
827 |
+ |
828 |
+ struct gs_host_frame { |
829 |
+ u32 echo_id; |
830 |
+- u32 can_id; |
831 |
++ __le32 can_id; |
832 |
+ |
833 |
+ u8 can_dlc; |
834 |
+ u8 channel; |
835 |
+@@ -337,13 +343,13 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) |
836 |
+ if (!skb) |
837 |
+ return; |
838 |
+ |
839 |
+- cf->can_id = hf->can_id; |
840 |
++ cf->can_id = le32_to_cpu(hf->can_id); |
841 |
+ |
842 |
+ cf->can_dlc = get_can_dlc(hf->can_dlc); |
843 |
+ memcpy(cf->data, hf->data, 8); |
844 |
+ |
845 |
+ /* ERROR frames tell us information about the controller */ |
846 |
+- if (hf->can_id & CAN_ERR_FLAG) |
847 |
++ if (le32_to_cpu(hf->can_id) & CAN_ERR_FLAG) |
848 |
+ gs_update_state(dev, cf); |
849 |
+ |
850 |
+ netdev->stats.rx_packets++; |
851 |
+@@ -426,11 +432,11 @@ static int gs_usb_set_bittiming(struct net_device *netdev) |
852 |
+ if (!dbt) |
853 |
+ return -ENOMEM; |
854 |
+ |
855 |
+- dbt->prop_seg = bt->prop_seg; |
856 |
+- dbt->phase_seg1 = bt->phase_seg1; |
857 |
+- dbt->phase_seg2 = bt->phase_seg2; |
858 |
+- dbt->sjw = bt->sjw; |
859 |
+- dbt->brp = bt->brp; |
860 |
++ dbt->prop_seg = cpu_to_le32(bt->prop_seg); |
861 |
++ dbt->phase_seg1 = cpu_to_le32(bt->phase_seg1); |
862 |
++ dbt->phase_seg2 = cpu_to_le32(bt->phase_seg2); |
863 |
++ dbt->sjw = cpu_to_le32(bt->sjw); |
864 |
++ dbt->brp = cpu_to_le32(bt->brp); |
865 |
+ |
866 |
+ /* request bit timings */ |
867 |
+ rc = usb_control_msg(interface_to_usbdev(intf), |
868 |
+@@ -511,7 +517,7 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, |
869 |
+ |
870 |
+ cf = (struct can_frame *)skb->data; |
871 |
+ |
872 |
+- hf->can_id = cf->can_id; |
873 |
++ hf->can_id = cpu_to_le32(cf->can_id); |
874 |
+ hf->can_dlc = cf->can_dlc; |
875 |
+ memcpy(hf->data, cf->data, cf->can_dlc); |
876 |
+ |
877 |
+@@ -581,6 +587,7 @@ static int gs_can_open(struct net_device *netdev) |
878 |
+ int rc, i; |
879 |
+ struct gs_device_mode *dm; |
880 |
+ u32 ctrlmode; |
881 |
++ u32 flags = 0; |
882 |
+ |
883 |
+ rc = open_candev(netdev); |
884 |
+ if (rc) |
885 |
+@@ -648,24 +655,24 @@ static int gs_can_open(struct net_device *netdev) |
886 |
+ |
887 |
+ /* flags */ |
888 |
+ ctrlmode = dev->can.ctrlmode; |
889 |
+- dm->flags = 0; |
890 |
+ |
891 |
+ if (ctrlmode & CAN_CTRLMODE_LOOPBACK) |
892 |
+- dm->flags |= GS_CAN_MODE_LOOP_BACK; |
893 |
++ flags |= GS_CAN_MODE_LOOP_BACK; |
894 |
+ else if (ctrlmode & CAN_CTRLMODE_LISTENONLY) |
895 |
+- dm->flags |= GS_CAN_MODE_LISTEN_ONLY; |
896 |
++ flags |= GS_CAN_MODE_LISTEN_ONLY; |
897 |
+ |
898 |
+ /* Controller is not allowed to retry TX |
899 |
+ * this mode is unavailable on atmels uc3c hardware |
900 |
+ */ |
901 |
+ if (ctrlmode & CAN_CTRLMODE_ONE_SHOT) |
902 |
+- dm->flags |= GS_CAN_MODE_ONE_SHOT; |
903 |
++ flags |= GS_CAN_MODE_ONE_SHOT; |
904 |
+ |
905 |
+ if (ctrlmode & CAN_CTRLMODE_3_SAMPLES) |
906 |
+- dm->flags |= GS_CAN_MODE_TRIPLE_SAMPLE; |
907 |
++ flags |= GS_CAN_MODE_TRIPLE_SAMPLE; |
908 |
+ |
909 |
+ /* finally start device */ |
910 |
+- dm->mode = GS_CAN_MODE_START; |
911 |
++ dm->mode = cpu_to_le32(GS_CAN_MODE_START); |
912 |
++ dm->flags = cpu_to_le32(flags); |
913 |
+ rc = usb_control_msg(interface_to_usbdev(dev->iface), |
914 |
+ usb_sndctrlpipe(interface_to_usbdev(dev->iface), 0), |
915 |
+ GS_USB_BREQ_MODE, |
916 |
+@@ -745,9 +752,9 @@ static int gs_usb_set_identify(struct net_device *netdev, bool do_identify) |
917 |
+ return -ENOMEM; |
918 |
+ |
919 |
+ if (do_identify) |
920 |
+- imode->mode = GS_CAN_IDENTIFY_ON; |
921 |
++ imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_ON); |
922 |
+ else |
923 |
+- imode->mode = GS_CAN_IDENTIFY_OFF; |
924 |
++ imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_OFF); |
925 |
+ |
926 |
+ rc = usb_control_msg(interface_to_usbdev(dev->iface), |
927 |
+ usb_sndctrlpipe(interface_to_usbdev(dev->iface), |
928 |
+@@ -798,6 +805,7 @@ static struct gs_can *gs_make_candev(unsigned int channel, |
929 |
+ struct net_device *netdev; |
930 |
+ int rc; |
931 |
+ struct gs_device_bt_const *bt_const; |
932 |
++ u32 feature; |
933 |
+ |
934 |
+ bt_const = kmalloc(sizeof(*bt_const), GFP_KERNEL); |
935 |
+ if (!bt_const) |
936 |
+@@ -838,14 +846,14 @@ static struct gs_can *gs_make_candev(unsigned int channel, |
937 |
+ |
938 |
+ /* dev settup */ |
939 |
+ strcpy(dev->bt_const.name, "gs_usb"); |
940 |
+- dev->bt_const.tseg1_min = bt_const->tseg1_min; |
941 |
+- dev->bt_const.tseg1_max = bt_const->tseg1_max; |
942 |
+- dev->bt_const.tseg2_min = bt_const->tseg2_min; |
943 |
+- dev->bt_const.tseg2_max = bt_const->tseg2_max; |
944 |
+- dev->bt_const.sjw_max = bt_const->sjw_max; |
945 |
+- dev->bt_const.brp_min = bt_const->brp_min; |
946 |
+- dev->bt_const.brp_max = bt_const->brp_max; |
947 |
+- dev->bt_const.brp_inc = bt_const->brp_inc; |
948 |
++ dev->bt_const.tseg1_min = le32_to_cpu(bt_const->tseg1_min); |
949 |
++ dev->bt_const.tseg1_max = le32_to_cpu(bt_const->tseg1_max); |
950 |
++ dev->bt_const.tseg2_min = le32_to_cpu(bt_const->tseg2_min); |
951 |
++ dev->bt_const.tseg2_max = le32_to_cpu(bt_const->tseg2_max); |
952 |
++ dev->bt_const.sjw_max = le32_to_cpu(bt_const->sjw_max); |
953 |
++ dev->bt_const.brp_min = le32_to_cpu(bt_const->brp_min); |
954 |
++ dev->bt_const.brp_max = le32_to_cpu(bt_const->brp_max); |
955 |
++ dev->bt_const.brp_inc = le32_to_cpu(bt_const->brp_inc); |
956 |
+ |
957 |
+ dev->udev = interface_to_usbdev(intf); |
958 |
+ dev->iface = intf; |
959 |
+@@ -862,28 +870,29 @@ static struct gs_can *gs_make_candev(unsigned int channel, |
960 |
+ |
961 |
+ /* can settup */ |
962 |
+ dev->can.state = CAN_STATE_STOPPED; |
963 |
+- dev->can.clock.freq = bt_const->fclk_can; |
964 |
++ dev->can.clock.freq = le32_to_cpu(bt_const->fclk_can); |
965 |
+ dev->can.bittiming_const = &dev->bt_const; |
966 |
+ dev->can.do_set_bittiming = gs_usb_set_bittiming; |
967 |
+ |
968 |
+ dev->can.ctrlmode_supported = 0; |
969 |
+ |
970 |
+- if (bt_const->feature & GS_CAN_FEATURE_LISTEN_ONLY) |
971 |
++ feature = le32_to_cpu(bt_const->feature); |
972 |
++ if (feature & GS_CAN_FEATURE_LISTEN_ONLY) |
973 |
+ dev->can.ctrlmode_supported |= CAN_CTRLMODE_LISTENONLY; |
974 |
+ |
975 |
+- if (bt_const->feature & GS_CAN_FEATURE_LOOP_BACK) |
976 |
++ if (feature & GS_CAN_FEATURE_LOOP_BACK) |
977 |
+ dev->can.ctrlmode_supported |= CAN_CTRLMODE_LOOPBACK; |
978 |
+ |
979 |
+- if (bt_const->feature & GS_CAN_FEATURE_TRIPLE_SAMPLE) |
980 |
++ if (feature & GS_CAN_FEATURE_TRIPLE_SAMPLE) |
981 |
+ dev->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES; |
982 |
+ |
983 |
+- if (bt_const->feature & GS_CAN_FEATURE_ONE_SHOT) |
984 |
++ if (feature & GS_CAN_FEATURE_ONE_SHOT) |
985 |
+ dev->can.ctrlmode_supported |= CAN_CTRLMODE_ONE_SHOT; |
986 |
+ |
987 |
+ SET_NETDEV_DEV(netdev, &intf->dev); |
988 |
+ |
989 |
+- if (dconf->sw_version > 1) |
990 |
+- if (bt_const->feature & GS_CAN_FEATURE_IDENTIFY) |
991 |
++ if (le32_to_cpu(dconf->sw_version) > 1) |
992 |
++ if (feature & GS_CAN_FEATURE_IDENTIFY) |
993 |
+ netdev->ethtool_ops = &gs_usb_ethtool_ops; |
994 |
+ |
995 |
+ kfree(bt_const); |
996 |
+@@ -918,7 +927,7 @@ static int gs_usb_probe(struct usb_interface *intf, |
997 |
+ if (!hconf) |
998 |
+ return -ENOMEM; |
999 |
+ |
1000 |
+- hconf->byte_order = 0x0000beef; |
1001 |
++ hconf->byte_order = cpu_to_le32(0x0000beef); |
1002 |
+ |
1003 |
+ /* send host config */ |
1004 |
+ rc = usb_control_msg(interface_to_usbdev(intf), |
1005 |
+diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1006 |
+index d9ece9ac6f53c..938170b91f85e 100644 |
1007 |
+--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1008 |
++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1009 |
+@@ -2474,16 +2474,9 @@ static int ena_device_init(struct ena_com_dev *ena_dev, struct pci_dev *pdev, |
1010 |
+ goto err_mmio_read_less; |
1011 |
+ } |
1012 |
+ |
1013 |
+- rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(dma_width)); |
1014 |
++ rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(dma_width)); |
1015 |
+ if (rc) { |
1016 |
+- dev_err(dev, "pci_set_dma_mask failed 0x%x\n", rc); |
1017 |
+- goto err_mmio_read_less; |
1018 |
+- } |
1019 |
+- |
1020 |
+- rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(dma_width)); |
1021 |
+- if (rc) { |
1022 |
+- dev_err(dev, "err_pci_set_consistent_dma_mask failed 0x%x\n", |
1023 |
+- rc); |
1024 |
++ dev_err(dev, "dma_set_mask_and_coherent failed %d\n", rc); |
1025 |
+ goto err_mmio_read_less; |
1026 |
+ } |
1027 |
+ |
1028 |
+@@ -3141,6 +3134,12 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
1029 |
+ return rc; |
1030 |
+ } |
1031 |
+ |
1032 |
++ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(ENA_MAX_PHYS_ADDR_SIZE_BITS)); |
1033 |
++ if (rc) { |
1034 |
++ dev_err(&pdev->dev, "dma_set_mask_and_coherent failed %d\n", rc); |
1035 |
++ goto err_disable_device; |
1036 |
++ } |
1037 |
++ |
1038 |
+ pci_set_master(pdev); |
1039 |
+ |
1040 |
+ ena_dev = vzalloc(sizeof(*ena_dev)); |
1041 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1042 |
+index e146f6a1fa80d..ea2a539e6e0f7 100644 |
1043 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1044 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
1045 |
+@@ -7212,7 +7212,8 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev) |
1046 |
+ if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0 && |
1047 |
+ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) { |
1048 |
+ dev_err(&pdev->dev, "System does not support DMA, aborting\n"); |
1049 |
+- goto init_err_disable; |
1050 |
++ rc = -EIO; |
1051 |
++ goto init_err_release; |
1052 |
+ } |
1053 |
+ |
1054 |
+ pci_set_master(pdev); |
1055 |
+@@ -8233,6 +8234,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1056 |
+ create_singlethread_workqueue("bnxt_pf_wq"); |
1057 |
+ if (!bnxt_pf_wq) { |
1058 |
+ dev_err(&pdev->dev, "Unable to create workqueue.\n"); |
1059 |
++ rc = -ENOMEM; |
1060 |
+ goto init_err_pci_clean; |
1061 |
+ } |
1062 |
+ } |
1063 |
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
1064 |
+index 8b8a0c4fbc993..9a524b0e3e7ba 100644 |
1065 |
+--- a/drivers/net/ethernet/ibm/ibmvnic.c |
1066 |
++++ b/drivers/net/ethernet/ibm/ibmvnic.c |
1067 |
+@@ -1977,6 +1977,9 @@ static int reset_sub_crq_queues(struct ibmvnic_adapter *adapter) |
1068 |
+ { |
1069 |
+ int i, rc; |
1070 |
+ |
1071 |
++ if (!adapter->tx_scrq || !adapter->rx_scrq) |
1072 |
++ return -EINVAL; |
1073 |
++ |
1074 |
+ for (i = 0; i < adapter->req_tx_queues; i++) { |
1075 |
+ netdev_dbg(adapter->netdev, "Re-setting tx_scrq[%d]\n", i); |
1076 |
+ rc = reset_one_sub_crq_queue(adapter, adapter->tx_scrq[i]); |
1077 |
+@@ -3709,6 +3712,9 @@ static int ibmvnic_reset_crq(struct ibmvnic_adapter *adapter) |
1078 |
+ } while (rc == H_BUSY || H_IS_LONG_BUSY(rc)); |
1079 |
+ |
1080 |
+ /* Clean out the queue */ |
1081 |
++ if (!crq->msgs) |
1082 |
++ return -EINVAL; |
1083 |
++ |
1084 |
+ memset(crq->msgs, 0, PAGE_SIZE); |
1085 |
+ crq->cur = 0; |
1086 |
+ |
1087 |
+diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c |
1088 |
+index 3f09d7fd2285f..da7ca08d185e4 100644 |
1089 |
+--- a/drivers/nfc/s3fwrn5/i2c.c |
1090 |
++++ b/drivers/nfc/s3fwrn5/i2c.c |
1091 |
+@@ -37,8 +37,8 @@ struct s3fwrn5_i2c_phy { |
1092 |
+ struct i2c_client *i2c_dev; |
1093 |
+ struct nci_dev *ndev; |
1094 |
+ |
1095 |
+- unsigned int gpio_en; |
1096 |
+- unsigned int gpio_fw_wake; |
1097 |
++ int gpio_en; |
1098 |
++ int gpio_fw_wake; |
1099 |
+ |
1100 |
+ struct mutex mutex; |
1101 |
+ |
1102 |
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
1103 |
+index 3788c053a0b19..540fab9f850dd 100644 |
1104 |
+--- a/drivers/nvme/host/pci.c |
1105 |
++++ b/drivers/nvme/host/pci.c |
1106 |
+@@ -266,9 +266,21 @@ static void nvme_dbbuf_init(struct nvme_dev *dev, |
1107 |
+ nvmeq->dbbuf_cq_ei = &dev->dbbuf_eis[cq_idx(qid, dev->db_stride)]; |
1108 |
+ } |
1109 |
+ |
1110 |
++static void nvme_dbbuf_free(struct nvme_queue *nvmeq) |
1111 |
++{ |
1112 |
++ if (!nvmeq->qid) |
1113 |
++ return; |
1114 |
++ |
1115 |
++ nvmeq->dbbuf_sq_db = NULL; |
1116 |
++ nvmeq->dbbuf_cq_db = NULL; |
1117 |
++ nvmeq->dbbuf_sq_ei = NULL; |
1118 |
++ nvmeq->dbbuf_cq_ei = NULL; |
1119 |
++} |
1120 |
++ |
1121 |
+ static void nvme_dbbuf_set(struct nvme_dev *dev) |
1122 |
+ { |
1123 |
+ struct nvme_command c; |
1124 |
++ unsigned int i; |
1125 |
+ |
1126 |
+ if (!dev->dbbuf_dbs) |
1127 |
+ return; |
1128 |
+@@ -282,6 +294,9 @@ static void nvme_dbbuf_set(struct nvme_dev *dev) |
1129 |
+ dev_warn(dev->ctrl.device, "unable to set dbbuf\n"); |
1130 |
+ /* Free memory and continue on */ |
1131 |
+ nvme_dbbuf_dma_free(dev); |
1132 |
++ |
1133 |
++ for (i = 1; i <= dev->online_queues; i++) |
1134 |
++ nvme_dbbuf_free(&dev->queues[i]); |
1135 |
+ } |
1136 |
+ } |
1137 |
+ |
1138 |
+diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c |
1139 |
+index bc56cf19afd39..8f78e8c15d2ec 100644 |
1140 |
+--- a/drivers/pci/bus.c |
1141 |
++++ b/drivers/pci/bus.c |
1142 |
+@@ -324,12 +324,8 @@ void pci_bus_add_device(struct pci_dev *dev) |
1143 |
+ |
1144 |
+ dev->match_driver = true; |
1145 |
+ retval = device_attach(&dev->dev); |
1146 |
+- if (retval < 0 && retval != -EPROBE_DEFER) { |
1147 |
++ if (retval < 0 && retval != -EPROBE_DEFER) |
1148 |
+ dev_warn(&dev->dev, "device attach failed (%d)\n", retval); |
1149 |
+- pci_proc_detach_device(dev); |
1150 |
+- pci_remove_sysfs_dev_files(dev); |
1151 |
+- return; |
1152 |
+- } |
1153 |
+ |
1154 |
+ dev->is_added = 1; |
1155 |
+ } |
1156 |
+diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c |
1157 |
+index 11aa5902a9ac1..9c55e0f45ea8a 100644 |
1158 |
+--- a/drivers/phy/tegra/xusb.c |
1159 |
++++ b/drivers/phy/tegra/xusb.c |
1160 |
+@@ -912,6 +912,7 @@ remove_pads: |
1161 |
+ reset: |
1162 |
+ reset_control_assert(padctl->rst); |
1163 |
+ remove: |
1164 |
++ platform_set_drvdata(pdev, NULL); |
1165 |
+ soc->ops->remove(padctl); |
1166 |
+ return err; |
1167 |
+ } |
1168 |
+diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c |
1169 |
+index 8221e000c8c23..25955b4d80b0d 100644 |
1170 |
+--- a/drivers/platform/x86/toshiba_acpi.c |
1171 |
++++ b/drivers/platform/x86/toshiba_acpi.c |
1172 |
+@@ -1497,7 +1497,7 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf, |
1173 |
+ struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); |
1174 |
+ char *buffer; |
1175 |
+ char *cmd; |
1176 |
+- int lcd_out, crt_out, tv_out; |
1177 |
++ int lcd_out = -1, crt_out = -1, tv_out = -1; |
1178 |
+ int remain = count; |
1179 |
+ int value; |
1180 |
+ int ret; |
1181 |
+@@ -1529,7 +1529,6 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf, |
1182 |
+ |
1183 |
+ kfree(cmd); |
1184 |
+ |
1185 |
+- lcd_out = crt_out = tv_out = -1; |
1186 |
+ ret = get_video_status(dev, &video_out); |
1187 |
+ if (!ret) { |
1188 |
+ unsigned int new_video_out = video_out; |
1189 |
+diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c |
1190 |
+index 662df16b07a40..f7e1af90849b3 100644 |
1191 |
+--- a/drivers/scsi/libiscsi.c |
1192 |
++++ b/drivers/scsi/libiscsi.c |
1193 |
+@@ -571,8 +571,8 @@ static void iscsi_complete_task(struct iscsi_task *task, int state) |
1194 |
+ if (conn->task == task) |
1195 |
+ conn->task = NULL; |
1196 |
+ |
1197 |
+- if (conn->ping_task == task) |
1198 |
+- conn->ping_task = NULL; |
1199 |
++ if (READ_ONCE(conn->ping_task) == task) |
1200 |
++ WRITE_ONCE(conn->ping_task, NULL); |
1201 |
+ |
1202 |
+ /* release get from queueing */ |
1203 |
+ __iscsi_put_task(task); |
1204 |
+@@ -781,6 +781,9 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, |
1205 |
+ task->conn->session->age); |
1206 |
+ } |
1207 |
+ |
1208 |
++ if (unlikely(READ_ONCE(conn->ping_task) == INVALID_SCSI_TASK)) |
1209 |
++ WRITE_ONCE(conn->ping_task, task); |
1210 |
++ |
1211 |
+ if (!ihost->workq) { |
1212 |
+ if (iscsi_prep_mgmt_task(conn, task)) |
1213 |
+ goto free_task; |
1214 |
+@@ -988,8 +991,11 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) |
1215 |
+ struct iscsi_nopout hdr; |
1216 |
+ struct iscsi_task *task; |
1217 |
+ |
1218 |
+- if (!rhdr && conn->ping_task) |
1219 |
+- return -EINVAL; |
1220 |
++ if (!rhdr) { |
1221 |
++ if (READ_ONCE(conn->ping_task)) |
1222 |
++ return -EINVAL; |
1223 |
++ WRITE_ONCE(conn->ping_task, INVALID_SCSI_TASK); |
1224 |
++ } |
1225 |
+ |
1226 |
+ memset(&hdr, 0, sizeof(struct iscsi_nopout)); |
1227 |
+ hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE; |
1228 |
+@@ -1004,11 +1010,12 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) |
1229 |
+ |
1230 |
+ task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); |
1231 |
+ if (!task) { |
1232 |
++ if (!rhdr) |
1233 |
++ WRITE_ONCE(conn->ping_task, NULL); |
1234 |
+ iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); |
1235 |
+ return -EIO; |
1236 |
+ } else if (!rhdr) { |
1237 |
+ /* only track our nops */ |
1238 |
+- conn->ping_task = task; |
1239 |
+ conn->last_ping = jiffies; |
1240 |
+ } |
1241 |
+ |
1242 |
+@@ -1021,7 +1028,7 @@ static int iscsi_nop_out_rsp(struct iscsi_task *task, |
1243 |
+ struct iscsi_conn *conn = task->conn; |
1244 |
+ int rc = 0; |
1245 |
+ |
1246 |
+- if (conn->ping_task != task) { |
1247 |
++ if (READ_ONCE(conn->ping_task) != task) { |
1248 |
+ /* |
1249 |
+ * If this is not in response to one of our |
1250 |
+ * nops then it must be from userspace. |
1251 |
+@@ -1961,7 +1968,7 @@ static void iscsi_start_tx(struct iscsi_conn *conn) |
1252 |
+ */ |
1253 |
+ static int iscsi_has_ping_timed_out(struct iscsi_conn *conn) |
1254 |
+ { |
1255 |
+- if (conn->ping_task && |
1256 |
++ if (READ_ONCE(conn->ping_task) && |
1257 |
+ time_before_eq(conn->last_recv + (conn->recv_timeout * HZ) + |
1258 |
+ (conn->ping_timeout * HZ), jiffies)) |
1259 |
+ return 1; |
1260 |
+@@ -2096,7 +2103,7 @@ enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc) |
1261 |
+ * Checking the transport already or nop from a cmd timeout still |
1262 |
+ * running |
1263 |
+ */ |
1264 |
+- if (conn->ping_task) { |
1265 |
++ if (READ_ONCE(conn->ping_task)) { |
1266 |
+ task->have_checked_conn = true; |
1267 |
+ rc = BLK_EH_RESET_TIMER; |
1268 |
+ goto done; |
1269 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
1270 |
+index c1792f271ac5d..a3a3ee6e2a002 100644 |
1271 |
+--- a/drivers/scsi/ufs/ufshcd.c |
1272 |
++++ b/drivers/scsi/ufs/ufshcd.c |
1273 |
+@@ -7792,11 +7792,7 @@ int ufshcd_shutdown(struct ufs_hba *hba) |
1274 |
+ if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba)) |
1275 |
+ goto out; |
1276 |
+ |
1277 |
+- if (pm_runtime_suspended(hba->dev)) { |
1278 |
+- ret = ufshcd_runtime_resume(hba); |
1279 |
+- if (ret) |
1280 |
+- goto out; |
1281 |
+- } |
1282 |
++ pm_runtime_get_sync(hba->dev); |
1283 |
+ |
1284 |
+ ret = ufshcd_suspend(hba, UFS_SHUTDOWN_PM); |
1285 |
+ out: |
1286 |
+diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
1287 |
+index da80c03de6ea4..d9fcef82ddf59 100644 |
1288 |
+--- a/drivers/target/iscsi/iscsi_target.c |
1289 |
++++ b/drivers/target/iscsi/iscsi_target.c |
1290 |
+@@ -490,8 +490,7 @@ EXPORT_SYMBOL(iscsit_queue_rsp); |
1291 |
+ void iscsit_aborted_task(struct iscsi_conn *conn, struct iscsi_cmd *cmd) |
1292 |
+ { |
1293 |
+ spin_lock_bh(&conn->cmd_lock); |
1294 |
+- if (!list_empty(&cmd->i_conn_node) && |
1295 |
+- !(cmd->se_cmd.transport_state & CMD_T_FABRIC_STOP)) |
1296 |
++ if (!list_empty(&cmd->i_conn_node)) |
1297 |
+ list_del_init(&cmd->i_conn_node); |
1298 |
+ spin_unlock_bh(&conn->cmd_lock); |
1299 |
+ |
1300 |
+@@ -4086,12 +4085,22 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) |
1301 |
+ spin_lock_bh(&conn->cmd_lock); |
1302 |
+ list_splice_init(&conn->conn_cmd_list, &tmp_list); |
1303 |
+ |
1304 |
+- list_for_each_entry(cmd, &tmp_list, i_conn_node) { |
1305 |
++ list_for_each_entry_safe(cmd, cmd_tmp, &tmp_list, i_conn_node) { |
1306 |
+ struct se_cmd *se_cmd = &cmd->se_cmd; |
1307 |
+ |
1308 |
+ if (se_cmd->se_tfo != NULL) { |
1309 |
+ spin_lock_irq(&se_cmd->t_state_lock); |
1310 |
+- se_cmd->transport_state |= CMD_T_FABRIC_STOP; |
1311 |
++ if (se_cmd->transport_state & CMD_T_ABORTED) { |
1312 |
++ /* |
1313 |
++ * LIO's abort path owns the cleanup for this, |
1314 |
++ * so put it back on the list and let |
1315 |
++ * aborted_task handle it. |
1316 |
++ */ |
1317 |
++ list_move_tail(&cmd->i_conn_node, |
1318 |
++ &conn->conn_cmd_list); |
1319 |
++ } else { |
1320 |
++ se_cmd->transport_state |= CMD_T_FABRIC_STOP; |
1321 |
++ } |
1322 |
+ spin_unlock_irq(&se_cmd->t_state_lock); |
1323 |
+ } |
1324 |
+ } |
1325 |
+diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c |
1326 |
+index 7df7faa3eed5d..88ca8129d9df0 100644 |
1327 |
+--- a/drivers/usb/core/config.c |
1328 |
++++ b/drivers/usb/core/config.c |
1329 |
+@@ -256,6 +256,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, |
1330 |
+ struct usb_host_interface *ifp, int num_ep, |
1331 |
+ unsigned char *buffer, int size) |
1332 |
+ { |
1333 |
++ struct usb_device *udev = to_usb_device(ddev); |
1334 |
+ unsigned char *buffer0 = buffer; |
1335 |
+ struct usb_endpoint_descriptor *d; |
1336 |
+ struct usb_host_endpoint *endpoint; |
1337 |
+@@ -297,6 +298,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, |
1338 |
+ goto skip_to_next_endpoint_or_interface_descriptor; |
1339 |
+ } |
1340 |
+ |
1341 |
++ /* Ignore blacklisted endpoints */ |
1342 |
++ if (udev->quirks & USB_QUIRK_ENDPOINT_BLACKLIST) { |
1343 |
++ if (usb_endpoint_is_blacklisted(udev, ifp, d)) { |
1344 |
++ dev_warn(ddev, "config %d interface %d altsetting %d has a blacklisted endpoint with address 0x%X, skipping\n", |
1345 |
++ cfgno, inum, asnum, |
1346 |
++ d->bEndpointAddress); |
1347 |
++ goto skip_to_next_endpoint_or_interface_descriptor; |
1348 |
++ } |
1349 |
++ } |
1350 |
++ |
1351 |
+ endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints]; |
1352 |
+ ++ifp->desc.bNumEndpoints; |
1353 |
+ |
1354 |
+diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c |
1355 |
+index 4fb4cf8c2f14d..a334933b5d52a 100644 |
1356 |
+--- a/drivers/usb/core/devio.c |
1357 |
++++ b/drivers/usb/core/devio.c |
1358 |
+@@ -478,11 +478,11 @@ static void snoop_urb(struct usb_device *udev, |
1359 |
+ |
1360 |
+ if (userurb) { /* Async */ |
1361 |
+ if (when == SUBMIT) |
1362 |
+- dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, " |
1363 |
++ dev_info(&udev->dev, "userurb %px, ep%d %s-%s, " |
1364 |
+ "length %u\n", |
1365 |
+ userurb, ep, t, d, length); |
1366 |
+ else |
1367 |
+- dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, " |
1368 |
++ dev_info(&udev->dev, "userurb %px, ep%d %s-%s, " |
1369 |
+ "actual_length %u status %d\n", |
1370 |
+ userurb, ep, t, d, length, |
1371 |
+ timeout_or_status); |
1372 |
+@@ -1946,7 +1946,7 @@ static int proc_reapurb(struct usb_dev_state *ps, void __user *arg) |
1373 |
+ if (as) { |
1374 |
+ int retval; |
1375 |
+ |
1376 |
+- snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
1377 |
++ snoop(&ps->dev->dev, "reap %px\n", as->userurb); |
1378 |
+ retval = processcompl(as, (void __user * __user *)arg); |
1379 |
+ free_async(as); |
1380 |
+ return retval; |
1381 |
+@@ -1963,7 +1963,7 @@ static int proc_reapurbnonblock(struct usb_dev_state *ps, void __user *arg) |
1382 |
+ |
1383 |
+ as = async_getcompleted(ps); |
1384 |
+ if (as) { |
1385 |
+- snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
1386 |
++ snoop(&ps->dev->dev, "reap %px\n", as->userurb); |
1387 |
+ retval = processcompl(as, (void __user * __user *)arg); |
1388 |
+ free_async(as); |
1389 |
+ } else { |
1390 |
+@@ -2089,7 +2089,7 @@ static int proc_reapurb_compat(struct usb_dev_state *ps, void __user *arg) |
1391 |
+ if (as) { |
1392 |
+ int retval; |
1393 |
+ |
1394 |
+- snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
1395 |
++ snoop(&ps->dev->dev, "reap %px\n", as->userurb); |
1396 |
+ retval = processcompl_compat(as, (void __user * __user *)arg); |
1397 |
+ free_async(as); |
1398 |
+ return retval; |
1399 |
+@@ -2106,7 +2106,7 @@ static int proc_reapurbnonblock_compat(struct usb_dev_state *ps, void __user *ar |
1400 |
+ |
1401 |
+ as = async_getcompleted(ps); |
1402 |
+ if (as) { |
1403 |
+- snoop(&ps->dev->dev, "reap %pK\n", as->userurb); |
1404 |
++ snoop(&ps->dev->dev, "reap %px\n", as->userurb); |
1405 |
+ retval = processcompl_compat(as, (void __user * __user *)arg); |
1406 |
+ free_async(as); |
1407 |
+ } else { |
1408 |
+@@ -2531,7 +2531,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, |
1409 |
+ #endif |
1410 |
+ |
1411 |
+ case USBDEVFS_DISCARDURB: |
1412 |
+- snoop(&dev->dev, "%s: DISCARDURB %pK\n", __func__, p); |
1413 |
++ snoop(&dev->dev, "%s: DISCARDURB %px\n", __func__, p); |
1414 |
+ ret = proc_unlinkurb(ps, p); |
1415 |
+ break; |
1416 |
+ |
1417 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
1418 |
+index ca74b67c4450d..34d8cece6dd3b 100644 |
1419 |
+--- a/drivers/usb/core/quirks.c |
1420 |
++++ b/drivers/usb/core/quirks.c |
1421 |
+@@ -195,6 +195,10 @@ static const struct usb_device_id usb_quirk_list[] = { |
1422 |
+ /* Guillemot Webcam Hercules Dualpix Exchange*/ |
1423 |
+ { USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME }, |
1424 |
+ |
1425 |
++ /* Guillemot Hercules DJ Console audio card (BZ 208357) */ |
1426 |
++ { USB_DEVICE(0x06f8, 0xb000), .driver_info = |
1427 |
++ USB_QUIRK_ENDPOINT_BLACKLIST }, |
1428 |
++ |
1429 |
+ /* Midiman M-Audio Keystation 88es */ |
1430 |
+ { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME }, |
1431 |
+ |
1432 |
+@@ -344,6 +348,40 @@ static const struct usb_device_id usb_amd_resume_quirk_list[] = { |
1433 |
+ { } /* terminating entry must be last */ |
1434 |
+ }; |
1435 |
+ |
1436 |
++/* |
1437 |
++ * Entries for blacklisted endpoints that should be ignored when parsing |
1438 |
++ * configuration descriptors. |
1439 |
++ * |
1440 |
++ * Matched for devices with USB_QUIRK_ENDPOINT_BLACKLIST. |
1441 |
++ */ |
1442 |
++static const struct usb_device_id usb_endpoint_blacklist[] = { |
1443 |
++ { USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x01 }, |
1444 |
++ { USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x81 }, |
1445 |
++ { } |
1446 |
++}; |
1447 |
++ |
1448 |
++bool usb_endpoint_is_blacklisted(struct usb_device *udev, |
1449 |
++ struct usb_host_interface *intf, |
1450 |
++ struct usb_endpoint_descriptor *epd) |
1451 |
++{ |
1452 |
++ const struct usb_device_id *id; |
1453 |
++ unsigned int address; |
1454 |
++ |
1455 |
++ for (id = usb_endpoint_blacklist; id->match_flags; ++id) { |
1456 |
++ if (!usb_match_device(udev, id)) |
1457 |
++ continue; |
1458 |
++ |
1459 |
++ if (!usb_match_one_id_intf(udev, intf, id)) |
1460 |
++ continue; |
1461 |
++ |
1462 |
++ address = id->driver_info; |
1463 |
++ if (address == epd->bEndpointAddress) |
1464 |
++ return true; |
1465 |
++ } |
1466 |
++ |
1467 |
++ return false; |
1468 |
++} |
1469 |
++ |
1470 |
+ static bool usb_match_any_interface(struct usb_device *udev, |
1471 |
+ const struct usb_device_id *id) |
1472 |
+ { |
1473 |
+diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h |
1474 |
+index 1b5f346d93ebb..abac872220931 100644 |
1475 |
+--- a/drivers/usb/core/usb.h |
1476 |
++++ b/drivers/usb/core/usb.h |
1477 |
+@@ -36,6 +36,9 @@ extern void usb_deauthorize_interface(struct usb_interface *); |
1478 |
+ extern void usb_authorize_interface(struct usb_interface *); |
1479 |
+ extern void usb_detect_quirks(struct usb_device *udev); |
1480 |
+ extern void usb_detect_interface_quirks(struct usb_device *udev); |
1481 |
++extern bool usb_endpoint_is_blacklisted(struct usb_device *udev, |
1482 |
++ struct usb_host_interface *intf, |
1483 |
++ struct usb_endpoint_descriptor *epd); |
1484 |
+ extern int usb_remove_device(struct usb_device *udev); |
1485 |
+ |
1486 |
+ extern int usb_get_device_descriptor(struct usb_device *dev, |
1487 |
+diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c |
1488 |
+index 71cf552b88281..34c0a385516ef 100644 |
1489 |
+--- a/drivers/usb/gadget/function/f_midi.c |
1490 |
++++ b/drivers/usb/gadget/function/f_midi.c |
1491 |
+@@ -1303,7 +1303,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) |
1492 |
+ midi->id = kstrdup(opts->id, GFP_KERNEL); |
1493 |
+ if (opts->id && !midi->id) { |
1494 |
+ status = -ENOMEM; |
1495 |
+- goto setup_fail; |
1496 |
++ goto midi_free; |
1497 |
+ } |
1498 |
+ midi->in_ports = opts->in_ports; |
1499 |
+ midi->out_ports = opts->out_ports; |
1500 |
+@@ -1315,7 +1315,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) |
1501 |
+ |
1502 |
+ status = kfifo_alloc(&midi->in_req_fifo, midi->qlen, GFP_KERNEL); |
1503 |
+ if (status) |
1504 |
+- goto setup_fail; |
1505 |
++ goto midi_free; |
1506 |
+ |
1507 |
+ spin_lock_init(&midi->transmit_lock); |
1508 |
+ |
1509 |
+@@ -1331,9 +1331,13 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) |
1510 |
+ |
1511 |
+ return &midi->func; |
1512 |
+ |
1513 |
++midi_free: |
1514 |
++ if (midi) |
1515 |
++ kfree(midi->id); |
1516 |
++ kfree(midi); |
1517 |
+ setup_fail: |
1518 |
+ mutex_unlock(&opts->lock); |
1519 |
+- kfree(midi); |
1520 |
++ |
1521 |
+ return ERR_PTR(status); |
1522 |
+ } |
1523 |
+ |
1524 |
+diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c |
1525 |
+index e431a8bc3a9d2..e9f7f2660cd1e 100644 |
1526 |
+--- a/drivers/usb/gadget/legacy/inode.c |
1527 |
++++ b/drivers/usb/gadget/legacy/inode.c |
1528 |
+@@ -2044,6 +2044,9 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) |
1529 |
+ return 0; |
1530 |
+ |
1531 |
+ Enomem: |
1532 |
++ kfree(CHIP); |
1533 |
++ CHIP = NULL; |
1534 |
++ |
1535 |
+ return -ENOMEM; |
1536 |
+ } |
1537 |
+ |
1538 |
+diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c |
1539 |
+index 2fd49b2358f8b..f3938c5278832 100644 |
1540 |
+--- a/drivers/video/fbdev/hyperv_fb.c |
1541 |
++++ b/drivers/video/fbdev/hyperv_fb.c |
1542 |
+@@ -712,7 +712,12 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) |
1543 |
+ goto err1; |
1544 |
+ } |
1545 |
+ |
1546 |
+- fb_virt = ioremap(par->mem->start, screen_fb_size); |
1547 |
++ /* |
1548 |
++ * Map the VRAM cacheable for performance. This is also required for |
1549 |
++ * VM Connect to display properly for ARM64 Linux VM, as the host also |
1550 |
++ * maps the VRAM cacheable. |
1551 |
++ */ |
1552 |
++ fb_virt = ioremap_cache(par->mem->start, screen_fb_size); |
1553 |
+ if (!fb_virt) |
1554 |
+ goto err2; |
1555 |
+ |
1556 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
1557 |
+index e985e820724e1..c5ae2f4a7ec32 100644 |
1558 |
+--- a/fs/btrfs/inode.c |
1559 |
++++ b/fs/btrfs/inode.c |
1560 |
+@@ -5584,11 +5584,14 @@ no_delete: |
1561 |
+ } |
1562 |
+ |
1563 |
+ /* |
1564 |
+- * this returns the key found in the dir entry in the location pointer. |
1565 |
+- * If no dir entries were found, location->objectid is 0. |
1566 |
++ * Return the key found in the dir entry in the location pointer, fill @type |
1567 |
++ * with BTRFS_FT_*, and return 0. |
1568 |
++ * |
1569 |
++ * If no dir entries were found, returns -ENOENT. |
1570 |
++ * If found a corrupted location in dir entry, returns -EUCLEAN. |
1571 |
+ */ |
1572 |
+ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry, |
1573 |
+- struct btrfs_key *location) |
1574 |
++ struct btrfs_key *location, u8 *type) |
1575 |
+ { |
1576 |
+ const char *name = dentry->d_name.name; |
1577 |
+ int namelen = dentry->d_name.len; |
1578 |
+@@ -5603,27 +5606,29 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry, |
1579 |
+ |
1580 |
+ di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(BTRFS_I(dir)), |
1581 |
+ name, namelen, 0); |
1582 |
+- if (IS_ERR(di)) |
1583 |
++ if (!di) { |
1584 |
++ ret = -ENOENT; |
1585 |
++ goto out; |
1586 |
++ } |
1587 |
++ if (IS_ERR(di)) { |
1588 |
+ ret = PTR_ERR(di); |
1589 |
+- |
1590 |
+- if (IS_ERR_OR_NULL(di)) |
1591 |
+- goto out_err; |
1592 |
++ goto out; |
1593 |
++ } |
1594 |
+ |
1595 |
+ btrfs_dir_item_key_to_cpu(path->nodes[0], di, location); |
1596 |
+ if (location->type != BTRFS_INODE_ITEM_KEY && |
1597 |
+ location->type != BTRFS_ROOT_ITEM_KEY) { |
1598 |
++ ret = -EUCLEAN; |
1599 |
+ btrfs_warn(root->fs_info, |
1600 |
+ "%s gets something invalid in DIR_ITEM (name %s, directory ino %llu, location(%llu %u %llu))", |
1601 |
+ __func__, name, btrfs_ino(BTRFS_I(dir)), |
1602 |
+ location->objectid, location->type, location->offset); |
1603 |
+- goto out_err; |
1604 |
+ } |
1605 |
++ if (!ret) |
1606 |
++ *type = btrfs_dir_type(path->nodes[0], di); |
1607 |
+ out: |
1608 |
+ btrfs_free_path(path); |
1609 |
+ return ret; |
1610 |
+-out_err: |
1611 |
+- location->objectid = 0; |
1612 |
+- goto out; |
1613 |
+ } |
1614 |
+ |
1615 |
+ /* |
1616 |
+@@ -5907,6 +5912,11 @@ static struct inode *new_simple_dir(struct super_block *s, |
1617 |
+ return inode; |
1618 |
+ } |
1619 |
+ |
1620 |
++static inline u8 btrfs_inode_type(struct inode *inode) |
1621 |
++{ |
1622 |
++ return btrfs_type_by_mode[(inode->i_mode & S_IFMT) >> S_SHIFT]; |
1623 |
++} |
1624 |
++ |
1625 |
+ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) |
1626 |
+ { |
1627 |
+ struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb); |
1628 |
+@@ -5914,21 +5924,31 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) |
1629 |
+ struct btrfs_root *root = BTRFS_I(dir)->root; |
1630 |
+ struct btrfs_root *sub_root = root; |
1631 |
+ struct btrfs_key location; |
1632 |
++ u8 di_type = 0; |
1633 |
+ int index; |
1634 |
+ int ret = 0; |
1635 |
+ |
1636 |
+ if (dentry->d_name.len > BTRFS_NAME_LEN) |
1637 |
+ return ERR_PTR(-ENAMETOOLONG); |
1638 |
+ |
1639 |
+- ret = btrfs_inode_by_name(dir, dentry, &location); |
1640 |
++ ret = btrfs_inode_by_name(dir, dentry, &location, &di_type); |
1641 |
+ if (ret < 0) |
1642 |
+ return ERR_PTR(ret); |
1643 |
+ |
1644 |
+- if (location.objectid == 0) |
1645 |
+- return ERR_PTR(-ENOENT); |
1646 |
+- |
1647 |
+ if (location.type == BTRFS_INODE_ITEM_KEY) { |
1648 |
+ inode = btrfs_iget(dir->i_sb, &location, root, NULL); |
1649 |
++ if (IS_ERR(inode)) |
1650 |
++ return inode; |
1651 |
++ |
1652 |
++ /* Do extra check against inode mode with di_type */ |
1653 |
++ if (btrfs_inode_type(inode) != di_type) { |
1654 |
++ btrfs_crit(fs_info, |
1655 |
++"inode mode mismatch with dir: inode mode=0%o btrfs type=%u dir type=%u", |
1656 |
++ inode->i_mode, btrfs_inode_type(inode), |
1657 |
++ di_type); |
1658 |
++ iput(inode); |
1659 |
++ return ERR_PTR(-EUCLEAN); |
1660 |
++ } |
1661 |
+ return inode; |
1662 |
+ } |
1663 |
+ |
1664 |
+@@ -6546,11 +6566,6 @@ fail: |
1665 |
+ return ERR_PTR(ret); |
1666 |
+ } |
1667 |
+ |
1668 |
+-static inline u8 btrfs_inode_type(struct inode *inode) |
1669 |
+-{ |
1670 |
+- return btrfs_type_by_mode[(inode->i_mode & S_IFMT) >> S_SHIFT]; |
1671 |
+-} |
1672 |
+- |
1673 |
+ /* |
1674 |
+ * utility function to add 'inode' into 'parent_inode' with |
1675 |
+ * a give name and a given sequence number. |
1676 |
+@@ -7162,6 +7177,14 @@ again: |
1677 |
+ extent_start = found_key.offset; |
1678 |
+ if (found_type == BTRFS_FILE_EXTENT_REG || |
1679 |
+ found_type == BTRFS_FILE_EXTENT_PREALLOC) { |
1680 |
++ /* Only regular file could have regular/prealloc extent */ |
1681 |
++ if (!S_ISREG(inode->vfs_inode.i_mode)) { |
1682 |
++ ret = -EUCLEAN; |
1683 |
++ btrfs_crit(fs_info, |
1684 |
++ "regular/prealloc extent found for non-regular inode %llu", |
1685 |
++ btrfs_ino(inode)); |
1686 |
++ goto out; |
1687 |
++ } |
1688 |
+ extent_end = extent_start + |
1689 |
+ btrfs_file_extent_num_bytes(leaf, item); |
1690 |
+ |
1691 |
+diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c |
1692 |
+index 39a00b57ff016..53f6bb5d0b72c 100644 |
1693 |
+--- a/fs/btrfs/qgroup.c |
1694 |
++++ b/fs/btrfs/qgroup.c |
1695 |
+@@ -424,13 +424,13 @@ next2: |
1696 |
+ break; |
1697 |
+ } |
1698 |
+ out: |
1699 |
++ btrfs_free_path(path); |
1700 |
+ fs_info->qgroup_flags |= flags; |
1701 |
+ if (!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_ON)) |
1702 |
+ clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); |
1703 |
+ else if (fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN && |
1704 |
+ ret >= 0) |
1705 |
+ ret = qgroup_rescan_init(fs_info, rescan_progress, 0); |
1706 |
+- btrfs_free_path(path); |
1707 |
+ |
1708 |
+ if (ret < 0) { |
1709 |
+ ulist_free(fs_info->qgroup_ulist); |
1710 |
+diff --git a/fs/btrfs/tests/inode-tests.c b/fs/btrfs/tests/inode-tests.c |
1711 |
+index 8c91d03cc82d8..94b139e92ff3d 100644 |
1712 |
+--- a/fs/btrfs/tests/inode-tests.c |
1713 |
++++ b/fs/btrfs/tests/inode-tests.c |
1714 |
+@@ -245,6 +245,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) |
1715 |
+ return ret; |
1716 |
+ } |
1717 |
+ |
1718 |
++ inode->i_mode = S_IFREG; |
1719 |
+ BTRFS_I(inode)->location.type = BTRFS_INODE_ITEM_KEY; |
1720 |
+ BTRFS_I(inode)->location.objectid = BTRFS_FIRST_FREE_OBJECTID; |
1721 |
+ BTRFS_I(inode)->location.offset = 0; |
1722 |
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
1723 |
+index 3d92feff249a0..3b3c65b7d0c19 100644 |
1724 |
+--- a/fs/btrfs/volumes.c |
1725 |
++++ b/fs/btrfs/volumes.c |
1726 |
+@@ -6406,6 +6406,13 @@ static int btrfs_check_chunk_valid(struct btrfs_fs_info *fs_info, |
1727 |
+ return -EIO; |
1728 |
+ } |
1729 |
+ |
1730 |
++ if (!is_power_of_2(type & BTRFS_BLOCK_GROUP_PROFILE_MASK) && |
1731 |
++ (type & BTRFS_BLOCK_GROUP_PROFILE_MASK) != 0) { |
1732 |
++ btrfs_err(fs_info, |
1733 |
++ "invalid chunk profile flag: 0x%llx, expect 0 or 1 bit set", |
1734 |
++ type & BTRFS_BLOCK_GROUP_PROFILE_MASK); |
1735 |
++ return -EUCLEAN; |
1736 |
++ } |
1737 |
+ if ((type & BTRFS_BLOCK_GROUP_TYPE_MASK) == 0) { |
1738 |
+ btrfs_err(fs_info, "missing chunk type flag: 0x%llx", type); |
1739 |
+ return -EIO; |
1740 |
+diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c |
1741 |
+index 71fccccf317e8..5decb3e06563f 100644 |
1742 |
+--- a/fs/efivarfs/inode.c |
1743 |
++++ b/fs/efivarfs/inode.c |
1744 |
+@@ -10,6 +10,7 @@ |
1745 |
+ #include <linux/efi.h> |
1746 |
+ #include <linux/fs.h> |
1747 |
+ #include <linux/ctype.h> |
1748 |
++#include <linux/kmemleak.h> |
1749 |
+ #include <linux/slab.h> |
1750 |
+ #include <linux/uuid.h> |
1751 |
+ |
1752 |
+@@ -104,6 +105,7 @@ static int efivarfs_create(struct inode *dir, struct dentry *dentry, |
1753 |
+ var->var.VariableName[i] = '\0'; |
1754 |
+ |
1755 |
+ inode->i_private = var; |
1756 |
++ kmemleak_ignore(var); |
1757 |
+ |
1758 |
+ err = efivar_entry_add(var, &efivarfs_list); |
1759 |
+ if (err) |
1760 |
+diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c |
1761 |
+index 7808a26bd33fa..834615f13f3e3 100644 |
1762 |
+--- a/fs/efivarfs/super.c |
1763 |
++++ b/fs/efivarfs/super.c |
1764 |
+@@ -23,7 +23,6 @@ LIST_HEAD(efivarfs_list); |
1765 |
+ static void efivarfs_evict_inode(struct inode *inode) |
1766 |
+ { |
1767 |
+ clear_inode(inode); |
1768 |
+- kfree(inode->i_private); |
1769 |
+ } |
1770 |
+ |
1771 |
+ static const struct super_operations efivarfs_ops = { |
1772 |
+diff --git a/fs/proc/self.c b/fs/proc/self.c |
1773 |
+index 398cdf9a9f0c6..eba167e1700ef 100644 |
1774 |
+--- a/fs/proc/self.c |
1775 |
++++ b/fs/proc/self.c |
1776 |
+@@ -15,6 +15,13 @@ static const char *proc_self_get_link(struct dentry *dentry, |
1777 |
+ pid_t tgid = task_tgid_nr_ns(current, ns); |
1778 |
+ char *name; |
1779 |
+ |
1780 |
++ /* |
1781 |
++ * Not currently supported. Once we can inherit all of struct pid, |
1782 |
++ * we can allow this. |
1783 |
++ */ |
1784 |
++ if (current->flags & PF_KTHREAD) |
1785 |
++ return ERR_PTR(-EOPNOTSUPP); |
1786 |
++ |
1787 |
+ if (!tgid) |
1788 |
+ return ERR_PTR(-ENOENT); |
1789 |
+ /* 11 for max length of signed int in decimal + NULL term */ |
1790 |
+diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h |
1791 |
+index b6ce4c2eb40bd..fe878f253b209 100644 |
1792 |
+--- a/include/linux/usb/quirks.h |
1793 |
++++ b/include/linux/usb/quirks.h |
1794 |
+@@ -60,4 +60,7 @@ |
1795 |
+ /* Device needs a pause after every control message. */ |
1796 |
+ #define USB_QUIRK_DELAY_CTRL_MSG BIT(13) |
1797 |
+ |
1798 |
++/* device has blacklisted endpoints */ |
1799 |
++#define USB_QUIRK_ENDPOINT_BLACKLIST BIT(15) |
1800 |
++ |
1801 |
+ #endif /* __LINUX_USB_QUIRKS_H */ |
1802 |
+diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h |
1803 |
+index c9bd935f4fd1c..1ee0f30ae190b 100644 |
1804 |
+--- a/include/scsi/libiscsi.h |
1805 |
++++ b/include/scsi/libiscsi.h |
1806 |
+@@ -145,6 +145,9 @@ struct iscsi_task { |
1807 |
+ void *dd_data; /* driver/transport data */ |
1808 |
+ }; |
1809 |
+ |
1810 |
++/* invalid scsi_task pointer */ |
1811 |
++#define INVALID_SCSI_TASK (struct iscsi_task *)-1l |
1812 |
++ |
1813 |
+ static inline int iscsi_task_has_unsol_data(struct iscsi_task *task) |
1814 |
+ { |
1815 |
+ return task->unsol_r2t.data_length > task->unsol_r2t.sent; |
1816 |
+diff --git a/include/uapi/linux/wireless.h b/include/uapi/linux/wireless.h |
1817 |
+index a2c006a364e0b..24f3371ad8262 100644 |
1818 |
+--- a/include/uapi/linux/wireless.h |
1819 |
++++ b/include/uapi/linux/wireless.h |
1820 |
+@@ -74,7 +74,11 @@ |
1821 |
+ #include <linux/socket.h> /* for "struct sockaddr" et al */ |
1822 |
+ #include <linux/if.h> /* for IFNAMSIZ and co... */ |
1823 |
+ |
1824 |
+-#include <stddef.h> /* for offsetof */ |
1825 |
++#ifdef __KERNEL__ |
1826 |
++# include <linux/stddef.h> /* for offsetof */ |
1827 |
++#else |
1828 |
++# include <stddef.h> /* for offsetof */ |
1829 |
++#endif |
1830 |
+ |
1831 |
+ /***************************** VERSION *****************************/ |
1832 |
+ /* |
1833 |
+diff --git a/mm/huge_memory.c b/mm/huge_memory.c |
1834 |
+index 51068ef1dff5a..5d9dd24d99c8b 100644 |
1835 |
+--- a/mm/huge_memory.c |
1836 |
++++ b/mm/huge_memory.c |
1837 |
+@@ -688,7 +688,6 @@ int do_huge_pmd_anonymous_page(struct vm_fault *vmf) |
1838 |
+ transparent_hugepage_use_zero_page()) { |
1839 |
+ pgtable_t pgtable; |
1840 |
+ struct page *zero_page; |
1841 |
+- bool set; |
1842 |
+ int ret; |
1843 |
+ pgtable = pte_alloc_one(vma->vm_mm, haddr); |
1844 |
+ if (unlikely(!pgtable)) |
1845 |
+@@ -701,25 +700,25 @@ int do_huge_pmd_anonymous_page(struct vm_fault *vmf) |
1846 |
+ } |
1847 |
+ vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd); |
1848 |
+ ret = 0; |
1849 |
+- set = false; |
1850 |
+ if (pmd_none(*vmf->pmd)) { |
1851 |
+ ret = check_stable_address_space(vma->vm_mm); |
1852 |
+ if (ret) { |
1853 |
+ spin_unlock(vmf->ptl); |
1854 |
++ pte_free(vma->vm_mm, pgtable); |
1855 |
+ } else if (userfaultfd_missing(vma)) { |
1856 |
+ spin_unlock(vmf->ptl); |
1857 |
++ pte_free(vma->vm_mm, pgtable); |
1858 |
+ ret = handle_userfault(vmf, VM_UFFD_MISSING); |
1859 |
+ VM_BUG_ON(ret & VM_FAULT_FALLBACK); |
1860 |
+ } else { |
1861 |
+ set_huge_zero_page(pgtable, vma->vm_mm, vma, |
1862 |
+ haddr, vmf->pmd, zero_page); |
1863 |
+ spin_unlock(vmf->ptl); |
1864 |
+- set = true; |
1865 |
+ } |
1866 |
+- } else |
1867 |
++ } else { |
1868 |
+ spin_unlock(vmf->ptl); |
1869 |
+- if (!set) |
1870 |
+ pte_free(vma->vm_mm, pgtable); |
1871 |
++ } |
1872 |
+ return ret; |
1873 |
+ } |
1874 |
+ gfp = alloc_hugepage_direct_gfpmask(vma); |
1875 |
+diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c |
1876 |
+index 4ef4bde2cc2d3..b61ce96ae1d3d 100644 |
1877 |
+--- a/net/batman-adv/log.c |
1878 |
++++ b/net/batman-adv/log.c |
1879 |
+@@ -195,6 +195,7 @@ static const struct file_operations batadv_log_fops = { |
1880 |
+ .read = batadv_log_read, |
1881 |
+ .poll = batadv_log_poll, |
1882 |
+ .llseek = no_llseek, |
1883 |
++ .owner = THIS_MODULE, |
1884 |
+ }; |
1885 |
+ |
1886 |
+ int batadv_debug_log_setup(struct batadv_priv *bat_priv) |
1887 |
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
1888 |
+index 75bdcede04e63..21d9b7d96eb0f 100644 |
1889 |
+--- a/sound/pci/hda/patch_hdmi.c |
1890 |
++++ b/sound/pci/hda/patch_hdmi.c |
1891 |
+@@ -339,13 +339,13 @@ static int hdmi_eld_ctl_info(struct snd_kcontrol *kcontrol, |
1892 |
+ if (!per_pin) { |
1893 |
+ /* no pin is bound to the pcm */ |
1894 |
+ uinfo->count = 0; |
1895 |
+- mutex_unlock(&spec->pcm_lock); |
1896 |
+- return 0; |
1897 |
++ goto unlock; |
1898 |
+ } |
1899 |
+ eld = &per_pin->sink_eld; |
1900 |
+ uinfo->count = eld->eld_valid ? eld->eld_size : 0; |
1901 |
+- mutex_unlock(&spec->pcm_lock); |
1902 |
+ |
1903 |
++ unlock: |
1904 |
++ mutex_unlock(&spec->pcm_lock); |
1905 |
+ return 0; |
1906 |
+ } |
1907 |
+ |
1908 |
+@@ -357,6 +357,7 @@ static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol, |
1909 |
+ struct hdmi_spec_per_pin *per_pin; |
1910 |
+ struct hdmi_eld *eld; |
1911 |
+ int pcm_idx; |
1912 |
++ int err = 0; |
1913 |
+ |
1914 |
+ pcm_idx = kcontrol->private_value; |
1915 |
+ mutex_lock(&spec->pcm_lock); |
1916 |
+@@ -365,16 +366,15 @@ static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol, |
1917 |
+ /* no pin is bound to the pcm */ |
1918 |
+ memset(ucontrol->value.bytes.data, 0, |
1919 |
+ ARRAY_SIZE(ucontrol->value.bytes.data)); |
1920 |
+- mutex_unlock(&spec->pcm_lock); |
1921 |
+- return 0; |
1922 |
++ goto unlock; |
1923 |
+ } |
1924 |
+- eld = &per_pin->sink_eld; |
1925 |
+ |
1926 |
++ eld = &per_pin->sink_eld; |
1927 |
+ if (eld->eld_size > ARRAY_SIZE(ucontrol->value.bytes.data) || |
1928 |
+ eld->eld_size > ELD_MAX_SIZE) { |
1929 |
+- mutex_unlock(&spec->pcm_lock); |
1930 |
+ snd_BUG(); |
1931 |
+- return -EINVAL; |
1932 |
++ err = -EINVAL; |
1933 |
++ goto unlock; |
1934 |
+ } |
1935 |
+ |
1936 |
+ memset(ucontrol->value.bytes.data, 0, |
1937 |
+@@ -382,9 +382,10 @@ static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol, |
1938 |
+ if (eld->eld_valid) |
1939 |
+ memcpy(ucontrol->value.bytes.data, eld->eld_buffer, |
1940 |
+ eld->eld_size); |
1941 |
+- mutex_unlock(&spec->pcm_lock); |
1942 |
+ |
1943 |
+- return 0; |
1944 |
++ unlock: |
1945 |
++ mutex_unlock(&spec->pcm_lock); |
1946 |
++ return err; |
1947 |
+ } |
1948 |
+ |
1949 |
+ static const struct snd_kcontrol_new eld_bytes_ctl = { |
1950 |
+@@ -1209,8 +1210,8 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, |
1951 |
+ pin_idx = hinfo_to_pin_index(codec, hinfo); |
1952 |
+ if (!spec->dyn_pcm_assign) { |
1953 |
+ if (snd_BUG_ON(pin_idx < 0)) { |
1954 |
+- mutex_unlock(&spec->pcm_lock); |
1955 |
+- return -EINVAL; |
1956 |
++ err = -EINVAL; |
1957 |
++ goto unlock; |
1958 |
+ } |
1959 |
+ } else { |
1960 |
+ /* no pin is assigned to the PCM |
1961 |
+@@ -1218,16 +1219,13 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, |
1962 |
+ */ |
1963 |
+ if (pin_idx < 0) { |
1964 |
+ err = hdmi_pcm_open_no_pin(hinfo, codec, substream); |
1965 |
+- mutex_unlock(&spec->pcm_lock); |
1966 |
+- return err; |
1967 |
++ goto unlock; |
1968 |
+ } |
1969 |
+ } |
1970 |
+ |
1971 |
+ err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx); |
1972 |
+- if (err < 0) { |
1973 |
+- mutex_unlock(&spec->pcm_lock); |
1974 |
+- return err; |
1975 |
+- } |
1976 |
++ if (err < 0) |
1977 |
++ goto unlock; |
1978 |
+ |
1979 |
+ per_cvt = get_cvt(spec, cvt_idx); |
1980 |
+ /* Claim converter */ |
1981 |
+@@ -1264,12 +1262,11 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, |
1982 |
+ per_cvt->assigned = 0; |
1983 |
+ hinfo->nid = 0; |
1984 |
+ snd_hda_spdif_ctls_unassign(codec, pcm_idx); |
1985 |
+- mutex_unlock(&spec->pcm_lock); |
1986 |
+- return -ENODEV; |
1987 |
++ err = -ENODEV; |
1988 |
++ goto unlock; |
1989 |
+ } |
1990 |
+ } |
1991 |
+ |
1992 |
+- mutex_unlock(&spec->pcm_lock); |
1993 |
+ /* Store the updated parameters */ |
1994 |
+ runtime->hw.channels_min = hinfo->channels_min; |
1995 |
+ runtime->hw.channels_max = hinfo->channels_max; |
1996 |
+@@ -1278,7 +1275,9 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, |
1997 |
+ |
1998 |
+ snd_pcm_hw_constraint_step(substream->runtime, 0, |
1999 |
+ SNDRV_PCM_HW_PARAM_CHANNELS, 2); |
2000 |
+- return 0; |
2001 |
++ unlock: |
2002 |
++ mutex_unlock(&spec->pcm_lock); |
2003 |
++ return err; |
2004 |
+ } |
2005 |
+ |
2006 |
+ /* |
2007 |
+@@ -1876,7 +1875,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
2008 |
+ struct snd_pcm_runtime *runtime = substream->runtime; |
2009 |
+ bool non_pcm; |
2010 |
+ int pinctl; |
2011 |
+- int err; |
2012 |
++ int err = 0; |
2013 |
+ |
2014 |
+ mutex_lock(&spec->pcm_lock); |
2015 |
+ pin_idx = hinfo_to_pin_index(codec, hinfo); |
2016 |
+@@ -1888,13 +1887,12 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
2017 |
+ pin_cvt_fixup(codec, NULL, cvt_nid); |
2018 |
+ snd_hda_codec_setup_stream(codec, cvt_nid, |
2019 |
+ stream_tag, 0, format); |
2020 |
+- mutex_unlock(&spec->pcm_lock); |
2021 |
+- return 0; |
2022 |
++ goto unlock; |
2023 |
+ } |
2024 |
+ |
2025 |
+ if (snd_BUG_ON(pin_idx < 0)) { |
2026 |
+- mutex_unlock(&spec->pcm_lock); |
2027 |
+- return -EINVAL; |
2028 |
++ err = -EINVAL; |
2029 |
++ goto unlock; |
2030 |
+ } |
2031 |
+ per_pin = get_pin(spec, pin_idx); |
2032 |
+ pin_nid = per_pin->pin_nid; |
2033 |
+@@ -1933,6 +1931,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
2034 |
+ /* snd_hda_set_dev_select() has been called before */ |
2035 |
+ err = spec->ops.setup_stream(codec, cvt_nid, pin_nid, |
2036 |
+ stream_tag, format); |
2037 |
++ unlock: |
2038 |
+ mutex_unlock(&spec->pcm_lock); |
2039 |
+ return err; |
2040 |
+ } |
2041 |
+@@ -1954,32 +1953,34 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, |
2042 |
+ struct hdmi_spec_per_cvt *per_cvt; |
2043 |
+ struct hdmi_spec_per_pin *per_pin; |
2044 |
+ int pinctl; |
2045 |
++ int err = 0; |
2046 |
+ |
2047 |
++ mutex_lock(&spec->pcm_lock); |
2048 |
+ if (hinfo->nid) { |
2049 |
+ pcm_idx = hinfo_to_pcm_index(codec, hinfo); |
2050 |
+- if (snd_BUG_ON(pcm_idx < 0)) |
2051 |
+- return -EINVAL; |
2052 |
++ if (snd_BUG_ON(pcm_idx < 0)) { |
2053 |
++ err = -EINVAL; |
2054 |
++ goto unlock; |
2055 |
++ } |
2056 |
+ cvt_idx = cvt_nid_to_cvt_index(codec, hinfo->nid); |
2057 |
+- if (snd_BUG_ON(cvt_idx < 0)) |
2058 |
+- return -EINVAL; |
2059 |
++ if (snd_BUG_ON(cvt_idx < 0)) { |
2060 |
++ err = -EINVAL; |
2061 |
++ goto unlock; |
2062 |
++ } |
2063 |
+ per_cvt = get_cvt(spec, cvt_idx); |
2064 |
+- |
2065 |
+ snd_BUG_ON(!per_cvt->assigned); |
2066 |
+ per_cvt->assigned = 0; |
2067 |
+ hinfo->nid = 0; |
2068 |
+ |
2069 |
+- mutex_lock(&spec->pcm_lock); |
2070 |
+ snd_hda_spdif_ctls_unassign(codec, pcm_idx); |
2071 |
+ clear_bit(pcm_idx, &spec->pcm_in_use); |
2072 |
+ pin_idx = hinfo_to_pin_index(codec, hinfo); |
2073 |
+- if (spec->dyn_pcm_assign && pin_idx < 0) { |
2074 |
+- mutex_unlock(&spec->pcm_lock); |
2075 |
+- return 0; |
2076 |
+- } |
2077 |
++ if (spec->dyn_pcm_assign && pin_idx < 0) |
2078 |
++ goto unlock; |
2079 |
+ |
2080 |
+ if (snd_BUG_ON(pin_idx < 0)) { |
2081 |
+- mutex_unlock(&spec->pcm_lock); |
2082 |
+- return -EINVAL; |
2083 |
++ err = -EINVAL; |
2084 |
++ goto unlock; |
2085 |
+ } |
2086 |
+ per_pin = get_pin(spec, pin_idx); |
2087 |
+ |
2088 |
+@@ -1998,10 +1999,12 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, |
2089 |
+ per_pin->setup = false; |
2090 |
+ per_pin->channels = 0; |
2091 |
+ mutex_unlock(&per_pin->lock); |
2092 |
+- mutex_unlock(&spec->pcm_lock); |
2093 |
+ } |
2094 |
+ |
2095 |
+- return 0; |
2096 |
++unlock: |
2097 |
++ mutex_unlock(&spec->pcm_lock); |
2098 |
++ |
2099 |
++ return err; |
2100 |
+ } |
2101 |
+ |
2102 |
+ static const struct hda_pcm_ops generic_ops = { |
2103 |
+diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c |
2104 |
+index 289ef63208fb6..7514aa9c68c99 100644 |
2105 |
+--- a/tools/perf/util/dwarf-aux.c |
2106 |
++++ b/tools/perf/util/dwarf-aux.c |
2107 |
+@@ -332,6 +332,7 @@ bool die_is_func_def(Dwarf_Die *dw_die) |
2108 |
+ int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr) |
2109 |
+ { |
2110 |
+ Dwarf_Addr base, end; |
2111 |
++ Dwarf_Attribute attr; |
2112 |
+ |
2113 |
+ if (!addr) |
2114 |
+ return -EINVAL; |
2115 |
+@@ -339,6 +340,13 @@ int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr) |
2116 |
+ if (dwarf_entrypc(dw_die, addr) == 0) |
2117 |
+ return 0; |
2118 |
+ |
2119 |
++ /* |
2120 |
++ * Since the dwarf_ranges() will return 0 if there is no |
2121 |
++ * DW_AT_ranges attribute, we should check it first. |
2122 |
++ */ |
2123 |
++ if (!dwarf_attr(dw_die, DW_AT_ranges, &attr)) |
2124 |
++ return -ENOENT; |
2125 |
++ |
2126 |
+ return dwarf_ranges(dw_die, 0, &base, addr, &end) < 0 ? -ENOENT : 0; |
2127 |
+ } |
2128 |
+ |
2129 |
+diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c |
2130 |
+index a19e840db54a0..70cada80d1853 100644 |
2131 |
+--- a/tools/perf/util/event.c |
2132 |
++++ b/tools/perf/util/event.c |
2133 |
+@@ -794,11 +794,13 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, |
2134 |
+ int err; |
2135 |
+ union perf_event *event; |
2136 |
+ |
2137 |
+- if (symbol_conf.kptr_restrict) |
2138 |
+- return -1; |
2139 |
+ if (map == NULL) |
2140 |
+ return -1; |
2141 |
+ |
2142 |
++ kmap = map__kmap(map); |
2143 |
++ if (!kmap->ref_reloc_sym) |
2144 |
++ return -1; |
2145 |
++ |
2146 |
+ /* |
2147 |
+ * We should get this from /sys/kernel/sections/.text, but till that is |
2148 |
+ * available use this, and after it is use this as a fallback for older |
2149 |
+@@ -822,7 +824,6 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, |
2150 |
+ event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL; |
2151 |
+ } |
2152 |
+ |
2153 |
+- kmap = map__kmap(map); |
2154 |
+ size = snprintf(event->mmap.filename, sizeof(event->mmap.filename), |
2155 |
+ "%s%s", mmap_name, kmap->ref_reloc_sym->name) + 1; |
2156 |
+ size = PERF_ALIGN(size, sizeof(u64)); |