Contents of /trunk/kernel-alx/patches-5.4/0111-5.4.12-all-fixes.patch
Parent Directory | Revision Log
Revision 3492 -
(show annotations)
(download)
Mon May 11 14:36:15 2020 UTC (4 years, 4 months ago) by niro
File size: 83542 byte(s)
Mon May 11 14:36:15 2020 UTC (4 years, 4 months ago) by niro
File size: 83542 byte(s)
-linux-5.4.12
1 | diff --git a/Makefile b/Makefile |
2 | index e8963f623568..45c6264f1108 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 5 |
8 | PATCHLEVEL = 4 |
9 | -SUBLEVEL = 11 |
10 | +SUBLEVEL = 12 |
11 | EXTRAVERSION = |
12 | NAME = Kleptomaniac Octopus |
13 | |
14 | diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig |
15 | index 8a50efb559f3..39002d769d95 100644 |
16 | --- a/arch/arm/Kconfig |
17 | +++ b/arch/arm/Kconfig |
18 | @@ -73,6 +73,7 @@ config ARM |
19 | select HAVE_ARM_SMCCC if CPU_V7 |
20 | select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32 |
21 | select HAVE_CONTEXT_TRACKING |
22 | + select HAVE_COPY_THREAD_TLS |
23 | select HAVE_C_RECORDMCOUNT |
24 | select HAVE_DEBUG_KMEMLEAK |
25 | select HAVE_DMA_CONTIGUOUS if MMU |
26 | diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c |
27 | index 9485acc520a4..e7fac125ea0d 100644 |
28 | --- a/arch/arm/kernel/process.c |
29 | +++ b/arch/arm/kernel/process.c |
30 | @@ -224,8 +224,8 @@ void release_thread(struct task_struct *dead_task) |
31 | asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); |
32 | |
33 | int |
34 | -copy_thread(unsigned long clone_flags, unsigned long stack_start, |
35 | - unsigned long stk_sz, struct task_struct *p) |
36 | +copy_thread_tls(unsigned long clone_flags, unsigned long stack_start, |
37 | + unsigned long stk_sz, struct task_struct *p, unsigned long tls) |
38 | { |
39 | struct thread_info *thread = task_thread_info(p); |
40 | struct pt_regs *childregs = task_pt_regs(p); |
41 | @@ -259,7 +259,7 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start, |
42 | clear_ptrace_hw_breakpoint(p); |
43 | |
44 | if (clone_flags & CLONE_SETTLS) |
45 | - thread->tp_value[0] = childregs->ARM_r3; |
46 | + thread->tp_value[0] = tls; |
47 | thread->tp_value[1] = get_tpuser(); |
48 | |
49 | thread_notify(THREAD_NOTIFY_COPY, thread); |
50 | diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig |
51 | index 3f047afb982c..6ccd2ed30963 100644 |
52 | --- a/arch/arm64/Kconfig |
53 | +++ b/arch/arm64/Kconfig |
54 | @@ -139,6 +139,7 @@ config ARM64 |
55 | select HAVE_CMPXCHG_DOUBLE |
56 | select HAVE_CMPXCHG_LOCAL |
57 | select HAVE_CONTEXT_TRACKING |
58 | + select HAVE_COPY_THREAD_TLS |
59 | select HAVE_DEBUG_BUGVERBOSE |
60 | select HAVE_DEBUG_KMEMLEAK |
61 | select HAVE_DMA_CONTIGUOUS |
62 | diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h |
63 | index 2629a68b8724..5af82587909e 100644 |
64 | --- a/arch/arm64/include/asm/unistd.h |
65 | +++ b/arch/arm64/include/asm/unistd.h |
66 | @@ -42,7 +42,6 @@ |
67 | #endif |
68 | |
69 | #define __ARCH_WANT_SYS_CLONE |
70 | -#define __ARCH_WANT_SYS_CLONE3 |
71 | |
72 | #ifndef __COMPAT_SYSCALL_NR |
73 | #include <uapi/asm/unistd.h> |
74 | diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h |
75 | index 4703d218663a..f83a70e07df8 100644 |
76 | --- a/arch/arm64/include/uapi/asm/unistd.h |
77 | +++ b/arch/arm64/include/uapi/asm/unistd.h |
78 | @@ -19,5 +19,6 @@ |
79 | #define __ARCH_WANT_NEW_STAT |
80 | #define __ARCH_WANT_SET_GET_RLIMIT |
81 | #define __ARCH_WANT_TIME32_SYSCALLS |
82 | +#define __ARCH_WANT_SYS_CLONE3 |
83 | |
84 | #include <asm-generic/unistd.h> |
85 | diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c |
86 | index 71f788cd2b18..d54586d5b031 100644 |
87 | --- a/arch/arm64/kernel/process.c |
88 | +++ b/arch/arm64/kernel/process.c |
89 | @@ -360,8 +360,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) |
90 | |
91 | asmlinkage void ret_from_fork(void) asm("ret_from_fork"); |
92 | |
93 | -int copy_thread(unsigned long clone_flags, unsigned long stack_start, |
94 | - unsigned long stk_sz, struct task_struct *p) |
95 | +int copy_thread_tls(unsigned long clone_flags, unsigned long stack_start, |
96 | + unsigned long stk_sz, struct task_struct *p, unsigned long tls) |
97 | { |
98 | struct pt_regs *childregs = task_pt_regs(p); |
99 | |
100 | @@ -394,11 +394,11 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, |
101 | } |
102 | |
103 | /* |
104 | - * If a TLS pointer was passed to clone (4th argument), use it |
105 | - * for the new thread. |
106 | + * If a TLS pointer was passed to clone, use it for the new |
107 | + * thread. |
108 | */ |
109 | if (clone_flags & CLONE_SETTLS) |
110 | - p->thread.uw.tp_value = childregs->regs[3]; |
111 | + p->thread.uw.tp_value = tls; |
112 | } else { |
113 | memset(childregs, 0, sizeof(struct pt_regs)); |
114 | childregs->pstate = PSR_MODE_EL1h; |
115 | diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig |
116 | index b16237c95ea3..0c29d6cb2c8d 100644 |
117 | --- a/arch/parisc/Kconfig |
118 | +++ b/arch/parisc/Kconfig |
119 | @@ -62,6 +62,7 @@ config PARISC |
120 | select HAVE_FTRACE_MCOUNT_RECORD if HAVE_DYNAMIC_FTRACE |
121 | select HAVE_KPROBES_ON_FTRACE |
122 | select HAVE_DYNAMIC_FTRACE_WITH_REGS |
123 | + select HAVE_COPY_THREAD_TLS |
124 | |
125 | help |
126 | The PA-RISC microprocessor is designed by Hewlett-Packard and used |
127 | diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c |
128 | index ecc5c2771208..230a6422b99f 100644 |
129 | --- a/arch/parisc/kernel/process.c |
130 | +++ b/arch/parisc/kernel/process.c |
131 | @@ -208,8 +208,8 @@ arch_initcall(parisc_idle_init); |
132 | * Copy architecture-specific thread state |
133 | */ |
134 | int |
135 | -copy_thread(unsigned long clone_flags, unsigned long usp, |
136 | - unsigned long kthread_arg, struct task_struct *p) |
137 | +copy_thread_tls(unsigned long clone_flags, unsigned long usp, |
138 | + unsigned long kthread_arg, struct task_struct *p, unsigned long tls) |
139 | { |
140 | struct pt_regs *cregs = &(p->thread.regs); |
141 | void *stack = task_stack_page(p); |
142 | @@ -254,9 +254,9 @@ copy_thread(unsigned long clone_flags, unsigned long usp, |
143 | cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE; |
144 | cregs->kpc = (unsigned long) &child_return; |
145 | |
146 | - /* Setup thread TLS area from the 4th parameter in clone */ |
147 | + /* Setup thread TLS area */ |
148 | if (clone_flags & CLONE_SETTLS) |
149 | - cregs->cr27 = cregs->gr[23]; |
150 | + cregs->cr27 = tls; |
151 | } |
152 | |
153 | return 0; |
154 | diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig |
155 | index 8eebbc8860bb..ade9699aa0dd 100644 |
156 | --- a/arch/riscv/Kconfig |
157 | +++ b/arch/riscv/Kconfig |
158 | @@ -61,6 +61,7 @@ config RISCV |
159 | select SPARSEMEM_STATIC if 32BIT |
160 | select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU |
161 | select HAVE_ARCH_MMAP_RND_BITS |
162 | + select HAVE_COPY_THREAD_TLS |
163 | |
164 | config ARCH_MMAP_RND_BITS_MIN |
165 | default 18 if 64BIT |
166 | diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c |
167 | index 85e3c39bb60b..330b34706aa0 100644 |
168 | --- a/arch/riscv/kernel/process.c |
169 | +++ b/arch/riscv/kernel/process.c |
170 | @@ -99,8 +99,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) |
171 | return 0; |
172 | } |
173 | |
174 | -int copy_thread(unsigned long clone_flags, unsigned long usp, |
175 | - unsigned long arg, struct task_struct *p) |
176 | +int copy_thread_tls(unsigned long clone_flags, unsigned long usp, |
177 | + unsigned long arg, struct task_struct *p, unsigned long tls) |
178 | { |
179 | struct pt_regs *childregs = task_pt_regs(p); |
180 | |
181 | @@ -120,7 +120,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, |
182 | if (usp) /* User fork */ |
183 | childregs->sp = usp; |
184 | if (clone_flags & CLONE_SETTLS) |
185 | - childregs->tp = childregs->a5; |
186 | + childregs->tp = tls; |
187 | childregs->a0 = 0; /* Return value of fork() */ |
188 | p->thread.ra = (unsigned long)ret_from_fork; |
189 | } |
190 | diff --git a/arch/um/Kconfig b/arch/um/Kconfig |
191 | index fec6b4ca2b6e..c56d3526a3bd 100644 |
192 | --- a/arch/um/Kconfig |
193 | +++ b/arch/um/Kconfig |
194 | @@ -14,6 +14,7 @@ config UML |
195 | select HAVE_FUTEX_CMPXCHG if FUTEX |
196 | select HAVE_DEBUG_KMEMLEAK |
197 | select HAVE_DEBUG_BUGVERBOSE |
198 | + select HAVE_COPY_THREAD_TLS |
199 | select GENERIC_IRQ_SHOW |
200 | select GENERIC_CPU_DEVICES |
201 | select GENERIC_CLOCKEVENTS |
202 | diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptrace-generic.h |
203 | index 81c647ef9c6c..adf91ef553ae 100644 |
204 | --- a/arch/um/include/asm/ptrace-generic.h |
205 | +++ b/arch/um/include/asm/ptrace-generic.h |
206 | @@ -36,7 +36,7 @@ extern long subarch_ptrace(struct task_struct *child, long request, |
207 | extern unsigned long getreg(struct task_struct *child, int regno); |
208 | extern int putreg(struct task_struct *child, int regno, unsigned long value); |
209 | |
210 | -extern int arch_copy_tls(struct task_struct *new); |
211 | +extern int arch_set_tls(struct task_struct *new, unsigned long tls); |
212 | extern void clear_flushed_tls(struct task_struct *task); |
213 | extern int syscall_trace_enter(struct pt_regs *regs); |
214 | extern void syscall_trace_leave(struct pt_regs *regs); |
215 | diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c |
216 | index 263a8f069133..17045e7211bf 100644 |
217 | --- a/arch/um/kernel/process.c |
218 | +++ b/arch/um/kernel/process.c |
219 | @@ -153,8 +153,8 @@ void fork_handler(void) |
220 | userspace(¤t->thread.regs.regs, current_thread_info()->aux_fp_regs); |
221 | } |
222 | |
223 | -int copy_thread(unsigned long clone_flags, unsigned long sp, |
224 | - unsigned long arg, struct task_struct * p) |
225 | +int copy_thread_tls(unsigned long clone_flags, unsigned long sp, |
226 | + unsigned long arg, struct task_struct * p, unsigned long tls) |
227 | { |
228 | void (*handler)(void); |
229 | int kthread = current->flags & PF_KTHREAD; |
230 | @@ -188,7 +188,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, |
231 | * Set a new TLS for the child thread? |
232 | */ |
233 | if (clone_flags & CLONE_SETTLS) |
234 | - ret = arch_copy_tls(p); |
235 | + ret = arch_set_tls(p, tls); |
236 | } |
237 | |
238 | return ret; |
239 | diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c |
240 | index 5bd949da7a4a..ac8eee093f9c 100644 |
241 | --- a/arch/x86/um/tls_32.c |
242 | +++ b/arch/x86/um/tls_32.c |
243 | @@ -215,14 +215,12 @@ static int set_tls_entry(struct task_struct* task, struct user_desc *info, |
244 | return 0; |
245 | } |
246 | |
247 | -int arch_copy_tls(struct task_struct *new) |
248 | +int arch_set_tls(struct task_struct *new, unsigned long tls) |
249 | { |
250 | struct user_desc info; |
251 | int idx, ret = -EFAULT; |
252 | |
253 | - if (copy_from_user(&info, |
254 | - (void __user *) UPT_SI(&new->thread.regs.regs), |
255 | - sizeof(info))) |
256 | + if (copy_from_user(&info, (void __user *) tls, sizeof(info))) |
257 | goto out; |
258 | |
259 | ret = -EINVAL; |
260 | diff --git a/arch/x86/um/tls_64.c b/arch/x86/um/tls_64.c |
261 | index 3a621e0d3925..ebd3855d9b13 100644 |
262 | --- a/arch/x86/um/tls_64.c |
263 | +++ b/arch/x86/um/tls_64.c |
264 | @@ -6,14 +6,13 @@ void clear_flushed_tls(struct task_struct *task) |
265 | { |
266 | } |
267 | |
268 | -int arch_copy_tls(struct task_struct *t) |
269 | +int arch_set_tls(struct task_struct *t, unsigned long tls) |
270 | { |
271 | /* |
272 | * If CLONE_SETTLS is set, we need to save the thread id |
273 | - * (which is argument 5, child_tid, of clone) so it can be set |
274 | - * during context switches. |
275 | + * so it can be set during context switches. |
276 | */ |
277 | - t->thread.arch.fs = t->thread.regs.regs.gp[R8 / sizeof(long)]; |
278 | + t->thread.arch.fs = tls; |
279 | |
280 | return 0; |
281 | } |
282 | diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig |
283 | index a8e7beb6b7b5..8352037322df 100644 |
284 | --- a/arch/xtensa/Kconfig |
285 | +++ b/arch/xtensa/Kconfig |
286 | @@ -22,6 +22,7 @@ config XTENSA |
287 | select HAVE_ARCH_JUMP_LABEL |
288 | select HAVE_ARCH_KASAN if MMU |
289 | select HAVE_ARCH_TRACEHOOK |
290 | + select HAVE_COPY_THREAD_TLS |
291 | select HAVE_DEBUG_KMEMLEAK |
292 | select HAVE_DMA_CONTIGUOUS |
293 | select HAVE_EXIT_THREAD |
294 | diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c |
295 | index db278a9e80c7..7cbf8bd6d922 100644 |
296 | --- a/arch/xtensa/kernel/process.c |
297 | +++ b/arch/xtensa/kernel/process.c |
298 | @@ -202,8 +202,9 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) |
299 | * involved. Much simpler to just not copy those live frames across. |
300 | */ |
301 | |
302 | -int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, |
303 | - unsigned long thread_fn_arg, struct task_struct *p) |
304 | +int copy_thread_tls(unsigned long clone_flags, unsigned long usp_thread_fn, |
305 | + unsigned long thread_fn_arg, struct task_struct *p, |
306 | + unsigned long tls) |
307 | { |
308 | struct pt_regs *childregs = task_pt_regs(p); |
309 | |
310 | @@ -264,9 +265,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, |
311 | ®s->areg[XCHAL_NUM_AREGS - len/4], len); |
312 | } |
313 | |
314 | - /* The thread pointer is passed in the '4th argument' (= a5) */ |
315 | if (clone_flags & CLONE_SETTLS) |
316 | - childregs->threadptr = childregs->areg[5]; |
317 | + childregs->threadptr = tls; |
318 | } else { |
319 | p->thread.ra = MAKE_RA_FOR_CALL( |
320 | (unsigned long)ret_from_kernel_thread, 1); |
321 | diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c |
322 | index b23b0b999232..87f449340202 100644 |
323 | --- a/drivers/char/tpm/tpm-dev-common.c |
324 | +++ b/drivers/char/tpm/tpm-dev-common.c |
325 | @@ -130,7 +130,7 @@ ssize_t tpm_common_read(struct file *file, char __user *buf, |
326 | priv->response_read = true; |
327 | |
328 | ret_size = min_t(ssize_t, size, priv->response_length); |
329 | - if (!ret_size) { |
330 | + if (ret_size <= 0) { |
331 | priv->response_length = 0; |
332 | goto out; |
333 | } |
334 | diff --git a/drivers/char/tpm/tpm-dev.h b/drivers/char/tpm/tpm-dev.h |
335 | index 1089fc0bb290..f3742bcc73e3 100644 |
336 | --- a/drivers/char/tpm/tpm-dev.h |
337 | +++ b/drivers/char/tpm/tpm-dev.h |
338 | @@ -14,7 +14,7 @@ struct file_priv { |
339 | struct work_struct timeout_work; |
340 | struct work_struct async_work; |
341 | wait_queue_head_t async_wait; |
342 | - size_t response_length; |
343 | + ssize_t response_length; |
344 | bool response_read; |
345 | bool command_enqueued; |
346 | |
347 | diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c |
348 | index f528fc39ea6b..c3181ea9f271 100644 |
349 | --- a/drivers/char/tpm/tpm_tis_core.c |
350 | +++ b/drivers/char/tpm/tpm_tis_core.c |
351 | @@ -899,13 +899,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
352 | |
353 | if (wait_startup(chip, 0) != 0) { |
354 | rc = -ENODEV; |
355 | - goto err_start; |
356 | + goto out_err; |
357 | } |
358 | |
359 | /* Take control of the TPM's interrupt hardware and shut it off */ |
360 | rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); |
361 | if (rc < 0) |
362 | - goto err_start; |
363 | + goto out_err; |
364 | |
365 | intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | |
366 | TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; |
367 | @@ -914,21 +914,21 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
368 | |
369 | rc = tpm_chip_start(chip); |
370 | if (rc) |
371 | - goto err_start; |
372 | - |
373 | + goto out_err; |
374 | rc = tpm2_probe(chip); |
375 | + tpm_chip_stop(chip); |
376 | if (rc) |
377 | - goto err_probe; |
378 | + goto out_err; |
379 | |
380 | rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor); |
381 | if (rc < 0) |
382 | - goto err_probe; |
383 | + goto out_err; |
384 | |
385 | priv->manufacturer_id = vendor; |
386 | |
387 | rc = tpm_tis_read8(priv, TPM_RID(0), &rid); |
388 | if (rc < 0) |
389 | - goto err_probe; |
390 | + goto out_err; |
391 | |
392 | dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n", |
393 | (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2", |
394 | @@ -937,13 +937,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
395 | probe = probe_itpm(chip); |
396 | if (probe < 0) { |
397 | rc = -ENODEV; |
398 | - goto err_probe; |
399 | + goto out_err; |
400 | } |
401 | |
402 | /* Figure out the capabilities */ |
403 | rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps); |
404 | if (rc < 0) |
405 | - goto err_probe; |
406 | + goto out_err; |
407 | |
408 | dev_dbg(dev, "TPM interface capabilities (0x%x):\n", |
409 | intfcaps); |
410 | @@ -977,10 +977,9 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
411 | if (tpm_get_timeouts(chip)) { |
412 | dev_err(dev, "Could not get TPM timeouts and durations\n"); |
413 | rc = -ENODEV; |
414 | - goto err_probe; |
415 | + goto out_err; |
416 | } |
417 | |
418 | - chip->flags |= TPM_CHIP_FLAG_IRQ; |
419 | if (irq) { |
420 | tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, |
421 | irq); |
422 | @@ -992,18 +991,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
423 | } |
424 | } |
425 | |
426 | - tpm_chip_stop(chip); |
427 | - |
428 | rc = tpm_chip_register(chip); |
429 | if (rc) |
430 | - goto err_start; |
431 | - |
432 | - return 0; |
433 | + goto out_err; |
434 | |
435 | -err_probe: |
436 | - tpm_chip_stop(chip); |
437 | + if (chip->ops->clk_enable != NULL) |
438 | + chip->ops->clk_enable(chip, false); |
439 | |
440 | -err_start: |
441 | + return 0; |
442 | +out_err: |
443 | if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL)) |
444 | chip->ops->clk_enable(chip, false); |
445 | |
446 | diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c |
447 | index 59ccfd24627d..1f98e988c0d3 100644 |
448 | --- a/drivers/gpio/gpiolib-acpi.c |
449 | +++ b/drivers/gpio/gpiolib-acpi.c |
450 | @@ -21,11 +21,19 @@ |
451 | #include "gpiolib.h" |
452 | #include "gpiolib-acpi.h" |
453 | |
454 | +#define QUIRK_NO_EDGE_EVENTS_ON_BOOT 0x01l |
455 | +#define QUIRK_NO_WAKEUP 0x02l |
456 | + |
457 | static int run_edge_events_on_boot = -1; |
458 | module_param(run_edge_events_on_boot, int, 0444); |
459 | MODULE_PARM_DESC(run_edge_events_on_boot, |
460 | "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto"); |
461 | |
462 | +static int honor_wakeup = -1; |
463 | +module_param(honor_wakeup, int, 0444); |
464 | +MODULE_PARM_DESC(honor_wakeup, |
465 | + "Honor the ACPI wake-capable flag: 0=no, 1=yes, -1=auto"); |
466 | + |
467 | /** |
468 | * struct acpi_gpio_event - ACPI GPIO event handler data |
469 | * |
470 | @@ -274,7 +282,7 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares, |
471 | event->handle = evt_handle; |
472 | event->handler = handler; |
473 | event->irq = irq; |
474 | - event->irq_is_wake = agpio->wake_capable == ACPI_WAKE_CAPABLE; |
475 | + event->irq_is_wake = honor_wakeup && agpio->wake_capable == ACPI_WAKE_CAPABLE; |
476 | event->pin = pin; |
477 | event->desc = desc; |
478 | |
479 | @@ -1302,7 +1310,7 @@ static int acpi_gpio_handle_deferred_request_irqs(void) |
480 | /* We must use _sync so that this runs after the first deferred_probe run */ |
481 | late_initcall_sync(acpi_gpio_handle_deferred_request_irqs); |
482 | |
483 | -static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = { |
484 | +static const struct dmi_system_id gpiolib_acpi_quirks[] = { |
485 | { |
486 | /* |
487 | * The Minix Neo Z83-4 has a micro-USB-B id-pin handler for |
488 | @@ -1312,7 +1320,8 @@ static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = { |
489 | .matches = { |
490 | DMI_MATCH(DMI_SYS_VENDOR, "MINIX"), |
491 | DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"), |
492 | - } |
493 | + }, |
494 | + .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT, |
495 | }, |
496 | { |
497 | /* |
498 | @@ -1324,20 +1333,52 @@ static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = { |
499 | .matches = { |
500 | DMI_MATCH(DMI_SYS_VENDOR, "Wortmann_AG"), |
501 | DMI_MATCH(DMI_PRODUCT_NAME, "TERRA_PAD_1061"), |
502 | - } |
503 | + }, |
504 | + .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT, |
505 | + }, |
506 | + { |
507 | + /* |
508 | + * Various HP X2 10 Cherry Trail models use an external |
509 | + * embedded-controller connected via I2C + an ACPI GPIO |
510 | + * event handler. The embedded controller generates various |
511 | + * spurious wakeup events when suspended. So disable wakeup |
512 | + * for its handler (it uses the only ACPI GPIO event handler). |
513 | + * This breaks wakeup when opening the lid, the user needs |
514 | + * to press the power-button to wakeup the system. The |
515 | + * alternative is suspend simply not working, which is worse. |
516 | + */ |
517 | + .matches = { |
518 | + DMI_MATCH(DMI_SYS_VENDOR, "HP"), |
519 | + DMI_MATCH(DMI_PRODUCT_NAME, "HP x2 Detachable 10-p0XX"), |
520 | + }, |
521 | + .driver_data = (void *)QUIRK_NO_WAKEUP, |
522 | }, |
523 | {} /* Terminating entry */ |
524 | }; |
525 | |
526 | static int acpi_gpio_setup_params(void) |
527 | { |
528 | + const struct dmi_system_id *id; |
529 | + long quirks = 0; |
530 | + |
531 | + id = dmi_first_match(gpiolib_acpi_quirks); |
532 | + if (id) |
533 | + quirks = (long)id->driver_data; |
534 | + |
535 | if (run_edge_events_on_boot < 0) { |
536 | - if (dmi_check_system(run_edge_events_on_boot_blacklist)) |
537 | + if (quirks & QUIRK_NO_EDGE_EVENTS_ON_BOOT) |
538 | run_edge_events_on_boot = 0; |
539 | else |
540 | run_edge_events_on_boot = 1; |
541 | } |
542 | |
543 | + if (honor_wakeup < 0) { |
544 | + if (quirks & QUIRK_NO_WAKEUP) |
545 | + honor_wakeup = 0; |
546 | + else |
547 | + honor_wakeup = 1; |
548 | + } |
549 | + |
550 | return 0; |
551 | } |
552 | |
553 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |
554 | index b19157b19fa0..33a1099e2f33 100644 |
555 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |
556 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |
557 | @@ -145,7 +145,7 @@ int amdgpu_async_gfx_ring = 1; |
558 | int amdgpu_mcbp = 0; |
559 | int amdgpu_discovery = -1; |
560 | int amdgpu_mes = 0; |
561 | -int amdgpu_noretry = 1; |
562 | +int amdgpu_noretry; |
563 | |
564 | struct amdgpu_mgpu_info mgpu_info = { |
565 | .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex), |
566 | @@ -613,7 +613,7 @@ MODULE_PARM_DESC(mes, |
567 | module_param_named(mes, amdgpu_mes, int, 0444); |
568 | |
569 | MODULE_PARM_DESC(noretry, |
570 | - "Disable retry faults (0 = retry enabled, 1 = retry disabled (default))"); |
571 | + "Disable retry faults (0 = retry enabled (default), 1 = retry disabled)"); |
572 | module_param_named(noretry, amdgpu_noretry, int, 0644); |
573 | |
574 | #ifdef CONFIG_HSA_AMD |
575 | diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
576 | index 86c17896b532..a48a4c21b1b3 100644 |
577 | --- a/drivers/gpu/drm/drm_dp_mst_topology.c |
578 | +++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
579 | @@ -339,7 +339,7 @@ static void drm_dp_encode_sideband_req(struct drm_dp_sideband_msg_req_body *req, |
580 | memcpy(&buf[idx], req->u.i2c_read.transactions[i].bytes, req->u.i2c_read.transactions[i].num_bytes); |
581 | idx += req->u.i2c_read.transactions[i].num_bytes; |
582 | |
583 | - buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit & 0x1) << 5; |
584 | + buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit & 0x1) << 4; |
585 | buf[idx] |= (req->u.i2c_read.transactions[i].i2c_transaction_delay & 0xf); |
586 | idx++; |
587 | } |
588 | diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c |
589 | index a7ba5b4902d6..8d193a58363d 100644 |
590 | --- a/drivers/gpu/drm/drm_fb_helper.c |
591 | +++ b/drivers/gpu/drm/drm_fb_helper.c |
592 | @@ -1320,7 +1320,7 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, |
593 | * Changes struct fb_var_screeninfo are currently not pushed back |
594 | * to KMS, hence fail if different settings are requested. |
595 | */ |
596 | - if (var->bits_per_pixel != fb->format->cpp[0] * 8 || |
597 | + if (var->bits_per_pixel > fb->format->cpp[0] * 8 || |
598 | var->xres > fb->width || var->yres > fb->height || |
599 | var->xres_virtual > fb->width || var->yres_virtual > fb->height) { |
600 | DRM_DEBUG("fb requested width/height/bpp can't fit in current fb " |
601 | @@ -1345,6 +1345,11 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, |
602 | drm_fb_helper_fill_pixel_fmt(var, fb->format->depth); |
603 | } |
604 | |
605 | + /* |
606 | + * Likewise, bits_per_pixel should be rounded up to a supported value. |
607 | + */ |
608 | + var->bits_per_pixel = fb->format->cpp[0] * 8; |
609 | + |
610 | /* |
611 | * drm fbdev emulation doesn't support changing the pixel format at all, |
612 | * so reject all pixel format changing requests. |
613 | diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c |
614 | index d564bfcab6a3..4949b5ad860f 100644 |
615 | --- a/drivers/gpu/drm/i915/gt/intel_lrc.c |
616 | +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c |
617 | @@ -2132,6 +2132,14 @@ static u32 *gen9_init_indirectctx_bb(struct intel_engine_cs *engine, u32 *batch) |
618 | /* WaFlushCoherentL3CacheLinesAtContextSwitch:skl,bxt,glk */ |
619 | batch = gen8_emit_flush_coherentl3_wa(engine, batch); |
620 | |
621 | + /* WaClearSlmSpaceAtContextSwitch:skl,bxt,kbl,glk,cfl */ |
622 | + batch = gen8_emit_pipe_control(batch, |
623 | + PIPE_CONTROL_FLUSH_L3 | |
624 | + PIPE_CONTROL_GLOBAL_GTT_IVB | |
625 | + PIPE_CONTROL_CS_STALL | |
626 | + PIPE_CONTROL_QW_WRITE, |
627 | + slm_offset(engine)); |
628 | + |
629 | batch = emit_lri(batch, lri, ARRAY_SIZE(lri)); |
630 | |
631 | /* WaMediaPoolStateCmdInWABB:bxt,glk */ |
632 | @@ -3716,9 +3724,11 @@ intel_execlists_create_virtual(struct i915_gem_context *ctx, |
633 | ve->base.i915 = ctx->i915; |
634 | ve->base.gt = siblings[0]->gt; |
635 | ve->base.id = -1; |
636 | + |
637 | ve->base.class = OTHER_CLASS; |
638 | ve->base.uabi_class = I915_ENGINE_CLASS_INVALID; |
639 | ve->base.instance = I915_ENGINE_CLASS_INVALID_VIRTUAL; |
640 | + ve->base.uabi_instance = I915_ENGINE_CLASS_INVALID_VIRTUAL; |
641 | |
642 | /* |
643 | * The decision on whether to submit a request using semaphores |
644 | diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h |
645 | index f8ee9aba3955..7b6e68f082f8 100644 |
646 | --- a/drivers/gpu/drm/i915/i915_reg.h |
647 | +++ b/drivers/gpu/drm/i915/i915_reg.h |
648 | @@ -4049,7 +4049,13 @@ enum { |
649 | #define GWUNIT_CLKGATE_DIS (1 << 16) |
650 | |
651 | #define UNSLICE_UNIT_LEVEL_CLKGATE _MMIO(0x9434) |
652 | -#define VFUNIT_CLKGATE_DIS (1 << 20) |
653 | +#define VFUNIT_CLKGATE_DIS REG_BIT(20) |
654 | +#define HSUNIT_CLKGATE_DIS REG_BIT(8) |
655 | +#define VSUNIT_CLKGATE_DIS REG_BIT(3) |
656 | + |
657 | +#define UNSLICE_UNIT_LEVEL_CLKGATE2 _MMIO(0x94e4) |
658 | +#define VSUNIT_CLKGATE_DIS_TGL REG_BIT(19) |
659 | +#define PSDUNIT_CLKGATE_DIS REG_BIT(5) |
660 | |
661 | #define INF_UNIT_LEVEL_CLKGATE _MMIO(0x9560) |
662 | #define CGPSF_CLKGATE_DIS (1 << 3) |
663 | diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c |
664 | index 2efe1d12d5a9..3ccfc025fde2 100644 |
665 | --- a/drivers/gpu/drm/i915/intel_pm.c |
666 | +++ b/drivers/gpu/drm/i915/intel_pm.c |
667 | @@ -9194,6 +9194,17 @@ static void icl_init_clock_gating(struct drm_i915_private *dev_priv) |
668 | /* WaEnable32PlaneMode:icl */ |
669 | I915_WRITE(GEN9_CSFE_CHICKEN1_RCS, |
670 | _MASKED_BIT_ENABLE(GEN11_ENABLE_32_PLANE_MODE)); |
671 | + |
672 | + /* |
673 | + * Wa_1408615072:icl,ehl (vsunit) |
674 | + * Wa_1407596294:icl,ehl (hsunit) |
675 | + */ |
676 | + intel_uncore_rmw(&dev_priv->uncore, UNSLICE_UNIT_LEVEL_CLKGATE, |
677 | + 0, VSUNIT_CLKGATE_DIS | HSUNIT_CLKGATE_DIS); |
678 | + |
679 | + /* Wa_1407352427:icl,ehl */ |
680 | + intel_uncore_rmw(&dev_priv->uncore, UNSLICE_UNIT_LEVEL_CLKGATE2, |
681 | + 0, PSDUNIT_CLKGATE_DIS); |
682 | } |
683 | |
684 | static void cnp_init_clock_gating(struct drm_i915_private *dev_priv) |
685 | diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c |
686 | index b89439ed210d..27c80c9e2b83 100644 |
687 | --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c |
688 | +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c |
689 | @@ -488,7 +488,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, |
690 | |
691 | WARN_ON(!tcon->quirks->has_channel_0); |
692 | |
693 | - tcon->dclk_min_div = 1; |
694 | + tcon->dclk_min_div = tcon->quirks->dclk_min_div; |
695 | tcon->dclk_max_div = 127; |
696 | sun4i_tcon0_mode_set_common(tcon, mode); |
697 | |
698 | @@ -1425,12 +1425,14 @@ static int sun8i_r40_tcon_tv_set_mux(struct sun4i_tcon *tcon, |
699 | static const struct sun4i_tcon_quirks sun4i_a10_quirks = { |
700 | .has_channel_0 = true, |
701 | .has_channel_1 = true, |
702 | + .dclk_min_div = 4, |
703 | .set_mux = sun4i_a10_tcon_set_mux, |
704 | }; |
705 | |
706 | static const struct sun4i_tcon_quirks sun5i_a13_quirks = { |
707 | .has_channel_0 = true, |
708 | .has_channel_1 = true, |
709 | + .dclk_min_div = 4, |
710 | .set_mux = sun5i_a13_tcon_set_mux, |
711 | }; |
712 | |
713 | @@ -1439,6 +1441,7 @@ static const struct sun4i_tcon_quirks sun6i_a31_quirks = { |
714 | .has_channel_1 = true, |
715 | .has_lvds_alt = true, |
716 | .needs_de_be_mux = true, |
717 | + .dclk_min_div = 1, |
718 | .set_mux = sun6i_tcon_set_mux, |
719 | }; |
720 | |
721 | @@ -1446,11 +1449,13 @@ static const struct sun4i_tcon_quirks sun6i_a31s_quirks = { |
722 | .has_channel_0 = true, |
723 | .has_channel_1 = true, |
724 | .needs_de_be_mux = true, |
725 | + .dclk_min_div = 1, |
726 | }; |
727 | |
728 | static const struct sun4i_tcon_quirks sun7i_a20_quirks = { |
729 | .has_channel_0 = true, |
730 | .has_channel_1 = true, |
731 | + .dclk_min_div = 4, |
732 | /* Same display pipeline structure as A10 */ |
733 | .set_mux = sun4i_a10_tcon_set_mux, |
734 | }; |
735 | @@ -1458,11 +1463,13 @@ static const struct sun4i_tcon_quirks sun7i_a20_quirks = { |
736 | static const struct sun4i_tcon_quirks sun8i_a33_quirks = { |
737 | .has_channel_0 = true, |
738 | .has_lvds_alt = true, |
739 | + .dclk_min_div = 1, |
740 | }; |
741 | |
742 | static const struct sun4i_tcon_quirks sun8i_a83t_lcd_quirks = { |
743 | .supports_lvds = true, |
744 | .has_channel_0 = true, |
745 | + .dclk_min_div = 1, |
746 | }; |
747 | |
748 | static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = { |
749 | @@ -1476,11 +1483,13 @@ static const struct sun4i_tcon_quirks sun8i_r40_tv_quirks = { |
750 | |
751 | static const struct sun4i_tcon_quirks sun8i_v3s_quirks = { |
752 | .has_channel_0 = true, |
753 | + .dclk_min_div = 1, |
754 | }; |
755 | |
756 | static const struct sun4i_tcon_quirks sun9i_a80_tcon_lcd_quirks = { |
757 | - .has_channel_0 = true, |
758 | - .needs_edp_reset = true, |
759 | + .has_channel_0 = true, |
760 | + .needs_edp_reset = true, |
761 | + .dclk_min_div = 1, |
762 | }; |
763 | |
764 | static const struct sun4i_tcon_quirks sun9i_a80_tcon_tv_quirks = { |
765 | diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h |
766 | index f9f1fe80b206..a62ec826ae71 100644 |
767 | --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h |
768 | +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h |
769 | @@ -224,6 +224,7 @@ struct sun4i_tcon_quirks { |
770 | bool needs_de_be_mux; /* sun6i needs mux to select backend */ |
771 | bool needs_edp_reset; /* a80 edp reset needed for tcon0 access */ |
772 | bool supports_lvds; /* Does the TCON support an LVDS output? */ |
773 | + u8 dclk_min_div; /* minimum divider for TCON0 DCLK */ |
774 | |
775 | /* callback to handle tcon muxing options */ |
776 | int (*set_mux)(struct sun4i_tcon *, const struct drm_encoder *); |
777 | diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
778 | index e0b241bd3070..851fe54ea59e 100644 |
779 | --- a/drivers/hid/hid-core.c |
780 | +++ b/drivers/hid/hid-core.c |
781 | @@ -288,6 +288,12 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign |
782 | offset = report->size; |
783 | report->size += parser->global.report_size * parser->global.report_count; |
784 | |
785 | + /* Total size check: Allow for possible report index byte */ |
786 | + if (report->size > (HID_MAX_BUFFER_SIZE - 1) << 3) { |
787 | + hid_err(parser->device, "report is too long\n"); |
788 | + return -1; |
789 | + } |
790 | + |
791 | if (!parser->local.usage_index) /* Ignore padding fields */ |
792 | return 0; |
793 | |
794 | diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c |
795 | index 63855f275a38..dea9cc65bf80 100644 |
796 | --- a/drivers/hid/hid-input.c |
797 | +++ b/drivers/hid/hid-input.c |
798 | @@ -1132,9 +1132,15 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel |
799 | } |
800 | |
801 | mapped: |
802 | - if (device->driver->input_mapped && device->driver->input_mapped(device, |
803 | - hidinput, field, usage, &bit, &max) < 0) |
804 | - goto ignore; |
805 | + if (device->driver->input_mapped && |
806 | + device->driver->input_mapped(device, hidinput, field, usage, |
807 | + &bit, &max) < 0) { |
808 | + /* |
809 | + * The driver indicated that no further generic handling |
810 | + * of the usage is desired. |
811 | + */ |
812 | + return; |
813 | + } |
814 | |
815 | set_bit(usage->type, input->evbit); |
816 | |
817 | @@ -1215,9 +1221,11 @@ mapped: |
818 | set_bit(MSC_SCAN, input->mscbit); |
819 | } |
820 | |
821 | -ignore: |
822 | return; |
823 | |
824 | +ignore: |
825 | + usage->type = 0; |
826 | + usage->code = 0; |
827 | } |
828 | |
829 | static void hidinput_handle_scroll(struct hid_usage *usage, |
830 | diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c |
831 | index bbc6ec1aa5cb..c25e95c19cad 100644 |
832 | --- a/drivers/hid/hidraw.c |
833 | +++ b/drivers/hid/hidraw.c |
834 | @@ -252,10 +252,10 @@ static __poll_t hidraw_poll(struct file *file, poll_table *wait) |
835 | |
836 | poll_wait(file, &list->hidraw->wait, wait); |
837 | if (list->head != list->tail) |
838 | - return EPOLLIN | EPOLLRDNORM | EPOLLOUT; |
839 | + return EPOLLIN | EPOLLRDNORM; |
840 | if (!list->hidraw->exist) |
841 | return EPOLLERR | EPOLLHUP; |
842 | - return 0; |
843 | + return EPOLLOUT | EPOLLWRNORM; |
844 | } |
845 | |
846 | static int hidraw_open(struct inode *inode, struct file *file) |
847 | diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c |
848 | index fa0cc0899827..935c3d0a3b63 100644 |
849 | --- a/drivers/hid/uhid.c |
850 | +++ b/drivers/hid/uhid.c |
851 | @@ -772,7 +772,7 @@ static __poll_t uhid_char_poll(struct file *file, poll_table *wait) |
852 | if (uhid->head != uhid->tail) |
853 | return EPOLLIN | EPOLLRDNORM; |
854 | |
855 | - return 0; |
856 | + return EPOLLOUT | EPOLLWRNORM; |
857 | } |
858 | |
859 | static const struct file_operations uhid_fops = { |
860 | diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c |
861 | index 1f9bc4483465..c879b214a479 100644 |
862 | --- a/drivers/hid/usbhid/hiddev.c |
863 | +++ b/drivers/hid/usbhid/hiddev.c |
864 | @@ -241,12 +241,51 @@ static int hiddev_release(struct inode * inode, struct file * file) |
865 | return 0; |
866 | } |
867 | |
868 | +static int __hiddev_open(struct hiddev *hiddev, struct file *file) |
869 | +{ |
870 | + struct hiddev_list *list; |
871 | + int error; |
872 | + |
873 | + lockdep_assert_held(&hiddev->existancelock); |
874 | + |
875 | + list = vzalloc(sizeof(*list)); |
876 | + if (!list) |
877 | + return -ENOMEM; |
878 | + |
879 | + mutex_init(&list->thread_lock); |
880 | + list->hiddev = hiddev; |
881 | + |
882 | + if (!hiddev->open++) { |
883 | + error = hid_hw_power(hiddev->hid, PM_HINT_FULLON); |
884 | + if (error < 0) |
885 | + goto err_drop_count; |
886 | + |
887 | + error = hid_hw_open(hiddev->hid); |
888 | + if (error < 0) |
889 | + goto err_normal_power; |
890 | + } |
891 | + |
892 | + spin_lock_irq(&hiddev->list_lock); |
893 | + list_add_tail(&list->node, &hiddev->list); |
894 | + spin_unlock_irq(&hiddev->list_lock); |
895 | + |
896 | + file->private_data = list; |
897 | + |
898 | + return 0; |
899 | + |
900 | +err_normal_power: |
901 | + hid_hw_power(hiddev->hid, PM_HINT_NORMAL); |
902 | +err_drop_count: |
903 | + hiddev->open--; |
904 | + vfree(list); |
905 | + return error; |
906 | +} |
907 | + |
908 | /* |
909 | * open file op |
910 | */ |
911 | static int hiddev_open(struct inode *inode, struct file *file) |
912 | { |
913 | - struct hiddev_list *list; |
914 | struct usb_interface *intf; |
915 | struct hid_device *hid; |
916 | struct hiddev *hiddev; |
917 | @@ -255,66 +294,14 @@ static int hiddev_open(struct inode *inode, struct file *file) |
918 | intf = usbhid_find_interface(iminor(inode)); |
919 | if (!intf) |
920 | return -ENODEV; |
921 | + |
922 | hid = usb_get_intfdata(intf); |
923 | hiddev = hid->hiddev; |
924 | |
925 | - if (!(list = vzalloc(sizeof(struct hiddev_list)))) |
926 | - return -ENOMEM; |
927 | - mutex_init(&list->thread_lock); |
928 | - list->hiddev = hiddev; |
929 | - file->private_data = list; |
930 | - |
931 | - /* |
932 | - * no need for locking because the USB major number |
933 | - * is shared which usbcore guards against disconnect |
934 | - */ |
935 | - if (list->hiddev->exist) { |
936 | - if (!list->hiddev->open++) { |
937 | - res = hid_hw_open(hiddev->hid); |
938 | - if (res < 0) |
939 | - goto bail; |
940 | - } |
941 | - } else { |
942 | - res = -ENODEV; |
943 | - goto bail; |
944 | - } |
945 | - |
946 | - spin_lock_irq(&list->hiddev->list_lock); |
947 | - list_add_tail(&list->node, &hiddev->list); |
948 | - spin_unlock_irq(&list->hiddev->list_lock); |
949 | - |
950 | mutex_lock(&hiddev->existancelock); |
951 | - /* |
952 | - * recheck exist with existance lock held to |
953 | - * avoid opening a disconnected device |
954 | - */ |
955 | - if (!list->hiddev->exist) { |
956 | - res = -ENODEV; |
957 | - goto bail_unlock; |
958 | - } |
959 | - if (!list->hiddev->open++) |
960 | - if (list->hiddev->exist) { |
961 | - struct hid_device *hid = hiddev->hid; |
962 | - res = hid_hw_power(hid, PM_HINT_FULLON); |
963 | - if (res < 0) |
964 | - goto bail_unlock; |
965 | - res = hid_hw_open(hid); |
966 | - if (res < 0) |
967 | - goto bail_normal_power; |
968 | - } |
969 | - mutex_unlock(&hiddev->existancelock); |
970 | - return 0; |
971 | -bail_normal_power: |
972 | - hid_hw_power(hid, PM_HINT_NORMAL); |
973 | -bail_unlock: |
974 | + res = hiddev->exist ? __hiddev_open(hiddev, file) : -ENODEV; |
975 | mutex_unlock(&hiddev->existancelock); |
976 | |
977 | - spin_lock_irq(&list->hiddev->list_lock); |
978 | - list_del(&list->node); |
979 | - spin_unlock_irq(&list->hiddev->list_lock); |
980 | -bail: |
981 | - file->private_data = NULL; |
982 | - vfree(list); |
983 | return res; |
984 | } |
985 | |
986 | diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c |
987 | index 5f6a4985f2bc..810a942eaa8e 100644 |
988 | --- a/drivers/i2c/i2c-core-base.c |
989 | +++ b/drivers/i2c/i2c-core-base.c |
990 | @@ -186,10 +186,11 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap) |
991 | * If we can set SDA, we will always create a STOP to ensure additional |
992 | * pulses will do no harm. This is achieved by letting SDA follow SCL |
993 | * half a cycle later. Check the 'incomplete_write_byte' fault injector |
994 | - * for details. |
995 | + * for details. Note that we must honour tsu:sto, 4us, but lets use 5us |
996 | + * here for simplicity. |
997 | */ |
998 | bri->set_scl(adap, scl); |
999 | - ndelay(RECOVERY_NDELAY / 2); |
1000 | + ndelay(RECOVERY_NDELAY); |
1001 | if (bri->set_sda) |
1002 | bri->set_sda(adap, scl); |
1003 | ndelay(RECOVERY_NDELAY / 2); |
1004 | @@ -211,7 +212,13 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap) |
1005 | scl = !scl; |
1006 | bri->set_scl(adap, scl); |
1007 | /* Creating STOP again, see above */ |
1008 | - ndelay(RECOVERY_NDELAY / 2); |
1009 | + if (scl) { |
1010 | + /* Honour minimum tsu:sto */ |
1011 | + ndelay(RECOVERY_NDELAY); |
1012 | + } else { |
1013 | + /* Honour minimum tf and thd:dat */ |
1014 | + ndelay(RECOVERY_NDELAY / 2); |
1015 | + } |
1016 | if (bri->set_sda) |
1017 | bri->set_sda(adap, scl); |
1018 | ndelay(RECOVERY_NDELAY / 2); |
1019 | diff --git a/drivers/infiniband/hw/hfi1/tid_rdma.c b/drivers/infiniband/hw/hfi1/tid_rdma.c |
1020 | index e53f542b60af..8a2e0d9351e9 100644 |
1021 | --- a/drivers/infiniband/hw/hfi1/tid_rdma.c |
1022 | +++ b/drivers/infiniband/hw/hfi1/tid_rdma.c |
1023 | @@ -4633,6 +4633,15 @@ void hfi1_rc_rcv_tid_rdma_ack(struct hfi1_packet *packet) |
1024 | */ |
1025 | fpsn = full_flow_psn(flow, flow->flow_state.spsn); |
1026 | req->r_ack_psn = psn; |
1027 | + /* |
1028 | + * If resync_psn points to the last flow PSN for a |
1029 | + * segment and the new segment (likely from a new |
1030 | + * request) starts with a new generation number, we |
1031 | + * need to adjust resync_psn accordingly. |
1032 | + */ |
1033 | + if (flow->flow_state.generation != |
1034 | + (resync_psn >> HFI1_KDETH_BTH_SEQ_SHIFT)) |
1035 | + resync_psn = mask_psn(fpsn - 1); |
1036 | flow->resync_npkts += |
1037 | delta_psn(mask_psn(resync_psn + 1), fpsn); |
1038 | /* |
1039 | diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c |
1040 | index d7dd6fcf2db0..f918fca9ada3 100644 |
1041 | --- a/drivers/input/evdev.c |
1042 | +++ b/drivers/input/evdev.c |
1043 | @@ -224,13 +224,13 @@ static void __pass_event(struct evdev_client *client, |
1044 | */ |
1045 | client->tail = (client->head - 2) & (client->bufsize - 1); |
1046 | |
1047 | - client->buffer[client->tail].input_event_sec = |
1048 | - event->input_event_sec; |
1049 | - client->buffer[client->tail].input_event_usec = |
1050 | - event->input_event_usec; |
1051 | - client->buffer[client->tail].type = EV_SYN; |
1052 | - client->buffer[client->tail].code = SYN_DROPPED; |
1053 | - client->buffer[client->tail].value = 0; |
1054 | + client->buffer[client->tail] = (struct input_event) { |
1055 | + .input_event_sec = event->input_event_sec, |
1056 | + .input_event_usec = event->input_event_usec, |
1057 | + .type = EV_SYN, |
1058 | + .code = SYN_DROPPED, |
1059 | + .value = 0, |
1060 | + }; |
1061 | |
1062 | client->packet_head = client->tail; |
1063 | } |
1064 | diff --git a/drivers/input/input.c b/drivers/input/input.c |
1065 | index 55086279d044..ee6c3234df36 100644 |
1066 | --- a/drivers/input/input.c |
1067 | +++ b/drivers/input/input.c |
1068 | @@ -878,16 +878,18 @@ static int input_default_setkeycode(struct input_dev *dev, |
1069 | } |
1070 | } |
1071 | |
1072 | - __clear_bit(*old_keycode, dev->keybit); |
1073 | - __set_bit(ke->keycode, dev->keybit); |
1074 | - |
1075 | - for (i = 0; i < dev->keycodemax; i++) { |
1076 | - if (input_fetch_keycode(dev, i) == *old_keycode) { |
1077 | - __set_bit(*old_keycode, dev->keybit); |
1078 | - break; /* Setting the bit twice is useless, so break */ |
1079 | + if (*old_keycode <= KEY_MAX) { |
1080 | + __clear_bit(*old_keycode, dev->keybit); |
1081 | + for (i = 0; i < dev->keycodemax; i++) { |
1082 | + if (input_fetch_keycode(dev, i) == *old_keycode) { |
1083 | + __set_bit(*old_keycode, dev->keybit); |
1084 | + /* Setting the bit twice is useless, so break */ |
1085 | + break; |
1086 | + } |
1087 | } |
1088 | } |
1089 | |
1090 | + __set_bit(ke->keycode, dev->keybit); |
1091 | return 0; |
1092 | } |
1093 | |
1094 | @@ -943,9 +945,13 @@ int input_set_keycode(struct input_dev *dev, |
1095 | * Simulate keyup event if keycode is not present |
1096 | * in the keymap anymore |
1097 | */ |
1098 | - if (test_bit(EV_KEY, dev->evbit) && |
1099 | - !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && |
1100 | - __test_and_clear_bit(old_keycode, dev->key)) { |
1101 | + if (old_keycode > KEY_MAX) { |
1102 | + dev_warn(dev->dev.parent ?: &dev->dev, |
1103 | + "%s: got too big old keycode %#x\n", |
1104 | + __func__, old_keycode); |
1105 | + } else if (test_bit(EV_KEY, dev->evbit) && |
1106 | + !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && |
1107 | + __test_and_clear_bit(old_keycode, dev->key)) { |
1108 | struct input_value vals[] = { |
1109 | { EV_KEY, old_keycode, 0 }, |
1110 | input_value_sync |
1111 | diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c |
1112 | index 84051f20b18a..002654ec7040 100644 |
1113 | --- a/drivers/input/misc/uinput.c |
1114 | +++ b/drivers/input/misc/uinput.c |
1115 | @@ -74,12 +74,16 @@ static int uinput_dev_event(struct input_dev *dev, |
1116 | struct uinput_device *udev = input_get_drvdata(dev); |
1117 | struct timespec64 ts; |
1118 | |
1119 | - udev->buff[udev->head].type = type; |
1120 | - udev->buff[udev->head].code = code; |
1121 | - udev->buff[udev->head].value = value; |
1122 | ktime_get_ts64(&ts); |
1123 | - udev->buff[udev->head].input_event_sec = ts.tv_sec; |
1124 | - udev->buff[udev->head].input_event_usec = ts.tv_nsec / NSEC_PER_USEC; |
1125 | + |
1126 | + udev->buff[udev->head] = (struct input_event) { |
1127 | + .input_event_sec = ts.tv_sec, |
1128 | + .input_event_usec = ts.tv_nsec / NSEC_PER_USEC, |
1129 | + .type = type, |
1130 | + .code = code, |
1131 | + .value = value, |
1132 | + }; |
1133 | + |
1134 | udev->head = (udev->head + 1) % UINPUT_BUFFER_SIZE; |
1135 | |
1136 | wake_up_interruptible(&udev->waitq); |
1137 | diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
1138 | index 4ce797d4259f..67aa317de6db 100644 |
1139 | --- a/drivers/iommu/intel-iommu.c |
1140 | +++ b/drivers/iommu/intel-iommu.c |
1141 | @@ -5786,6 +5786,13 @@ static void intel_iommu_apply_resv_region(struct device *dev, |
1142 | WARN_ON_ONCE(!reserve_iova(&dmar_domain->iovad, start, end)); |
1143 | } |
1144 | |
1145 | +static struct iommu_group *intel_iommu_device_group(struct device *dev) |
1146 | +{ |
1147 | + if (dev_is_pci(dev)) |
1148 | + return pci_device_group(dev); |
1149 | + return generic_device_group(dev); |
1150 | +} |
1151 | + |
1152 | #ifdef CONFIG_INTEL_IOMMU_SVM |
1153 | struct intel_iommu *intel_svm_device_to_iommu(struct device *dev) |
1154 | { |
1155 | @@ -5958,7 +5965,7 @@ const struct iommu_ops intel_iommu_ops = { |
1156 | .get_resv_regions = intel_iommu_get_resv_regions, |
1157 | .put_resv_regions = intel_iommu_put_resv_regions, |
1158 | .apply_resv_region = intel_iommu_apply_resv_region, |
1159 | - .device_group = pci_device_group, |
1160 | + .device_group = intel_iommu_device_group, |
1161 | .dev_has_feat = intel_iommu_dev_has_feat, |
1162 | .dev_feat_enabled = intel_iommu_dev_feat_enabled, |
1163 | .dev_enable_feat = intel_iommu_dev_enable_feat, |
1164 | diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c |
1165 | index d5d4bfa9c8fd..d797912e665a 100644 |
1166 | --- a/drivers/net/can/m_can/tcan4x5x.c |
1167 | +++ b/drivers/net/can/m_can/tcan4x5x.c |
1168 | @@ -445,6 +445,10 @@ static int tcan4x5x_can_probe(struct spi_device *spi) |
1169 | |
1170 | tcan4x5x_power_enable(priv->power, 1); |
1171 | |
1172 | + ret = tcan4x5x_init(mcan_class); |
1173 | + if (ret) |
1174 | + goto out_power; |
1175 | + |
1176 | ret = m_can_class_register(mcan_class); |
1177 | if (ret) |
1178 | goto out_power; |
1179 | diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c |
1180 | index 8caf7af0dee2..99101d7027a8 100644 |
1181 | --- a/drivers/net/can/mscan/mscan.c |
1182 | +++ b/drivers/net/can/mscan/mscan.c |
1183 | @@ -381,13 +381,12 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota) |
1184 | struct net_device *dev = napi->dev; |
1185 | struct mscan_regs __iomem *regs = priv->reg_base; |
1186 | struct net_device_stats *stats = &dev->stats; |
1187 | - int npackets = 0; |
1188 | - int ret = 1; |
1189 | + int work_done = 0; |
1190 | struct sk_buff *skb; |
1191 | struct can_frame *frame; |
1192 | u8 canrflg; |
1193 | |
1194 | - while (npackets < quota) { |
1195 | + while (work_done < quota) { |
1196 | canrflg = in_8(®s->canrflg); |
1197 | if (!(canrflg & (MSCAN_RXF | MSCAN_ERR_IF))) |
1198 | break; |
1199 | @@ -408,18 +407,18 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota) |
1200 | |
1201 | stats->rx_packets++; |
1202 | stats->rx_bytes += frame->can_dlc; |
1203 | - npackets++; |
1204 | + work_done++; |
1205 | netif_receive_skb(skb); |
1206 | } |
1207 | |
1208 | - if (!(in_8(®s->canrflg) & (MSCAN_RXF | MSCAN_ERR_IF))) { |
1209 | - napi_complete(&priv->napi); |
1210 | - clear_bit(F_RX_PROGRESS, &priv->flags); |
1211 | - if (priv->can.state < CAN_STATE_BUS_OFF) |
1212 | - out_8(®s->canrier, priv->shadow_canrier); |
1213 | - ret = 0; |
1214 | + if (work_done < quota) { |
1215 | + if (likely(napi_complete_done(&priv->napi, work_done))) { |
1216 | + clear_bit(F_RX_PROGRESS, &priv->flags); |
1217 | + if (priv->can.state < CAN_STATE_BUS_OFF) |
1218 | + out_8(®s->canrier, priv->shadow_canrier); |
1219 | + } |
1220 | } |
1221 | - return ret; |
1222 | + return work_done; |
1223 | } |
1224 | |
1225 | static irqreturn_t mscan_isr(int irq, void *dev_id) |
1226 | diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c |
1227 | index 2f74f6704c12..a4b4b742c80c 100644 |
1228 | --- a/drivers/net/can/usb/gs_usb.c |
1229 | +++ b/drivers/net/can/usb/gs_usb.c |
1230 | @@ -918,7 +918,7 @@ static int gs_usb_probe(struct usb_interface *intf, |
1231 | GS_USB_BREQ_HOST_FORMAT, |
1232 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, |
1233 | 1, |
1234 | - intf->altsetting[0].desc.bInterfaceNumber, |
1235 | + intf->cur_altsetting->desc.bInterfaceNumber, |
1236 | hconf, |
1237 | sizeof(*hconf), |
1238 | 1000); |
1239 | @@ -941,7 +941,7 @@ static int gs_usb_probe(struct usb_interface *intf, |
1240 | GS_USB_BREQ_DEVICE_CONFIG, |
1241 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, |
1242 | 1, |
1243 | - intf->altsetting[0].desc.bInterfaceNumber, |
1244 | + intf->cur_altsetting->desc.bInterfaceNumber, |
1245 | dconf, |
1246 | sizeof(*dconf), |
1247 | 1000); |
1248 | diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c |
1249 | index 5fc0be564274..7ab87a758754 100644 |
1250 | --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c |
1251 | +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c |
1252 | @@ -1590,7 +1590,7 @@ static int kvaser_usb_hydra_setup_endpoints(struct kvaser_usb *dev) |
1253 | struct usb_endpoint_descriptor *ep; |
1254 | int i; |
1255 | |
1256 | - iface_desc = &dev->intf->altsetting[0]; |
1257 | + iface_desc = dev->intf->cur_altsetting; |
1258 | |
1259 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { |
1260 | ep = &iface_desc->endpoint[i].desc; |
1261 | diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c |
1262 | index ae4c37e1bb75..1b9957f12459 100644 |
1263 | --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c |
1264 | +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c |
1265 | @@ -1310,7 +1310,7 @@ static int kvaser_usb_leaf_setup_endpoints(struct kvaser_usb *dev) |
1266 | struct usb_endpoint_descriptor *endpoint; |
1267 | int i; |
1268 | |
1269 | - iface_desc = &dev->intf->altsetting[0]; |
1270 | + iface_desc = dev->intf->cur_altsetting; |
1271 | |
1272 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { |
1273 | endpoint = &iface_desc->endpoint[i].desc; |
1274 | diff --git a/drivers/net/wireless/ath/ath10k/usb.c b/drivers/net/wireless/ath/ath10k/usb.c |
1275 | index 9ebe74ee4aef..1e0343081be9 100644 |
1276 | --- a/drivers/net/wireless/ath/ath10k/usb.c |
1277 | +++ b/drivers/net/wireless/ath/ath10k/usb.c |
1278 | @@ -443,6 +443,7 @@ static int ath10k_usb_hif_tx_sg(struct ath10k *ar, u8 pipe_id, |
1279 | ath10k_dbg(ar, ATH10K_DBG_USB_BULK, |
1280 | "usb bulk transmit failed: %d\n", ret); |
1281 | usb_unanchor_urb(urb); |
1282 | + usb_free_urb(urb); |
1283 | ret = -EINVAL; |
1284 | goto err_free_urb_to_pipe; |
1285 | } |
1286 | diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c |
1287 | index 096334e941a1..fc1706d0647d 100644 |
1288 | --- a/drivers/net/wireless/marvell/mwifiex/pcie.c |
1289 | +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c |
1290 | @@ -1032,8 +1032,10 @@ static int mwifiex_pcie_alloc_cmdrsp_buf(struct mwifiex_adapter *adapter) |
1291 | } |
1292 | skb_put(skb, MWIFIEX_UPLD_SIZE); |
1293 | if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, |
1294 | - PCI_DMA_FROMDEVICE)) |
1295 | + PCI_DMA_FROMDEVICE)) { |
1296 | + kfree_skb(skb); |
1297 | return -1; |
1298 | + } |
1299 | |
1300 | card->cmdrsp_buf = skb; |
1301 | |
1302 | diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c |
1303 | index 74e50566db1f..6dd835f1efc2 100644 |
1304 | --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c |
1305 | +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c |
1306 | @@ -229,6 +229,14 @@ static int mwifiex_process_country_ie(struct mwifiex_private *priv, |
1307 | "11D: skip setting domain info in FW\n"); |
1308 | return 0; |
1309 | } |
1310 | + |
1311 | + if (country_ie_len > |
1312 | + (IEEE80211_COUNTRY_STRING_LEN + MWIFIEX_MAX_TRIPLET_802_11D)) { |
1313 | + mwifiex_dbg(priv->adapter, ERROR, |
1314 | + "11D: country_ie_len overflow!, deauth AP\n"); |
1315 | + return -EINVAL; |
1316 | + } |
1317 | + |
1318 | memcpy(priv->adapter->country_code, &country_ie[2], 2); |
1319 | |
1320 | domain_info->country_code[0] = country_ie[2]; |
1321 | @@ -272,8 +280,9 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, |
1322 | priv->scan_block = false; |
1323 | |
1324 | if (bss) { |
1325 | - if (adapter->region_code == 0x00) |
1326 | - mwifiex_process_country_ie(priv, bss); |
1327 | + if (adapter->region_code == 0x00 && |
1328 | + mwifiex_process_country_ie(priv, bss)) |
1329 | + return -EINVAL; |
1330 | |
1331 | /* Allocate and fill new bss descriptor */ |
1332 | bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor), |
1333 | diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |
1334 | index 361248e97568..e7d96ac673b7 100644 |
1335 | --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |
1336 | +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |
1337 | @@ -5447,6 +5447,7 @@ static int rtl8xxxu_submit_int_urb(struct ieee80211_hw *hw) |
1338 | ret = usb_submit_urb(urb, GFP_KERNEL); |
1339 | if (ret) { |
1340 | usb_unanchor_urb(urb); |
1341 | + usb_free_urb(urb); |
1342 | goto error; |
1343 | } |
1344 | |
1345 | diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c |
1346 | index ead06c6c2601..9a38741d3546 100644 |
1347 | --- a/drivers/phy/motorola/phy-cpcap-usb.c |
1348 | +++ b/drivers/phy/motorola/phy-cpcap-usb.c |
1349 | @@ -207,6 +207,19 @@ static int cpcap_phy_get_ints_state(struct cpcap_phy_ddata *ddata, |
1350 | static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata); |
1351 | static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata); |
1352 | |
1353 | +static void cpcap_usb_try_musb_mailbox(struct cpcap_phy_ddata *ddata, |
1354 | + enum musb_vbus_id_status status) |
1355 | +{ |
1356 | + int error; |
1357 | + |
1358 | + error = musb_mailbox(status); |
1359 | + if (!error) |
1360 | + return; |
1361 | + |
1362 | + dev_dbg(ddata->dev, "%s: musb_mailbox failed: %i\n", |
1363 | + __func__, error); |
1364 | +} |
1365 | + |
1366 | static void cpcap_usb_detect(struct work_struct *work) |
1367 | { |
1368 | struct cpcap_phy_ddata *ddata; |
1369 | @@ -226,9 +239,7 @@ static void cpcap_usb_detect(struct work_struct *work) |
1370 | if (error) |
1371 | goto out_err; |
1372 | |
1373 | - error = musb_mailbox(MUSB_ID_GROUND); |
1374 | - if (error) |
1375 | - goto out_err; |
1376 | + cpcap_usb_try_musb_mailbox(ddata, MUSB_ID_GROUND); |
1377 | |
1378 | error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC3, |
1379 | CPCAP_BIT_VBUSSTBY_EN | |
1380 | @@ -257,9 +268,7 @@ static void cpcap_usb_detect(struct work_struct *work) |
1381 | error = cpcap_usb_set_usb_mode(ddata); |
1382 | if (error) |
1383 | goto out_err; |
1384 | - error = musb_mailbox(MUSB_ID_GROUND); |
1385 | - if (error) |
1386 | - goto out_err; |
1387 | + cpcap_usb_try_musb_mailbox(ddata, MUSB_ID_GROUND); |
1388 | |
1389 | return; |
1390 | } |
1391 | @@ -269,22 +278,18 @@ static void cpcap_usb_detect(struct work_struct *work) |
1392 | error = cpcap_usb_set_usb_mode(ddata); |
1393 | if (error) |
1394 | goto out_err; |
1395 | - error = musb_mailbox(MUSB_VBUS_VALID); |
1396 | - if (error) |
1397 | - goto out_err; |
1398 | + cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_VALID); |
1399 | |
1400 | return; |
1401 | } |
1402 | |
1403 | + cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_OFF); |
1404 | + |
1405 | /* Default to debug UART mode */ |
1406 | error = cpcap_usb_set_uart_mode(ddata); |
1407 | if (error) |
1408 | goto out_err; |
1409 | |
1410 | - error = musb_mailbox(MUSB_VBUS_OFF); |
1411 | - if (error) |
1412 | - goto out_err; |
1413 | - |
1414 | dev_dbg(ddata->dev, "set UART mode\n"); |
1415 | |
1416 | return; |
1417 | @@ -649,9 +654,7 @@ static int cpcap_usb_phy_remove(struct platform_device *pdev) |
1418 | if (error) |
1419 | dev_err(ddata->dev, "could not set UART mode\n"); |
1420 | |
1421 | - error = musb_mailbox(MUSB_VBUS_OFF); |
1422 | - if (error) |
1423 | - dev_err(ddata->dev, "could not set mailbox\n"); |
1424 | + cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_OFF); |
1425 | |
1426 | usb_remove_phy(&ddata->phy); |
1427 | cancel_delayed_work_sync(&ddata->detect_work); |
1428 | diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c |
1429 | index 94ddd7d659c8..925b0004a0ed 100644 |
1430 | --- a/drivers/powercap/intel_rapl_common.c |
1431 | +++ b/drivers/powercap/intel_rapl_common.c |
1432 | @@ -1293,6 +1293,9 @@ struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv) |
1433 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
1434 | int ret; |
1435 | |
1436 | + if (!rapl_defaults) |
1437 | + return ERR_PTR(-ENODEV); |
1438 | + |
1439 | rp = kzalloc(sizeof(struct rapl_package), GFP_KERNEL); |
1440 | if (!rp) |
1441 | return ERR_PTR(-ENOMEM); |
1442 | diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c |
1443 | index eea5ebbb5119..c655074c07c2 100644 |
1444 | --- a/drivers/rpmsg/rpmsg_char.c |
1445 | +++ b/drivers/rpmsg/rpmsg_char.c |
1446 | @@ -227,8 +227,10 @@ static ssize_t rpmsg_eptdev_write_iter(struct kiocb *iocb, |
1447 | if (!kbuf) |
1448 | return -ENOMEM; |
1449 | |
1450 | - if (!copy_from_iter_full(kbuf, len, from)) |
1451 | - return -EFAULT; |
1452 | + if (!copy_from_iter_full(kbuf, len, from)) { |
1453 | + ret = -EFAULT; |
1454 | + goto free_kbuf; |
1455 | + } |
1456 | |
1457 | if (mutex_lock_interruptible(&eptdev->ept_lock)) { |
1458 | ret = -ERESTARTSYS; |
1459 | diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c |
1460 | index 5e2bd9f1d01e..fc32be687606 100644 |
1461 | --- a/drivers/rtc/rtc-sun6i.c |
1462 | +++ b/drivers/rtc/rtc-sun6i.c |
1463 | @@ -380,6 +380,22 @@ static void __init sun50i_h6_rtc_clk_init(struct device_node *node) |
1464 | CLK_OF_DECLARE_DRIVER(sun50i_h6_rtc_clk, "allwinner,sun50i-h6-rtc", |
1465 | sun50i_h6_rtc_clk_init); |
1466 | |
1467 | +/* |
1468 | + * The R40 user manual is self-conflicting on whether the prescaler is |
1469 | + * fixed or configurable. The clock diagram shows it as fixed, but there |
1470 | + * is also a configurable divider in the RTC block. |
1471 | + */ |
1472 | +static const struct sun6i_rtc_clk_data sun8i_r40_rtc_data = { |
1473 | + .rc_osc_rate = 16000000, |
1474 | + .fixed_prescaler = 512, |
1475 | +}; |
1476 | +static void __init sun8i_r40_rtc_clk_init(struct device_node *node) |
1477 | +{ |
1478 | + sun6i_rtc_clk_init(node, &sun8i_r40_rtc_data); |
1479 | +} |
1480 | +CLK_OF_DECLARE_DRIVER(sun8i_r40_rtc_clk, "allwinner,sun8i-r40-rtc", |
1481 | + sun8i_r40_rtc_clk_init); |
1482 | + |
1483 | static const struct sun6i_rtc_clk_data sun8i_v3_rtc_data = { |
1484 | .rc_osc_rate = 32000, |
1485 | .has_out_clk = 1, |
1486 | diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c |
1487 | index 29ab81df75c0..fbfce02e5b93 100644 |
1488 | --- a/drivers/scsi/bfa/bfad_attr.c |
1489 | +++ b/drivers/scsi/bfa/bfad_attr.c |
1490 | @@ -275,8 +275,10 @@ bfad_im_get_stats(struct Scsi_Host *shost) |
1491 | rc = bfa_port_get_stats(BFA_FCPORT(&bfad->bfa), |
1492 | fcstats, bfad_hcb_comp, &fcomp); |
1493 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
1494 | - if (rc != BFA_STATUS_OK) |
1495 | + if (rc != BFA_STATUS_OK) { |
1496 | + kfree(fcstats); |
1497 | return NULL; |
1498 | + } |
1499 | |
1500 | wait_for_completion(&fcomp.comp); |
1501 | |
1502 | diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c |
1503 | index dbff0f7e7cf5..ddc0dc93d08b 100644 |
1504 | --- a/drivers/staging/comedi/drivers/adv_pci1710.c |
1505 | +++ b/drivers/staging/comedi/drivers/adv_pci1710.c |
1506 | @@ -46,8 +46,8 @@ |
1507 | #define PCI171X_RANGE_UNI BIT(4) |
1508 | #define PCI171X_RANGE_GAIN(x) (((x) & 0x7) << 0) |
1509 | #define PCI171X_MUX_REG 0x04 /* W: A/D multiplexor control */ |
1510 | -#define PCI171X_MUX_CHANH(x) (((x) & 0xf) << 8) |
1511 | -#define PCI171X_MUX_CHANL(x) (((x) & 0xf) << 0) |
1512 | +#define PCI171X_MUX_CHANH(x) (((x) & 0xff) << 8) |
1513 | +#define PCI171X_MUX_CHANL(x) (((x) & 0xff) << 0) |
1514 | #define PCI171X_MUX_CHAN(x) (PCI171X_MUX_CHANH(x) | PCI171X_MUX_CHANL(x)) |
1515 | #define PCI171X_STATUS_REG 0x06 /* R: status register */ |
1516 | #define PCI171X_STATUS_IRQ BIT(11) /* 1=IRQ occurred */ |
1517 | diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c |
1518 | index a7cac0719b8b..b5d42f411dd8 100644 |
1519 | --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c |
1520 | +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c |
1521 | @@ -37,6 +37,7 @@ static const struct usb_device_id rtw_usb_id_tbl[] = { |
1522 | {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ |
1523 | {USB_DEVICE(0x2001, 0x331B)}, /* D-Link DWA-121 rev B1 */ |
1524 | {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ |
1525 | + {USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */ |
1526 | {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ |
1527 | {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ |
1528 | {} /* Terminating entry */ |
1529 | diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c |
1530 | index 8d19ae71e7cc..4e651b698617 100644 |
1531 | --- a/drivers/staging/vt6656/baseband.c |
1532 | +++ b/drivers/staging/vt6656/baseband.c |
1533 | @@ -449,8 +449,8 @@ int vnt_vt3184_init(struct vnt_private *priv) |
1534 | |
1535 | memcpy(array, addr, length); |
1536 | |
1537 | - ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0, |
1538 | - MESSAGE_REQUEST_BBREG, length, array); |
1539 | + ret = vnt_control_out_blocks(priv, VNT_REG_BLOCK_SIZE, |
1540 | + MESSAGE_REQUEST_BBREG, length, array); |
1541 | if (ret) |
1542 | goto end; |
1543 | |
1544 | diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c |
1545 | index 56cd77fd9ea0..7958fc165462 100644 |
1546 | --- a/drivers/staging/vt6656/card.c |
1547 | +++ b/drivers/staging/vt6656/card.c |
1548 | @@ -719,7 +719,7 @@ end: |
1549 | */ |
1550 | int vnt_radio_power_on(struct vnt_private *priv) |
1551 | { |
1552 | - int ret = true; |
1553 | + int ret = 0; |
1554 | |
1555 | vnt_exit_deep_sleep(priv); |
1556 | |
1557 | diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h |
1558 | index 6074ceda78bf..50e1c8918040 100644 |
1559 | --- a/drivers/staging/vt6656/device.h |
1560 | +++ b/drivers/staging/vt6656/device.h |
1561 | @@ -259,6 +259,7 @@ struct vnt_private { |
1562 | u8 mac_hw; |
1563 | /* netdev */ |
1564 | struct usb_device *usb; |
1565 | + struct usb_interface *intf; |
1566 | |
1567 | u64 tsf_time; |
1568 | u8 rx_rate; |
1569 | diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c |
1570 | index 856ba97aec4f..c26882e2bb80 100644 |
1571 | --- a/drivers/staging/vt6656/main_usb.c |
1572 | +++ b/drivers/staging/vt6656/main_usb.c |
1573 | @@ -950,7 +950,7 @@ static const struct ieee80211_ops vnt_mac_ops = { |
1574 | |
1575 | int vnt_init(struct vnt_private *priv) |
1576 | { |
1577 | - if (!(vnt_init_registers(priv))) |
1578 | + if (vnt_init_registers(priv)) |
1579 | return -EAGAIN; |
1580 | |
1581 | SET_IEEE80211_PERM_ADDR(priv->hw, priv->permanent_net_addr); |
1582 | @@ -993,6 +993,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) |
1583 | priv = hw->priv; |
1584 | priv->hw = hw; |
1585 | priv->usb = udev; |
1586 | + priv->intf = intf; |
1587 | |
1588 | vnt_set_options(priv); |
1589 | |
1590 | diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c |
1591 | index d3304df6bd53..d977d4777e4f 100644 |
1592 | --- a/drivers/staging/vt6656/usbpipe.c |
1593 | +++ b/drivers/staging/vt6656/usbpipe.c |
1594 | @@ -59,7 +59,9 @@ int vnt_control_out(struct vnt_private *priv, u8 request, u16 value, |
1595 | |
1596 | kfree(usb_buffer); |
1597 | |
1598 | - if (ret >= 0 && ret < (int)length) |
1599 | + if (ret == (int)length) |
1600 | + ret = 0; |
1601 | + else |
1602 | ret = -EIO; |
1603 | |
1604 | end_unlock: |
1605 | @@ -74,6 +76,23 @@ int vnt_control_out_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 data) |
1606 | reg_off, reg, sizeof(u8), &data); |
1607 | } |
1608 | |
1609 | +int vnt_control_out_blocks(struct vnt_private *priv, |
1610 | + u16 block, u8 reg, u16 length, u8 *data) |
1611 | +{ |
1612 | + int ret = 0, i; |
1613 | + |
1614 | + for (i = 0; i < length; i += block) { |
1615 | + u16 len = min_t(int, length - i, block); |
1616 | + |
1617 | + ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, |
1618 | + i, reg, len, data + i); |
1619 | + if (ret) |
1620 | + goto end; |
1621 | + } |
1622 | +end: |
1623 | + return ret; |
1624 | +} |
1625 | + |
1626 | int vnt_control_in(struct vnt_private *priv, u8 request, u16 value, |
1627 | u16 index, u16 length, u8 *buffer) |
1628 | { |
1629 | @@ -103,7 +122,9 @@ int vnt_control_in(struct vnt_private *priv, u8 request, u16 value, |
1630 | |
1631 | kfree(usb_buffer); |
1632 | |
1633 | - if (ret >= 0 && ret < (int)length) |
1634 | + if (ret == (int)length) |
1635 | + ret = 0; |
1636 | + else |
1637 | ret = -EIO; |
1638 | |
1639 | end_unlock: |
1640 | diff --git a/drivers/staging/vt6656/usbpipe.h b/drivers/staging/vt6656/usbpipe.h |
1641 | index 95147ec7b96a..b65d9c01a211 100644 |
1642 | --- a/drivers/staging/vt6656/usbpipe.h |
1643 | +++ b/drivers/staging/vt6656/usbpipe.h |
1644 | @@ -18,6 +18,8 @@ |
1645 | |
1646 | #include "device.h" |
1647 | |
1648 | +#define VNT_REG_BLOCK_SIZE 64 |
1649 | + |
1650 | int vnt_control_out(struct vnt_private *priv, u8 request, u16 value, |
1651 | u16 index, u16 length, u8 *buffer); |
1652 | int vnt_control_in(struct vnt_private *priv, u8 request, u16 value, |
1653 | @@ -26,6 +28,9 @@ int vnt_control_in(struct vnt_private *priv, u8 request, u16 value, |
1654 | int vnt_control_out_u8(struct vnt_private *priv, u8 reg, u8 ref_off, u8 data); |
1655 | int vnt_control_in_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 *data); |
1656 | |
1657 | +int vnt_control_out_blocks(struct vnt_private *priv, |
1658 | + u16 block, u8 reg, u16 len, u8 *data); |
1659 | + |
1660 | int vnt_start_interrupt_urb(struct vnt_private *priv); |
1661 | int vnt_submit_rx_urb(struct vnt_private *priv, struct vnt_rcb *rcb); |
1662 | int vnt_tx_context(struct vnt_private *priv, |
1663 | diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c |
1664 | index 3eb2f11a5de1..2c5250ca2801 100644 |
1665 | --- a/drivers/staging/vt6656/wcmd.c |
1666 | +++ b/drivers/staging/vt6656/wcmd.c |
1667 | @@ -99,6 +99,7 @@ void vnt_run_command(struct work_struct *work) |
1668 | if (vnt_init(priv)) { |
1669 | /* If fail all ends TODO retry */ |
1670 | dev_err(&priv->usb->dev, "failed to start\n"); |
1671 | + usb_set_intfdata(priv->intf, NULL); |
1672 | ieee80211_free_hw(priv->hw); |
1673 | return; |
1674 | } |
1675 | diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c |
1676 | index a0ac16ee6575..a9719858c950 100644 |
1677 | --- a/drivers/tty/serdev/core.c |
1678 | +++ b/drivers/tty/serdev/core.c |
1679 | @@ -582,6 +582,12 @@ static acpi_status acpi_serdev_register_device(struct serdev_controller *ctrl, |
1680 | return AE_OK; |
1681 | } |
1682 | |
1683 | +static const struct acpi_device_id serdev_acpi_devices_blacklist[] = { |
1684 | + { "INT3511", 0 }, |
1685 | + { "INT3512", 0 }, |
1686 | + { }, |
1687 | +}; |
1688 | + |
1689 | static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level, |
1690 | void *data, void **return_value) |
1691 | { |
1692 | @@ -591,6 +597,10 @@ static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level, |
1693 | if (acpi_bus_get_device(handle, &adev)) |
1694 | return AE_OK; |
1695 | |
1696 | + /* Skip if black listed */ |
1697 | + if (!acpi_match_device_ids(adev, serdev_acpi_devices_blacklist)) |
1698 | + return AE_OK; |
1699 | + |
1700 | return acpi_serdev_register_device(ctrl, adev); |
1701 | } |
1702 | |
1703 | diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c |
1704 | index b0a6eb106edb..7c2782785736 100644 |
1705 | --- a/drivers/tty/serial/serial_core.c |
1706 | +++ b/drivers/tty/serial/serial_core.c |
1707 | @@ -2834,6 +2834,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) |
1708 | if (uport->cons && uport->dev) |
1709 | of_console_check(uport->dev->of_node, uport->cons->name, uport->line); |
1710 | |
1711 | + tty_port_link_device(port, drv->tty_driver, uport->line); |
1712 | uart_configure_port(drv, state, uport); |
1713 | |
1714 | port->console = uart_console(uport); |
1715 | diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c |
1716 | index 4c1e75509303..02f6ca2cb1ba 100644 |
1717 | --- a/drivers/usb/cdns3/gadget.c |
1718 | +++ b/drivers/usb/cdns3/gadget.c |
1719 | @@ -1375,13 +1375,10 @@ static void cdns3_check_usb_interrupt_proceed(struct cdns3_device *priv_dev, |
1720 | */ |
1721 | static irqreturn_t cdns3_device_irq_handler(int irq, void *data) |
1722 | { |
1723 | - struct cdns3_device *priv_dev; |
1724 | - struct cdns3 *cdns = data; |
1725 | + struct cdns3_device *priv_dev = data; |
1726 | irqreturn_t ret = IRQ_NONE; |
1727 | u32 reg; |
1728 | |
1729 | - priv_dev = cdns->gadget_dev; |
1730 | - |
1731 | /* check USB device interrupt */ |
1732 | reg = readl(&priv_dev->regs->usb_ists); |
1733 | if (reg) { |
1734 | @@ -1419,14 +1416,12 @@ static irqreturn_t cdns3_device_irq_handler(int irq, void *data) |
1735 | */ |
1736 | static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data) |
1737 | { |
1738 | - struct cdns3_device *priv_dev; |
1739 | - struct cdns3 *cdns = data; |
1740 | + struct cdns3_device *priv_dev = data; |
1741 | irqreturn_t ret = IRQ_NONE; |
1742 | unsigned long flags; |
1743 | int bit; |
1744 | u32 reg; |
1745 | |
1746 | - priv_dev = cdns->gadget_dev; |
1747 | spin_lock_irqsave(&priv_dev->lock, flags); |
1748 | |
1749 | reg = readl(&priv_dev->regs->usb_ists); |
1750 | @@ -2539,7 +2534,7 @@ void cdns3_gadget_exit(struct cdns3 *cdns) |
1751 | |
1752 | priv_dev = cdns->gadget_dev; |
1753 | |
1754 | - devm_free_irq(cdns->dev, cdns->dev_irq, cdns); |
1755 | + devm_free_irq(cdns->dev, cdns->dev_irq, priv_dev); |
1756 | |
1757 | pm_runtime_mark_last_busy(cdns->dev); |
1758 | pm_runtime_put_autosuspend(cdns->dev); |
1759 | @@ -2710,7 +2705,8 @@ static int __cdns3_gadget_init(struct cdns3 *cdns) |
1760 | ret = devm_request_threaded_irq(cdns->dev, cdns->dev_irq, |
1761 | cdns3_device_irq_handler, |
1762 | cdns3_device_thread_irq_handler, |
1763 | - IRQF_SHARED, dev_name(cdns->dev), cdns); |
1764 | + IRQF_SHARED, dev_name(cdns->dev), |
1765 | + cdns->gadget_dev); |
1766 | |
1767 | if (ret) |
1768 | goto err0; |
1769 | diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c |
1770 | index b45ceb91c735..48e4a5ca1835 100644 |
1771 | --- a/drivers/usb/chipidea/host.c |
1772 | +++ b/drivers/usb/chipidea/host.c |
1773 | @@ -26,6 +26,7 @@ static int (*orig_bus_suspend)(struct usb_hcd *hcd); |
1774 | |
1775 | struct ehci_ci_priv { |
1776 | struct regulator *reg_vbus; |
1777 | + bool enabled; |
1778 | }; |
1779 | |
1780 | static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) |
1781 | @@ -37,7 +38,7 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) |
1782 | int ret = 0; |
1783 | int port = HCS_N_PORTS(ehci->hcs_params); |
1784 | |
1785 | - if (priv->reg_vbus) { |
1786 | + if (priv->reg_vbus && enable != priv->enabled) { |
1787 | if (port > 1) { |
1788 | dev_warn(dev, |
1789 | "Not support multi-port regulator control\n"); |
1790 | @@ -53,6 +54,7 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) |
1791 | enable ? "enable" : "disable", ret); |
1792 | return ret; |
1793 | } |
1794 | + priv->enabled = enable; |
1795 | } |
1796 | |
1797 | if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) { |
1798 | diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c |
1799 | index 5e92c6abe306..3e94259406d7 100644 |
1800 | --- a/drivers/usb/core/config.c |
1801 | +++ b/drivers/usb/core/config.c |
1802 | @@ -392,12 +392,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, |
1803 | endpoint->desc.wMaxPacketSize = cpu_to_le16(8); |
1804 | } |
1805 | |
1806 | - /* Validate the wMaxPacketSize field */ |
1807 | + /* |
1808 | + * Validate the wMaxPacketSize field. |
1809 | + * Some devices have isochronous endpoints in altsetting 0; |
1810 | + * the USB-2 spec requires such endpoints to have wMaxPacketSize = 0 |
1811 | + * (see the end of section 5.6.3), so don't warn about them. |
1812 | + */ |
1813 | maxp = usb_endpoint_maxp(&endpoint->desc); |
1814 | - if (maxp == 0) { |
1815 | - dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has wMaxPacketSize 0, skipping\n", |
1816 | + if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) { |
1817 | + dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", |
1818 | cfgno, inum, asnum, d->bEndpointAddress); |
1819 | - goto skip_to_next_endpoint_or_interface_descriptor; |
1820 | } |
1821 | |
1822 | /* Find the highest legal maxpacket size for this endpoint */ |
1823 | diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c |
1824 | index 38183ac438c6..1371b0c249ec 100644 |
1825 | --- a/drivers/usb/host/ohci-da8xx.c |
1826 | +++ b/drivers/usb/host/ohci-da8xx.c |
1827 | @@ -415,13 +415,17 @@ static int ohci_da8xx_probe(struct platform_device *pdev) |
1828 | } |
1829 | |
1830 | da8xx_ohci->oc_gpio = devm_gpiod_get_optional(dev, "oc", GPIOD_IN); |
1831 | - if (IS_ERR(da8xx_ohci->oc_gpio)) |
1832 | + if (IS_ERR(da8xx_ohci->oc_gpio)) { |
1833 | + error = PTR_ERR(da8xx_ohci->oc_gpio); |
1834 | goto err; |
1835 | + } |
1836 | |
1837 | if (da8xx_ohci->oc_gpio) { |
1838 | oc_irq = gpiod_to_irq(da8xx_ohci->oc_gpio); |
1839 | - if (oc_irq < 0) |
1840 | + if (oc_irq < 0) { |
1841 | + error = oc_irq; |
1842 | goto err; |
1843 | + } |
1844 | |
1845 | error = devm_request_threaded_irq(dev, oc_irq, NULL, |
1846 | ohci_da8xx_oc_thread, IRQF_TRIGGER_RISING | |
1847 | diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c |
1848 | index bd63450af76a..bf083c1f997f 100644 |
1849 | --- a/drivers/usb/musb/musb_core.c |
1850 | +++ b/drivers/usb/musb/musb_core.c |
1851 | @@ -1840,6 +1840,9 @@ ATTRIBUTE_GROUPS(musb); |
1852 | #define MUSB_QUIRK_B_INVALID_VBUS_91 (MUSB_DEVCTL_BDEVICE | \ |
1853 | (2 << MUSB_DEVCTL_VBUS_SHIFT) | \ |
1854 | MUSB_DEVCTL_SESSION) |
1855 | +#define MUSB_QUIRK_B_DISCONNECT_99 (MUSB_DEVCTL_BDEVICE | \ |
1856 | + (3 << MUSB_DEVCTL_VBUS_SHIFT) | \ |
1857 | + MUSB_DEVCTL_SESSION) |
1858 | #define MUSB_QUIRK_A_DISCONNECT_19 ((3 << MUSB_DEVCTL_VBUS_SHIFT) | \ |
1859 | MUSB_DEVCTL_SESSION) |
1860 | |
1861 | @@ -1862,6 +1865,11 @@ static void musb_pm_runtime_check_session(struct musb *musb) |
1862 | s = MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV | |
1863 | MUSB_DEVCTL_HR; |
1864 | switch (devctl & ~s) { |
1865 | + case MUSB_QUIRK_B_DISCONNECT_99: |
1866 | + musb_dbg(musb, "Poll devctl in case of suspend after disconnect\n"); |
1867 | + schedule_delayed_work(&musb->irq_work, |
1868 | + msecs_to_jiffies(1000)); |
1869 | + break; |
1870 | case MUSB_QUIRK_B_INVALID_VBUS_91: |
1871 | if (musb->quirk_retries && !musb->flush_irq_work) { |
1872 | musb_dbg(musb, |
1873 | @@ -2310,6 +2318,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) |
1874 | musb_disable_interrupts(musb); |
1875 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); |
1876 | |
1877 | + /* MUSB_POWER_SOFTCONN might be already set, JZ4740 does this. */ |
1878 | + musb_writeb(musb->mregs, MUSB_POWER, 0); |
1879 | + |
1880 | /* Init IRQ workqueue before request_irq */ |
1881 | INIT_DELAYED_WORK(&musb->irq_work, musb_irq_work); |
1882 | INIT_DELAYED_WORK(&musb->deassert_reset_work, musb_deassert_reset); |
1883 | diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c |
1884 | index 5fc6825745f2..2d3751d885b4 100644 |
1885 | --- a/drivers/usb/musb/musbhsdma.c |
1886 | +++ b/drivers/usb/musb/musbhsdma.c |
1887 | @@ -425,7 +425,7 @@ struct dma_controller *musbhs_dma_controller_create(struct musb *musb, |
1888 | controller->controller.channel_abort = dma_channel_abort; |
1889 | |
1890 | if (request_irq(irq, dma_controller_irq, 0, |
1891 | - dev_name(musb->controller), &controller->controller)) { |
1892 | + dev_name(musb->controller), controller)) { |
1893 | dev_err(dev, "request_irq %d failed!\n", irq); |
1894 | musb_dma_controller_destroy(&controller->controller); |
1895 | |
1896 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
1897 | index fea09a3f491f..2d919d0e6e45 100644 |
1898 | --- a/drivers/usb/serial/option.c |
1899 | +++ b/drivers/usb/serial/option.c |
1900 | @@ -567,6 +567,9 @@ static void option_instat_callback(struct urb *urb); |
1901 | /* Interface must have two endpoints */ |
1902 | #define NUMEP2 BIT(16) |
1903 | |
1904 | +/* Device needs ZLP */ |
1905 | +#define ZLP BIT(17) |
1906 | + |
1907 | |
1908 | static const struct usb_device_id option_ids[] = { |
1909 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
1910 | @@ -1198,6 +1201,8 @@ static const struct usb_device_id option_ids[] = { |
1911 | .driver_info = NCTRL(0) | RSVD(1) }, |
1912 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff), /* Telit LN940 (MBIM) */ |
1913 | .driver_info = NCTRL(0) }, |
1914 | + { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */ |
1915 | + .driver_info = NCTRL(0) | ZLP }, |
1916 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ |
1917 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), |
1918 | .driver_info = RSVD(1) }, |
1919 | @@ -2099,6 +2104,9 @@ static int option_attach(struct usb_serial *serial) |
1920 | if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber))) |
1921 | data->use_send_setup = 1; |
1922 | |
1923 | + if (device_flags & ZLP) |
1924 | + data->use_zlp = 1; |
1925 | + |
1926 | spin_lock_init(&data->susp_lock); |
1927 | |
1928 | usb_set_serial_data(serial, data); |
1929 | diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h |
1930 | index 1c120eaf4091..934e9361cf6b 100644 |
1931 | --- a/drivers/usb/serial/usb-wwan.h |
1932 | +++ b/drivers/usb/serial/usb-wwan.h |
1933 | @@ -38,6 +38,7 @@ struct usb_wwan_intf_private { |
1934 | spinlock_t susp_lock; |
1935 | unsigned int suspended:1; |
1936 | unsigned int use_send_setup:1; |
1937 | + unsigned int use_zlp:1; |
1938 | int in_flight; |
1939 | unsigned int open_ports; |
1940 | void *private; |
1941 | diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c |
1942 | index 7e855c87e4f7..13be21aad2f4 100644 |
1943 | --- a/drivers/usb/serial/usb_wwan.c |
1944 | +++ b/drivers/usb/serial/usb_wwan.c |
1945 | @@ -461,6 +461,7 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, |
1946 | void (*callback) (struct urb *)) |
1947 | { |
1948 | struct usb_serial *serial = port->serial; |
1949 | + struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial); |
1950 | struct urb *urb; |
1951 | |
1952 | urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ |
1953 | @@ -471,6 +472,9 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, |
1954 | usb_sndbulkpipe(serial->dev, endpoint) | dir, |
1955 | buf, len, callback, ctx); |
1956 | |
1957 | + if (intfdata->use_zlp && dir == USB_DIR_OUT) |
1958 | + urb->transfer_flags |= URB_ZERO_PACKET; |
1959 | + |
1960 | return urb; |
1961 | } |
1962 | |
1963 | diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c |
1964 | index c1f7073a56de..8b4ff9fff340 100644 |
1965 | --- a/drivers/usb/typec/tcpm/tcpci.c |
1966 | +++ b/drivers/usb/typec/tcpm/tcpci.c |
1967 | @@ -432,20 +432,30 @@ irqreturn_t tcpci_irq(struct tcpci *tcpci) |
1968 | |
1969 | if (status & TCPC_ALERT_RX_STATUS) { |
1970 | struct pd_message msg; |
1971 | - unsigned int cnt; |
1972 | + unsigned int cnt, payload_cnt; |
1973 | u16 header; |
1974 | |
1975 | regmap_read(tcpci->regmap, TCPC_RX_BYTE_CNT, &cnt); |
1976 | + /* |
1977 | + * 'cnt' corresponds to READABLE_BYTE_COUNT in section 4.4.14 |
1978 | + * of the TCPCI spec [Rev 2.0 Ver 1.0 October 2017] and is |
1979 | + * defined in table 4-36 as one greater than the number of |
1980 | + * bytes received. And that number includes the header. So: |
1981 | + */ |
1982 | + if (cnt > 3) |
1983 | + payload_cnt = cnt - (1 + sizeof(msg.header)); |
1984 | + else |
1985 | + payload_cnt = 0; |
1986 | |
1987 | tcpci_read16(tcpci, TCPC_RX_HDR, &header); |
1988 | msg.header = cpu_to_le16(header); |
1989 | |
1990 | - if (WARN_ON(cnt > sizeof(msg.payload))) |
1991 | - cnt = sizeof(msg.payload); |
1992 | + if (WARN_ON(payload_cnt > sizeof(msg.payload))) |
1993 | + payload_cnt = sizeof(msg.payload); |
1994 | |
1995 | - if (cnt > 0) |
1996 | + if (payload_cnt > 0) |
1997 | regmap_raw_read(tcpci->regmap, TCPC_RX_DATA, |
1998 | - &msg.payload, cnt); |
1999 | + &msg.payload, payload_cnt); |
2000 | |
2001 | /* Read complete, clear RX status alert bit */ |
2002 | tcpci_write16(tcpci, TCPC_ALERT, TCPC_ALERT_RX_STATUS); |
2003 | diff --git a/fs/char_dev.c b/fs/char_dev.c |
2004 | index 00dfe17871ac..c5e6eff5a381 100644 |
2005 | --- a/fs/char_dev.c |
2006 | +++ b/fs/char_dev.c |
2007 | @@ -352,7 +352,7 @@ static struct kobject *cdev_get(struct cdev *p) |
2008 | |
2009 | if (owner && !try_module_get(owner)) |
2010 | return NULL; |
2011 | - kobj = kobject_get(&p->kobj); |
2012 | + kobj = kobject_get_unless_zero(&p->kobj); |
2013 | if (!kobj) |
2014 | module_put(owner); |
2015 | return kobj; |
2016 | diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c |
2017 | index 487ee39b438a..013486b5125e 100644 |
2018 | --- a/fs/pstore/ram.c |
2019 | +++ b/fs/pstore/ram.c |
2020 | @@ -583,12 +583,12 @@ static int ramoops_init_przs(const char *name, |
2021 | prz_ar[i] = persistent_ram_new(*paddr, zone_sz, sig, |
2022 | &cxt->ecc_info, |
2023 | cxt->memtype, flags, label); |
2024 | + kfree(label); |
2025 | if (IS_ERR(prz_ar[i])) { |
2026 | err = PTR_ERR(prz_ar[i]); |
2027 | dev_err(dev, "failed to request %s mem region (0x%zx@0x%llx): %d\n", |
2028 | name, record_size, |
2029 | (unsigned long long)*paddr, err); |
2030 | - kfree(label); |
2031 | |
2032 | while (i > 0) { |
2033 | i--; |
2034 | @@ -629,12 +629,12 @@ static int ramoops_init_prz(const char *name, |
2035 | label = kasprintf(GFP_KERNEL, "ramoops:%s", name); |
2036 | *prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info, |
2037 | cxt->memtype, PRZ_FLAG_ZAP_OLD, label); |
2038 | + kfree(label); |
2039 | if (IS_ERR(*prz)) { |
2040 | int err = PTR_ERR(*prz); |
2041 | |
2042 | dev_err(dev, "failed to request %s mem region (0x%zx@0x%llx): %d\n", |
2043 | name, sz, (unsigned long long)*paddr, err); |
2044 | - kfree(label); |
2045 | return err; |
2046 | } |
2047 | |
2048 | diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c |
2049 | index 8823f65888f0..1f4d8c06f9be 100644 |
2050 | --- a/fs/pstore/ram_core.c |
2051 | +++ b/fs/pstore/ram_core.c |
2052 | @@ -574,7 +574,7 @@ struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, |
2053 | /* Initialize general buffer state. */ |
2054 | raw_spin_lock_init(&prz->buffer_lock); |
2055 | prz->flags = flags; |
2056 | - prz->label = label; |
2057 | + prz->label = kstrdup(label, GFP_KERNEL); |
2058 | |
2059 | ret = persistent_ram_buffer_map(start, size, prz, memtype); |
2060 | if (ret) |
2061 | diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h |
2062 | index 9b3c720a31b1..5e3d45525bd3 100644 |
2063 | --- a/include/linux/can/dev.h |
2064 | +++ b/include/linux/can/dev.h |
2065 | @@ -18,6 +18,7 @@ |
2066 | #include <linux/can/error.h> |
2067 | #include <linux/can/led.h> |
2068 | #include <linux/can/netlink.h> |
2069 | +#include <linux/can/skb.h> |
2070 | #include <linux/netdevice.h> |
2071 | |
2072 | /* |
2073 | @@ -91,6 +92,36 @@ struct can_priv { |
2074 | #define get_can_dlc(i) (min_t(__u8, (i), CAN_MAX_DLC)) |
2075 | #define get_canfd_dlc(i) (min_t(__u8, (i), CANFD_MAX_DLC)) |
2076 | |
2077 | +/* Check for outgoing skbs that have not been created by the CAN subsystem */ |
2078 | +static inline bool can_skb_headroom_valid(struct net_device *dev, |
2079 | + struct sk_buff *skb) |
2080 | +{ |
2081 | + /* af_packet creates a headroom of HH_DATA_MOD bytes which is fine */ |
2082 | + if (WARN_ON_ONCE(skb_headroom(skb) < sizeof(struct can_skb_priv))) |
2083 | + return false; |
2084 | + |
2085 | + /* af_packet does not apply CAN skb specific settings */ |
2086 | + if (skb->ip_summed == CHECKSUM_NONE) { |
2087 | + /* init headroom */ |
2088 | + can_skb_prv(skb)->ifindex = dev->ifindex; |
2089 | + can_skb_prv(skb)->skbcnt = 0; |
2090 | + |
2091 | + skb->ip_summed = CHECKSUM_UNNECESSARY; |
2092 | + |
2093 | + /* preform proper loopback on capable devices */ |
2094 | + if (dev->flags & IFF_ECHO) |
2095 | + skb->pkt_type = PACKET_LOOPBACK; |
2096 | + else |
2097 | + skb->pkt_type = PACKET_HOST; |
2098 | + |
2099 | + skb_reset_mac_header(skb); |
2100 | + skb_reset_network_header(skb); |
2101 | + skb_reset_transport_header(skb); |
2102 | + } |
2103 | + |
2104 | + return true; |
2105 | +} |
2106 | + |
2107 | /* Drop a given socketbuffer if it does not contain a valid CAN frame. */ |
2108 | static inline bool can_dropped_invalid_skb(struct net_device *dev, |
2109 | struct sk_buff *skb) |
2110 | @@ -108,6 +139,9 @@ static inline bool can_dropped_invalid_skb(struct net_device *dev, |
2111 | } else |
2112 | goto inval_skb; |
2113 | |
2114 | + if (!can_skb_headroom_valid(dev, skb)) |
2115 | + goto inval_skb; |
2116 | + |
2117 | return false; |
2118 | |
2119 | inval_skb: |
2120 | diff --git a/include/trace/events/preemptirq.h b/include/trace/events/preemptirq.h |
2121 | index 95fba0471e5b..3f249e150c0c 100644 |
2122 | --- a/include/trace/events/preemptirq.h |
2123 | +++ b/include/trace/events/preemptirq.h |
2124 | @@ -18,13 +18,13 @@ DECLARE_EVENT_CLASS(preemptirq_template, |
2125 | TP_ARGS(ip, parent_ip), |
2126 | |
2127 | TP_STRUCT__entry( |
2128 | - __field(u32, caller_offs) |
2129 | - __field(u32, parent_offs) |
2130 | + __field(s32, caller_offs) |
2131 | + __field(s32, parent_offs) |
2132 | ), |
2133 | |
2134 | TP_fast_assign( |
2135 | - __entry->caller_offs = (u32)(ip - (unsigned long)_stext); |
2136 | - __entry->parent_offs = (u32)(parent_ip - (unsigned long)_stext); |
2137 | + __entry->caller_offs = (s32)(ip - (unsigned long)_stext); |
2138 | + __entry->parent_offs = (s32)(parent_ip - (unsigned long)_stext); |
2139 | ), |
2140 | |
2141 | TP_printk("caller=%pS parent=%pS", |
2142 | diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h |
2143 | index f056b2a00d5c..9a61c28ed3ae 100644 |
2144 | --- a/include/uapi/linux/input.h |
2145 | +++ b/include/uapi/linux/input.h |
2146 | @@ -34,6 +34,7 @@ struct input_event { |
2147 | __kernel_ulong_t __sec; |
2148 | #if defined(__sparc__) && defined(__arch64__) |
2149 | unsigned int __usec; |
2150 | + unsigned int __pad; |
2151 | #else |
2152 | __kernel_ulong_t __usec; |
2153 | #endif |
2154 | diff --git a/kernel/fork.c b/kernel/fork.c |
2155 | index 6cabc124378c..755d8160e001 100644 |
2156 | --- a/kernel/fork.c |
2157 | +++ b/kernel/fork.c |
2158 | @@ -2513,6 +2513,16 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, |
2159 | #endif |
2160 | |
2161 | #ifdef __ARCH_WANT_SYS_CLONE3 |
2162 | + |
2163 | +/* |
2164 | + * copy_thread implementations handle CLONE_SETTLS by reading the TLS value from |
2165 | + * the registers containing the syscall arguments for clone. This doesn't work |
2166 | + * with clone3 since the TLS value is passed in clone_args instead. |
2167 | + */ |
2168 | +#ifndef CONFIG_HAVE_COPY_THREAD_TLS |
2169 | +#error clone3 requires copy_thread_tls support in arch |
2170 | +#endif |
2171 | + |
2172 | noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs, |
2173 | struct clone_args __user *uargs, |
2174 | size_t usize) |
2175 | diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c |
2176 | index 5e43b9664eca..617e297f46dc 100644 |
2177 | --- a/kernel/trace/trace_sched_wakeup.c |
2178 | +++ b/kernel/trace/trace_sched_wakeup.c |
2179 | @@ -630,7 +630,7 @@ static void start_wakeup_tracer(struct trace_array *tr) |
2180 | if (ret) { |
2181 | pr_info("wakeup trace: Couldn't activate tracepoint" |
2182 | " probe to kernel_sched_migrate_task\n"); |
2183 | - return; |
2184 | + goto fail_deprobe_sched_switch; |
2185 | } |
2186 | |
2187 | wakeup_reset(tr); |
2188 | @@ -648,6 +648,8 @@ static void start_wakeup_tracer(struct trace_array *tr) |
2189 | printk(KERN_ERR "failed to start wakeup tracer\n"); |
2190 | |
2191 | return; |
2192 | +fail_deprobe_sched_switch: |
2193 | + unregister_trace_sched_switch(probe_wakeup_sched_switch, NULL); |
2194 | fail_deprobe_wake_new: |
2195 | unregister_trace_sched_wakeup_new(probe_wakeup, NULL); |
2196 | fail_deprobe: |
2197 | diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c |
2198 | index 4df9a209f7ca..c557f42a9397 100644 |
2199 | --- a/kernel/trace/trace_stack.c |
2200 | +++ b/kernel/trace/trace_stack.c |
2201 | @@ -283,6 +283,11 @@ static void check_stack(unsigned long ip, unsigned long *stack) |
2202 | local_irq_restore(flags); |
2203 | } |
2204 | |
2205 | +/* Some archs may not define MCOUNT_INSN_SIZE */ |
2206 | +#ifndef MCOUNT_INSN_SIZE |
2207 | +# define MCOUNT_INSN_SIZE 0 |
2208 | +#endif |
2209 | + |
2210 | static void |
2211 | stack_trace_call(unsigned long ip, unsigned long parent_ip, |
2212 | struct ftrace_ops *op, struct pt_regs *pt_regs) |
2213 | diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c |
2214 | index 214154b47d56..069f72edb264 100644 |
2215 | --- a/net/ipv4/netfilter/arp_tables.c |
2216 | +++ b/net/ipv4/netfilter/arp_tables.c |
2217 | @@ -384,10 +384,11 @@ next: ; |
2218 | return 1; |
2219 | } |
2220 | |
2221 | -static inline int check_target(struct arpt_entry *e, const char *name) |
2222 | +static int check_target(struct arpt_entry *e, struct net *net, const char *name) |
2223 | { |
2224 | struct xt_entry_target *t = arpt_get_target(e); |
2225 | struct xt_tgchk_param par = { |
2226 | + .net = net, |
2227 | .table = name, |
2228 | .entryinfo = e, |
2229 | .target = t->u.kernel.target, |
2230 | @@ -399,8 +400,9 @@ static inline int check_target(struct arpt_entry *e, const char *name) |
2231 | return xt_check_target(&par, t->u.target_size - sizeof(*t), 0, false); |
2232 | } |
2233 | |
2234 | -static inline int |
2235 | -find_check_entry(struct arpt_entry *e, const char *name, unsigned int size, |
2236 | +static int |
2237 | +find_check_entry(struct arpt_entry *e, struct net *net, const char *name, |
2238 | + unsigned int size, |
2239 | struct xt_percpu_counter_alloc_state *alloc_state) |
2240 | { |
2241 | struct xt_entry_target *t; |
2242 | @@ -419,7 +421,7 @@ find_check_entry(struct arpt_entry *e, const char *name, unsigned int size, |
2243 | } |
2244 | t->u.kernel.target = target; |
2245 | |
2246 | - ret = check_target(e, name); |
2247 | + ret = check_target(e, net, name); |
2248 | if (ret) |
2249 | goto err; |
2250 | return 0; |
2251 | @@ -512,7 +514,9 @@ static inline void cleanup_entry(struct arpt_entry *e) |
2252 | /* Checks and translates the user-supplied table segment (held in |
2253 | * newinfo). |
2254 | */ |
2255 | -static int translate_table(struct xt_table_info *newinfo, void *entry0, |
2256 | +static int translate_table(struct net *net, |
2257 | + struct xt_table_info *newinfo, |
2258 | + void *entry0, |
2259 | const struct arpt_replace *repl) |
2260 | { |
2261 | struct xt_percpu_counter_alloc_state alloc_state = { 0 }; |
2262 | @@ -569,7 +573,7 @@ static int translate_table(struct xt_table_info *newinfo, void *entry0, |
2263 | /* Finally, each sanity check must pass */ |
2264 | i = 0; |
2265 | xt_entry_foreach(iter, entry0, newinfo->size) { |
2266 | - ret = find_check_entry(iter, repl->name, repl->size, |
2267 | + ret = find_check_entry(iter, net, repl->name, repl->size, |
2268 | &alloc_state); |
2269 | if (ret != 0) |
2270 | break; |
2271 | @@ -974,7 +978,7 @@ static int do_replace(struct net *net, const void __user *user, |
2272 | goto free_newinfo; |
2273 | } |
2274 | |
2275 | - ret = translate_table(newinfo, loc_cpu_entry, &tmp); |
2276 | + ret = translate_table(net, newinfo, loc_cpu_entry, &tmp); |
2277 | if (ret != 0) |
2278 | goto free_newinfo; |
2279 | |
2280 | @@ -1149,7 +1153,8 @@ compat_copy_entry_from_user(struct compat_arpt_entry *e, void **dstptr, |
2281 | } |
2282 | } |
2283 | |
2284 | -static int translate_compat_table(struct xt_table_info **pinfo, |
2285 | +static int translate_compat_table(struct net *net, |
2286 | + struct xt_table_info **pinfo, |
2287 | void **pentry0, |
2288 | const struct compat_arpt_replace *compatr) |
2289 | { |
2290 | @@ -1217,7 +1222,7 @@ static int translate_compat_table(struct xt_table_info **pinfo, |
2291 | repl.num_counters = 0; |
2292 | repl.counters = NULL; |
2293 | repl.size = newinfo->size; |
2294 | - ret = translate_table(newinfo, entry1, &repl); |
2295 | + ret = translate_table(net, newinfo, entry1, &repl); |
2296 | if (ret) |
2297 | goto free_newinfo; |
2298 | |
2299 | @@ -1270,7 +1275,7 @@ static int compat_do_replace(struct net *net, void __user *user, |
2300 | goto free_newinfo; |
2301 | } |
2302 | |
2303 | - ret = translate_compat_table(&newinfo, &loc_cpu_entry, &tmp); |
2304 | + ret = translate_compat_table(net, &newinfo, &loc_cpu_entry, &tmp); |
2305 | if (ret != 0) |
2306 | goto free_newinfo; |
2307 | |
2308 | @@ -1546,7 +1551,7 @@ int arpt_register_table(struct net *net, |
2309 | loc_cpu_entry = newinfo->entries; |
2310 | memcpy(loc_cpu_entry, repl->entries, repl->size); |
2311 | |
2312 | - ret = translate_table(newinfo, loc_cpu_entry, repl); |
2313 | + ret = translate_table(net, newinfo, loc_cpu_entry, repl); |
2314 | if (ret != 0) |
2315 | goto out_free; |
2316 | |
2317 | diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c |
2318 | index d73d1828216a..d8143a8c034d 100644 |
2319 | --- a/net/netfilter/ipset/ip_set_core.c |
2320 | +++ b/net/netfilter/ipset/ip_set_core.c |
2321 | @@ -1658,6 +1658,7 @@ static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb, |
2322 | struct ip_set *set; |
2323 | struct nlattr *tb[IPSET_ATTR_ADT_MAX + 1] = {}; |
2324 | int ret = 0; |
2325 | + u32 lineno; |
2326 | |
2327 | if (unlikely(protocol_min_failed(attr) || |
2328 | !attr[IPSET_ATTR_SETNAME] || |
2329 | @@ -1674,7 +1675,7 @@ static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb, |
2330 | return -IPSET_ERR_PROTOCOL; |
2331 | |
2332 | rcu_read_lock_bh(); |
2333 | - ret = set->variant->uadt(set, tb, IPSET_TEST, NULL, 0, 0); |
2334 | + ret = set->variant->uadt(set, tb, IPSET_TEST, &lineno, 0, 0); |
2335 | rcu_read_unlock_bh(); |
2336 | /* Userspace can't trigger element to be re-added */ |
2337 | if (ret == -EAGAIN) |
2338 | diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c |
2339 | index b6b14db3955b..b3f4a334f9d7 100644 |
2340 | --- a/net/netfilter/nf_conntrack_proto_dccp.c |
2341 | +++ b/net/netfilter/nf_conntrack_proto_dccp.c |
2342 | @@ -677,6 +677,9 @@ static int dccp_timeout_nlattr_to_obj(struct nlattr *tb[], |
2343 | unsigned int *timeouts = data; |
2344 | int i; |
2345 | |
2346 | + if (!timeouts) |
2347 | + timeouts = dn->dccp_timeout; |
2348 | + |
2349 | /* set default DCCP timeouts. */ |
2350 | for (i=0; i<CT_DCCP_MAX; i++) |
2351 | timeouts[i] = dn->dccp_timeout[i]; |
2352 | diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c |
2353 | index fce3d93f1541..0399ae8f1188 100644 |
2354 | --- a/net/netfilter/nf_conntrack_proto_sctp.c |
2355 | +++ b/net/netfilter/nf_conntrack_proto_sctp.c |
2356 | @@ -594,6 +594,9 @@ static int sctp_timeout_nlattr_to_obj(struct nlattr *tb[], |
2357 | struct nf_sctp_net *sn = nf_sctp_pernet(net); |
2358 | int i; |
2359 | |
2360 | + if (!timeouts) |
2361 | + timeouts = sn->timeouts; |
2362 | + |
2363 | /* set default SCTP timeouts. */ |
2364 | for (i=0; i<SCTP_CONNTRACK_MAX; i++) |
2365 | timeouts[i] = sn->timeouts[i]; |
2366 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
2367 | index 252888f426de..d293488dc3dd 100644 |
2368 | --- a/sound/pci/hda/patch_realtek.c |
2369 | +++ b/sound/pci/hda/patch_realtek.c |
2370 | @@ -412,6 +412,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) |
2371 | case 0x10ec0672: |
2372 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ |
2373 | break; |
2374 | + case 0x10ec0222: |
2375 | case 0x10ec0623: |
2376 | alc_update_coef_idx(codec, 0x19, 1<<13, 0); |
2377 | break; |
2378 | @@ -430,6 +431,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) |
2379 | break; |
2380 | case 0x10ec0899: |
2381 | case 0x10ec0900: |
2382 | + case 0x10ec0b00: |
2383 | case 0x10ec1168: |
2384 | case 0x10ec1220: |
2385 | alc_update_coef_idx(codec, 0x7, 1<<1, 0); |
2386 | @@ -2526,6 +2528,7 @@ static int patch_alc882(struct hda_codec *codec) |
2387 | case 0x10ec0882: |
2388 | case 0x10ec0885: |
2389 | case 0x10ec0900: |
2390 | + case 0x10ec0b00: |
2391 | case 0x10ec1220: |
2392 | break; |
2393 | default: |
2394 | @@ -7257,6 +7260,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
2395 | SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), |
2396 | SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), |
2397 | SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
2398 | + SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), |
2399 | SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), |
2400 | SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
2401 | SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
2402 | @@ -9295,6 +9299,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = { |
2403 | HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662), |
2404 | HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882), |
2405 | HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882), |
2406 | + HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882), |
2407 | HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882), |
2408 | HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882), |
2409 | {} /* terminator */ |
2410 | diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
2411 | index a81c2066499f..82184036437b 100644 |
2412 | --- a/sound/usb/quirks.c |
2413 | +++ b/sound/usb/quirks.c |
2414 | @@ -1397,6 +1397,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) |
2415 | case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ |
2416 | case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */ |
2417 | case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */ |
2418 | + case USB_ID(0x05a7, 0x1020): /* Bose Companion 5 */ |
2419 | case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ |
2420 | case USB_ID(0x1395, 0x740a): /* Sennheiser DECT */ |
2421 | case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */ |