1 |
commit: cb9215620693ce57c62fd42deef2a836304be704 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 10 19:39:12 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 10 19:39:12 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=cb921562 |
7 |
|
8 |
Linux patch 4.14.118 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1117_linux-4.14.118.patch | 1623 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1627 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 0096da3..c2f9a77 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -511,6 +511,10 @@ Patch: 1116_4.14.117.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.14.117 |
23 |
|
24 |
+Patch: 1117_4.14.118.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.14.118 |
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/1117_linux-4.14.118.patch b/1117_linux-4.14.118.patch |
33 |
new file mode 100644 |
34 |
index 0000000..c6d0d57 |
35 |
--- /dev/null |
36 |
+++ b/1117_linux-4.14.118.patch |
37 |
@@ -0,0 +1,1623 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index efe716372985..a856457cab8f 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 = 117 |
47 |
++SUBLEVEL = 118 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Petit Gorille |
50 |
+ |
51 |
+diff --git a/arch/arm64/include/asm/futex.h b/arch/arm64/include/asm/futex.h |
52 |
+index fd1e722f3821..c7e30a6ed56e 100644 |
53 |
+--- a/arch/arm64/include/asm/futex.h |
54 |
++++ b/arch/arm64/include/asm/futex.h |
55 |
+@@ -23,26 +23,34 @@ |
56 |
+ |
57 |
+ #include <asm/errno.h> |
58 |
+ |
59 |
++#define FUTEX_MAX_LOOPS 128 /* What's the largest number you can think of? */ |
60 |
++ |
61 |
+ #define __futex_atomic_op(insn, ret, oldval, uaddr, tmp, oparg) \ |
62 |
+ do { \ |
63 |
++ unsigned int loops = FUTEX_MAX_LOOPS; \ |
64 |
++ \ |
65 |
+ uaccess_enable(); \ |
66 |
+ asm volatile( \ |
67 |
+ " prfm pstl1strm, %2\n" \ |
68 |
+ "1: ldxr %w1, %2\n" \ |
69 |
+ insn "\n" \ |
70 |
+ "2: stlxr %w0, %w3, %2\n" \ |
71 |
+-" cbnz %w0, 1b\n" \ |
72 |
+-" dmb ish\n" \ |
73 |
++" cbz %w0, 3f\n" \ |
74 |
++" sub %w4, %w4, %w0\n" \ |
75 |
++" cbnz %w4, 1b\n" \ |
76 |
++" mov %w0, %w7\n" \ |
77 |
+ "3:\n" \ |
78 |
++" dmb ish\n" \ |
79 |
+ " .pushsection .fixup,\"ax\"\n" \ |
80 |
+ " .align 2\n" \ |
81 |
+-"4: mov %w0, %w5\n" \ |
82 |
++"4: mov %w0, %w6\n" \ |
83 |
+ " b 3b\n" \ |
84 |
+ " .popsection\n" \ |
85 |
+ _ASM_EXTABLE(1b, 4b) \ |
86 |
+ _ASM_EXTABLE(2b, 4b) \ |
87 |
+- : "=&r" (ret), "=&r" (oldval), "+Q" (*uaddr), "=&r" (tmp) \ |
88 |
+- : "r" (oparg), "Ir" (-EFAULT) \ |
89 |
++ : "=&r" (ret), "=&r" (oldval), "+Q" (*uaddr), "=&r" (tmp), \ |
90 |
++ "+r" (loops) \ |
91 |
++ : "r" (oparg), "Ir" (-EFAULT), "Ir" (-EAGAIN) \ |
92 |
+ : "memory"); \ |
93 |
+ uaccess_disable(); \ |
94 |
+ } while (0) |
95 |
+@@ -57,23 +65,23 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *_uaddr) |
96 |
+ |
97 |
+ switch (op) { |
98 |
+ case FUTEX_OP_SET: |
99 |
+- __futex_atomic_op("mov %w3, %w4", |
100 |
++ __futex_atomic_op("mov %w3, %w5", |
101 |
+ ret, oldval, uaddr, tmp, oparg); |
102 |
+ break; |
103 |
+ case FUTEX_OP_ADD: |
104 |
+- __futex_atomic_op("add %w3, %w1, %w4", |
105 |
++ __futex_atomic_op("add %w3, %w1, %w5", |
106 |
+ ret, oldval, uaddr, tmp, oparg); |
107 |
+ break; |
108 |
+ case FUTEX_OP_OR: |
109 |
+- __futex_atomic_op("orr %w3, %w1, %w4", |
110 |
++ __futex_atomic_op("orr %w3, %w1, %w5", |
111 |
+ ret, oldval, uaddr, tmp, oparg); |
112 |
+ break; |
113 |
+ case FUTEX_OP_ANDN: |
114 |
+- __futex_atomic_op("and %w3, %w1, %w4", |
115 |
++ __futex_atomic_op("and %w3, %w1, %w5", |
116 |
+ ret, oldval, uaddr, tmp, ~oparg); |
117 |
+ break; |
118 |
+ case FUTEX_OP_XOR: |
119 |
+- __futex_atomic_op("eor %w3, %w1, %w4", |
120 |
++ __futex_atomic_op("eor %w3, %w1, %w5", |
121 |
+ ret, oldval, uaddr, tmp, oparg); |
122 |
+ break; |
123 |
+ default: |
124 |
+@@ -93,6 +101,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *_uaddr, |
125 |
+ u32 oldval, u32 newval) |
126 |
+ { |
127 |
+ int ret = 0; |
128 |
++ unsigned int loops = FUTEX_MAX_LOOPS; |
129 |
+ u32 val, tmp; |
130 |
+ u32 __user *uaddr; |
131 |
+ |
132 |
+@@ -104,20 +113,24 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *_uaddr, |
133 |
+ asm volatile("// futex_atomic_cmpxchg_inatomic\n" |
134 |
+ " prfm pstl1strm, %2\n" |
135 |
+ "1: ldxr %w1, %2\n" |
136 |
+-" sub %w3, %w1, %w4\n" |
137 |
+-" cbnz %w3, 3f\n" |
138 |
+-"2: stlxr %w3, %w5, %2\n" |
139 |
+-" cbnz %w3, 1b\n" |
140 |
+-" dmb ish\n" |
141 |
++" sub %w3, %w1, %w5\n" |
142 |
++" cbnz %w3, 4f\n" |
143 |
++"2: stlxr %w3, %w6, %2\n" |
144 |
++" cbz %w3, 3f\n" |
145 |
++" sub %w4, %w4, %w3\n" |
146 |
++" cbnz %w4, 1b\n" |
147 |
++" mov %w0, %w8\n" |
148 |
+ "3:\n" |
149 |
++" dmb ish\n" |
150 |
++"4:\n" |
151 |
+ " .pushsection .fixup,\"ax\"\n" |
152 |
+-"4: mov %w0, %w6\n" |
153 |
+-" b 3b\n" |
154 |
++"5: mov %w0, %w7\n" |
155 |
++" b 4b\n" |
156 |
+ " .popsection\n" |
157 |
+- _ASM_EXTABLE(1b, 4b) |
158 |
+- _ASM_EXTABLE(2b, 4b) |
159 |
+- : "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp) |
160 |
+- : "r" (oldval), "r" (newval), "Ir" (-EFAULT) |
161 |
++ _ASM_EXTABLE(1b, 5b) |
162 |
++ _ASM_EXTABLE(2b, 5b) |
163 |
++ : "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp), "+r" (loops) |
164 |
++ : "r" (oldval), "r" (newval), "Ir" (-EFAULT), "Ir" (-EAGAIN) |
165 |
+ : "memory"); |
166 |
+ uaccess_disable(); |
167 |
+ |
168 |
+diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c |
169 |
+index eb6c0d582626..2c1e30ca7ee4 100644 |
170 |
+--- a/arch/mips/kernel/kgdb.c |
171 |
++++ b/arch/mips/kernel/kgdb.c |
172 |
+@@ -33,6 +33,7 @@ |
173 |
+ #include <asm/processor.h> |
174 |
+ #include <asm/sigcontext.h> |
175 |
+ #include <linux/uaccess.h> |
176 |
++#include <asm/irq_regs.h> |
177 |
+ |
178 |
+ static struct hard_trap_info { |
179 |
+ unsigned char tt; /* Trap type code for MIPS R3xxx and R4xxx */ |
180 |
+@@ -214,7 +215,7 @@ static void kgdb_call_nmi_hook(void *ignored) |
181 |
+ old_fs = get_fs(); |
182 |
+ set_fs(get_ds()); |
183 |
+ |
184 |
+- kgdb_nmicallback(raw_smp_processor_id(), NULL); |
185 |
++ kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs()); |
186 |
+ |
187 |
+ set_fs(old_fs); |
188 |
+ } |
189 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
190 |
+index 99d45660242e..82ddee4ab25f 100644 |
191 |
+--- a/arch/x86/events/intel/core.c |
192 |
++++ b/arch/x86/events/intel/core.c |
193 |
+@@ -3051,7 +3051,7 @@ static int intel_pmu_hw_config(struct perf_event *event) |
194 |
+ return ret; |
195 |
+ |
196 |
+ if (event->attr.precise_ip) { |
197 |
+- if (!event->attr.freq) { |
198 |
++ if (!(event->attr.freq || event->attr.wakeup_events)) { |
199 |
+ event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD; |
200 |
+ if (!(event->attr.sample_type & |
201 |
+ ~intel_pmu_free_running_flags(event))) |
202 |
+@@ -3427,6 +3427,12 @@ static void intel_pmu_cpu_starting(int cpu) |
203 |
+ |
204 |
+ cpuc->lbr_sel = NULL; |
205 |
+ |
206 |
++ if (x86_pmu.flags & PMU_FL_TFA) { |
207 |
++ WARN_ON_ONCE(cpuc->tfa_shadow); |
208 |
++ cpuc->tfa_shadow = ~0ULL; |
209 |
++ intel_set_tfa(cpuc, false); |
210 |
++ } |
211 |
++ |
212 |
+ if (x86_pmu.version > 1) |
213 |
+ flip_smm_bit(&x86_pmu.attr_freeze_on_smi); |
214 |
+ |
215 |
+diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c |
216 |
+index 68846897d213..8767401f75e0 100644 |
217 |
+--- a/drivers/block/virtio_blk.c |
218 |
++++ b/drivers/block/virtio_blk.c |
219 |
+@@ -437,6 +437,8 @@ static int init_vq(struct virtio_blk *vblk) |
220 |
+ if (err) |
221 |
+ num_vqs = 1; |
222 |
+ |
223 |
++ num_vqs = min_t(unsigned int, nr_cpu_ids, num_vqs); |
224 |
++ |
225 |
+ vblk->vqs = kmalloc_array(num_vqs, sizeof(*vblk->vqs), GFP_KERNEL); |
226 |
+ if (!vblk->vqs) |
227 |
+ return -ENOMEM; |
228 |
+diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c |
229 |
+index aba27ea9cea5..3c69c73fbd47 100644 |
230 |
+--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c |
231 |
++++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c |
232 |
+@@ -1473,7 +1473,6 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, |
233 |
+ if (IS_ERR(regmap)) |
234 |
+ ret = PTR_ERR(regmap); |
235 |
+ if (ret) { |
236 |
+- ret = PTR_ERR(regmap); |
237 |
+ dev_err(dev, |
238 |
+ "Failed to get system configuration registers: %d\n", |
239 |
+ ret); |
240 |
+@@ -1509,6 +1508,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, |
241 |
+ of_node_put(remote); |
242 |
+ |
243 |
+ hdmi->ddc_adpt = of_find_i2c_adapter_by_node(i2c_np); |
244 |
++ of_node_put(i2c_np); |
245 |
+ if (!hdmi->ddc_adpt) { |
246 |
+ dev_err(dev, "Failed to get ddc i2c adapter by node\n"); |
247 |
+ return -EINVAL; |
248 |
+diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c |
249 |
+index d8101cd28dfa..fe041f22521d 100644 |
250 |
+--- a/drivers/hv/hv.c |
251 |
++++ b/drivers/hv/hv.c |
252 |
+@@ -356,7 +356,6 @@ int hv_synic_cleanup(unsigned int cpu) |
253 |
+ |
254 |
+ clockevents_unbind_device(hv_cpu->clk_evt, cpu); |
255 |
+ hv_ce_shutdown(hv_cpu->clk_evt); |
256 |
+- put_cpu_ptr(hv_cpu); |
257 |
+ } |
258 |
+ |
259 |
+ hv_get_synint_state(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, |
260 |
+diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c |
261 |
+index ef699477d94a..eb8444faa14e 100644 |
262 |
+--- a/drivers/hwtracing/intel_th/pci.c |
263 |
++++ b/drivers/hwtracing/intel_th/pci.c |
264 |
+@@ -173,6 +173,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { |
265 |
+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x34a6), |
266 |
+ .driver_data = (kernel_ulong_t)&intel_th_2x, |
267 |
+ }, |
268 |
++ { |
269 |
++ /* Comet Lake */ |
270 |
++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x02a6), |
271 |
++ .driver_data = (kernel_ulong_t)&intel_th_2x, |
272 |
++ }, |
273 |
+ { 0 }, |
274 |
+ }; |
275 |
+ |
276 |
+diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c |
277 |
+index d3b8cb92fd6d..28eb7003c297 100644 |
278 |
+--- a/drivers/infiniband/hw/hfi1/rc.c |
279 |
++++ b/drivers/infiniband/hw/hfi1/rc.c |
280 |
+@@ -2309,7 +2309,7 @@ send_last: |
281 |
+ update_ack_queue(qp, next); |
282 |
+ } |
283 |
+ e = &qp->s_ack_queue[qp->r_head_ack_queue]; |
284 |
+- if (e->opcode == OP(RDMA_READ_REQUEST) && e->rdma_sge.mr) { |
285 |
++ if (e->rdma_sge.mr) { |
286 |
+ rvt_put_mr(e->rdma_sge.mr); |
287 |
+ e->rdma_sge.mr = NULL; |
288 |
+ } |
289 |
+@@ -2383,7 +2383,7 @@ send_last: |
290 |
+ update_ack_queue(qp, next); |
291 |
+ } |
292 |
+ e = &qp->s_ack_queue[qp->r_head_ack_queue]; |
293 |
+- if (e->opcode == OP(RDMA_READ_REQUEST) && e->rdma_sge.mr) { |
294 |
++ if (e->rdma_sge.mr) { |
295 |
+ rvt_put_mr(e->rdma_sge.mr); |
296 |
+ e->rdma_sge.mr = NULL; |
297 |
+ } |
298 |
+diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c |
299 |
+index 6ce709a67959..d549c9ffadcb 100644 |
300 |
+--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c |
301 |
++++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c |
302 |
+@@ -1055,6 +1055,8 @@ static void pvrdma_pci_remove(struct pci_dev *pdev) |
303 |
+ pvrdma_page_dir_cleanup(dev, &dev->cq_pdir); |
304 |
+ pvrdma_page_dir_cleanup(dev, &dev->async_pdir); |
305 |
+ pvrdma_free_slots(dev); |
306 |
++ dma_free_coherent(&pdev->dev, sizeof(*dev->dsr), dev->dsr, |
307 |
++ dev->dsrbase); |
308 |
+ |
309 |
+ iounmap(dev->regs); |
310 |
+ kfree(dev->sgid_tbl); |
311 |
+diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c |
312 |
+index 91d7718625a6..3884e82d24e9 100644 |
313 |
+--- a/drivers/iommu/amd_iommu_init.c |
314 |
++++ b/drivers/iommu/amd_iommu_init.c |
315 |
+@@ -355,7 +355,7 @@ static void iommu_write_l2(struct amd_iommu *iommu, u8 address, u32 val) |
316 |
+ static void iommu_set_exclusion_range(struct amd_iommu *iommu) |
317 |
+ { |
318 |
+ u64 start = iommu->exclusion_start & PAGE_MASK; |
319 |
+- u64 limit = (start + iommu->exclusion_length) & PAGE_MASK; |
320 |
++ u64 limit = (start + iommu->exclusion_length - 1) & PAGE_MASK; |
321 |
+ u64 entry; |
322 |
+ |
323 |
+ if (!iommu->exclusion_start) |
324 |
+diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c |
325 |
+index 75f69cf0d45f..50f2a125cd2c 100644 |
326 |
+--- a/drivers/platform/x86/pmc_atom.c |
327 |
++++ b/drivers/platform/x86/pmc_atom.c |
328 |
+@@ -426,7 +426,7 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc) |
329 |
+ * Some systems need one or more of their pmc_plt_clks to be |
330 |
+ * marked as critical. |
331 |
+ */ |
332 |
+-static const struct dmi_system_id critclk_systems[] __initconst = { |
333 |
++static const struct dmi_system_id critclk_systems[] = { |
334 |
+ { |
335 |
+ .ident = "MPL CEC1x", |
336 |
+ .matches = { |
337 |
+diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c |
338 |
+index dab0d3f9bee1..e09c7f360dbd 100644 |
339 |
+--- a/drivers/scsi/csiostor/csio_scsi.c |
340 |
++++ b/drivers/scsi/csiostor/csio_scsi.c |
341 |
+@@ -1713,8 +1713,11 @@ csio_scsi_err_handler(struct csio_hw *hw, struct csio_ioreq *req) |
342 |
+ } |
343 |
+ |
344 |
+ out: |
345 |
+- if (req->nsge > 0) |
346 |
++ if (req->nsge > 0) { |
347 |
+ scsi_dma_unmap(cmnd); |
348 |
++ if (req->dcopy && (host_status == DID_OK)) |
349 |
++ host_status = csio_scsi_copy_to_sgl(hw, req); |
350 |
++ } |
351 |
+ |
352 |
+ cmnd->result = (((host_status) << 16) | scsi_status); |
353 |
+ cmnd->scsi_done(cmnd); |
354 |
+diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c |
355 |
+index 56dec663d9f4..1c0d2784574a 100644 |
356 |
+--- a/drivers/scsi/libsas/sas_expander.c |
357 |
++++ b/drivers/scsi/libsas/sas_expander.c |
358 |
+@@ -47,17 +47,16 @@ static void smp_task_timedout(unsigned long _task) |
359 |
+ unsigned long flags; |
360 |
+ |
361 |
+ spin_lock_irqsave(&task->task_state_lock, flags); |
362 |
+- if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) |
363 |
++ if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { |
364 |
+ task->task_state_flags |= SAS_TASK_STATE_ABORTED; |
365 |
++ complete(&task->slow_task->completion); |
366 |
++ } |
367 |
+ spin_unlock_irqrestore(&task->task_state_lock, flags); |
368 |
+- |
369 |
+- complete(&task->slow_task->completion); |
370 |
+ } |
371 |
+ |
372 |
+ static void smp_task_done(struct sas_task *task) |
373 |
+ { |
374 |
+- if (!del_timer(&task->slow_task->timer)) |
375 |
+- return; |
376 |
++ del_timer(&task->slow_task->timer); |
377 |
+ complete(&task->slow_task->completion); |
378 |
+ } |
379 |
+ |
380 |
+diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c |
381 |
+index b09d29931393..1844c2f59460 100644 |
382 |
+--- a/drivers/scsi/qla2xxx/qla_attr.c |
383 |
++++ b/drivers/scsi/qla2xxx/qla_attr.c |
384 |
+@@ -345,7 +345,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, |
385 |
+ } |
386 |
+ |
387 |
+ ha->optrom_region_start = start; |
388 |
+- ha->optrom_region_size = start + size; |
389 |
++ ha->optrom_region_size = size; |
390 |
+ |
391 |
+ ha->optrom_state = QLA_SREADING; |
392 |
+ ha->optrom_buffer = vmalloc(ha->optrom_region_size); |
393 |
+@@ -418,7 +418,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, |
394 |
+ } |
395 |
+ |
396 |
+ ha->optrom_region_start = start; |
397 |
+- ha->optrom_region_size = start + size; |
398 |
++ ha->optrom_region_size = size; |
399 |
+ |
400 |
+ ha->optrom_state = QLA_SWRITING; |
401 |
+ ha->optrom_buffer = vmalloc(ha->optrom_region_size); |
402 |
+diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c |
403 |
+index 20cac20518d7..809664807643 100644 |
404 |
+--- a/drivers/staging/greybus/power_supply.c |
405 |
++++ b/drivers/staging/greybus/power_supply.c |
406 |
+@@ -521,7 +521,7 @@ static int gb_power_supply_prop_descriptors_get(struct gb_power_supply *gbpsy) |
407 |
+ |
408 |
+ op = gb_operation_create(connection, |
409 |
+ GB_POWER_SUPPLY_TYPE_GET_PROP_DESCRIPTORS, |
410 |
+- sizeof(req), sizeof(*resp) + props_count * |
411 |
++ sizeof(*req), sizeof(*resp) + props_count * |
412 |
+ sizeof(struct gb_power_supply_props_desc), |
413 |
+ GFP_KERNEL); |
414 |
+ if (!op) |
415 |
+diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
416 |
+index f736c8895089..efa8b620fee8 100644 |
417 |
+--- a/drivers/usb/class/cdc-acm.c |
418 |
++++ b/drivers/usb/class/cdc-acm.c |
419 |
+@@ -482,12 +482,12 @@ static void acm_read_bulk_callback(struct urb *urb) |
420 |
+ struct acm *acm = rb->instance; |
421 |
+ unsigned long flags; |
422 |
+ int status = urb->status; |
423 |
++ bool stopped = false; |
424 |
++ bool stalled = false; |
425 |
+ |
426 |
+ dev_vdbg(&acm->data->dev, "got urb %d, len %d, status %d\n", |
427 |
+ rb->index, urb->actual_length, status); |
428 |
+ |
429 |
+- set_bit(rb->index, &acm->read_urbs_free); |
430 |
+- |
431 |
+ if (!acm->dev) { |
432 |
+ dev_dbg(&acm->data->dev, "%s - disconnected\n", __func__); |
433 |
+ return; |
434 |
+@@ -500,15 +500,16 @@ static void acm_read_bulk_callback(struct urb *urb) |
435 |
+ break; |
436 |
+ case -EPIPE: |
437 |
+ set_bit(EVENT_RX_STALL, &acm->flags); |
438 |
+- schedule_work(&acm->work); |
439 |
+- return; |
440 |
++ stalled = true; |
441 |
++ break; |
442 |
+ case -ENOENT: |
443 |
+ case -ECONNRESET: |
444 |
+ case -ESHUTDOWN: |
445 |
+ dev_dbg(&acm->data->dev, |
446 |
+ "%s - urb shutting down with status: %d\n", |
447 |
+ __func__, status); |
448 |
+- return; |
449 |
++ stopped = true; |
450 |
++ break; |
451 |
+ default: |
452 |
+ dev_dbg(&acm->data->dev, |
453 |
+ "%s - nonzero urb status received: %d\n", |
454 |
+@@ -517,10 +518,24 @@ static void acm_read_bulk_callback(struct urb *urb) |
455 |
+ } |
456 |
+ |
457 |
+ /* |
458 |
+- * Unthrottle may run on another CPU which needs to see events |
459 |
+- * in the same order. Submission has an implict barrier |
460 |
++ * Make sure URB processing is done before marking as free to avoid |
461 |
++ * racing with unthrottle() on another CPU. Matches the barriers |
462 |
++ * implied by the test_and_clear_bit() in acm_submit_read_urb(). |
463 |
+ */ |
464 |
+ smp_mb__before_atomic(); |
465 |
++ set_bit(rb->index, &acm->read_urbs_free); |
466 |
++ /* |
467 |
++ * Make sure URB is marked as free before checking the throttled flag |
468 |
++ * to avoid racing with unthrottle() on another CPU. Matches the |
469 |
++ * smp_mb() in unthrottle(). |
470 |
++ */ |
471 |
++ smp_mb__after_atomic(); |
472 |
++ |
473 |
++ if (stopped || stalled) { |
474 |
++ if (stalled) |
475 |
++ schedule_work(&acm->work); |
476 |
++ return; |
477 |
++ } |
478 |
+ |
479 |
+ /* throttle device if requested by tty */ |
480 |
+ spin_lock_irqsave(&acm->read_lock, flags); |
481 |
+@@ -854,6 +869,9 @@ static void acm_tty_unthrottle(struct tty_struct *tty) |
482 |
+ acm->throttle_req = 0; |
483 |
+ spin_unlock_irq(&acm->read_lock); |
484 |
+ |
485 |
++ /* Matches the smp_mb__after_atomic() in acm_read_bulk_callback(). */ |
486 |
++ smp_mb(); |
487 |
++ |
488 |
+ if (was_throttled) |
489 |
+ acm_submit_read_urbs(acm, GFP_KERNEL); |
490 |
+ } |
491 |
+diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c |
492 |
+index 783d16a53466..945330ea8d5c 100644 |
493 |
+--- a/drivers/usb/dwc3/core.c |
494 |
++++ b/drivers/usb/dwc3/core.c |
495 |
+@@ -1042,7 +1042,7 @@ static void dwc3_get_properties(struct dwc3 *dwc) |
496 |
+ u8 hird_threshold; |
497 |
+ |
498 |
+ /* default to highest possible threshold */ |
499 |
+- lpm_nyet_threshold = 0xff; |
500 |
++ lpm_nyet_threshold = 0xf; |
501 |
+ |
502 |
+ /* default to -3.5dB de-emphasis */ |
503 |
+ tx_de_emphasis = 1; |
504 |
+diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c |
505 |
+index 972f5a5fe577..1f20fa0a67c0 100644 |
506 |
+--- a/drivers/usb/serial/f81232.c |
507 |
++++ b/drivers/usb/serial/f81232.c |
508 |
+@@ -560,9 +560,12 @@ static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port) |
509 |
+ |
510 |
+ static void f81232_close(struct usb_serial_port *port) |
511 |
+ { |
512 |
++ struct f81232_private *port_priv = usb_get_serial_port_data(port); |
513 |
++ |
514 |
+ f81232_port_disable(port); |
515 |
+ usb_serial_generic_close(port); |
516 |
+ usb_kill_urb(port->interrupt_in_urb); |
517 |
++ flush_work(&port_priv->interrupt_work); |
518 |
+ } |
519 |
+ |
520 |
+ static void f81232_dtr_rts(struct usb_serial_port *port, int on) |
521 |
+@@ -656,6 +659,40 @@ static int f81232_port_remove(struct usb_serial_port *port) |
522 |
+ return 0; |
523 |
+ } |
524 |
+ |
525 |
++static int f81232_suspend(struct usb_serial *serial, pm_message_t message) |
526 |
++{ |
527 |
++ struct usb_serial_port *port = serial->port[0]; |
528 |
++ struct f81232_private *port_priv = usb_get_serial_port_data(port); |
529 |
++ int i; |
530 |
++ |
531 |
++ for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) |
532 |
++ usb_kill_urb(port->read_urbs[i]); |
533 |
++ |
534 |
++ usb_kill_urb(port->interrupt_in_urb); |
535 |
++ |
536 |
++ if (port_priv) |
537 |
++ flush_work(&port_priv->interrupt_work); |
538 |
++ |
539 |
++ return 0; |
540 |
++} |
541 |
++ |
542 |
++static int f81232_resume(struct usb_serial *serial) |
543 |
++{ |
544 |
++ struct usb_serial_port *port = serial->port[0]; |
545 |
++ int result; |
546 |
++ |
547 |
++ if (tty_port_initialized(&port->port)) { |
548 |
++ result = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); |
549 |
++ if (result) { |
550 |
++ dev_err(&port->dev, "submit interrupt urb failed: %d\n", |
551 |
++ result); |
552 |
++ return result; |
553 |
++ } |
554 |
++ } |
555 |
++ |
556 |
++ return usb_serial_generic_resume(serial); |
557 |
++} |
558 |
++ |
559 |
+ static struct usb_serial_driver f81232_device = { |
560 |
+ .driver = { |
561 |
+ .owner = THIS_MODULE, |
562 |
+@@ -679,6 +716,8 @@ static struct usb_serial_driver f81232_device = { |
563 |
+ .read_int_callback = f81232_read_int_callback, |
564 |
+ .port_probe = f81232_port_probe, |
565 |
+ .port_remove = f81232_port_remove, |
566 |
++ .suspend = f81232_suspend, |
567 |
++ .resume = f81232_resume, |
568 |
+ }; |
569 |
+ |
570 |
+ static struct usb_serial_driver * const serial_drivers[] = { |
571 |
+diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c |
572 |
+index 13f2c051dbf2..afb4b0bf47b3 100644 |
573 |
+--- a/drivers/usb/storage/scsiglue.c |
574 |
++++ b/drivers/usb/storage/scsiglue.c |
575 |
+@@ -81,6 +81,7 @@ static const char* host_info(struct Scsi_Host *host) |
576 |
+ static int slave_alloc (struct scsi_device *sdev) |
577 |
+ { |
578 |
+ struct us_data *us = host_to_us(sdev->host); |
579 |
++ int maxp; |
580 |
+ |
581 |
+ /* |
582 |
+ * Set the INQUIRY transfer length to 36. We don't use any of |
583 |
+@@ -90,20 +91,17 @@ static int slave_alloc (struct scsi_device *sdev) |
584 |
+ sdev->inquiry_len = 36; |
585 |
+ |
586 |
+ /* |
587 |
+- * USB has unusual DMA-alignment requirements: Although the |
588 |
+- * starting address of each scatter-gather element doesn't matter, |
589 |
+- * the length of each element except the last must be divisible |
590 |
+- * by the Bulk maxpacket value. There's currently no way to |
591 |
+- * express this by block-layer constraints, so we'll cop out |
592 |
+- * and simply require addresses to be aligned at 512-byte |
593 |
+- * boundaries. This is okay since most block I/O involves |
594 |
+- * hardware sectors that are multiples of 512 bytes in length, |
595 |
+- * and since host controllers up through USB 2.0 have maxpacket |
596 |
+- * values no larger than 512. |
597 |
+- * |
598 |
+- * But it doesn't suffice for Wireless USB, where Bulk maxpacket |
599 |
+- * values can be as large as 2048. To make that work properly |
600 |
+- * will require changes to the block layer. |
601 |
++ * USB has unusual scatter-gather requirements: the length of each |
602 |
++ * scatterlist element except the last must be divisible by the |
603 |
++ * Bulk maxpacket value. Fortunately this value is always a |
604 |
++ * power of 2. Inform the block layer about this requirement. |
605 |
++ */ |
606 |
++ maxp = usb_maxpacket(us->pusb_dev, us->recv_bulk_pipe, 0); |
607 |
++ blk_queue_virt_boundary(sdev->request_queue, maxp - 1); |
608 |
++ |
609 |
++ /* |
610 |
++ * Some host controllers may have alignment requirements. |
611 |
++ * We'll play it safe by requiring 512-byte alignment always. |
612 |
+ */ |
613 |
+ blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); |
614 |
+ |
615 |
+diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c |
616 |
+index 24de9c00d8e2..21c8925a4116 100644 |
617 |
+--- a/drivers/usb/storage/uas.c |
618 |
++++ b/drivers/usb/storage/uas.c |
619 |
+@@ -796,24 +796,33 @@ static int uas_slave_alloc(struct scsi_device *sdev) |
620 |
+ { |
621 |
+ struct uas_dev_info *devinfo = |
622 |
+ (struct uas_dev_info *)sdev->host->hostdata; |
623 |
++ int maxp; |
624 |
+ |
625 |
+ sdev->hostdata = devinfo; |
626 |
+ |
627 |
+ /* |
628 |
+- * USB has unusual DMA-alignment requirements: Although the |
629 |
+- * starting address of each scatter-gather element doesn't matter, |
630 |
+- * the length of each element except the last must be divisible |
631 |
+- * by the Bulk maxpacket value. There's currently no way to |
632 |
+- * express this by block-layer constraints, so we'll cop out |
633 |
+- * and simply require addresses to be aligned at 512-byte |
634 |
+- * boundaries. This is okay since most block I/O involves |
635 |
+- * hardware sectors that are multiples of 512 bytes in length, |
636 |
+- * and since host controllers up through USB 2.0 have maxpacket |
637 |
+- * values no larger than 512. |
638 |
++ * We have two requirements here. We must satisfy the requirements |
639 |
++ * of the physical HC and the demands of the protocol, as we |
640 |
++ * definitely want no additional memory allocation in this path |
641 |
++ * ruling out using bounce buffers. |
642 |
+ * |
643 |
+- * But it doesn't suffice for Wireless USB, where Bulk maxpacket |
644 |
+- * values can be as large as 2048. To make that work properly |
645 |
+- * will require changes to the block layer. |
646 |
++ * For a transmission on USB to continue we must never send |
647 |
++ * a package that is smaller than maxpacket. Hence the length of each |
648 |
++ * scatterlist element except the last must be divisible by the |
649 |
++ * Bulk maxpacket value. |
650 |
++ * If the HC does not ensure that through SG, |
651 |
++ * the upper layer must do that. We must assume nothing |
652 |
++ * about the capabilities off the HC, so we use the most |
653 |
++ * pessimistic requirement. |
654 |
++ */ |
655 |
++ |
656 |
++ maxp = usb_maxpacket(devinfo->udev, devinfo->data_in_pipe, 0); |
657 |
++ blk_queue_virt_boundary(sdev->request_queue, maxp - 1); |
658 |
++ |
659 |
++ /* |
660 |
++ * The protocol has no requirements on alignment in the strict sense. |
661 |
++ * Controllers may or may not have alignment restrictions. |
662 |
++ * As this is not exported, we use an extremely conservative guess. |
663 |
+ */ |
664 |
+ blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); |
665 |
+ |
666 |
+diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c |
667 |
+index 1c4797e53f68..80a3704939cd 100644 |
668 |
+--- a/drivers/virtio/virtio_pci_common.c |
669 |
++++ b/drivers/virtio/virtio_pci_common.c |
670 |
+@@ -254,9 +254,11 @@ void vp_del_vqs(struct virtio_device *vdev) |
671 |
+ for (i = 0; i < vp_dev->msix_used_vectors; ++i) |
672 |
+ free_irq(pci_irq_vector(vp_dev->pci_dev, i), vp_dev); |
673 |
+ |
674 |
+- for (i = 0; i < vp_dev->msix_vectors; i++) |
675 |
+- if (vp_dev->msix_affinity_masks[i]) |
676 |
+- free_cpumask_var(vp_dev->msix_affinity_masks[i]); |
677 |
++ if (vp_dev->msix_affinity_masks) { |
678 |
++ for (i = 0; i < vp_dev->msix_vectors; i++) |
679 |
++ if (vp_dev->msix_affinity_masks[i]) |
680 |
++ free_cpumask_var(vp_dev->msix_affinity_masks[i]); |
681 |
++ } |
682 |
+ |
683 |
+ if (vp_dev->msix_enabled) { |
684 |
+ /* Disable the vector used for configuration */ |
685 |
+diff --git a/include/linux/kernel.h b/include/linux/kernel.h |
686 |
+index 4b484ab9e163..1c5469adaa85 100644 |
687 |
+--- a/include/linux/kernel.h |
688 |
++++ b/include/linux/kernel.h |
689 |
+@@ -72,8 +72,8 @@ |
690 |
+ |
691 |
+ #define u64_to_user_ptr(x) ( \ |
692 |
+ { \ |
693 |
+- typecheck(u64, x); \ |
694 |
+- (void __user *)(uintptr_t)x; \ |
695 |
++ typecheck(u64, (x)); \ |
696 |
++ (void __user *)(uintptr_t)(x); \ |
697 |
+ } \ |
698 |
+ ) |
699 |
+ |
700 |
+diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h |
701 |
+index b619a190ff12..6cd4d5b48239 100644 |
702 |
+--- a/include/net/bluetooth/hci_core.h |
703 |
++++ b/include/net/bluetooth/hci_core.h |
704 |
+@@ -178,6 +178,9 @@ struct adv_info { |
705 |
+ |
706 |
+ #define HCI_MAX_SHORT_NAME_LENGTH 10 |
707 |
+ |
708 |
++/* Min encryption key size to match with SMP */ |
709 |
++#define HCI_MIN_ENC_KEY_SIZE 7 |
710 |
++ |
711 |
+ /* Default LE RPA expiry time, 15 minutes */ |
712 |
+ #define HCI_DEFAULT_RPA_TIMEOUT (15 * 60) |
713 |
+ |
714 |
+diff --git a/kernel/futex.c b/kernel/futex.c |
715 |
+index f2fa48c6c476..afe6a81584c9 100644 |
716 |
+--- a/kernel/futex.c |
717 |
++++ b/kernel/futex.c |
718 |
+@@ -1324,13 +1324,15 @@ static int lookup_pi_state(u32 __user *uaddr, u32 uval, |
719 |
+ |
720 |
+ static int lock_pi_update_atomic(u32 __user *uaddr, u32 uval, u32 newval) |
721 |
+ { |
722 |
++ int err; |
723 |
+ u32 uninitialized_var(curval); |
724 |
+ |
725 |
+ if (unlikely(should_fail_futex(true))) |
726 |
+ return -EFAULT; |
727 |
+ |
728 |
+- if (unlikely(cmpxchg_futex_value_locked(&curval, uaddr, uval, newval))) |
729 |
+- return -EFAULT; |
730 |
++ err = cmpxchg_futex_value_locked(&curval, uaddr, uval, newval); |
731 |
++ if (unlikely(err)) |
732 |
++ return err; |
733 |
+ |
734 |
+ /* If user space value changed, let the caller retry */ |
735 |
+ return curval != uval ? -EAGAIN : 0; |
736 |
+@@ -1516,10 +1518,8 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_pi_state *pi_ |
737 |
+ if (unlikely(should_fail_futex(true))) |
738 |
+ ret = -EFAULT; |
739 |
+ |
740 |
+- if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval)) { |
741 |
+- ret = -EFAULT; |
742 |
+- |
743 |
+- } else if (curval != uval) { |
744 |
++ ret = cmpxchg_futex_value_locked(&curval, uaddr, uval, newval); |
745 |
++ if (!ret && (curval != uval)) { |
746 |
+ /* |
747 |
+ * If a unconditional UNLOCK_PI operation (user space did not |
748 |
+ * try the TID->0 transition) raced with a waiter setting the |
749 |
+@@ -1714,32 +1714,32 @@ retry_private: |
750 |
+ double_lock_hb(hb1, hb2); |
751 |
+ op_ret = futex_atomic_op_inuser(op, uaddr2); |
752 |
+ if (unlikely(op_ret < 0)) { |
753 |
+- |
754 |
+ double_unlock_hb(hb1, hb2); |
755 |
+ |
756 |
+-#ifndef CONFIG_MMU |
757 |
+- /* |
758 |
+- * we don't get EFAULT from MMU faults if we don't have an MMU, |
759 |
+- * but we might get them from range checking |
760 |
+- */ |
761 |
+- ret = op_ret; |
762 |
+- goto out_put_keys; |
763 |
+-#endif |
764 |
+- |
765 |
+- if (unlikely(op_ret != -EFAULT)) { |
766 |
++ if (!IS_ENABLED(CONFIG_MMU) || |
767 |
++ unlikely(op_ret != -EFAULT && op_ret != -EAGAIN)) { |
768 |
++ /* |
769 |
++ * we don't get EFAULT from MMU faults if we don't have |
770 |
++ * an MMU, but we might get them from range checking |
771 |
++ */ |
772 |
+ ret = op_ret; |
773 |
+ goto out_put_keys; |
774 |
+ } |
775 |
+ |
776 |
+- ret = fault_in_user_writeable(uaddr2); |
777 |
+- if (ret) |
778 |
+- goto out_put_keys; |
779 |
++ if (op_ret == -EFAULT) { |
780 |
++ ret = fault_in_user_writeable(uaddr2); |
781 |
++ if (ret) |
782 |
++ goto out_put_keys; |
783 |
++ } |
784 |
+ |
785 |
+- if (!(flags & FLAGS_SHARED)) |
786 |
++ if (!(flags & FLAGS_SHARED)) { |
787 |
++ cond_resched(); |
788 |
+ goto retry_private; |
789 |
++ } |
790 |
+ |
791 |
+ put_futex_key(&key2); |
792 |
+ put_futex_key(&key1); |
793 |
++ cond_resched(); |
794 |
+ goto retry; |
795 |
+ } |
796 |
+ |
797 |
+@@ -2364,7 +2364,7 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, |
798 |
+ u32 uval, uninitialized_var(curval), newval; |
799 |
+ struct task_struct *oldowner, *newowner; |
800 |
+ u32 newtid; |
801 |
+- int ret; |
802 |
++ int ret, err = 0; |
803 |
+ |
804 |
+ lockdep_assert_held(q->lock_ptr); |
805 |
+ |
806 |
+@@ -2435,14 +2435,17 @@ retry: |
807 |
+ if (!pi_state->owner) |
808 |
+ newtid |= FUTEX_OWNER_DIED; |
809 |
+ |
810 |
+- if (get_futex_value_locked(&uval, uaddr)) |
811 |
+- goto handle_fault; |
812 |
++ err = get_futex_value_locked(&uval, uaddr); |
813 |
++ if (err) |
814 |
++ goto handle_err; |
815 |
+ |
816 |
+ for (;;) { |
817 |
+ newval = (uval & FUTEX_OWNER_DIED) | newtid; |
818 |
+ |
819 |
+- if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval)) |
820 |
+- goto handle_fault; |
821 |
++ err = cmpxchg_futex_value_locked(&curval, uaddr, uval, newval); |
822 |
++ if (err) |
823 |
++ goto handle_err; |
824 |
++ |
825 |
+ if (curval == uval) |
826 |
+ break; |
827 |
+ uval = curval; |
828 |
+@@ -2470,23 +2473,37 @@ retry: |
829 |
+ return 0; |
830 |
+ |
831 |
+ /* |
832 |
+- * To handle the page fault we need to drop the locks here. That gives |
833 |
+- * the other task (either the highest priority waiter itself or the |
834 |
+- * task which stole the rtmutex) the chance to try the fixup of the |
835 |
+- * pi_state. So once we are back from handling the fault we need to |
836 |
+- * check the pi_state after reacquiring the locks and before trying to |
837 |
+- * do another fixup. When the fixup has been done already we simply |
838 |
+- * return. |
839 |
++ * In order to reschedule or handle a page fault, we need to drop the |
840 |
++ * locks here. In the case of a fault, this gives the other task |
841 |
++ * (either the highest priority waiter itself or the task which stole |
842 |
++ * the rtmutex) the chance to try the fixup of the pi_state. So once we |
843 |
++ * are back from handling the fault we need to check the pi_state after |
844 |
++ * reacquiring the locks and before trying to do another fixup. When |
845 |
++ * the fixup has been done already we simply return. |
846 |
+ * |
847 |
+ * Note: we hold both hb->lock and pi_mutex->wait_lock. We can safely |
848 |
+ * drop hb->lock since the caller owns the hb -> futex_q relation. |
849 |
+ * Dropping the pi_mutex->wait_lock requires the state revalidate. |
850 |
+ */ |
851 |
+-handle_fault: |
852 |
++handle_err: |
853 |
+ raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); |
854 |
+ spin_unlock(q->lock_ptr); |
855 |
+ |
856 |
+- ret = fault_in_user_writeable(uaddr); |
857 |
++ switch (err) { |
858 |
++ case -EFAULT: |
859 |
++ ret = fault_in_user_writeable(uaddr); |
860 |
++ break; |
861 |
++ |
862 |
++ case -EAGAIN: |
863 |
++ cond_resched(); |
864 |
++ ret = 0; |
865 |
++ break; |
866 |
++ |
867 |
++ default: |
868 |
++ WARN_ON_ONCE(1); |
869 |
++ ret = err; |
870 |
++ break; |
871 |
++ } |
872 |
+ |
873 |
+ spin_lock(q->lock_ptr); |
874 |
+ raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); |
875 |
+@@ -3055,10 +3072,8 @@ retry: |
876 |
+ * A unconditional UNLOCK_PI op raced against a waiter |
877 |
+ * setting the FUTEX_WAITERS bit. Try again. |
878 |
+ */ |
879 |
+- if (ret == -EAGAIN) { |
880 |
+- put_futex_key(&key); |
881 |
+- goto retry; |
882 |
+- } |
883 |
++ if (ret == -EAGAIN) |
884 |
++ goto pi_retry; |
885 |
+ /* |
886 |
+ * wake_futex_pi has detected invalid state. Tell user |
887 |
+ * space. |
888 |
+@@ -3073,9 +3088,19 @@ retry: |
889 |
+ * preserve the WAITERS bit not the OWNER_DIED one. We are the |
890 |
+ * owner. |
891 |
+ */ |
892 |
+- if (cmpxchg_futex_value_locked(&curval, uaddr, uval, 0)) { |
893 |
++ if ((ret = cmpxchg_futex_value_locked(&curval, uaddr, uval, 0))) { |
894 |
+ spin_unlock(&hb->lock); |
895 |
+- goto pi_faulted; |
896 |
++ switch (ret) { |
897 |
++ case -EFAULT: |
898 |
++ goto pi_faulted; |
899 |
++ |
900 |
++ case -EAGAIN: |
901 |
++ goto pi_retry; |
902 |
++ |
903 |
++ default: |
904 |
++ WARN_ON_ONCE(1); |
905 |
++ goto out_putkey; |
906 |
++ } |
907 |
+ } |
908 |
+ |
909 |
+ /* |
910 |
+@@ -3089,6 +3114,11 @@ out_putkey: |
911 |
+ put_futex_key(&key); |
912 |
+ return ret; |
913 |
+ |
914 |
++pi_retry: |
915 |
++ put_futex_key(&key); |
916 |
++ cond_resched(); |
917 |
++ goto retry; |
918 |
++ |
919 |
+ pi_faulted: |
920 |
+ put_futex_key(&key); |
921 |
+ |
922 |
+@@ -3449,6 +3479,7 @@ err_unlock: |
923 |
+ int handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi) |
924 |
+ { |
925 |
+ u32 uval, uninitialized_var(nval), mval; |
926 |
++ int err; |
927 |
+ |
928 |
+ /* Futex address must be 32bit aligned */ |
929 |
+ if ((((unsigned long)uaddr) % sizeof(*uaddr)) != 0) |
930 |
+@@ -3458,42 +3489,57 @@ retry: |
931 |
+ if (get_user(uval, uaddr)) |
932 |
+ return -1; |
933 |
+ |
934 |
+- if ((uval & FUTEX_TID_MASK) == task_pid_vnr(curr)) { |
935 |
+- /* |
936 |
+- * Ok, this dying thread is truly holding a futex |
937 |
+- * of interest. Set the OWNER_DIED bit atomically |
938 |
+- * via cmpxchg, and if the value had FUTEX_WAITERS |
939 |
+- * set, wake up a waiter (if any). (We have to do a |
940 |
+- * futex_wake() even if OWNER_DIED is already set - |
941 |
+- * to handle the rare but possible case of recursive |
942 |
+- * thread-death.) The rest of the cleanup is done in |
943 |
+- * userspace. |
944 |
+- */ |
945 |
+- mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED; |
946 |
+- /* |
947 |
+- * We are not holding a lock here, but we want to have |
948 |
+- * the pagefault_disable/enable() protection because |
949 |
+- * we want to handle the fault gracefully. If the |
950 |
+- * access fails we try to fault in the futex with R/W |
951 |
+- * verification via get_user_pages. get_user() above |
952 |
+- * does not guarantee R/W access. If that fails we |
953 |
+- * give up and leave the futex locked. |
954 |
+- */ |
955 |
+- if (cmpxchg_futex_value_locked(&nval, uaddr, uval, mval)) { |
956 |
++ if ((uval & FUTEX_TID_MASK) != task_pid_vnr(curr)) |
957 |
++ return 0; |
958 |
++ |
959 |
++ /* |
960 |
++ * Ok, this dying thread is truly holding a futex |
961 |
++ * of interest. Set the OWNER_DIED bit atomically |
962 |
++ * via cmpxchg, and if the value had FUTEX_WAITERS |
963 |
++ * set, wake up a waiter (if any). (We have to do a |
964 |
++ * futex_wake() even if OWNER_DIED is already set - |
965 |
++ * to handle the rare but possible case of recursive |
966 |
++ * thread-death.) The rest of the cleanup is done in |
967 |
++ * userspace. |
968 |
++ */ |
969 |
++ mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED; |
970 |
++ |
971 |
++ /* |
972 |
++ * We are not holding a lock here, but we want to have |
973 |
++ * the pagefault_disable/enable() protection because |
974 |
++ * we want to handle the fault gracefully. If the |
975 |
++ * access fails we try to fault in the futex with R/W |
976 |
++ * verification via get_user_pages. get_user() above |
977 |
++ * does not guarantee R/W access. If that fails we |
978 |
++ * give up and leave the futex locked. |
979 |
++ */ |
980 |
++ if ((err = cmpxchg_futex_value_locked(&nval, uaddr, uval, mval))) { |
981 |
++ switch (err) { |
982 |
++ case -EFAULT: |
983 |
+ if (fault_in_user_writeable(uaddr)) |
984 |
+ return -1; |
985 |
+ goto retry; |
986 |
+- } |
987 |
+- if (nval != uval) |
988 |
++ |
989 |
++ case -EAGAIN: |
990 |
++ cond_resched(); |
991 |
+ goto retry; |
992 |
+ |
993 |
+- /* |
994 |
+- * Wake robust non-PI futexes here. The wakeup of |
995 |
+- * PI futexes happens in exit_pi_state(): |
996 |
+- */ |
997 |
+- if (!pi && (uval & FUTEX_WAITERS)) |
998 |
+- futex_wake(uaddr, 1, 1, FUTEX_BITSET_MATCH_ANY); |
999 |
++ default: |
1000 |
++ WARN_ON_ONCE(1); |
1001 |
++ return err; |
1002 |
++ } |
1003 |
+ } |
1004 |
++ |
1005 |
++ if (nval != uval) |
1006 |
++ goto retry; |
1007 |
++ |
1008 |
++ /* |
1009 |
++ * Wake robust non-PI futexes here. The wakeup of |
1010 |
++ * PI futexes happens in exit_pi_state(): |
1011 |
++ */ |
1012 |
++ if (!pi && (uval & FUTEX_WAITERS)) |
1013 |
++ futex_wake(uaddr, 1, 1, FUTEX_BITSET_MATCH_ANY); |
1014 |
++ |
1015 |
+ return 0; |
1016 |
+ } |
1017 |
+ |
1018 |
+diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c |
1019 |
+index 6c877d28838f..9c86a3e45110 100644 |
1020 |
+--- a/kernel/irq/manage.c |
1021 |
++++ b/kernel/irq/manage.c |
1022 |
+@@ -323,8 +323,10 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify) |
1023 |
+ desc->affinity_notify = notify; |
1024 |
+ raw_spin_unlock_irqrestore(&desc->lock, flags); |
1025 |
+ |
1026 |
+- if (old_notify) |
1027 |
++ if (old_notify) { |
1028 |
++ cancel_work_sync(&old_notify->work); |
1029 |
+ kref_put(&old_notify->kref, old_notify->release); |
1030 |
++ } |
1031 |
+ |
1032 |
+ return 0; |
1033 |
+ } |
1034 |
+diff --git a/lib/ubsan.c b/lib/ubsan.c |
1035 |
+index 60e108c5c173..c652b4a820cc 100644 |
1036 |
+--- a/lib/ubsan.c |
1037 |
++++ b/lib/ubsan.c |
1038 |
+@@ -86,11 +86,13 @@ static bool is_inline_int(struct type_descriptor *type) |
1039 |
+ return bits <= inline_bits; |
1040 |
+ } |
1041 |
+ |
1042 |
+-static s_max get_signed_val(struct type_descriptor *type, unsigned long val) |
1043 |
++static s_max get_signed_val(struct type_descriptor *type, void *val) |
1044 |
+ { |
1045 |
+ if (is_inline_int(type)) { |
1046 |
+ unsigned extra_bits = sizeof(s_max)*8 - type_bit_width(type); |
1047 |
+- return ((s_max)val) << extra_bits >> extra_bits; |
1048 |
++ unsigned long ulong_val = (unsigned long)val; |
1049 |
++ |
1050 |
++ return ((s_max)ulong_val) << extra_bits >> extra_bits; |
1051 |
+ } |
1052 |
+ |
1053 |
+ if (type_bit_width(type) == 64) |
1054 |
+@@ -99,15 +101,15 @@ static s_max get_signed_val(struct type_descriptor *type, unsigned long val) |
1055 |
+ return *(s_max *)val; |
1056 |
+ } |
1057 |
+ |
1058 |
+-static bool val_is_negative(struct type_descriptor *type, unsigned long val) |
1059 |
++static bool val_is_negative(struct type_descriptor *type, void *val) |
1060 |
+ { |
1061 |
+ return type_is_signed(type) && get_signed_val(type, val) < 0; |
1062 |
+ } |
1063 |
+ |
1064 |
+-static u_max get_unsigned_val(struct type_descriptor *type, unsigned long val) |
1065 |
++static u_max get_unsigned_val(struct type_descriptor *type, void *val) |
1066 |
+ { |
1067 |
+ if (is_inline_int(type)) |
1068 |
+- return val; |
1069 |
++ return (unsigned long)val; |
1070 |
+ |
1071 |
+ if (type_bit_width(type) == 64) |
1072 |
+ return *(u64 *)val; |
1073 |
+@@ -116,7 +118,7 @@ static u_max get_unsigned_val(struct type_descriptor *type, unsigned long val) |
1074 |
+ } |
1075 |
+ |
1076 |
+ static void val_to_string(char *str, size_t size, struct type_descriptor *type, |
1077 |
+- unsigned long value) |
1078 |
++ void *value) |
1079 |
+ { |
1080 |
+ if (type_is_int(type)) { |
1081 |
+ if (type_bit_width(type) == 128) { |
1082 |
+@@ -168,8 +170,8 @@ static void ubsan_epilogue(unsigned long *flags) |
1083 |
+ current->in_ubsan--; |
1084 |
+ } |
1085 |
+ |
1086 |
+-static void handle_overflow(struct overflow_data *data, unsigned long lhs, |
1087 |
+- unsigned long rhs, char op) |
1088 |
++static void handle_overflow(struct overflow_data *data, void *lhs, |
1089 |
++ void *rhs, char op) |
1090 |
+ { |
1091 |
+ |
1092 |
+ struct type_descriptor *type = data->type; |
1093 |
+@@ -196,8 +198,7 @@ static void handle_overflow(struct overflow_data *data, unsigned long lhs, |
1094 |
+ } |
1095 |
+ |
1096 |
+ void __ubsan_handle_add_overflow(struct overflow_data *data, |
1097 |
+- unsigned long lhs, |
1098 |
+- unsigned long rhs) |
1099 |
++ void *lhs, void *rhs) |
1100 |
+ { |
1101 |
+ |
1102 |
+ handle_overflow(data, lhs, rhs, '+'); |
1103 |
+@@ -205,23 +206,21 @@ void __ubsan_handle_add_overflow(struct overflow_data *data, |
1104 |
+ EXPORT_SYMBOL(__ubsan_handle_add_overflow); |
1105 |
+ |
1106 |
+ void __ubsan_handle_sub_overflow(struct overflow_data *data, |
1107 |
+- unsigned long lhs, |
1108 |
+- unsigned long rhs) |
1109 |
++ void *lhs, void *rhs) |
1110 |
+ { |
1111 |
+ handle_overflow(data, lhs, rhs, '-'); |
1112 |
+ } |
1113 |
+ EXPORT_SYMBOL(__ubsan_handle_sub_overflow); |
1114 |
+ |
1115 |
+ void __ubsan_handle_mul_overflow(struct overflow_data *data, |
1116 |
+- unsigned long lhs, |
1117 |
+- unsigned long rhs) |
1118 |
++ void *lhs, void *rhs) |
1119 |
+ { |
1120 |
+ handle_overflow(data, lhs, rhs, '*'); |
1121 |
+ } |
1122 |
+ EXPORT_SYMBOL(__ubsan_handle_mul_overflow); |
1123 |
+ |
1124 |
+ void __ubsan_handle_negate_overflow(struct overflow_data *data, |
1125 |
+- unsigned long old_val) |
1126 |
++ void *old_val) |
1127 |
+ { |
1128 |
+ unsigned long flags; |
1129 |
+ char old_val_str[VALUE_LENGTH]; |
1130 |
+@@ -242,8 +241,7 @@ EXPORT_SYMBOL(__ubsan_handle_negate_overflow); |
1131 |
+ |
1132 |
+ |
1133 |
+ void __ubsan_handle_divrem_overflow(struct overflow_data *data, |
1134 |
+- unsigned long lhs, |
1135 |
+- unsigned long rhs) |
1136 |
++ void *lhs, void *rhs) |
1137 |
+ { |
1138 |
+ unsigned long flags; |
1139 |
+ char rhs_val_str[VALUE_LENGTH]; |
1140 |
+@@ -328,7 +326,7 @@ static void ubsan_type_mismatch_common(struct type_mismatch_data_common *data, |
1141 |
+ } |
1142 |
+ |
1143 |
+ void __ubsan_handle_type_mismatch(struct type_mismatch_data *data, |
1144 |
+- unsigned long ptr) |
1145 |
++ void *ptr) |
1146 |
+ { |
1147 |
+ struct type_mismatch_data_common common_data = { |
1148 |
+ .location = &data->location, |
1149 |
+@@ -337,12 +335,12 @@ void __ubsan_handle_type_mismatch(struct type_mismatch_data *data, |
1150 |
+ .type_check_kind = data->type_check_kind |
1151 |
+ }; |
1152 |
+ |
1153 |
+- ubsan_type_mismatch_common(&common_data, ptr); |
1154 |
++ ubsan_type_mismatch_common(&common_data, (unsigned long)ptr); |
1155 |
+ } |
1156 |
+ EXPORT_SYMBOL(__ubsan_handle_type_mismatch); |
1157 |
+ |
1158 |
+ void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data, |
1159 |
+- unsigned long ptr) |
1160 |
++ void *ptr) |
1161 |
+ { |
1162 |
+ |
1163 |
+ struct type_mismatch_data_common common_data = { |
1164 |
+@@ -352,7 +350,7 @@ void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data, |
1165 |
+ .type_check_kind = data->type_check_kind |
1166 |
+ }; |
1167 |
+ |
1168 |
+- ubsan_type_mismatch_common(&common_data, ptr); |
1169 |
++ ubsan_type_mismatch_common(&common_data, (unsigned long)ptr); |
1170 |
+ } |
1171 |
+ EXPORT_SYMBOL(__ubsan_handle_type_mismatch_v1); |
1172 |
+ |
1173 |
+@@ -376,7 +374,7 @@ void __ubsan_handle_nonnull_return(struct nonnull_return_data *data) |
1174 |
+ EXPORT_SYMBOL(__ubsan_handle_nonnull_return); |
1175 |
+ |
1176 |
+ void __ubsan_handle_vla_bound_not_positive(struct vla_bound_data *data, |
1177 |
+- unsigned long bound) |
1178 |
++ void *bound) |
1179 |
+ { |
1180 |
+ unsigned long flags; |
1181 |
+ char bound_str[VALUE_LENGTH]; |
1182 |
+@@ -393,8 +391,7 @@ void __ubsan_handle_vla_bound_not_positive(struct vla_bound_data *data, |
1183 |
+ } |
1184 |
+ EXPORT_SYMBOL(__ubsan_handle_vla_bound_not_positive); |
1185 |
+ |
1186 |
+-void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data, |
1187 |
+- unsigned long index) |
1188 |
++void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data, void *index) |
1189 |
+ { |
1190 |
+ unsigned long flags; |
1191 |
+ char index_str[VALUE_LENGTH]; |
1192 |
+@@ -412,7 +409,7 @@ void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data, |
1193 |
+ EXPORT_SYMBOL(__ubsan_handle_out_of_bounds); |
1194 |
+ |
1195 |
+ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, |
1196 |
+- unsigned long lhs, unsigned long rhs) |
1197 |
++ void *lhs, void *rhs) |
1198 |
+ { |
1199 |
+ unsigned long flags; |
1200 |
+ struct type_descriptor *rhs_type = data->rhs_type; |
1201 |
+@@ -463,7 +460,7 @@ void __ubsan_handle_builtin_unreachable(struct unreachable_data *data) |
1202 |
+ EXPORT_SYMBOL(__ubsan_handle_builtin_unreachable); |
1203 |
+ |
1204 |
+ void __ubsan_handle_load_invalid_value(struct invalid_value_data *data, |
1205 |
+- unsigned long val) |
1206 |
++ void *val) |
1207 |
+ { |
1208 |
+ unsigned long flags; |
1209 |
+ char val_str[VALUE_LENGTH]; |
1210 |
+diff --git a/mm/slab.c b/mm/slab.c |
1211 |
+index f4658468b23e..843ecea9e336 100644 |
1212 |
+--- a/mm/slab.c |
1213 |
++++ b/mm/slab.c |
1214 |
+@@ -4299,7 +4299,8 @@ static void show_symbol(struct seq_file *m, unsigned long address) |
1215 |
+ |
1216 |
+ static int leaks_show(struct seq_file *m, void *p) |
1217 |
+ { |
1218 |
+- struct kmem_cache *cachep = list_entry(p, struct kmem_cache, list); |
1219 |
++ struct kmem_cache *cachep = list_entry(p, struct kmem_cache, |
1220 |
++ root_caches_node); |
1221 |
+ struct page *page; |
1222 |
+ struct kmem_cache_node *n; |
1223 |
+ const char *name; |
1224 |
+diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c |
1225 |
+index cc061495f653..fe4fb0c1fa61 100644 |
1226 |
+--- a/net/bluetooth/hci_conn.c |
1227 |
++++ b/net/bluetooth/hci_conn.c |
1228 |
+@@ -1165,6 +1165,14 @@ int hci_conn_check_link_mode(struct hci_conn *conn) |
1229 |
+ !test_bit(HCI_CONN_ENCRYPT, &conn->flags)) |
1230 |
+ return 0; |
1231 |
+ |
1232 |
++ /* The minimum encryption key size needs to be enforced by the |
1233 |
++ * host stack before establishing any L2CAP connections. The |
1234 |
++ * specification in theory allows a minimum of 1, but to align |
1235 |
++ * BR/EDR and LE transports, a minimum of 7 is chosen. |
1236 |
++ */ |
1237 |
++ if (conn->enc_key_size < HCI_MIN_ENC_KEY_SIZE) |
1238 |
++ return 0; |
1239 |
++ |
1240 |
+ return 1; |
1241 |
+ } |
1242 |
+ |
1243 |
+diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c |
1244 |
+index 008ba439bd62..cc80c76177b6 100644 |
1245 |
+--- a/net/bluetooth/hidp/sock.c |
1246 |
++++ b/net/bluetooth/hidp/sock.c |
1247 |
+@@ -76,6 +76,7 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long |
1248 |
+ sockfd_put(csock); |
1249 |
+ return err; |
1250 |
+ } |
1251 |
++ ca.name[sizeof(ca.name)-1] = 0; |
1252 |
+ |
1253 |
+ err = hidp_connection_add(&ca, csock, isock); |
1254 |
+ if (!err && copy_to_user(argp, &ca, sizeof(ca))) |
1255 |
+diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c |
1256 |
+index 84f86745c30e..828bc615a190 100644 |
1257 |
+--- a/sound/soc/codecs/cs4270.c |
1258 |
++++ b/sound/soc/codecs/cs4270.c |
1259 |
+@@ -643,6 +643,7 @@ static const struct regmap_config cs4270_regmap = { |
1260 |
+ .reg_defaults = cs4270_reg_defaults, |
1261 |
+ .num_reg_defaults = ARRAY_SIZE(cs4270_reg_defaults), |
1262 |
+ .cache_type = REGCACHE_RBTREE, |
1263 |
++ .write_flag_mask = CS4270_I2C_INCR, |
1264 |
+ |
1265 |
+ .readable_reg = cs4270_reg_is_readable, |
1266 |
+ .volatile_reg = cs4270_reg_is_volatile, |
1267 |
+diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c |
1268 |
+index cf3b905b4ead..7406695ee5dc 100644 |
1269 |
+--- a/sound/soc/codecs/hdmi-codec.c |
1270 |
++++ b/sound/soc/codecs/hdmi-codec.c |
1271 |
+@@ -536,73 +536,71 @@ static int hdmi_codec_set_fmt(struct snd_soc_dai *dai, |
1272 |
+ { |
1273 |
+ struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); |
1274 |
+ struct hdmi_codec_daifmt cf = { 0 }; |
1275 |
+- int ret = 0; |
1276 |
+ |
1277 |
+ dev_dbg(dai->dev, "%s()\n", __func__); |
1278 |
+ |
1279 |
+- if (dai->id == DAI_ID_SPDIF) { |
1280 |
+- cf.fmt = HDMI_SPDIF; |
1281 |
+- } else { |
1282 |
+- switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
1283 |
+- case SND_SOC_DAIFMT_CBM_CFM: |
1284 |
+- cf.bit_clk_master = 1; |
1285 |
+- cf.frame_clk_master = 1; |
1286 |
+- break; |
1287 |
+- case SND_SOC_DAIFMT_CBS_CFM: |
1288 |
+- cf.frame_clk_master = 1; |
1289 |
+- break; |
1290 |
+- case SND_SOC_DAIFMT_CBM_CFS: |
1291 |
+- cf.bit_clk_master = 1; |
1292 |
+- break; |
1293 |
+- case SND_SOC_DAIFMT_CBS_CFS: |
1294 |
+- break; |
1295 |
+- default: |
1296 |
+- return -EINVAL; |
1297 |
+- } |
1298 |
++ if (dai->id == DAI_ID_SPDIF) |
1299 |
++ return 0; |
1300 |
++ |
1301 |
++ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
1302 |
++ case SND_SOC_DAIFMT_CBM_CFM: |
1303 |
++ cf.bit_clk_master = 1; |
1304 |
++ cf.frame_clk_master = 1; |
1305 |
++ break; |
1306 |
++ case SND_SOC_DAIFMT_CBS_CFM: |
1307 |
++ cf.frame_clk_master = 1; |
1308 |
++ break; |
1309 |
++ case SND_SOC_DAIFMT_CBM_CFS: |
1310 |
++ cf.bit_clk_master = 1; |
1311 |
++ break; |
1312 |
++ case SND_SOC_DAIFMT_CBS_CFS: |
1313 |
++ break; |
1314 |
++ default: |
1315 |
++ return -EINVAL; |
1316 |
++ } |
1317 |
+ |
1318 |
+- switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
1319 |
+- case SND_SOC_DAIFMT_NB_NF: |
1320 |
+- break; |
1321 |
+- case SND_SOC_DAIFMT_NB_IF: |
1322 |
+- cf.frame_clk_inv = 1; |
1323 |
+- break; |
1324 |
+- case SND_SOC_DAIFMT_IB_NF: |
1325 |
+- cf.bit_clk_inv = 1; |
1326 |
+- break; |
1327 |
+- case SND_SOC_DAIFMT_IB_IF: |
1328 |
+- cf.frame_clk_inv = 1; |
1329 |
+- cf.bit_clk_inv = 1; |
1330 |
+- break; |
1331 |
+- } |
1332 |
++ switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
1333 |
++ case SND_SOC_DAIFMT_NB_NF: |
1334 |
++ break; |
1335 |
++ case SND_SOC_DAIFMT_NB_IF: |
1336 |
++ cf.frame_clk_inv = 1; |
1337 |
++ break; |
1338 |
++ case SND_SOC_DAIFMT_IB_NF: |
1339 |
++ cf.bit_clk_inv = 1; |
1340 |
++ break; |
1341 |
++ case SND_SOC_DAIFMT_IB_IF: |
1342 |
++ cf.frame_clk_inv = 1; |
1343 |
++ cf.bit_clk_inv = 1; |
1344 |
++ break; |
1345 |
++ } |
1346 |
+ |
1347 |
+- switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
1348 |
+- case SND_SOC_DAIFMT_I2S: |
1349 |
+- cf.fmt = HDMI_I2S; |
1350 |
+- break; |
1351 |
+- case SND_SOC_DAIFMT_DSP_A: |
1352 |
+- cf.fmt = HDMI_DSP_A; |
1353 |
+- break; |
1354 |
+- case SND_SOC_DAIFMT_DSP_B: |
1355 |
+- cf.fmt = HDMI_DSP_B; |
1356 |
+- break; |
1357 |
+- case SND_SOC_DAIFMT_RIGHT_J: |
1358 |
+- cf.fmt = HDMI_RIGHT_J; |
1359 |
+- break; |
1360 |
+- case SND_SOC_DAIFMT_LEFT_J: |
1361 |
+- cf.fmt = HDMI_LEFT_J; |
1362 |
+- break; |
1363 |
+- case SND_SOC_DAIFMT_AC97: |
1364 |
+- cf.fmt = HDMI_AC97; |
1365 |
+- break; |
1366 |
+- default: |
1367 |
+- dev_err(dai->dev, "Invalid DAI interface format\n"); |
1368 |
+- return -EINVAL; |
1369 |
+- } |
1370 |
++ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
1371 |
++ case SND_SOC_DAIFMT_I2S: |
1372 |
++ cf.fmt = HDMI_I2S; |
1373 |
++ break; |
1374 |
++ case SND_SOC_DAIFMT_DSP_A: |
1375 |
++ cf.fmt = HDMI_DSP_A; |
1376 |
++ break; |
1377 |
++ case SND_SOC_DAIFMT_DSP_B: |
1378 |
++ cf.fmt = HDMI_DSP_B; |
1379 |
++ break; |
1380 |
++ case SND_SOC_DAIFMT_RIGHT_J: |
1381 |
++ cf.fmt = HDMI_RIGHT_J; |
1382 |
++ break; |
1383 |
++ case SND_SOC_DAIFMT_LEFT_J: |
1384 |
++ cf.fmt = HDMI_LEFT_J; |
1385 |
++ break; |
1386 |
++ case SND_SOC_DAIFMT_AC97: |
1387 |
++ cf.fmt = HDMI_AC97; |
1388 |
++ break; |
1389 |
++ default: |
1390 |
++ dev_err(dai->dev, "Invalid DAI interface format\n"); |
1391 |
++ return -EINVAL; |
1392 |
+ } |
1393 |
+ |
1394 |
+ hcp->daifmt[dai->id] = cf; |
1395 |
+ |
1396 |
+- return ret; |
1397 |
++ return 0; |
1398 |
+ } |
1399 |
+ |
1400 |
+ static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute) |
1401 |
+@@ -784,8 +782,10 @@ static int hdmi_codec_probe(struct platform_device *pdev) |
1402 |
+ i++; |
1403 |
+ } |
1404 |
+ |
1405 |
+- if (hcd->spdif) |
1406 |
++ if (hcd->spdif) { |
1407 |
+ hcp->daidrv[i] = hdmi_spdif_dai; |
1408 |
++ hcp->daifmt[DAI_ID_SPDIF].fmt = HDMI_SPDIF; |
1409 |
++ } |
1410 |
+ |
1411 |
+ ret = snd_soc_register_codec(dev, &hdmi_codec, hcp->daidrv, |
1412 |
+ dai_count); |
1413 |
+diff --git a/sound/soc/codecs/nau8810.c b/sound/soc/codecs/nau8810.c |
1414 |
+index c8e2451ae0a3..193588eb9835 100644 |
1415 |
+--- a/sound/soc/codecs/nau8810.c |
1416 |
++++ b/sound/soc/codecs/nau8810.c |
1417 |
+@@ -414,9 +414,9 @@ static const struct snd_soc_dapm_widget nau8810_dapm_widgets[] = { |
1418 |
+ SND_SOC_DAPM_MIXER("Mono Mixer", NAU8810_REG_POWER3, |
1419 |
+ NAU8810_MOUTMX_EN_SFT, 0, &nau8810_mono_mixer_controls[0], |
1420 |
+ ARRAY_SIZE(nau8810_mono_mixer_controls)), |
1421 |
+- SND_SOC_DAPM_DAC("DAC", "HiFi Playback", NAU8810_REG_POWER3, |
1422 |
++ SND_SOC_DAPM_DAC("DAC", "Playback", NAU8810_REG_POWER3, |
1423 |
+ NAU8810_DAC_EN_SFT, 0), |
1424 |
+- SND_SOC_DAPM_ADC("ADC", "HiFi Capture", NAU8810_REG_POWER2, |
1425 |
++ SND_SOC_DAPM_ADC("ADC", "Capture", NAU8810_REG_POWER2, |
1426 |
+ NAU8810_ADC_EN_SFT, 0), |
1427 |
+ SND_SOC_DAPM_PGA("SpkN Out", NAU8810_REG_POWER3, |
1428 |
+ NAU8810_NSPK_EN_SFT, 0, NULL, 0), |
1429 |
+diff --git a/sound/soc/codecs/nau8824.c b/sound/soc/codecs/nau8824.c |
1430 |
+index 0240759f951c..e8ea51247b17 100644 |
1431 |
+--- a/sound/soc/codecs/nau8824.c |
1432 |
++++ b/sound/soc/codecs/nau8824.c |
1433 |
+@@ -634,8 +634,8 @@ static const struct snd_soc_dapm_widget nau8824_dapm_widgets[] = { |
1434 |
+ SND_SOC_DAPM_ADC("ADCR", NULL, NAU8824_REG_ANALOG_ADC_2, |
1435 |
+ NAU8824_ADCR_EN_SFT, 0), |
1436 |
+ |
1437 |
+- SND_SOC_DAPM_AIF_OUT("AIFTX", "HiFi Capture", 0, SND_SOC_NOPM, 0, 0), |
1438 |
+- SND_SOC_DAPM_AIF_IN("AIFRX", "HiFi Playback", 0, SND_SOC_NOPM, 0, 0), |
1439 |
++ SND_SOC_DAPM_AIF_OUT("AIFTX", "Capture", 0, SND_SOC_NOPM, 0, 0), |
1440 |
++ SND_SOC_DAPM_AIF_IN("AIFRX", "Playback", 0, SND_SOC_NOPM, 0, 0), |
1441 |
+ |
1442 |
+ SND_SOC_DAPM_DAC("DACL", NULL, NAU8824_REG_RDAC, |
1443 |
+ NAU8824_DACL_EN_SFT, 0), |
1444 |
+@@ -784,6 +784,36 @@ static void nau8824_int_status_clear_all(struct regmap *regmap) |
1445 |
+ } |
1446 |
+ } |
1447 |
+ |
1448 |
++static void nau8824_dapm_disable_pin(struct nau8824 *nau8824, const char *pin) |
1449 |
++{ |
1450 |
++ struct snd_soc_dapm_context *dapm = nau8824->dapm; |
1451 |
++ const char *prefix = dapm->component->name_prefix; |
1452 |
++ char prefixed_pin[80]; |
1453 |
++ |
1454 |
++ if (prefix) { |
1455 |
++ snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s", |
1456 |
++ prefix, pin); |
1457 |
++ snd_soc_dapm_disable_pin(dapm, prefixed_pin); |
1458 |
++ } else { |
1459 |
++ snd_soc_dapm_disable_pin(dapm, pin); |
1460 |
++ } |
1461 |
++} |
1462 |
++ |
1463 |
++static void nau8824_dapm_enable_pin(struct nau8824 *nau8824, const char *pin) |
1464 |
++{ |
1465 |
++ struct snd_soc_dapm_context *dapm = nau8824->dapm; |
1466 |
++ const char *prefix = dapm->component->name_prefix; |
1467 |
++ char prefixed_pin[80]; |
1468 |
++ |
1469 |
++ if (prefix) { |
1470 |
++ snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s", |
1471 |
++ prefix, pin); |
1472 |
++ snd_soc_dapm_force_enable_pin(dapm, prefixed_pin); |
1473 |
++ } else { |
1474 |
++ snd_soc_dapm_force_enable_pin(dapm, pin); |
1475 |
++ } |
1476 |
++} |
1477 |
++ |
1478 |
+ static void nau8824_eject_jack(struct nau8824 *nau8824) |
1479 |
+ { |
1480 |
+ struct snd_soc_dapm_context *dapm = nau8824->dapm; |
1481 |
+@@ -792,8 +822,8 @@ static void nau8824_eject_jack(struct nau8824 *nau8824) |
1482 |
+ /* Clear all interruption status */ |
1483 |
+ nau8824_int_status_clear_all(regmap); |
1484 |
+ |
1485 |
+- snd_soc_dapm_disable_pin(dapm, "SAR"); |
1486 |
+- snd_soc_dapm_disable_pin(dapm, "MICBIAS"); |
1487 |
++ nau8824_dapm_disable_pin(nau8824, "SAR"); |
1488 |
++ nau8824_dapm_disable_pin(nau8824, "MICBIAS"); |
1489 |
+ snd_soc_dapm_sync(dapm); |
1490 |
+ |
1491 |
+ /* Enable the insertion interruption, disable the ejection |
1492 |
+@@ -822,8 +852,8 @@ static void nau8824_jdet_work(struct work_struct *work) |
1493 |
+ struct regmap *regmap = nau8824->regmap; |
1494 |
+ int adc_value, event = 0, event_mask = 0; |
1495 |
+ |
1496 |
+- snd_soc_dapm_force_enable_pin(dapm, "MICBIAS"); |
1497 |
+- snd_soc_dapm_force_enable_pin(dapm, "SAR"); |
1498 |
++ nau8824_dapm_enable_pin(nau8824, "MICBIAS"); |
1499 |
++ nau8824_dapm_enable_pin(nau8824, "SAR"); |
1500 |
+ snd_soc_dapm_sync(dapm); |
1501 |
+ |
1502 |
+ msleep(100); |
1503 |
+@@ -834,8 +864,8 @@ static void nau8824_jdet_work(struct work_struct *work) |
1504 |
+ if (adc_value < HEADSET_SARADC_THD) { |
1505 |
+ event |= SND_JACK_HEADPHONE; |
1506 |
+ |
1507 |
+- snd_soc_dapm_disable_pin(dapm, "SAR"); |
1508 |
+- snd_soc_dapm_disable_pin(dapm, "MICBIAS"); |
1509 |
++ nau8824_dapm_disable_pin(nau8824, "SAR"); |
1510 |
++ nau8824_dapm_disable_pin(nau8824, "MICBIAS"); |
1511 |
+ snd_soc_dapm_sync(dapm); |
1512 |
+ } else { |
1513 |
+ event |= SND_JACK_HEADSET; |
1514 |
+diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c |
1515 |
+index e694f5f04eb9..628621fc3386 100644 |
1516 |
+--- a/sound/soc/codecs/tlv320aic32x4.c |
1517 |
++++ b/sound/soc/codecs/tlv320aic32x4.c |
1518 |
+@@ -462,6 +462,8 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = { |
1519 |
+ SND_SOC_DAPM_INPUT("IN2_R"), |
1520 |
+ SND_SOC_DAPM_INPUT("IN3_L"), |
1521 |
+ SND_SOC_DAPM_INPUT("IN3_R"), |
1522 |
++ SND_SOC_DAPM_INPUT("CM_L"), |
1523 |
++ SND_SOC_DAPM_INPUT("CM_R"), |
1524 |
+ }; |
1525 |
+ |
1526 |
+ static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = { |
1527 |
+diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c |
1528 |
+index 67330b6ab204..d632a0511d62 100644 |
1529 |
+--- a/sound/soc/codecs/wm_adsp.c |
1530 |
++++ b/sound/soc/codecs/wm_adsp.c |
1531 |
+@@ -3711,11 +3711,13 @@ irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp) |
1532 |
+ struct regmap *regmap = dsp->regmap; |
1533 |
+ int ret = 0; |
1534 |
+ |
1535 |
++ mutex_lock(&dsp->pwr_lock); |
1536 |
++ |
1537 |
+ ret = regmap_read(regmap, dsp->base + ADSP2_LOCK_REGION_CTRL, &val); |
1538 |
+ if (ret) { |
1539 |
+ adsp_err(dsp, |
1540 |
+ "Failed to read Region Lock Ctrl register: %d\n", ret); |
1541 |
+- return IRQ_HANDLED; |
1542 |
++ goto error; |
1543 |
+ } |
1544 |
+ |
1545 |
+ if (val & ADSP2_WDT_TIMEOUT_STS_MASK) { |
1546 |
+@@ -3734,7 +3736,7 @@ irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp) |
1547 |
+ adsp_err(dsp, |
1548 |
+ "Failed to read Bus Err Addr register: %d\n", |
1549 |
+ ret); |
1550 |
+- return IRQ_HANDLED; |
1551 |
++ goto error; |
1552 |
+ } |
1553 |
+ |
1554 |
+ adsp_err(dsp, "bus error address = 0x%x\n", |
1555 |
+@@ -3747,7 +3749,7 @@ irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp) |
1556 |
+ adsp_err(dsp, |
1557 |
+ "Failed to read Pmem Xmem Err Addr register: %d\n", |
1558 |
+ ret); |
1559 |
+- return IRQ_HANDLED; |
1560 |
++ goto error; |
1561 |
+ } |
1562 |
+ |
1563 |
+ adsp_err(dsp, "xmem error address = 0x%x\n", |
1564 |
+@@ -3760,6 +3762,9 @@ irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp) |
1565 |
+ regmap_update_bits(regmap, dsp->base + ADSP2_LOCK_REGION_CTRL, |
1566 |
+ ADSP2_CTRL_ERR_EINT, ADSP2_CTRL_ERR_EINT); |
1567 |
+ |
1568 |
++error: |
1569 |
++ mutex_unlock(&dsp->pwr_lock); |
1570 |
++ |
1571 |
+ return IRQ_HANDLED; |
1572 |
+ } |
1573 |
+ EXPORT_SYMBOL_GPL(wm_adsp2_bus_error); |
1574 |
+diff --git a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c |
1575 |
+index 69ab55956492..41cb1fefbd42 100644 |
1576 |
+--- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c |
1577 |
++++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c |
1578 |
+@@ -405,7 +405,7 @@ static const struct snd_pcm_hw_constraint_list constraints_dmic_channels = { |
1579 |
+ }; |
1580 |
+ |
1581 |
+ static const unsigned int dmic_2ch[] = { |
1582 |
+- 4, |
1583 |
++ 2, |
1584 |
+ }; |
1585 |
+ |
1586 |
+ static const struct snd_pcm_hw_constraint_list constraints_dmic_2ch = { |
1587 |
+diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c |
1588 |
+index 79a9fdf94d38..582b30a5118d 100644 |
1589 |
+--- a/sound/soc/intel/common/sst-firmware.c |
1590 |
++++ b/sound/soc/intel/common/sst-firmware.c |
1591 |
+@@ -1252,11 +1252,15 @@ struct sst_dsp *sst_dsp_new(struct device *dev, |
1592 |
+ goto irq_err; |
1593 |
+ |
1594 |
+ err = sst_dma_new(sst); |
1595 |
+- if (err) |
1596 |
+- dev_warn(dev, "sst_dma_new failed %d\n", err); |
1597 |
++ if (err) { |
1598 |
++ dev_err(dev, "sst_dma_new failed %d\n", err); |
1599 |
++ goto dma_err; |
1600 |
++ } |
1601 |
+ |
1602 |
+ return sst; |
1603 |
+ |
1604 |
++dma_err: |
1605 |
++ free_irq(sst->irq, sst); |
1606 |
+ irq_err: |
1607 |
+ if (sst->ops->free) |
1608 |
+ sst->ops->free(sst); |
1609 |
+diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c |
1610 |
+index 400e29edb1c9..8a2e3bbce3a1 100644 |
1611 |
+--- a/sound/soc/rockchip/rockchip_pdm.c |
1612 |
++++ b/sound/soc/rockchip/rockchip_pdm.c |
1613 |
+@@ -208,7 +208,9 @@ static int rockchip_pdm_set_fmt(struct snd_soc_dai *cpu_dai, |
1614 |
+ return -EINVAL; |
1615 |
+ } |
1616 |
+ |
1617 |
++ pm_runtime_get_sync(cpu_dai->dev); |
1618 |
+ regmap_update_bits(pdm->regmap, PDM_CLK_CTRL, mask, val); |
1619 |
++ pm_runtime_put(cpu_dai->dev); |
1620 |
+ |
1621 |
+ return 0; |
1622 |
+ } |
1623 |
+diff --git a/sound/soc/samsung/odroid.c b/sound/soc/samsung/odroid.c |
1624 |
+index 06a31a9585a0..32c9e197ca95 100644 |
1625 |
+--- a/sound/soc/samsung/odroid.c |
1626 |
++++ b/sound/soc/samsung/odroid.c |
1627 |
+@@ -66,11 +66,11 @@ static int odroid_card_hw_params(struct snd_pcm_substream *substream, |
1628 |
+ return ret; |
1629 |
+ |
1630 |
+ /* |
1631 |
+- * We add 1 to the rclk_freq value in order to avoid too low clock |
1632 |
++ * We add 2 to the rclk_freq value in order to avoid too low clock |
1633 |
+ * frequency values due to the EPLL output frequency not being exact |
1634 |
+ * multiple of the audio sampling rate. |
1635 |
+ */ |
1636 |
+- rclk_freq = params_rate(params) * rfs + 1; |
1637 |
++ rclk_freq = params_rate(params) * rfs + 2; |
1638 |
+ |
1639 |
+ ret = clk_set_rate(priv->sclk_i2s, rclk_freq); |
1640 |
+ if (ret < 0) |
1641 |
+diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
1642 |
+index 6fc85199ac73..584b7ffe78f5 100644 |
1643 |
+--- a/sound/soc/soc-pcm.c |
1644 |
++++ b/sound/soc/soc-pcm.c |
1645 |
+@@ -894,10 +894,13 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, |
1646 |
+ codec_params = *params; |
1647 |
+ |
1648 |
+ /* fixup params based on TDM slot masks */ |
1649 |
+- if (codec_dai->tx_mask) |
1650 |
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && |
1651 |
++ codec_dai->tx_mask) |
1652 |
+ soc_pcm_codec_params_fixup(&codec_params, |
1653 |
+ codec_dai->tx_mask); |
1654 |
+- if (codec_dai->rx_mask) |
1655 |
++ |
1656 |
++ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && |
1657 |
++ codec_dai->rx_mask) |
1658 |
+ soc_pcm_codec_params_fixup(&codec_params, |
1659 |
+ codec_dai->rx_mask); |
1660 |
+ |