Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Wed, 02 Dec 2020 12:48:06
Message-Id: 1606913264.4e7289260989faaf2307ee528c7ddb2f0f820ba8.mpagano@gentoo
1 commit: 4e7289260989faaf2307ee528c7ddb2f0f820ba8
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 2 12:47:44 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 2 12:47:44 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=4e728926
7
8 Linux patch 4.9.247
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1246_linux-4.9.247.patch | 1759 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1763 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index e3bb8b3..c4d4e26 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -1027,6 +1027,10 @@ Patch: 1245_linux-4.9.246.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.9.246
23
24 +Patch: 1246_linux-4.9.247.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.9.247
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/1246_linux-4.9.247.patch b/1246_linux-4.9.247.patch
33 new file mode 100644
34 index 0000000..901b28d
35 --- /dev/null
36 +++ b/1246_linux-4.9.247.patch
37 @@ -0,0 +1,1759 @@
38 +diff --git a/Makefile b/Makefile
39 +index b9e2a97da5da7..82f71f9460cb6 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 9
45 +-SUBLEVEL = 246
46 ++SUBLEVEL = 247
47 + EXTRAVERSION =
48 + NAME = Roaring Lionus
49 +
50 +diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
51 +index 199f434f99a49..60e92da7bf37b 100644
52 +--- a/arch/arm64/include/asm/pgtable.h
53 ++++ b/arch/arm64/include/asm/pgtable.h
54 +@@ -85,8 +85,6 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
55 + #define pte_valid(pte) (!!(pte_val(pte) & PTE_VALID))
56 + #define pte_valid_not_user(pte) \
57 + ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID)
58 +-#define pte_valid_young(pte) \
59 +- ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF))
60 + #define pte_valid_user(pte) \
61 + ((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER))
62 +
63 +@@ -94,9 +92,12 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
64 + * Could the pte be present in the TLB? We must check mm_tlb_flush_pending
65 + * so that we don't erroneously return false for pages that have been
66 + * remapped as PROT_NONE but are yet to be flushed from the TLB.
67 ++ * Note that we can't make any assumptions based on the state of the access
68 ++ * flag, since ptep_clear_flush_young() elides a DSB when invalidating the
69 ++ * TLB.
70 + */
71 + #define pte_accessible(mm, pte) \
72 +- (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid_young(pte))
73 ++ (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid(pte))
74 +
75 + /*
76 + * p??_access_permitted() is true for valid user mappings (subject to the
77 +diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c
78 +index 72d09340c24d2..88ba013d08d49 100644
79 +--- a/arch/x86/events/intel/cstate.c
80 ++++ b/arch/x86/events/intel/cstate.c
81 +@@ -98,14 +98,14 @@
82 + MODULE_LICENSE("GPL");
83 +
84 + #define DEFINE_CSTATE_FORMAT_ATTR(_var, _name, _format) \
85 +-static ssize_t __cstate_##_var##_show(struct kobject *kobj, \
86 +- struct kobj_attribute *attr, \
87 ++static ssize_t __cstate_##_var##_show(struct device *dev, \
88 ++ struct device_attribute *attr, \
89 + char *page) \
90 + { \
91 + BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \
92 + return sprintf(page, _format "\n"); \
93 + } \
94 +-static struct kobj_attribute format_attr_##_var = \
95 ++static struct device_attribute format_attr_##_var = \
96 + __ATTR(_name, 0444, __cstate_##_var##_show, NULL)
97 +
98 + static ssize_t cstate_get_attr_cpumask(struct device *dev,
99 +diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
100 +index 4c1b7ea185415..38dae3d1391b5 100644
101 +--- a/arch/x86/events/intel/rapl.c
102 ++++ b/arch/x86/events/intel/rapl.c
103 +@@ -115,18 +115,6 @@ static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
104 + * any other bit is reserved
105 + */
106 + #define RAPL_EVENT_MASK 0xFFULL
107 +-
108 +-#define DEFINE_RAPL_FORMAT_ATTR(_var, _name, _format) \
109 +-static ssize_t __rapl_##_var##_show(struct kobject *kobj, \
110 +- struct kobj_attribute *attr, \
111 +- char *page) \
112 +-{ \
113 +- BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \
114 +- return sprintf(page, _format "\n"); \
115 +-} \
116 +-static struct kobj_attribute format_attr_##_var = \
117 +- __ATTR(_name, 0444, __rapl_##_var##_show, NULL)
118 +-
119 + #define RAPL_CNTR_WIDTH 32
120 +
121 + #define RAPL_EVENT_ATTR_STR(_name, v, str) \
122 +@@ -548,7 +536,7 @@ static struct attribute_group rapl_pmu_events_group = {
123 + .attrs = NULL, /* patched at runtime */
124 + };
125 +
126 +-DEFINE_RAPL_FORMAT_ATTR(event, event, "config:0-7");
127 ++PMU_FORMAT_ATTR(event, "config:0-7");
128 + static struct attribute *rapl_formats_attr[] = {
129 + &format_attr_event.attr,
130 + NULL,
131 +diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
132 +index 4f365267b12fe..9f572bf6c6216 100644
133 +--- a/arch/x86/events/intel/uncore.c
134 ++++ b/arch/x86/events/intel/uncore.c
135 +@@ -90,8 +90,8 @@ end:
136 + return map;
137 + }
138 +
139 +-ssize_t uncore_event_show(struct kobject *kobj,
140 +- struct kobj_attribute *attr, char *buf)
141 ++ssize_t uncore_event_show(struct device *dev,
142 ++ struct device_attribute *attr, char *buf)
143 + {
144 + struct uncore_event_desc *event =
145 + container_of(attr, struct uncore_event_desc, attr);
146 +diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h
147 +index ad986c1e29bcc..f699783114ee3 100644
148 +--- a/arch/x86/events/intel/uncore.h
149 ++++ b/arch/x86/events/intel/uncore.h
150 +@@ -124,7 +124,7 @@ struct intel_uncore_box {
151 + #define UNCORE_BOX_FLAG_CTL_OFFS8 1 /* event config registers are 8-byte apart */
152 +
153 + struct uncore_event_desc {
154 +- struct kobj_attribute attr;
155 ++ struct device_attribute attr;
156 + const char *config;
157 + };
158 +
159 +@@ -136,8 +136,8 @@ struct pci2phy_map {
160 +
161 + struct pci2phy_map *__find_pci2phy_map(int segment);
162 +
163 +-ssize_t uncore_event_show(struct kobject *kobj,
164 +- struct kobj_attribute *attr, char *buf);
165 ++ssize_t uncore_event_show(struct device *dev,
166 ++ struct device_attribute *attr, char *buf);
167 +
168 + #define INTEL_UNCORE_EVENT_DESC(_name, _config) \
169 + { \
170 +@@ -146,14 +146,14 @@ ssize_t uncore_event_show(struct kobject *kobj,
171 + }
172 +
173 + #define DEFINE_UNCORE_FORMAT_ATTR(_var, _name, _format) \
174 +-static ssize_t __uncore_##_var##_show(struct kobject *kobj, \
175 +- struct kobj_attribute *attr, \
176 ++static ssize_t __uncore_##_var##_show(struct device *dev, \
177 ++ struct device_attribute *attr, \
178 + char *page) \
179 + { \
180 + BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \
181 + return sprintf(page, _format "\n"); \
182 + } \
183 +-static struct kobj_attribute format_attr_##_var = \
184 ++static struct device_attribute format_attr_##_var = \
185 + __ATTR(_name, 0444, __uncore_##_var##_show, NULL)
186 +
187 + static inline unsigned uncore_pci_box_ctl(struct intel_uncore_box *box)
188 +diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
189 +index f8a7aba4b0959..a884bb7e7b01d 100644
190 +--- a/arch/x86/kernel/cpu/bugs.c
191 ++++ b/arch/x86/kernel/cpu/bugs.c
192 +@@ -732,11 +732,13 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd)
193 + if (boot_cpu_has(X86_FEATURE_IBPB)) {
194 + setup_force_cpu_cap(X86_FEATURE_USE_IBPB);
195 +
196 ++ spectre_v2_user_ibpb = mode;
197 + switch (cmd) {
198 + case SPECTRE_V2_USER_CMD_FORCE:
199 + case SPECTRE_V2_USER_CMD_PRCTL_IBPB:
200 + case SPECTRE_V2_USER_CMD_SECCOMP_IBPB:
201 + static_branch_enable(&switch_mm_always_ibpb);
202 ++ spectre_v2_user_ibpb = SPECTRE_V2_USER_STRICT;
203 + break;
204 + case SPECTRE_V2_USER_CMD_PRCTL:
205 + case SPECTRE_V2_USER_CMD_AUTO:
206 +@@ -750,8 +752,6 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd)
207 + pr_info("mitigation: Enabling %s Indirect Branch Prediction Barrier\n",
208 + static_key_enabled(&switch_mm_always_ibpb) ?
209 + "always-on" : "conditional");
210 +-
211 +- spectre_v2_user_ibpb = mode;
212 + }
213 +
214 + /*
215 +diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
216 +index 8d2c6f071dccf..44bf8a22c97b8 100644
217 +--- a/arch/x86/xen/spinlock.c
218 ++++ b/arch/x86/xen/spinlock.c
219 +@@ -98,10 +98,20 @@ void xen_init_lock_cpu(int cpu)
220 +
221 + void xen_uninit_lock_cpu(int cpu)
222 + {
223 ++ int irq;
224 ++
225 + if (!xen_pvspin)
226 + return;
227 +
228 +- unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL);
229 ++ /*
230 ++ * When booting the kernel with 'mitigations=auto,nosmt', the secondary
231 ++ * CPUs are not activated, and lock_kicker_irq is not initialized.
232 ++ */
233 ++ irq = per_cpu(lock_kicker_irq, cpu);
234 ++ if (irq == -1)
235 ++ return;
236 ++
237 ++ unbind_from_irqhandler(irq, NULL);
238 + per_cpu(lock_kicker_irq, cpu) = -1;
239 + kfree(per_cpu(irq_name, cpu));
240 + per_cpu(irq_name, cpu) = NULL;
241 +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
242 +index 16c08846ea0e1..f5a9bb1231882 100644
243 +--- a/drivers/dma/pl330.c
244 ++++ b/drivers/dma/pl330.c
245 +@@ -2682,7 +2682,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,
246 + * If burst size is smaller than bus width then make sure we only
247 + * transfer one at a time to avoid a burst stradling an MFIFO entry.
248 + */
249 +- if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width)
250 ++ if (burst * 8 < pl330->pcfg.data_bus_width)
251 + desc->rqcfg.brst_len = 1;
252 +
253 + desc->bytes_requested = len;
254 +diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
255 +index cd271f7826051..ef99ef0bb1ca2 100644
256 +--- a/drivers/dma/xilinx/xilinx_dma.c
257 ++++ b/drivers/dma/xilinx/xilinx_dma.c
258 +@@ -420,8 +420,8 @@ struct xilinx_dma_device {
259 + #define to_dma_tx_descriptor(tx) \
260 + container_of(tx, struct xilinx_dma_tx_descriptor, async_tx)
261 + #define xilinx_dma_poll_timeout(chan, reg, val, cond, delay_us, timeout_us) \
262 +- readl_poll_timeout(chan->xdev->regs + chan->ctrl_offset + reg, val, \
263 +- cond, delay_us, timeout_us)
264 ++ readl_poll_timeout_atomic(chan->xdev->regs + chan->ctrl_offset + reg, \
265 ++ val, cond, delay_us, timeout_us)
266 +
267 + /* IO accessors */
268 + static inline u32 dma_read(struct xilinx_dma_chan *chan, u32 reg)
269 +diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c
270 +index 1689568b597d4..12c5d7c96527a 100644
271 +--- a/drivers/hid/hid-cypress.c
272 ++++ b/drivers/hid/hid-cypress.c
273 +@@ -26,19 +26,17 @@
274 + #define CP_2WHEEL_MOUSE_HACK 0x02
275 + #define CP_2WHEEL_MOUSE_HACK_ON 0x04
276 +
277 ++#define VA_INVAL_LOGICAL_BOUNDARY 0x08
278 ++
279 + /*
280 + * Some USB barcode readers from cypress have usage min and usage max in
281 + * the wrong order
282 + */
283 +-static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
284 ++static __u8 *cp_rdesc_fixup(struct hid_device *hdev, __u8 *rdesc,
285 + unsigned int *rsize)
286 + {
287 +- unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
288 + unsigned int i;
289 +
290 +- if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX))
291 +- return rdesc;
292 +-
293 + if (*rsize < 4)
294 + return rdesc;
295 +
296 +@@ -51,6 +49,40 @@ static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
297 + return rdesc;
298 + }
299 +
300 ++static __u8 *va_logical_boundary_fixup(struct hid_device *hdev, __u8 *rdesc,
301 ++ unsigned int *rsize)
302 ++{
303 ++ /*
304 ++ * Varmilo VA104M (with VID Cypress and device ID 07B1) incorrectly
305 ++ * reports Logical Minimum of its Consumer Control device as 572
306 ++ * (0x02 0x3c). Fix this by setting its Logical Minimum to zero.
307 ++ */
308 ++ if (*rsize == 25 &&
309 ++ rdesc[0] == 0x05 && rdesc[1] == 0x0c &&
310 ++ rdesc[2] == 0x09 && rdesc[3] == 0x01 &&
311 ++ rdesc[6] == 0x19 && rdesc[7] == 0x00 &&
312 ++ rdesc[11] == 0x16 && rdesc[12] == 0x3c && rdesc[13] == 0x02) {
313 ++ hid_info(hdev,
314 ++ "fixing up varmilo VA104M consumer control report descriptor\n");
315 ++ rdesc[12] = 0x00;
316 ++ rdesc[13] = 0x00;
317 ++ }
318 ++ return rdesc;
319 ++}
320 ++
321 ++static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
322 ++ unsigned int *rsize)
323 ++{
324 ++ unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
325 ++
326 ++ if (quirks & CP_RDESC_SWAPPED_MIN_MAX)
327 ++ rdesc = cp_rdesc_fixup(hdev, rdesc, rsize);
328 ++ if (quirks & VA_INVAL_LOGICAL_BOUNDARY)
329 ++ rdesc = va_logical_boundary_fixup(hdev, rdesc, rsize);
330 ++
331 ++ return rdesc;
332 ++}
333 ++
334 + static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi,
335 + struct hid_field *field, struct hid_usage *usage,
336 + unsigned long **bit, int *max)
337 +@@ -131,6 +163,8 @@ static const struct hid_device_id cp_devices[] = {
338 + .driver_data = CP_RDESC_SWAPPED_MIN_MAX },
339 + { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE),
340 + .driver_data = CP_2WHEEL_MOUSE_HACK },
341 ++ { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_VARMILO_VA104M_07B1),
342 ++ .driver_data = VA_INVAL_LOGICAL_BOUNDARY },
343 + { }
344 + };
345 + MODULE_DEVICE_TABLE(hid, cp_devices);
346 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
347 +index 4630b58634d87..c4a53fc648e95 100644
348 +--- a/drivers/hid/hid-ids.h
349 ++++ b/drivers/hid/hid-ids.h
350 +@@ -307,6 +307,8 @@
351 + #define USB_DEVICE_ID_CYPRESS_BARCODE_4 0xed81
352 + #define USB_DEVICE_ID_CYPRESS_TRUETOUCH 0xc001
353 +
354 ++#define USB_DEVICE_ID_CYPRESS_VARMILO_VA104M_07B1 0X07b1
355 ++
356 + #define USB_VENDOR_ID_DATA_MODUL 0x7374
357 + #define USB_VENDOR_ID_DATA_MODUL_EASYMAXTOUCH 0x1201
358 +
359 +diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
360 +index 4ef73374a8f98..7001f07ca3996 100644
361 +--- a/drivers/hid/hid-sensor-hub.c
362 ++++ b/drivers/hid/hid-sensor-hub.c
363 +@@ -489,7 +489,8 @@ static int sensor_hub_raw_event(struct hid_device *hdev,
364 + return 1;
365 +
366 + ptr = raw_data;
367 +- ptr++; /* Skip report id */
368 ++ if (report->id)
369 ++ ptr++; /* Skip report id */
370 +
371 + spin_lock_irqsave(&pdata->lock, flags);
372 +
373 +diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
374 +index a6531ffe29a6f..a5694dec3f2ee 100644
375 +--- a/drivers/infiniband/hw/mthca/mthca_cq.c
376 ++++ b/drivers/infiniband/hw/mthca/mthca_cq.c
377 +@@ -808,8 +808,10 @@ int mthca_init_cq(struct mthca_dev *dev, int nent,
378 + }
379 +
380 + mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
381 +- if (IS_ERR(mailbox))
382 ++ if (IS_ERR(mailbox)) {
383 ++ err = PTR_ERR(mailbox);
384 + goto err_out_arm;
385 ++ }
386 +
387 + cq_context = mailbox->buf;
388 +
389 +@@ -851,9 +853,9 @@ int mthca_init_cq(struct mthca_dev *dev, int nent,
390 + }
391 +
392 + spin_lock_irq(&dev->cq_table.lock);
393 +- if (mthca_array_set(&dev->cq_table.cq,
394 +- cq->cqn & (dev->limits.num_cqs - 1),
395 +- cq)) {
396 ++ err = mthca_array_set(&dev->cq_table.cq,
397 ++ cq->cqn & (dev->limits.num_cqs - 1), cq);
398 ++ if (err) {
399 + spin_unlock_irq(&dev->cq_table.lock);
400 + goto err_out_free_mr;
401 + }
402 +diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
403 +index c84c685056b99..6b648339733fa 100644
404 +--- a/drivers/input/serio/i8042.c
405 ++++ b/drivers/input/serio/i8042.c
406 +@@ -125,6 +125,7 @@ module_param_named(unmask_kbd_data, i8042_unmask_kbd_data, bool, 0600);
407 + 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]");
408 + #endif
409 +
410 ++static bool i8042_present;
411 + static bool i8042_bypass_aux_irq_test;
412 + static char i8042_kbd_firmware_id[128];
413 + static char i8042_aux_firmware_id[128];
414 +@@ -343,6 +344,9 @@ int i8042_command(unsigned char *param, int command)
415 + unsigned long flags;
416 + int retval;
417 +
418 ++ if (!i8042_present)
419 ++ return -1;
420 ++
421 + spin_lock_irqsave(&i8042_lock, flags);
422 + retval = __i8042_command(param, command);
423 + spin_unlock_irqrestore(&i8042_lock, flags);
424 +@@ -1597,12 +1601,15 @@ static int __init i8042_init(void)
425 +
426 + err = i8042_platform_init();
427 + if (err)
428 +- return err;
429 ++ return (err == -ENODEV) ? 0 : err;
430 +
431 + err = i8042_controller_check();
432 + if (err)
433 + goto err_platform_exit;
434 +
435 ++ /* Set this before creating the dev to allow i8042_command to work right away */
436 ++ i8042_present = true;
437 ++
438 + pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, NULL, 0);
439 + if (IS_ERR(pdev)) {
440 + err = PTR_ERR(pdev);
441 +@@ -1621,6 +1628,9 @@ static int __init i8042_init(void)
442 +
443 + static void __exit i8042_exit(void)
444 + {
445 ++ if (!i8042_present)
446 ++ return;
447 ++
448 + platform_device_unregister(i8042_platform_device);
449 + platform_driver_unregister(&i8042_driver);
450 + i8042_platform_exit();
451 +diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
452 +index a65203e6ea5f4..d21c68882e867 100644
453 +--- a/drivers/net/can/usb/gs_usb.c
454 ++++ b/drivers/net/can/usb/gs_usb.c
455 +@@ -71,21 +71,27 @@ enum gs_can_identify_mode {
456 + };
457 +
458 + /* data types passed between host and device */
459 ++
460 ++/* The firmware on the original USB2CAN by Geschwister Schneider
461 ++ * Technologie Entwicklungs- und Vertriebs UG exchanges all data
462 ++ * between the host and the device in host byte order. This is done
463 ++ * with the struct gs_host_config::byte_order member, which is sent
464 ++ * first to indicate the desired byte order.
465 ++ *
466 ++ * The widely used open source firmware candleLight doesn't support
467 ++ * this feature and exchanges the data in little endian byte order.
468 ++ */
469 + struct gs_host_config {
470 +- u32 byte_order;
471 ++ __le32 byte_order;
472 + } __packed;
473 +-/* All data exchanged between host and device is exchanged in host byte order,
474 +- * thanks to the struct gs_host_config byte_order member, which is sent first
475 +- * to indicate the desired byte order.
476 +- */
477 +
478 + struct gs_device_config {
479 + u8 reserved1;
480 + u8 reserved2;
481 + u8 reserved3;
482 + u8 icount;
483 +- u32 sw_version;
484 +- u32 hw_version;
485 ++ __le32 sw_version;
486 ++ __le32 hw_version;
487 + } __packed;
488 +
489 + #define GS_CAN_MODE_NORMAL 0
490 +@@ -95,26 +101,26 @@ struct gs_device_config {
491 + #define GS_CAN_MODE_ONE_SHOT BIT(3)
492 +
493 + struct gs_device_mode {
494 +- u32 mode;
495 +- u32 flags;
496 ++ __le32 mode;
497 ++ __le32 flags;
498 + } __packed;
499 +
500 + struct gs_device_state {
501 +- u32 state;
502 +- u32 rxerr;
503 +- u32 txerr;
504 ++ __le32 state;
505 ++ __le32 rxerr;
506 ++ __le32 txerr;
507 + } __packed;
508 +
509 + struct gs_device_bittiming {
510 +- u32 prop_seg;
511 +- u32 phase_seg1;
512 +- u32 phase_seg2;
513 +- u32 sjw;
514 +- u32 brp;
515 ++ __le32 prop_seg;
516 ++ __le32 phase_seg1;
517 ++ __le32 phase_seg2;
518 ++ __le32 sjw;
519 ++ __le32 brp;
520 + } __packed;
521 +
522 + struct gs_identify_mode {
523 +- u32 mode;
524 ++ __le32 mode;
525 + } __packed;
526 +
527 + #define GS_CAN_FEATURE_LISTEN_ONLY BIT(0)
528 +@@ -125,23 +131,23 @@ struct gs_identify_mode {
529 + #define GS_CAN_FEATURE_IDENTIFY BIT(5)
530 +
531 + struct gs_device_bt_const {
532 +- u32 feature;
533 +- u32 fclk_can;
534 +- u32 tseg1_min;
535 +- u32 tseg1_max;
536 +- u32 tseg2_min;
537 +- u32 tseg2_max;
538 +- u32 sjw_max;
539 +- u32 brp_min;
540 +- u32 brp_max;
541 +- u32 brp_inc;
542 ++ __le32 feature;
543 ++ __le32 fclk_can;
544 ++ __le32 tseg1_min;
545 ++ __le32 tseg1_max;
546 ++ __le32 tseg2_min;
547 ++ __le32 tseg2_max;
548 ++ __le32 sjw_max;
549 ++ __le32 brp_min;
550 ++ __le32 brp_max;
551 ++ __le32 brp_inc;
552 + } __packed;
553 +
554 + #define GS_CAN_FLAG_OVERFLOW 1
555 +
556 + struct gs_host_frame {
557 + u32 echo_id;
558 +- u32 can_id;
559 ++ __le32 can_id;
560 +
561 + u8 can_dlc;
562 + u8 channel;
563 +@@ -337,13 +343,13 @@ static void gs_usb_receive_bulk_callback(struct urb *urb)
564 + if (!skb)
565 + return;
566 +
567 +- cf->can_id = hf->can_id;
568 ++ cf->can_id = le32_to_cpu(hf->can_id);
569 +
570 + cf->can_dlc = get_can_dlc(hf->can_dlc);
571 + memcpy(cf->data, hf->data, 8);
572 +
573 + /* ERROR frames tell us information about the controller */
574 +- if (hf->can_id & CAN_ERR_FLAG)
575 ++ if (le32_to_cpu(hf->can_id) & CAN_ERR_FLAG)
576 + gs_update_state(dev, cf);
577 +
578 + netdev->stats.rx_packets++;
579 +@@ -426,11 +432,11 @@ static int gs_usb_set_bittiming(struct net_device *netdev)
580 + if (!dbt)
581 + return -ENOMEM;
582 +
583 +- dbt->prop_seg = bt->prop_seg;
584 +- dbt->phase_seg1 = bt->phase_seg1;
585 +- dbt->phase_seg2 = bt->phase_seg2;
586 +- dbt->sjw = bt->sjw;
587 +- dbt->brp = bt->brp;
588 ++ dbt->prop_seg = cpu_to_le32(bt->prop_seg);
589 ++ dbt->phase_seg1 = cpu_to_le32(bt->phase_seg1);
590 ++ dbt->phase_seg2 = cpu_to_le32(bt->phase_seg2);
591 ++ dbt->sjw = cpu_to_le32(bt->sjw);
592 ++ dbt->brp = cpu_to_le32(bt->brp);
593 +
594 + /* request bit timings */
595 + rc = usb_control_msg(interface_to_usbdev(intf),
596 +@@ -511,7 +517,7 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb,
597 +
598 + cf = (struct can_frame *)skb->data;
599 +
600 +- hf->can_id = cf->can_id;
601 ++ hf->can_id = cpu_to_le32(cf->can_id);
602 + hf->can_dlc = cf->can_dlc;
603 + memcpy(hf->data, cf->data, cf->can_dlc);
604 +
605 +@@ -582,6 +588,7 @@ static int gs_can_open(struct net_device *netdev)
606 + int rc, i;
607 + struct gs_device_mode *dm;
608 + u32 ctrlmode;
609 ++ u32 flags = 0;
610 +
611 + rc = open_candev(netdev);
612 + if (rc)
613 +@@ -649,24 +656,24 @@ static int gs_can_open(struct net_device *netdev)
614 +
615 + /* flags */
616 + ctrlmode = dev->can.ctrlmode;
617 +- dm->flags = 0;
618 +
619 + if (ctrlmode & CAN_CTRLMODE_LOOPBACK)
620 +- dm->flags |= GS_CAN_MODE_LOOP_BACK;
621 ++ flags |= GS_CAN_MODE_LOOP_BACK;
622 + else if (ctrlmode & CAN_CTRLMODE_LISTENONLY)
623 +- dm->flags |= GS_CAN_MODE_LISTEN_ONLY;
624 ++ flags |= GS_CAN_MODE_LISTEN_ONLY;
625 +
626 + /* Controller is not allowed to retry TX
627 + * this mode is unavailable on atmels uc3c hardware
628 + */
629 + if (ctrlmode & CAN_CTRLMODE_ONE_SHOT)
630 +- dm->flags |= GS_CAN_MODE_ONE_SHOT;
631 ++ flags |= GS_CAN_MODE_ONE_SHOT;
632 +
633 + if (ctrlmode & CAN_CTRLMODE_3_SAMPLES)
634 +- dm->flags |= GS_CAN_MODE_TRIPLE_SAMPLE;
635 ++ flags |= GS_CAN_MODE_TRIPLE_SAMPLE;
636 +
637 + /* finally start device */
638 +- dm->mode = GS_CAN_MODE_START;
639 ++ dm->mode = cpu_to_le32(GS_CAN_MODE_START);
640 ++ dm->flags = cpu_to_le32(flags);
641 + rc = usb_control_msg(interface_to_usbdev(dev->iface),
642 + usb_sndctrlpipe(interface_to_usbdev(dev->iface), 0),
643 + GS_USB_BREQ_MODE,
644 +@@ -746,9 +753,9 @@ static int gs_usb_set_identify(struct net_device *netdev, bool do_identify)
645 + return -ENOMEM;
646 +
647 + if (do_identify)
648 +- imode->mode = GS_CAN_IDENTIFY_ON;
649 ++ imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_ON);
650 + else
651 +- imode->mode = GS_CAN_IDENTIFY_OFF;
652 ++ imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_OFF);
653 +
654 + rc = usb_control_msg(interface_to_usbdev(dev->iface),
655 + usb_sndctrlpipe(interface_to_usbdev(dev->iface),
656 +@@ -799,6 +806,7 @@ static struct gs_can *gs_make_candev(unsigned int channel,
657 + struct net_device *netdev;
658 + int rc;
659 + struct gs_device_bt_const *bt_const;
660 ++ u32 feature;
661 +
662 + bt_const = kmalloc(sizeof(*bt_const), GFP_KERNEL);
663 + if (!bt_const)
664 +@@ -839,14 +847,14 @@ static struct gs_can *gs_make_candev(unsigned int channel,
665 +
666 + /* dev settup */
667 + strcpy(dev->bt_const.name, "gs_usb");
668 +- dev->bt_const.tseg1_min = bt_const->tseg1_min;
669 +- dev->bt_const.tseg1_max = bt_const->tseg1_max;
670 +- dev->bt_const.tseg2_min = bt_const->tseg2_min;
671 +- dev->bt_const.tseg2_max = bt_const->tseg2_max;
672 +- dev->bt_const.sjw_max = bt_const->sjw_max;
673 +- dev->bt_const.brp_min = bt_const->brp_min;
674 +- dev->bt_const.brp_max = bt_const->brp_max;
675 +- dev->bt_const.brp_inc = bt_const->brp_inc;
676 ++ dev->bt_const.tseg1_min = le32_to_cpu(bt_const->tseg1_min);
677 ++ dev->bt_const.tseg1_max = le32_to_cpu(bt_const->tseg1_max);
678 ++ dev->bt_const.tseg2_min = le32_to_cpu(bt_const->tseg2_min);
679 ++ dev->bt_const.tseg2_max = le32_to_cpu(bt_const->tseg2_max);
680 ++ dev->bt_const.sjw_max = le32_to_cpu(bt_const->sjw_max);
681 ++ dev->bt_const.brp_min = le32_to_cpu(bt_const->brp_min);
682 ++ dev->bt_const.brp_max = le32_to_cpu(bt_const->brp_max);
683 ++ dev->bt_const.brp_inc = le32_to_cpu(bt_const->brp_inc);
684 +
685 + dev->udev = interface_to_usbdev(intf);
686 + dev->iface = intf;
687 +@@ -863,28 +871,29 @@ static struct gs_can *gs_make_candev(unsigned int channel,
688 +
689 + /* can settup */
690 + dev->can.state = CAN_STATE_STOPPED;
691 +- dev->can.clock.freq = bt_const->fclk_can;
692 ++ dev->can.clock.freq = le32_to_cpu(bt_const->fclk_can);
693 + dev->can.bittiming_const = &dev->bt_const;
694 + dev->can.do_set_bittiming = gs_usb_set_bittiming;
695 +
696 + dev->can.ctrlmode_supported = 0;
697 +
698 +- if (bt_const->feature & GS_CAN_FEATURE_LISTEN_ONLY)
699 ++ feature = le32_to_cpu(bt_const->feature);
700 ++ if (feature & GS_CAN_FEATURE_LISTEN_ONLY)
701 + dev->can.ctrlmode_supported |= CAN_CTRLMODE_LISTENONLY;
702 +
703 +- if (bt_const->feature & GS_CAN_FEATURE_LOOP_BACK)
704 ++ if (feature & GS_CAN_FEATURE_LOOP_BACK)
705 + dev->can.ctrlmode_supported |= CAN_CTRLMODE_LOOPBACK;
706 +
707 +- if (bt_const->feature & GS_CAN_FEATURE_TRIPLE_SAMPLE)
708 ++ if (feature & GS_CAN_FEATURE_TRIPLE_SAMPLE)
709 + dev->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
710 +
711 +- if (bt_const->feature & GS_CAN_FEATURE_ONE_SHOT)
712 ++ if (feature & GS_CAN_FEATURE_ONE_SHOT)
713 + dev->can.ctrlmode_supported |= CAN_CTRLMODE_ONE_SHOT;
714 +
715 + SET_NETDEV_DEV(netdev, &intf->dev);
716 +
717 +- if (dconf->sw_version > 1)
718 +- if (bt_const->feature & GS_CAN_FEATURE_IDENTIFY)
719 ++ if (le32_to_cpu(dconf->sw_version) > 1)
720 ++ if (feature & GS_CAN_FEATURE_IDENTIFY)
721 + netdev->ethtool_ops = &gs_usb_ethtool_ops;
722 +
723 + kfree(bt_const);
724 +@@ -919,7 +928,7 @@ static int gs_usb_probe(struct usb_interface *intf,
725 + if (!hconf)
726 + return -ENOMEM;
727 +
728 +- hconf->byte_order = 0x0000beef;
729 ++ hconf->byte_order = cpu_to_le32(0x0000beef);
730 +
731 + /* send host config */
732 + rc = usb_control_msg(interface_to_usbdev(intf),
733 +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
734 +index da21886609e30..de3d6f8b54316 100644
735 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
736 ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
737 +@@ -2345,16 +2345,9 @@ static int ena_device_init(struct ena_com_dev *ena_dev, struct pci_dev *pdev,
738 + goto err_mmio_read_less;
739 + }
740 +
741 +- rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(dma_width));
742 ++ rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(dma_width));
743 + if (rc) {
744 +- dev_err(dev, "pci_set_dma_mask failed 0x%x\n", rc);
745 +- goto err_mmio_read_less;
746 +- }
747 +-
748 +- rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(dma_width));
749 +- if (rc) {
750 +- dev_err(dev, "err_pci_set_consistent_dma_mask failed 0x%x\n",
751 +- rc);
752 ++ dev_err(dev, "dma_set_mask_and_coherent failed %d\n", rc);
753 + goto err_mmio_read_less;
754 + }
755 +
756 +@@ -2894,6 +2887,12 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
757 + return rc;
758 + }
759 +
760 ++ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(ENA_MAX_PHYS_ADDR_SIZE_BITS));
761 ++ if (rc) {
762 ++ dev_err(&pdev->dev, "dma_set_mask_and_coherent failed %d\n", rc);
763 ++ goto err_disable_device;
764 ++ }
765 ++
766 + pci_set_master(pdev);
767 +
768 + ena_dev = vzalloc(sizeof(*ena_dev));
769 +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
770 +index dc34cfa2a58fc..f9610f860e6d1 100644
771 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
772 ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
773 +@@ -6319,7 +6319,8 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
774 + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0 &&
775 + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) {
776 + dev_err(&pdev->dev, "System does not support DMA, aborting\n");
777 +- goto init_err_disable;
778 ++ rc = -EIO;
779 ++ goto init_err_release;
780 + }
781 +
782 + pci_set_master(pdev);
783 +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
784 +index d25b76440c114..88c837504c7d6 100644
785 +--- a/drivers/net/ethernet/ibm/ibmvnic.c
786 ++++ b/drivers/net/ethernet/ibm/ibmvnic.c
787 +@@ -3525,6 +3525,9 @@ static int ibmvnic_reset_crq(struct ibmvnic_adapter *adapter)
788 + } while (rc == H_BUSY || H_IS_LONG_BUSY(rc));
789 +
790 + /* Clean out the queue */
791 ++ if (!crq->msgs)
792 ++ return -EINVAL;
793 ++
794 + memset(crq->msgs, 0, PAGE_SIZE);
795 + crq->cur = 0;
796 +
797 +diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c
798 +index 3ed0adf6479b0..5b0c065bd279f 100644
799 +--- a/drivers/nfc/s3fwrn5/i2c.c
800 ++++ b/drivers/nfc/s3fwrn5/i2c.c
801 +@@ -37,8 +37,8 @@ struct s3fwrn5_i2c_phy {
802 + struct i2c_client *i2c_dev;
803 + struct nci_dev *ndev;
804 +
805 +- unsigned int gpio_en;
806 +- unsigned int gpio_fw_wake;
807 ++ int gpio_en;
808 ++ int gpio_fw_wake;
809 +
810 + struct mutex mutex;
811 +
812 +diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
813 +index c288e5a525754..32001787cff3f 100644
814 +--- a/drivers/pci/bus.c
815 ++++ b/drivers/pci/bus.c
816 +@@ -324,12 +324,8 @@ void pci_bus_add_device(struct pci_dev *dev)
817 +
818 + dev->match_driver = true;
819 + retval = device_attach(&dev->dev);
820 +- if (retval < 0 && retval != -EPROBE_DEFER) {
821 ++ if (retval < 0 && retval != -EPROBE_DEFER)
822 + dev_warn(&dev->dev, "device attach failed (%d)\n", retval);
823 +- pci_proc_detach_device(dev);
824 +- pci_remove_sysfs_dev_files(dev);
825 +- return;
826 +- }
827 +
828 + dev->is_added = 1;
829 + }
830 +diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
831 +index bd0e659002161..0156134dd022d 100644
832 +--- a/drivers/phy/tegra/xusb.c
833 ++++ b/drivers/phy/tegra/xusb.c
834 +@@ -916,6 +916,7 @@ remove_pads:
835 + reset:
836 + reset_control_assert(padctl->rst);
837 + remove:
838 ++ platform_set_drvdata(pdev, NULL);
839 + soc->ops->remove(padctl);
840 + return err;
841 + }
842 +diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
843 +index 79a2289370729..f25278bb3e1a8 100644
844 +--- a/drivers/platform/x86/toshiba_acpi.c
845 ++++ b/drivers/platform/x86/toshiba_acpi.c
846 +@@ -1497,7 +1497,7 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf,
847 + struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file));
848 + char *buffer;
849 + char *cmd;
850 +- int lcd_out, crt_out, tv_out;
851 ++ int lcd_out = -1, crt_out = -1, tv_out = -1;
852 + int remain = count;
853 + int value;
854 + int ret;
855 +@@ -1534,7 +1534,6 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf,
856 +
857 + kfree(cmd);
858 +
859 +- lcd_out = crt_out = tv_out = -1;
860 + ret = get_video_status(dev, &video_out);
861 + if (!ret) {
862 + unsigned int new_video_out = video_out;
863 +diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
864 +index 0a0dd0aac047c..23323add5b0b1 100644
865 +--- a/drivers/regulator/core.c
866 ++++ b/drivers/regulator/core.c
867 +@@ -1550,6 +1550,15 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
868 + }
869 + }
870 +
871 ++ if (r == rdev) {
872 ++ dev_err(dev, "Supply for %s (%s) resolved to itself\n",
873 ++ rdev->desc->name, rdev->supply_name);
874 ++ if (!have_full_constraints())
875 ++ return -EINVAL;
876 ++ r = dummy_regulator_rdev;
877 ++ get_device(&r->dev);
878 ++ }
879 ++
880 + /* Recursively resolve the supply of the supply */
881 + ret = regulator_resolve_supply(r);
882 + if (ret < 0) {
883 +diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
884 +index c4336b01db23c..a84b473d4a08b 100644
885 +--- a/drivers/scsi/libiscsi.c
886 ++++ b/drivers/scsi/libiscsi.c
887 +@@ -570,8 +570,8 @@ static void iscsi_complete_task(struct iscsi_task *task, int state)
888 + if (conn->task == task)
889 + conn->task = NULL;
890 +
891 +- if (conn->ping_task == task)
892 +- conn->ping_task = NULL;
893 ++ if (READ_ONCE(conn->ping_task) == task)
894 ++ WRITE_ONCE(conn->ping_task, NULL);
895 +
896 + /* release get from queueing */
897 + __iscsi_put_task(task);
898 +@@ -780,6 +780,9 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
899 + task->conn->session->age);
900 + }
901 +
902 ++ if (unlikely(READ_ONCE(conn->ping_task) == INVALID_SCSI_TASK))
903 ++ WRITE_ONCE(conn->ping_task, task);
904 ++
905 + if (!ihost->workq) {
906 + if (iscsi_prep_mgmt_task(conn, task))
907 + goto free_task;
908 +@@ -987,8 +990,11 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr)
909 + struct iscsi_nopout hdr;
910 + struct iscsi_task *task;
911 +
912 +- if (!rhdr && conn->ping_task)
913 +- return -EINVAL;
914 ++ if (!rhdr) {
915 ++ if (READ_ONCE(conn->ping_task))
916 ++ return -EINVAL;
917 ++ WRITE_ONCE(conn->ping_task, INVALID_SCSI_TASK);
918 ++ }
919 +
920 + memset(&hdr, 0, sizeof(struct iscsi_nopout));
921 + hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE;
922 +@@ -1003,11 +1009,12 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr)
923 +
924 + task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0);
925 + if (!task) {
926 ++ if (!rhdr)
927 ++ WRITE_ONCE(conn->ping_task, NULL);
928 + iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n");
929 + return -EIO;
930 + } else if (!rhdr) {
931 + /* only track our nops */
932 +- conn->ping_task = task;
933 + conn->last_ping = jiffies;
934 + }
935 +
936 +@@ -1020,7 +1027,7 @@ static int iscsi_nop_out_rsp(struct iscsi_task *task,
937 + struct iscsi_conn *conn = task->conn;
938 + int rc = 0;
939 +
940 +- if (conn->ping_task != task) {
941 ++ if (READ_ONCE(conn->ping_task) != task) {
942 + /*
943 + * If this is not in response to one of our
944 + * nops then it must be from userspace.
945 +@@ -1960,7 +1967,7 @@ static void iscsi_start_tx(struct iscsi_conn *conn)
946 + */
947 + static int iscsi_has_ping_timed_out(struct iscsi_conn *conn)
948 + {
949 +- if (conn->ping_task &&
950 ++ if (READ_ONCE(conn->ping_task) &&
951 + time_before_eq(conn->last_recv + (conn->recv_timeout * HZ) +
952 + (conn->ping_timeout * HZ), jiffies))
953 + return 1;
954 +@@ -2095,7 +2102,7 @@ static enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc)
955 + * Checking the transport already or nop from a cmd timeout still
956 + * running
957 + */
958 +- if (conn->ping_task) {
959 ++ if (READ_ONCE(conn->ping_task)) {
960 + task->have_checked_conn = true;
961 + rc = BLK_EH_RESET_TIMER;
962 + goto done;
963 +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
964 +index ad5f2e2b4cbaf..ad80e4223c2d3 100644
965 +--- a/drivers/scsi/ufs/ufshcd.c
966 ++++ b/drivers/scsi/ufs/ufshcd.c
967 +@@ -6521,11 +6521,7 @@ int ufshcd_shutdown(struct ufs_hba *hba)
968 + if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
969 + goto out;
970 +
971 +- if (pm_runtime_suspended(hba->dev)) {
972 +- ret = ufshcd_runtime_resume(hba);
973 +- if (ret)
974 +- goto out;
975 +- }
976 ++ pm_runtime_get_sync(hba->dev);
977 +
978 + ret = ufshcd_suspend(hba, UFS_SHUTDOWN_PM);
979 + out:
980 +diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
981 +index 7c0f4b96816a8..eba21f06a9b95 100644
982 +--- a/drivers/target/iscsi/iscsi_target.c
983 ++++ b/drivers/target/iscsi/iscsi_target.c
984 +@@ -493,8 +493,7 @@ void iscsit_aborted_task(struct iscsi_conn *conn, struct iscsi_cmd *cmd)
985 + bool scsi_cmd = (cmd->iscsi_opcode == ISCSI_OP_SCSI_CMD);
986 +
987 + spin_lock_bh(&conn->cmd_lock);
988 +- if (!list_empty(&cmd->i_conn_node) &&
989 +- !(cmd->se_cmd.transport_state & CMD_T_FABRIC_STOP))
990 ++ if (!list_empty(&cmd->i_conn_node))
991 + list_del_init(&cmd->i_conn_node);
992 + spin_unlock_bh(&conn->cmd_lock);
993 +
994 +@@ -4093,12 +4092,22 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn)
995 + spin_lock_bh(&conn->cmd_lock);
996 + list_splice_init(&conn->conn_cmd_list, &tmp_list);
997 +
998 +- list_for_each_entry(cmd, &tmp_list, i_conn_node) {
999 ++ list_for_each_entry_safe(cmd, cmd_tmp, &tmp_list, i_conn_node) {
1000 + struct se_cmd *se_cmd = &cmd->se_cmd;
1001 +
1002 + if (se_cmd->se_tfo != NULL) {
1003 + spin_lock_irq(&se_cmd->t_state_lock);
1004 +- se_cmd->transport_state |= CMD_T_FABRIC_STOP;
1005 ++ if (se_cmd->transport_state & CMD_T_ABORTED) {
1006 ++ /*
1007 ++ * LIO's abort path owns the cleanup for this,
1008 ++ * so put it back on the list and let
1009 ++ * aborted_task handle it.
1010 ++ */
1011 ++ list_move_tail(&cmd->i_conn_node,
1012 ++ &conn->conn_cmd_list);
1013 ++ } else {
1014 ++ se_cmd->transport_state |= CMD_T_FABRIC_STOP;
1015 ++ }
1016 + spin_unlock_irq(&se_cmd->t_state_lock);
1017 + }
1018 + }
1019 +diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
1020 +index edf66b2f916b8..34081f03b1f56 100644
1021 +--- a/drivers/usb/core/config.c
1022 ++++ b/drivers/usb/core/config.c
1023 +@@ -251,6 +251,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
1024 + struct usb_host_interface *ifp, int num_ep,
1025 + unsigned char *buffer, int size)
1026 + {
1027 ++ struct usb_device *udev = to_usb_device(ddev);
1028 + unsigned char *buffer0 = buffer;
1029 + struct usb_endpoint_descriptor *d;
1030 + struct usb_host_endpoint *endpoint;
1031 +@@ -292,6 +293,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
1032 + goto skip_to_next_endpoint_or_interface_descriptor;
1033 + }
1034 +
1035 ++ /* Ignore blacklisted endpoints */
1036 ++ if (udev->quirks & USB_QUIRK_ENDPOINT_BLACKLIST) {
1037 ++ if (usb_endpoint_is_blacklisted(udev, ifp, d)) {
1038 ++ dev_warn(ddev, "config %d interface %d altsetting %d has a blacklisted endpoint with address 0x%X, skipping\n",
1039 ++ cfgno, inum, asnum,
1040 ++ d->bEndpointAddress);
1041 ++ goto skip_to_next_endpoint_or_interface_descriptor;
1042 ++ }
1043 ++ }
1044 ++
1045 + endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints];
1046 + ++ifp->desc.bNumEndpoints;
1047 +
1048 +diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
1049 +index 059e71d71b666..781db58004f7f 100644
1050 +--- a/drivers/usb/core/devio.c
1051 ++++ b/drivers/usb/core/devio.c
1052 +@@ -477,11 +477,11 @@ static void snoop_urb(struct usb_device *udev,
1053 +
1054 + if (userurb) { /* Async */
1055 + if (when == SUBMIT)
1056 +- dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, "
1057 ++ dev_info(&udev->dev, "userurb %px, ep%d %s-%s, "
1058 + "length %u\n",
1059 + userurb, ep, t, d, length);
1060 + else
1061 +- dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, "
1062 ++ dev_info(&udev->dev, "userurb %px, ep%d %s-%s, "
1063 + "actual_length %u status %d\n",
1064 + userurb, ep, t, d, length,
1065 + timeout_or_status);
1066 +@@ -1945,7 +1945,7 @@ static int proc_reapurb(struct usb_dev_state *ps, void __user *arg)
1067 + if (as) {
1068 + int retval;
1069 +
1070 +- snoop(&ps->dev->dev, "reap %pK\n", as->userurb);
1071 ++ snoop(&ps->dev->dev, "reap %px\n", as->userurb);
1072 + retval = processcompl(as, (void __user * __user *)arg);
1073 + free_async(as);
1074 + return retval;
1075 +@@ -1962,7 +1962,7 @@ static int proc_reapurbnonblock(struct usb_dev_state *ps, void __user *arg)
1076 +
1077 + as = async_getcompleted(ps);
1078 + if (as) {
1079 +- snoop(&ps->dev->dev, "reap %pK\n", as->userurb);
1080 ++ snoop(&ps->dev->dev, "reap %px\n", as->userurb);
1081 + retval = processcompl(as, (void __user * __user *)arg);
1082 + free_async(as);
1083 + } else {
1084 +@@ -2094,7 +2094,7 @@ static int proc_reapurb_compat(struct usb_dev_state *ps, void __user *arg)
1085 + if (as) {
1086 + int retval;
1087 +
1088 +- snoop(&ps->dev->dev, "reap %pK\n", as->userurb);
1089 ++ snoop(&ps->dev->dev, "reap %px\n", as->userurb);
1090 + retval = processcompl_compat(as, (void __user * __user *)arg);
1091 + free_async(as);
1092 + return retval;
1093 +@@ -2111,7 +2111,7 @@ static int proc_reapurbnonblock_compat(struct usb_dev_state *ps, void __user *ar
1094 +
1095 + as = async_getcompleted(ps);
1096 + if (as) {
1097 +- snoop(&ps->dev->dev, "reap %pK\n", as->userurb);
1098 ++ snoop(&ps->dev->dev, "reap %px\n", as->userurb);
1099 + retval = processcompl_compat(as, (void __user * __user *)arg);
1100 + free_async(as);
1101 + } else {
1102 +@@ -2540,7 +2540,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
1103 + #endif
1104 +
1105 + case USBDEVFS_DISCARDURB:
1106 +- snoop(&dev->dev, "%s: DISCARDURB %pK\n", __func__, p);
1107 ++ snoop(&dev->dev, "%s: DISCARDURB %px\n", __func__, p);
1108 + ret = proc_unlinkurb(ps, p);
1109 + break;
1110 +
1111 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1112 +index ca74b67c4450d..34d8cece6dd3b 100644
1113 +--- a/drivers/usb/core/quirks.c
1114 ++++ b/drivers/usb/core/quirks.c
1115 +@@ -195,6 +195,10 @@ static const struct usb_device_id usb_quirk_list[] = {
1116 + /* Guillemot Webcam Hercules Dualpix Exchange*/
1117 + { USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME },
1118 +
1119 ++ /* Guillemot Hercules DJ Console audio card (BZ 208357) */
1120 ++ { USB_DEVICE(0x06f8, 0xb000), .driver_info =
1121 ++ USB_QUIRK_ENDPOINT_BLACKLIST },
1122 ++
1123 + /* Midiman M-Audio Keystation 88es */
1124 + { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME },
1125 +
1126 +@@ -344,6 +348,40 @@ static const struct usb_device_id usb_amd_resume_quirk_list[] = {
1127 + { } /* terminating entry must be last */
1128 + };
1129 +
1130 ++/*
1131 ++ * Entries for blacklisted endpoints that should be ignored when parsing
1132 ++ * configuration descriptors.
1133 ++ *
1134 ++ * Matched for devices with USB_QUIRK_ENDPOINT_BLACKLIST.
1135 ++ */
1136 ++static const struct usb_device_id usb_endpoint_blacklist[] = {
1137 ++ { USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x01 },
1138 ++ { USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x81 },
1139 ++ { }
1140 ++};
1141 ++
1142 ++bool usb_endpoint_is_blacklisted(struct usb_device *udev,
1143 ++ struct usb_host_interface *intf,
1144 ++ struct usb_endpoint_descriptor *epd)
1145 ++{
1146 ++ const struct usb_device_id *id;
1147 ++ unsigned int address;
1148 ++
1149 ++ for (id = usb_endpoint_blacklist; id->match_flags; ++id) {
1150 ++ if (!usb_match_device(udev, id))
1151 ++ continue;
1152 ++
1153 ++ if (!usb_match_one_id_intf(udev, intf, id))
1154 ++ continue;
1155 ++
1156 ++ address = id->driver_info;
1157 ++ if (address == epd->bEndpointAddress)
1158 ++ return true;
1159 ++ }
1160 ++
1161 ++ return false;
1162 ++}
1163 ++
1164 + static bool usb_match_any_interface(struct usb_device *udev,
1165 + const struct usb_device_id *id)
1166 + {
1167 +diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
1168 +index 6b2f115442838..462a00c749b87 100644
1169 +--- a/drivers/usb/core/usb.h
1170 ++++ b/drivers/usb/core/usb.h
1171 +@@ -31,6 +31,9 @@ extern void usb_deauthorize_interface(struct usb_interface *);
1172 + extern void usb_authorize_interface(struct usb_interface *);
1173 + extern void usb_detect_quirks(struct usb_device *udev);
1174 + extern void usb_detect_interface_quirks(struct usb_device *udev);
1175 ++extern bool usb_endpoint_is_blacklisted(struct usb_device *udev,
1176 ++ struct usb_host_interface *intf,
1177 ++ struct usb_endpoint_descriptor *epd);
1178 + extern int usb_remove_device(struct usb_device *udev);
1179 +
1180 + extern int usb_get_device_descriptor(struct usb_device *dev,
1181 +diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
1182 +index 70ac1963b5987..cab5fbd5b9557 100644
1183 +--- a/drivers/usb/gadget/function/f_midi.c
1184 ++++ b/drivers/usb/gadget/function/f_midi.c
1185 +@@ -1256,7 +1256,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
1186 + midi->id = kstrdup(opts->id, GFP_KERNEL);
1187 + if (opts->id && !midi->id) {
1188 + status = -ENOMEM;
1189 +- goto setup_fail;
1190 ++ goto midi_free;
1191 + }
1192 + midi->in_ports = opts->in_ports;
1193 + midi->out_ports = opts->out_ports;
1194 +@@ -1267,7 +1267,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
1195 +
1196 + status = kfifo_alloc(&midi->in_req_fifo, midi->qlen, GFP_KERNEL);
1197 + if (status)
1198 +- goto setup_fail;
1199 ++ goto midi_free;
1200 +
1201 + spin_lock_init(&midi->transmit_lock);
1202 +
1203 +@@ -1283,9 +1283,13 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
1204 +
1205 + return &midi->func;
1206 +
1207 ++midi_free:
1208 ++ if (midi)
1209 ++ kfree(midi->id);
1210 ++ kfree(midi);
1211 + setup_fail:
1212 + mutex_unlock(&opts->lock);
1213 +- kfree(midi);
1214 ++
1215 + return ERR_PTR(status);
1216 + }
1217 +
1218 +diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
1219 +index cb02e9ecd8e7d..de0f3c2c9f6f3 100644
1220 +--- a/drivers/usb/gadget/legacy/inode.c
1221 ++++ b/drivers/usb/gadget/legacy/inode.c
1222 +@@ -2045,6 +2045,9 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
1223 + return 0;
1224 +
1225 + Enomem:
1226 ++ kfree(CHIP);
1227 ++ CHIP = NULL;
1228 ++
1229 + return -ENOMEM;
1230 + }
1231 +
1232 +diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
1233 +index 2fd49b2358f8b..f3938c5278832 100644
1234 +--- a/drivers/video/fbdev/hyperv_fb.c
1235 ++++ b/drivers/video/fbdev/hyperv_fb.c
1236 +@@ -712,7 +712,12 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
1237 + goto err1;
1238 + }
1239 +
1240 +- fb_virt = ioremap(par->mem->start, screen_fb_size);
1241 ++ /*
1242 ++ * Map the VRAM cacheable for performance. This is also required for
1243 ++ * VM Connect to display properly for ARM64 Linux VM, as the host also
1244 ++ * maps the VRAM cacheable.
1245 ++ */
1246 ++ fb_virt = ioremap_cache(par->mem->start, screen_fb_size);
1247 + if (!fb_virt)
1248 + goto err2;
1249 +
1250 +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
1251 +index dfc0b3adf57af..6f8f37e37abb2 100644
1252 +--- a/fs/btrfs/inode.c
1253 ++++ b/fs/btrfs/inode.c
1254 +@@ -5440,11 +5440,13 @@ no_delete:
1255 + }
1256 +
1257 + /*
1258 +- * this returns the key found in the dir entry in the location pointer.
1259 ++ * Return the key found in the dir entry in the location pointer, fill @type
1260 ++ * with BTRFS_FT_*, and return 0.
1261 ++ *
1262 + * If no dir entries were found, location->objectid is 0.
1263 + */
1264 + static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
1265 +- struct btrfs_key *location)
1266 ++ struct btrfs_key *location, u8 *type)
1267 + {
1268 + const char *name = dentry->d_name.name;
1269 + int namelen = dentry->d_name.len;
1270 +@@ -5466,6 +5468,8 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
1271 + goto out_err;
1272 +
1273 + btrfs_dir_item_key_to_cpu(path->nodes[0], di, location);
1274 ++ if (!ret)
1275 ++ *type = btrfs_dir_type(path->nodes[0], di);
1276 + out:
1277 + btrfs_free_path(path);
1278 + return ret;
1279 +@@ -5755,19 +5759,25 @@ static struct inode *new_simple_dir(struct super_block *s,
1280 + return inode;
1281 + }
1282 +
1283 ++static inline u8 btrfs_inode_type(struct inode *inode)
1284 ++{
1285 ++ return btrfs_type_by_mode[(inode->i_mode & S_IFMT) >> S_SHIFT];
1286 ++}
1287 ++
1288 + struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
1289 + {
1290 + struct inode *inode;
1291 + struct btrfs_root *root = BTRFS_I(dir)->root;
1292 + struct btrfs_root *sub_root = root;
1293 + struct btrfs_key location;
1294 ++ u8 di_type = 0;
1295 + int index;
1296 + int ret = 0;
1297 +
1298 + if (dentry->d_name.len > BTRFS_NAME_LEN)
1299 + return ERR_PTR(-ENAMETOOLONG);
1300 +
1301 +- ret = btrfs_inode_by_name(dir, dentry, &location);
1302 ++ ret = btrfs_inode_by_name(dir, dentry, &location, &di_type);
1303 + if (ret < 0)
1304 + return ERR_PTR(ret);
1305 +
1306 +@@ -5776,6 +5786,18 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
1307 +
1308 + if (location.type == BTRFS_INODE_ITEM_KEY) {
1309 + inode = btrfs_iget(dir->i_sb, &location, root, NULL);
1310 ++ if (IS_ERR(inode))
1311 ++ return inode;
1312 ++
1313 ++ /* Do extra check against inode mode with di_type */
1314 ++ if (btrfs_inode_type(inode) != di_type) {
1315 ++ btrfs_crit(root->fs_info,
1316 ++"inode mode mismatch with dir: inode mode=0%o btrfs type=%u dir type=%u",
1317 ++ inode->i_mode, btrfs_inode_type(inode),
1318 ++ di_type);
1319 ++ iput(inode);
1320 ++ return ERR_PTR(-EUCLEAN);
1321 ++ }
1322 + return inode;
1323 + }
1324 +
1325 +@@ -6391,11 +6413,6 @@ fail:
1326 + return ERR_PTR(ret);
1327 + }
1328 +
1329 +-static inline u8 btrfs_inode_type(struct inode *inode)
1330 +-{
1331 +- return btrfs_type_by_mode[(inode->i_mode & S_IFMT) >> S_SHIFT];
1332 +-}
1333 +-
1334 + /*
1335 + * utility function to add 'inode' into 'parent_inode' with
1336 + * a give name and a given sequence number.
1337 +@@ -6981,6 +6998,14 @@ again:
1338 + extent_start = found_key.offset;
1339 + if (found_type == BTRFS_FILE_EXTENT_REG ||
1340 + found_type == BTRFS_FILE_EXTENT_PREALLOC) {
1341 ++ /* Only regular file could have regular/prealloc extent */
1342 ++ if (!S_ISREG(inode->i_mode)) {
1343 ++ ret = -EUCLEAN;
1344 ++ btrfs_crit(root->fs_info,
1345 ++ "regular/prealloc extent found for non-regular inode %llu",
1346 ++ btrfs_ino(inode));
1347 ++ goto out;
1348 ++ }
1349 + extent_end = extent_start +
1350 + btrfs_file_extent_num_bytes(leaf, item);
1351 + } else if (found_type == BTRFS_FILE_EXTENT_INLINE) {
1352 +diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
1353 +index 0355e6d9e21cb..154008e245a2f 100644
1354 +--- a/fs/btrfs/qgroup.c
1355 ++++ b/fs/btrfs/qgroup.c
1356 +@@ -461,13 +461,13 @@ next2:
1357 + break;
1358 + }
1359 + out:
1360 ++ btrfs_free_path(path);
1361 + fs_info->qgroup_flags |= flags;
1362 + if (!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_ON))
1363 + clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
1364 + else if (fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN &&
1365 + ret >= 0)
1366 + ret = qgroup_rescan_init(fs_info, rescan_progress, 0);
1367 +- btrfs_free_path(path);
1368 +
1369 + if (ret < 0) {
1370 + ulist_free(fs_info->qgroup_ulist);
1371 +diff --git a/fs/btrfs/tests/inode-tests.c b/fs/btrfs/tests/inode-tests.c
1372 +index 0bf46808ce8f2..ee89de7f4d61b 100644
1373 +--- a/fs/btrfs/tests/inode-tests.c
1374 ++++ b/fs/btrfs/tests/inode-tests.c
1375 +@@ -245,6 +245,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
1376 + return ret;
1377 + }
1378 +
1379 ++ inode->i_mode = S_IFREG;
1380 + BTRFS_I(inode)->location.type = BTRFS_INODE_ITEM_KEY;
1381 + BTRFS_I(inode)->location.objectid = BTRFS_FIRST_FREE_OBJECTID;
1382 + BTRFS_I(inode)->location.offset = 0;
1383 +diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
1384 +index c31b02692f706..7391634520ab2 100644
1385 +--- a/fs/btrfs/volumes.c
1386 ++++ b/fs/btrfs/volumes.c
1387 +@@ -6414,6 +6414,13 @@ static int btrfs_check_chunk_valid(struct btrfs_root *root,
1388 + return -EIO;
1389 + }
1390 +
1391 ++ if (!is_power_of_2(type & BTRFS_BLOCK_GROUP_PROFILE_MASK) &&
1392 ++ (type & BTRFS_BLOCK_GROUP_PROFILE_MASK) != 0) {
1393 ++ btrfs_err(root->fs_info,
1394 ++ "invalid chunk profile flag: 0x%llx, expect 0 or 1 bit set",
1395 ++ type & BTRFS_BLOCK_GROUP_PROFILE_MASK);
1396 ++ return -EUCLEAN;
1397 ++ }
1398 + if ((type & BTRFS_BLOCK_GROUP_TYPE_MASK) == 0) {
1399 + btrfs_err(root->fs_info, "missing chunk type flag: 0x%llx", type);
1400 + return -EIO;
1401 +diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c
1402 +index 71fccccf317e8..5decb3e06563f 100644
1403 +--- a/fs/efivarfs/inode.c
1404 ++++ b/fs/efivarfs/inode.c
1405 +@@ -10,6 +10,7 @@
1406 + #include <linux/efi.h>
1407 + #include <linux/fs.h>
1408 + #include <linux/ctype.h>
1409 ++#include <linux/kmemleak.h>
1410 + #include <linux/slab.h>
1411 + #include <linux/uuid.h>
1412 +
1413 +@@ -104,6 +105,7 @@ static int efivarfs_create(struct inode *dir, struct dentry *dentry,
1414 + var->var.VariableName[i] = '\0';
1415 +
1416 + inode->i_private = var;
1417 ++ kmemleak_ignore(var);
1418 +
1419 + err = efivar_entry_add(var, &efivarfs_list);
1420 + if (err)
1421 +diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
1422 +index bbf056191aaa4..b1e6acec53041 100644
1423 +--- a/fs/efivarfs/super.c
1424 ++++ b/fs/efivarfs/super.c
1425 +@@ -23,7 +23,6 @@ LIST_HEAD(efivarfs_list);
1426 + static void efivarfs_evict_inode(struct inode *inode)
1427 + {
1428 + clear_inode(inode);
1429 +- kfree(inode->i_private);
1430 + }
1431 +
1432 + static const struct super_operations efivarfs_ops = {
1433 +diff --git a/fs/proc/self.c b/fs/proc/self.c
1434 +index c8bbc1c84a39a..f6e2e3fb8a226 100644
1435 +--- a/fs/proc/self.c
1436 ++++ b/fs/proc/self.c
1437 +@@ -26,6 +26,13 @@ static const char *proc_self_get_link(struct dentry *dentry,
1438 + pid_t tgid = task_tgid_nr_ns(current, ns);
1439 + char *name;
1440 +
1441 ++ /*
1442 ++ * Not currently supported. Once we can inherit all of struct pid,
1443 ++ * we can allow this.
1444 ++ */
1445 ++ if (current->flags & PF_KTHREAD)
1446 ++ return ERR_PTR(-EOPNOTSUPP);
1447 ++
1448 + if (!tgid)
1449 + return ERR_PTR(-ENOENT);
1450 + /* 11 for max length of signed int in decimal + NULL term */
1451 +diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
1452 +index ea4f81c2a6d5e..602dff213bae1 100644
1453 +--- a/include/linux/usb/quirks.h
1454 ++++ b/include/linux/usb/quirks.h
1455 +@@ -59,4 +59,7 @@
1456 + /* Device needs a pause after every control message. */
1457 + #define USB_QUIRK_DELAY_CTRL_MSG BIT(13)
1458 +
1459 ++/* device has blacklisted endpoints */
1460 ++#define USB_QUIRK_ENDPOINT_BLACKLIST BIT(15)
1461 ++
1462 + #endif /* __LINUX_USB_QUIRKS_H */
1463 +diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
1464 +index c7b1dc713cdd7..9c7f4aad6db66 100644
1465 +--- a/include/scsi/libiscsi.h
1466 ++++ b/include/scsi/libiscsi.h
1467 +@@ -144,6 +144,9 @@ struct iscsi_task {
1468 + void *dd_data; /* driver/transport data */
1469 + };
1470 +
1471 ++/* invalid scsi_task pointer */
1472 ++#define INVALID_SCSI_TASK (struct iscsi_task *)-1l
1473 ++
1474 + static inline int iscsi_task_has_unsol_data(struct iscsi_task *task)
1475 + {
1476 + return task->unsol_r2t.data_length > task->unsol_r2t.sent;
1477 +diff --git a/mm/huge_memory.c b/mm/huge_memory.c
1478 +index cf4c0a61b3708..0385c57a2b7af 100644
1479 +--- a/mm/huge_memory.c
1480 ++++ b/mm/huge_memory.c
1481 +@@ -661,7 +661,6 @@ int do_huge_pmd_anonymous_page(struct fault_env *fe)
1482 + transparent_hugepage_use_zero_page()) {
1483 + pgtable_t pgtable;
1484 + struct page *zero_page;
1485 +- bool set;
1486 + int ret;
1487 + pgtable = pte_alloc_one(vma->vm_mm, haddr);
1488 + if (unlikely(!pgtable))
1489 +@@ -674,22 +673,21 @@ int do_huge_pmd_anonymous_page(struct fault_env *fe)
1490 + }
1491 + fe->ptl = pmd_lock(vma->vm_mm, fe->pmd);
1492 + ret = 0;
1493 +- set = false;
1494 + if (pmd_none(*fe->pmd)) {
1495 + if (userfaultfd_missing(vma)) {
1496 + spin_unlock(fe->ptl);
1497 ++ pte_free(vma->vm_mm, pgtable);
1498 + ret = handle_userfault(fe, VM_UFFD_MISSING);
1499 + VM_BUG_ON(ret & VM_FAULT_FALLBACK);
1500 + } else {
1501 + set_huge_zero_page(pgtable, vma->vm_mm, vma,
1502 + haddr, fe->pmd, zero_page);
1503 + spin_unlock(fe->ptl);
1504 +- set = true;
1505 + }
1506 +- } else
1507 ++ } else {
1508 + spin_unlock(fe->ptl);
1509 +- if (!set)
1510 + pte_free(vma->vm_mm, pgtable);
1511 ++ }
1512 + return ret;
1513 + }
1514 + gfp = alloc_hugepage_direct_gfpmask(vma);
1515 +diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c
1516 +index 56dc532f7a2c2..b422a8b34b9f5 100644
1517 +--- a/net/batman-adv/log.c
1518 ++++ b/net/batman-adv/log.c
1519 +@@ -196,6 +196,7 @@ static const struct file_operations batadv_log_fops = {
1520 + .read = batadv_log_read,
1521 + .poll = batadv_log_poll,
1522 + .llseek = no_llseek,
1523 ++ .owner = THIS_MODULE,
1524 + };
1525 +
1526 + int batadv_debug_log_setup(struct batadv_priv *bat_priv)
1527 +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
1528 +index 4f8dd558af48f..ba0c3a381933e 100644
1529 +--- a/sound/pci/hda/patch_hdmi.c
1530 ++++ b/sound/pci/hda/patch_hdmi.c
1531 +@@ -307,13 +307,13 @@ static int hdmi_eld_ctl_info(struct snd_kcontrol *kcontrol,
1532 + if (!per_pin) {
1533 + /* no pin is bound to the pcm */
1534 + uinfo->count = 0;
1535 +- mutex_unlock(&spec->pcm_lock);
1536 +- return 0;
1537 ++ goto unlock;
1538 + }
1539 + eld = &per_pin->sink_eld;
1540 + uinfo->count = eld->eld_valid ? eld->eld_size : 0;
1541 +- mutex_unlock(&spec->pcm_lock);
1542 +
1543 ++ unlock:
1544 ++ mutex_unlock(&spec->pcm_lock);
1545 + return 0;
1546 + }
1547 +
1548 +@@ -325,6 +325,7 @@ static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol,
1549 + struct hdmi_spec_per_pin *per_pin;
1550 + struct hdmi_eld *eld;
1551 + int pcm_idx;
1552 ++ int err = 0;
1553 +
1554 + pcm_idx = kcontrol->private_value;
1555 + mutex_lock(&spec->pcm_lock);
1556 +@@ -333,16 +334,15 @@ static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol,
1557 + /* no pin is bound to the pcm */
1558 + memset(ucontrol->value.bytes.data, 0,
1559 + ARRAY_SIZE(ucontrol->value.bytes.data));
1560 +- mutex_unlock(&spec->pcm_lock);
1561 +- return 0;
1562 ++ goto unlock;
1563 + }
1564 +- eld = &per_pin->sink_eld;
1565 +
1566 ++ eld = &per_pin->sink_eld;
1567 + if (eld->eld_size > ARRAY_SIZE(ucontrol->value.bytes.data) ||
1568 + eld->eld_size > ELD_MAX_SIZE) {
1569 +- mutex_unlock(&spec->pcm_lock);
1570 + snd_BUG();
1571 +- return -EINVAL;
1572 ++ err = -EINVAL;
1573 ++ goto unlock;
1574 + }
1575 +
1576 + memset(ucontrol->value.bytes.data, 0,
1577 +@@ -350,9 +350,10 @@ static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol,
1578 + if (eld->eld_valid)
1579 + memcpy(ucontrol->value.bytes.data, eld->eld_buffer,
1580 + eld->eld_size);
1581 +- mutex_unlock(&spec->pcm_lock);
1582 +
1583 +- return 0;
1584 ++ unlock:
1585 ++ mutex_unlock(&spec->pcm_lock);
1586 ++ return err;
1587 + }
1588 +
1589 + static struct snd_kcontrol_new eld_bytes_ctl = {
1590 +@@ -1114,8 +1115,8 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
1591 + pin_idx = hinfo_to_pin_index(codec, hinfo);
1592 + if (!spec->dyn_pcm_assign) {
1593 + if (snd_BUG_ON(pin_idx < 0)) {
1594 +- mutex_unlock(&spec->pcm_lock);
1595 +- return -EINVAL;
1596 ++ err = -EINVAL;
1597 ++ goto unlock;
1598 + }
1599 + } else {
1600 + /* no pin is assigned to the PCM
1601 +@@ -1123,16 +1124,13 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
1602 + */
1603 + if (pin_idx < 0) {
1604 + err = hdmi_pcm_open_no_pin(hinfo, codec, substream);
1605 +- mutex_unlock(&spec->pcm_lock);
1606 +- return err;
1607 ++ goto unlock;
1608 + }
1609 + }
1610 +
1611 + err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx);
1612 +- if (err < 0) {
1613 +- mutex_unlock(&spec->pcm_lock);
1614 +- return err;
1615 +- }
1616 ++ if (err < 0)
1617 ++ goto unlock;
1618 +
1619 + per_cvt = get_cvt(spec, cvt_idx);
1620 + /* Claim converter */
1621 +@@ -1168,12 +1166,11 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
1622 + per_cvt->assigned = 0;
1623 + hinfo->nid = 0;
1624 + snd_hda_spdif_ctls_unassign(codec, pcm_idx);
1625 +- mutex_unlock(&spec->pcm_lock);
1626 +- return -ENODEV;
1627 ++ err = -ENODEV;
1628 ++ goto unlock;
1629 + }
1630 + }
1631 +
1632 +- mutex_unlock(&spec->pcm_lock);
1633 + /* Store the updated parameters */
1634 + runtime->hw.channels_min = hinfo->channels_min;
1635 + runtime->hw.channels_max = hinfo->channels_max;
1636 +@@ -1182,7 +1179,9 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
1637 +
1638 + snd_pcm_hw_constraint_step(substream->runtime, 0,
1639 + SNDRV_PCM_HW_PARAM_CHANNELS, 2);
1640 +- return 0;
1641 ++ unlock:
1642 ++ mutex_unlock(&spec->pcm_lock);
1643 ++ return err;
1644 + }
1645 +
1646 + /*
1647 +@@ -1726,7 +1725,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1648 + struct snd_pcm_runtime *runtime = substream->runtime;
1649 + bool non_pcm;
1650 + int pinctl;
1651 +- int err;
1652 ++ int err = 0;
1653 +
1654 + mutex_lock(&spec->pcm_lock);
1655 + pin_idx = hinfo_to_pin_index(codec, hinfo);
1656 +@@ -1738,13 +1737,12 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1657 + pin_cvt_fixup(codec, NULL, cvt_nid);
1658 + snd_hda_codec_setup_stream(codec, cvt_nid,
1659 + stream_tag, 0, format);
1660 +- mutex_unlock(&spec->pcm_lock);
1661 +- return 0;
1662 ++ goto unlock;
1663 + }
1664 +
1665 + if (snd_BUG_ON(pin_idx < 0)) {
1666 +- mutex_unlock(&spec->pcm_lock);
1667 +- return -EINVAL;
1668 ++ err = -EINVAL;
1669 ++ goto unlock;
1670 + }
1671 + per_pin = get_pin(spec, pin_idx);
1672 + pin_nid = per_pin->pin_nid;
1673 +@@ -1781,6 +1779,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1674 +
1675 + err = spec->ops.setup_stream(codec, cvt_nid, pin_nid,
1676 + stream_tag, format);
1677 ++ unlock:
1678 + mutex_unlock(&spec->pcm_lock);
1679 + return err;
1680 + }
1681 +@@ -1802,32 +1801,34 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
1682 + struct hdmi_spec_per_cvt *per_cvt;
1683 + struct hdmi_spec_per_pin *per_pin;
1684 + int pinctl;
1685 ++ int err = 0;
1686 +
1687 ++ mutex_lock(&spec->pcm_lock);
1688 + if (hinfo->nid) {
1689 + pcm_idx = hinfo_to_pcm_index(codec, hinfo);
1690 +- if (snd_BUG_ON(pcm_idx < 0))
1691 +- return -EINVAL;
1692 ++ if (snd_BUG_ON(pcm_idx < 0)) {
1693 ++ err = -EINVAL;
1694 ++ goto unlock;
1695 ++ }
1696 + cvt_idx = cvt_nid_to_cvt_index(codec, hinfo->nid);
1697 +- if (snd_BUG_ON(cvt_idx < 0))
1698 +- return -EINVAL;
1699 ++ if (snd_BUG_ON(cvt_idx < 0)) {
1700 ++ err = -EINVAL;
1701 ++ goto unlock;
1702 ++ }
1703 + per_cvt = get_cvt(spec, cvt_idx);
1704 +-
1705 + snd_BUG_ON(!per_cvt->assigned);
1706 + per_cvt->assigned = 0;
1707 + hinfo->nid = 0;
1708 +
1709 +- mutex_lock(&spec->pcm_lock);
1710 + snd_hda_spdif_ctls_unassign(codec, pcm_idx);
1711 + clear_bit(pcm_idx, &spec->pcm_in_use);
1712 + pin_idx = hinfo_to_pin_index(codec, hinfo);
1713 +- if (spec->dyn_pcm_assign && pin_idx < 0) {
1714 +- mutex_unlock(&spec->pcm_lock);
1715 +- return 0;
1716 +- }
1717 ++ if (spec->dyn_pcm_assign && pin_idx < 0)
1718 ++ goto unlock;
1719 +
1720 + if (snd_BUG_ON(pin_idx < 0)) {
1721 +- mutex_unlock(&spec->pcm_lock);
1722 +- return -EINVAL;
1723 ++ err = -EINVAL;
1724 ++ goto unlock;
1725 + }
1726 + per_pin = get_pin(spec, pin_idx);
1727 +
1728 +@@ -1846,10 +1847,12 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
1729 + per_pin->setup = false;
1730 + per_pin->channels = 0;
1731 + mutex_unlock(&per_pin->lock);
1732 +- mutex_unlock(&spec->pcm_lock);
1733 + }
1734 +
1735 +- return 0;
1736 ++unlock:
1737 ++ mutex_unlock(&spec->pcm_lock);
1738 ++
1739 ++ return err;
1740 + }
1741 +
1742 + static const struct hda_pcm_ops generic_ops = {
1743 +diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
1744 +index fb4e1d2839c5f..cbbacc3467494 100644
1745 +--- a/tools/perf/util/dwarf-aux.c
1746 ++++ b/tools/perf/util/dwarf-aux.c
1747 +@@ -329,6 +329,7 @@ bool die_is_func_def(Dwarf_Die *dw_die)
1748 + int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr)
1749 + {
1750 + Dwarf_Addr base, end;
1751 ++ Dwarf_Attribute attr;
1752 +
1753 + if (!addr)
1754 + return -EINVAL;
1755 +@@ -336,6 +337,13 @@ int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr)
1756 + if (dwarf_entrypc(dw_die, addr) == 0)
1757 + return 0;
1758 +
1759 ++ /*
1760 ++ * Since the dwarf_ranges() will return 0 if there is no
1761 ++ * DW_AT_ranges attribute, we should check it first.
1762 ++ */
1763 ++ if (!dwarf_attr(dw_die, DW_AT_ranges, &attr))
1764 ++ return -ENOENT;
1765 ++
1766 + return dwarf_ranges(dw_die, 0, &base, addr, &end) < 0 ? -ENOENT : 0;
1767 + }
1768 +
1769 +diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
1770 +index 2d5744d986f0b..659c41004322d 100644
1771 +--- a/tools/perf/util/event.c
1772 ++++ b/tools/perf/util/event.c
1773 +@@ -682,11 +682,13 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
1774 + int err;
1775 + union perf_event *event;
1776 +
1777 +- if (symbol_conf.kptr_restrict)
1778 +- return -1;
1779 + if (map == NULL)
1780 + return -1;
1781 +
1782 ++ kmap = map__kmap(map);
1783 ++ if (!kmap->ref_reloc_sym)
1784 ++ return -1;
1785 ++
1786 + /*
1787 + * We should get this from /sys/kernel/sections/.text, but till that is
1788 + * available use this, and after it is use this as a fallback for older
1789 +@@ -710,7 +712,6 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
1790 + event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL;
1791 + }
1792 +
1793 +- kmap = map__kmap(map);
1794 + size = snprintf(event->mmap.filename, sizeof(event->mmap.filename),
1795 + "%s%s", mmap_name, kmap->ref_reloc_sym->name) + 1;
1796 + size = PERF_ALIGN(size, sizeof(u64));