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