Contents of /trunk/kernel-magellan/patches-4.5/0101-4.5.2-all-fixes.patch
Parent Directory | Revision Log
Revision 2783 -
(show annotations)
(download)
Fri May 13 07:36:22 2016 UTC (8 years, 4 months ago) by niro
File size: 171097 byte(s)
Fri May 13 07:36:22 2016 UTC (8 years, 4 months ago) by niro
File size: 171097 byte(s)
-linux-4.5.2
1 | diff --git a/Documentation/devicetree/bindings/pinctrl/img,pistachio-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/img,pistachio-pinctrl.txt |
2 | index 08a4a32c8eb0..0326154c7925 100644 |
3 | --- a/Documentation/devicetree/bindings/pinctrl/img,pistachio-pinctrl.txt |
4 | +++ b/Documentation/devicetree/bindings/pinctrl/img,pistachio-pinctrl.txt |
5 | @@ -134,12 +134,12 @@ mfio80 ddr_debug, mips_trace_data, mips_debug |
6 | mfio81 dreq0, mips_trace_data, eth_debug |
7 | mfio82 dreq1, mips_trace_data, eth_debug |
8 | mfio83 mips_pll_lock, mips_trace_data, usb_debug |
9 | -mfio84 sys_pll_lock, mips_trace_data, usb_debug |
10 | -mfio85 wifi_pll_lock, mips_trace_data, sdhost_debug |
11 | -mfio86 bt_pll_lock, mips_trace_data, sdhost_debug |
12 | -mfio87 rpu_v_pll_lock, dreq2, socif_debug |
13 | -mfio88 rpu_l_pll_lock, dreq3, socif_debug |
14 | -mfio89 audio_pll_lock, dreq4, dreq5 |
15 | +mfio84 audio_pll_lock, mips_trace_data, usb_debug |
16 | +mfio85 rpu_v_pll_lock, mips_trace_data, sdhost_debug |
17 | +mfio86 rpu_l_pll_lock, mips_trace_data, sdhost_debug |
18 | +mfio87 sys_pll_lock, dreq2, socif_debug |
19 | +mfio88 wifi_pll_lock, dreq3, socif_debug |
20 | +mfio89 bt_pll_lock, dreq4, dreq5 |
21 | tck |
22 | trstn |
23 | tdi |
24 | diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt |
25 | index 9a53c929f017..21e4b4861331 100644 |
26 | --- a/Documentation/kernel-parameters.txt |
27 | +++ b/Documentation/kernel-parameters.txt |
28 | @@ -4016,6 +4016,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. |
29 | sector if the number is odd); |
30 | i = IGNORE_DEVICE (don't bind to this |
31 | device); |
32 | + j = NO_REPORT_LUNS (don't use report luns |
33 | + command, uas only); |
34 | l = NOT_LOCKABLE (don't try to lock and |
35 | unlock ejectable media); |
36 | m = MAX_SECTORS_64 (don't transfer more |
37 | diff --git a/Makefile b/Makefile |
38 | index c621889b8827..1ecaaeb7791d 100644 |
39 | --- a/Makefile |
40 | +++ b/Makefile |
41 | @@ -1,6 +1,6 @@ |
42 | VERSION = 4 |
43 | PATCHLEVEL = 5 |
44 | -SUBLEVEL = 1 |
45 | +SUBLEVEL = 2 |
46 | EXTRAVERSION = |
47 | NAME = Blurry Fish Butt |
48 | |
49 | diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c |
50 | index 7d0cba6f1cc5..c86ea8aac203 100644 |
51 | --- a/arch/arm/kernel/setup.c |
52 | +++ b/arch/arm/kernel/setup.c |
53 | @@ -430,11 +430,13 @@ static void __init patch_aeabi_idiv(void) |
54 | pr_info("CPU: div instructions available: patching division code\n"); |
55 | |
56 | fn_addr = ((uintptr_t)&__aeabi_uidiv) & ~1; |
57 | + asm ("" : "+g" (fn_addr)); |
58 | ((u32 *)fn_addr)[0] = udiv_instruction(); |
59 | ((u32 *)fn_addr)[1] = bx_lr_instruction(); |
60 | flush_icache_range(fn_addr, fn_addr + 8); |
61 | |
62 | fn_addr = ((uintptr_t)&__aeabi_idiv) & ~1; |
63 | + asm ("" : "+g" (fn_addr)); |
64 | ((u32 *)fn_addr)[0] = sdiv_instruction(); |
65 | ((u32 *)fn_addr)[1] = bx_lr_instruction(); |
66 | flush_icache_range(fn_addr, fn_addr + 8); |
67 | diff --git a/arch/arm64/include/asm/opcodes.h b/arch/arm64/include/asm/opcodes.h |
68 | index 4e603ea36ad3..123f45d92cd1 100644 |
69 | --- a/arch/arm64/include/asm/opcodes.h |
70 | +++ b/arch/arm64/include/asm/opcodes.h |
71 | @@ -1 +1,5 @@ |
72 | +#ifdef CONFIG_CPU_BIG_ENDIAN |
73 | +#define CONFIG_CPU_ENDIAN_BE8 CONFIG_CPU_BIG_ENDIAN |
74 | +#endif |
75 | + |
76 | #include <../../arm/include/asm/opcodes.h> |
77 | diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c |
78 | index c536c9e307b9..0931155f6406 100644 |
79 | --- a/arch/arm64/kernel/debug-monitors.c |
80 | +++ b/arch/arm64/kernel/debug-monitors.c |
81 | @@ -186,20 +186,21 @@ static void clear_regs_spsr_ss(struct pt_regs *regs) |
82 | |
83 | /* EL1 Single Step Handler hooks */ |
84 | static LIST_HEAD(step_hook); |
85 | -static DEFINE_RWLOCK(step_hook_lock); |
86 | +static DEFINE_SPINLOCK(step_hook_lock); |
87 | |
88 | void register_step_hook(struct step_hook *hook) |
89 | { |
90 | - write_lock(&step_hook_lock); |
91 | - list_add(&hook->node, &step_hook); |
92 | - write_unlock(&step_hook_lock); |
93 | + spin_lock(&step_hook_lock); |
94 | + list_add_rcu(&hook->node, &step_hook); |
95 | + spin_unlock(&step_hook_lock); |
96 | } |
97 | |
98 | void unregister_step_hook(struct step_hook *hook) |
99 | { |
100 | - write_lock(&step_hook_lock); |
101 | - list_del(&hook->node); |
102 | - write_unlock(&step_hook_lock); |
103 | + spin_lock(&step_hook_lock); |
104 | + list_del_rcu(&hook->node); |
105 | + spin_unlock(&step_hook_lock); |
106 | + synchronize_rcu(); |
107 | } |
108 | |
109 | /* |
110 | @@ -213,15 +214,15 @@ static int call_step_hook(struct pt_regs *regs, unsigned int esr) |
111 | struct step_hook *hook; |
112 | int retval = DBG_HOOK_ERROR; |
113 | |
114 | - read_lock(&step_hook_lock); |
115 | + rcu_read_lock(); |
116 | |
117 | - list_for_each_entry(hook, &step_hook, node) { |
118 | + list_for_each_entry_rcu(hook, &step_hook, node) { |
119 | retval = hook->fn(regs, esr); |
120 | if (retval == DBG_HOOK_HANDLED) |
121 | break; |
122 | } |
123 | |
124 | - read_unlock(&step_hook_lock); |
125 | + rcu_read_unlock(); |
126 | |
127 | return retval; |
128 | } |
129 | diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c |
130 | index bdeed9d13c6f..433c4b9a9f0a 100644 |
131 | --- a/arch/mips/alchemy/devboards/db1000.c |
132 | +++ b/arch/mips/alchemy/devboards/db1000.c |
133 | @@ -503,15 +503,15 @@ int __init db1000_dev_setup(void) |
134 | if (board == BCSR_WHOAMI_DB1500) { |
135 | c0 = AU1500_GPIO2_INT; |
136 | c1 = AU1500_GPIO5_INT; |
137 | - d0 = AU1500_GPIO0_INT; |
138 | - d1 = AU1500_GPIO3_INT; |
139 | + d0 = 0; /* GPIO number, NOT irq! */ |
140 | + d1 = 3; /* GPIO number, NOT irq! */ |
141 | s0 = AU1500_GPIO1_INT; |
142 | s1 = AU1500_GPIO4_INT; |
143 | } else if (board == BCSR_WHOAMI_DB1100) { |
144 | c0 = AU1100_GPIO2_INT; |
145 | c1 = AU1100_GPIO5_INT; |
146 | - d0 = AU1100_GPIO0_INT; |
147 | - d1 = AU1100_GPIO3_INT; |
148 | + d0 = 0; /* GPIO number, NOT irq! */ |
149 | + d1 = 3; /* GPIO number, NOT irq! */ |
150 | s0 = AU1100_GPIO1_INT; |
151 | s1 = AU1100_GPIO4_INT; |
152 | |
153 | @@ -545,15 +545,15 @@ int __init db1000_dev_setup(void) |
154 | } else if (board == BCSR_WHOAMI_DB1000) { |
155 | c0 = AU1000_GPIO2_INT; |
156 | c1 = AU1000_GPIO5_INT; |
157 | - d0 = AU1000_GPIO0_INT; |
158 | - d1 = AU1000_GPIO3_INT; |
159 | + d0 = 0; /* GPIO number, NOT irq! */ |
160 | + d1 = 3; /* GPIO number, NOT irq! */ |
161 | s0 = AU1000_GPIO1_INT; |
162 | s1 = AU1000_GPIO4_INT; |
163 | platform_add_devices(db1000_devs, ARRAY_SIZE(db1000_devs)); |
164 | } else if ((board == BCSR_WHOAMI_PB1500) || |
165 | (board == BCSR_WHOAMI_PB1500R2)) { |
166 | c0 = AU1500_GPIO203_INT; |
167 | - d0 = AU1500_GPIO201_INT; |
168 | + d0 = 1; /* GPIO number, NOT irq! */ |
169 | s0 = AU1500_GPIO202_INT; |
170 | twosocks = 0; |
171 | flashsize = 64; |
172 | @@ -566,7 +566,7 @@ int __init db1000_dev_setup(void) |
173 | */ |
174 | } else if (board == BCSR_WHOAMI_PB1100) { |
175 | c0 = AU1100_GPIO11_INT; |
176 | - d0 = AU1100_GPIO9_INT; |
177 | + d0 = 9; /* GPIO number, NOT irq! */ |
178 | s0 = AU1100_GPIO10_INT; |
179 | twosocks = 0; |
180 | flashsize = 64; |
181 | @@ -583,7 +583,6 @@ int __init db1000_dev_setup(void) |
182 | } else |
183 | return 0; /* unknown board, no further dev setup to do */ |
184 | |
185 | - irq_set_irq_type(d0, IRQ_TYPE_EDGE_BOTH); |
186 | irq_set_irq_type(c0, IRQ_TYPE_LEVEL_LOW); |
187 | irq_set_irq_type(s0, IRQ_TYPE_LEVEL_LOW); |
188 | |
189 | @@ -597,7 +596,6 @@ int __init db1000_dev_setup(void) |
190 | c0, d0, /*s0*/0, 0, 0); |
191 | |
192 | if (twosocks) { |
193 | - irq_set_irq_type(d1, IRQ_TYPE_EDGE_BOTH); |
194 | irq_set_irq_type(c1, IRQ_TYPE_LEVEL_LOW); |
195 | irq_set_irq_type(s1, IRQ_TYPE_LEVEL_LOW); |
196 | |
197 | diff --git a/arch/mips/alchemy/devboards/db1550.c b/arch/mips/alchemy/devboards/db1550.c |
198 | index b518f029f5e7..1c01d6eadb08 100644 |
199 | --- a/arch/mips/alchemy/devboards/db1550.c |
200 | +++ b/arch/mips/alchemy/devboards/db1550.c |
201 | @@ -514,7 +514,7 @@ static void __init db1550_devices(void) |
202 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, |
203 | AU1000_PCMCIA_IO_PHYS_ADDR, |
204 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, |
205 | - AU1550_GPIO3_INT, AU1550_GPIO0_INT, |
206 | + AU1550_GPIO3_INT, 0, |
207 | /*AU1550_GPIO21_INT*/0, 0, 0); |
208 | |
209 | db1x_register_pcmcia_socket( |
210 | @@ -524,7 +524,7 @@ static void __init db1550_devices(void) |
211 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1, |
212 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000, |
213 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1, |
214 | - AU1550_GPIO5_INT, AU1550_GPIO1_INT, |
215 | + AU1550_GPIO5_INT, 1, |
216 | /*AU1550_GPIO22_INT*/0, 0, 1); |
217 | |
218 | platform_device_register(&db1550_nand_dev); |
219 | diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c |
220 | index 490cea569d57..5c62065cbf22 100644 |
221 | --- a/arch/mips/kernel/unaligned.c |
222 | +++ b/arch/mips/kernel/unaligned.c |
223 | @@ -885,7 +885,7 @@ static void emulate_load_store_insn(struct pt_regs *regs, |
224 | { |
225 | union mips_instruction insn; |
226 | unsigned long value; |
227 | - unsigned int res; |
228 | + unsigned int res, preempted; |
229 | unsigned long origpc; |
230 | unsigned long orig31; |
231 | void __user *fault_addr = NULL; |
232 | @@ -1226,27 +1226,36 @@ static void emulate_load_store_insn(struct pt_regs *regs, |
233 | if (!access_ok(VERIFY_READ, addr, sizeof(*fpr))) |
234 | goto sigbus; |
235 | |
236 | - /* |
237 | - * Disable preemption to avoid a race between copying |
238 | - * state from userland, migrating to another CPU and |
239 | - * updating the hardware vector register below. |
240 | - */ |
241 | - preempt_disable(); |
242 | - |
243 | - res = __copy_from_user_inatomic(fpr, addr, |
244 | - sizeof(*fpr)); |
245 | - if (res) |
246 | - goto fault; |
247 | - |
248 | - /* |
249 | - * Update the hardware register if it is in use by the |
250 | - * task in this quantum, in order to avoid having to |
251 | - * save & restore the whole vector context. |
252 | - */ |
253 | - if (test_thread_flag(TIF_USEDMSA)) |
254 | - write_msa_wr(wd, fpr, df); |
255 | + do { |
256 | + /* |
257 | + * If we have live MSA context keep track of |
258 | + * whether we get preempted in order to avoid |
259 | + * the register context we load being clobbered |
260 | + * by the live context as it's saved during |
261 | + * preemption. If we don't have live context |
262 | + * then it can't be saved to clobber the value |
263 | + * we load. |
264 | + */ |
265 | + preempted = test_thread_flag(TIF_USEDMSA); |
266 | + |
267 | + res = __copy_from_user_inatomic(fpr, addr, |
268 | + sizeof(*fpr)); |
269 | + if (res) |
270 | + goto fault; |
271 | |
272 | - preempt_enable(); |
273 | + /* |
274 | + * Update the hardware register if it is in use |
275 | + * by the task in this quantum, in order to |
276 | + * avoid having to save & restore the whole |
277 | + * vector context. |
278 | + */ |
279 | + preempt_disable(); |
280 | + if (test_thread_flag(TIF_USEDMSA)) { |
281 | + write_msa_wr(wd, fpr, df); |
282 | + preempted = 0; |
283 | + } |
284 | + preempt_enable(); |
285 | + } while (preempted); |
286 | break; |
287 | |
288 | case msa_st_op: |
289 | diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig |
290 | index 14f655cf542e..86ed37671ef5 100644 |
291 | --- a/arch/parisc/Kconfig |
292 | +++ b/arch/parisc/Kconfig |
293 | @@ -29,6 +29,7 @@ config PARISC |
294 | select TTY # Needed for pdc_cons.c |
295 | select HAVE_DEBUG_STACKOVERFLOW |
296 | select HAVE_ARCH_AUDITSYSCALL |
297 | + select HAVE_ARCH_SECCOMP_FILTER |
298 | select ARCH_NO_COHERENT_DMA_MMAP |
299 | |
300 | help |
301 | diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h |
302 | index 0448a2c8eafb..3387307cc33e 100644 |
303 | --- a/arch/parisc/include/asm/compat.h |
304 | +++ b/arch/parisc/include/asm/compat.h |
305 | @@ -183,6 +183,13 @@ typedef struct compat_siginfo { |
306 | int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ |
307 | int _fd; |
308 | } _sigpoll; |
309 | + |
310 | + /* SIGSYS */ |
311 | + struct { |
312 | + compat_uptr_t _call_addr; /* calling user insn */ |
313 | + int _syscall; /* triggering system call number */ |
314 | + compat_uint_t _arch; /* AUDIT_ARCH_* of syscall */ |
315 | + } _sigsys; |
316 | } _sifields; |
317 | } compat_siginfo_t; |
318 | |
319 | diff --git a/arch/parisc/include/asm/syscall.h b/arch/parisc/include/asm/syscall.h |
320 | index a5eba95d87fe..637ce8d6f375 100644 |
321 | --- a/arch/parisc/include/asm/syscall.h |
322 | +++ b/arch/parisc/include/asm/syscall.h |
323 | @@ -39,6 +39,19 @@ static inline void syscall_get_arguments(struct task_struct *tsk, |
324 | } |
325 | } |
326 | |
327 | +static inline void syscall_set_return_value(struct task_struct *task, |
328 | + struct pt_regs *regs, |
329 | + int error, long val) |
330 | +{ |
331 | + regs->gr[28] = error ? error : val; |
332 | +} |
333 | + |
334 | +static inline void syscall_rollback(struct task_struct *task, |
335 | + struct pt_regs *regs) |
336 | +{ |
337 | + /* do nothing */ |
338 | +} |
339 | + |
340 | static inline int syscall_get_arch(void) |
341 | { |
342 | int arch = AUDIT_ARCH_PARISC; |
343 | diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h |
344 | index 0abdd4c607ed..1960b87c1c8b 100644 |
345 | --- a/arch/parisc/include/asm/uaccess.h |
346 | +++ b/arch/parisc/include/asm/uaccess.h |
347 | @@ -76,6 +76,7 @@ struct exception_table_entry { |
348 | */ |
349 | struct exception_data { |
350 | unsigned long fault_ip; |
351 | + unsigned long fault_gp; |
352 | unsigned long fault_space; |
353 | unsigned long fault_addr; |
354 | }; |
355 | diff --git a/arch/parisc/kernel/asm-offsets.c b/arch/parisc/kernel/asm-offsets.c |
356 | index d2f62570a7b1..78d30d2ea2d8 100644 |
357 | --- a/arch/parisc/kernel/asm-offsets.c |
358 | +++ b/arch/parisc/kernel/asm-offsets.c |
359 | @@ -299,6 +299,7 @@ int main(void) |
360 | #endif |
361 | BLANK(); |
362 | DEFINE(EXCDATA_IP, offsetof(struct exception_data, fault_ip)); |
363 | + DEFINE(EXCDATA_GP, offsetof(struct exception_data, fault_gp)); |
364 | DEFINE(EXCDATA_SPACE, offsetof(struct exception_data, fault_space)); |
365 | DEFINE(EXCDATA_ADDR, offsetof(struct exception_data, fault_addr)); |
366 | BLANK(); |
367 | diff --git a/arch/parisc/kernel/parisc_ksyms.c b/arch/parisc/kernel/parisc_ksyms.c |
368 | index 568b2c61ea02..3cad8aadc69e 100644 |
369 | --- a/arch/parisc/kernel/parisc_ksyms.c |
370 | +++ b/arch/parisc/kernel/parisc_ksyms.c |
371 | @@ -47,11 +47,11 @@ EXPORT_SYMBOL(__cmpxchg_u64); |
372 | EXPORT_SYMBOL(lclear_user); |
373 | EXPORT_SYMBOL(lstrnlen_user); |
374 | |
375 | -/* Global fixups */ |
376 | -extern void fixup_get_user_skip_1(void); |
377 | -extern void fixup_get_user_skip_2(void); |
378 | -extern void fixup_put_user_skip_1(void); |
379 | -extern void fixup_put_user_skip_2(void); |
380 | +/* Global fixups - defined as int to avoid creation of function pointers */ |
381 | +extern int fixup_get_user_skip_1; |
382 | +extern int fixup_get_user_skip_2; |
383 | +extern int fixup_put_user_skip_1; |
384 | +extern int fixup_put_user_skip_2; |
385 | EXPORT_SYMBOL(fixup_get_user_skip_1); |
386 | EXPORT_SYMBOL(fixup_get_user_skip_2); |
387 | EXPORT_SYMBOL(fixup_put_user_skip_1); |
388 | diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c |
389 | index ce0b2b4075c7..8fb81a391599 100644 |
390 | --- a/arch/parisc/kernel/ptrace.c |
391 | +++ b/arch/parisc/kernel/ptrace.c |
392 | @@ -270,7 +270,8 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, |
393 | long do_syscall_trace_enter(struct pt_regs *regs) |
394 | { |
395 | /* Do the secure computing check first. */ |
396 | - secure_computing_strict(regs->gr[20]); |
397 | + if (secure_computing() == -1) |
398 | + return -1; |
399 | |
400 | if (test_thread_flag(TIF_SYSCALL_TRACE) && |
401 | tracehook_report_syscall_entry(regs)) { |
402 | @@ -296,7 +297,11 @@ long do_syscall_trace_enter(struct pt_regs *regs) |
403 | regs->gr[23] & 0xffffffff); |
404 | |
405 | out: |
406 | - return regs->gr[20]; |
407 | + /* |
408 | + * Sign extend the syscall number to 64bit since it may have been |
409 | + * modified by a compat ptrace call |
410 | + */ |
411 | + return (int) ((u32) regs->gr[20]); |
412 | } |
413 | |
414 | void do_syscall_trace_exit(struct pt_regs *regs) |
415 | diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c |
416 | index 984abbee71ca..c342b2e17492 100644 |
417 | --- a/arch/parisc/kernel/signal32.c |
418 | +++ b/arch/parisc/kernel/signal32.c |
419 | @@ -371,6 +371,11 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, const siginfo_t *from) |
420 | val = (compat_int_t)from->si_int; |
421 | err |= __put_user(val, &to->si_int); |
422 | break; |
423 | + case __SI_SYS >> 16: |
424 | + err |= __put_user(ptr_to_compat(from->si_call_addr), &to->si_call_addr); |
425 | + err |= __put_user(from->si_syscall, &to->si_syscall); |
426 | + err |= __put_user(from->si_arch, &to->si_arch); |
427 | + break; |
428 | } |
429 | } |
430 | return err; |
431 | diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S |
432 | index fbafa0d0e2bf..c976ebfe2269 100644 |
433 | --- a/arch/parisc/kernel/syscall.S |
434 | +++ b/arch/parisc/kernel/syscall.S |
435 | @@ -329,6 +329,7 @@ tracesys_next: |
436 | |
437 | ldo -THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr */ |
438 | LDREG TI_TASK(%r1), %r1 |
439 | + LDREG TASK_PT_GR28(%r1), %r28 /* Restore return value */ |
440 | LDREG TASK_PT_GR26(%r1), %r26 /* Restore the users args */ |
441 | LDREG TASK_PT_GR25(%r1), %r25 |
442 | LDREG TASK_PT_GR24(%r1), %r24 |
443 | @@ -342,6 +343,7 @@ tracesys_next: |
444 | stw %r21, -56(%r30) /* 6th argument */ |
445 | #endif |
446 | |
447 | + cmpib,COND(=),n -1,%r20,tracesys_exit /* seccomp may have returned -1 */ |
448 | comiclr,>>= __NR_Linux_syscalls, %r20, %r0 |
449 | b,n .Ltracesys_nosys |
450 | |
451 | diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c |
452 | index 553b09855cfd..77e2262c97f6 100644 |
453 | --- a/arch/parisc/kernel/traps.c |
454 | +++ b/arch/parisc/kernel/traps.c |
455 | @@ -798,6 +798,9 @@ void notrace handle_interruption(int code, struct pt_regs *regs) |
456 | |
457 | if (fault_space == 0 && !faulthandler_disabled()) |
458 | { |
459 | + /* Clean up and return if in exception table. */ |
460 | + if (fixup_exception(regs)) |
461 | + return; |
462 | pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC); |
463 | parisc_terminate("Kernel Fault", regs, code, fault_address); |
464 | } |
465 | diff --git a/arch/parisc/lib/fixup.S b/arch/parisc/lib/fixup.S |
466 | index 536ef66bb94b..1052b747e011 100644 |
467 | --- a/arch/parisc/lib/fixup.S |
468 | +++ b/arch/parisc/lib/fixup.S |
469 | @@ -26,6 +26,7 @@ |
470 | |
471 | #ifdef CONFIG_SMP |
472 | .macro get_fault_ip t1 t2 |
473 | + loadgp |
474 | addil LT%__per_cpu_offset,%r27 |
475 | LDREG RT%__per_cpu_offset(%r1),\t1 |
476 | /* t2 = smp_processor_id() */ |
477 | @@ -40,14 +41,19 @@ |
478 | LDREG RT%exception_data(%r1),\t1 |
479 | /* t1 = this_cpu_ptr(&exception_data) */ |
480 | add,l \t1,\t2,\t1 |
481 | + /* %r27 = t1->fault_gp - restore gp */ |
482 | + LDREG EXCDATA_GP(\t1), %r27 |
483 | /* t1 = t1->fault_ip */ |
484 | LDREG EXCDATA_IP(\t1), \t1 |
485 | .endm |
486 | #else |
487 | .macro get_fault_ip t1 t2 |
488 | + loadgp |
489 | /* t1 = this_cpu_ptr(&exception_data) */ |
490 | addil LT%exception_data,%r27 |
491 | LDREG RT%exception_data(%r1),\t2 |
492 | + /* %r27 = t2->fault_gp - restore gp */ |
493 | + LDREG EXCDATA_GP(\t2), %r27 |
494 | /* t1 = t2->fault_ip */ |
495 | LDREG EXCDATA_IP(\t2), \t1 |
496 | .endm |
497 | diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c |
498 | index a762864ec92e..f9064449908a 100644 |
499 | --- a/arch/parisc/mm/fault.c |
500 | +++ b/arch/parisc/mm/fault.c |
501 | @@ -151,6 +151,7 @@ int fixup_exception(struct pt_regs *regs) |
502 | struct exception_data *d; |
503 | d = this_cpu_ptr(&exception_data); |
504 | d->fault_ip = regs->iaoq[0]; |
505 | + d->fault_gp = regs->gr[27]; |
506 | d->fault_space = regs->isr; |
507 | d->fault_addr = regs->ior; |
508 | |
509 | diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c |
510 | index 3c5736e52a14..54ed9c7663e6 100644 |
511 | --- a/arch/powerpc/kernel/process.c |
512 | +++ b/arch/powerpc/kernel/process.c |
513 | @@ -854,7 +854,7 @@ void restore_tm_state(struct pt_regs *regs) |
514 | static inline void save_sprs(struct thread_struct *t) |
515 | { |
516 | #ifdef CONFIG_ALTIVEC |
517 | - if (cpu_has_feature(cpu_has_feature(CPU_FTR_ALTIVEC))) |
518 | + if (cpu_has_feature(CPU_FTR_ALTIVEC)) |
519 | t->vrsave = mfspr(SPRN_VRSAVE); |
520 | #endif |
521 | #ifdef CONFIG_PPC_BOOK3S_64 |
522 | diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c |
523 | index 744e24bcb85c..4a811ca7ac9d 100644 |
524 | --- a/arch/powerpc/mm/hugetlbpage.c |
525 | +++ b/arch/powerpc/mm/hugetlbpage.c |
526 | @@ -414,13 +414,13 @@ static void hugepd_free(struct mmu_gather *tlb, void *hugepte) |
527 | { |
528 | struct hugepd_freelist **batchp; |
529 | |
530 | - batchp = this_cpu_ptr(&hugepd_freelist_cur); |
531 | + batchp = &get_cpu_var(hugepd_freelist_cur); |
532 | |
533 | if (atomic_read(&tlb->mm->mm_users) < 2 || |
534 | cpumask_equal(mm_cpumask(tlb->mm), |
535 | cpumask_of(smp_processor_id()))) { |
536 | kmem_cache_free(hugepte_cache, hugepte); |
537 | - put_cpu_var(hugepd_freelist_cur); |
538 | + put_cpu_var(hugepd_freelist_cur); |
539 | return; |
540 | } |
541 | |
542 | diff --git a/arch/s390/mm/gup.c b/arch/s390/mm/gup.c |
543 | index 13dab0c1645c..3776aca22082 100644 |
544 | --- a/arch/s390/mm/gup.c |
545 | +++ b/arch/s390/mm/gup.c |
546 | @@ -20,9 +20,9 @@ |
547 | static inline int gup_pte_range(pmd_t *pmdp, pmd_t pmd, unsigned long addr, |
548 | unsigned long end, int write, struct page **pages, int *nr) |
549 | { |
550 | + struct page *head, *page; |
551 | unsigned long mask; |
552 | pte_t *ptep, pte; |
553 | - struct page *page; |
554 | |
555 | mask = (write ? _PAGE_PROTECT : 0) | _PAGE_INVALID | _PAGE_SPECIAL; |
556 | |
557 | @@ -37,12 +37,14 @@ static inline int gup_pte_range(pmd_t *pmdp, pmd_t pmd, unsigned long addr, |
558 | return 0; |
559 | VM_BUG_ON(!pfn_valid(pte_pfn(pte))); |
560 | page = pte_page(pte); |
561 | - if (!page_cache_get_speculative(page)) |
562 | + head = compound_head(page); |
563 | + if (!page_cache_get_speculative(head)) |
564 | return 0; |
565 | if (unlikely(pte_val(pte) != pte_val(*ptep))) { |
566 | - put_page(page); |
567 | + put_page(head); |
568 | return 0; |
569 | } |
570 | + VM_BUG_ON_PAGE(compound_head(page) != head, page); |
571 | pages[*nr] = page; |
572 | (*nr)++; |
573 | |
574 | diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h |
575 | index 44adbb819041..f8dba2097c40 100644 |
576 | --- a/arch/x86/include/asm/kvm_host.h |
577 | +++ b/arch/x86/include/asm/kvm_host.h |
578 | @@ -42,7 +42,7 @@ |
579 | |
580 | #define KVM_PIO_PAGE_OFFSET 1 |
581 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 2 |
582 | -#define KVM_HALT_POLL_NS_DEFAULT 500000 |
583 | +#define KVM_HALT_POLL_NS_DEFAULT 400000 |
584 | |
585 | #define KVM_IRQCHIP_NUM_PINS KVM_IOAPIC_NUM_PINS |
586 | |
587 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
588 | index d47d231e0d4b..eca5bd9f0e47 100644 |
589 | --- a/arch/x86/kvm/x86.c |
590 | +++ b/arch/x86/kvm/x86.c |
591 | @@ -6074,12 +6074,10 @@ static int inject_pending_event(struct kvm_vcpu *vcpu, bool req_int_win) |
592 | } |
593 | |
594 | /* try to inject new event if pending */ |
595 | - if (vcpu->arch.nmi_pending) { |
596 | - if (kvm_x86_ops->nmi_allowed(vcpu)) { |
597 | - --vcpu->arch.nmi_pending; |
598 | - vcpu->arch.nmi_injected = true; |
599 | - kvm_x86_ops->set_nmi(vcpu); |
600 | - } |
601 | + if (vcpu->arch.nmi_pending && kvm_x86_ops->nmi_allowed(vcpu)) { |
602 | + --vcpu->arch.nmi_pending; |
603 | + vcpu->arch.nmi_injected = true; |
604 | + kvm_x86_ops->set_nmi(vcpu); |
605 | } else if (kvm_cpu_has_injectable_intr(vcpu)) { |
606 | /* |
607 | * Because interrupts can be injected asynchronously, we are |
608 | @@ -6548,10 +6546,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) |
609 | if (inject_pending_event(vcpu, req_int_win) != 0) |
610 | req_immediate_exit = true; |
611 | /* enable NMI/IRQ window open exits if needed */ |
612 | - else if (vcpu->arch.nmi_pending) |
613 | - kvm_x86_ops->enable_nmi_window(vcpu); |
614 | - else if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win) |
615 | - kvm_x86_ops->enable_irq_window(vcpu); |
616 | + else { |
617 | + if (vcpu->arch.nmi_pending) |
618 | + kvm_x86_ops->enable_nmi_window(vcpu); |
619 | + if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win) |
620 | + kvm_x86_ops->enable_irq_window(vcpu); |
621 | + } |
622 | |
623 | if (kvm_lapic_enabled(vcpu)) { |
624 | update_cr8_intercept(vcpu); |
625 | diff --git a/crypto/asymmetric_keys/pkcs7_trust.c b/crypto/asymmetric_keys/pkcs7_trust.c |
626 | index 90d6d47965b0..ecdb5a2ce085 100644 |
627 | --- a/crypto/asymmetric_keys/pkcs7_trust.c |
628 | +++ b/crypto/asymmetric_keys/pkcs7_trust.c |
629 | @@ -178,6 +178,8 @@ int pkcs7_validate_trust(struct pkcs7_message *pkcs7, |
630 | int cached_ret = -ENOKEY; |
631 | int ret; |
632 | |
633 | + *_trusted = false; |
634 | + |
635 | for (p = pkcs7->certs; p; p = p->next) |
636 | p->seen = false; |
637 | |
638 | diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c |
639 | index 4a876785b68c..9745cf9fcd3c 100644 |
640 | --- a/drivers/block/rbd.c |
641 | +++ b/drivers/block/rbd.c |
642 | @@ -1955,7 +1955,7 @@ static struct ceph_osd_request *rbd_osd_req_create( |
643 | |
644 | osdc = &rbd_dev->rbd_client->client->osdc; |
645 | osd_req = ceph_osdc_alloc_request(osdc, snapc, num_ops, false, |
646 | - GFP_ATOMIC); |
647 | + GFP_NOIO); |
648 | if (!osd_req) |
649 | return NULL; /* ENOMEM */ |
650 | |
651 | @@ -2004,7 +2004,7 @@ rbd_osd_req_create_copyup(struct rbd_obj_request *obj_request) |
652 | rbd_dev = img_request->rbd_dev; |
653 | osdc = &rbd_dev->rbd_client->client->osdc; |
654 | osd_req = ceph_osdc_alloc_request(osdc, snapc, num_osd_ops, |
655 | - false, GFP_ATOMIC); |
656 | + false, GFP_NOIO); |
657 | if (!osd_req) |
658 | return NULL; /* ENOMEM */ |
659 | |
660 | @@ -2506,7 +2506,7 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request, |
661 | bio_chain_clone_range(&bio_list, |
662 | &bio_offset, |
663 | clone_size, |
664 | - GFP_ATOMIC); |
665 | + GFP_NOIO); |
666 | if (!obj_request->bio_list) |
667 | goto out_unwind; |
668 | } else if (type == OBJ_REQUEST_PAGES) { |
669 | diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c |
670 | index 99b375c95998..90c1511d731f 100644 |
671 | --- a/drivers/gpio/gpio-pca953x.c |
672 | +++ b/drivers/gpio/gpio-pca953x.c |
673 | @@ -18,6 +18,7 @@ |
674 | #include <linux/i2c.h> |
675 | #include <linux/platform_data/pca953x.h> |
676 | #include <linux/slab.h> |
677 | +#include <asm/unaligned.h> |
678 | #include <linux/of_platform.h> |
679 | #include <linux/acpi.h> |
680 | |
681 | @@ -159,7 +160,7 @@ static int pca953x_write_regs(struct pca953x_chip *chip, int reg, u8 *val) |
682 | switch (chip->chip_type) { |
683 | case PCA953X_TYPE: |
684 | ret = i2c_smbus_write_word_data(chip->client, |
685 | - reg << 1, (u16) *val); |
686 | + reg << 1, cpu_to_le16(get_unaligned((u16 *)val))); |
687 | break; |
688 | case PCA957X_TYPE: |
689 | ret = i2c_smbus_write_byte_data(chip->client, reg << 1, |
690 | diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c |
691 | index b2b7b78664b8..76ac906b4d78 100644 |
692 | --- a/drivers/gpio/gpio-pxa.c |
693 | +++ b/drivers/gpio/gpio-pxa.c |
694 | @@ -283,8 +283,8 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip, |
695 | writel_relaxed(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET)); |
696 | |
697 | ret = pinctrl_gpio_direction_output(chip->base + offset); |
698 | - if (!ret) |
699 | - return 0; |
700 | + if (ret) |
701 | + return ret; |
702 | |
703 | spin_lock_irqsave(&gpio_lock, flags); |
704 | |
705 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c |
706 | index 7a4b101e10c6..75cb5b9b88f8 100644 |
707 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c |
708 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c |
709 | @@ -816,10 +816,13 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device, |
710 | struct drm_device *ddev = adev->ddev; |
711 | struct drm_crtc *crtc; |
712 | uint32_t line_time_us, vblank_lines; |
713 | + struct cgs_mode_info *mode_info; |
714 | |
715 | if (info == NULL) |
716 | return -EINVAL; |
717 | |
718 | + mode_info = info->mode_info; |
719 | + |
720 | if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) { |
721 | list_for_each_entry(crtc, |
722 | &ddev->mode_config.crtc_list, head) { |
723 | @@ -828,7 +831,7 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device, |
724 | info->active_display_mask |= (1 << amdgpu_crtc->crtc_id); |
725 | info->display_count++; |
726 | } |
727 | - if (info->mode_info != NULL && |
728 | + if (mode_info != NULL && |
729 | crtc->enabled && amdgpu_crtc->enabled && |
730 | amdgpu_crtc->hw_mode.clock) { |
731 | line_time_us = (amdgpu_crtc->hw_mode.crtc_htotal * 1000) / |
732 | @@ -836,10 +839,10 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device, |
733 | vblank_lines = amdgpu_crtc->hw_mode.crtc_vblank_end - |
734 | amdgpu_crtc->hw_mode.crtc_vdisplay + |
735 | (amdgpu_crtc->v_border * 2); |
736 | - info->mode_info->vblank_time_us = vblank_lines * line_time_us; |
737 | - info->mode_info->refresh_rate = drm_mode_vrefresh(&amdgpu_crtc->hw_mode); |
738 | - info->mode_info->ref_clock = adev->clock.spll.reference_freq; |
739 | - info->mode_info++; |
740 | + mode_info->vblank_time_us = vblank_lines * line_time_us; |
741 | + mode_info->refresh_rate = drm_mode_vrefresh(&amdgpu_crtc->hw_mode); |
742 | + mode_info->ref_clock = adev->clock.spll.reference_freq; |
743 | + mode_info = NULL; |
744 | } |
745 | } |
746 | } |
747 | diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c |
748 | index b8060795b27b..53964b14ff48 100644 |
749 | --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c |
750 | +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c |
751 | @@ -902,14 +902,6 @@ static int gmc_v7_0_early_init(void *handle) |
752 | gmc_v7_0_set_gart_funcs(adev); |
753 | gmc_v7_0_set_irq_funcs(adev); |
754 | |
755 | - if (adev->flags & AMD_IS_APU) { |
756 | - adev->mc.vram_type = AMDGPU_VRAM_TYPE_UNKNOWN; |
757 | - } else { |
758 | - u32 tmp = RREG32(mmMC_SEQ_MISC0); |
759 | - tmp &= MC_SEQ_MISC0__MT__MASK; |
760 | - adev->mc.vram_type = gmc_v7_0_convert_vram_type(tmp); |
761 | - } |
762 | - |
763 | return 0; |
764 | } |
765 | |
766 | @@ -930,6 +922,14 @@ static int gmc_v7_0_sw_init(void *handle) |
767 | if (r) |
768 | return r; |
769 | |
770 | + if (adev->flags & AMD_IS_APU) { |
771 | + adev->mc.vram_type = AMDGPU_VRAM_TYPE_UNKNOWN; |
772 | + } else { |
773 | + u32 tmp = RREG32(mmMC_SEQ_MISC0); |
774 | + tmp &= MC_SEQ_MISC0__MT__MASK; |
775 | + adev->mc.vram_type = gmc_v7_0_convert_vram_type(tmp); |
776 | + } |
777 | + |
778 | r = amdgpu_irq_add_id(adev, 146, &adev->mc.vm_fault); |
779 | if (r) |
780 | return r; |
781 | diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c |
782 | index 3efd45546241..e59251f4a85d 100644 |
783 | --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c |
784 | +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c |
785 | @@ -856,14 +856,6 @@ static int gmc_v8_0_early_init(void *handle) |
786 | gmc_v8_0_set_gart_funcs(adev); |
787 | gmc_v8_0_set_irq_funcs(adev); |
788 | |
789 | - if (adev->flags & AMD_IS_APU) { |
790 | - adev->mc.vram_type = AMDGPU_VRAM_TYPE_UNKNOWN; |
791 | - } else { |
792 | - u32 tmp = RREG32(mmMC_SEQ_MISC0); |
793 | - tmp &= MC_SEQ_MISC0__MT__MASK; |
794 | - adev->mc.vram_type = gmc_v8_0_convert_vram_type(tmp); |
795 | - } |
796 | - |
797 | return 0; |
798 | } |
799 | |
800 | @@ -874,6 +866,8 @@ static int gmc_v8_0_late_init(void *handle) |
801 | return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0); |
802 | } |
803 | |
804 | +#define mmMC_SEQ_MISC0_FIJI 0xA71 |
805 | + |
806 | static int gmc_v8_0_sw_init(void *handle) |
807 | { |
808 | int r; |
809 | @@ -884,6 +878,19 @@ static int gmc_v8_0_sw_init(void *handle) |
810 | if (r) |
811 | return r; |
812 | |
813 | + if (adev->flags & AMD_IS_APU) { |
814 | + adev->mc.vram_type = AMDGPU_VRAM_TYPE_UNKNOWN; |
815 | + } else { |
816 | + u32 tmp; |
817 | + |
818 | + if (adev->asic_type == CHIP_FIJI) |
819 | + tmp = RREG32(mmMC_SEQ_MISC0_FIJI); |
820 | + else |
821 | + tmp = RREG32(mmMC_SEQ_MISC0); |
822 | + tmp &= MC_SEQ_MISC0__MT__MASK; |
823 | + adev->mc.vram_type = gmc_v8_0_convert_vram_type(tmp); |
824 | + } |
825 | + |
826 | r = amdgpu_irq_add_id(adev, 146, &adev->mc.vm_fault); |
827 | if (r) |
828 | return r; |
829 | diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c |
830 | index 9535c5b60387..7e5a97204051 100644 |
831 | --- a/drivers/gpu/drm/drm_dp_helper.c |
832 | +++ b/drivers/gpu/drm/drm_dp_helper.c |
833 | @@ -178,7 +178,7 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, |
834 | { |
835 | struct drm_dp_aux_msg msg; |
836 | unsigned int retry; |
837 | - int err; |
838 | + int err = 0; |
839 | |
840 | memset(&msg, 0, sizeof(msg)); |
841 | msg.address = offset; |
842 | @@ -186,6 +186,8 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, |
843 | msg.buffer = buffer; |
844 | msg.size = size; |
845 | |
846 | + mutex_lock(&aux->hw_mutex); |
847 | + |
848 | /* |
849 | * The specification doesn't give any recommendation on how often to |
850 | * retry native transactions. We used to retry 7 times like for |
851 | @@ -194,25 +196,24 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, |
852 | */ |
853 | for (retry = 0; retry < 32; retry++) { |
854 | |
855 | - mutex_lock(&aux->hw_mutex); |
856 | err = aux->transfer(aux, &msg); |
857 | - mutex_unlock(&aux->hw_mutex); |
858 | if (err < 0) { |
859 | if (err == -EBUSY) |
860 | continue; |
861 | |
862 | - return err; |
863 | + goto unlock; |
864 | } |
865 | |
866 | |
867 | switch (msg.reply & DP_AUX_NATIVE_REPLY_MASK) { |
868 | case DP_AUX_NATIVE_REPLY_ACK: |
869 | if (err < size) |
870 | - return -EPROTO; |
871 | - return err; |
872 | + err = -EPROTO; |
873 | + goto unlock; |
874 | |
875 | case DP_AUX_NATIVE_REPLY_NACK: |
876 | - return -EIO; |
877 | + err = -EIO; |
878 | + goto unlock; |
879 | |
880 | case DP_AUX_NATIVE_REPLY_DEFER: |
881 | usleep_range(AUX_RETRY_INTERVAL, AUX_RETRY_INTERVAL + 100); |
882 | @@ -221,7 +222,11 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, |
883 | } |
884 | |
885 | DRM_DEBUG_KMS("too many retries, giving up\n"); |
886 | - return -EIO; |
887 | + err = -EIO; |
888 | + |
889 | +unlock: |
890 | + mutex_unlock(&aux->hw_mutex); |
891 | + return err; |
892 | } |
893 | |
894 | /** |
895 | @@ -543,9 +548,7 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) |
896 | int max_retries = max(7, drm_dp_i2c_retry_count(msg, dp_aux_i2c_speed_khz)); |
897 | |
898 | for (retry = 0, defer_i2c = 0; retry < (max_retries + defer_i2c); retry++) { |
899 | - mutex_lock(&aux->hw_mutex); |
900 | ret = aux->transfer(aux, msg); |
901 | - mutex_unlock(&aux->hw_mutex); |
902 | if (ret < 0) { |
903 | if (ret == -EBUSY) |
904 | continue; |
905 | @@ -684,6 +687,8 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, |
906 | |
907 | memset(&msg, 0, sizeof(msg)); |
908 | |
909 | + mutex_lock(&aux->hw_mutex); |
910 | + |
911 | for (i = 0; i < num; i++) { |
912 | msg.address = msgs[i].addr; |
913 | drm_dp_i2c_msg_set_request(&msg, &msgs[i]); |
914 | @@ -738,6 +743,8 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, |
915 | msg.size = 0; |
916 | (void)drm_dp_i2c_do_msg(aux, &msg); |
917 | |
918 | + mutex_unlock(&aux->hw_mutex); |
919 | + |
920 | return err; |
921 | } |
922 | |
923 | diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c |
924 | index a82b891ae1fe..7285adb27099 100644 |
925 | --- a/drivers/gpu/drm/radeon/si_dpm.c |
926 | +++ b/drivers/gpu/drm/radeon/si_dpm.c |
927 | @@ -2926,9 +2926,11 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = { |
928 | /* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */ |
929 | { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 }, |
930 | { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 }, |
931 | + { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0x2015, 0, 120000 }, |
932 | { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 }, |
933 | { PCI_VENDOR_ID_ATI, 0x6811, 0x1462, 0x2015, 0, 120000 }, |
934 | { PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 }, |
935 | + { PCI_VENDOR_ID_ATI, 0x6811, 0x148c, 0x2015, 0, 120000 }, |
936 | { 0, 0, 0, 0 }, |
937 | }; |
938 | |
939 | @@ -3008,6 +3010,10 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, |
940 | } |
941 | ++p; |
942 | } |
943 | + /* limit mclk on all R7 370 parts for stability */ |
944 | + if (rdev->pdev->device == 0x6811 && |
945 | + rdev->pdev->revision == 0x81) |
946 | + max_mclk = 120000; |
947 | |
948 | if (rps->vce_active) { |
949 | rps->evclk = rdev->pm.dpm.vce_states[rdev->pm.dpm.vce_level].evclk; |
950 | diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c |
951 | index 200419d4d43c..18a2acbccb7d 100644 |
952 | --- a/drivers/gpu/drm/udl/udl_fb.c |
953 | +++ b/drivers/gpu/drm/udl/udl_fb.c |
954 | @@ -538,7 +538,7 @@ static int udlfb_create(struct drm_fb_helper *helper, |
955 | out_destroy_fbi: |
956 | drm_fb_helper_release_fbi(helper); |
957 | out_gfree: |
958 | - drm_gem_object_unreference(&ufbdev->ufb.obj->base); |
959 | + drm_gem_object_unreference_unlocked(&ufbdev->ufb.obj->base); |
960 | out: |
961 | return ret; |
962 | } |
963 | diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c |
964 | index 2a0a784ab6ee..d7528e0d8442 100644 |
965 | --- a/drivers/gpu/drm/udl/udl_gem.c |
966 | +++ b/drivers/gpu/drm/udl/udl_gem.c |
967 | @@ -52,7 +52,7 @@ udl_gem_create(struct drm_file *file, |
968 | return ret; |
969 | } |
970 | |
971 | - drm_gem_object_unreference(&obj->base); |
972 | + drm_gem_object_unreference_unlocked(&obj->base); |
973 | *handle_p = handle; |
974 | return 0; |
975 | } |
976 | diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c |
977 | index ad71160b9ea4..ae83af649a60 100644 |
978 | --- a/drivers/hid/usbhid/hid-core.c |
979 | +++ b/drivers/hid/usbhid/hid-core.c |
980 | @@ -951,14 +951,6 @@ static int usbhid_output_report(struct hid_device *hid, __u8 *buf, size_t count) |
981 | return ret; |
982 | } |
983 | |
984 | -static void usbhid_restart_queues(struct usbhid_device *usbhid) |
985 | -{ |
986 | - if (usbhid->urbout && !test_bit(HID_OUT_RUNNING, &usbhid->iofl)) |
987 | - usbhid_restart_out_queue(usbhid); |
988 | - if (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl)) |
989 | - usbhid_restart_ctrl_queue(usbhid); |
990 | -} |
991 | - |
992 | static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid) |
993 | { |
994 | struct usbhid_device *usbhid = hid->driver_data; |
995 | @@ -1404,6 +1396,37 @@ static void hid_cease_io(struct usbhid_device *usbhid) |
996 | usb_kill_urb(usbhid->urbout); |
997 | } |
998 | |
999 | +static void hid_restart_io(struct hid_device *hid) |
1000 | +{ |
1001 | + struct usbhid_device *usbhid = hid->driver_data; |
1002 | + int clear_halt = test_bit(HID_CLEAR_HALT, &usbhid->iofl); |
1003 | + int reset_pending = test_bit(HID_RESET_PENDING, &usbhid->iofl); |
1004 | + |
1005 | + spin_lock_irq(&usbhid->lock); |
1006 | + clear_bit(HID_SUSPENDED, &usbhid->iofl); |
1007 | + usbhid_mark_busy(usbhid); |
1008 | + |
1009 | + if (clear_halt || reset_pending) |
1010 | + schedule_work(&usbhid->reset_work); |
1011 | + usbhid->retry_delay = 0; |
1012 | + spin_unlock_irq(&usbhid->lock); |
1013 | + |
1014 | + if (reset_pending || !test_bit(HID_STARTED, &usbhid->iofl)) |
1015 | + return; |
1016 | + |
1017 | + if (!clear_halt) { |
1018 | + if (hid_start_in(hid) < 0) |
1019 | + hid_io_error(hid); |
1020 | + } |
1021 | + |
1022 | + spin_lock_irq(&usbhid->lock); |
1023 | + if (usbhid->urbout && !test_bit(HID_OUT_RUNNING, &usbhid->iofl)) |
1024 | + usbhid_restart_out_queue(usbhid); |
1025 | + if (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl)) |
1026 | + usbhid_restart_ctrl_queue(usbhid); |
1027 | + spin_unlock_irq(&usbhid->lock); |
1028 | +} |
1029 | + |
1030 | /* Treat USB reset pretty much the same as suspend/resume */ |
1031 | static int hid_pre_reset(struct usb_interface *intf) |
1032 | { |
1033 | @@ -1453,14 +1476,14 @@ static int hid_post_reset(struct usb_interface *intf) |
1034 | return 1; |
1035 | } |
1036 | |
1037 | + /* No need to do another reset or clear a halted endpoint */ |
1038 | spin_lock_irq(&usbhid->lock); |
1039 | clear_bit(HID_RESET_PENDING, &usbhid->iofl); |
1040 | + clear_bit(HID_CLEAR_HALT, &usbhid->iofl); |
1041 | spin_unlock_irq(&usbhid->lock); |
1042 | hid_set_idle(dev, intf->cur_altsetting->desc.bInterfaceNumber, 0, 0); |
1043 | - status = hid_start_in(hid); |
1044 | - if (status < 0) |
1045 | - hid_io_error(hid); |
1046 | - usbhid_restart_queues(usbhid); |
1047 | + |
1048 | + hid_restart_io(hid); |
1049 | |
1050 | return 0; |
1051 | } |
1052 | @@ -1483,25 +1506,9 @@ void usbhid_put_power(struct hid_device *hid) |
1053 | #ifdef CONFIG_PM |
1054 | static int hid_resume_common(struct hid_device *hid, bool driver_suspended) |
1055 | { |
1056 | - struct usbhid_device *usbhid = hid->driver_data; |
1057 | - int status; |
1058 | - |
1059 | - spin_lock_irq(&usbhid->lock); |
1060 | - clear_bit(HID_SUSPENDED, &usbhid->iofl); |
1061 | - usbhid_mark_busy(usbhid); |
1062 | - |
1063 | - if (test_bit(HID_CLEAR_HALT, &usbhid->iofl) || |
1064 | - test_bit(HID_RESET_PENDING, &usbhid->iofl)) |
1065 | - schedule_work(&usbhid->reset_work); |
1066 | - usbhid->retry_delay = 0; |
1067 | - |
1068 | - usbhid_restart_queues(usbhid); |
1069 | - spin_unlock_irq(&usbhid->lock); |
1070 | - |
1071 | - status = hid_start_in(hid); |
1072 | - if (status < 0) |
1073 | - hid_io_error(hid); |
1074 | + int status = 0; |
1075 | |
1076 | + hid_restart_io(hid); |
1077 | if (driver_suspended && hid->driver && hid->driver->resume) |
1078 | status = hid->driver->resume(hid); |
1079 | return status; |
1080 | @@ -1570,12 +1577,8 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message) |
1081 | static int hid_resume(struct usb_interface *intf) |
1082 | { |
1083 | struct hid_device *hid = usb_get_intfdata (intf); |
1084 | - struct usbhid_device *usbhid = hid->driver_data; |
1085 | int status; |
1086 | |
1087 | - if (!test_bit(HID_STARTED, &usbhid->iofl)) |
1088 | - return 0; |
1089 | - |
1090 | status = hid_resume_common(hid, true); |
1091 | dev_dbg(&intf->dev, "resume status %d\n", status); |
1092 | return 0; |
1093 | @@ -1584,10 +1587,8 @@ static int hid_resume(struct usb_interface *intf) |
1094 | static int hid_reset_resume(struct usb_interface *intf) |
1095 | { |
1096 | struct hid_device *hid = usb_get_intfdata(intf); |
1097 | - struct usbhid_device *usbhid = hid->driver_data; |
1098 | int status; |
1099 | |
1100 | - clear_bit(HID_SUSPENDED, &usbhid->iofl); |
1101 | status = hid_post_reset(intf); |
1102 | if (status >= 0 && hid->driver && hid->driver->reset_resume) { |
1103 | int ret = hid->driver->reset_resume(hid); |
1104 | diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c |
1105 | index 99ef77fcfb80..94a8875b38fb 100644 |
1106 | --- a/drivers/hid/wacom_wac.c |
1107 | +++ b/drivers/hid/wacom_wac.c |
1108 | @@ -2409,6 +2409,17 @@ void wacom_setup_device_quirks(struct wacom *wacom) |
1109 | } |
1110 | |
1111 | /* |
1112 | + * Hack for the Bamboo One: |
1113 | + * the device presents a PAD/Touch interface as most Bamboos and even |
1114 | + * sends ghosts PAD data on it. However, later, we must disable this |
1115 | + * ghost interface, and we can not detect it unless we set it here |
1116 | + * to WACOM_DEVICETYPE_PAD or WACOM_DEVICETYPE_TOUCH. |
1117 | + */ |
1118 | + if (features->type == BAMBOO_PEN && |
1119 | + features->pktlen == WACOM_PKGLEN_BBTOUCH3) |
1120 | + features->device_type |= WACOM_DEVICETYPE_PAD; |
1121 | + |
1122 | + /* |
1123 | * Raw Wacom-mode pen and touch events both come from interface |
1124 | * 0, whose HID descriptor has an application usage of 0xFF0D |
1125 | * (i.e., WACOM_VENDORDEFINED_PEN). We route pen packets back |
1126 | diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c |
1127 | index 36544c4f653c..303d0c9df907 100644 |
1128 | --- a/drivers/hwmon/max1111.c |
1129 | +++ b/drivers/hwmon/max1111.c |
1130 | @@ -85,6 +85,9 @@ static struct max1111_data *the_max1111; |
1131 | |
1132 | int max1111_read_channel(int channel) |
1133 | { |
1134 | + if (!the_max1111 || !the_max1111->spi) |
1135 | + return -ENODEV; |
1136 | + |
1137 | return max1111_read(&the_max1111->spi->dev, channel); |
1138 | } |
1139 | EXPORT_SYMBOL(max1111_read_channel); |
1140 | @@ -258,6 +261,9 @@ static int max1111_remove(struct spi_device *spi) |
1141 | { |
1142 | struct max1111_data *data = spi_get_drvdata(spi); |
1143 | |
1144 | +#ifdef CONFIG_SHARPSL_PM |
1145 | + the_max1111 = NULL; |
1146 | +#endif |
1147 | hwmon_device_unregister(data->hwmon_dev); |
1148 | sysfs_remove_group(&spi->dev.kobj, &max1110_attr_group); |
1149 | sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group); |
1150 | diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c |
1151 | index c73331f7782b..2072a31e813b 100644 |
1152 | --- a/drivers/iio/accel/bmc150-accel-core.c |
1153 | +++ b/drivers/iio/accel/bmc150-accel-core.c |
1154 | @@ -547,7 +547,7 @@ static int bmc150_accel_get_axis(struct bmc150_accel_data *data, |
1155 | { |
1156 | int ret; |
1157 | int axis = chan->scan_index; |
1158 | - unsigned int raw_val; |
1159 | + __le16 raw_val; |
1160 | |
1161 | mutex_lock(&data->mutex); |
1162 | ret = bmc150_accel_set_power_state(data, true); |
1163 | @@ -557,14 +557,14 @@ static int bmc150_accel_get_axis(struct bmc150_accel_data *data, |
1164 | } |
1165 | |
1166 | ret = regmap_bulk_read(data->regmap, BMC150_ACCEL_AXIS_TO_REG(axis), |
1167 | - &raw_val, 2); |
1168 | + &raw_val, sizeof(raw_val)); |
1169 | if (ret < 0) { |
1170 | dev_err(data->dev, "Error reading axis %d\n", axis); |
1171 | bmc150_accel_set_power_state(data, false); |
1172 | mutex_unlock(&data->mutex); |
1173 | return ret; |
1174 | } |
1175 | - *val = sign_extend32(raw_val >> chan->scan_type.shift, |
1176 | + *val = sign_extend32(le16_to_cpu(raw_val) >> chan->scan_type.shift, |
1177 | chan->scan_type.realbits - 1); |
1178 | ret = bmc150_accel_set_power_state(data, false); |
1179 | mutex_unlock(&data->mutex); |
1180 | @@ -988,6 +988,7 @@ static const struct iio_event_spec bmc150_accel_event = { |
1181 | .realbits = (bits), \ |
1182 | .storagebits = 16, \ |
1183 | .shift = 16 - (bits), \ |
1184 | + .endianness = IIO_LE, \ |
1185 | }, \ |
1186 | .event_spec = &bmc150_accel_event, \ |
1187 | .num_event_specs = 1 \ |
1188 | diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c |
1189 | index bbce3b09ac45..4dac567e75b4 100644 |
1190 | --- a/drivers/iio/gyro/bmg160_core.c |
1191 | +++ b/drivers/iio/gyro/bmg160_core.c |
1192 | @@ -452,7 +452,7 @@ static int bmg160_get_temp(struct bmg160_data *data, int *val) |
1193 | static int bmg160_get_axis(struct bmg160_data *data, int axis, int *val) |
1194 | { |
1195 | int ret; |
1196 | - unsigned int raw_val; |
1197 | + __le16 raw_val; |
1198 | |
1199 | mutex_lock(&data->mutex); |
1200 | ret = bmg160_set_power_state(data, true); |
1201 | @@ -462,7 +462,7 @@ static int bmg160_get_axis(struct bmg160_data *data, int axis, int *val) |
1202 | } |
1203 | |
1204 | ret = regmap_bulk_read(data->regmap, BMG160_AXIS_TO_REG(axis), &raw_val, |
1205 | - 2); |
1206 | + sizeof(raw_val)); |
1207 | if (ret < 0) { |
1208 | dev_err(data->dev, "Error reading axis %d\n", axis); |
1209 | bmg160_set_power_state(data, false); |
1210 | @@ -470,7 +470,7 @@ static int bmg160_get_axis(struct bmg160_data *data, int axis, int *val) |
1211 | return ret; |
1212 | } |
1213 | |
1214 | - *val = sign_extend32(raw_val, 15); |
1215 | + *val = sign_extend32(le16_to_cpu(raw_val), 15); |
1216 | ret = bmg160_set_power_state(data, false); |
1217 | mutex_unlock(&data->mutex); |
1218 | if (ret < 0) |
1219 | @@ -733,6 +733,7 @@ static const struct iio_event_spec bmg160_event = { |
1220 | .sign = 's', \ |
1221 | .realbits = 16, \ |
1222 | .storagebits = 16, \ |
1223 | + .endianness = IIO_LE, \ |
1224 | }, \ |
1225 | .event_spec = &bmg160_event, \ |
1226 | .num_event_specs = 1 \ |
1227 | @@ -780,7 +781,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p) |
1228 | mutex_unlock(&data->mutex); |
1229 | goto err; |
1230 | } |
1231 | - data->buffer[i++] = ret; |
1232 | + data->buffer[i++] = val; |
1233 | } |
1234 | mutex_unlock(&data->mutex); |
1235 | |
1236 | diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c |
1237 | index 139ae916225f..5b6abc541e8c 100644 |
1238 | --- a/drivers/iio/industrialio-buffer.c |
1239 | +++ b/drivers/iio/industrialio-buffer.c |
1240 | @@ -645,6 +645,7 @@ static int iio_verify_update(struct iio_dev *indio_dev, |
1241 | unsigned int modes; |
1242 | |
1243 | memset(config, 0, sizeof(*config)); |
1244 | + config->watermark = ~0; |
1245 | |
1246 | /* |
1247 | * If there is just one buffer and we are removing it there is nothing |
1248 | diff --git a/drivers/iio/magnetometer/st_magn.h b/drivers/iio/magnetometer/st_magn.h |
1249 | index 06a4d9c35581..9daca4681922 100644 |
1250 | --- a/drivers/iio/magnetometer/st_magn.h |
1251 | +++ b/drivers/iio/magnetometer/st_magn.h |
1252 | @@ -44,6 +44,7 @@ static inline int st_magn_allocate_ring(struct iio_dev *indio_dev) |
1253 | static inline void st_magn_deallocate_ring(struct iio_dev *indio_dev) |
1254 | { |
1255 | } |
1256 | +#define ST_MAGN_TRIGGER_SET_STATE NULL |
1257 | #endif /* CONFIG_IIO_BUFFER */ |
1258 | |
1259 | #endif /* ST_MAGN_H */ |
1260 | diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c |
1261 | index 0e3b0092ec92..515bb8b80952 100644 |
1262 | --- a/drivers/iommu/iommu.c |
1263 | +++ b/drivers/iommu/iommu.c |
1264 | @@ -848,7 +848,8 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev) |
1265 | if (!group->default_domain) { |
1266 | group->default_domain = __iommu_domain_alloc(dev->bus, |
1267 | IOMMU_DOMAIN_DMA); |
1268 | - group->domain = group->default_domain; |
1269 | + if (!group->domain) |
1270 | + group->domain = group->default_domain; |
1271 | } |
1272 | |
1273 | ret = iommu_group_add_device(group, dev); |
1274 | diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c |
1275 | index 2d782ce94a67..7ae89c684783 100644 |
1276 | --- a/drivers/media/platform/coda/coda-common.c |
1277 | +++ b/drivers/media/platform/coda/coda-common.c |
1278 | @@ -2118,14 +2118,12 @@ static int coda_probe(struct platform_device *pdev) |
1279 | |
1280 | pdev_id = of_id ? of_id->data : platform_get_device_id(pdev); |
1281 | |
1282 | - if (of_id) { |
1283 | + if (of_id) |
1284 | dev->devtype = of_id->data; |
1285 | - } else if (pdev_id) { |
1286 | + else if (pdev_id) |
1287 | dev->devtype = &coda_devdata[pdev_id->driver_data]; |
1288 | - } else { |
1289 | - ret = -EINVAL; |
1290 | - goto err_v4l2_register; |
1291 | - } |
1292 | + else |
1293 | + return -EINVAL; |
1294 | |
1295 | spin_lock_init(&dev->irqlock); |
1296 | INIT_LIST_HEAD(&dev->instances); |
1297 | diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c |
1298 | index 6310acab60e7..d41ae950d1a1 100644 |
1299 | --- a/drivers/media/platform/vsp1/vsp1_sru.c |
1300 | +++ b/drivers/media/platform/vsp1/vsp1_sru.c |
1301 | @@ -154,6 +154,7 @@ static int sru_s_stream(struct v4l2_subdev *subdev, int enable) |
1302 | mutex_lock(sru->ctrls.lock); |
1303 | ctrl0 |= vsp1_sru_read(sru, VI6_SRU_CTRL0) |
1304 | & (VI6_SRU_CTRL0_PARAM0_MASK | VI6_SRU_CTRL0_PARAM1_MASK); |
1305 | + vsp1_sru_write(sru, VI6_SRU_CTRL0, ctrl0); |
1306 | mutex_unlock(sru->ctrls.lock); |
1307 | |
1308 | vsp1_sru_write(sru, VI6_SRU_CTRL1, VI6_SRU_CTRL1_PARAM5); |
1309 | diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c |
1310 | index 9e29e70a78d7..d8988801dde0 100644 |
1311 | --- a/drivers/media/usb/au0828/au0828-core.c |
1312 | +++ b/drivers/media/usb/au0828/au0828-core.c |
1313 | @@ -192,7 +192,7 @@ static void au0828_usb_disconnect(struct usb_interface *interface) |
1314 | Set the status so poll routines can check and avoid |
1315 | access after disconnect. |
1316 | */ |
1317 | - dev->dev_state = DEV_DISCONNECTED; |
1318 | + set_bit(DEV_DISCONNECTED, &dev->dev_state); |
1319 | |
1320 | au0828_rc_unregister(dev); |
1321 | /* Digital TV */ |
1322 | diff --git a/drivers/media/usb/au0828/au0828-input.c b/drivers/media/usb/au0828/au0828-input.c |
1323 | index b0f067971979..3d6687f0407d 100644 |
1324 | --- a/drivers/media/usb/au0828/au0828-input.c |
1325 | +++ b/drivers/media/usb/au0828/au0828-input.c |
1326 | @@ -130,7 +130,7 @@ static int au0828_get_key_au8522(struct au0828_rc *ir) |
1327 | bool first = true; |
1328 | |
1329 | /* do nothing if device is disconnected */ |
1330 | - if (ir->dev->dev_state == DEV_DISCONNECTED) |
1331 | + if (test_bit(DEV_DISCONNECTED, &ir->dev->dev_state)) |
1332 | return 0; |
1333 | |
1334 | /* Check IR int */ |
1335 | @@ -260,7 +260,7 @@ static void au0828_rc_stop(struct rc_dev *rc) |
1336 | cancel_delayed_work_sync(&ir->work); |
1337 | |
1338 | /* do nothing if device is disconnected */ |
1339 | - if (ir->dev->dev_state != DEV_DISCONNECTED) { |
1340 | + if (!test_bit(DEV_DISCONNECTED, &ir->dev->dev_state)) { |
1341 | /* Disable IR */ |
1342 | au8522_rc_clear(ir, 0xe0, 1 << 4); |
1343 | } |
1344 | diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c |
1345 | index a13625722848..8bc69af874a0 100644 |
1346 | --- a/drivers/media/usb/au0828/au0828-video.c |
1347 | +++ b/drivers/media/usb/au0828/au0828-video.c |
1348 | @@ -104,14 +104,13 @@ static inline void print_err_status(struct au0828_dev *dev, |
1349 | |
1350 | static int check_dev(struct au0828_dev *dev) |
1351 | { |
1352 | - if (dev->dev_state & DEV_DISCONNECTED) { |
1353 | + if (test_bit(DEV_DISCONNECTED, &dev->dev_state)) { |
1354 | pr_info("v4l2 ioctl: device not present\n"); |
1355 | return -ENODEV; |
1356 | } |
1357 | |
1358 | - if (dev->dev_state & DEV_MISCONFIGURED) { |
1359 | - pr_info("v4l2 ioctl: device is misconfigured; " |
1360 | - "close and open it again\n"); |
1361 | + if (test_bit(DEV_MISCONFIGURED, &dev->dev_state)) { |
1362 | + pr_info("v4l2 ioctl: device is misconfigured; close and open it again\n"); |
1363 | return -EIO; |
1364 | } |
1365 | return 0; |
1366 | @@ -519,8 +518,8 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb) |
1367 | if (!dev) |
1368 | return 0; |
1369 | |
1370 | - if ((dev->dev_state & DEV_DISCONNECTED) || |
1371 | - (dev->dev_state & DEV_MISCONFIGURED)) |
1372 | + if (test_bit(DEV_DISCONNECTED, &dev->dev_state) || |
1373 | + test_bit(DEV_MISCONFIGURED, &dev->dev_state)) |
1374 | return 0; |
1375 | |
1376 | if (urb->status < 0) { |
1377 | @@ -822,10 +821,10 @@ static int au0828_stream_interrupt(struct au0828_dev *dev) |
1378 | int ret = 0; |
1379 | |
1380 | dev->stream_state = STREAM_INTERRUPT; |
1381 | - if (dev->dev_state == DEV_DISCONNECTED) |
1382 | + if (test_bit(DEV_DISCONNECTED, &dev->dev_state)) |
1383 | return -ENODEV; |
1384 | else if (ret) { |
1385 | - dev->dev_state = DEV_MISCONFIGURED; |
1386 | + set_bit(DEV_MISCONFIGURED, &dev->dev_state); |
1387 | dprintk(1, "%s device is misconfigured!\n", __func__); |
1388 | return ret; |
1389 | } |
1390 | @@ -1014,7 +1013,7 @@ static int au0828_v4l2_open(struct file *filp) |
1391 | int ret; |
1392 | |
1393 | dprintk(1, |
1394 | - "%s called std_set %d dev_state %d stream users %d users %d\n", |
1395 | + "%s called std_set %d dev_state %ld stream users %d users %d\n", |
1396 | __func__, dev->std_set_in_tuner_core, dev->dev_state, |
1397 | dev->streaming_users, dev->users); |
1398 | |
1399 | @@ -1033,7 +1032,7 @@ static int au0828_v4l2_open(struct file *filp) |
1400 | au0828_analog_stream_enable(dev); |
1401 | au0828_analog_stream_reset(dev); |
1402 | dev->stream_state = STREAM_OFF; |
1403 | - dev->dev_state |= DEV_INITIALIZED; |
1404 | + set_bit(DEV_INITIALIZED, &dev->dev_state); |
1405 | } |
1406 | dev->users++; |
1407 | mutex_unlock(&dev->lock); |
1408 | @@ -1047,7 +1046,7 @@ static int au0828_v4l2_close(struct file *filp) |
1409 | struct video_device *vdev = video_devdata(filp); |
1410 | |
1411 | dprintk(1, |
1412 | - "%s called std_set %d dev_state %d stream users %d users %d\n", |
1413 | + "%s called std_set %d dev_state %ld stream users %d users %d\n", |
1414 | __func__, dev->std_set_in_tuner_core, dev->dev_state, |
1415 | dev->streaming_users, dev->users); |
1416 | |
1417 | @@ -1063,7 +1062,7 @@ static int au0828_v4l2_close(struct file *filp) |
1418 | del_timer_sync(&dev->vbi_timeout); |
1419 | } |
1420 | |
1421 | - if (dev->dev_state == DEV_DISCONNECTED) |
1422 | + if (test_bit(DEV_DISCONNECTED, &dev->dev_state)) |
1423 | goto end; |
1424 | |
1425 | if (dev->users == 1) { |
1426 | @@ -1092,7 +1091,7 @@ static void au0828_init_tuner(struct au0828_dev *dev) |
1427 | .type = V4L2_TUNER_ANALOG_TV, |
1428 | }; |
1429 | |
1430 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1431 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1432 | dev->std_set_in_tuner_core, dev->dev_state); |
1433 | |
1434 | if (dev->std_set_in_tuner_core) |
1435 | @@ -1164,7 +1163,7 @@ static int vidioc_querycap(struct file *file, void *priv, |
1436 | struct video_device *vdev = video_devdata(file); |
1437 | struct au0828_dev *dev = video_drvdata(file); |
1438 | |
1439 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1440 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1441 | dev->std_set_in_tuner_core, dev->dev_state); |
1442 | |
1443 | strlcpy(cap->driver, "au0828", sizeof(cap->driver)); |
1444 | @@ -1207,7 +1206,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, |
1445 | { |
1446 | struct au0828_dev *dev = video_drvdata(file); |
1447 | |
1448 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1449 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1450 | dev->std_set_in_tuner_core, dev->dev_state); |
1451 | |
1452 | f->fmt.pix.width = dev->width; |
1453 | @@ -1226,7 +1225,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, |
1454 | { |
1455 | struct au0828_dev *dev = video_drvdata(file); |
1456 | |
1457 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1458 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1459 | dev->std_set_in_tuner_core, dev->dev_state); |
1460 | |
1461 | return au0828_set_format(dev, VIDIOC_TRY_FMT, f); |
1462 | @@ -1238,7 +1237,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, |
1463 | struct au0828_dev *dev = video_drvdata(file); |
1464 | int rc; |
1465 | |
1466 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1467 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1468 | dev->std_set_in_tuner_core, dev->dev_state); |
1469 | |
1470 | rc = check_dev(dev); |
1471 | @@ -1260,7 +1259,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm) |
1472 | { |
1473 | struct au0828_dev *dev = video_drvdata(file); |
1474 | |
1475 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1476 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1477 | dev->std_set_in_tuner_core, dev->dev_state); |
1478 | |
1479 | if (norm == dev->std) |
1480 | @@ -1292,7 +1291,7 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm) |
1481 | { |
1482 | struct au0828_dev *dev = video_drvdata(file); |
1483 | |
1484 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1485 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1486 | dev->std_set_in_tuner_core, dev->dev_state); |
1487 | |
1488 | *norm = dev->std; |
1489 | @@ -1315,7 +1314,7 @@ static int vidioc_enum_input(struct file *file, void *priv, |
1490 | [AU0828_VMUX_DEBUG] = "tv debug" |
1491 | }; |
1492 | |
1493 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1494 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1495 | dev->std_set_in_tuner_core, dev->dev_state); |
1496 | |
1497 | tmp = input->index; |
1498 | @@ -1345,7 +1344,7 @@ static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) |
1499 | { |
1500 | struct au0828_dev *dev = video_drvdata(file); |
1501 | |
1502 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1503 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1504 | dev->std_set_in_tuner_core, dev->dev_state); |
1505 | |
1506 | *i = dev->ctrl_input; |
1507 | @@ -1356,7 +1355,7 @@ static void au0828_s_input(struct au0828_dev *dev, int index) |
1508 | { |
1509 | int i; |
1510 | |
1511 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1512 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1513 | dev->std_set_in_tuner_core, dev->dev_state); |
1514 | |
1515 | switch (AUVI_INPUT(index).type) { |
1516 | @@ -1441,7 +1440,7 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a) |
1517 | { |
1518 | struct au0828_dev *dev = video_drvdata(file); |
1519 | |
1520 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1521 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1522 | dev->std_set_in_tuner_core, dev->dev_state); |
1523 | |
1524 | a->index = dev->ctrl_ainput; |
1525 | @@ -1461,7 +1460,7 @@ static int vidioc_s_audio(struct file *file, void *priv, const struct v4l2_audio |
1526 | if (a->index != dev->ctrl_ainput) |
1527 | return -EINVAL; |
1528 | |
1529 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1530 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1531 | dev->std_set_in_tuner_core, dev->dev_state); |
1532 | return 0; |
1533 | } |
1534 | @@ -1473,7 +1472,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) |
1535 | if (t->index != 0) |
1536 | return -EINVAL; |
1537 | |
1538 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1539 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1540 | dev->std_set_in_tuner_core, dev->dev_state); |
1541 | |
1542 | strcpy(t->name, "Auvitek tuner"); |
1543 | @@ -1493,7 +1492,7 @@ static int vidioc_s_tuner(struct file *file, void *priv, |
1544 | if (t->index != 0) |
1545 | return -EINVAL; |
1546 | |
1547 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1548 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1549 | dev->std_set_in_tuner_core, dev->dev_state); |
1550 | |
1551 | au0828_init_tuner(dev); |
1552 | @@ -1515,7 +1514,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, |
1553 | |
1554 | if (freq->tuner != 0) |
1555 | return -EINVAL; |
1556 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1557 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1558 | dev->std_set_in_tuner_core, dev->dev_state); |
1559 | freq->frequency = dev->ctrl_freq; |
1560 | return 0; |
1561 | @@ -1530,7 +1529,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, |
1562 | if (freq->tuner != 0) |
1563 | return -EINVAL; |
1564 | |
1565 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1566 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1567 | dev->std_set_in_tuner_core, dev->dev_state); |
1568 | |
1569 | au0828_init_tuner(dev); |
1570 | @@ -1556,7 +1555,7 @@ static int vidioc_g_fmt_vbi_cap(struct file *file, void *priv, |
1571 | { |
1572 | struct au0828_dev *dev = video_drvdata(file); |
1573 | |
1574 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1575 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1576 | dev->std_set_in_tuner_core, dev->dev_state); |
1577 | |
1578 | format->fmt.vbi.samples_per_line = dev->vbi_width; |
1579 | @@ -1582,7 +1581,7 @@ static int vidioc_cropcap(struct file *file, void *priv, |
1580 | if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1581 | return -EINVAL; |
1582 | |
1583 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1584 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1585 | dev->std_set_in_tuner_core, dev->dev_state); |
1586 | |
1587 | cc->bounds.left = 0; |
1588 | @@ -1604,7 +1603,7 @@ static int vidioc_g_register(struct file *file, void *priv, |
1589 | { |
1590 | struct au0828_dev *dev = video_drvdata(file); |
1591 | |
1592 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1593 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1594 | dev->std_set_in_tuner_core, dev->dev_state); |
1595 | |
1596 | reg->val = au0828_read(dev, reg->reg); |
1597 | @@ -1617,7 +1616,7 @@ static int vidioc_s_register(struct file *file, void *priv, |
1598 | { |
1599 | struct au0828_dev *dev = video_drvdata(file); |
1600 | |
1601 | - dprintk(1, "%s called std_set %d dev_state %d\n", __func__, |
1602 | + dprintk(1, "%s called std_set %d dev_state %ld\n", __func__, |
1603 | dev->std_set_in_tuner_core, dev->dev_state); |
1604 | |
1605 | return au0828_writereg(dev, reg->reg, reg->val); |
1606 | diff --git a/drivers/media/usb/au0828/au0828.h b/drivers/media/usb/au0828/au0828.h |
1607 | index 8276072bc55a..b28a05d76618 100644 |
1608 | --- a/drivers/media/usb/au0828/au0828.h |
1609 | +++ b/drivers/media/usb/au0828/au0828.h |
1610 | @@ -21,6 +21,7 @@ |
1611 | |
1612 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
1613 | |
1614 | +#include <linux/bitops.h> |
1615 | #include <linux/usb.h> |
1616 | #include <linux/i2c.h> |
1617 | #include <linux/i2c-algo-bit.h> |
1618 | @@ -122,9 +123,9 @@ enum au0828_stream_state { |
1619 | |
1620 | /* device state */ |
1621 | enum au0828_dev_state { |
1622 | - DEV_INITIALIZED = 0x01, |
1623 | - DEV_DISCONNECTED = 0x02, |
1624 | - DEV_MISCONFIGURED = 0x04 |
1625 | + DEV_INITIALIZED = 0, |
1626 | + DEV_DISCONNECTED = 1, |
1627 | + DEV_MISCONFIGURED = 2 |
1628 | }; |
1629 | |
1630 | struct au0828_dev; |
1631 | @@ -248,7 +249,7 @@ struct au0828_dev { |
1632 | int input_type; |
1633 | int std_set_in_tuner_core; |
1634 | unsigned int ctrl_input; |
1635 | - enum au0828_dev_state dev_state; |
1636 | + long unsigned int dev_state; /* defined at enum au0828_dev_state */; |
1637 | enum au0828_stream_state stream_state; |
1638 | wait_queue_head_t open; |
1639 | |
1640 | diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c |
1641 | index df3b8eced8c4..a04d0f7ee00e 100644 |
1642 | --- a/drivers/mmc/host/sdhci-pci-core.c |
1643 | +++ b/drivers/mmc/host/sdhci-pci-core.c |
1644 | @@ -390,6 +390,7 @@ static int byt_sd_probe_slot(struct sdhci_pci_slot *slot) |
1645 | slot->cd_idx = 0; |
1646 | slot->cd_override_level = true; |
1647 | if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXT_SD || |
1648 | + slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXTM_SD || |
1649 | slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD) |
1650 | slot->host->mmc_host_ops.get_cd = bxt_get_cd; |
1651 | |
1652 | @@ -1173,6 +1174,30 @@ static const struct pci_device_id pci_ids[] = { |
1653 | |
1654 | { |
1655 | .vendor = PCI_VENDOR_ID_INTEL, |
1656 | + .device = PCI_DEVICE_ID_INTEL_BXTM_EMMC, |
1657 | + .subvendor = PCI_ANY_ID, |
1658 | + .subdevice = PCI_ANY_ID, |
1659 | + .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc, |
1660 | + }, |
1661 | + |
1662 | + { |
1663 | + .vendor = PCI_VENDOR_ID_INTEL, |
1664 | + .device = PCI_DEVICE_ID_INTEL_BXTM_SDIO, |
1665 | + .subvendor = PCI_ANY_ID, |
1666 | + .subdevice = PCI_ANY_ID, |
1667 | + .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio, |
1668 | + }, |
1669 | + |
1670 | + { |
1671 | + .vendor = PCI_VENDOR_ID_INTEL, |
1672 | + .device = PCI_DEVICE_ID_INTEL_BXTM_SD, |
1673 | + .subvendor = PCI_ANY_ID, |
1674 | + .subdevice = PCI_ANY_ID, |
1675 | + .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd, |
1676 | + }, |
1677 | + |
1678 | + { |
1679 | + .vendor = PCI_VENDOR_ID_INTEL, |
1680 | .device = PCI_DEVICE_ID_INTEL_APL_EMMC, |
1681 | .subvendor = PCI_ANY_ID, |
1682 | .subdevice = PCI_ANY_ID, |
1683 | diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h |
1684 | index d1a0b4db60db..89e7151684a1 100644 |
1685 | --- a/drivers/mmc/host/sdhci-pci.h |
1686 | +++ b/drivers/mmc/host/sdhci-pci.h |
1687 | @@ -28,6 +28,9 @@ |
1688 | #define PCI_DEVICE_ID_INTEL_BXT_SD 0x0aca |
1689 | #define PCI_DEVICE_ID_INTEL_BXT_EMMC 0x0acc |
1690 | #define PCI_DEVICE_ID_INTEL_BXT_SDIO 0x0ad0 |
1691 | +#define PCI_DEVICE_ID_INTEL_BXTM_SD 0x1aca |
1692 | +#define PCI_DEVICE_ID_INTEL_BXTM_EMMC 0x1acc |
1693 | +#define PCI_DEVICE_ID_INTEL_BXTM_SDIO 0x1ad0 |
1694 | #define PCI_DEVICE_ID_INTEL_APL_SD 0x5aca |
1695 | #define PCI_DEVICE_ID_INTEL_APL_EMMC 0x5acc |
1696 | #define PCI_DEVICE_ID_INTEL_APL_SDIO 0x5ad0 |
1697 | diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c |
1698 | index c7f27fe4805a..452bf500c82e 100644 |
1699 | --- a/drivers/mmc/host/sdhci-pxav3.c |
1700 | +++ b/drivers/mmc/host/sdhci-pxav3.c |
1701 | @@ -309,8 +309,30 @@ static void pxav3_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs) |
1702 | __func__, uhs, ctrl_2); |
1703 | } |
1704 | |
1705 | +static void pxav3_set_power(struct sdhci_host *host, unsigned char mode, |
1706 | + unsigned short vdd) |
1707 | +{ |
1708 | + struct mmc_host *mmc = host->mmc; |
1709 | + u8 pwr = host->pwr; |
1710 | + |
1711 | + sdhci_set_power(host, mode, vdd); |
1712 | + |
1713 | + if (host->pwr == pwr) |
1714 | + return; |
1715 | + |
1716 | + if (host->pwr == 0) |
1717 | + vdd = 0; |
1718 | + |
1719 | + if (!IS_ERR(mmc->supply.vmmc)) { |
1720 | + spin_unlock_irq(&host->lock); |
1721 | + mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); |
1722 | + spin_lock_irq(&host->lock); |
1723 | + } |
1724 | +} |
1725 | + |
1726 | static const struct sdhci_ops pxav3_sdhci_ops = { |
1727 | .set_clock = sdhci_set_clock, |
1728 | + .set_power = pxav3_set_power, |
1729 | .platform_send_init_74_clocks = pxav3_gen_init_74_clocks, |
1730 | .get_max_clock = sdhci_pltfm_clk_get_max_clock, |
1731 | .set_bus_width = sdhci_set_bus_width, |
1732 | diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c |
1733 | index 8059d7248fff..6d485b5fa5ca 100644 |
1734 | --- a/drivers/mmc/host/sdhci.c |
1735 | +++ b/drivers/mmc/host/sdhci.c |
1736 | @@ -1250,10 +1250,24 @@ clock_set: |
1737 | } |
1738 | EXPORT_SYMBOL_GPL(sdhci_set_clock); |
1739 | |
1740 | -static void sdhci_set_power(struct sdhci_host *host, unsigned char mode, |
1741 | - unsigned short vdd) |
1742 | +static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode, |
1743 | + unsigned short vdd) |
1744 | { |
1745 | struct mmc_host *mmc = host->mmc; |
1746 | + |
1747 | + spin_unlock_irq(&host->lock); |
1748 | + mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); |
1749 | + spin_lock_irq(&host->lock); |
1750 | + |
1751 | + if (mode != MMC_POWER_OFF) |
1752 | + sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL); |
1753 | + else |
1754 | + sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); |
1755 | +} |
1756 | + |
1757 | +void sdhci_set_power(struct sdhci_host *host, unsigned char mode, |
1758 | + unsigned short vdd) |
1759 | +{ |
1760 | u8 pwr = 0; |
1761 | |
1762 | if (mode != MMC_POWER_OFF) { |
1763 | @@ -1285,7 +1299,6 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode, |
1764 | sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); |
1765 | if (host->quirks2 & SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON) |
1766 | sdhci_runtime_pm_bus_off(host); |
1767 | - vdd = 0; |
1768 | } else { |
1769 | /* |
1770 | * Spec says that we should clear the power reg before setting |
1771 | @@ -1316,12 +1329,20 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode, |
1772 | if (host->quirks & SDHCI_QUIRK_DELAY_AFTER_POWER) |
1773 | mdelay(10); |
1774 | } |
1775 | +} |
1776 | +EXPORT_SYMBOL_GPL(sdhci_set_power); |
1777 | |
1778 | - if (!IS_ERR(mmc->supply.vmmc)) { |
1779 | - spin_unlock_irq(&host->lock); |
1780 | - mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); |
1781 | - spin_lock_irq(&host->lock); |
1782 | - } |
1783 | +static void __sdhci_set_power(struct sdhci_host *host, unsigned char mode, |
1784 | + unsigned short vdd) |
1785 | +{ |
1786 | + struct mmc_host *mmc = host->mmc; |
1787 | + |
1788 | + if (host->ops->set_power) |
1789 | + host->ops->set_power(host, mode, vdd); |
1790 | + else if (!IS_ERR(mmc->supply.vmmc)) |
1791 | + sdhci_set_power_reg(host, mode, vdd); |
1792 | + else |
1793 | + sdhci_set_power(host, mode, vdd); |
1794 | } |
1795 | |
1796 | /*****************************************************************************\ |
1797 | @@ -1471,7 +1492,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) |
1798 | } |
1799 | } |
1800 | |
1801 | - sdhci_set_power(host, ios->power_mode, ios->vdd); |
1802 | + __sdhci_set_power(host, ios->power_mode, ios->vdd); |
1803 | |
1804 | if (host->ops->platform_send_init_74_clocks) |
1805 | host->ops->platform_send_init_74_clocks(host, ios->power_mode); |
1806 | diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h |
1807 | index 0115e9907bf8..033d72b5bbd5 100644 |
1808 | --- a/drivers/mmc/host/sdhci.h |
1809 | +++ b/drivers/mmc/host/sdhci.h |
1810 | @@ -529,6 +529,8 @@ struct sdhci_ops { |
1811 | #endif |
1812 | |
1813 | void (*set_clock)(struct sdhci_host *host, unsigned int clock); |
1814 | + void (*set_power)(struct sdhci_host *host, unsigned char mode, |
1815 | + unsigned short vdd); |
1816 | |
1817 | int (*enable_dma)(struct sdhci_host *host); |
1818 | unsigned int (*get_max_clock)(struct sdhci_host *host); |
1819 | @@ -660,6 +662,8 @@ static inline bool sdhci_sdio_irq_enabled(struct sdhci_host *host) |
1820 | } |
1821 | |
1822 | void sdhci_set_clock(struct sdhci_host *host, unsigned int clock); |
1823 | +void sdhci_set_power(struct sdhci_host *host, unsigned char mode, |
1824 | + unsigned short vdd); |
1825 | void sdhci_set_bus_width(struct sdhci_host *host, int width); |
1826 | void sdhci_reset(struct sdhci_host *host, u8 mask); |
1827 | void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing); |
1828 | diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
1829 | index b7f1a9919033..5ec8195b02c0 100644 |
1830 | --- a/drivers/net/bonding/bond_main.c |
1831 | +++ b/drivers/net/bonding/bond_main.c |
1832 | @@ -3308,6 +3308,30 @@ static int bond_close(struct net_device *bond_dev) |
1833 | return 0; |
1834 | } |
1835 | |
1836 | +/* fold stats, assuming all rtnl_link_stats64 fields are u64, but |
1837 | + * that some drivers can provide 32bit values only. |
1838 | + */ |
1839 | +static void bond_fold_stats(struct rtnl_link_stats64 *_res, |
1840 | + const struct rtnl_link_stats64 *_new, |
1841 | + const struct rtnl_link_stats64 *_old) |
1842 | +{ |
1843 | + const u64 *new = (const u64 *)_new; |
1844 | + const u64 *old = (const u64 *)_old; |
1845 | + u64 *res = (u64 *)_res; |
1846 | + int i; |
1847 | + |
1848 | + for (i = 0; i < sizeof(*_res) / sizeof(u64); i++) { |
1849 | + u64 nv = new[i]; |
1850 | + u64 ov = old[i]; |
1851 | + |
1852 | + /* detects if this particular field is 32bit only */ |
1853 | + if (((nv | ov) >> 32) == 0) |
1854 | + res[i] += (u32)nv - (u32)ov; |
1855 | + else |
1856 | + res[i] += nv - ov; |
1857 | + } |
1858 | +} |
1859 | + |
1860 | static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev, |
1861 | struct rtnl_link_stats64 *stats) |
1862 | { |
1863 | @@ -3316,43 +3340,23 @@ static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev, |
1864 | struct list_head *iter; |
1865 | struct slave *slave; |
1866 | |
1867 | + spin_lock(&bond->stats_lock); |
1868 | memcpy(stats, &bond->bond_stats, sizeof(*stats)); |
1869 | |
1870 | - bond_for_each_slave(bond, slave, iter) { |
1871 | - const struct rtnl_link_stats64 *sstats = |
1872 | + rcu_read_lock(); |
1873 | + bond_for_each_slave_rcu(bond, slave, iter) { |
1874 | + const struct rtnl_link_stats64 *new = |
1875 | dev_get_stats(slave->dev, &temp); |
1876 | - struct rtnl_link_stats64 *pstats = &slave->slave_stats; |
1877 | - |
1878 | - stats->rx_packets += sstats->rx_packets - pstats->rx_packets; |
1879 | - stats->rx_bytes += sstats->rx_bytes - pstats->rx_bytes; |
1880 | - stats->rx_errors += sstats->rx_errors - pstats->rx_errors; |
1881 | - stats->rx_dropped += sstats->rx_dropped - pstats->rx_dropped; |
1882 | - |
1883 | - stats->tx_packets += sstats->tx_packets - pstats->tx_packets;; |
1884 | - stats->tx_bytes += sstats->tx_bytes - pstats->tx_bytes; |
1885 | - stats->tx_errors += sstats->tx_errors - pstats->tx_errors; |
1886 | - stats->tx_dropped += sstats->tx_dropped - pstats->tx_dropped; |
1887 | - |
1888 | - stats->multicast += sstats->multicast - pstats->multicast; |
1889 | - stats->collisions += sstats->collisions - pstats->collisions; |
1890 | - |
1891 | - stats->rx_length_errors += sstats->rx_length_errors - pstats->rx_length_errors; |
1892 | - stats->rx_over_errors += sstats->rx_over_errors - pstats->rx_over_errors; |
1893 | - stats->rx_crc_errors += sstats->rx_crc_errors - pstats->rx_crc_errors; |
1894 | - stats->rx_frame_errors += sstats->rx_frame_errors - pstats->rx_frame_errors; |
1895 | - stats->rx_fifo_errors += sstats->rx_fifo_errors - pstats->rx_fifo_errors; |
1896 | - stats->rx_missed_errors += sstats->rx_missed_errors - pstats->rx_missed_errors; |
1897 | - |
1898 | - stats->tx_aborted_errors += sstats->tx_aborted_errors - pstats->tx_aborted_errors; |
1899 | - stats->tx_carrier_errors += sstats->tx_carrier_errors - pstats->tx_carrier_errors; |
1900 | - stats->tx_fifo_errors += sstats->tx_fifo_errors - pstats->tx_fifo_errors; |
1901 | - stats->tx_heartbeat_errors += sstats->tx_heartbeat_errors - pstats->tx_heartbeat_errors; |
1902 | - stats->tx_window_errors += sstats->tx_window_errors - pstats->tx_window_errors; |
1903 | + |
1904 | + bond_fold_stats(stats, new, &slave->slave_stats); |
1905 | |
1906 | /* save off the slave stats for the next run */ |
1907 | - memcpy(pstats, sstats, sizeof(*sstats)); |
1908 | + memcpy(&slave->slave_stats, new, sizeof(*new)); |
1909 | } |
1910 | + rcu_read_unlock(); |
1911 | + |
1912 | memcpy(&bond->bond_stats, stats, sizeof(*stats)); |
1913 | + spin_unlock(&bond->stats_lock); |
1914 | |
1915 | return stats; |
1916 | } |
1917 | @@ -4166,6 +4170,7 @@ void bond_setup(struct net_device *bond_dev) |
1918 | struct bonding *bond = netdev_priv(bond_dev); |
1919 | |
1920 | spin_lock_init(&bond->mode_lock); |
1921 | + spin_lock_init(&bond->stats_lock); |
1922 | bond->params = bonding_defaults; |
1923 | |
1924 | /* Initialize pointers */ |
1925 | diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
1926 | index d7e01a74e927..6746fd03cb3a 100644 |
1927 | --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
1928 | +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
1929 | @@ -1197,7 +1197,7 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev, |
1930 | dev->stats.tx_bytes += tx_cb_ptr->skb->len; |
1931 | dma_unmap_single(&dev->dev, |
1932 | dma_unmap_addr(tx_cb_ptr, dma_addr), |
1933 | - tx_cb_ptr->skb->len, |
1934 | + dma_unmap_len(tx_cb_ptr, dma_len), |
1935 | DMA_TO_DEVICE); |
1936 | bcmgenet_free_cb(tx_cb_ptr); |
1937 | } else if (dma_unmap_addr(tx_cb_ptr, dma_addr)) { |
1938 | @@ -1308,7 +1308,7 @@ static int bcmgenet_xmit_single(struct net_device *dev, |
1939 | } |
1940 | |
1941 | dma_unmap_addr_set(tx_cb_ptr, dma_addr, mapping); |
1942 | - dma_unmap_len_set(tx_cb_ptr, dma_len, skb->len); |
1943 | + dma_unmap_len_set(tx_cb_ptr, dma_len, skb_len); |
1944 | length_status = (skb_len << DMA_BUFLENGTH_SHIFT) | dma_desc_flags | |
1945 | (priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT) | |
1946 | DMA_TX_APPEND_CRC; |
1947 | diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c |
1948 | index acb1c5b2bad3..2ee05cebea75 100644 |
1949 | --- a/drivers/net/ethernet/marvell/mvneta.c |
1950 | +++ b/drivers/net/ethernet/marvell/mvneta.c |
1951 | @@ -3070,17 +3070,17 @@ static int mvneta_stop(struct net_device *dev) |
1952 | struct mvneta_port *pp = netdev_priv(dev); |
1953 | |
1954 | /* Inform that we are stopping so we don't want to setup the |
1955 | - * driver for new CPUs in the notifiers |
1956 | + * driver for new CPUs in the notifiers. The code of the |
1957 | + * notifier for CPU online is protected by the same spinlock, |
1958 | + * so when we get the lock, the notifer work is done. |
1959 | */ |
1960 | spin_lock(&pp->lock); |
1961 | pp->is_stopped = true; |
1962 | + spin_unlock(&pp->lock); |
1963 | + |
1964 | mvneta_stop_dev(pp); |
1965 | mvneta_mdio_remove(pp); |
1966 | unregister_cpu_notifier(&pp->cpu_notifier); |
1967 | - /* Now that the notifier are unregistered, we can release le |
1968 | - * lock |
1969 | - */ |
1970 | - spin_unlock(&pp->lock); |
1971 | on_each_cpu(mvneta_percpu_disable, pp, true); |
1972 | free_percpu_irq(dev->irq, pp->ports); |
1973 | mvneta_cleanup_rxqs(pp); |
1974 | @@ -3612,6 +3612,7 @@ static int mvneta_probe(struct platform_device *pdev) |
1975 | dev->ethtool_ops = &mvneta_eth_tool_ops; |
1976 | |
1977 | pp = netdev_priv(dev); |
1978 | + spin_lock_init(&pp->lock); |
1979 | pp->phy_node = phy_node; |
1980 | pp->phy_interface = phy_mode; |
1981 | |
1982 | diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c |
1983 | index 25ce1b030a00..cd9b2b28df88 100644 |
1984 | --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c |
1985 | +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c |
1986 | @@ -3141,7 +3141,7 @@ static int verify_qp_parameters(struct mlx4_dev *dev, |
1987 | case QP_TRANS_RTS2RTS: |
1988 | case QP_TRANS_SQD2SQD: |
1989 | case QP_TRANS_SQD2RTS: |
1990 | - if (slave != mlx4_master_func_num(dev)) |
1991 | + if (slave != mlx4_master_func_num(dev)) { |
1992 | if (optpar & MLX4_QP_OPTPAR_PRIMARY_ADDR_PATH) { |
1993 | port = (qp_ctx->pri_path.sched_queue >> 6 & 1) + 1; |
1994 | if (dev->caps.port_mask[port] != MLX4_PORT_TYPE_IB) |
1995 | @@ -3160,6 +3160,7 @@ static int verify_qp_parameters(struct mlx4_dev *dev, |
1996 | if (qp_ctx->alt_path.mgid_index >= num_gids) |
1997 | return -EINVAL; |
1998 | } |
1999 | + } |
2000 | break; |
2001 | default: |
2002 | break; |
2003 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h |
2004 | index 3b89ed2f3c76..65a115fc0c96 100644 |
2005 | --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h |
2006 | +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h |
2007 | @@ -118,6 +118,8 @@ struct mlxsw_sp { |
2008 | #define MLXSW_SP_DEFAULT_LEARNING_INTERVAL 100 |
2009 | unsigned int interval; /* ms */ |
2010 | } fdb_notify; |
2011 | +#define MLXSW_SP_MIN_AGEING_TIME 10 |
2012 | +#define MLXSW_SP_MAX_AGEING_TIME 1000000 |
2013 | #define MLXSW_SP_DEFAULT_AGEING_TIME 300 |
2014 | u32 ageing_time; |
2015 | struct mlxsw_sp_upper master_bridge; |
2016 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
2017 | index 7b56098acc58..e1c74efff51a 100644 |
2018 | --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
2019 | +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
2020 | @@ -311,8 +311,13 @@ static int mlxsw_sp_port_attr_br_ageing_set(struct mlxsw_sp_port *mlxsw_sp_port, |
2021 | unsigned long ageing_jiffies = clock_t_to_jiffies(ageing_clock_t); |
2022 | u32 ageing_time = jiffies_to_msecs(ageing_jiffies) / 1000; |
2023 | |
2024 | - if (switchdev_trans_ph_prepare(trans)) |
2025 | - return 0; |
2026 | + if (switchdev_trans_ph_prepare(trans)) { |
2027 | + if (ageing_time < MLXSW_SP_MIN_AGEING_TIME || |
2028 | + ageing_time > MLXSW_SP_MAX_AGEING_TIME) |
2029 | + return -ERANGE; |
2030 | + else |
2031 | + return 0; |
2032 | + } |
2033 | |
2034 | return mlxsw_sp_ageing_set(mlxsw_sp, ageing_time); |
2035 | } |
2036 | diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h |
2037 | index 46bbea8e023c..55007f1e6bbc 100644 |
2038 | --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h |
2039 | +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h |
2040 | @@ -566,6 +566,7 @@ struct qlcnic_adapter_stats { |
2041 | u64 tx_dma_map_error; |
2042 | u64 spurious_intr; |
2043 | u64 mac_filter_limit_overrun; |
2044 | + u64 mbx_spurious_intr; |
2045 | }; |
2046 | |
2047 | /* |
2048 | @@ -1099,7 +1100,7 @@ struct qlcnic_mailbox { |
2049 | unsigned long status; |
2050 | spinlock_t queue_lock; /* Mailbox queue lock */ |
2051 | spinlock_t aen_lock; /* Mailbox response/AEN lock */ |
2052 | - atomic_t rsp_status; |
2053 | + u32 rsp_status; |
2054 | u32 num_cmds; |
2055 | }; |
2056 | |
2057 | diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c |
2058 | index 37a731be7d39..f9640d5ce6ba 100644 |
2059 | --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c |
2060 | +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c |
2061 | @@ -491,7 +491,7 @@ irqreturn_t qlcnic_83xx_clear_legacy_intr(struct qlcnic_adapter *adapter) |
2062 | |
2063 | static inline void qlcnic_83xx_notify_mbx_response(struct qlcnic_mailbox *mbx) |
2064 | { |
2065 | - atomic_set(&mbx->rsp_status, QLC_83XX_MBX_RESPONSE_ARRIVED); |
2066 | + mbx->rsp_status = QLC_83XX_MBX_RESPONSE_ARRIVED; |
2067 | complete(&mbx->completion); |
2068 | } |
2069 | |
2070 | @@ -510,7 +510,7 @@ static void qlcnic_83xx_poll_process_aen(struct qlcnic_adapter *adapter) |
2071 | if (event & QLCNIC_MBX_ASYNC_EVENT) { |
2072 | __qlcnic_83xx_process_aen(adapter); |
2073 | } else { |
2074 | - if (atomic_read(&mbx->rsp_status) != rsp_status) |
2075 | + if (mbx->rsp_status != rsp_status) |
2076 | qlcnic_83xx_notify_mbx_response(mbx); |
2077 | } |
2078 | out: |
2079 | @@ -1023,7 +1023,7 @@ static void qlcnic_83xx_process_aen(struct qlcnic_adapter *adapter) |
2080 | if (event & QLCNIC_MBX_ASYNC_EVENT) { |
2081 | __qlcnic_83xx_process_aen(adapter); |
2082 | } else { |
2083 | - if (atomic_read(&mbx->rsp_status) != rsp_status) |
2084 | + if (mbx->rsp_status != rsp_status) |
2085 | qlcnic_83xx_notify_mbx_response(mbx); |
2086 | } |
2087 | } |
2088 | @@ -2338,9 +2338,9 @@ static void qlcnic_83xx_handle_link_aen(struct qlcnic_adapter *adapter, |
2089 | |
2090 | static irqreturn_t qlcnic_83xx_handle_aen(int irq, void *data) |
2091 | { |
2092 | + u32 mask, resp, event, rsp_status = QLC_83XX_MBX_RESPONSE_ARRIVED; |
2093 | struct qlcnic_adapter *adapter = data; |
2094 | struct qlcnic_mailbox *mbx; |
2095 | - u32 mask, resp, event; |
2096 | unsigned long flags; |
2097 | |
2098 | mbx = adapter->ahw->mailbox; |
2099 | @@ -2350,10 +2350,14 @@ static irqreturn_t qlcnic_83xx_handle_aen(int irq, void *data) |
2100 | goto out; |
2101 | |
2102 | event = readl(QLCNIC_MBX_FW(adapter->ahw, 0)); |
2103 | - if (event & QLCNIC_MBX_ASYNC_EVENT) |
2104 | + if (event & QLCNIC_MBX_ASYNC_EVENT) { |
2105 | __qlcnic_83xx_process_aen(adapter); |
2106 | - else |
2107 | - qlcnic_83xx_notify_mbx_response(mbx); |
2108 | + } else { |
2109 | + if (mbx->rsp_status != rsp_status) |
2110 | + qlcnic_83xx_notify_mbx_response(mbx); |
2111 | + else |
2112 | + adapter->stats.mbx_spurious_intr++; |
2113 | + } |
2114 | |
2115 | out: |
2116 | mask = QLCRDX(adapter->ahw, QLCNIC_DEF_INT_MASK); |
2117 | @@ -4050,10 +4054,10 @@ static void qlcnic_83xx_mailbox_worker(struct work_struct *work) |
2118 | struct qlcnic_adapter *adapter = mbx->adapter; |
2119 | const struct qlcnic_mbx_ops *mbx_ops = mbx->ops; |
2120 | struct device *dev = &adapter->pdev->dev; |
2121 | - atomic_t *rsp_status = &mbx->rsp_status; |
2122 | struct list_head *head = &mbx->cmd_q; |
2123 | struct qlcnic_hardware_context *ahw; |
2124 | struct qlcnic_cmd_args *cmd = NULL; |
2125 | + unsigned long flags; |
2126 | |
2127 | ahw = adapter->ahw; |
2128 | |
2129 | @@ -4063,7 +4067,9 @@ static void qlcnic_83xx_mailbox_worker(struct work_struct *work) |
2130 | return; |
2131 | } |
2132 | |
2133 | - atomic_set(rsp_status, QLC_83XX_MBX_RESPONSE_WAIT); |
2134 | + spin_lock_irqsave(&mbx->aen_lock, flags); |
2135 | + mbx->rsp_status = QLC_83XX_MBX_RESPONSE_WAIT; |
2136 | + spin_unlock_irqrestore(&mbx->aen_lock, flags); |
2137 | |
2138 | spin_lock(&mbx->queue_lock); |
2139 | |
2140 | diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c |
2141 | index 494e8105adee..0a2318cad34d 100644 |
2142 | --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c |
2143 | +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c |
2144 | @@ -59,7 +59,8 @@ static const struct qlcnic_stats qlcnic_gstrings_stats[] = { |
2145 | QLC_OFF(stats.mac_filter_limit_overrun)}, |
2146 | {"spurious intr", QLC_SIZEOF(stats.spurious_intr), |
2147 | QLC_OFF(stats.spurious_intr)}, |
2148 | - |
2149 | + {"mbx spurious intr", QLC_SIZEOF(stats.mbx_spurious_intr), |
2150 | + QLC_OFF(stats.mbx_spurious_intr)}, |
2151 | }; |
2152 | |
2153 | static const char qlcnic_device_gstrings_stats[][ETH_GSTRING_LEN] = { |
2154 | diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c |
2155 | index 997976426799..b28e73ea2c25 100644 |
2156 | --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c |
2157 | +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c |
2158 | @@ -1648,7 +1648,18 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev, |
2159 | return; |
2160 | } |
2161 | skb_reserve(new_skb, NET_IP_ALIGN); |
2162 | + |
2163 | + pci_dma_sync_single_for_cpu(qdev->pdev, |
2164 | + dma_unmap_addr(sbq_desc, mapaddr), |
2165 | + dma_unmap_len(sbq_desc, maplen), |
2166 | + PCI_DMA_FROMDEVICE); |
2167 | + |
2168 | memcpy(skb_put(new_skb, length), skb->data, length); |
2169 | + |
2170 | + pci_dma_sync_single_for_device(qdev->pdev, |
2171 | + dma_unmap_addr(sbq_desc, mapaddr), |
2172 | + dma_unmap_len(sbq_desc, maplen), |
2173 | + PCI_DMA_FROMDEVICE); |
2174 | skb = new_skb; |
2175 | |
2176 | /* Frame error, so drop the packet. */ |
2177 | diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c |
2178 | index 738449992876..01f6d5bbd420 100644 |
2179 | --- a/drivers/net/ethernet/renesas/sh_eth.c |
2180 | +++ b/drivers/net/ethernet/renesas/sh_eth.c |
2181 | @@ -1136,11 +1136,8 @@ static void sh_eth_ring_format(struct net_device *ndev) |
2182 | break; |
2183 | sh_eth_set_receive_align(skb); |
2184 | |
2185 | - /* RX descriptor */ |
2186 | - rxdesc = &mdp->rx_ring[i]; |
2187 | /* The size of the buffer is a multiple of 32 bytes. */ |
2188 | buf_len = ALIGN(mdp->rx_buf_sz, 32); |
2189 | - rxdesc->len = cpu_to_le32(buf_len << 16); |
2190 | dma_addr = dma_map_single(&ndev->dev, skb->data, buf_len, |
2191 | DMA_FROM_DEVICE); |
2192 | if (dma_mapping_error(&ndev->dev, dma_addr)) { |
2193 | @@ -1148,6 +1145,10 @@ static void sh_eth_ring_format(struct net_device *ndev) |
2194 | break; |
2195 | } |
2196 | mdp->rx_skbuff[i] = skb; |
2197 | + |
2198 | + /* RX descriptor */ |
2199 | + rxdesc = &mdp->rx_ring[i]; |
2200 | + rxdesc->len = cpu_to_le32(buf_len << 16); |
2201 | rxdesc->addr = cpu_to_le32(dma_addr); |
2202 | rxdesc->status = cpu_to_le32(RD_RACT | RD_RFP); |
2203 | |
2204 | @@ -1163,7 +1164,8 @@ static void sh_eth_ring_format(struct net_device *ndev) |
2205 | mdp->dirty_rx = (u32) (i - mdp->num_rx_ring); |
2206 | |
2207 | /* Mark the last entry as wrapping the ring. */ |
2208 | - rxdesc->status |= cpu_to_le32(RD_RDLE); |
2209 | + if (rxdesc) |
2210 | + rxdesc->status |= cpu_to_le32(RD_RDLE); |
2211 | |
2212 | memset(mdp->tx_ring, 0, tx_ringsize); |
2213 | |
2214 | diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c |
2215 | index 166a7fc87e2f..f39e7198e818 100644 |
2216 | --- a/drivers/net/ethernet/rocker/rocker.c |
2217 | +++ b/drivers/net/ethernet/rocker/rocker.c |
2218 | @@ -239,6 +239,7 @@ struct rocker { |
2219 | struct { |
2220 | u64 id; |
2221 | } hw; |
2222 | + unsigned long ageing_time; |
2223 | spinlock_t cmd_ring_lock; /* for cmd ring accesses */ |
2224 | struct rocker_dma_ring_info cmd_ring; |
2225 | struct rocker_dma_ring_info event_ring; |
2226 | @@ -3704,7 +3705,7 @@ static void rocker_fdb_cleanup(unsigned long data) |
2227 | struct rocker_port *rocker_port; |
2228 | struct rocker_fdb_tbl_entry *entry; |
2229 | struct hlist_node *tmp; |
2230 | - unsigned long next_timer = jiffies + BR_MIN_AGEING_TIME; |
2231 | + unsigned long next_timer = jiffies + rocker->ageing_time; |
2232 | unsigned long expires; |
2233 | unsigned long lock_flags; |
2234 | int flags = ROCKER_OP_FLAG_NOWAIT | ROCKER_OP_FLAG_REMOVE | |
2235 | @@ -4367,8 +4368,12 @@ static int rocker_port_bridge_ageing_time(struct rocker_port *rocker_port, |
2236 | struct switchdev_trans *trans, |
2237 | u32 ageing_time) |
2238 | { |
2239 | + struct rocker *rocker = rocker_port->rocker; |
2240 | + |
2241 | if (!switchdev_trans_ph_prepare(trans)) { |
2242 | rocker_port->ageing_time = clock_t_to_jiffies(ageing_time); |
2243 | + if (rocker_port->ageing_time < rocker->ageing_time) |
2244 | + rocker->ageing_time = rocker_port->ageing_time; |
2245 | mod_timer(&rocker_port->rocker->fdb_cleanup_timer, jiffies); |
2246 | } |
2247 | |
2248 | @@ -5206,10 +5211,13 @@ static int rocker_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
2249 | goto err_init_tbls; |
2250 | } |
2251 | |
2252 | + rocker->ageing_time = BR_DEFAULT_AGEING_TIME; |
2253 | setup_timer(&rocker->fdb_cleanup_timer, rocker_fdb_cleanup, |
2254 | (unsigned long) rocker); |
2255 | mod_timer(&rocker->fdb_cleanup_timer, jiffies); |
2256 | |
2257 | + rocker->ageing_time = BR_DEFAULT_AGEING_TIME; |
2258 | + |
2259 | err = rocker_probe_ports(rocker); |
2260 | if (err) { |
2261 | dev_err(&pdev->dev, "failed to probe ports\n"); |
2262 | diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c |
2263 | index d636d051fac8..95394edd1ed5 100644 |
2264 | --- a/drivers/net/macvtap.c |
2265 | +++ b/drivers/net/macvtap.c |
2266 | @@ -760,6 +760,8 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, |
2267 | macvtap16_to_cpu(q, vnet_hdr.hdr_len) : GOODCOPY_LEN; |
2268 | if (copylen > good_linear) |
2269 | copylen = good_linear; |
2270 | + else if (copylen < ETH_HLEN) |
2271 | + copylen = ETH_HLEN; |
2272 | linear = copylen; |
2273 | i = *from; |
2274 | iov_iter_advance(&i, copylen); |
2275 | @@ -769,10 +771,11 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, |
2276 | |
2277 | if (!zerocopy) { |
2278 | copylen = len; |
2279 | - if (macvtap16_to_cpu(q, vnet_hdr.hdr_len) > good_linear) |
2280 | + linear = macvtap16_to_cpu(q, vnet_hdr.hdr_len); |
2281 | + if (linear > good_linear) |
2282 | linear = good_linear; |
2283 | - else |
2284 | - linear = macvtap16_to_cpu(q, vnet_hdr.hdr_len); |
2285 | + else if (linear < ETH_HLEN) |
2286 | + linear = ETH_HLEN; |
2287 | } |
2288 | |
2289 | skb = macvtap_alloc_skb(&q->sk, MACVTAP_RESERVE, copylen, |
2290 | diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c |
2291 | index d61da9ece3ba..aafe237b25ac 100644 |
2292 | --- a/drivers/net/ppp/ppp_generic.c |
2293 | +++ b/drivers/net/ppp/ppp_generic.c |
2294 | @@ -575,7 +575,7 @@ static int get_filter(void __user *arg, struct sock_filter **p) |
2295 | |
2296 | static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
2297 | { |
2298 | - struct ppp_file *pf = file->private_data; |
2299 | + struct ppp_file *pf; |
2300 | struct ppp *ppp; |
2301 | int err = -EFAULT, val, val2, i; |
2302 | struct ppp_idle idle; |
2303 | @@ -585,9 +585,14 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
2304 | void __user *argp = (void __user *)arg; |
2305 | int __user *p = argp; |
2306 | |
2307 | - if (!pf) |
2308 | - return ppp_unattached_ioctl(current->nsproxy->net_ns, |
2309 | - pf, file, cmd, arg); |
2310 | + mutex_lock(&ppp_mutex); |
2311 | + |
2312 | + pf = file->private_data; |
2313 | + if (!pf) { |
2314 | + err = ppp_unattached_ioctl(current->nsproxy->net_ns, |
2315 | + pf, file, cmd, arg); |
2316 | + goto out; |
2317 | + } |
2318 | |
2319 | if (cmd == PPPIOCDETACH) { |
2320 | /* |
2321 | @@ -602,7 +607,6 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
2322 | * this fd and reopening /dev/ppp. |
2323 | */ |
2324 | err = -EINVAL; |
2325 | - mutex_lock(&ppp_mutex); |
2326 | if (pf->kind == INTERFACE) { |
2327 | ppp = PF_TO_PPP(pf); |
2328 | rtnl_lock(); |
2329 | @@ -616,15 +620,13 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
2330 | } else |
2331 | pr_warn("PPPIOCDETACH file->f_count=%ld\n", |
2332 | atomic_long_read(&file->f_count)); |
2333 | - mutex_unlock(&ppp_mutex); |
2334 | - return err; |
2335 | + goto out; |
2336 | } |
2337 | |
2338 | if (pf->kind == CHANNEL) { |
2339 | struct channel *pch; |
2340 | struct ppp_channel *chan; |
2341 | |
2342 | - mutex_lock(&ppp_mutex); |
2343 | pch = PF_TO_CHANNEL(pf); |
2344 | |
2345 | switch (cmd) { |
2346 | @@ -646,17 +648,16 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
2347 | err = chan->ops->ioctl(chan, cmd, arg); |
2348 | up_read(&pch->chan_sem); |
2349 | } |
2350 | - mutex_unlock(&ppp_mutex); |
2351 | - return err; |
2352 | + goto out; |
2353 | } |
2354 | |
2355 | if (pf->kind != INTERFACE) { |
2356 | /* can't happen */ |
2357 | pr_err("PPP: not interface or channel??\n"); |
2358 | - return -EINVAL; |
2359 | + err = -EINVAL; |
2360 | + goto out; |
2361 | } |
2362 | |
2363 | - mutex_lock(&ppp_mutex); |
2364 | ppp = PF_TO_PPP(pf); |
2365 | switch (cmd) { |
2366 | case PPPIOCSMRU: |
2367 | @@ -831,7 +832,10 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
2368 | default: |
2369 | err = -ENOTTY; |
2370 | } |
2371 | + |
2372 | +out: |
2373 | mutex_unlock(&ppp_mutex); |
2374 | + |
2375 | return err; |
2376 | } |
2377 | |
2378 | @@ -844,7 +848,6 @@ static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, |
2379 | struct ppp_net *pn; |
2380 | int __user *p = (int __user *)arg; |
2381 | |
2382 | - mutex_lock(&ppp_mutex); |
2383 | switch (cmd) { |
2384 | case PPPIOCNEWUNIT: |
2385 | /* Create a new ppp unit */ |
2386 | @@ -894,7 +897,7 @@ static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, |
2387 | default: |
2388 | err = -ENOTTY; |
2389 | } |
2390 | - mutex_unlock(&ppp_mutex); |
2391 | + |
2392 | return err; |
2393 | } |
2394 | |
2395 | @@ -2304,7 +2307,7 @@ int ppp_register_net_channel(struct net *net, struct ppp_channel *chan) |
2396 | |
2397 | pch->ppp = NULL; |
2398 | pch->chan = chan; |
2399 | - pch->chan_net = net; |
2400 | + pch->chan_net = get_net(net); |
2401 | chan->ppp = pch; |
2402 | init_ppp_file(&pch->file, CHANNEL); |
2403 | pch->file.hdrlen = chan->hdrlen; |
2404 | @@ -2401,6 +2404,8 @@ ppp_unregister_channel(struct ppp_channel *chan) |
2405 | spin_lock_bh(&pn->all_channels_lock); |
2406 | list_del(&pch->list); |
2407 | spin_unlock_bh(&pn->all_channels_lock); |
2408 | + put_net(pch->chan_net); |
2409 | + pch->chan_net = NULL; |
2410 | |
2411 | pch->file.dead = 1; |
2412 | wake_up_interruptible(&pch->file.rwait); |
2413 | diff --git a/drivers/net/tun.c b/drivers/net/tun.c |
2414 | index 88bb8cc3555b..81ecc2ed8137 100644 |
2415 | --- a/drivers/net/tun.c |
2416 | +++ b/drivers/net/tun.c |
2417 | @@ -621,7 +621,8 @@ static int tun_attach(struct tun_struct *tun, struct file *file, bool skip_filte |
2418 | |
2419 | /* Re-attach the filter to persist device */ |
2420 | if (!skip_filter && (tun->filter_attached == true)) { |
2421 | - err = sk_attach_filter(&tun->fprog, tfile->socket.sk); |
2422 | + err = __sk_attach_filter(&tun->fprog, tfile->socket.sk, |
2423 | + lockdep_rtnl_is_held()); |
2424 | if (!err) |
2425 | goto out; |
2426 | } |
2427 | @@ -1000,7 +1001,6 @@ static void tun_net_init(struct net_device *dev) |
2428 | /* Zero header length */ |
2429 | dev->type = ARPHRD_NONE; |
2430 | dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; |
2431 | - dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */ |
2432 | break; |
2433 | |
2434 | case IFF_TAP: |
2435 | @@ -1012,7 +1012,6 @@ static void tun_net_init(struct net_device *dev) |
2436 | |
2437 | eth_hw_addr_random(dev); |
2438 | |
2439 | - dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */ |
2440 | break; |
2441 | } |
2442 | } |
2443 | @@ -1466,6 +1465,8 @@ static void tun_setup(struct net_device *dev) |
2444 | |
2445 | dev->ethtool_ops = &tun_ethtool_ops; |
2446 | dev->destructor = tun_free_netdev; |
2447 | + /* We prefer our own queue length */ |
2448 | + dev->tx_queue_len = TUN_READQ_SIZE; |
2449 | } |
2450 | |
2451 | /* Trivial set of netlink ops to allow deleting tun or tap |
2452 | @@ -1807,7 +1808,7 @@ static void tun_detach_filter(struct tun_struct *tun, int n) |
2453 | |
2454 | for (i = 0; i < n; i++) { |
2455 | tfile = rtnl_dereference(tun->tfiles[i]); |
2456 | - sk_detach_filter(tfile->socket.sk); |
2457 | + __sk_detach_filter(tfile->socket.sk, lockdep_rtnl_is_held()); |
2458 | } |
2459 | |
2460 | tun->filter_attached = false; |
2461 | @@ -1820,7 +1821,8 @@ static int tun_attach_filter(struct tun_struct *tun) |
2462 | |
2463 | for (i = 0; i < tun->numqueues; i++) { |
2464 | tfile = rtnl_dereference(tun->tfiles[i]); |
2465 | - ret = sk_attach_filter(&tun->fprog, tfile->socket.sk); |
2466 | + ret = __sk_attach_filter(&tun->fprog, tfile->socket.sk, |
2467 | + lockdep_rtnl_is_held()); |
2468 | if (ret) { |
2469 | tun_detach_filter(tun, i); |
2470 | return ret; |
2471 | diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
2472 | index a3a4ccf7cf52..1232a8c608b4 100644 |
2473 | --- a/drivers/net/usb/qmi_wwan.c |
2474 | +++ b/drivers/net/usb/qmi_wwan.c |
2475 | @@ -844,6 +844,7 @@ static const struct usb_device_id products[] = { |
2476 | {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ |
2477 | {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */ |
2478 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ |
2479 | + {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ |
2480 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ |
2481 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ |
2482 | {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ |
2483 | diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c |
2484 | index 44541dbc5c28..69b994f3b8c5 100644 |
2485 | --- a/drivers/net/wan/farsync.c |
2486 | +++ b/drivers/net/wan/farsync.c |
2487 | @@ -2516,7 +2516,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
2488 | dev->mem_start = card->phys_mem |
2489 | + BUF_OFFSET ( txBuffer[i][0][0]); |
2490 | dev->mem_end = card->phys_mem |
2491 | - + BUF_OFFSET ( txBuffer[i][NUM_TX_BUFFER][0]); |
2492 | + + BUF_OFFSET ( txBuffer[i][NUM_TX_BUFFER - 1][LEN_RX_BUFFER - 1]); |
2493 | dev->base_addr = card->pci_conf; |
2494 | dev->irq = card->irq; |
2495 | |
2496 | diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c |
2497 | index 73fb4232f9f2..a794157a147d 100644 |
2498 | --- a/drivers/net/wireless/ath/ath9k/eeprom.c |
2499 | +++ b/drivers/net/wireless/ath/ath9k/eeprom.c |
2500 | @@ -477,10 +477,9 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, |
2501 | |
2502 | if (match) { |
2503 | if (AR_SREV_9287(ah)) { |
2504 | - /* FIXME: array overrun? */ |
2505 | for (i = 0; i < numXpdGains; i++) { |
2506 | minPwrT4[i] = data_9287[idxL].pwrPdg[i][0]; |
2507 | - maxPwrT4[i] = data_9287[idxL].pwrPdg[i][4]; |
2508 | + maxPwrT4[i] = data_9287[idxL].pwrPdg[i][intercepts - 1]; |
2509 | ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i], |
2510 | data_9287[idxL].pwrPdg[i], |
2511 | data_9287[idxL].vpdPdg[i], |
2512 | @@ -490,7 +489,7 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, |
2513 | } else if (eeprom_4k) { |
2514 | for (i = 0; i < numXpdGains; i++) { |
2515 | minPwrT4[i] = data_4k[idxL].pwrPdg[i][0]; |
2516 | - maxPwrT4[i] = data_4k[idxL].pwrPdg[i][4]; |
2517 | + maxPwrT4[i] = data_4k[idxL].pwrPdg[i][intercepts - 1]; |
2518 | ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i], |
2519 | data_4k[idxL].pwrPdg[i], |
2520 | data_4k[idxL].vpdPdg[i], |
2521 | @@ -500,7 +499,7 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, |
2522 | } else { |
2523 | for (i = 0; i < numXpdGains; i++) { |
2524 | minPwrT4[i] = data_def[idxL].pwrPdg[i][0]; |
2525 | - maxPwrT4[i] = data_def[idxL].pwrPdg[i][4]; |
2526 | + maxPwrT4[i] = data_def[idxL].pwrPdg[i][intercepts - 1]; |
2527 | ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i], |
2528 | data_def[idxL].pwrPdg[i], |
2529 | data_def[idxL].vpdPdg[i], |
2530 | diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c |
2531 | index 576eb7013792..cdbab06bf74f 100644 |
2532 | --- a/drivers/nvdimm/bus.c |
2533 | +++ b/drivers/nvdimm/bus.c |
2534 | @@ -335,7 +335,7 @@ static const struct nd_cmd_desc __nd_cmd_dimm_descs[] = { |
2535 | [ND_CMD_IMPLEMENTED] = { }, |
2536 | [ND_CMD_SMART] = { |
2537 | .out_num = 2, |
2538 | - .out_sizes = { 4, 8, }, |
2539 | + .out_sizes = { 4, 128, }, |
2540 | }, |
2541 | [ND_CMD_SMART_THRESHOLD] = { |
2542 | .out_num = 2, |
2543 | diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c |
2544 | index ae81a2f1da50..f0b56b3aac4d 100644 |
2545 | --- a/drivers/nvdimm/pfn_devs.c |
2546 | +++ b/drivers/nvdimm/pfn_devs.c |
2547 | @@ -315,7 +315,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn) |
2548 | } else { |
2549 | /* from init we validate */ |
2550 | if (memcmp(nd_pfn->uuid, pfn_sb->uuid, 16) != 0) |
2551 | - return -EINVAL; |
2552 | + return -ENODEV; |
2553 | } |
2554 | |
2555 | if (nd_pfn->align > nvdimm_namespace_capacity(ndns)) { |
2556 | diff --git a/drivers/pcmcia/db1xxx_ss.c b/drivers/pcmcia/db1xxx_ss.c |
2557 | index 4c2fa05b4589..944674ee3464 100644 |
2558 | --- a/drivers/pcmcia/db1xxx_ss.c |
2559 | +++ b/drivers/pcmcia/db1xxx_ss.c |
2560 | @@ -56,6 +56,7 @@ struct db1x_pcmcia_sock { |
2561 | int stschg_irq; /* card-status-change irq */ |
2562 | int card_irq; /* card irq */ |
2563 | int eject_irq; /* db1200/pb1200 have these */ |
2564 | + int insert_gpio; /* db1000 carddetect gpio */ |
2565 | |
2566 | #define BOARD_TYPE_DEFAULT 0 /* most boards */ |
2567 | #define BOARD_TYPE_DB1200 1 /* IRQs aren't gpios */ |
2568 | @@ -83,7 +84,7 @@ static int db1200_card_inserted(struct db1x_pcmcia_sock *sock) |
2569 | /* carddetect gpio: low-active */ |
2570 | static int db1000_card_inserted(struct db1x_pcmcia_sock *sock) |
2571 | { |
2572 | - return !gpio_get_value(irq_to_gpio(sock->insert_irq)); |
2573 | + return !gpio_get_value(sock->insert_gpio); |
2574 | } |
2575 | |
2576 | static int db1x_card_inserted(struct db1x_pcmcia_sock *sock) |
2577 | @@ -457,9 +458,15 @@ static int db1x_pcmcia_socket_probe(struct platform_device *pdev) |
2578 | r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "card"); |
2579 | sock->card_irq = r ? r->start : 0; |
2580 | |
2581 | - /* insert: irq which triggers on card insertion/ejection */ |
2582 | + /* insert: irq which triggers on card insertion/ejection |
2583 | + * BIG FAT NOTE: on DB1000/1100/1500/1550 we pass a GPIO here! |
2584 | + */ |
2585 | r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "insert"); |
2586 | sock->insert_irq = r ? r->start : -1; |
2587 | + if (sock->board_type == BOARD_TYPE_DEFAULT) { |
2588 | + sock->insert_gpio = r ? r->start : -1; |
2589 | + sock->insert_irq = r ? gpio_to_irq(r->start) : -1; |
2590 | + } |
2591 | |
2592 | /* stschg: irq which trigger on card status change (optional) */ |
2593 | r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "stschg"); |
2594 | diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c |
2595 | index a5bb93987378..1029aa7889b5 100644 |
2596 | --- a/drivers/pinctrl/freescale/pinctrl-imx.c |
2597 | +++ b/drivers/pinctrl/freescale/pinctrl-imx.c |
2598 | @@ -726,19 +726,18 @@ int imx_pinctrl_probe(struct platform_device *pdev, |
2599 | |
2600 | if (of_property_read_bool(dev_np, "fsl,input-sel")) { |
2601 | np = of_parse_phandle(dev_np, "fsl,input-sel", 0); |
2602 | - if (np) { |
2603 | - ipctl->input_sel_base = of_iomap(np, 0); |
2604 | - if (IS_ERR(ipctl->input_sel_base)) { |
2605 | - of_node_put(np); |
2606 | - dev_err(&pdev->dev, |
2607 | - "iomuxc input select base address not found\n"); |
2608 | - return PTR_ERR(ipctl->input_sel_base); |
2609 | - } |
2610 | - } else { |
2611 | + if (!np) { |
2612 | dev_err(&pdev->dev, "iomuxc fsl,input-sel property not found\n"); |
2613 | return -EINVAL; |
2614 | } |
2615 | + |
2616 | + ipctl->input_sel_base = of_iomap(np, 0); |
2617 | of_node_put(np); |
2618 | + if (!ipctl->input_sel_base) { |
2619 | + dev_err(&pdev->dev, |
2620 | + "iomuxc input select base address not found\n"); |
2621 | + return -ENOMEM; |
2622 | + } |
2623 | } |
2624 | |
2625 | imx_pinctrl_desc.name = dev_name(&pdev->dev); |
2626 | diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c |
2627 | index 352406108fa0..c8969dd49449 100644 |
2628 | --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c |
2629 | +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c |
2630 | @@ -990,7 +990,7 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s, |
2631 | int val; |
2632 | |
2633 | if (pull) |
2634 | - pullidx = data_out ? 1 : 2; |
2635 | + pullidx = data_out ? 2 : 1; |
2636 | |
2637 | seq_printf(s, " gpio-%-3d (%-20.20s) in %s %s", |
2638 | gpio, |
2639 | diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c |
2640 | index 856f736cb1a6..2673cd9d106e 100644 |
2641 | --- a/drivers/pinctrl/pinctrl-pistachio.c |
2642 | +++ b/drivers/pinctrl/pinctrl-pistachio.c |
2643 | @@ -469,27 +469,27 @@ static const char * const pistachio_mips_pll_lock_groups[] = { |
2644 | "mfio83", |
2645 | }; |
2646 | |
2647 | -static const char * const pistachio_sys_pll_lock_groups[] = { |
2648 | +static const char * const pistachio_audio_pll_lock_groups[] = { |
2649 | "mfio84", |
2650 | }; |
2651 | |
2652 | -static const char * const pistachio_wifi_pll_lock_groups[] = { |
2653 | +static const char * const pistachio_rpu_v_pll_lock_groups[] = { |
2654 | "mfio85", |
2655 | }; |
2656 | |
2657 | -static const char * const pistachio_bt_pll_lock_groups[] = { |
2658 | +static const char * const pistachio_rpu_l_pll_lock_groups[] = { |
2659 | "mfio86", |
2660 | }; |
2661 | |
2662 | -static const char * const pistachio_rpu_v_pll_lock_groups[] = { |
2663 | +static const char * const pistachio_sys_pll_lock_groups[] = { |
2664 | "mfio87", |
2665 | }; |
2666 | |
2667 | -static const char * const pistachio_rpu_l_pll_lock_groups[] = { |
2668 | +static const char * const pistachio_wifi_pll_lock_groups[] = { |
2669 | "mfio88", |
2670 | }; |
2671 | |
2672 | -static const char * const pistachio_audio_pll_lock_groups[] = { |
2673 | +static const char * const pistachio_bt_pll_lock_groups[] = { |
2674 | "mfio89", |
2675 | }; |
2676 | |
2677 | @@ -559,12 +559,12 @@ enum pistachio_mux_option { |
2678 | PISTACHIO_FUNCTION_DREQ4, |
2679 | PISTACHIO_FUNCTION_DREQ5, |
2680 | PISTACHIO_FUNCTION_MIPS_PLL_LOCK, |
2681 | + PISTACHIO_FUNCTION_AUDIO_PLL_LOCK, |
2682 | + PISTACHIO_FUNCTION_RPU_V_PLL_LOCK, |
2683 | + PISTACHIO_FUNCTION_RPU_L_PLL_LOCK, |
2684 | PISTACHIO_FUNCTION_SYS_PLL_LOCK, |
2685 | PISTACHIO_FUNCTION_WIFI_PLL_LOCK, |
2686 | PISTACHIO_FUNCTION_BT_PLL_LOCK, |
2687 | - PISTACHIO_FUNCTION_RPU_V_PLL_LOCK, |
2688 | - PISTACHIO_FUNCTION_RPU_L_PLL_LOCK, |
2689 | - PISTACHIO_FUNCTION_AUDIO_PLL_LOCK, |
2690 | PISTACHIO_FUNCTION_DEBUG_RAW_CCA_IND, |
2691 | PISTACHIO_FUNCTION_DEBUG_ED_SEC20_CCA_IND, |
2692 | PISTACHIO_FUNCTION_DEBUG_ED_SEC40_CCA_IND, |
2693 | @@ -620,12 +620,12 @@ static const struct pistachio_function pistachio_functions[] = { |
2694 | FUNCTION(dreq4), |
2695 | FUNCTION(dreq5), |
2696 | FUNCTION(mips_pll_lock), |
2697 | + FUNCTION(audio_pll_lock), |
2698 | + FUNCTION(rpu_v_pll_lock), |
2699 | + FUNCTION(rpu_l_pll_lock), |
2700 | FUNCTION(sys_pll_lock), |
2701 | FUNCTION(wifi_pll_lock), |
2702 | FUNCTION(bt_pll_lock), |
2703 | - FUNCTION(rpu_v_pll_lock), |
2704 | - FUNCTION(rpu_l_pll_lock), |
2705 | - FUNCTION(audio_pll_lock), |
2706 | FUNCTION(debug_raw_cca_ind), |
2707 | FUNCTION(debug_ed_sec20_cca_ind), |
2708 | FUNCTION(debug_ed_sec40_cca_ind), |
2709 | diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c |
2710 | index 181ea98a63b7..2b0d70217bbd 100644 |
2711 | --- a/drivers/pinctrl/sh-pfc/core.c |
2712 | +++ b/drivers/pinctrl/sh-pfc/core.c |
2713 | @@ -545,7 +545,9 @@ static int sh_pfc_probe(struct platform_device *pdev) |
2714 | return ret; |
2715 | } |
2716 | |
2717 | - pinctrl_provide_dummies(); |
2718 | + /* Enable dummy states for those platforms without pinctrl support */ |
2719 | + if (!of_have_populated_dt()) |
2720 | + pinctrl_provide_dummies(); |
2721 | |
2722 | ret = sh_pfc_init_ranges(pfc); |
2723 | if (ret < 0) |
2724 | diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c |
2725 | index 00265f0435a7..8b381d69df86 100644 |
2726 | --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c |
2727 | +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c |
2728 | @@ -485,6 +485,7 @@ static const struct sunxi_pinctrl_desc sun8i_a33_pinctrl_data = { |
2729 | .pins = sun8i_a33_pins, |
2730 | .npins = ARRAY_SIZE(sun8i_a33_pins), |
2731 | .irq_banks = 2, |
2732 | + .irq_bank_base = 1, |
2733 | }; |
2734 | |
2735 | static int sun8i_a33_pinctrl_probe(struct platform_device *pdev) |
2736 | diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c |
2737 | index 7a2465f5e71e..884c2b314567 100644 |
2738 | --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c |
2739 | +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c |
2740 | @@ -578,7 +578,7 @@ static void sunxi_pinctrl_irq_release_resources(struct irq_data *d) |
2741 | static int sunxi_pinctrl_irq_set_type(struct irq_data *d, unsigned int type) |
2742 | { |
2743 | struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d); |
2744 | - u32 reg = sunxi_irq_cfg_reg(d->hwirq); |
2745 | + u32 reg = sunxi_irq_cfg_reg(d->hwirq, pctl->desc->irq_bank_base); |
2746 | u8 index = sunxi_irq_cfg_offset(d->hwirq); |
2747 | unsigned long flags; |
2748 | u32 regval; |
2749 | @@ -625,7 +625,8 @@ static int sunxi_pinctrl_irq_set_type(struct irq_data *d, unsigned int type) |
2750 | static void sunxi_pinctrl_irq_ack(struct irq_data *d) |
2751 | { |
2752 | struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d); |
2753 | - u32 status_reg = sunxi_irq_status_reg(d->hwirq); |
2754 | + u32 status_reg = sunxi_irq_status_reg(d->hwirq, |
2755 | + pctl->desc->irq_bank_base); |
2756 | u8 status_idx = sunxi_irq_status_offset(d->hwirq); |
2757 | |
2758 | /* Clear the IRQ */ |
2759 | @@ -635,7 +636,7 @@ static void sunxi_pinctrl_irq_ack(struct irq_data *d) |
2760 | static void sunxi_pinctrl_irq_mask(struct irq_data *d) |
2761 | { |
2762 | struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d); |
2763 | - u32 reg = sunxi_irq_ctrl_reg(d->hwirq); |
2764 | + u32 reg = sunxi_irq_ctrl_reg(d->hwirq, pctl->desc->irq_bank_base); |
2765 | u8 idx = sunxi_irq_ctrl_offset(d->hwirq); |
2766 | unsigned long flags; |
2767 | u32 val; |
2768 | @@ -652,7 +653,7 @@ static void sunxi_pinctrl_irq_mask(struct irq_data *d) |
2769 | static void sunxi_pinctrl_irq_unmask(struct irq_data *d) |
2770 | { |
2771 | struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d); |
2772 | - u32 reg = sunxi_irq_ctrl_reg(d->hwirq); |
2773 | + u32 reg = sunxi_irq_ctrl_reg(d->hwirq, pctl->desc->irq_bank_base); |
2774 | u8 idx = sunxi_irq_ctrl_offset(d->hwirq); |
2775 | unsigned long flags; |
2776 | u32 val; |
2777 | @@ -744,7 +745,7 @@ static void sunxi_pinctrl_irq_handler(struct irq_desc *desc) |
2778 | if (bank == pctl->desc->irq_banks) |
2779 | return; |
2780 | |
2781 | - reg = sunxi_irq_status_reg_from_bank(bank); |
2782 | + reg = sunxi_irq_status_reg_from_bank(bank, pctl->desc->irq_bank_base); |
2783 | val = readl(pctl->membase + reg); |
2784 | |
2785 | if (val) { |
2786 | @@ -1023,9 +1024,11 @@ int sunxi_pinctrl_init(struct platform_device *pdev, |
2787 | |
2788 | for (i = 0; i < pctl->desc->irq_banks; i++) { |
2789 | /* Mask and clear all IRQs before registering a handler */ |
2790 | - writel(0, pctl->membase + sunxi_irq_ctrl_reg_from_bank(i)); |
2791 | + writel(0, pctl->membase + sunxi_irq_ctrl_reg_from_bank(i, |
2792 | + pctl->desc->irq_bank_base)); |
2793 | writel(0xffffffff, |
2794 | - pctl->membase + sunxi_irq_status_reg_from_bank(i)); |
2795 | + pctl->membase + sunxi_irq_status_reg_from_bank(i, |
2796 | + pctl->desc->irq_bank_base)); |
2797 | |
2798 | irq_set_chained_handler_and_data(pctl->irq[i], |
2799 | sunxi_pinctrl_irq_handler, |
2800 | diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h |
2801 | index e248e81a0f9e..0afce1ab12d0 100644 |
2802 | --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h |
2803 | +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h |
2804 | @@ -97,6 +97,7 @@ struct sunxi_pinctrl_desc { |
2805 | int npins; |
2806 | unsigned pin_base; |
2807 | unsigned irq_banks; |
2808 | + unsigned irq_bank_base; |
2809 | bool irq_read_needs_mux; |
2810 | }; |
2811 | |
2812 | @@ -233,12 +234,12 @@ static inline u32 sunxi_pull_offset(u16 pin) |
2813 | return pin_num * PULL_PINS_BITS; |
2814 | } |
2815 | |
2816 | -static inline u32 sunxi_irq_cfg_reg(u16 irq) |
2817 | +static inline u32 sunxi_irq_cfg_reg(u16 irq, unsigned bank_base) |
2818 | { |
2819 | u8 bank = irq / IRQ_PER_BANK; |
2820 | u8 reg = (irq % IRQ_PER_BANK) / IRQ_CFG_IRQ_PER_REG * 0x04; |
2821 | |
2822 | - return IRQ_CFG_REG + bank * IRQ_MEM_SIZE + reg; |
2823 | + return IRQ_CFG_REG + (bank_base + bank) * IRQ_MEM_SIZE + reg; |
2824 | } |
2825 | |
2826 | static inline u32 sunxi_irq_cfg_offset(u16 irq) |
2827 | @@ -247,16 +248,16 @@ static inline u32 sunxi_irq_cfg_offset(u16 irq) |
2828 | return irq_num * IRQ_CFG_IRQ_BITS; |
2829 | } |
2830 | |
2831 | -static inline u32 sunxi_irq_ctrl_reg_from_bank(u8 bank) |
2832 | +static inline u32 sunxi_irq_ctrl_reg_from_bank(u8 bank, unsigned bank_base) |
2833 | { |
2834 | - return IRQ_CTRL_REG + bank * IRQ_MEM_SIZE; |
2835 | + return IRQ_CTRL_REG + (bank_base + bank) * IRQ_MEM_SIZE; |
2836 | } |
2837 | |
2838 | -static inline u32 sunxi_irq_ctrl_reg(u16 irq) |
2839 | +static inline u32 sunxi_irq_ctrl_reg(u16 irq, unsigned bank_base) |
2840 | { |
2841 | u8 bank = irq / IRQ_PER_BANK; |
2842 | |
2843 | - return sunxi_irq_ctrl_reg_from_bank(bank); |
2844 | + return sunxi_irq_ctrl_reg_from_bank(bank, bank_base); |
2845 | } |
2846 | |
2847 | static inline u32 sunxi_irq_ctrl_offset(u16 irq) |
2848 | @@ -265,16 +266,16 @@ static inline u32 sunxi_irq_ctrl_offset(u16 irq) |
2849 | return irq_num * IRQ_CTRL_IRQ_BITS; |
2850 | } |
2851 | |
2852 | -static inline u32 sunxi_irq_status_reg_from_bank(u8 bank) |
2853 | +static inline u32 sunxi_irq_status_reg_from_bank(u8 bank, unsigned bank_base) |
2854 | { |
2855 | - return IRQ_STATUS_REG + bank * IRQ_MEM_SIZE; |
2856 | + return IRQ_STATUS_REG + (bank_base + bank) * IRQ_MEM_SIZE; |
2857 | } |
2858 | |
2859 | -static inline u32 sunxi_irq_status_reg(u16 irq) |
2860 | +static inline u32 sunxi_irq_status_reg(u16 irq, unsigned bank_base) |
2861 | { |
2862 | u8 bank = irq / IRQ_PER_BANK; |
2863 | |
2864 | - return sunxi_irq_status_reg_from_bank(bank); |
2865 | + return sunxi_irq_status_reg_from_bank(bank, bank_base); |
2866 | } |
2867 | |
2868 | static inline u32 sunxi_irq_status_offset(u16 irq) |
2869 | diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c |
2870 | index b1bf42b93fcc..1deb6adc411f 100644 |
2871 | --- a/drivers/scsi/scsi.c |
2872 | +++ b/drivers/scsi/scsi.c |
2873 | @@ -784,8 +784,9 @@ void scsi_attach_vpd(struct scsi_device *sdev) |
2874 | int pg83_supported = 0; |
2875 | unsigned char __rcu *vpd_buf, *orig_vpd_buf = NULL; |
2876 | |
2877 | - if (sdev->skip_vpd_pages) |
2878 | + if (!scsi_device_supports_vpd(sdev)) |
2879 | return; |
2880 | + |
2881 | retry_pg0: |
2882 | vpd_buf = kmalloc(vpd_len, GFP_KERNEL); |
2883 | if (!vpd_buf) |
2884 | diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c |
2885 | index 5a5457ac9cdb..974ca5b45f8d 100644 |
2886 | --- a/drivers/scsi/sd.c |
2887 | +++ b/drivers/scsi/sd.c |
2888 | @@ -1275,18 +1275,19 @@ static int sd_getgeo(struct block_device *bdev, struct hd_geometry *geo) |
2889 | struct scsi_disk *sdkp = scsi_disk(bdev->bd_disk); |
2890 | struct scsi_device *sdp = sdkp->device; |
2891 | struct Scsi_Host *host = sdp->host; |
2892 | + sector_t capacity = logical_to_sectors(sdp, sdkp->capacity); |
2893 | int diskinfo[4]; |
2894 | |
2895 | /* default to most commonly used values */ |
2896 | - diskinfo[0] = 0x40; /* 1 << 6 */ |
2897 | - diskinfo[1] = 0x20; /* 1 << 5 */ |
2898 | - diskinfo[2] = sdkp->capacity >> 11; |
2899 | - |
2900 | + diskinfo[0] = 0x40; /* 1 << 6 */ |
2901 | + diskinfo[1] = 0x20; /* 1 << 5 */ |
2902 | + diskinfo[2] = capacity >> 11; |
2903 | + |
2904 | /* override with calculated, extended default, or driver values */ |
2905 | if (host->hostt->bios_param) |
2906 | - host->hostt->bios_param(sdp, bdev, sdkp->capacity, diskinfo); |
2907 | + host->hostt->bios_param(sdp, bdev, capacity, diskinfo); |
2908 | else |
2909 | - scsicam_bios_param(bdev, sdkp->capacity, diskinfo); |
2910 | + scsicam_bios_param(bdev, capacity, diskinfo); |
2911 | |
2912 | geo->heads = diskinfo[0]; |
2913 | geo->sectors = diskinfo[1]; |
2914 | @@ -2337,14 +2338,6 @@ got_data: |
2915 | if (sdkp->capacity > 0xffffffff) |
2916 | sdp->use_16_for_rw = 1; |
2917 | |
2918 | - /* Rescale capacity to 512-byte units */ |
2919 | - if (sector_size == 4096) |
2920 | - sdkp->capacity <<= 3; |
2921 | - else if (sector_size == 2048) |
2922 | - sdkp->capacity <<= 2; |
2923 | - else if (sector_size == 1024) |
2924 | - sdkp->capacity <<= 1; |
2925 | - |
2926 | blk_queue_physical_block_size(sdp->request_queue, |
2927 | sdkp->physical_block_size); |
2928 | sdkp->device->sector_size = sector_size; |
2929 | @@ -2795,28 +2788,6 @@ static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer) |
2930 | sdkp->ws10 = 1; |
2931 | } |
2932 | |
2933 | -static int sd_try_extended_inquiry(struct scsi_device *sdp) |
2934 | -{ |
2935 | - /* Attempt VPD inquiry if the device blacklist explicitly calls |
2936 | - * for it. |
2937 | - */ |
2938 | - if (sdp->try_vpd_pages) |
2939 | - return 1; |
2940 | - /* |
2941 | - * Although VPD inquiries can go to SCSI-2 type devices, |
2942 | - * some USB ones crash on receiving them, and the pages |
2943 | - * we currently ask for are for SPC-3 and beyond |
2944 | - */ |
2945 | - if (sdp->scsi_level > SCSI_SPC_2 && !sdp->skip_vpd_pages) |
2946 | - return 1; |
2947 | - return 0; |
2948 | -} |
2949 | - |
2950 | -static inline u32 logical_to_sectors(struct scsi_device *sdev, u32 blocks) |
2951 | -{ |
2952 | - return blocks << (ilog2(sdev->sector_size) - 9); |
2953 | -} |
2954 | - |
2955 | /** |
2956 | * sd_revalidate_disk - called the first time a new disk is seen, |
2957 | * performs disk spin up, read_capacity, etc. |
2958 | @@ -2856,7 +2827,7 @@ static int sd_revalidate_disk(struct gendisk *disk) |
2959 | if (sdkp->media_present) { |
2960 | sd_read_capacity(sdkp, buffer); |
2961 | |
2962 | - if (sd_try_extended_inquiry(sdp)) { |
2963 | + if (scsi_device_supports_vpd(sdp)) { |
2964 | sd_read_block_provisioning(sdkp); |
2965 | sd_read_block_limits(sdkp); |
2966 | sd_read_block_characteristics(sdkp); |
2967 | @@ -2900,7 +2871,7 @@ static int sd_revalidate_disk(struct gendisk *disk) |
2968 | /* Combine with controller limits */ |
2969 | q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q)); |
2970 | |
2971 | - set_capacity(disk, sdkp->capacity); |
2972 | + set_capacity(disk, logical_to_sectors(sdp, sdkp->capacity)); |
2973 | sd_config_write_same(sdkp); |
2974 | kfree(buffer); |
2975 | |
2976 | diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h |
2977 | index 5f2a84aff29f..654630bb7d0e 100644 |
2978 | --- a/drivers/scsi/sd.h |
2979 | +++ b/drivers/scsi/sd.h |
2980 | @@ -65,7 +65,7 @@ struct scsi_disk { |
2981 | struct device dev; |
2982 | struct gendisk *disk; |
2983 | atomic_t openers; |
2984 | - sector_t capacity; /* size in 512-byte sectors */ |
2985 | + sector_t capacity; /* size in logical blocks */ |
2986 | u32 max_xfer_blocks; |
2987 | u32 opt_xfer_blocks; |
2988 | u32 max_ws_blocks; |
2989 | @@ -146,6 +146,11 @@ static inline int scsi_medium_access_command(struct scsi_cmnd *scmd) |
2990 | return 0; |
2991 | } |
2992 | |
2993 | +static inline sector_t logical_to_sectors(struct scsi_device *sdev, sector_t blocks) |
2994 | +{ |
2995 | + return blocks << (ilog2(sdev->sector_size) - 9); |
2996 | +} |
2997 | + |
2998 | /* |
2999 | * A DIF-capable target device can be formatted with different |
3000 | * protection schemes. Currently 0 through 3 are defined: |
3001 | diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c |
3002 | index e237e9f3312d..df560216d702 100644 |
3003 | --- a/drivers/staging/android/ion/ion.c |
3004 | +++ b/drivers/staging/android/ion/ion.c |
3005 | @@ -251,8 +251,10 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, |
3006 | * memory coming from the heaps is ready for dma, ie if it has a |
3007 | * cached mapping that mapping has been invalidated |
3008 | */ |
3009 | - for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i) |
3010 | + for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i) { |
3011 | sg_dma_address(sg) = sg_phys(sg); |
3012 | + sg_dma_len(sg) = sg->length; |
3013 | + } |
3014 | mutex_lock(&dev->buffer_lock); |
3015 | ion_buffer_add(dev, buffer); |
3016 | mutex_unlock(&dev->buffer_lock); |
3017 | diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c |
3018 | index c0f5c652d272..f1893e08e51a 100644 |
3019 | --- a/drivers/usb/renesas_usbhs/fifo.c |
3020 | +++ b/drivers/usb/renesas_usbhs/fifo.c |
3021 | @@ -190,7 +190,8 @@ static int usbhsf_pkt_handler(struct usbhs_pipe *pipe, int type) |
3022 | goto __usbhs_pkt_handler_end; |
3023 | } |
3024 | |
3025 | - ret = func(pkt, &is_done); |
3026 | + if (likely(func)) |
3027 | + ret = func(pkt, &is_done); |
3028 | |
3029 | if (is_done) |
3030 | __usbhsf_pkt_del(pkt); |
3031 | @@ -889,6 +890,7 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done) |
3032 | |
3033 | pkt->trans = len; |
3034 | |
3035 | + usbhsf_tx_irq_ctrl(pipe, 0); |
3036 | INIT_WORK(&pkt->work, xfer_work); |
3037 | schedule_work(&pkt->work); |
3038 | |
3039 | diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c |
3040 | index 657f9672ceba..251053551866 100644 |
3041 | --- a/drivers/usb/renesas_usbhs/mod_gadget.c |
3042 | +++ b/drivers/usb/renesas_usbhs/mod_gadget.c |
3043 | @@ -158,10 +158,14 @@ static void usbhsg_queue_done(struct usbhs_priv *priv, struct usbhs_pkt *pkt) |
3044 | struct usbhs_pipe *pipe = pkt->pipe; |
3045 | struct usbhsg_uep *uep = usbhsg_pipe_to_uep(pipe); |
3046 | struct usbhsg_request *ureq = usbhsg_pkt_to_ureq(pkt); |
3047 | + unsigned long flags; |
3048 | |
3049 | ureq->req.actual = pkt->actual; |
3050 | |
3051 | - usbhsg_queue_pop(uep, ureq, 0); |
3052 | + usbhs_lock(priv, flags); |
3053 | + if (uep) |
3054 | + __usbhsg_queue_pop(uep, ureq, 0); |
3055 | + usbhs_unlock(priv, flags); |
3056 | } |
3057 | |
3058 | static void usbhsg_queue_push(struct usbhsg_uep *uep, |
3059 | diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c |
3060 | index c90a7e46cc7b..e4ade8d89eb5 100644 |
3061 | --- a/drivers/usb/storage/uas.c |
3062 | +++ b/drivers/usb/storage/uas.c |
3063 | @@ -2,7 +2,7 @@ |
3064 | * USB Attached SCSI |
3065 | * Note that this is not the same as the USB Mass Storage driver |
3066 | * |
3067 | - * Copyright Hans de Goede <hdegoede@redhat.com> for Red Hat, Inc. 2013 - 2014 |
3068 | + * Copyright Hans de Goede <hdegoede@redhat.com> for Red Hat, Inc. 2013 - 2016 |
3069 | * Copyright Matthew Wilcox for Intel Corp, 2010 |
3070 | * Copyright Sarah Sharp for Intel Corp, 2010 |
3071 | * |
3072 | @@ -757,6 +757,17 @@ static int uas_eh_bus_reset_handler(struct scsi_cmnd *cmnd) |
3073 | return SUCCESS; |
3074 | } |
3075 | |
3076 | +static int uas_target_alloc(struct scsi_target *starget) |
3077 | +{ |
3078 | + struct uas_dev_info *devinfo = (struct uas_dev_info *) |
3079 | + dev_to_shost(starget->dev.parent)->hostdata; |
3080 | + |
3081 | + if (devinfo->flags & US_FL_NO_REPORT_LUNS) |
3082 | + starget->no_report_luns = 1; |
3083 | + |
3084 | + return 0; |
3085 | +} |
3086 | + |
3087 | static int uas_slave_alloc(struct scsi_device *sdev) |
3088 | { |
3089 | struct uas_dev_info *devinfo = |
3090 | @@ -800,7 +811,6 @@ static int uas_slave_configure(struct scsi_device *sdev) |
3091 | if (devinfo->flags & US_FL_BROKEN_FUA) |
3092 | sdev->broken_fua = 1; |
3093 | |
3094 | - scsi_change_queue_depth(sdev, devinfo->qdepth - 2); |
3095 | return 0; |
3096 | } |
3097 | |
3098 | @@ -808,6 +818,7 @@ static struct scsi_host_template uas_host_template = { |
3099 | .module = THIS_MODULE, |
3100 | .name = "uas", |
3101 | .queuecommand = uas_queuecommand, |
3102 | + .target_alloc = uas_target_alloc, |
3103 | .slave_alloc = uas_slave_alloc, |
3104 | .slave_configure = uas_slave_configure, |
3105 | .eh_abort_handler = uas_eh_abort_handler, |
3106 | @@ -932,6 +943,12 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) |
3107 | if (result) |
3108 | goto set_alt0; |
3109 | |
3110 | + /* |
3111 | + * 1 tag is reserved for untagged commands + |
3112 | + * 1 tag to avoid off by one errors in some bridge firmwares |
3113 | + */ |
3114 | + shost->can_queue = devinfo->qdepth - 2; |
3115 | + |
3116 | usb_set_intfdata(intf, shost); |
3117 | result = scsi_add_host(shost, &intf->dev); |
3118 | if (result) |
3119 | diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h |
3120 | index ccc113e83d88..53341a77d89f 100644 |
3121 | --- a/drivers/usb/storage/unusual_uas.h |
3122 | +++ b/drivers/usb/storage/unusual_uas.h |
3123 | @@ -64,6 +64,13 @@ UNUSUAL_DEV(0x0bc2, 0x3312, 0x0000, 0x9999, |
3124 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
3125 | US_FL_NO_ATA_1X), |
3126 | |
3127 | +/* Reported-by: David Webb <djw@noc.ac.uk> */ |
3128 | +UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x9999, |
3129 | + "Seagate", |
3130 | + "Expansion Desk", |
3131 | + USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
3132 | + US_FL_NO_REPORT_LUNS), |
3133 | + |
3134 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ |
3135 | UNUSUAL_DEV(0x0bc2, 0x3320, 0x0000, 0x9999, |
3136 | "Seagate", |
3137 | diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c |
3138 | index 43576ed31ccd..9de988a0f856 100644 |
3139 | --- a/drivers/usb/storage/usb.c |
3140 | +++ b/drivers/usb/storage/usb.c |
3141 | @@ -482,7 +482,7 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags) |
3142 | US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 | |
3143 | US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE | |
3144 | US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES | |
3145 | - US_FL_MAX_SECTORS_240); |
3146 | + US_FL_MAX_SECTORS_240 | US_FL_NO_REPORT_LUNS); |
3147 | |
3148 | p = quirks; |
3149 | while (*p) { |
3150 | @@ -532,6 +532,9 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags) |
3151 | case 'i': |
3152 | f |= US_FL_IGNORE_DEVICE; |
3153 | break; |
3154 | + case 'j': |
3155 | + f |= US_FL_NO_REPORT_LUNS; |
3156 | + break; |
3157 | case 'l': |
3158 | f |= US_FL_NOT_LOCKABLE; |
3159 | break; |
3160 | diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c |
3161 | index 7760fc1a2218..1f413a2f70b6 100644 |
3162 | --- a/drivers/virtio/virtio_pci_modern.c |
3163 | +++ b/drivers/virtio/virtio_pci_modern.c |
3164 | @@ -17,6 +17,7 @@ |
3165 | * |
3166 | */ |
3167 | |
3168 | +#include <linux/delay.h> |
3169 | #define VIRTIO_PCI_NO_LEGACY |
3170 | #include "virtio_pci_common.h" |
3171 | |
3172 | @@ -271,9 +272,13 @@ static void vp_reset(struct virtio_device *vdev) |
3173 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); |
3174 | /* 0 status means a reset. */ |
3175 | vp_iowrite8(0, &vp_dev->common->device_status); |
3176 | - /* Flush out the status write, and flush in device writes, |
3177 | - * including MSI-X interrupts, if any. */ |
3178 | - vp_ioread8(&vp_dev->common->device_status); |
3179 | + /* After writing 0 to device_status, the driver MUST wait for a read of |
3180 | + * device_status to return 0 before reinitializing the device. |
3181 | + * This will flush out the status write, and flush in device writes, |
3182 | + * including MSI-X interrupts, if any. |
3183 | + */ |
3184 | + while (vp_ioread8(&vp_dev->common->device_status)) |
3185 | + msleep(1); |
3186 | /* Flush pending VQ/configuration callbacks. */ |
3187 | vp_synchronize_vectors(vdev); |
3188 | } |
3189 | diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c |
3190 | index 524c22146429..44367783f07a 100644 |
3191 | --- a/drivers/xen/events/events_base.c |
3192 | +++ b/drivers/xen/events/events_base.c |
3193 | @@ -484,9 +484,19 @@ static void eoi_pirq(struct irq_data *data) |
3194 | struct physdev_eoi eoi = { .irq = pirq_from_irq(data->irq) }; |
3195 | int rc = 0; |
3196 | |
3197 | - irq_move_irq(data); |
3198 | + if (!VALID_EVTCHN(evtchn)) |
3199 | + return; |
3200 | |
3201 | - if (VALID_EVTCHN(evtchn)) |
3202 | + if (unlikely(irqd_is_setaffinity_pending(data))) { |
3203 | + int masked = test_and_set_mask(evtchn); |
3204 | + |
3205 | + clear_evtchn(evtchn); |
3206 | + |
3207 | + irq_move_masked_irq(data); |
3208 | + |
3209 | + if (!masked) |
3210 | + unmask_evtchn(evtchn); |
3211 | + } else |
3212 | clear_evtchn(evtchn); |
3213 | |
3214 | if (pirq_needs_eoi(data->irq)) { |
3215 | @@ -1357,9 +1367,19 @@ static void ack_dynirq(struct irq_data *data) |
3216 | { |
3217 | int evtchn = evtchn_from_irq(data->irq); |
3218 | |
3219 | - irq_move_irq(data); |
3220 | + if (!VALID_EVTCHN(evtchn)) |
3221 | + return; |
3222 | |
3223 | - if (VALID_EVTCHN(evtchn)) |
3224 | + if (unlikely(irqd_is_setaffinity_pending(data))) { |
3225 | + int masked = test_and_set_mask(evtchn); |
3226 | + |
3227 | + clear_evtchn(evtchn); |
3228 | + |
3229 | + irq_move_masked_irq(data); |
3230 | + |
3231 | + if (!masked) |
3232 | + unmask_evtchn(evtchn); |
3233 | + } else |
3234 | clear_evtchn(evtchn); |
3235 | } |
3236 | |
3237 | diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
3238 | index 098bb8f690c9..9a30ca64066b 100644 |
3239 | --- a/fs/btrfs/file.c |
3240 | +++ b/fs/btrfs/file.c |
3241 | @@ -1883,7 +1883,7 @@ static int start_ordered_ops(struct inode *inode, loff_t start, loff_t end) |
3242 | */ |
3243 | int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
3244 | { |
3245 | - struct dentry *dentry = file->f_path.dentry; |
3246 | + struct dentry *dentry = file_dentry(file); |
3247 | struct inode *inode = d_inode(dentry); |
3248 | struct btrfs_root *root = BTRFS_I(inode)->root; |
3249 | struct btrfs_trans_handle *trans; |
3250 | diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
3251 | index 978c3a810893..849a30aa117d 100644 |
3252 | --- a/fs/btrfs/tree-log.c |
3253 | +++ b/fs/btrfs/tree-log.c |
3254 | @@ -4414,6 +4414,127 @@ static int btrfs_log_trailing_hole(struct btrfs_trans_handle *trans, |
3255 | return ret; |
3256 | } |
3257 | |
3258 | +/* |
3259 | + * When we are logging a new inode X, check if it doesn't have a reference that |
3260 | + * matches the reference from some other inode Y created in a past transaction |
3261 | + * and that was renamed in the current transaction. If we don't do this, then at |
3262 | + * log replay time we can lose inode Y (and all its files if it's a directory): |
3263 | + * |
3264 | + * mkdir /mnt/x |
3265 | + * echo "hello world" > /mnt/x/foobar |
3266 | + * sync |
3267 | + * mv /mnt/x /mnt/y |
3268 | + * mkdir /mnt/x # or touch /mnt/x |
3269 | + * xfs_io -c fsync /mnt/x |
3270 | + * <power fail> |
3271 | + * mount fs, trigger log replay |
3272 | + * |
3273 | + * After the log replay procedure, we would lose the first directory and all its |
3274 | + * files (file foobar). |
3275 | + * For the case where inode Y is not a directory we simply end up losing it: |
3276 | + * |
3277 | + * echo "123" > /mnt/foo |
3278 | + * sync |
3279 | + * mv /mnt/foo /mnt/bar |
3280 | + * echo "abc" > /mnt/foo |
3281 | + * xfs_io -c fsync /mnt/foo |
3282 | + * <power fail> |
3283 | + * |
3284 | + * We also need this for cases where a snapshot entry is replaced by some other |
3285 | + * entry (file or directory) otherwise we end up with an unreplayable log due to |
3286 | + * attempts to delete the snapshot entry (entry of type BTRFS_ROOT_ITEM_KEY) as |
3287 | + * if it were a regular entry: |
3288 | + * |
3289 | + * mkdir /mnt/x |
3290 | + * btrfs subvolume snapshot /mnt /mnt/x/snap |
3291 | + * btrfs subvolume delete /mnt/x/snap |
3292 | + * rmdir /mnt/x |
3293 | + * mkdir /mnt/x |
3294 | + * fsync /mnt/x or fsync some new file inside it |
3295 | + * <power fail> |
3296 | + * |
3297 | + * The snapshot delete, rmdir of x, mkdir of a new x and the fsync all happen in |
3298 | + * the same transaction. |
3299 | + */ |
3300 | +static int btrfs_check_ref_name_override(struct extent_buffer *eb, |
3301 | + const int slot, |
3302 | + const struct btrfs_key *key, |
3303 | + struct inode *inode) |
3304 | +{ |
3305 | + int ret; |
3306 | + struct btrfs_path *search_path; |
3307 | + char *name = NULL; |
3308 | + u32 name_len = 0; |
3309 | + u32 item_size = btrfs_item_size_nr(eb, slot); |
3310 | + u32 cur_offset = 0; |
3311 | + unsigned long ptr = btrfs_item_ptr_offset(eb, slot); |
3312 | + |
3313 | + search_path = btrfs_alloc_path(); |
3314 | + if (!search_path) |
3315 | + return -ENOMEM; |
3316 | + search_path->search_commit_root = 1; |
3317 | + search_path->skip_locking = 1; |
3318 | + |
3319 | + while (cur_offset < item_size) { |
3320 | + u64 parent; |
3321 | + u32 this_name_len; |
3322 | + u32 this_len; |
3323 | + unsigned long name_ptr; |
3324 | + struct btrfs_dir_item *di; |
3325 | + |
3326 | + if (key->type == BTRFS_INODE_REF_KEY) { |
3327 | + struct btrfs_inode_ref *iref; |
3328 | + |
3329 | + iref = (struct btrfs_inode_ref *)(ptr + cur_offset); |
3330 | + parent = key->offset; |
3331 | + this_name_len = btrfs_inode_ref_name_len(eb, iref); |
3332 | + name_ptr = (unsigned long)(iref + 1); |
3333 | + this_len = sizeof(*iref) + this_name_len; |
3334 | + } else { |
3335 | + struct btrfs_inode_extref *extref; |
3336 | + |
3337 | + extref = (struct btrfs_inode_extref *)(ptr + |
3338 | + cur_offset); |
3339 | + parent = btrfs_inode_extref_parent(eb, extref); |
3340 | + this_name_len = btrfs_inode_extref_name_len(eb, extref); |
3341 | + name_ptr = (unsigned long)&extref->name; |
3342 | + this_len = sizeof(*extref) + this_name_len; |
3343 | + } |
3344 | + |
3345 | + if (this_name_len > name_len) { |
3346 | + char *new_name; |
3347 | + |
3348 | + new_name = krealloc(name, this_name_len, GFP_NOFS); |
3349 | + if (!new_name) { |
3350 | + ret = -ENOMEM; |
3351 | + goto out; |
3352 | + } |
3353 | + name_len = this_name_len; |
3354 | + name = new_name; |
3355 | + } |
3356 | + |
3357 | + read_extent_buffer(eb, name, name_ptr, this_name_len); |
3358 | + di = btrfs_lookup_dir_item(NULL, BTRFS_I(inode)->root, |
3359 | + search_path, parent, |
3360 | + name, this_name_len, 0); |
3361 | + if (di && !IS_ERR(di)) { |
3362 | + ret = 1; |
3363 | + goto out; |
3364 | + } else if (IS_ERR(di)) { |
3365 | + ret = PTR_ERR(di); |
3366 | + goto out; |
3367 | + } |
3368 | + btrfs_release_path(search_path); |
3369 | + |
3370 | + cur_offset += this_len; |
3371 | + } |
3372 | + ret = 0; |
3373 | +out: |
3374 | + btrfs_free_path(search_path); |
3375 | + kfree(name); |
3376 | + return ret; |
3377 | +} |
3378 | + |
3379 | /* log a single inode in the tree log. |
3380 | * At least one parent directory for this inode must exist in the tree |
3381 | * or be logged already. |
3382 | @@ -4586,6 +4707,22 @@ again: |
3383 | if (min_key.type == BTRFS_INODE_ITEM_KEY) |
3384 | need_log_inode_item = false; |
3385 | |
3386 | + if ((min_key.type == BTRFS_INODE_REF_KEY || |
3387 | + min_key.type == BTRFS_INODE_EXTREF_KEY) && |
3388 | + BTRFS_I(inode)->generation == trans->transid) { |
3389 | + ret = btrfs_check_ref_name_override(path->nodes[0], |
3390 | + path->slots[0], |
3391 | + &min_key, inode); |
3392 | + if (ret < 0) { |
3393 | + err = ret; |
3394 | + goto out_unlock; |
3395 | + } else if (ret > 0) { |
3396 | + err = 1; |
3397 | + btrfs_set_log_full_commit(root->fs_info, trans); |
3398 | + goto out_unlock; |
3399 | + } |
3400 | + } |
3401 | + |
3402 | /* Skip xattrs, we log them later with btrfs_log_all_xattrs() */ |
3403 | if (min_key.type == BTRFS_XATTR_ITEM_KEY) { |
3404 | if (ins_nr == 0) |
3405 | diff --git a/fs/dcache.c b/fs/dcache.c |
3406 | index 2398f9f94337..7566b2689609 100644 |
3407 | --- a/fs/dcache.c |
3408 | +++ b/fs/dcache.c |
3409 | @@ -1667,7 +1667,8 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) |
3410 | DCACHE_OP_REVALIDATE | |
3411 | DCACHE_OP_WEAK_REVALIDATE | |
3412 | DCACHE_OP_DELETE | |
3413 | - DCACHE_OP_SELECT_INODE)); |
3414 | + DCACHE_OP_SELECT_INODE | |
3415 | + DCACHE_OP_REAL)); |
3416 | dentry->d_op = op; |
3417 | if (!op) |
3418 | return; |
3419 | @@ -1685,6 +1686,8 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) |
3420 | dentry->d_flags |= DCACHE_OP_PRUNE; |
3421 | if (op->d_select_inode) |
3422 | dentry->d_flags |= DCACHE_OP_SELECT_INODE; |
3423 | + if (op->d_real) |
3424 | + dentry->d_flags |= DCACHE_OP_REAL; |
3425 | |
3426 | } |
3427 | EXPORT_SYMBOL(d_set_d_op); |
3428 | diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c |
3429 | index 38f7562489bb..ecb54394492a 100644 |
3430 | --- a/fs/ext4/crypto.c |
3431 | +++ b/fs/ext4/crypto.c |
3432 | @@ -475,13 +475,16 @@ uint32_t ext4_validate_encryption_key_size(uint32_t mode, uint32_t size) |
3433 | */ |
3434 | static int ext4_d_revalidate(struct dentry *dentry, unsigned int flags) |
3435 | { |
3436 | - struct inode *dir = d_inode(dentry->d_parent); |
3437 | - struct ext4_crypt_info *ci = EXT4_I(dir)->i_crypt_info; |
3438 | + struct dentry *dir; |
3439 | + struct ext4_crypt_info *ci; |
3440 | int dir_has_key, cached_with_key; |
3441 | |
3442 | - if (!ext4_encrypted_inode(dir)) |
3443 | + dir = dget_parent(dentry); |
3444 | + if (!ext4_encrypted_inode(d_inode(dir))) { |
3445 | + dput(dir); |
3446 | return 0; |
3447 | - |
3448 | + } |
3449 | + ci = EXT4_I(d_inode(dir))->i_crypt_info; |
3450 | if (ci && ci->ci_keyring_key && |
3451 | (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) | |
3452 | (1 << KEY_FLAG_REVOKED) | |
3453 | @@ -491,6 +494,7 @@ static int ext4_d_revalidate(struct dentry *dentry, unsigned int flags) |
3454 | /* this should eventually be an flag in d_flags */ |
3455 | cached_with_key = dentry->d_fsdata != NULL; |
3456 | dir_has_key = (ci != NULL); |
3457 | + dput(dir); |
3458 | |
3459 | /* |
3460 | * If the dentry was cached without the key, and it is a |
3461 | diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
3462 | index 157b458a69d4..b213449a5d1b 100644 |
3463 | --- a/fs/ext4/ext4.h |
3464 | +++ b/fs/ext4/ext4.h |
3465 | @@ -900,6 +900,29 @@ do { \ |
3466 | #include "extents_status.h" |
3467 | |
3468 | /* |
3469 | + * Lock subclasses for i_data_sem in the ext4_inode_info structure. |
3470 | + * |
3471 | + * These are needed to avoid lockdep false positives when we need to |
3472 | + * allocate blocks to the quota inode during ext4_map_blocks(), while |
3473 | + * holding i_data_sem for a normal (non-quota) inode. Since we don't |
3474 | + * do quota tracking for the quota inode, this avoids deadlock (as |
3475 | + * well as infinite recursion, since it isn't turtles all the way |
3476 | + * down...) |
3477 | + * |
3478 | + * I_DATA_SEM_NORMAL - Used for most inodes |
3479 | + * I_DATA_SEM_OTHER - Used by move_inode.c for the second normal inode |
3480 | + * where the second inode has larger inode number |
3481 | + * than the first |
3482 | + * I_DATA_SEM_QUOTA - Used for quota inodes only |
3483 | + */ |
3484 | +enum { |
3485 | + I_DATA_SEM_NORMAL = 0, |
3486 | + I_DATA_SEM_OTHER, |
3487 | + I_DATA_SEM_QUOTA, |
3488 | +}; |
3489 | + |
3490 | + |
3491 | +/* |
3492 | * fourth extended file system inode data in memory |
3493 | */ |
3494 | struct ext4_inode_info { |
3495 | diff --git a/fs/ext4/file.c b/fs/ext4/file.c |
3496 | index 4cd318f31cbe..38847f38b34a 100644 |
3497 | --- a/fs/ext4/file.c |
3498 | +++ b/fs/ext4/file.c |
3499 | @@ -335,7 +335,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp) |
3500 | struct super_block *sb = inode->i_sb; |
3501 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
3502 | struct vfsmount *mnt = filp->f_path.mnt; |
3503 | - struct inode *dir = filp->f_path.dentry->d_parent->d_inode; |
3504 | + struct dentry *dir; |
3505 | struct path path; |
3506 | char buf[64], *cp; |
3507 | int ret; |
3508 | @@ -379,14 +379,18 @@ static int ext4_file_open(struct inode * inode, struct file * filp) |
3509 | if (ext4_encryption_info(inode) == NULL) |
3510 | return -ENOKEY; |
3511 | } |
3512 | - if (ext4_encrypted_inode(dir) && |
3513 | - !ext4_is_child_context_consistent_with_parent(dir, inode)) { |
3514 | + |
3515 | + dir = dget_parent(file_dentry(filp)); |
3516 | + if (ext4_encrypted_inode(d_inode(dir)) && |
3517 | + !ext4_is_child_context_consistent_with_parent(d_inode(dir), inode)) { |
3518 | ext4_warning(inode->i_sb, |
3519 | "Inconsistent encryption contexts: %lu/%lu\n", |
3520 | - (unsigned long) dir->i_ino, |
3521 | + (unsigned long) d_inode(dir)->i_ino, |
3522 | (unsigned long) inode->i_ino); |
3523 | + dput(dir); |
3524 | return -EPERM; |
3525 | } |
3526 | + dput(dir); |
3527 | /* |
3528 | * Set up the jbd2_inode if we are opening the inode for |
3529 | * writing and the journal is present |
3530 | diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c |
3531 | index 4098acc701c3..796ff0eafd3c 100644 |
3532 | --- a/fs/ext4/move_extent.c |
3533 | +++ b/fs/ext4/move_extent.c |
3534 | @@ -60,10 +60,10 @@ ext4_double_down_write_data_sem(struct inode *first, struct inode *second) |
3535 | { |
3536 | if (first < second) { |
3537 | down_write(&EXT4_I(first)->i_data_sem); |
3538 | - down_write_nested(&EXT4_I(second)->i_data_sem, SINGLE_DEPTH_NESTING); |
3539 | + down_write_nested(&EXT4_I(second)->i_data_sem, I_DATA_SEM_OTHER); |
3540 | } else { |
3541 | down_write(&EXT4_I(second)->i_data_sem); |
3542 | - down_write_nested(&EXT4_I(first)->i_data_sem, SINGLE_DEPTH_NESTING); |
3543 | + down_write_nested(&EXT4_I(first)->i_data_sem, I_DATA_SEM_OTHER); |
3544 | |
3545 | } |
3546 | } |
3547 | @@ -484,6 +484,13 @@ mext_check_arguments(struct inode *orig_inode, |
3548 | return -EBUSY; |
3549 | } |
3550 | |
3551 | + if (IS_NOQUOTA(orig_inode) || IS_NOQUOTA(donor_inode)) { |
3552 | + ext4_debug("ext4 move extent: The argument files should " |
3553 | + "not be quota files [ino:orig %lu, donor %lu]\n", |
3554 | + orig_inode->i_ino, donor_inode->i_ino); |
3555 | + return -EBUSY; |
3556 | + } |
3557 | + |
3558 | /* Ext4 move extent supports only extent based file */ |
3559 | if (!(ext4_test_inode_flag(orig_inode, EXT4_INODE_EXTENTS))) { |
3560 | ext4_debug("ext4 move extent: orig file is not extents " |
3561 | diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
3562 | index 3ed01ec011d7..a76ca677fd1a 100644 |
3563 | --- a/fs/ext4/super.c |
3564 | +++ b/fs/ext4/super.c |
3565 | @@ -1324,9 +1324,9 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args) |
3566 | return -1; |
3567 | } |
3568 | if (ext4_has_feature_quota(sb)) { |
3569 | - ext4_msg(sb, KERN_ERR, "Cannot set journaled quota options " |
3570 | - "when QUOTA feature is enabled"); |
3571 | - return -1; |
3572 | + ext4_msg(sb, KERN_INFO, "Journaled quota options " |
3573 | + "ignored when QUOTA feature is enabled"); |
3574 | + return 1; |
3575 | } |
3576 | qname = match_strdup(args); |
3577 | if (!qname) { |
3578 | @@ -1689,10 +1689,10 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, |
3579 | return -1; |
3580 | } |
3581 | if (ext4_has_feature_quota(sb)) { |
3582 | - ext4_msg(sb, KERN_ERR, |
3583 | - "Cannot set journaled quota options " |
3584 | + ext4_msg(sb, KERN_INFO, |
3585 | + "Quota format mount options ignored " |
3586 | "when QUOTA feature is enabled"); |
3587 | - return -1; |
3588 | + return 1; |
3589 | } |
3590 | sbi->s_jquota_fmt = m->mount_opt; |
3591 | #endif |
3592 | @@ -1753,11 +1753,11 @@ static int parse_options(char *options, struct super_block *sb, |
3593 | #ifdef CONFIG_QUOTA |
3594 | if (ext4_has_feature_quota(sb) && |
3595 | (test_opt(sb, USRQUOTA) || test_opt(sb, GRPQUOTA))) { |
3596 | - ext4_msg(sb, KERN_ERR, "Cannot set quota options when QUOTA " |
3597 | - "feature is enabled"); |
3598 | - return 0; |
3599 | - } |
3600 | - if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { |
3601 | + ext4_msg(sb, KERN_INFO, "Quota feature enabled, usrquota and grpquota " |
3602 | + "mount options ignored."); |
3603 | + clear_opt(sb, USRQUOTA); |
3604 | + clear_opt(sb, GRPQUOTA); |
3605 | + } else if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { |
3606 | if (test_opt(sb, USRQUOTA) && sbi->s_qf_names[USRQUOTA]) |
3607 | clear_opt(sb, USRQUOTA); |
3608 | |
3609 | @@ -5021,6 +5021,20 @@ static int ext4_quota_on_mount(struct super_block *sb, int type) |
3610 | EXT4_SB(sb)->s_jquota_fmt, type); |
3611 | } |
3612 | |
3613 | +static void lockdep_set_quota_inode(struct inode *inode, int subclass) |
3614 | +{ |
3615 | + struct ext4_inode_info *ei = EXT4_I(inode); |
3616 | + |
3617 | + /* The first argument of lockdep_set_subclass has to be |
3618 | + * *exactly* the same as the argument to init_rwsem() --- in |
3619 | + * this case, in init_once() --- or lockdep gets unhappy |
3620 | + * because the name of the lock is set using the |
3621 | + * stringification of the argument to init_rwsem(). |
3622 | + */ |
3623 | + (void) ei; /* shut up clang warning if !CONFIG_LOCKDEP */ |
3624 | + lockdep_set_subclass(&ei->i_data_sem, subclass); |
3625 | +} |
3626 | + |
3627 | /* |
3628 | * Standard function to be called on quota_on |
3629 | */ |
3630 | @@ -5060,8 +5074,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
3631 | if (err) |
3632 | return err; |
3633 | } |
3634 | - |
3635 | - return dquot_quota_on(sb, type, format_id, path); |
3636 | + lockdep_set_quota_inode(path->dentry->d_inode, I_DATA_SEM_QUOTA); |
3637 | + err = dquot_quota_on(sb, type, format_id, path); |
3638 | + if (err) |
3639 | + lockdep_set_quota_inode(path->dentry->d_inode, |
3640 | + I_DATA_SEM_NORMAL); |
3641 | + return err; |
3642 | } |
3643 | |
3644 | static int ext4_quota_enable(struct super_block *sb, int type, int format_id, |
3645 | @@ -5088,8 +5106,11 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id, |
3646 | |
3647 | /* Don't account quota for quota files to avoid recursion */ |
3648 | qf_inode->i_flags |= S_NOQUOTA; |
3649 | + lockdep_set_quota_inode(qf_inode, I_DATA_SEM_QUOTA); |
3650 | err = dquot_enable(qf_inode, type, format_id, flags); |
3651 | iput(qf_inode); |
3652 | + if (err) |
3653 | + lockdep_set_quota_inode(qf_inode, I_DATA_SEM_NORMAL); |
3654 | |
3655 | return err; |
3656 | } |
3657 | diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c |
3658 | index 9cce67043f92..7ded17764754 100644 |
3659 | --- a/fs/nfs/dir.c |
3660 | +++ b/fs/nfs/dir.c |
3661 | @@ -377,7 +377,7 @@ int nfs_readdir_xdr_filler(struct page **pages, nfs_readdir_descriptor_t *desc, |
3662 | again: |
3663 | timestamp = jiffies; |
3664 | gencount = nfs_inc_attr_generation_counter(); |
3665 | - error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, entry->cookie, pages, |
3666 | + error = NFS_PROTO(inode)->readdir(file_dentry(file), cred, entry->cookie, pages, |
3667 | NFS_SERVER(inode)->dtsize, desc->plus); |
3668 | if (error < 0) { |
3669 | /* We requested READDIRPLUS, but the server doesn't grok it */ |
3670 | @@ -560,7 +560,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en |
3671 | count++; |
3672 | |
3673 | if (desc->plus != 0) |
3674 | - nfs_prime_dcache(desc->file->f_path.dentry, entry); |
3675 | + nfs_prime_dcache(file_dentry(desc->file), entry); |
3676 | |
3677 | status = nfs_readdir_add_to_array(entry, page); |
3678 | if (status != 0) |
3679 | @@ -864,7 +864,7 @@ static bool nfs_dir_mapping_need_revalidate(struct inode *dir) |
3680 | */ |
3681 | static int nfs_readdir(struct file *file, struct dir_context *ctx) |
3682 | { |
3683 | - struct dentry *dentry = file->f_path.dentry; |
3684 | + struct dentry *dentry = file_dentry(file); |
3685 | struct inode *inode = d_inode(dentry); |
3686 | nfs_readdir_descriptor_t my_desc, |
3687 | *desc = &my_desc; |
3688 | diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c |
3689 | index 86faecf8f328..847b678af4f0 100644 |
3690 | --- a/fs/nfs/inode.c |
3691 | +++ b/fs/nfs/inode.c |
3692 | @@ -940,7 +940,7 @@ int nfs_open(struct inode *inode, struct file *filp) |
3693 | { |
3694 | struct nfs_open_context *ctx; |
3695 | |
3696 | - ctx = alloc_nfs_open_context(filp->f_path.dentry, filp->f_mode); |
3697 | + ctx = alloc_nfs_open_context(file_dentry(filp), filp->f_mode); |
3698 | if (IS_ERR(ctx)) |
3699 | return PTR_ERR(ctx); |
3700 | nfs_file_set_open_context(filp, ctx); |
3701 | diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c |
3702 | index 57ca1c8039c1..2a9ff14cfb3b 100644 |
3703 | --- a/fs/nfs/nfs4file.c |
3704 | +++ b/fs/nfs/nfs4file.c |
3705 | @@ -26,7 +26,7 @@ static int |
3706 | nfs4_file_open(struct inode *inode, struct file *filp) |
3707 | { |
3708 | struct nfs_open_context *ctx; |
3709 | - struct dentry *dentry = filp->f_path.dentry; |
3710 | + struct dentry *dentry = file_dentry(filp); |
3711 | struct dentry *parent = NULL; |
3712 | struct inode *dir; |
3713 | unsigned openflags = filp->f_flags; |
3714 | @@ -57,7 +57,7 @@ nfs4_file_open(struct inode *inode, struct file *filp) |
3715 | parent = dget_parent(dentry); |
3716 | dir = d_inode(parent); |
3717 | |
3718 | - ctx = alloc_nfs_open_context(filp->f_path.dentry, filp->f_mode); |
3719 | + ctx = alloc_nfs_open_context(file_dentry(filp), filp->f_mode); |
3720 | err = PTR_ERR(ctx); |
3721 | if (IS_ERR(ctx)) |
3722 | goto out; |
3723 | diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c |
3724 | index 619ad4b016d2..4399ea804447 100644 |
3725 | --- a/fs/overlayfs/super.c |
3726 | +++ b/fs/overlayfs/super.c |
3727 | @@ -295,6 +295,37 @@ static void ovl_dentry_release(struct dentry *dentry) |
3728 | } |
3729 | } |
3730 | |
3731 | +static struct dentry *ovl_d_real(struct dentry *dentry, struct inode *inode) |
3732 | +{ |
3733 | + struct dentry *real; |
3734 | + |
3735 | + if (d_is_dir(dentry)) { |
3736 | + if (!inode || inode == d_inode(dentry)) |
3737 | + return dentry; |
3738 | + goto bug; |
3739 | + } |
3740 | + |
3741 | + real = ovl_dentry_upper(dentry); |
3742 | + if (real && (!inode || inode == d_inode(real))) |
3743 | + return real; |
3744 | + |
3745 | + real = ovl_dentry_lower(dentry); |
3746 | + if (!real) |
3747 | + goto bug; |
3748 | + |
3749 | + if (!inode || inode == d_inode(real)) |
3750 | + return real; |
3751 | + |
3752 | + /* Handle recursion */ |
3753 | + if (real->d_flags & DCACHE_OP_REAL) |
3754 | + return real->d_op->d_real(real, inode); |
3755 | + |
3756 | +bug: |
3757 | + WARN(1, "ovl_d_real(%pd4, %s:%lu\n): real dentry not found\n", dentry, |
3758 | + inode ? inode->i_sb->s_id : "NULL", inode ? inode->i_ino : 0); |
3759 | + return dentry; |
3760 | +} |
3761 | + |
3762 | static int ovl_dentry_revalidate(struct dentry *dentry, unsigned int flags) |
3763 | { |
3764 | struct ovl_entry *oe = dentry->d_fsdata; |
3765 | @@ -339,11 +370,13 @@ static int ovl_dentry_weak_revalidate(struct dentry *dentry, unsigned int flags) |
3766 | static const struct dentry_operations ovl_dentry_operations = { |
3767 | .d_release = ovl_dentry_release, |
3768 | .d_select_inode = ovl_d_select_inode, |
3769 | + .d_real = ovl_d_real, |
3770 | }; |
3771 | |
3772 | static const struct dentry_operations ovl_reval_dentry_operations = { |
3773 | .d_release = ovl_dentry_release, |
3774 | .d_select_inode = ovl_d_select_inode, |
3775 | + .d_real = ovl_d_real, |
3776 | .d_revalidate = ovl_dentry_revalidate, |
3777 | .d_weak_revalidate = ovl_dentry_weak_revalidate, |
3778 | }; |
3779 | diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h |
3780 | index 22ab246feed3..eeae401a2412 100644 |
3781 | --- a/include/linux/compiler-gcc.h |
3782 | +++ b/include/linux/compiler-gcc.h |
3783 | @@ -199,7 +199,7 @@ |
3784 | #define unreachable() __builtin_unreachable() |
3785 | |
3786 | /* Mark a function definition as prohibited from being cloned. */ |
3787 | -#define __noclone __attribute__((__noclone__)) |
3788 | +#define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) |
3789 | |
3790 | #endif /* GCC_VERSION >= 40500 */ |
3791 | |
3792 | diff --git a/include/linux/dcache.h b/include/linux/dcache.h |
3793 | index c4b5f4b3f8f8..03dda7ba73ac 100644 |
3794 | --- a/include/linux/dcache.h |
3795 | +++ b/include/linux/dcache.h |
3796 | @@ -161,6 +161,7 @@ struct dentry_operations { |
3797 | struct vfsmount *(*d_automount)(struct path *); |
3798 | int (*d_manage)(struct dentry *, bool); |
3799 | struct inode *(*d_select_inode)(struct dentry *, unsigned); |
3800 | + struct dentry *(*d_real)(struct dentry *, struct inode *); |
3801 | } ____cacheline_aligned; |
3802 | |
3803 | /* |
3804 | @@ -227,6 +228,7 @@ struct dentry_operations { |
3805 | #define DCACHE_MAY_FREE 0x00800000 |
3806 | #define DCACHE_FALLTHRU 0x01000000 /* Fall through to lower layer */ |
3807 | #define DCACHE_OP_SELECT_INODE 0x02000000 /* Unioned entry: dcache op selects inode */ |
3808 | +#define DCACHE_OP_REAL 0x08000000 |
3809 | |
3810 | extern seqlock_t rename_lock; |
3811 | |
3812 | @@ -582,4 +584,12 @@ static inline struct dentry *d_backing_dentry(struct dentry *upper) |
3813 | return upper; |
3814 | } |
3815 | |
3816 | +static inline struct dentry *d_real(struct dentry *dentry) |
3817 | +{ |
3818 | + if (unlikely(dentry->d_flags & DCACHE_OP_REAL)) |
3819 | + return dentry->d_op->d_real(dentry, NULL); |
3820 | + else |
3821 | + return dentry; |
3822 | +} |
3823 | + |
3824 | #endif /* __LINUX_DCACHE_H */ |
3825 | diff --git a/include/linux/filter.h b/include/linux/filter.h |
3826 | index 43aa1f8855c7..a51a5361695f 100644 |
3827 | --- a/include/linux/filter.h |
3828 | +++ b/include/linux/filter.h |
3829 | @@ -465,10 +465,14 @@ int bpf_prog_create_from_user(struct bpf_prog **pfp, struct sock_fprog *fprog, |
3830 | void bpf_prog_destroy(struct bpf_prog *fp); |
3831 | |
3832 | int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); |
3833 | +int __sk_attach_filter(struct sock_fprog *fprog, struct sock *sk, |
3834 | + bool locked); |
3835 | int sk_attach_bpf(u32 ufd, struct sock *sk); |
3836 | int sk_reuseport_attach_filter(struct sock_fprog *fprog, struct sock *sk); |
3837 | int sk_reuseport_attach_bpf(u32 ufd, struct sock *sk); |
3838 | int sk_detach_filter(struct sock *sk); |
3839 | +int __sk_detach_filter(struct sock *sk, bool locked); |
3840 | + |
3841 | int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, |
3842 | unsigned int len); |
3843 | |
3844 | diff --git a/include/linux/fs.h b/include/linux/fs.h |
3845 | index 2c7f8d9c3c70..83c77b093ce2 100644 |
3846 | --- a/include/linux/fs.h |
3847 | +++ b/include/linux/fs.h |
3848 | @@ -1234,6 +1234,16 @@ static inline struct inode *file_inode(const struct file *f) |
3849 | return f->f_inode; |
3850 | } |
3851 | |
3852 | +static inline struct dentry *file_dentry(const struct file *file) |
3853 | +{ |
3854 | + struct dentry *dentry = file->f_path.dentry; |
3855 | + |
3856 | + if (unlikely(dentry->d_flags & DCACHE_OP_REAL)) |
3857 | + return dentry->d_op->d_real(dentry, file_inode(file)); |
3858 | + else |
3859 | + return dentry; |
3860 | +} |
3861 | + |
3862 | static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl) |
3863 | { |
3864 | return locks_lock_inode_wait(file_inode(filp), fl); |
3865 | diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h |
3866 | index a338a688ee4a..dcb89e3515db 100644 |
3867 | --- a/include/linux/if_bridge.h |
3868 | +++ b/include/linux/if_bridge.h |
3869 | @@ -46,10 +46,6 @@ struct br_ip_list { |
3870 | #define BR_LEARNING_SYNC BIT(9) |
3871 | #define BR_PROXYARP_WIFI BIT(10) |
3872 | |
3873 | -/* values as per ieee8021QBridgeFdbAgingTime */ |
3874 | -#define BR_MIN_AGEING_TIME (10 * HZ) |
3875 | -#define BR_MAX_AGEING_TIME (1000000 * HZ) |
3876 | - |
3877 | #define BR_DEFAULT_AGEING_TIME (300 * HZ) |
3878 | |
3879 | extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); |
3880 | diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h |
3881 | index 5440b7b705eb..6d1d8f4f759b 100644 |
3882 | --- a/include/linux/netdevice.h |
3883 | +++ b/include/linux/netdevice.h |
3884 | @@ -267,6 +267,7 @@ struct header_ops { |
3885 | void (*cache_update)(struct hh_cache *hh, |
3886 | const struct net_device *dev, |
3887 | const unsigned char *haddr); |
3888 | + bool (*validate)(const char *ll_header, unsigned int len); |
3889 | }; |
3890 | |
3891 | /* These flag bits are private to the generic network queueing |
3892 | @@ -1420,8 +1421,7 @@ enum netdev_priv_flags { |
3893 | * @dma: DMA channel |
3894 | * @mtu: Interface MTU value |
3895 | * @type: Interface hardware type |
3896 | - * @hard_header_len: Hardware header length, which means that this is the |
3897 | - * minimum size of a packet. |
3898 | + * @hard_header_len: Maximum hardware header length. |
3899 | * |
3900 | * @needed_headroom: Extra headroom the hardware may need, but not in all |
3901 | * cases can this be guaranteed |
3902 | @@ -2627,6 +2627,24 @@ static inline int dev_parse_header(const struct sk_buff *skb, |
3903 | return dev->header_ops->parse(skb, haddr); |
3904 | } |
3905 | |
3906 | +/* ll_header must have at least hard_header_len allocated */ |
3907 | +static inline bool dev_validate_header(const struct net_device *dev, |
3908 | + char *ll_header, int len) |
3909 | +{ |
3910 | + if (likely(len >= dev->hard_header_len)) |
3911 | + return true; |
3912 | + |
3913 | + if (capable(CAP_SYS_RAWIO)) { |
3914 | + memset(ll_header + len, 0, dev->hard_header_len - len); |
3915 | + return true; |
3916 | + } |
3917 | + |
3918 | + if (dev->header_ops && dev->header_ops->validate) |
3919 | + return dev->header_ops->validate(ll_header, len); |
3920 | + |
3921 | + return false; |
3922 | +} |
3923 | + |
3924 | typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); |
3925 | int register_gifconf(unsigned int family, gifconf_func_t *gifconf); |
3926 | static inline int unregister_gifconf(unsigned int family) |
3927 | diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h |
3928 | index 7f5f78bd15ad..245f57dbbb61 100644 |
3929 | --- a/include/linux/usb_usual.h |
3930 | +++ b/include/linux/usb_usual.h |
3931 | @@ -79,6 +79,8 @@ |
3932 | /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \ |
3933 | US_FLAG(MAX_SECTORS_240, 0x08000000) \ |
3934 | /* Sets max_sectors to 240 */ \ |
3935 | + US_FLAG(NO_REPORT_LUNS, 0x10000000) \ |
3936 | + /* Cannot handle REPORT_LUNS */ \ |
3937 | |
3938 | #define US_FLAG(name, value) US_FL_##name = value , |
3939 | enum { US_DO_ALL_FLAGS }; |
3940 | diff --git a/include/net/bonding.h b/include/net/bonding.h |
3941 | index ee6c52053aa3..791800ddd6d9 100644 |
3942 | --- a/include/net/bonding.h |
3943 | +++ b/include/net/bonding.h |
3944 | @@ -215,6 +215,7 @@ struct bonding { |
3945 | * ALB mode (6) - to sync the use and modifications of its hash table |
3946 | */ |
3947 | spinlock_t mode_lock; |
3948 | + spinlock_t stats_lock; |
3949 | u8 send_peer_notif; |
3950 | u8 igmp_retrans; |
3951 | #ifdef CONFIG_PROC_FS |
3952 | diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h |
3953 | index f63a16760ae9..ba93c0f69870 100644 |
3954 | --- a/include/scsi/scsi_device.h |
3955 | +++ b/include/scsi/scsi_device.h |
3956 | @@ -513,6 +513,31 @@ static inline int scsi_device_tpgs(struct scsi_device *sdev) |
3957 | return sdev->inquiry ? (sdev->inquiry[5] >> 4) & 0x3 : 0; |
3958 | } |
3959 | |
3960 | +/** |
3961 | + * scsi_device_supports_vpd - test if a device supports VPD pages |
3962 | + * @sdev: the &struct scsi_device to test |
3963 | + * |
3964 | + * If the 'try_vpd_pages' flag is set it takes precedence. |
3965 | + * Otherwise we will assume VPD pages are supported if the |
3966 | + * SCSI level is at least SPC-3 and 'skip_vpd_pages' is not set. |
3967 | + */ |
3968 | +static inline int scsi_device_supports_vpd(struct scsi_device *sdev) |
3969 | +{ |
3970 | + /* Attempt VPD inquiry if the device blacklist explicitly calls |
3971 | + * for it. |
3972 | + */ |
3973 | + if (sdev->try_vpd_pages) |
3974 | + return 1; |
3975 | + /* |
3976 | + * Although VPD inquiries can go to SCSI-2 type devices, |
3977 | + * some USB ones crash on receiving them, and the pages |
3978 | + * we currently ask for are for SPC-3 and beyond |
3979 | + */ |
3980 | + if (sdev->scsi_level > SCSI_SPC_2 && !sdev->skip_vpd_pages) |
3981 | + return 1; |
3982 | + return 0; |
3983 | +} |
3984 | + |
3985 | #define MODULE_ALIAS_SCSI_DEVICE(type) \ |
3986 | MODULE_ALIAS("scsi:t-" __stringify(type) "*") |
3987 | #define SCSI_DEVICE_MODALIAS_FMT "scsi:t-0x%02x" |
3988 | diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c |
3989 | index 4504ca66118d..50da680c479f 100644 |
3990 | --- a/kernel/bpf/helpers.c |
3991 | +++ b/kernel/bpf/helpers.c |
3992 | @@ -166,7 +166,7 @@ static u64 bpf_get_current_comm(u64 r1, u64 size, u64 r3, u64 r4, u64 r5) |
3993 | if (!task) |
3994 | return -EINVAL; |
3995 | |
3996 | - memcpy(buf, task->comm, min_t(size_t, size, sizeof(task->comm))); |
3997 | + strlcpy(buf, task->comm, min_t(size_t, size, sizeof(task->comm))); |
3998 | return 0; |
3999 | } |
4000 | |
4001 | diff --git a/mm/page_isolation.c b/mm/page_isolation.c |
4002 | index 92c4c36501e7..31555b689eb9 100644 |
4003 | --- a/mm/page_isolation.c |
4004 | +++ b/mm/page_isolation.c |
4005 | @@ -289,11 +289,11 @@ struct page *alloc_migrate_target(struct page *page, unsigned long private, |
4006 | * now as a simple work-around, we use the next node for destination. |
4007 | */ |
4008 | if (PageHuge(page)) { |
4009 | - nodemask_t src = nodemask_of_node(page_to_nid(page)); |
4010 | - nodemask_t dst; |
4011 | - nodes_complement(dst, src); |
4012 | + int node = next_online_node(page_to_nid(page)); |
4013 | + if (node == MAX_NUMNODES) |
4014 | + node = first_online_node; |
4015 | return alloc_huge_page_node(page_hstate(compound_head(page)), |
4016 | - next_node(page_to_nid(page), dst)); |
4017 | + node); |
4018 | } |
4019 | |
4020 | if (PageHighMem(page)) |
4021 | diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c |
4022 | index b563a3f5f2a8..2fa3be965101 100644 |
4023 | --- a/net/ax25/ax25_ip.c |
4024 | +++ b/net/ax25/ax25_ip.c |
4025 | @@ -228,8 +228,23 @@ netdev_tx_t ax25_ip_xmit(struct sk_buff *skb) |
4026 | } |
4027 | #endif |
4028 | |
4029 | +static bool ax25_validate_header(const char *header, unsigned int len) |
4030 | +{ |
4031 | + ax25_digi digi; |
4032 | + |
4033 | + if (!len) |
4034 | + return false; |
4035 | + |
4036 | + if (header[0]) |
4037 | + return true; |
4038 | + |
4039 | + return ax25_addr_parse(header + 1, len - 1, NULL, NULL, &digi, NULL, |
4040 | + NULL); |
4041 | +} |
4042 | + |
4043 | const struct header_ops ax25_header_ops = { |
4044 | .create = ax25_hard_header, |
4045 | + .validate = ax25_validate_header, |
4046 | }; |
4047 | |
4048 | EXPORT_SYMBOL(ax25_header_ops); |
4049 | diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c |
4050 | index b3cca126b103..e2670c5baafd 100644 |
4051 | --- a/net/bridge/br_stp.c |
4052 | +++ b/net/bridge/br_stp.c |
4053 | @@ -568,6 +568,14 @@ int br_set_max_age(struct net_bridge *br, unsigned long val) |
4054 | |
4055 | } |
4056 | |
4057 | +/* Set time interval that dynamic forwarding entries live |
4058 | + * For pure software bridge, allow values outside the 802.1 |
4059 | + * standard specification for special cases: |
4060 | + * 0 - entry never ages (all permanant) |
4061 | + * 1 - entry disappears (no persistance) |
4062 | + * |
4063 | + * Offloaded switch entries maybe more restrictive |
4064 | + */ |
4065 | int br_set_ageing_time(struct net_bridge *br, u32 ageing_time) |
4066 | { |
4067 | struct switchdev_attr attr = { |
4068 | @@ -579,11 +587,8 @@ int br_set_ageing_time(struct net_bridge *br, u32 ageing_time) |
4069 | unsigned long t = clock_t_to_jiffies(ageing_time); |
4070 | int err; |
4071 | |
4072 | - if (t < BR_MIN_AGEING_TIME || t > BR_MAX_AGEING_TIME) |
4073 | - return -ERANGE; |
4074 | - |
4075 | err = switchdev_port_attr_set(br->dev, &attr); |
4076 | - if (err) |
4077 | + if (err && err != -EOPNOTSUPP) |
4078 | return err; |
4079 | |
4080 | br->ageing_time = t; |
4081 | diff --git a/net/core/filter.c b/net/core/filter.c |
4082 | index bba502f7cd57..fb2951c3532d 100644 |
4083 | --- a/net/core/filter.c |
4084 | +++ b/net/core/filter.c |
4085 | @@ -1147,7 +1147,8 @@ void bpf_prog_destroy(struct bpf_prog *fp) |
4086 | } |
4087 | EXPORT_SYMBOL_GPL(bpf_prog_destroy); |
4088 | |
4089 | -static int __sk_attach_prog(struct bpf_prog *prog, struct sock *sk) |
4090 | +static int __sk_attach_prog(struct bpf_prog *prog, struct sock *sk, |
4091 | + bool locked) |
4092 | { |
4093 | struct sk_filter *fp, *old_fp; |
4094 | |
4095 | @@ -1163,10 +1164,8 @@ static int __sk_attach_prog(struct bpf_prog *prog, struct sock *sk) |
4096 | return -ENOMEM; |
4097 | } |
4098 | |
4099 | - old_fp = rcu_dereference_protected(sk->sk_filter, |
4100 | - sock_owned_by_user(sk)); |
4101 | + old_fp = rcu_dereference_protected(sk->sk_filter, locked); |
4102 | rcu_assign_pointer(sk->sk_filter, fp); |
4103 | - |
4104 | if (old_fp) |
4105 | sk_filter_uncharge(sk, old_fp); |
4106 | |
4107 | @@ -1245,7 +1244,8 @@ struct bpf_prog *__get_filter(struct sock_fprog *fprog, struct sock *sk) |
4108 | * occurs or there is insufficient memory for the filter a negative |
4109 | * errno code is returned. On success the return is zero. |
4110 | */ |
4111 | -int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) |
4112 | +int __sk_attach_filter(struct sock_fprog *fprog, struct sock *sk, |
4113 | + bool locked) |
4114 | { |
4115 | struct bpf_prog *prog = __get_filter(fprog, sk); |
4116 | int err; |
4117 | @@ -1253,7 +1253,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) |
4118 | if (IS_ERR(prog)) |
4119 | return PTR_ERR(prog); |
4120 | |
4121 | - err = __sk_attach_prog(prog, sk); |
4122 | + err = __sk_attach_prog(prog, sk, locked); |
4123 | if (err < 0) { |
4124 | __bpf_prog_release(prog); |
4125 | return err; |
4126 | @@ -1261,7 +1261,12 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) |
4127 | |
4128 | return 0; |
4129 | } |
4130 | -EXPORT_SYMBOL_GPL(sk_attach_filter); |
4131 | +EXPORT_SYMBOL_GPL(__sk_attach_filter); |
4132 | + |
4133 | +int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) |
4134 | +{ |
4135 | + return __sk_attach_filter(fprog, sk, sock_owned_by_user(sk)); |
4136 | +} |
4137 | |
4138 | int sk_reuseport_attach_filter(struct sock_fprog *fprog, struct sock *sk) |
4139 | { |
4140 | @@ -1307,7 +1312,7 @@ int sk_attach_bpf(u32 ufd, struct sock *sk) |
4141 | if (IS_ERR(prog)) |
4142 | return PTR_ERR(prog); |
4143 | |
4144 | - err = __sk_attach_prog(prog, sk); |
4145 | + err = __sk_attach_prog(prog, sk, sock_owned_by_user(sk)); |
4146 | if (err < 0) { |
4147 | bpf_prog_put(prog); |
4148 | return err; |
4149 | @@ -2105,7 +2110,7 @@ static int __init register_sk_filter_ops(void) |
4150 | } |
4151 | late_initcall(register_sk_filter_ops); |
4152 | |
4153 | -int sk_detach_filter(struct sock *sk) |
4154 | +int __sk_detach_filter(struct sock *sk, bool locked) |
4155 | { |
4156 | int ret = -ENOENT; |
4157 | struct sk_filter *filter; |
4158 | @@ -2113,8 +2118,7 @@ int sk_detach_filter(struct sock *sk) |
4159 | if (sock_flag(sk, SOCK_FILTER_LOCKED)) |
4160 | return -EPERM; |
4161 | |
4162 | - filter = rcu_dereference_protected(sk->sk_filter, |
4163 | - sock_owned_by_user(sk)); |
4164 | + filter = rcu_dereference_protected(sk->sk_filter, locked); |
4165 | if (filter) { |
4166 | RCU_INIT_POINTER(sk->sk_filter, NULL); |
4167 | sk_filter_uncharge(sk, filter); |
4168 | @@ -2123,7 +2127,12 @@ int sk_detach_filter(struct sock *sk) |
4169 | |
4170 | return ret; |
4171 | } |
4172 | -EXPORT_SYMBOL_GPL(sk_detach_filter); |
4173 | +EXPORT_SYMBOL_GPL(__sk_detach_filter); |
4174 | + |
4175 | +int sk_detach_filter(struct sock *sk) |
4176 | +{ |
4177 | + return __sk_detach_filter(sk, sock_owned_by_user(sk)); |
4178 | +} |
4179 | |
4180 | int sk_get_filter(struct sock *sk, struct sock_filter __user *ubuf, |
4181 | unsigned int len) |
4182 | diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
4183 | index 8261d95dd846..215e6137f6ff 100644 |
4184 | --- a/net/core/rtnetlink.c |
4185 | +++ b/net/core/rtnetlink.c |
4186 | @@ -905,6 +905,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev, |
4187 | + rtnl_link_get_af_size(dev, ext_filter_mask) /* IFLA_AF_SPEC */ |
4188 | + nla_total_size(MAX_PHYS_ITEM_ID_LEN) /* IFLA_PHYS_PORT_ID */ |
4189 | + nla_total_size(MAX_PHYS_ITEM_ID_LEN) /* IFLA_PHYS_SWITCH_ID */ |
4190 | + + nla_total_size(IFNAMSIZ) /* IFLA_PHYS_PORT_NAME */ |
4191 | + nla_total_size(1); /* IFLA_PROTO_DOWN */ |
4192 | |
4193 | } |
4194 | diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c |
4195 | index 902d606324a0..8be8f27bfacc 100644 |
4196 | --- a/net/dccp/ipv4.c |
4197 | +++ b/net/dccp/ipv4.c |
4198 | @@ -204,8 +204,6 @@ void dccp_req_err(struct sock *sk, u64 seq) |
4199 | * ICMPs are not backlogged, hence we cannot get an established |
4200 | * socket here. |
4201 | */ |
4202 | - WARN_ON(req->sk); |
4203 | - |
4204 | if (!between48(seq, dccp_rsk(req)->dreq_iss, dccp_rsk(req)->dreq_gss)) { |
4205 | NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS); |
4206 | } else { |
4207 | diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c |
4208 | index fa4daba8db55..d8fb47fcad05 100644 |
4209 | --- a/net/dsa/dsa.c |
4210 | +++ b/net/dsa/dsa.c |
4211 | @@ -935,6 +935,14 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst) |
4212 | { |
4213 | int i; |
4214 | |
4215 | + dst->master_netdev->dsa_ptr = NULL; |
4216 | + |
4217 | + /* If we used a tagging format that doesn't have an ethertype |
4218 | + * field, make sure that all packets from this point get sent |
4219 | + * without the tag and go through the regular receive path. |
4220 | + */ |
4221 | + wmb(); |
4222 | + |
4223 | for (i = 0; i < dst->pd->nr_chips; i++) { |
4224 | struct dsa_switch *ds = dst->ds[i]; |
4225 | |
4226 | @@ -988,14 +996,6 @@ static int dsa_suspend(struct device *d) |
4227 | struct dsa_switch_tree *dst = platform_get_drvdata(pdev); |
4228 | int i, ret = 0; |
4229 | |
4230 | - dst->master_netdev->dsa_ptr = NULL; |
4231 | - |
4232 | - /* If we used a tagging format that doesn't have an ethertype |
4233 | - * field, make sure that all packets from this point get sent |
4234 | - * without the tag and go through the regular receive path. |
4235 | - */ |
4236 | - wmb(); |
4237 | - |
4238 | for (i = 0; i < dst->pd->nr_chips; i++) { |
4239 | struct dsa_switch *ds = dst->ds[i]; |
4240 | |
4241 | diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c |
4242 | index f6303b17546b..0212591b0077 100644 |
4243 | --- a/net/ipv4/devinet.c |
4244 | +++ b/net/ipv4/devinet.c |
4245 | @@ -334,6 +334,9 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, |
4246 | |
4247 | ASSERT_RTNL(); |
4248 | |
4249 | + if (in_dev->dead) |
4250 | + goto no_promotions; |
4251 | + |
4252 | /* 1. Deleting primary ifaddr forces deletion all secondaries |
4253 | * unless alias promotion is set |
4254 | **/ |
4255 | @@ -380,6 +383,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, |
4256 | fib_del_ifaddr(ifa, ifa1); |
4257 | } |
4258 | |
4259 | +no_promotions: |
4260 | /* 2. Unlink it */ |
4261 | |
4262 | *ifap = ifa1->ifa_next; |
4263 | diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c |
4264 | index 473447593060..8a9246deccfe 100644 |
4265 | --- a/net/ipv4/fib_frontend.c |
4266 | +++ b/net/ipv4/fib_frontend.c |
4267 | @@ -280,7 +280,6 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb) |
4268 | struct in_device *in_dev; |
4269 | struct fib_result res; |
4270 | struct rtable *rt; |
4271 | - struct flowi4 fl4; |
4272 | struct net *net; |
4273 | int scope; |
4274 | |
4275 | @@ -296,14 +295,13 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb) |
4276 | |
4277 | scope = RT_SCOPE_UNIVERSE; |
4278 | if (!ipv4_is_zeronet(ip_hdr(skb)->saddr)) { |
4279 | - fl4.flowi4_oif = 0; |
4280 | - fl4.flowi4_iif = LOOPBACK_IFINDEX; |
4281 | - fl4.daddr = ip_hdr(skb)->saddr; |
4282 | - fl4.saddr = 0; |
4283 | - fl4.flowi4_tos = RT_TOS(ip_hdr(skb)->tos); |
4284 | - fl4.flowi4_scope = scope; |
4285 | - fl4.flowi4_mark = IN_DEV_SRC_VMARK(in_dev) ? skb->mark : 0; |
4286 | - fl4.flowi4_tun_key.tun_id = 0; |
4287 | + struct flowi4 fl4 = { |
4288 | + .flowi4_iif = LOOPBACK_IFINDEX, |
4289 | + .daddr = ip_hdr(skb)->saddr, |
4290 | + .flowi4_tos = RT_TOS(ip_hdr(skb)->tos), |
4291 | + .flowi4_scope = scope, |
4292 | + .flowi4_mark = IN_DEV_SRC_VMARK(in_dev) ? skb->mark : 0, |
4293 | + }; |
4294 | if (!fib_lookup(net, &fl4, &res, 0)) |
4295 | return FIB_RES_PREFSRC(net, res); |
4296 | } else { |
4297 | @@ -922,6 +920,9 @@ void fib_del_ifaddr(struct in_ifaddr *ifa, struct in_ifaddr *iprim) |
4298 | subnet = 1; |
4299 | } |
4300 | |
4301 | + if (in_dev->dead) |
4302 | + goto no_promotions; |
4303 | + |
4304 | /* Deletion is more complicated than add. |
4305 | * We should take care of not to delete too much :-) |
4306 | * |
4307 | @@ -997,6 +998,7 @@ void fib_del_ifaddr(struct in_ifaddr *ifa, struct in_ifaddr *iprim) |
4308 | } |
4309 | } |
4310 | |
4311 | +no_promotions: |
4312 | if (!(ok & BRD_OK)) |
4313 | fib_magic(RTM_DELROUTE, RTN_BROADCAST, ifa->ifa_broadcast, 32, prim); |
4314 | if (subnet && ifa->ifa_prefixlen < 31) { |
4315 | diff --git a/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c |
4316 | index c6eb42100e9a..ea91058b5f6f 100644 |
4317 | --- a/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c |
4318 | +++ b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c |
4319 | @@ -108,10 +108,18 @@ static int masq_inet_event(struct notifier_block *this, |
4320 | unsigned long event, |
4321 | void *ptr) |
4322 | { |
4323 | - struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev; |
4324 | + struct in_device *idev = ((struct in_ifaddr *)ptr)->ifa_dev; |
4325 | struct netdev_notifier_info info; |
4326 | |
4327 | - netdev_notifier_info_init(&info, dev); |
4328 | + /* The masq_dev_notifier will catch the case of the device going |
4329 | + * down. So if the inetdev is dead and being destroyed we have |
4330 | + * no work to do. Otherwise this is an individual address removal |
4331 | + * and we have to perform the flush. |
4332 | + */ |
4333 | + if (idev->dead) |
4334 | + return NOTIFY_DONE; |
4335 | + |
4336 | + netdev_notifier_info_init(&info, idev->dev); |
4337 | return masq_device_event(this, event, &info); |
4338 | } |
4339 | |
4340 | diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c |
4341 | index 487ac67059e2..a7b1a905580b 100644 |
4342 | --- a/net/ipv4/tcp_ipv4.c |
4343 | +++ b/net/ipv4/tcp_ipv4.c |
4344 | @@ -319,8 +319,6 @@ void tcp_req_err(struct sock *sk, u32 seq, bool abort) |
4345 | /* ICMPs are not backlogged, hence we cannot get |
4346 | * an established socket here. |
4347 | */ |
4348 | - WARN_ON(req->sk); |
4349 | - |
4350 | if (seq != tcp_rsk(req)->snt_isn) { |
4351 | NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS); |
4352 | } else if (abort) { |
4353 | diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c |
4354 | index 95d2f198017e..eb8933bc0e6e 100644 |
4355 | --- a/net/ipv4/udp.c |
4356 | +++ b/net/ipv4/udp.c |
4357 | @@ -2082,10 +2082,14 @@ void udp_v4_early_demux(struct sk_buff *skb) |
4358 | if (!in_dev) |
4359 | return; |
4360 | |
4361 | - ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr, |
4362 | - iph->protocol); |
4363 | - if (!ours) |
4364 | - return; |
4365 | + /* we are supposed to accept bcast packets */ |
4366 | + if (skb->pkt_type == PACKET_MULTICAST) { |
4367 | + ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr, |
4368 | + iph->protocol); |
4369 | + if (!ours) |
4370 | + return; |
4371 | + } |
4372 | + |
4373 | sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr, |
4374 | uh->source, iph->saddr, dif); |
4375 | } else if (skb->pkt_type == PACKET_HOST) { |
4376 | diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c |
4377 | index a163102f1803..2a6606c935cc 100644 |
4378 | --- a/net/ipv6/ip6_output.c |
4379 | +++ b/net/ipv6/ip6_output.c |
4380 | @@ -1091,8 +1091,8 @@ static inline int ip6_ufo_append_data(struct sock *sk, |
4381 | int getfrag(void *from, char *to, int offset, int len, |
4382 | int odd, struct sk_buff *skb), |
4383 | void *from, int length, int hh_len, int fragheaderlen, |
4384 | - int transhdrlen, int mtu, unsigned int flags, |
4385 | - const struct flowi6 *fl6) |
4386 | + int exthdrlen, int transhdrlen, int mtu, |
4387 | + unsigned int flags, const struct flowi6 *fl6) |
4388 | |
4389 | { |
4390 | struct sk_buff *skb; |
4391 | @@ -1117,7 +1117,7 @@ static inline int ip6_ufo_append_data(struct sock *sk, |
4392 | skb_put(skb, fragheaderlen + transhdrlen); |
4393 | |
4394 | /* initialize network header pointer */ |
4395 | - skb_reset_network_header(skb); |
4396 | + skb_set_network_header(skb, exthdrlen); |
4397 | |
4398 | /* initialize protocol header pointer */ |
4399 | skb->transport_header = skb->network_header + fragheaderlen; |
4400 | @@ -1359,7 +1359,7 @@ emsgsize: |
4401 | (rt->dst.dev->features & NETIF_F_UFO) && |
4402 | (sk->sk_type == SOCK_DGRAM) && !udp_get_no_check6_tx(sk)) { |
4403 | err = ip6_ufo_append_data(sk, queue, getfrag, from, length, |
4404 | - hh_len, fragheaderlen, |
4405 | + hh_len, fragheaderlen, exthdrlen, |
4406 | transhdrlen, mtu, flags, fl6); |
4407 | if (err) |
4408 | goto error; |
4409 | diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c |
4410 | index 6c5dfec7a377..3991b21e24ad 100644 |
4411 | --- a/net/ipv6/ip6_tunnel.c |
4412 | +++ b/net/ipv6/ip6_tunnel.c |
4413 | @@ -343,12 +343,12 @@ static int ip6_tnl_create2(struct net_device *dev) |
4414 | |
4415 | t = netdev_priv(dev); |
4416 | |
4417 | + dev->rtnl_link_ops = &ip6_link_ops; |
4418 | err = register_netdevice(dev); |
4419 | if (err < 0) |
4420 | goto out; |
4421 | |
4422 | strcpy(t->parms.name, dev->name); |
4423 | - dev->rtnl_link_ops = &ip6_link_ops; |
4424 | |
4425 | dev_hold(dev); |
4426 | ip6_tnl_link(ip6n, t); |
4427 | diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c |
4428 | index 422dd014aa2c..6794120f53b8 100644 |
4429 | --- a/net/ipv6/udp.c |
4430 | +++ b/net/ipv6/udp.c |
4431 | @@ -883,8 +883,8 @@ start_lookup: |
4432 | flush_stack(stack, count, skb, count - 1); |
4433 | } else { |
4434 | if (!inner_flushed) |
4435 | - UDP_INC_STATS_BH(net, UDP_MIB_IGNOREDMULTI, |
4436 | - proto == IPPROTO_UDPLITE); |
4437 | + UDP6_INC_STATS_BH(net, UDP_MIB_IGNOREDMULTI, |
4438 | + proto == IPPROTO_UDPLITE); |
4439 | consume_skb(skb); |
4440 | } |
4441 | return 0; |
4442 | diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c |
4443 | index ec22078b0914..42de4ccd159f 100644 |
4444 | --- a/net/l2tp/l2tp_ip.c |
4445 | +++ b/net/l2tp/l2tp_ip.c |
4446 | @@ -123,12 +123,11 @@ static int l2tp_ip_recv(struct sk_buff *skb) |
4447 | struct l2tp_tunnel *tunnel = NULL; |
4448 | int length; |
4449 | |
4450 | - /* Point to L2TP header */ |
4451 | - optr = ptr = skb->data; |
4452 | - |
4453 | if (!pskb_may_pull(skb, 4)) |
4454 | goto discard; |
4455 | |
4456 | + /* Point to L2TP header */ |
4457 | + optr = ptr = skb->data; |
4458 | session_id = ntohl(*((__be32 *) ptr)); |
4459 | ptr += 4; |
4460 | |
4461 | @@ -156,6 +155,9 @@ static int l2tp_ip_recv(struct sk_buff *skb) |
4462 | if (!pskb_may_pull(skb, length)) |
4463 | goto discard; |
4464 | |
4465 | + /* Point to L2TP header */ |
4466 | + optr = ptr = skb->data; |
4467 | + ptr += 4; |
4468 | pr_debug("%s: ip recv\n", tunnel->name); |
4469 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length); |
4470 | } |
4471 | diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c |
4472 | index a2c8747d2936..9ee4ddb6b397 100644 |
4473 | --- a/net/l2tp/l2tp_ip6.c |
4474 | +++ b/net/l2tp/l2tp_ip6.c |
4475 | @@ -135,12 +135,11 @@ static int l2tp_ip6_recv(struct sk_buff *skb) |
4476 | struct l2tp_tunnel *tunnel = NULL; |
4477 | int length; |
4478 | |
4479 | - /* Point to L2TP header */ |
4480 | - optr = ptr = skb->data; |
4481 | - |
4482 | if (!pskb_may_pull(skb, 4)) |
4483 | goto discard; |
4484 | |
4485 | + /* Point to L2TP header */ |
4486 | + optr = ptr = skb->data; |
4487 | session_id = ntohl(*((__be32 *) ptr)); |
4488 | ptr += 4; |
4489 | |
4490 | @@ -168,6 +167,9 @@ static int l2tp_ip6_recv(struct sk_buff *skb) |
4491 | if (!pskb_may_pull(skb, length)) |
4492 | goto discard; |
4493 | |
4494 | + /* Point to L2TP header */ |
4495 | + optr = ptr = skb->data; |
4496 | + ptr += 4; |
4497 | pr_debug("%s: ip recv\n", tunnel->name); |
4498 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length); |
4499 | } |
4500 | diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c |
4501 | index 978d3bc31df7..1b33d89906e1 100644 |
4502 | --- a/net/mac80211/ibss.c |
4503 | +++ b/net/mac80211/ibss.c |
4504 | @@ -7,6 +7,7 @@ |
4505 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> |
4506 | * Copyright 2009, Johannes Berg <johannes@sipsolutions.net> |
4507 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
4508 | + * Copyright(c) 2016 Intel Deutschland GmbH |
4509 | * |
4510 | * This program is free software; you can redistribute it and/or modify |
4511 | * it under the terms of the GNU General Public License version 2 as |
4512 | @@ -1485,14 +1486,21 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) |
4513 | |
4514 | sdata_info(sdata, "Trigger new scan to find an IBSS to join\n"); |
4515 | |
4516 | - num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy, |
4517 | - &ifibss->chandef, |
4518 | - channels, |
4519 | - ARRAY_SIZE(channels)); |
4520 | scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef); |
4521 | - ieee80211_request_ibss_scan(sdata, ifibss->ssid, |
4522 | - ifibss->ssid_len, channels, num, |
4523 | - scan_width); |
4524 | + |
4525 | + if (ifibss->fixed_channel) { |
4526 | + num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy, |
4527 | + &ifibss->chandef, |
4528 | + channels, |
4529 | + ARRAY_SIZE(channels)); |
4530 | + ieee80211_request_ibss_scan(sdata, ifibss->ssid, |
4531 | + ifibss->ssid_len, channels, |
4532 | + num, scan_width); |
4533 | + } else { |
4534 | + ieee80211_request_ibss_scan(sdata, ifibss->ssid, |
4535 | + ifibss->ssid_len, NULL, |
4536 | + 0, scan_width); |
4537 | + } |
4538 | } else { |
4539 | int interval = IEEE80211_SCAN_INTERVAL; |
4540 | |
4541 | diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
4542 | index c9e325d2e120..7a2b7915093b 100644 |
4543 | --- a/net/mac80211/iface.c |
4544 | +++ b/net/mac80211/iface.c |
4545 | @@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, |
4546 | if (sdata->vif.txq) { |
4547 | struct txq_info *txqi = to_txq_info(sdata->vif.txq); |
4548 | |
4549 | + spin_lock_bh(&txqi->queue.lock); |
4550 | ieee80211_purge_tx_queue(&local->hw, &txqi->queue); |
4551 | + spin_unlock_bh(&txqi->queue.lock); |
4552 | + |
4553 | atomic_set(&sdata->txqs_len[txqi->txq.ac], 0); |
4554 | } |
4555 | |
4556 | diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
4557 | index 60d093f40f1d..261df74eaf38 100644 |
4558 | --- a/net/mac80211/rx.c |
4559 | +++ b/net/mac80211/rx.c |
4560 | @@ -2249,7 +2249,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) |
4561 | struct ieee80211_local *local = rx->local; |
4562 | struct ieee80211_sub_if_data *sdata = rx->sdata; |
4563 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
4564 | - u16 q, hdrlen; |
4565 | + u16 ac, q, hdrlen; |
4566 | |
4567 | hdr = (struct ieee80211_hdr *) skb->data; |
4568 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
4569 | @@ -2318,7 +2318,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) |
4570 | ether_addr_equal(sdata->vif.addr, hdr->addr3)) |
4571 | return RX_CONTINUE; |
4572 | |
4573 | - q = ieee80211_select_queue_80211(sdata, skb, hdr); |
4574 | + ac = ieee80211_select_queue_80211(sdata, skb, hdr); |
4575 | + q = sdata->vif.hw_queue[ac]; |
4576 | if (ieee80211_queue_stopped(&local->hw, q)) { |
4577 | IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion); |
4578 | return RX_DROP_MONITOR; |
4579 | diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c |
4580 | index a4a4f89d3ba0..23ed038cf7f9 100644 |
4581 | --- a/net/mac80211/sta_info.c |
4582 | +++ b/net/mac80211/sta_info.c |
4583 | @@ -257,11 +257,11 @@ void sta_info_free(struct ieee80211_local *local, struct sta_info *sta) |
4584 | } |
4585 | |
4586 | /* Caller must hold local->sta_mtx */ |
4587 | -static void sta_info_hash_add(struct ieee80211_local *local, |
4588 | - struct sta_info *sta) |
4589 | +static int sta_info_hash_add(struct ieee80211_local *local, |
4590 | + struct sta_info *sta) |
4591 | { |
4592 | - rhashtable_insert_fast(&local->sta_hash, &sta->hash_node, |
4593 | - sta_rht_params); |
4594 | + return rhashtable_insert_fast(&local->sta_hash, &sta->hash_node, |
4595 | + sta_rht_params); |
4596 | } |
4597 | |
4598 | static void sta_deliver_ps_frames(struct work_struct *wk) |
4599 | @@ -498,11 +498,17 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) |
4600 | { |
4601 | struct ieee80211_local *local = sta->local; |
4602 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
4603 | - struct station_info sinfo; |
4604 | + struct station_info *sinfo; |
4605 | int err = 0; |
4606 | |
4607 | lockdep_assert_held(&local->sta_mtx); |
4608 | |
4609 | + sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL); |
4610 | + if (!sinfo) { |
4611 | + err = -ENOMEM; |
4612 | + goto out_err; |
4613 | + } |
4614 | + |
4615 | /* check if STA exists already */ |
4616 | if (sta_info_get_bss(sdata, sta->sta.addr)) { |
4617 | err = -EEXIST; |
4618 | @@ -517,7 +523,9 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) |
4619 | set_sta_flag(sta, WLAN_STA_BLOCK_BA); |
4620 | |
4621 | /* make the station visible */ |
4622 | - sta_info_hash_add(local, sta); |
4623 | + err = sta_info_hash_add(local, sta); |
4624 | + if (err) |
4625 | + goto out_drop_sta; |
4626 | |
4627 | list_add_tail_rcu(&sta->list, &local->sta_list); |
4628 | |
4629 | @@ -534,10 +542,9 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) |
4630 | ieee80211_sta_debugfs_add(sta); |
4631 | rate_control_add_sta_debugfs(sta); |
4632 | |
4633 | - memset(&sinfo, 0, sizeof(sinfo)); |
4634 | - sinfo.filled = 0; |
4635 | - sinfo.generation = local->sta_generation; |
4636 | - cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL); |
4637 | + sinfo->generation = local->sta_generation; |
4638 | + cfg80211_new_sta(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL); |
4639 | + kfree(sinfo); |
4640 | |
4641 | sta_dbg(sdata, "Inserted STA %pM\n", sta->sta.addr); |
4642 | |
4643 | @@ -552,6 +559,7 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) |
4644 | out_remove: |
4645 | sta_info_hash_del(local, sta); |
4646 | list_del_rcu(&sta->list); |
4647 | + out_drop_sta: |
4648 | local->num_sta--; |
4649 | synchronize_net(); |
4650 | __cleanup_single_sta(sta); |
4651 | @@ -898,7 +906,7 @@ static void __sta_info_destroy_part2(struct sta_info *sta) |
4652 | { |
4653 | struct ieee80211_local *local = sta->local; |
4654 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
4655 | - struct station_info sinfo = {}; |
4656 | + struct station_info *sinfo; |
4657 | int ret; |
4658 | |
4659 | /* |
4660 | @@ -936,8 +944,11 @@ static void __sta_info_destroy_part2(struct sta_info *sta) |
4661 | |
4662 | sta_dbg(sdata, "Removed STA %pM\n", sta->sta.addr); |
4663 | |
4664 | - sta_set_sinfo(sta, &sinfo); |
4665 | - cfg80211_del_sta_sinfo(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL); |
4666 | + sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); |
4667 | + if (sinfo) |
4668 | + sta_set_sinfo(sta, sinfo); |
4669 | + cfg80211_del_sta_sinfo(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL); |
4670 | + kfree(sinfo); |
4671 | |
4672 | rate_control_remove_sta_debugfs(sta); |
4673 | ieee80211_sta_debugfs_remove(sta); |
4674 | diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c |
4675 | index b18c5ed42d95..0b80a7140cc4 100644 |
4676 | --- a/net/mpls/af_mpls.c |
4677 | +++ b/net/mpls/af_mpls.c |
4678 | @@ -543,6 +543,9 @@ static struct net_device *find_outdev(struct net *net, |
4679 | if (!dev) |
4680 | return ERR_PTR(-ENODEV); |
4681 | |
4682 | + if (IS_ERR(dev)) |
4683 | + return dev; |
4684 | + |
4685 | /* The caller is holding rtnl anyways, so release the dev reference */ |
4686 | dev_put(dev); |
4687 | |
4688 | diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
4689 | index 992396aa635c..da1ae0e13cb5 100644 |
4690 | --- a/net/packet/af_packet.c |
4691 | +++ b/net/packet/af_packet.c |
4692 | @@ -1916,6 +1916,10 @@ retry: |
4693 | goto retry; |
4694 | } |
4695 | |
4696 | + if (!dev_validate_header(dev, skb->data, len)) { |
4697 | + err = -EINVAL; |
4698 | + goto out_unlock; |
4699 | + } |
4700 | if (len > (dev->mtu + dev->hard_header_len + extra_len) && |
4701 | !packet_extra_vlan_len_allowed(dev, skb)) { |
4702 | err = -EMSGSIZE; |
4703 | @@ -2326,18 +2330,6 @@ static void tpacket_destruct_skb(struct sk_buff *skb) |
4704 | sock_wfree(skb); |
4705 | } |
4706 | |
4707 | -static bool ll_header_truncated(const struct net_device *dev, int len) |
4708 | -{ |
4709 | - /* net device doesn't like empty head */ |
4710 | - if (unlikely(len < dev->hard_header_len)) { |
4711 | - net_warn_ratelimited("%s: packet size is too short (%d < %d)\n", |
4712 | - current->comm, len, dev->hard_header_len); |
4713 | - return true; |
4714 | - } |
4715 | - |
4716 | - return false; |
4717 | -} |
4718 | - |
4719 | static void tpacket_set_protocol(const struct net_device *dev, |
4720 | struct sk_buff *skb) |
4721 | { |
4722 | @@ -2420,19 +2412,19 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb, |
4723 | if (unlikely(err < 0)) |
4724 | return -EINVAL; |
4725 | } else if (dev->hard_header_len) { |
4726 | - if (ll_header_truncated(dev, tp_len)) |
4727 | - return -EINVAL; |
4728 | + int hdrlen = min_t(int, dev->hard_header_len, tp_len); |
4729 | |
4730 | skb_push(skb, dev->hard_header_len); |
4731 | - err = skb_store_bits(skb, 0, data, |
4732 | - dev->hard_header_len); |
4733 | + err = skb_store_bits(skb, 0, data, hdrlen); |
4734 | if (unlikely(err)) |
4735 | return err; |
4736 | + if (!dev_validate_header(dev, skb->data, hdrlen)) |
4737 | + return -EINVAL; |
4738 | if (!skb->protocol) |
4739 | tpacket_set_protocol(dev, skb); |
4740 | |
4741 | - data += dev->hard_header_len; |
4742 | - to_write -= dev->hard_header_len; |
4743 | + data += hdrlen; |
4744 | + to_write -= hdrlen; |
4745 | } |
4746 | |
4747 | offset = offset_in_page(data); |
4748 | @@ -2763,9 +2755,6 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) |
4749 | offset = dev_hard_header(skb, dev, ntohs(proto), addr, NULL, len); |
4750 | if (unlikely(offset < 0)) |
4751 | goto out_free; |
4752 | - } else { |
4753 | - if (ll_header_truncated(dev, len)) |
4754 | - goto out_free; |
4755 | } |
4756 | |
4757 | /* Returns -EFAULT on error */ |
4758 | @@ -2773,6 +2762,12 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) |
4759 | if (err) |
4760 | goto out_free; |
4761 | |
4762 | + if (sock->type == SOCK_RAW && |
4763 | + !dev_validate_header(dev, skb->data, len)) { |
4764 | + err = -EINVAL; |
4765 | + goto out_free; |
4766 | + } |
4767 | + |
4768 | sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags); |
4769 | |
4770 | if (!gso_type && (len > dev->mtu + reserve + extra_len) && |
4771 | diff --git a/net/socket.c b/net/socket.c |
4772 | index c044d1e8508c..db13ae893dce 100644 |
4773 | --- a/net/socket.c |
4774 | +++ b/net/socket.c |
4775 | @@ -2240,31 +2240,31 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, |
4776 | cond_resched(); |
4777 | } |
4778 | |
4779 | -out_put: |
4780 | - fput_light(sock->file, fput_needed); |
4781 | - |
4782 | if (err == 0) |
4783 | - return datagrams; |
4784 | + goto out_put; |
4785 | |
4786 | - if (datagrams != 0) { |
4787 | + if (datagrams == 0) { |
4788 | + datagrams = err; |
4789 | + goto out_put; |
4790 | + } |
4791 | + |
4792 | + /* |
4793 | + * We may return less entries than requested (vlen) if the |
4794 | + * sock is non block and there aren't enough datagrams... |
4795 | + */ |
4796 | + if (err != -EAGAIN) { |
4797 | /* |
4798 | - * We may return less entries than requested (vlen) if the |
4799 | - * sock is non block and there aren't enough datagrams... |
4800 | + * ... or if recvmsg returns an error after we |
4801 | + * received some datagrams, where we record the |
4802 | + * error to return on the next call or if the |
4803 | + * app asks about it using getsockopt(SO_ERROR). |
4804 | */ |
4805 | - if (err != -EAGAIN) { |
4806 | - /* |
4807 | - * ... or if recvmsg returns an error after we |
4808 | - * received some datagrams, where we record the |
4809 | - * error to return on the next call or if the |
4810 | - * app asks about it using getsockopt(SO_ERROR). |
4811 | - */ |
4812 | - sock->sk->sk_err = -err; |
4813 | - } |
4814 | - |
4815 | - return datagrams; |
4816 | + sock->sk->sk_err = -err; |
4817 | } |
4818 | +out_put: |
4819 | + fput_light(sock->file, fput_needed); |
4820 | |
4821 | - return err; |
4822 | + return datagrams; |
4823 | } |
4824 | |
4825 | SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg, |
4826 | diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c |
4827 | index ad7f5b3f9b61..1c4ad477ce93 100644 |
4828 | --- a/net/xfrm/xfrm_input.c |
4829 | +++ b/net/xfrm/xfrm_input.c |
4830 | @@ -292,12 +292,15 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) |
4831 | XFRM_SKB_CB(skb)->seq.input.hi = seq_hi; |
4832 | |
4833 | skb_dst_force(skb); |
4834 | + dev_hold(skb->dev); |
4835 | |
4836 | nexthdr = x->type->input(x, skb); |
4837 | |
4838 | if (nexthdr == -EINPROGRESS) |
4839 | return 0; |
4840 | resume: |
4841 | + dev_put(skb->dev); |
4842 | + |
4843 | spin_lock(&x->lock); |
4844 | if (nexthdr <= 0) { |
4845 | if (nexthdr == -EBADMSG) { |
4846 | diff --git a/sound/core/timer.c b/sound/core/timer.c |
4847 | index dca817fc7894..e5e7e4368996 100644 |
4848 | --- a/sound/core/timer.c |
4849 | +++ b/sound/core/timer.c |
4850 | @@ -1041,8 +1041,8 @@ static int snd_timer_s_start(struct snd_timer * timer) |
4851 | njiff += timer->sticks - priv->correction; |
4852 | priv->correction = 0; |
4853 | } |
4854 | - priv->last_expires = priv->tlist.expires = njiff; |
4855 | - add_timer(&priv->tlist); |
4856 | + priv->last_expires = njiff; |
4857 | + mod_timer(&priv->tlist, njiff); |
4858 | return 0; |
4859 | } |
4860 | |
4861 | diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
4862 | index e68fa449ebef..0c9585602bf3 100644 |
4863 | --- a/sound/pci/hda/patch_hdmi.c |
4864 | +++ b/sound/pci/hda/patch_hdmi.c |
4865 | @@ -1623,6 +1623,8 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin, |
4866 | |
4867 | mutex_lock(&per_pin->lock); |
4868 | pin_eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE); |
4869 | + eld->monitor_present = pin_eld->monitor_present; |
4870 | + |
4871 | if (pin_eld->monitor_present) |
4872 | eld->eld_valid = !!(present & AC_PINSENSE_ELDV); |
4873 | else |
4874 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
4875 | index 4f5ca0b9ce27..1402ba954b3d 100644 |
4876 | --- a/sound/pci/hda/patch_realtek.c |
4877 | +++ b/sound/pci/hda/patch_realtek.c |
4878 | @@ -4759,6 +4759,8 @@ enum { |
4879 | ALC255_FIXUP_DELL_SPK_NOISE, |
4880 | ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, |
4881 | ALC280_FIXUP_HP_HEADSET_MIC, |
4882 | + ALC221_FIXUP_HP_FRONT_MIC, |
4883 | + ALC292_FIXUP_TPT460, |
4884 | }; |
4885 | |
4886 | static const struct hda_fixup alc269_fixups[] = { |
4887 | @@ -5401,6 +5403,19 @@ static const struct hda_fixup alc269_fixups[] = { |
4888 | .chained = true, |
4889 | .chain_id = ALC269_FIXUP_HEADSET_MIC, |
4890 | }, |
4891 | + [ALC221_FIXUP_HP_FRONT_MIC] = { |
4892 | + .type = HDA_FIXUP_PINS, |
4893 | + .v.pins = (const struct hda_pintbl[]) { |
4894 | + { 0x19, 0x02a19020 }, /* Front Mic */ |
4895 | + { } |
4896 | + }, |
4897 | + }, |
4898 | + [ALC292_FIXUP_TPT460] = { |
4899 | + .type = HDA_FIXUP_FUNC, |
4900 | + .v.func = alc_fixup_tpt440_dock, |
4901 | + .chained = true, |
4902 | + .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE, |
4903 | + }, |
4904 | }; |
4905 | |
4906 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4907 | @@ -5506,6 +5521,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4908 | SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4909 | SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4910 | SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC), |
4911 | + SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC), |
4912 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), |
4913 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4914 | SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4915 | @@ -5554,7 +5570,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4916 | SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK), |
4917 | SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK), |
4918 | SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK), |
4919 | - SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE), |
4920 | + SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460), |
4921 | SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
4922 | SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
4923 | SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), |
4924 | @@ -5649,6 +5665,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { |
4925 | {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"}, |
4926 | {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"}, |
4927 | {.id = ALC292_FIXUP_TPT440, .name = "tpt440"}, |
4928 | + {.id = ALC292_FIXUP_TPT460, .name = "tpt460"}, |
4929 | {} |
4930 | }; |
4931 | #define ALC225_STANDARD_PINS \ |
4932 | @@ -6406,6 +6423,7 @@ enum { |
4933 | ALC668_FIXUP_AUTO_MUTE, |
4934 | ALC668_FIXUP_DELL_DISABLE_AAMIX, |
4935 | ALC668_FIXUP_DELL_XPS13, |
4936 | + ALC662_FIXUP_ASUS_Nx50, |
4937 | }; |
4938 | |
4939 | static const struct hda_fixup alc662_fixups[] = { |
4940 | @@ -6646,6 +6664,12 @@ static const struct hda_fixup alc662_fixups[] = { |
4941 | .type = HDA_FIXUP_FUNC, |
4942 | .v.func = alc_fixup_bass_chmap, |
4943 | }, |
4944 | + [ALC662_FIXUP_ASUS_Nx50] = { |
4945 | + .type = HDA_FIXUP_FUNC, |
4946 | + .v.func = alc_fixup_auto_mute_via_amp, |
4947 | + .chained = true, |
4948 | + .chain_id = ALC662_FIXUP_BASS_1A |
4949 | + }, |
4950 | }; |
4951 | |
4952 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
4953 | @@ -6668,8 +6692,9 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
4954 | SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
4955 | SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
4956 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), |
4957 | - SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A), |
4958 | + SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50), |
4959 | SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A), |
4960 | + SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50), |
4961 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), |
4962 | SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16), |
4963 | SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16), |
4964 | diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c |
4965 | index ddca6547399b..1f8fb0d904e0 100644 |
4966 | --- a/sound/usb/mixer_maps.c |
4967 | +++ b/sound/usb/mixer_maps.c |
4968 | @@ -349,6 +349,16 @@ static struct usbmix_name_map bose_companion5_map[] = { |
4969 | }; |
4970 | |
4971 | /* |
4972 | + * Dell usb dock with ALC4020 codec had a firmware problem where it got |
4973 | + * screwed up when zero volume is passed; just skip it as a workaround |
4974 | + */ |
4975 | +static const struct usbmix_name_map dell_alc4020_map[] = { |
4976 | + { 16, NULL }, |
4977 | + { 19, NULL }, |
4978 | + { 0 } |
4979 | +}; |
4980 | + |
4981 | +/* |
4982 | * Control map entries |
4983 | */ |
4984 | |
4985 | @@ -431,6 +441,10 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { |
4986 | .map = aureon_51_2_map, |
4987 | }, |
4988 | { |
4989 | + .id = USB_ID(0x0bda, 0x4014), |
4990 | + .map = dell_alc4020_map, |
4991 | + }, |
4992 | + { |
4993 | .id = USB_ID(0x0dba, 0x1000), |
4994 | .map = mbox1_map, |
4995 | }, |
4996 | diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
4997 | index cd7eac28edee..001fb4dc0722 100644 |
4998 | --- a/sound/usb/quirks.c |
4999 | +++ b/sound/usb/quirks.c |
5000 | @@ -1135,9 +1135,11 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) |
5001 | case USB_ID(0x045E, 0x076F): /* MS Lifecam HD-6000 */ |
5002 | case USB_ID(0x045E, 0x0772): /* MS Lifecam Studio */ |
5003 | case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */ |
5004 | + case USB_ID(0x047F, 0x0415): /* Plantronics BT-300 */ |
5005 | case USB_ID(0x047F, 0xAA05): /* Plantronics DA45 */ |
5006 | case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ |
5007 | case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ |
5008 | + case USB_ID(0x1de7, 0x0014): /* Phoenix Audio TMX320 */ |
5009 | case USB_ID(0x21B4, 0x0081): /* AudioQuest DragonFly */ |
5010 | return true; |
5011 | } |