Contents of /trunk/kernel-alx/patches-4.9/0270-4.9.171-all-fixes.patch
Parent Directory | Revision Log
Revision 3347 -
(show annotations)
(download)
Tue Jun 18 09:42:01 2019 UTC (5 years, 3 months ago) by niro
File size: 66084 byte(s)
Tue Jun 18 09:42:01 2019 UTC (5 years, 3 months ago) by niro
File size: 66084 byte(s)
-linux-4.9.171
1 | diff --git a/Makefile b/Makefile |
2 | index 966069dab768..dbdef749e1c8 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 4 |
7 | PATCHLEVEL = 9 |
8 | -SUBLEVEL = 170 |
9 | +SUBLEVEL = 171 |
10 | EXTRAVERSION = |
11 | NAME = Roaring Lionus |
12 | |
13 | @@ -655,8 +655,7 @@ KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) |
14 | endif |
15 | |
16 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
17 | -KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) |
18 | -KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) |
19 | +KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) |
20 | else |
21 | ifdef CONFIG_PROFILE_ALL_BRANCHES |
22 | KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,) |
23 | diff --git a/arch/arm64/include/asm/futex.h b/arch/arm64/include/asm/futex.h |
24 | index d7116f5935fb..86a43450f014 100644 |
25 | --- a/arch/arm64/include/asm/futex.h |
26 | +++ b/arch/arm64/include/asm/futex.h |
27 | @@ -53,7 +53,7 @@ |
28 | static inline int |
29 | arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr) |
30 | { |
31 | - int oldval, ret, tmp; |
32 | + int oldval = 0, ret, tmp; |
33 | |
34 | pagefault_disable(); |
35 | |
36 | diff --git a/arch/x86/crypto/poly1305-avx2-x86_64.S b/arch/x86/crypto/poly1305-avx2-x86_64.S |
37 | index eff2f414e22b..ec234c43b3f4 100644 |
38 | --- a/arch/x86/crypto/poly1305-avx2-x86_64.S |
39 | +++ b/arch/x86/crypto/poly1305-avx2-x86_64.S |
40 | @@ -321,6 +321,12 @@ ENTRY(poly1305_4block_avx2) |
41 | vpaddq t2,t1,t1 |
42 | vmovq t1x,d4 |
43 | |
44 | + # Now do a partial reduction mod (2^130)-5, carrying h0 -> h1 -> h2 -> |
45 | + # h3 -> h4 -> h0 -> h1 to get h0,h2,h3,h4 < 2^26 and h1 < 2^26 + a small |
46 | + # amount. Careful: we must not assume the carry bits 'd0 >> 26', |
47 | + # 'd1 >> 26', 'd2 >> 26', 'd3 >> 26', and '(d4 >> 26) * 5' fit in 32-bit |
48 | + # integers. It's true in a single-block implementation, but not here. |
49 | + |
50 | # d1 += d0 >> 26 |
51 | mov d0,%rax |
52 | shr $26,%rax |
53 | @@ -359,16 +365,16 @@ ENTRY(poly1305_4block_avx2) |
54 | # h0 += (d4 >> 26) * 5 |
55 | mov d4,%rax |
56 | shr $26,%rax |
57 | - lea (%eax,%eax,4),%eax |
58 | - add %eax,%ebx |
59 | + lea (%rax,%rax,4),%rax |
60 | + add %rax,%rbx |
61 | # h4 = d4 & 0x3ffffff |
62 | mov d4,%rax |
63 | and $0x3ffffff,%eax |
64 | mov %eax,h4 |
65 | |
66 | # h1 += h0 >> 26 |
67 | - mov %ebx,%eax |
68 | - shr $26,%eax |
69 | + mov %rbx,%rax |
70 | + shr $26,%rax |
71 | add %eax,h1 |
72 | # h0 = h0 & 0x3ffffff |
73 | andl $0x3ffffff,%ebx |
74 | diff --git a/arch/x86/crypto/poly1305-sse2-x86_64.S b/arch/x86/crypto/poly1305-sse2-x86_64.S |
75 | index 338c748054ed..639d9760b089 100644 |
76 | --- a/arch/x86/crypto/poly1305-sse2-x86_64.S |
77 | +++ b/arch/x86/crypto/poly1305-sse2-x86_64.S |
78 | @@ -251,16 +251,16 @@ ENTRY(poly1305_block_sse2) |
79 | # h0 += (d4 >> 26) * 5 |
80 | mov d4,%rax |
81 | shr $26,%rax |
82 | - lea (%eax,%eax,4),%eax |
83 | - add %eax,%ebx |
84 | + lea (%rax,%rax,4),%rax |
85 | + add %rax,%rbx |
86 | # h4 = d4 & 0x3ffffff |
87 | mov d4,%rax |
88 | and $0x3ffffff,%eax |
89 | mov %eax,h4 |
90 | |
91 | # h1 += h0 >> 26 |
92 | - mov %ebx,%eax |
93 | - shr $26,%eax |
94 | + mov %rbx,%rax |
95 | + shr $26,%rax |
96 | add %eax,h1 |
97 | # h0 = h0 & 0x3ffffff |
98 | andl $0x3ffffff,%ebx |
99 | @@ -518,6 +518,12 @@ ENTRY(poly1305_2block_sse2) |
100 | paddq t2,t1 |
101 | movq t1,d4 |
102 | |
103 | + # Now do a partial reduction mod (2^130)-5, carrying h0 -> h1 -> h2 -> |
104 | + # h3 -> h4 -> h0 -> h1 to get h0,h2,h3,h4 < 2^26 and h1 < 2^26 + a small |
105 | + # amount. Careful: we must not assume the carry bits 'd0 >> 26', |
106 | + # 'd1 >> 26', 'd2 >> 26', 'd3 >> 26', and '(d4 >> 26) * 5' fit in 32-bit |
107 | + # integers. It's true in a single-block implementation, but not here. |
108 | + |
109 | # d1 += d0 >> 26 |
110 | mov d0,%rax |
111 | shr $26,%rax |
112 | @@ -556,16 +562,16 @@ ENTRY(poly1305_2block_sse2) |
113 | # h0 += (d4 >> 26) * 5 |
114 | mov d4,%rax |
115 | shr $26,%rax |
116 | - lea (%eax,%eax,4),%eax |
117 | - add %eax,%ebx |
118 | + lea (%rax,%rax,4),%rax |
119 | + add %rax,%rbx |
120 | # h4 = d4 & 0x3ffffff |
121 | mov d4,%rax |
122 | and $0x3ffffff,%eax |
123 | mov %eax,h4 |
124 | |
125 | # h1 += h0 >> 26 |
126 | - mov %ebx,%eax |
127 | - shr $26,%eax |
128 | + mov %rbx,%rax |
129 | + shr $26,%rax |
130 | add %eax,h1 |
131 | # h0 = h0 & 0x3ffffff |
132 | andl $0x3ffffff,%ebx |
133 | diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c |
134 | index afb222b63cae..de050d5a4506 100644 |
135 | --- a/arch/x86/events/amd/core.c |
136 | +++ b/arch/x86/events/amd/core.c |
137 | @@ -113,22 +113,39 @@ static __initconst const u64 amd_hw_cache_event_ids |
138 | }; |
139 | |
140 | /* |
141 | - * AMD Performance Monitor K7 and later. |
142 | + * AMD Performance Monitor K7 and later, up to and including Family 16h: |
143 | */ |
144 | static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] = |
145 | { |
146 | - [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, |
147 | - [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
148 | - [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, |
149 | - [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, |
150 | - [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, |
151 | - [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, |
152 | - [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ |
153 | - [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x00d1, /* "Dispatch stalls" event */ |
154 | + [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, |
155 | + [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
156 | + [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, |
157 | + [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, |
158 | + [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, |
159 | + [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, |
160 | + [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ |
161 | + [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x00d1, /* "Dispatch stalls" event */ |
162 | +}; |
163 | + |
164 | +/* |
165 | + * AMD Performance Monitor Family 17h and later: |
166 | + */ |
167 | +static const u64 amd_f17h_perfmon_event_map[PERF_COUNT_HW_MAX] = |
168 | +{ |
169 | + [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, |
170 | + [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
171 | + [PERF_COUNT_HW_CACHE_REFERENCES] = 0xff60, |
172 | + [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, |
173 | + [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, |
174 | + [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x0287, |
175 | + [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x0187, |
176 | }; |
177 | |
178 | static u64 amd_pmu_event_map(int hw_event) |
179 | { |
180 | + if (boot_cpu_data.x86 >= 0x17) |
181 | + return amd_f17h_perfmon_event_map[hw_event]; |
182 | + |
183 | return amd_perfmon_event_map[hw_event]; |
184 | } |
185 | |
186 | diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c |
187 | index 64a70b2e2285..3f3cfeca1083 100644 |
188 | --- a/arch/x86/kernel/kprobes/core.c |
189 | +++ b/arch/x86/kernel/kprobes/core.c |
190 | @@ -545,6 +545,7 @@ void arch_prepare_kretprobe(struct kretprobe_instance *ri, struct pt_regs *regs) |
191 | unsigned long *sara = stack_addr(regs); |
192 | |
193 | ri->ret_addr = (kprobe_opcode_t *) *sara; |
194 | + ri->fp = sara; |
195 | |
196 | /* Replace the return addr with trampoline addr */ |
197 | *sara = (unsigned long) &kretprobe_trampoline; |
198 | @@ -746,15 +747,21 @@ __visible __used void *trampoline_handler(struct pt_regs *regs) |
199 | unsigned long flags, orig_ret_address = 0; |
200 | unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline; |
201 | kprobe_opcode_t *correct_ret_addr = NULL; |
202 | + void *frame_pointer; |
203 | + bool skipped = false; |
204 | |
205 | INIT_HLIST_HEAD(&empty_rp); |
206 | kretprobe_hash_lock(current, &head, &flags); |
207 | /* fixup registers */ |
208 | #ifdef CONFIG_X86_64 |
209 | regs->cs = __KERNEL_CS; |
210 | + /* On x86-64, we use pt_regs->sp for return address holder. */ |
211 | + frame_pointer = ®s->sp; |
212 | #else |
213 | regs->cs = __KERNEL_CS | get_kernel_rpl(); |
214 | regs->gs = 0; |
215 | + /* On x86-32, we use pt_regs->flags for return address holder. */ |
216 | + frame_pointer = ®s->flags; |
217 | #endif |
218 | regs->ip = trampoline_address; |
219 | regs->orig_ax = ~0UL; |
220 | @@ -776,8 +783,25 @@ __visible __used void *trampoline_handler(struct pt_regs *regs) |
221 | if (ri->task != current) |
222 | /* another task is sharing our hash bucket */ |
223 | continue; |
224 | + /* |
225 | + * Return probes must be pushed on this hash list correct |
226 | + * order (same as return order) so that it can be poped |
227 | + * correctly. However, if we find it is pushed it incorrect |
228 | + * order, this means we find a function which should not be |
229 | + * probed, because the wrong order entry is pushed on the |
230 | + * path of processing other kretprobe itself. |
231 | + */ |
232 | + if (ri->fp != frame_pointer) { |
233 | + if (!skipped) |
234 | + pr_warn("kretprobe is stacked incorrectly. Trying to fixup.\n"); |
235 | + skipped = true; |
236 | + continue; |
237 | + } |
238 | |
239 | orig_ret_address = (unsigned long)ri->ret_addr; |
240 | + if (skipped) |
241 | + pr_warn("%ps must be blacklisted because of incorrect kretprobe order\n", |
242 | + ri->rp->kp.addr); |
243 | |
244 | if (orig_ret_address != trampoline_address) |
245 | /* |
246 | @@ -795,6 +819,8 @@ __visible __used void *trampoline_handler(struct pt_regs *regs) |
247 | if (ri->task != current) |
248 | /* another task is sharing our hash bucket */ |
249 | continue; |
250 | + if (ri->fp != frame_pointer) |
251 | + continue; |
252 | |
253 | orig_ret_address = (unsigned long)ri->ret_addr; |
254 | if (ri->rp && ri->rp->handler) { |
255 | diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c |
256 | index 510cfc06701a..b636a1e849fd 100644 |
257 | --- a/arch/x86/kvm/emulate.c |
258 | +++ b/arch/x86/kvm/emulate.c |
259 | @@ -2579,15 +2579,13 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt) |
260 | * CR0/CR3/CR4/EFER. It's all a bit more complicated if the vCPU |
261 | * supports long mode. |
262 | */ |
263 | - cr4 = ctxt->ops->get_cr(ctxt, 4); |
264 | if (emulator_has_longmode(ctxt)) { |
265 | struct desc_struct cs_desc; |
266 | |
267 | /* Zero CR4.PCIDE before CR0.PG. */ |
268 | - if (cr4 & X86_CR4_PCIDE) { |
269 | + cr4 = ctxt->ops->get_cr(ctxt, 4); |
270 | + if (cr4 & X86_CR4_PCIDE) |
271 | ctxt->ops->set_cr(ctxt, 4, cr4 & ~X86_CR4_PCIDE); |
272 | - cr4 &= ~X86_CR4_PCIDE; |
273 | - } |
274 | |
275 | /* A 32-bit code segment is required to clear EFER.LMA. */ |
276 | memset(&cs_desc, 0, sizeof(cs_desc)); |
277 | @@ -2601,13 +2599,16 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt) |
278 | if (cr0 & X86_CR0_PE) |
279 | ctxt->ops->set_cr(ctxt, 0, cr0 & ~(X86_CR0_PG | X86_CR0_PE)); |
280 | |
281 | - /* Now clear CR4.PAE (which must be done before clearing EFER.LME). */ |
282 | - if (cr4 & X86_CR4_PAE) |
283 | - ctxt->ops->set_cr(ctxt, 4, cr4 & ~X86_CR4_PAE); |
284 | + if (emulator_has_longmode(ctxt)) { |
285 | + /* Clear CR4.PAE before clearing EFER.LME. */ |
286 | + cr4 = ctxt->ops->get_cr(ctxt, 4); |
287 | + if (cr4 & X86_CR4_PAE) |
288 | + ctxt->ops->set_cr(ctxt, 4, cr4 & ~X86_CR4_PAE); |
289 | |
290 | - /* And finally go back to 32-bit mode. */ |
291 | - efer = 0; |
292 | - ctxt->ops->set_msr(ctxt, MSR_EFER, efer); |
293 | + /* And finally go back to 32-bit mode. */ |
294 | + efer = 0; |
295 | + ctxt->ops->set_msr(ctxt, MSR_EFER, efer); |
296 | + } |
297 | |
298 | smbase = ctxt->ops->get_smbase(ctxt); |
299 | if (emulator_has_longmode(ctxt)) |
300 | diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
301 | index 01eb0451b96d..9a6d258c3c16 100644 |
302 | --- a/arch/x86/kvm/svm.c |
303 | +++ b/arch/x86/kvm/svm.c |
304 | @@ -3940,14 +3940,25 @@ static int avic_incomplete_ipi_interception(struct vcpu_svm *svm) |
305 | kvm_lapic_reg_write(apic, APIC_ICR, icrl); |
306 | break; |
307 | case AVIC_IPI_FAILURE_TARGET_NOT_RUNNING: { |
308 | + int i; |
309 | + struct kvm_vcpu *vcpu; |
310 | + struct kvm *kvm = svm->vcpu.kvm; |
311 | struct kvm_lapic *apic = svm->vcpu.arch.apic; |
312 | |
313 | /* |
314 | - * Update ICR high and low, then emulate sending IPI, |
315 | - * which is handled when writing APIC_ICR. |
316 | + * At this point, we expect that the AVIC HW has already |
317 | + * set the appropriate IRR bits on the valid target |
318 | + * vcpus. So, we just need to kick the appropriate vcpu. |
319 | */ |
320 | - kvm_lapic_reg_write(apic, APIC_ICR2, icrh); |
321 | - kvm_lapic_reg_write(apic, APIC_ICR, icrl); |
322 | + kvm_for_each_vcpu(i, vcpu, kvm) { |
323 | + bool m = kvm_apic_match_dest(vcpu, apic, |
324 | + icrl & KVM_APIC_SHORT_MASK, |
325 | + GET_APIC_DEST_FIELD(icrh), |
326 | + icrl & KVM_APIC_DEST_MASK); |
327 | + |
328 | + if (m && !avic_vcpu_is_running(vcpu)) |
329 | + kvm_vcpu_wake_up(vcpu); |
330 | + } |
331 | break; |
332 | } |
333 | case AVIC_IPI_FAILURE_INVALID_TARGET: |
334 | diff --git a/crypto/testmgr.h b/crypto/testmgr.h |
335 | index 9033088ca231..ebff33765ac3 100644 |
336 | --- a/crypto/testmgr.h |
337 | +++ b/crypto/testmgr.h |
338 | @@ -4527,7 +4527,49 @@ static struct hash_testvec poly1305_tv_template[] = { |
339 | .psize = 80, |
340 | .digest = "\x13\x00\x00\x00\x00\x00\x00\x00" |
341 | "\x00\x00\x00\x00\x00\x00\x00\x00", |
342 | - }, |
343 | + }, { /* Regression test for overflow in AVX2 implementation */ |
344 | + .plaintext = "\xff\xff\xff\xff\xff\xff\xff\xff" |
345 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
346 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
347 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
348 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
349 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
350 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
351 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
352 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
353 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
354 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
355 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
356 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
357 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
358 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
359 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
360 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
361 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
362 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
363 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
364 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
365 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
366 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
367 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
368 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
369 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
370 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
371 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
372 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
373 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
374 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
375 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
376 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
377 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
378 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
379 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
380 | + "\xff\xff\xff\xff\xff\xff\xff\xff" |
381 | + "\xff\xff\xff\xff", |
382 | + .psize = 300, |
383 | + .digest = "\xfb\x5e\x96\xd8\x61\xd5\xc7\xc8" |
384 | + "\x78\xe5\x87\xcc\x2d\x5a\x22\xe1", |
385 | + } |
386 | }; |
387 | |
388 | /* |
389 | diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c |
390 | index 95ce2e9ccdc6..cc4e642d3180 100644 |
391 | --- a/drivers/char/tpm/tpm_i2c_atmel.c |
392 | +++ b/drivers/char/tpm/tpm_i2c_atmel.c |
393 | @@ -65,7 +65,15 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len) |
394 | dev_dbg(&chip->dev, |
395 | "%s(buf=%*ph len=%0zx) -> sts=%d\n", __func__, |
396 | (int)min_t(size_t, 64, len), buf, len, status); |
397 | - return status; |
398 | + |
399 | + if (status < 0) |
400 | + return status; |
401 | + |
402 | + /* The upper layer does not support incomplete sends. */ |
403 | + if (status != len) |
404 | + return -E2BIG; |
405 | + |
406 | + return 0; |
407 | } |
408 | |
409 | static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count) |
410 | diff --git a/drivers/crypto/amcc/crypto4xx_alg.c b/drivers/crypto/amcc/crypto4xx_alg.c |
411 | index 4afca3968773..e3b8bebfdd30 100644 |
412 | --- a/drivers/crypto/amcc/crypto4xx_alg.c |
413 | +++ b/drivers/crypto/amcc/crypto4xx_alg.c |
414 | @@ -138,7 +138,8 @@ static int crypto4xx_setkey_aes(struct crypto_ablkcipher *cipher, |
415 | sa = (struct dynamic_sa_ctl *) ctx->sa_in; |
416 | ctx->hash_final = 0; |
417 | |
418 | - set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, SA_NOT_SAVE_IV, |
419 | + set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, (cm == CRYPTO_MODE_CBC ? |
420 | + SA_SAVE_IV : SA_NOT_SAVE_IV), |
421 | SA_LOAD_HASH_FROM_SA, SA_LOAD_IV_FROM_STATE, |
422 | SA_NO_HEADER_PROC, SA_HASH_ALG_NULL, |
423 | SA_CIPHER_ALG_AES, SA_PAD_TYPE_ZERO, |
424 | diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c |
425 | index c7524bbbaf98..7d066fa9f2ad 100644 |
426 | --- a/drivers/crypto/amcc/crypto4xx_core.c |
427 | +++ b/drivers/crypto/amcc/crypto4xx_core.c |
428 | @@ -646,6 +646,15 @@ static u32 crypto4xx_ablkcipher_done(struct crypto4xx_device *dev, |
429 | addr = dma_map_page(dev->core_dev->device, sg_page(dst), |
430 | dst->offset, dst->length, DMA_FROM_DEVICE); |
431 | } |
432 | + |
433 | + if (pd_uinfo->sa_va->sa_command_0.bf.save_iv == SA_SAVE_IV) { |
434 | + struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req); |
435 | + |
436 | + crypto4xx_memcpy_from_le32((u32 *)req->iv, |
437 | + pd_uinfo->sr_va->save_iv, |
438 | + crypto_skcipher_ivsize(skcipher)); |
439 | + } |
440 | + |
441 | crypto4xx_ret_sg_desc(dev, pd_uinfo); |
442 | if (ablk_req->base.complete != NULL) |
443 | ablk_req->base.complete(&ablk_req->base, 0); |
444 | diff --git a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c |
445 | index 1d645c9ab417..cac262a912c1 100644 |
446 | --- a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c |
447 | +++ b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c |
448 | @@ -337,7 +337,8 @@ static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = { |
449 | DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FlexBook edge11 - M-FBE11"), |
450 | }, |
451 | .driver_data = (void *)&sipodev_desc |
452 | - } |
453 | + }, |
454 | + { } /* Terminate list */ |
455 | }; |
456 | |
457 | |
458 | diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c |
459 | index 784636800361..780f886ccbfe 100644 |
460 | --- a/drivers/iio/accel/kxcjk-1013.c |
461 | +++ b/drivers/iio/accel/kxcjk-1013.c |
462 | @@ -1340,6 +1340,8 @@ static int kxcjk1013_resume(struct device *dev) |
463 | |
464 | mutex_lock(&data->mutex); |
465 | ret = kxcjk1013_set_mode(data, OPERATION); |
466 | + if (ret == 0) |
467 | + ret = kxcjk1013_set_range(data, data->range); |
468 | mutex_unlock(&data->mutex); |
469 | |
470 | return ret; |
471 | diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c |
472 | index 22c4c17cd996..a1d072ecb717 100644 |
473 | --- a/drivers/iio/adc/ad_sigma_delta.c |
474 | +++ b/drivers/iio/adc/ad_sigma_delta.c |
475 | @@ -121,6 +121,7 @@ static int ad_sd_read_reg_raw(struct ad_sigma_delta *sigma_delta, |
476 | if (sigma_delta->info->has_registers) { |
477 | data[0] = reg << sigma_delta->info->addr_shift; |
478 | data[0] |= sigma_delta->info->read_mask; |
479 | + data[0] |= sigma_delta->comm; |
480 | spi_message_add_tail(&t[0], &m); |
481 | } |
482 | spi_message_add_tail(&t[1], &m); |
483 | diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c |
484 | index e3e2155b0386..dd9f2280927b 100644 |
485 | --- a/drivers/iio/adc/at91_adc.c |
486 | +++ b/drivers/iio/adc/at91_adc.c |
487 | @@ -704,23 +704,29 @@ static int at91_adc_read_raw(struct iio_dev *idev, |
488 | ret = wait_event_interruptible_timeout(st->wq_data_avail, |
489 | st->done, |
490 | msecs_to_jiffies(1000)); |
491 | - if (ret == 0) |
492 | - ret = -ETIMEDOUT; |
493 | - if (ret < 0) { |
494 | - mutex_unlock(&st->lock); |
495 | - return ret; |
496 | - } |
497 | - |
498 | - *val = st->last_value; |
499 | |
500 | + /* Disable interrupts, regardless if adc conversion was |
501 | + * successful or not |
502 | + */ |
503 | at91_adc_writel(st, AT91_ADC_CHDR, |
504 | AT91_ADC_CH(chan->channel)); |
505 | at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel)); |
506 | |
507 | - st->last_value = 0; |
508 | - st->done = false; |
509 | + if (ret > 0) { |
510 | + /* a valid conversion took place */ |
511 | + *val = st->last_value; |
512 | + st->last_value = 0; |
513 | + st->done = false; |
514 | + ret = IIO_VAL_INT; |
515 | + } else if (ret == 0) { |
516 | + /* conversion timeout */ |
517 | + dev_err(&idev->dev, "ADC Channel %d timeout.\n", |
518 | + chan->channel); |
519 | + ret = -ETIMEDOUT; |
520 | + } |
521 | + |
522 | mutex_unlock(&st->lock); |
523 | - return IIO_VAL_INT; |
524 | + return ret; |
525 | |
526 | case IIO_CHAN_INFO_SCALE: |
527 | *val = st->vref_mv; |
528 | diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c |
529 | index 821919dd245b..b5a5517e3ce1 100644 |
530 | --- a/drivers/iio/gyro/bmg160_core.c |
531 | +++ b/drivers/iio/gyro/bmg160_core.c |
532 | @@ -583,11 +583,10 @@ static int bmg160_read_raw(struct iio_dev *indio_dev, |
533 | case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: |
534 | return bmg160_get_filter(data, val); |
535 | case IIO_CHAN_INFO_SCALE: |
536 | - *val = 0; |
537 | switch (chan->type) { |
538 | case IIO_TEMP: |
539 | - *val2 = 500000; |
540 | - return IIO_VAL_INT_PLUS_MICRO; |
541 | + *val = 500; |
542 | + return IIO_VAL_INT; |
543 | case IIO_ANGL_VEL: |
544 | { |
545 | int i; |
546 | @@ -595,6 +594,7 @@ static int bmg160_read_raw(struct iio_dev *indio_dev, |
547 | for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) { |
548 | if (bmg160_scale_table[i].dps_range == |
549 | data->dps_range) { |
550 | + *val = 0; |
551 | *val2 = bmg160_scale_table[i].scale; |
552 | return IIO_VAL_INT_PLUS_MICRO; |
553 | } |
554 | diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c |
555 | index 6bf58d27b6fc..df306caba296 100644 |
556 | --- a/drivers/mmc/host/sdhci.c |
557 | +++ b/drivers/mmc/host/sdhci.c |
558 | @@ -944,8 +944,7 @@ static bool sdhci_needs_reset(struct sdhci_host *host, struct mmc_request *mrq) |
559 | return (!(host->flags & SDHCI_DEVICE_DEAD) && |
560 | ((mrq->cmd && mrq->cmd->error) || |
561 | (mrq->sbc && mrq->sbc->error) || |
562 | - (mrq->data && ((mrq->data->error && !mrq->data->stop) || |
563 | - (mrq->data->stop && mrq->data->stop->error))) || |
564 | + (mrq->data && mrq->data->stop && mrq->data->stop->error) || |
565 | (host->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST))); |
566 | } |
567 | |
568 | @@ -997,6 +996,16 @@ static void sdhci_finish_data(struct sdhci_host *host) |
569 | host->data = NULL; |
570 | host->data_cmd = NULL; |
571 | |
572 | + /* |
573 | + * The controller needs a reset of internal state machines upon error |
574 | + * conditions. |
575 | + */ |
576 | + if (data->error) { |
577 | + if (!host->cmd || host->cmd == data_cmd) |
578 | + sdhci_do_reset(host, SDHCI_RESET_CMD); |
579 | + sdhci_do_reset(host, SDHCI_RESET_DATA); |
580 | + } |
581 | + |
582 | if ((host->flags & (SDHCI_REQ_USE_DMA | SDHCI_USE_ADMA)) == |
583 | (SDHCI_REQ_USE_DMA | SDHCI_USE_ADMA)) |
584 | sdhci_adma_table_post(host, data); |
585 | @@ -1021,17 +1030,6 @@ static void sdhci_finish_data(struct sdhci_host *host) |
586 | if (data->stop && |
587 | (data->error || |
588 | !data->mrq->sbc)) { |
589 | - |
590 | - /* |
591 | - * The controller needs a reset of internal state machines |
592 | - * upon error conditions. |
593 | - */ |
594 | - if (data->error) { |
595 | - if (!host->cmd || host->cmd == data_cmd) |
596 | - sdhci_do_reset(host, SDHCI_RESET_CMD); |
597 | - sdhci_do_reset(host, SDHCI_RESET_DATA); |
598 | - } |
599 | - |
600 | /* |
601 | * 'cap_cmd_during_tfr' request must not use the command line |
602 | * after mmc_command_done() has been called. It is upper layer's |
603 | @@ -2457,7 +2455,7 @@ static void sdhci_timeout_data_timer(unsigned long data) |
604 | * * |
605 | \*****************************************************************************/ |
606 | |
607 | -static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask) |
608 | +static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask, u32 *intmask_p) |
609 | { |
610 | if (!host->cmd) { |
611 | /* |
612 | @@ -2480,20 +2478,12 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask) |
613 | else |
614 | host->cmd->error = -EILSEQ; |
615 | |
616 | - /* |
617 | - * If this command initiates a data phase and a response |
618 | - * CRC error is signalled, the card can start transferring |
619 | - * data - the card may have received the command without |
620 | - * error. We must not terminate the mmc_request early. |
621 | - * |
622 | - * If the card did not receive the command or returned an |
623 | - * error which prevented it sending data, the data phase |
624 | - * will time out. |
625 | - */ |
626 | + /* Treat data command CRC error the same as data CRC error */ |
627 | if (host->cmd->data && |
628 | (intmask & (SDHCI_INT_CRC | SDHCI_INT_TIMEOUT)) == |
629 | SDHCI_INT_CRC) { |
630 | host->cmd = NULL; |
631 | + *intmask_p |= SDHCI_INT_DATA_CRC; |
632 | return; |
633 | } |
634 | |
635 | @@ -2722,7 +2712,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) |
636 | } |
637 | |
638 | if (intmask & SDHCI_INT_CMD_MASK) |
639 | - sdhci_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK); |
640 | + sdhci_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK, &intmask); |
641 | |
642 | if (intmask & SDHCI_INT_DATA_MASK) |
643 | sdhci_data_irq(host, intmask & SDHCI_INT_DATA_MASK); |
644 | diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
645 | index 24a3433f3944..93169729dfc9 100644 |
646 | --- a/drivers/net/bonding/bond_main.c |
647 | +++ b/drivers/net/bonding/bond_main.c |
648 | @@ -3134,8 +3134,12 @@ static int bond_netdev_event(struct notifier_block *this, |
649 | return NOTIFY_DONE; |
650 | |
651 | if (event_dev->flags & IFF_MASTER) { |
652 | + int ret; |
653 | + |
654 | netdev_dbg(event_dev, "IFF_MASTER\n"); |
655 | - return bond_master_netdev_event(event, event_dev); |
656 | + ret = bond_master_netdev_event(event, event_dev); |
657 | + if (ret != NOTIFY_DONE) |
658 | + return ret; |
659 | } |
660 | |
661 | if (event_dev->flags & IFF_SLAVE) { |
662 | diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c |
663 | index 375b6810bf46..b8874faaa813 100644 |
664 | --- a/drivers/net/team/team.c |
665 | +++ b/drivers/net/team/team.c |
666 | @@ -1251,6 +1251,23 @@ static int team_port_add(struct team *team, struct net_device *port_dev) |
667 | goto err_option_port_add; |
668 | } |
669 | |
670 | + /* set promiscuity level to new slave */ |
671 | + if (dev->flags & IFF_PROMISC) { |
672 | + err = dev_set_promiscuity(port_dev, 1); |
673 | + if (err) |
674 | + goto err_set_slave_promisc; |
675 | + } |
676 | + |
677 | + /* set allmulti level to new slave */ |
678 | + if (dev->flags & IFF_ALLMULTI) { |
679 | + err = dev_set_allmulti(port_dev, 1); |
680 | + if (err) { |
681 | + if (dev->flags & IFF_PROMISC) |
682 | + dev_set_promiscuity(port_dev, -1); |
683 | + goto err_set_slave_promisc; |
684 | + } |
685 | + } |
686 | + |
687 | netif_addr_lock_bh(dev); |
688 | dev_uc_sync_multiple(port_dev, dev); |
689 | dev_mc_sync_multiple(port_dev, dev); |
690 | @@ -1267,6 +1284,9 @@ static int team_port_add(struct team *team, struct net_device *port_dev) |
691 | |
692 | return 0; |
693 | |
694 | +err_set_slave_promisc: |
695 | + __team_option_inst_del_port(team, port); |
696 | + |
697 | err_option_port_add: |
698 | team_upper_dev_unlink(team, port); |
699 | |
700 | @@ -1312,6 +1332,12 @@ static int team_port_del(struct team *team, struct net_device *port_dev) |
701 | |
702 | team_port_disable(team, port); |
703 | list_del_rcu(&port->list); |
704 | + |
705 | + if (dev->flags & IFF_PROMISC) |
706 | + dev_set_promiscuity(port_dev, -1); |
707 | + if (dev->flags & IFF_ALLMULTI) |
708 | + dev_set_allmulti(port_dev, -1); |
709 | + |
710 | team_upper_dev_unlink(team, port); |
711 | netdev_rx_handler_unregister(port_dev); |
712 | team_port_disable_netpoll(port); |
713 | diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h |
714 | index f68d492129c6..822833a52dd3 100644 |
715 | --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h |
716 | +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h |
717 | @@ -669,7 +669,6 @@ enum rt2x00_state_flags { |
718 | CONFIG_CHANNEL_HT40, |
719 | CONFIG_POWERSAVING, |
720 | CONFIG_HT_DISABLED, |
721 | - CONFIG_QOS_DISABLED, |
722 | CONFIG_MONITORING, |
723 | |
724 | /* |
725 | diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c |
726 | index 987c7c4f43cd..55036ce5465c 100644 |
727 | --- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c |
728 | +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c |
729 | @@ -666,18 +666,8 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, |
730 | rt2x00dev->intf_associated--; |
731 | |
732 | rt2x00leds_led_assoc(rt2x00dev, !!rt2x00dev->intf_associated); |
733 | - |
734 | - clear_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags); |
735 | } |
736 | |
737 | - /* |
738 | - * Check for access point which do not support 802.11e . We have to |
739 | - * generate data frames sequence number in S/W for such AP, because |
740 | - * of H/W bug. |
741 | - */ |
742 | - if (changes & BSS_CHANGED_QOS && !bss_conf->qos) |
743 | - set_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags); |
744 | - |
745 | /* |
746 | * When the erp information has changed, we should perform |
747 | * additional configuration steps. For all other changes we are done. |
748 | diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c |
749 | index 68b620b2462f..9a15a69b96a6 100644 |
750 | --- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c |
751 | +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c |
752 | @@ -201,15 +201,18 @@ static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev, |
753 | if (!rt2x00_has_cap_flag(rt2x00dev, REQUIRE_SW_SEQNO)) { |
754 | /* |
755 | * rt2800 has a H/W (or F/W) bug, device incorrectly increase |
756 | - * seqno on retransmited data (non-QOS) frames. To workaround |
757 | - * the problem let's generate seqno in software if QOS is |
758 | - * disabled. |
759 | + * seqno on retransmitted data (non-QOS) and management frames. |
760 | + * To workaround the problem let's generate seqno in software. |
761 | + * Except for beacons which are transmitted periodically by H/W |
762 | + * hence hardware has to assign seqno for them. |
763 | */ |
764 | - if (test_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags)) |
765 | - __clear_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); |
766 | - else |
767 | + if (ieee80211_is_beacon(hdr->frame_control)) { |
768 | + __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); |
769 | /* H/W will generate sequence number */ |
770 | return; |
771 | + } |
772 | + |
773 | + __clear_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); |
774 | } |
775 | |
776 | /* |
777 | diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c |
778 | index e3ffd244603e..97aeaddd600d 100644 |
779 | --- a/drivers/scsi/libfc/fc_rport.c |
780 | +++ b/drivers/scsi/libfc/fc_rport.c |
781 | @@ -1935,7 +1935,6 @@ static void fc_rport_recv_logo_req(struct fc_lport *lport, struct fc_frame *fp) |
782 | FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n", |
783 | fc_rport_state(rdata)); |
784 | |
785 | - rdata->flags &= ~FC_RP_STARTED; |
786 | fc_rport_enter_delete(rdata, RPORT_EV_STOP); |
787 | mutex_unlock(&rdata->rp_mutex); |
788 | kref_put(&rdata->kref, rdata->local_port->tt.rport_destroy); |
789 | diff --git a/drivers/staging/comedi/drivers/ni_usb6501.c b/drivers/staging/comedi/drivers/ni_usb6501.c |
790 | index 5036eebb9162..2f174a34d9e9 100644 |
791 | --- a/drivers/staging/comedi/drivers/ni_usb6501.c |
792 | +++ b/drivers/staging/comedi/drivers/ni_usb6501.c |
793 | @@ -472,10 +472,8 @@ static int ni6501_alloc_usb_buffers(struct comedi_device *dev) |
794 | |
795 | size = usb_endpoint_maxp(devpriv->ep_tx); |
796 | devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL); |
797 | - if (!devpriv->usb_tx_buf) { |
798 | - kfree(devpriv->usb_rx_buf); |
799 | + if (!devpriv->usb_tx_buf) |
800 | return -ENOMEM; |
801 | - } |
802 | |
803 | return 0; |
804 | } |
805 | @@ -527,6 +525,9 @@ static int ni6501_auto_attach(struct comedi_device *dev, |
806 | if (!devpriv) |
807 | return -ENOMEM; |
808 | |
809 | + mutex_init(&devpriv->mut); |
810 | + usb_set_intfdata(intf, devpriv); |
811 | + |
812 | ret = ni6501_find_endpoints(dev); |
813 | if (ret) |
814 | return ret; |
815 | @@ -535,9 +536,6 @@ static int ni6501_auto_attach(struct comedi_device *dev, |
816 | if (ret) |
817 | return ret; |
818 | |
819 | - mutex_init(&devpriv->mut); |
820 | - usb_set_intfdata(intf, devpriv); |
821 | - |
822 | ret = comedi_alloc_subdevices(dev, 2); |
823 | if (ret) |
824 | return ret; |
825 | diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c |
826 | index a004aed0147a..1800eb3ae017 100644 |
827 | --- a/drivers/staging/comedi/drivers/vmk80xx.c |
828 | +++ b/drivers/staging/comedi/drivers/vmk80xx.c |
829 | @@ -691,10 +691,8 @@ static int vmk80xx_alloc_usb_buffers(struct comedi_device *dev) |
830 | |
831 | size = usb_endpoint_maxp(devpriv->ep_tx); |
832 | devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL); |
833 | - if (!devpriv->usb_tx_buf) { |
834 | - kfree(devpriv->usb_rx_buf); |
835 | + if (!devpriv->usb_tx_buf) |
836 | return -ENOMEM; |
837 | - } |
838 | |
839 | return 0; |
840 | } |
841 | @@ -809,6 +807,8 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, |
842 | |
843 | devpriv->model = board->model; |
844 | |
845 | + sema_init(&devpriv->limit_sem, 8); |
846 | + |
847 | ret = vmk80xx_find_usb_endpoints(dev); |
848 | if (ret) |
849 | return ret; |
850 | @@ -817,8 +817,6 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, |
851 | if (ret) |
852 | return ret; |
853 | |
854 | - sema_init(&devpriv->limit_sem, 8); |
855 | - |
856 | usb_set_intfdata(intf, devpriv); |
857 | |
858 | if (devpriv->model == VMK8055_MODEL) |
859 | diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c |
860 | index 4dc9ca3a11b4..b82a4ab77860 100644 |
861 | --- a/drivers/staging/iio/adc/ad7192.c |
862 | +++ b/drivers/staging/iio/adc/ad7192.c |
863 | @@ -109,10 +109,10 @@ |
864 | #define AD7192_CH_AIN3 BIT(6) /* AIN3 - AINCOM */ |
865 | #define AD7192_CH_AIN4 BIT(7) /* AIN4 - AINCOM */ |
866 | |
867 | -#define AD7193_CH_AIN1P_AIN2M 0x000 /* AIN1(+) - AIN2(-) */ |
868 | -#define AD7193_CH_AIN3P_AIN4M 0x001 /* AIN3(+) - AIN4(-) */ |
869 | -#define AD7193_CH_AIN5P_AIN6M 0x002 /* AIN5(+) - AIN6(-) */ |
870 | -#define AD7193_CH_AIN7P_AIN8M 0x004 /* AIN7(+) - AIN8(-) */ |
871 | +#define AD7193_CH_AIN1P_AIN2M 0x001 /* AIN1(+) - AIN2(-) */ |
872 | +#define AD7193_CH_AIN3P_AIN4M 0x002 /* AIN3(+) - AIN4(-) */ |
873 | +#define AD7193_CH_AIN5P_AIN6M 0x004 /* AIN5(+) - AIN6(-) */ |
874 | +#define AD7193_CH_AIN7P_AIN8M 0x008 /* AIN7(+) - AIN8(-) */ |
875 | #define AD7193_CH_TEMP 0x100 /* Temp senseor */ |
876 | #define AD7193_CH_AIN2P_AIN2M 0x200 /* AIN2(+) - AIN2(-) */ |
877 | #define AD7193_CH_AIN1 0x401 /* AIN1 - AINCOM */ |
878 | diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c |
879 | index 2383caf88b67..a54dbfe664cd 100644 |
880 | --- a/drivers/vhost/vhost.c |
881 | +++ b/drivers/vhost/vhost.c |
882 | @@ -863,8 +863,12 @@ static int vhost_new_umem_range(struct vhost_umem *umem, |
883 | u64 start, u64 size, u64 end, |
884 | u64 userspace_addr, int perm) |
885 | { |
886 | - struct vhost_umem_node *tmp, *node = kmalloc(sizeof(*node), GFP_ATOMIC); |
887 | + struct vhost_umem_node *tmp, *node; |
888 | |
889 | + if (!size) |
890 | + return -EFAULT; |
891 | + |
892 | + node = kmalloc(sizeof(*node), GFP_ATOMIC); |
893 | if (!node) |
894 | return -ENOMEM; |
895 | |
896 | diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h |
897 | index 4ed4736b5bc6..5367b684c1f7 100644 |
898 | --- a/fs/cifs/cifsglob.h |
899 | +++ b/fs/cifs/cifsglob.h |
900 | @@ -1157,6 +1157,7 @@ cifsFileInfo_get_locked(struct cifsFileInfo *cifs_file) |
901 | } |
902 | |
903 | struct cifsFileInfo *cifsFileInfo_get(struct cifsFileInfo *cifs_file); |
904 | +void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_hdlr); |
905 | void cifsFileInfo_put(struct cifsFileInfo *cifs_file); |
906 | |
907 | #define CIFS_CACHE_READ_FLG 1 |
908 | @@ -1651,6 +1652,7 @@ GLOBAL_EXTERN spinlock_t gidsidlock; |
909 | #endif /* CONFIG_CIFS_ACL */ |
910 | |
911 | void cifs_oplock_break(struct work_struct *work); |
912 | +void cifs_queue_oplock_break(struct cifsFileInfo *cfile); |
913 | |
914 | extern const struct slow_work_ops cifs_oplock_break_ops; |
915 | extern struct workqueue_struct *cifsiod_wq; |
916 | diff --git a/fs/cifs/file.c b/fs/cifs/file.c |
917 | index 7d295bf283ca..e7f1773b25d6 100644 |
918 | --- a/fs/cifs/file.c |
919 | +++ b/fs/cifs/file.c |
920 | @@ -358,12 +358,30 @@ cifsFileInfo_get(struct cifsFileInfo *cifs_file) |
921 | return cifs_file; |
922 | } |
923 | |
924 | -/* |
925 | - * Release a reference on the file private data. This may involve closing |
926 | - * the filehandle out on the server. Must be called without holding |
927 | - * tcon->open_file_lock and cifs_file->file_info_lock. |
928 | +/** |
929 | + * cifsFileInfo_put - release a reference of file priv data |
930 | + * |
931 | + * Always potentially wait for oplock handler. See _cifsFileInfo_put(). |
932 | */ |
933 | void cifsFileInfo_put(struct cifsFileInfo *cifs_file) |
934 | +{ |
935 | + _cifsFileInfo_put(cifs_file, true); |
936 | +} |
937 | + |
938 | +/** |
939 | + * _cifsFileInfo_put - release a reference of file priv data |
940 | + * |
941 | + * This may involve closing the filehandle @cifs_file out on the |
942 | + * server. Must be called without holding tcon->open_file_lock and |
943 | + * cifs_file->file_info_lock. |
944 | + * |
945 | + * If @wait_for_oplock_handler is true and we are releasing the last |
946 | + * reference, wait for any running oplock break handler of the file |
947 | + * and cancel any pending one. If calling this function from the |
948 | + * oplock break handler, you need to pass false. |
949 | + * |
950 | + */ |
951 | +void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler) |
952 | { |
953 | struct inode *inode = d_inode(cifs_file->dentry); |
954 | struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); |
955 | @@ -411,7 +429,8 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) |
956 | |
957 | spin_unlock(&tcon->open_file_lock); |
958 | |
959 | - oplock_break_cancelled = cancel_work_sync(&cifs_file->oplock_break); |
960 | + oplock_break_cancelled = wait_oplock_handler ? |
961 | + cancel_work_sync(&cifs_file->oplock_break) : false; |
962 | |
963 | if (!tcon->need_reconnect && !cifs_file->invalidHandle) { |
964 | struct TCP_Server_Info *server = tcon->ses->server; |
965 | @@ -3913,6 +3932,7 @@ void cifs_oplock_break(struct work_struct *work) |
966 | cinode); |
967 | cifs_dbg(FYI, "Oplock release rc = %d\n", rc); |
968 | } |
969 | + _cifsFileInfo_put(cfile, false /* do not wait for ourself */); |
970 | cifs_done_oplock_break(cinode); |
971 | } |
972 | |
973 | diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c |
974 | index 50559a80acf8..5e75df69062d 100644 |
975 | --- a/fs/cifs/misc.c |
976 | +++ b/fs/cifs/misc.c |
977 | @@ -494,8 +494,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) |
978 | CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, |
979 | &pCifsInode->flags); |
980 | |
981 | - queue_work(cifsoplockd_wq, |
982 | - &netfile->oplock_break); |
983 | + cifs_queue_oplock_break(netfile); |
984 | netfile->oplock_break_cancelled = false; |
985 | |
986 | spin_unlock(&tcon->open_file_lock); |
987 | @@ -592,6 +591,28 @@ void cifs_put_writer(struct cifsInodeInfo *cinode) |
988 | spin_unlock(&cinode->writers_lock); |
989 | } |
990 | |
991 | +/** |
992 | + * cifs_queue_oplock_break - queue the oplock break handler for cfile |
993 | + * |
994 | + * This function is called from the demultiplex thread when it |
995 | + * receives an oplock break for @cfile. |
996 | + * |
997 | + * Assumes the tcon->open_file_lock is held. |
998 | + * Assumes cfile->file_info_lock is NOT held. |
999 | + */ |
1000 | +void cifs_queue_oplock_break(struct cifsFileInfo *cfile) |
1001 | +{ |
1002 | + /* |
1003 | + * Bump the handle refcount now while we hold the |
1004 | + * open_file_lock to enforce the validity of it for the oplock |
1005 | + * break handler. The matching put is done at the end of the |
1006 | + * handler. |
1007 | + */ |
1008 | + cifsFileInfo_get(cfile); |
1009 | + |
1010 | + queue_work(cifsoplockd_wq, &cfile->oplock_break); |
1011 | +} |
1012 | + |
1013 | void cifs_done_oplock_break(struct cifsInodeInfo *cinode) |
1014 | { |
1015 | clear_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags); |
1016 | diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c |
1017 | index 244d27bb8fba..9994d15a32fc 100644 |
1018 | --- a/fs/cifs/smb2misc.c |
1019 | +++ b/fs/cifs/smb2misc.c |
1020 | @@ -512,7 +512,7 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp, |
1021 | clear_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, |
1022 | &cinode->flags); |
1023 | |
1024 | - queue_work(cifsoplockd_wq, &cfile->oplock_break); |
1025 | + cifs_queue_oplock_break(cfile); |
1026 | kfree(lw); |
1027 | return true; |
1028 | } |
1029 | @@ -656,8 +656,8 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) |
1030 | CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, |
1031 | &cinode->flags); |
1032 | spin_unlock(&cfile->file_info_lock); |
1033 | - queue_work(cifsoplockd_wq, |
1034 | - &cfile->oplock_break); |
1035 | + |
1036 | + cifs_queue_oplock_break(cfile); |
1037 | |
1038 | spin_unlock(&tcon->open_file_lock); |
1039 | spin_unlock(&cifs_tcp_ses_lock); |
1040 | diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h |
1041 | index e23392517db9..cb527c78de9f 100644 |
1042 | --- a/include/linux/kprobes.h |
1043 | +++ b/include/linux/kprobes.h |
1044 | @@ -197,6 +197,7 @@ struct kretprobe_instance { |
1045 | struct kretprobe *rp; |
1046 | kprobe_opcode_t *ret_addr; |
1047 | struct task_struct *task; |
1048 | + void *fp; |
1049 | char data[0]; |
1050 | }; |
1051 | |
1052 | diff --git a/kernel/kprobes.c b/kernel/kprobes.c |
1053 | index f580352cc6e5..e2845dd53b30 100644 |
1054 | --- a/kernel/kprobes.c |
1055 | +++ b/kernel/kprobes.c |
1056 | @@ -668,7 +668,6 @@ static void unoptimize_kprobe(struct kprobe *p, bool force) |
1057 | static int reuse_unused_kprobe(struct kprobe *ap) |
1058 | { |
1059 | struct optimized_kprobe *op; |
1060 | - int ret; |
1061 | |
1062 | BUG_ON(!kprobe_unused(ap)); |
1063 | /* |
1064 | @@ -682,9 +681,8 @@ static int reuse_unused_kprobe(struct kprobe *ap) |
1065 | /* Enable the probe again */ |
1066 | ap->flags &= ~KPROBE_FLAG_DISABLED; |
1067 | /* Optimize it again (remove from op->list) */ |
1068 | - ret = kprobe_optready(ap); |
1069 | - if (ret) |
1070 | - return ret; |
1071 | + if (!kprobe_optready(ap)) |
1072 | + return -EINVAL; |
1073 | |
1074 | optimize_kprobe(ap); |
1075 | return 0; |
1076 | diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c |
1077 | index d5b779d7e79f..26fc428476b9 100644 |
1078 | --- a/kernel/locking/lockdep.c |
1079 | +++ b/kernel/locking/lockdep.c |
1080 | @@ -3446,9 +3446,6 @@ __lock_set_class(struct lockdep_map *lock, const char *name, |
1081 | unsigned int depth; |
1082 | int i; |
1083 | |
1084 | - if (unlikely(!debug_locks)) |
1085 | - return 0; |
1086 | - |
1087 | depth = curr->lockdep_depth; |
1088 | /* |
1089 | * This function is about (re)setting the class of a held lock, |
1090 | diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
1091 | index 1c630d94f86b..4b1e0669740c 100644 |
1092 | --- a/kernel/sched/fair.c |
1093 | +++ b/kernel/sched/fair.c |
1094 | @@ -4347,12 +4347,15 @@ static enum hrtimer_restart sched_cfs_slack_timer(struct hrtimer *timer) |
1095 | return HRTIMER_NORESTART; |
1096 | } |
1097 | |
1098 | +extern const u64 max_cfs_quota_period; |
1099 | + |
1100 | static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer) |
1101 | { |
1102 | struct cfs_bandwidth *cfs_b = |
1103 | container_of(timer, struct cfs_bandwidth, period_timer); |
1104 | int overrun; |
1105 | int idle = 0; |
1106 | + int count = 0; |
1107 | |
1108 | raw_spin_lock(&cfs_b->lock); |
1109 | for (;;) { |
1110 | @@ -4360,6 +4363,28 @@ static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer) |
1111 | if (!overrun) |
1112 | break; |
1113 | |
1114 | + if (++count > 3) { |
1115 | + u64 new, old = ktime_to_ns(cfs_b->period); |
1116 | + |
1117 | + new = (old * 147) / 128; /* ~115% */ |
1118 | + new = min(new, max_cfs_quota_period); |
1119 | + |
1120 | + cfs_b->period = ns_to_ktime(new); |
1121 | + |
1122 | + /* since max is 1s, this is limited to 1e9^2, which fits in u64 */ |
1123 | + cfs_b->quota *= new; |
1124 | + cfs_b->quota = div64_u64(cfs_b->quota, old); |
1125 | + |
1126 | + pr_warn_ratelimited( |
1127 | + "cfs_period_timer[cpu%d]: period too short, scaling up (new cfs_period_us %lld, cfs_quota_us = %lld)\n", |
1128 | + smp_processor_id(), |
1129 | + div_u64(new, NSEC_PER_USEC), |
1130 | + div_u64(cfs_b->quota, NSEC_PER_USEC)); |
1131 | + |
1132 | + /* reset count so we don't come right back in here */ |
1133 | + count = 0; |
1134 | + } |
1135 | + |
1136 | idle = do_sched_cfs_period_timer(cfs_b, overrun); |
1137 | } |
1138 | if (idle) |
1139 | diff --git a/kernel/sysctl.c b/kernel/sysctl.c |
1140 | index 5515d578095b..cf0aeaae567e 100644 |
1141 | --- a/kernel/sysctl.c |
1142 | +++ b/kernel/sysctl.c |
1143 | @@ -124,6 +124,7 @@ static int zero; |
1144 | static int __maybe_unused one = 1; |
1145 | static int __maybe_unused two = 2; |
1146 | static int __maybe_unused four = 4; |
1147 | +static unsigned long zero_ul; |
1148 | static unsigned long one_ul = 1; |
1149 | static unsigned long long_max = LONG_MAX; |
1150 | static int one_hundred = 100; |
1151 | @@ -1683,7 +1684,7 @@ static struct ctl_table fs_table[] = { |
1152 | .maxlen = sizeof(files_stat.max_files), |
1153 | .mode = 0644, |
1154 | .proc_handler = proc_doulongvec_minmax, |
1155 | - .extra1 = &zero, |
1156 | + .extra1 = &zero_ul, |
1157 | .extra2 = &long_max, |
1158 | }, |
1159 | { |
1160 | diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
1161 | index 8f4227d4cd39..0043aef0ed8d 100644 |
1162 | --- a/kernel/trace/ftrace.c |
1163 | +++ b/kernel/trace/ftrace.c |
1164 | @@ -32,6 +32,7 @@ |
1165 | #include <linux/list.h> |
1166 | #include <linux/hash.h> |
1167 | #include <linux/rcupdate.h> |
1168 | +#include <linux/kprobes.h> |
1169 | |
1170 | #include <trace/events/sched.h> |
1171 | |
1172 | @@ -5246,7 +5247,7 @@ void ftrace_reset_array_ops(struct trace_array *tr) |
1173 | tr->ops->func = ftrace_stub; |
1174 | } |
1175 | |
1176 | -static inline void |
1177 | +static nokprobe_inline void |
1178 | __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, |
1179 | struct ftrace_ops *ignored, struct pt_regs *regs) |
1180 | { |
1181 | @@ -5309,11 +5310,13 @@ static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, |
1182 | { |
1183 | __ftrace_ops_list_func(ip, parent_ip, NULL, regs); |
1184 | } |
1185 | +NOKPROBE_SYMBOL(ftrace_ops_list_func); |
1186 | #else |
1187 | static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip) |
1188 | { |
1189 | __ftrace_ops_list_func(ip, parent_ip, NULL, NULL); |
1190 | } |
1191 | +NOKPROBE_SYMBOL(ftrace_ops_no_ops); |
1192 | #endif |
1193 | |
1194 | /* |
1195 | @@ -5343,6 +5346,7 @@ static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip, |
1196 | preempt_enable_notrace(); |
1197 | trace_clear_recursion(bit); |
1198 | } |
1199 | +NOKPROBE_SYMBOL(ftrace_ops_assist_func); |
1200 | |
1201 | /** |
1202 | * ftrace_ops_get_func - get the function a trampoline should call |
1203 | diff --git a/mm/percpu.c b/mm/percpu.c |
1204 | index 3794cfc88689..0462a2a00f05 100644 |
1205 | --- a/mm/percpu.c |
1206 | +++ b/mm/percpu.c |
1207 | @@ -2048,8 +2048,8 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size, |
1208 | ai->groups[group].base_offset = areas[group] - base; |
1209 | } |
1210 | |
1211 | - pr_info("Embedded %zu pages/cpu @%p s%zu r%zu d%zu u%zu\n", |
1212 | - PFN_DOWN(size_sum), base, ai->static_size, ai->reserved_size, |
1213 | + pr_info("Embedded %zu pages/cpu s%zu r%zu d%zu u%zu\n", |
1214 | + PFN_DOWN(size_sum), ai->static_size, ai->reserved_size, |
1215 | ai->dyn_size, ai->unit_size); |
1216 | |
1217 | rc = pcpu_setup_first_chunk(ai, base); |
1218 | @@ -2162,8 +2162,8 @@ int __init pcpu_page_first_chunk(size_t reserved_size, |
1219 | } |
1220 | |
1221 | /* we're ready, commit */ |
1222 | - pr_info("%d %s pages/cpu @%p s%zu r%zu d%zu\n", |
1223 | - unit_pages, psize_str, vm.addr, ai->static_size, |
1224 | + pr_info("%d %s pages/cpu s%zu r%zu d%zu\n", |
1225 | + unit_pages, psize_str, ai->static_size, |
1226 | ai->reserved_size, ai->dyn_size); |
1227 | |
1228 | rc = pcpu_setup_first_chunk(ai, vm.addr); |
1229 | diff --git a/mm/vmstat.c b/mm/vmstat.c |
1230 | index 5e6a4d76659d..9af8d369e112 100644 |
1231 | --- a/mm/vmstat.c |
1232 | +++ b/mm/vmstat.c |
1233 | @@ -1075,13 +1075,8 @@ const char * const vmstat_text[] = { |
1234 | #endif |
1235 | #endif /* CONFIG_MEMORY_BALLOON */ |
1236 | #ifdef CONFIG_DEBUG_TLBFLUSH |
1237 | -#ifdef CONFIG_SMP |
1238 | "nr_tlb_remote_flush", |
1239 | "nr_tlb_remote_flush_received", |
1240 | -#else |
1241 | - "", /* nr_tlb_remote_flush */ |
1242 | - "", /* nr_tlb_remote_flush_received */ |
1243 | -#endif /* CONFIG_SMP */ |
1244 | "nr_tlb_local_flush_all", |
1245 | "nr_tlb_local_flush_one", |
1246 | #endif /* CONFIG_DEBUG_TLBFLUSH */ |
1247 | diff --git a/net/atm/lec.c b/net/atm/lec.c |
1248 | index 1e84c5226c84..704892d79bf1 100644 |
1249 | --- a/net/atm/lec.c |
1250 | +++ b/net/atm/lec.c |
1251 | @@ -721,7 +721,10 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg) |
1252 | |
1253 | static int lec_mcast_attach(struct atm_vcc *vcc, int arg) |
1254 | { |
1255 | - if (arg < 0 || arg >= MAX_LEC_ITF || !dev_lec[arg]) |
1256 | + if (arg < 0 || arg >= MAX_LEC_ITF) |
1257 | + return -EINVAL; |
1258 | + arg = array_index_nospec(arg, MAX_LEC_ITF); |
1259 | + if (!dev_lec[arg]) |
1260 | return -EINVAL; |
1261 | vcc->proto_data = dev_lec[arg]; |
1262 | return lec_mcast_make(netdev_priv(dev_lec[arg]), vcc); |
1263 | @@ -739,6 +742,7 @@ static int lecd_attach(struct atm_vcc *vcc, int arg) |
1264 | i = arg; |
1265 | if (arg >= MAX_LEC_ITF) |
1266 | return -EINVAL; |
1267 | + i = array_index_nospec(arg, MAX_LEC_ITF); |
1268 | if (!dev_lec[i]) { |
1269 | int size; |
1270 | |
1271 | diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c |
1272 | index 267b46af407f..c615dff40ab4 100644 |
1273 | --- a/net/bridge/br_input.c |
1274 | +++ b/net/bridge/br_input.c |
1275 | @@ -231,13 +231,10 @@ static void __br_handle_local_finish(struct sk_buff *skb) |
1276 | /* note: already called with rcu_read_lock */ |
1277 | static int br_handle_local_finish(struct net *net, struct sock *sk, struct sk_buff *skb) |
1278 | { |
1279 | - struct net_bridge_port *p = br_port_get_rcu(skb->dev); |
1280 | - |
1281 | __br_handle_local_finish(skb); |
1282 | |
1283 | - BR_INPUT_SKB_CB(skb)->brdev = p->br->dev; |
1284 | - br_pass_frame_up(skb); |
1285 | - return 0; |
1286 | + /* return 1 to signal the okfn() was called so it's ok to use the skb */ |
1287 | + return 1; |
1288 | } |
1289 | |
1290 | /* |
1291 | @@ -308,10 +305,18 @@ rx_handler_result_t br_handle_frame(struct sk_buff **pskb) |
1292 | goto forward; |
1293 | } |
1294 | |
1295 | - /* Deliver packet to local host only */ |
1296 | - NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, dev_net(skb->dev), |
1297 | - NULL, skb, skb->dev, NULL, br_handle_local_finish); |
1298 | - return RX_HANDLER_CONSUMED; |
1299 | + /* The else clause should be hit when nf_hook(): |
1300 | + * - returns < 0 (drop/error) |
1301 | + * - returns = 0 (stolen/nf_queue) |
1302 | + * Thus return 1 from the okfn() to signal the skb is ok to pass |
1303 | + */ |
1304 | + if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, |
1305 | + dev_net(skb->dev), NULL, skb, skb->dev, NULL, |
1306 | + br_handle_local_finish) == 1) { |
1307 | + return RX_HANDLER_PASS; |
1308 | + } else { |
1309 | + return RX_HANDLER_CONSUMED; |
1310 | + } |
1311 | } |
1312 | |
1313 | forward: |
1314 | diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c |
1315 | index 2136e45f5277..964ffff90432 100644 |
1316 | --- a/net/bridge/br_multicast.c |
1317 | +++ b/net/bridge/br_multicast.c |
1318 | @@ -1983,7 +1983,8 @@ static void br_multicast_start_querier(struct net_bridge *br, |
1319 | |
1320 | __br_multicast_open(br, query); |
1321 | |
1322 | - list_for_each_entry(port, &br->port_list, list) { |
1323 | + rcu_read_lock(); |
1324 | + list_for_each_entry_rcu(port, &br->port_list, list) { |
1325 | if (port->state == BR_STATE_DISABLED || |
1326 | port->state == BR_STATE_BLOCKING) |
1327 | continue; |
1328 | @@ -1995,6 +1996,7 @@ static void br_multicast_start_querier(struct net_bridge *br, |
1329 | br_multicast_enable(&port->ip6_own_query); |
1330 | #endif |
1331 | } |
1332 | + rcu_read_unlock(); |
1333 | } |
1334 | |
1335 | int br_multicast_toggle(struct net_bridge *br, unsigned long val) |
1336 | diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c |
1337 | index 030d1531e897..17acc89f9dec 100644 |
1338 | --- a/net/ipv4/fou.c |
1339 | +++ b/net/ipv4/fou.c |
1340 | @@ -119,6 +119,7 @@ static int gue_udp_recv(struct sock *sk, struct sk_buff *skb) |
1341 | struct guehdr *guehdr; |
1342 | void *data; |
1343 | u16 doffset = 0; |
1344 | + u8 proto_ctype; |
1345 | |
1346 | if (!fou) |
1347 | return 1; |
1348 | @@ -210,13 +211,14 @@ static int gue_udp_recv(struct sock *sk, struct sk_buff *skb) |
1349 | if (unlikely(guehdr->control)) |
1350 | return gue_control_message(skb, guehdr); |
1351 | |
1352 | + proto_ctype = guehdr->proto_ctype; |
1353 | __skb_pull(skb, sizeof(struct udphdr) + hdrlen); |
1354 | skb_reset_transport_header(skb); |
1355 | |
1356 | if (iptunnel_pull_offloads(skb)) |
1357 | goto drop; |
1358 | |
1359 | - return -guehdr->proto_ctype; |
1360 | + return -proto_ctype; |
1361 | |
1362 | drop: |
1363 | kfree_skb(skb); |
1364 | diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
1365 | index c42fb2330b45..0e2cf9634541 100644 |
1366 | --- a/net/ipv4/route.c |
1367 | +++ b/net/ipv4/route.c |
1368 | @@ -1170,9 +1170,23 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) |
1369 | |
1370 | static void ipv4_link_failure(struct sk_buff *skb) |
1371 | { |
1372 | + struct ip_options opt; |
1373 | struct rtable *rt; |
1374 | + int res; |
1375 | + |
1376 | + /* Recompile ip options since IPCB may not be valid anymore. |
1377 | + */ |
1378 | + memset(&opt, 0, sizeof(opt)); |
1379 | + opt.optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr); |
1380 | + |
1381 | + rcu_read_lock(); |
1382 | + res = __ip_options_compile(dev_net(skb->dev), &opt, skb, NULL); |
1383 | + rcu_read_unlock(); |
1384 | + |
1385 | + if (res) |
1386 | + return; |
1387 | |
1388 | - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); |
1389 | + __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0, &opt); |
1390 | |
1391 | rt = skb_rtable(skb); |
1392 | if (rt) |
1393 | diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
1394 | index cd4f13dda49e..e238539c3497 100644 |
1395 | --- a/net/ipv4/tcp_input.c |
1396 | +++ b/net/ipv4/tcp_input.c |
1397 | @@ -389,11 +389,12 @@ static int __tcp_grow_window(const struct sock *sk, const struct sk_buff *skb) |
1398 | static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) |
1399 | { |
1400 | struct tcp_sock *tp = tcp_sk(sk); |
1401 | + int room; |
1402 | + |
1403 | + room = min_t(int, tp->window_clamp, tcp_space(sk)) - tp->rcv_ssthresh; |
1404 | |
1405 | /* Check #1 */ |
1406 | - if (tp->rcv_ssthresh < tp->window_clamp && |
1407 | - (int)tp->rcv_ssthresh < tcp_space(sk) && |
1408 | - !tcp_under_memory_pressure(sk)) { |
1409 | + if (room > 0 && !tcp_under_memory_pressure(sk)) { |
1410 | int incr; |
1411 | |
1412 | /* Check #2. Increase window, if skb with such overhead |
1413 | @@ -406,8 +407,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) |
1414 | |
1415 | if (incr) { |
1416 | incr = max_t(int, incr, 2 * skb->len); |
1417 | - tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, |
1418 | - tp->window_clamp); |
1419 | + tp->rcv_ssthresh += min(room, incr); |
1420 | inet_csk(sk)->icsk_ack.quick |= 1; |
1421 | } |
1422 | } |
1423 | diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h |
1424 | index 49c8a9c9b91f..1a169de60192 100644 |
1425 | --- a/net/mac80211/driver-ops.h |
1426 | +++ b/net/mac80211/driver-ops.h |
1427 | @@ -1163,6 +1163,9 @@ static inline void drv_wake_tx_queue(struct ieee80211_local *local, |
1428 | { |
1429 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif); |
1430 | |
1431 | + if (local->in_reconfig) |
1432 | + return; |
1433 | + |
1434 | if (!check_sdata_in_driver(sdata)) |
1435 | return; |
1436 | |
1437 | diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c |
1438 | index 29d6699d5a06..55b4c0dc2b93 100644 |
1439 | --- a/scripts/mod/file2alias.c |
1440 | +++ b/scripts/mod/file2alias.c |
1441 | @@ -47,49 +47,9 @@ typedef struct { |
1442 | struct devtable { |
1443 | const char *device_id; /* name of table, __mod_<name>__*_device_table. */ |
1444 | unsigned long id_size; |
1445 | - void *function; |
1446 | + int (*do_entry)(const char *filename, void *symval, char *alias); |
1447 | }; |
1448 | |
1449 | -#define ___cat(a,b) a ## b |
1450 | -#define __cat(a,b) ___cat(a,b) |
1451 | - |
1452 | -/* we need some special handling for this host tool running eventually on |
1453 | - * Darwin. The Mach-O section handling is a bit different than ELF section |
1454 | - * handling. The differnces in detail are: |
1455 | - * a) we have segments which have sections |
1456 | - * b) we need a API call to get the respective section symbols */ |
1457 | -#if defined(__MACH__) |
1458 | -#include <mach-o/getsect.h> |
1459 | - |
1460 | -#define INIT_SECTION(name) do { \ |
1461 | - unsigned long name ## _len; \ |
1462 | - char *__cat(pstart_,name) = getsectdata("__TEXT", \ |
1463 | - #name, &__cat(name,_len)); \ |
1464 | - char *__cat(pstop_,name) = __cat(pstart_,name) + \ |
1465 | - __cat(name, _len); \ |
1466 | - __cat(__start_,name) = (void *)__cat(pstart_,name); \ |
1467 | - __cat(__stop_,name) = (void *)__cat(pstop_,name); \ |
1468 | - } while (0) |
1469 | -#define SECTION(name) __attribute__((section("__TEXT, " #name))) |
1470 | - |
1471 | -struct devtable **__start___devtable, **__stop___devtable; |
1472 | -#else |
1473 | -#define INIT_SECTION(name) /* no-op for ELF */ |
1474 | -#define SECTION(name) __attribute__((section(#name))) |
1475 | - |
1476 | -/* We construct a table of pointers in an ELF section (pointers generally |
1477 | - * go unpadded by gcc). ld creates boundary syms for us. */ |
1478 | -extern struct devtable *__start___devtable[], *__stop___devtable[]; |
1479 | -#endif /* __MACH__ */ |
1480 | - |
1481 | -#if !defined(__used) |
1482 | -# if __GNUC__ == 3 && __GNUC_MINOR__ < 3 |
1483 | -# define __used __attribute__((__unused__)) |
1484 | -# else |
1485 | -# define __used __attribute__((__used__)) |
1486 | -# endif |
1487 | -#endif |
1488 | - |
1489 | /* Define a variable f that holds the value of field f of struct devid |
1490 | * based at address m. |
1491 | */ |
1492 | @@ -102,16 +62,6 @@ extern struct devtable *__start___devtable[], *__stop___devtable[]; |
1493 | #define DEF_FIELD_ADDR(m, devid, f) \ |
1494 | typeof(((struct devid *)0)->f) *f = ((m) + OFF_##devid##_##f) |
1495 | |
1496 | -/* Add a table entry. We test function type matches while we're here. */ |
1497 | -#define ADD_TO_DEVTABLE(device_id, type, function) \ |
1498 | - static struct devtable __cat(devtable,__LINE__) = { \ |
1499 | - device_id + 0*sizeof((function)((const char *)NULL, \ |
1500 | - (void *)NULL, \ |
1501 | - (char *)NULL)), \ |
1502 | - SIZE_##type, (function) }; \ |
1503 | - static struct devtable *SECTION(__devtable) __used \ |
1504 | - __cat(devtable_ptr,__LINE__) = &__cat(devtable,__LINE__) |
1505 | - |
1506 | #define ADD(str, sep, cond, field) \ |
1507 | do { \ |
1508 | strcat(str, sep); \ |
1509 | @@ -431,7 +381,6 @@ static int do_hid_entry(const char *filename, |
1510 | |
1511 | return 1; |
1512 | } |
1513 | -ADD_TO_DEVTABLE("hid", hid_device_id, do_hid_entry); |
1514 | |
1515 | /* Looks like: ieee1394:venNmoNspNverN */ |
1516 | static int do_ieee1394_entry(const char *filename, |
1517 | @@ -456,7 +405,6 @@ static int do_ieee1394_entry(const char *filename, |
1518 | add_wildcard(alias); |
1519 | return 1; |
1520 | } |
1521 | -ADD_TO_DEVTABLE("ieee1394", ieee1394_device_id, do_ieee1394_entry); |
1522 | |
1523 | /* Looks like: pci:vNdNsvNsdNbcNscNiN. */ |
1524 | static int do_pci_entry(const char *filename, |
1525 | @@ -500,7 +448,6 @@ static int do_pci_entry(const char *filename, |
1526 | add_wildcard(alias); |
1527 | return 1; |
1528 | } |
1529 | -ADD_TO_DEVTABLE("pci", pci_device_id, do_pci_entry); |
1530 | |
1531 | /* looks like: "ccw:tNmNdtNdmN" */ |
1532 | static int do_ccw_entry(const char *filename, |
1533 | @@ -524,7 +471,6 @@ static int do_ccw_entry(const char *filename, |
1534 | add_wildcard(alias); |
1535 | return 1; |
1536 | } |
1537 | -ADD_TO_DEVTABLE("ccw", ccw_device_id, do_ccw_entry); |
1538 | |
1539 | /* looks like: "ap:tN" */ |
1540 | static int do_ap_entry(const char *filename, |
1541 | @@ -535,7 +481,6 @@ static int do_ap_entry(const char *filename, |
1542 | sprintf(alias, "ap:t%02X*", dev_type); |
1543 | return 1; |
1544 | } |
1545 | -ADD_TO_DEVTABLE("ap", ap_device_id, do_ap_entry); |
1546 | |
1547 | /* looks like: "css:tN" */ |
1548 | static int do_css_entry(const char *filename, |
1549 | @@ -546,7 +491,6 @@ static int do_css_entry(const char *filename, |
1550 | sprintf(alias, "css:t%01X", type); |
1551 | return 1; |
1552 | } |
1553 | -ADD_TO_DEVTABLE("css", css_device_id, do_css_entry); |
1554 | |
1555 | /* Looks like: "serio:tyNprNidNexN" */ |
1556 | static int do_serio_entry(const char *filename, |
1557 | @@ -566,7 +510,6 @@ static int do_serio_entry(const char *filename, |
1558 | add_wildcard(alias); |
1559 | return 1; |
1560 | } |
1561 | -ADD_TO_DEVTABLE("serio", serio_device_id, do_serio_entry); |
1562 | |
1563 | /* looks like: "acpi:ACPI0003" or "acpi:PNP0C0B" or "acpi:LNXVIDEO" or |
1564 | * "acpi:bbsspp" (bb=base-class, ss=sub-class, pp=prog-if) |
1565 | @@ -604,7 +547,6 @@ static int do_acpi_entry(const char *filename, |
1566 | } |
1567 | return 1; |
1568 | } |
1569 | -ADD_TO_DEVTABLE("acpi", acpi_device_id, do_acpi_entry); |
1570 | |
1571 | /* looks like: "pnp:dD" */ |
1572 | static void do_pnp_device_entry(void *symval, unsigned long size, |
1573 | @@ -725,7 +667,6 @@ static int do_pcmcia_entry(const char *filename, |
1574 | add_wildcard(alias); |
1575 | return 1; |
1576 | } |
1577 | -ADD_TO_DEVTABLE("pcmcia", pcmcia_device_id, do_pcmcia_entry); |
1578 | |
1579 | static int do_vio_entry(const char *filename, void *symval, |
1580 | char *alias) |
1581 | @@ -745,7 +686,6 @@ static int do_vio_entry(const char *filename, void *symval, |
1582 | add_wildcard(alias); |
1583 | return 1; |
1584 | } |
1585 | -ADD_TO_DEVTABLE("vio", vio_device_id, do_vio_entry); |
1586 | |
1587 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
1588 | |
1589 | @@ -818,7 +758,6 @@ static int do_input_entry(const char *filename, void *symval, |
1590 | do_input(alias, *swbit, 0, INPUT_DEVICE_ID_SW_MAX); |
1591 | return 1; |
1592 | } |
1593 | -ADD_TO_DEVTABLE("input", input_device_id, do_input_entry); |
1594 | |
1595 | static int do_eisa_entry(const char *filename, void *symval, |
1596 | char *alias) |
1597 | @@ -830,7 +769,6 @@ static int do_eisa_entry(const char *filename, void *symval, |
1598 | strcat(alias, "*"); |
1599 | return 1; |
1600 | } |
1601 | -ADD_TO_DEVTABLE("eisa", eisa_device_id, do_eisa_entry); |
1602 | |
1603 | /* Looks like: parisc:tNhvNrevNsvN */ |
1604 | static int do_parisc_entry(const char *filename, void *symval, |
1605 | @@ -850,7 +788,6 @@ static int do_parisc_entry(const char *filename, void *symval, |
1606 | add_wildcard(alias); |
1607 | return 1; |
1608 | } |
1609 | -ADD_TO_DEVTABLE("parisc", parisc_device_id, do_parisc_entry); |
1610 | |
1611 | /* Looks like: sdio:cNvNdN. */ |
1612 | static int do_sdio_entry(const char *filename, |
1613 | @@ -867,7 +804,6 @@ static int do_sdio_entry(const char *filename, |
1614 | add_wildcard(alias); |
1615 | return 1; |
1616 | } |
1617 | -ADD_TO_DEVTABLE("sdio", sdio_device_id, do_sdio_entry); |
1618 | |
1619 | /* Looks like: ssb:vNidNrevN. */ |
1620 | static int do_ssb_entry(const char *filename, |
1621 | @@ -884,7 +820,6 @@ static int do_ssb_entry(const char *filename, |
1622 | add_wildcard(alias); |
1623 | return 1; |
1624 | } |
1625 | -ADD_TO_DEVTABLE("ssb", ssb_device_id, do_ssb_entry); |
1626 | |
1627 | /* Looks like: bcma:mNidNrevNclN. */ |
1628 | static int do_bcma_entry(const char *filename, |
1629 | @@ -903,7 +838,6 @@ static int do_bcma_entry(const char *filename, |
1630 | add_wildcard(alias); |
1631 | return 1; |
1632 | } |
1633 | -ADD_TO_DEVTABLE("bcma", bcma_device_id, do_bcma_entry); |
1634 | |
1635 | /* Looks like: virtio:dNvN */ |
1636 | static int do_virtio_entry(const char *filename, void *symval, |
1637 | @@ -919,7 +853,6 @@ static int do_virtio_entry(const char *filename, void *symval, |
1638 | add_wildcard(alias); |
1639 | return 1; |
1640 | } |
1641 | -ADD_TO_DEVTABLE("virtio", virtio_device_id, do_virtio_entry); |
1642 | |
1643 | /* |
1644 | * Looks like: vmbus:guid |
1645 | @@ -942,7 +875,6 @@ static int do_vmbus_entry(const char *filename, void *symval, |
1646 | |
1647 | return 1; |
1648 | } |
1649 | -ADD_TO_DEVTABLE("vmbus", hv_vmbus_device_id, do_vmbus_entry); |
1650 | |
1651 | /* Looks like: i2c:S */ |
1652 | static int do_i2c_entry(const char *filename, void *symval, |
1653 | @@ -953,7 +885,6 @@ static int do_i2c_entry(const char *filename, void *symval, |
1654 | |
1655 | return 1; |
1656 | } |
1657 | -ADD_TO_DEVTABLE("i2c", i2c_device_id, do_i2c_entry); |
1658 | |
1659 | /* Looks like: spi:S */ |
1660 | static int do_spi_entry(const char *filename, void *symval, |
1661 | @@ -964,7 +895,6 @@ static int do_spi_entry(const char *filename, void *symval, |
1662 | |
1663 | return 1; |
1664 | } |
1665 | -ADD_TO_DEVTABLE("spi", spi_device_id, do_spi_entry); |
1666 | |
1667 | static const struct dmifield { |
1668 | const char *prefix; |
1669 | @@ -1019,7 +949,6 @@ static int do_dmi_entry(const char *filename, void *symval, |
1670 | strcat(alias, ":"); |
1671 | return 1; |
1672 | } |
1673 | -ADD_TO_DEVTABLE("dmi", dmi_system_id, do_dmi_entry); |
1674 | |
1675 | static int do_platform_entry(const char *filename, |
1676 | void *symval, char *alias) |
1677 | @@ -1028,7 +957,6 @@ static int do_platform_entry(const char *filename, |
1678 | sprintf(alias, PLATFORM_MODULE_PREFIX "%s", *name); |
1679 | return 1; |
1680 | } |
1681 | -ADD_TO_DEVTABLE("platform", platform_device_id, do_platform_entry); |
1682 | |
1683 | static int do_mdio_entry(const char *filename, |
1684 | void *symval, char *alias) |
1685 | @@ -1053,7 +981,6 @@ static int do_mdio_entry(const char *filename, |
1686 | |
1687 | return 1; |
1688 | } |
1689 | -ADD_TO_DEVTABLE("mdio", mdio_device_id, do_mdio_entry); |
1690 | |
1691 | /* Looks like: zorro:iN. */ |
1692 | static int do_zorro_entry(const char *filename, void *symval, |
1693 | @@ -1064,7 +991,6 @@ static int do_zorro_entry(const char *filename, void *symval, |
1694 | ADD(alias, "i", id != ZORRO_WILDCARD, id); |
1695 | return 1; |
1696 | } |
1697 | -ADD_TO_DEVTABLE("zorro", zorro_device_id, do_zorro_entry); |
1698 | |
1699 | /* looks like: "pnp:dD" */ |
1700 | static int do_isapnp_entry(const char *filename, |
1701 | @@ -1080,7 +1006,6 @@ static int do_isapnp_entry(const char *filename, |
1702 | (function >> 12) & 0x0f, (function >> 8) & 0x0f); |
1703 | return 1; |
1704 | } |
1705 | -ADD_TO_DEVTABLE("isapnp", isapnp_device_id, do_isapnp_entry); |
1706 | |
1707 | /* Looks like: "ipack:fNvNdN". */ |
1708 | static int do_ipack_entry(const char *filename, |
1709 | @@ -1096,7 +1021,6 @@ static int do_ipack_entry(const char *filename, |
1710 | add_wildcard(alias); |
1711 | return 1; |
1712 | } |
1713 | -ADD_TO_DEVTABLE("ipack", ipack_device_id, do_ipack_entry); |
1714 | |
1715 | /* |
1716 | * Append a match expression for a single masked hex digit. |
1717 | @@ -1167,7 +1091,6 @@ static int do_amba_entry(const char *filename, |
1718 | |
1719 | return 1; |
1720 | } |
1721 | -ADD_TO_DEVTABLE("amba", amba_id, do_amba_entry); |
1722 | |
1723 | /* |
1724 | * looks like: "mipscdmm:tN" |
1725 | @@ -1183,7 +1106,6 @@ static int do_mips_cdmm_entry(const char *filename, |
1726 | sprintf(alias, "mipscdmm:t%02X*", type); |
1727 | return 1; |
1728 | } |
1729 | -ADD_TO_DEVTABLE("mipscdmm", mips_cdmm_device_id, do_mips_cdmm_entry); |
1730 | |
1731 | /* LOOKS like cpu:type:x86,venVVVVfamFFFFmodMMMM:feature:*,FEAT,* |
1732 | * All fields are numbers. It would be nicer to use strings for vendor |
1733 | @@ -1208,7 +1130,6 @@ static int do_x86cpu_entry(const char *filename, void *symval, |
1734 | sprintf(alias + strlen(alias), "%04X*", feature); |
1735 | return 1; |
1736 | } |
1737 | -ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry); |
1738 | |
1739 | /* LOOKS like cpu:type:*:feature:*FEAT* */ |
1740 | static int do_cpu_entry(const char *filename, void *symval, char *alias) |
1741 | @@ -1218,7 +1139,6 @@ static int do_cpu_entry(const char *filename, void *symval, char *alias) |
1742 | sprintf(alias, "cpu:type:*:feature:*%04X*", feature); |
1743 | return 1; |
1744 | } |
1745 | -ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry); |
1746 | |
1747 | /* Looks like: mei:S:uuid:N:* */ |
1748 | static int do_mei_entry(const char *filename, void *symval, |
1749 | @@ -1237,7 +1157,6 @@ static int do_mei_entry(const char *filename, void *symval, |
1750 | |
1751 | return 1; |
1752 | } |
1753 | -ADD_TO_DEVTABLE("mei", mei_cl_device_id, do_mei_entry); |
1754 | |
1755 | /* Looks like: rapidio:vNdNavNadN */ |
1756 | static int do_rio_entry(const char *filename, |
1757 | @@ -1257,7 +1176,6 @@ static int do_rio_entry(const char *filename, |
1758 | add_wildcard(alias); |
1759 | return 1; |
1760 | } |
1761 | -ADD_TO_DEVTABLE("rapidio", rio_device_id, do_rio_entry); |
1762 | |
1763 | /* Looks like: ulpi:vNpN */ |
1764 | static int do_ulpi_entry(const char *filename, void *symval, |
1765 | @@ -1270,7 +1188,6 @@ static int do_ulpi_entry(const char *filename, void *symval, |
1766 | |
1767 | return 1; |
1768 | } |
1769 | -ADD_TO_DEVTABLE("ulpi", ulpi_device_id, do_ulpi_entry); |
1770 | |
1771 | /* Looks like: hdaudio:vNrNaN */ |
1772 | static int do_hda_entry(const char *filename, void *symval, char *alias) |
1773 | @@ -1287,7 +1204,6 @@ static int do_hda_entry(const char *filename, void *symval, char *alias) |
1774 | add_wildcard(alias); |
1775 | return 1; |
1776 | } |
1777 | -ADD_TO_DEVTABLE("hdaudio", hda_device_id, do_hda_entry); |
1778 | |
1779 | /* Looks like: fsl-mc:vNdN */ |
1780 | static int do_fsl_mc_entry(const char *filename, void *symval, |
1781 | @@ -1299,7 +1215,6 @@ static int do_fsl_mc_entry(const char *filename, void *symval, |
1782 | sprintf(alias, "fsl-mc:v%08Xd%s", vendor, *obj_type); |
1783 | return 1; |
1784 | } |
1785 | -ADD_TO_DEVTABLE("fslmc", fsl_mc_device_id, do_fsl_mc_entry); |
1786 | |
1787 | /* Does namelen bytes of name exactly match the symbol? */ |
1788 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) |
1789 | @@ -1313,12 +1228,11 @@ static bool sym_is(const char *name, unsigned namelen, const char *symbol) |
1790 | static void do_table(void *symval, unsigned long size, |
1791 | unsigned long id_size, |
1792 | const char *device_id, |
1793 | - void *function, |
1794 | + int (*do_entry)(const char *filename, void *symval, char *alias), |
1795 | struct module *mod) |
1796 | { |
1797 | unsigned int i; |
1798 | char alias[500]; |
1799 | - int (*do_entry)(const char *, void *entry, char *alias) = function; |
1800 | |
1801 | device_id_check(mod->name, device_id, size, id_size, symval); |
1802 | /* Leave last one: it's the terminator. */ |
1803 | @@ -1332,6 +1246,44 @@ static void do_table(void *symval, unsigned long size, |
1804 | } |
1805 | } |
1806 | |
1807 | +static const struct devtable devtable[] = { |
1808 | + {"hid", SIZE_hid_device_id, do_hid_entry}, |
1809 | + {"ieee1394", SIZE_ieee1394_device_id, do_ieee1394_entry}, |
1810 | + {"pci", SIZE_pci_device_id, do_pci_entry}, |
1811 | + {"ccw", SIZE_ccw_device_id, do_ccw_entry}, |
1812 | + {"ap", SIZE_ap_device_id, do_ap_entry}, |
1813 | + {"css", SIZE_css_device_id, do_css_entry}, |
1814 | + {"serio", SIZE_serio_device_id, do_serio_entry}, |
1815 | + {"acpi", SIZE_acpi_device_id, do_acpi_entry}, |
1816 | + {"pcmcia", SIZE_pcmcia_device_id, do_pcmcia_entry}, |
1817 | + {"vio", SIZE_vio_device_id, do_vio_entry}, |
1818 | + {"input", SIZE_input_device_id, do_input_entry}, |
1819 | + {"eisa", SIZE_eisa_device_id, do_eisa_entry}, |
1820 | + {"parisc", SIZE_parisc_device_id, do_parisc_entry}, |
1821 | + {"sdio", SIZE_sdio_device_id, do_sdio_entry}, |
1822 | + {"ssb", SIZE_ssb_device_id, do_ssb_entry}, |
1823 | + {"bcma", SIZE_bcma_device_id, do_bcma_entry}, |
1824 | + {"virtio", SIZE_virtio_device_id, do_virtio_entry}, |
1825 | + {"vmbus", SIZE_hv_vmbus_device_id, do_vmbus_entry}, |
1826 | + {"i2c", SIZE_i2c_device_id, do_i2c_entry}, |
1827 | + {"spi", SIZE_spi_device_id, do_spi_entry}, |
1828 | + {"dmi", SIZE_dmi_system_id, do_dmi_entry}, |
1829 | + {"platform", SIZE_platform_device_id, do_platform_entry}, |
1830 | + {"mdio", SIZE_mdio_device_id, do_mdio_entry}, |
1831 | + {"zorro", SIZE_zorro_device_id, do_zorro_entry}, |
1832 | + {"isapnp", SIZE_isapnp_device_id, do_isapnp_entry}, |
1833 | + {"ipack", SIZE_ipack_device_id, do_ipack_entry}, |
1834 | + {"amba", SIZE_amba_id, do_amba_entry}, |
1835 | + {"mipscdmm", SIZE_mips_cdmm_device_id, do_mips_cdmm_entry}, |
1836 | + {"x86cpu", SIZE_x86_cpu_id, do_x86cpu_entry}, |
1837 | + {"cpu", SIZE_cpu_feature, do_cpu_entry}, |
1838 | + {"mei", SIZE_mei_cl_device_id, do_mei_entry}, |
1839 | + {"rapidio", SIZE_rio_device_id, do_rio_entry}, |
1840 | + {"ulpi", SIZE_ulpi_device_id, do_ulpi_entry}, |
1841 | + {"hdaudio", SIZE_hda_device_id, do_hda_entry}, |
1842 | + {"fslmc", SIZE_fsl_mc_device_id, do_fsl_mc_entry}, |
1843 | +}; |
1844 | + |
1845 | /* Create MODULE_ALIAS() statements. |
1846 | * At this time, we cannot write the actual output C source yet, |
1847 | * so we write into the mod->dev_table_buf buffer. */ |
1848 | @@ -1386,13 +1338,14 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, |
1849 | else if (sym_is(name, namelen, "pnp_card")) |
1850 | do_pnp_card_entries(symval, sym->st_size, mod); |
1851 | else { |
1852 | - struct devtable **p; |
1853 | - INIT_SECTION(__devtable); |
1854 | + int i; |
1855 | + |
1856 | + for (i = 0; i < ARRAY_SIZE(devtable); i++) { |
1857 | + const struct devtable *p = &devtable[i]; |
1858 | |
1859 | - for (p = __start___devtable; p < __stop___devtable; p++) { |
1860 | - if (sym_is(name, namelen, (*p)->device_id)) { |
1861 | - do_table(symval, sym->st_size, (*p)->id_size, |
1862 | - (*p)->device_id, (*p)->function, mod); |
1863 | + if (sym_is(name, namelen, p->device_id)) { |
1864 | + do_table(symval, sym->st_size, p->id_size, |
1865 | + p->device_id, p->do_entry, mod); |
1866 | break; |
1867 | } |
1868 | } |
1869 | diff --git a/security/device_cgroup.c b/security/device_cgroup.c |
1870 | index 03c1652c9a1f..db3bdc91c520 100644 |
1871 | --- a/security/device_cgroup.c |
1872 | +++ b/security/device_cgroup.c |
1873 | @@ -568,7 +568,7 @@ static int propagate_exception(struct dev_cgroup *devcg_root, |
1874 | devcg->behavior == DEVCG_DEFAULT_ALLOW) { |
1875 | rc = dev_exception_add(devcg, ex); |
1876 | if (rc) |
1877 | - break; |
1878 | + return rc; |
1879 | } else { |
1880 | /* |
1881 | * in the other possible cases: |
1882 | diff --git a/sound/core/info.c b/sound/core/info.c |
1883 | index 8ab72e0f5932..358a6947342d 100644 |
1884 | --- a/sound/core/info.c |
1885 | +++ b/sound/core/info.c |
1886 | @@ -724,8 +724,11 @@ snd_info_create_entry(const char *name, struct snd_info_entry *parent) |
1887 | INIT_LIST_HEAD(&entry->children); |
1888 | INIT_LIST_HEAD(&entry->list); |
1889 | entry->parent = parent; |
1890 | - if (parent) |
1891 | + if (parent) { |
1892 | + mutex_lock(&parent->access); |
1893 | list_add_tail(&entry->list, &parent->children); |
1894 | + mutex_unlock(&parent->access); |
1895 | + } |
1896 | return entry; |
1897 | } |
1898 | |
1899 | @@ -809,7 +812,12 @@ void snd_info_free_entry(struct snd_info_entry * entry) |
1900 | list_for_each_entry_safe(p, n, &entry->children, list) |
1901 | snd_info_free_entry(p); |
1902 | |
1903 | - list_del(&entry->list); |
1904 | + p = entry->parent; |
1905 | + if (p) { |
1906 | + mutex_lock(&p->access); |
1907 | + list_del(&entry->list); |
1908 | + mutex_unlock(&p->access); |
1909 | + } |
1910 | kfree(entry->name); |
1911 | if (entry->private_free) |
1912 | entry->private_free(entry); |
1913 | diff --git a/sound/core/init.c b/sound/core/init.c |
1914 | index 6bda8436d765..02e96c580cb7 100644 |
1915 | --- a/sound/core/init.c |
1916 | +++ b/sound/core/init.c |
1917 | @@ -408,14 +408,7 @@ int snd_card_disconnect(struct snd_card *card) |
1918 | card->shutdown = 1; |
1919 | spin_unlock(&card->files_lock); |
1920 | |
1921 | - /* phase 1: disable fops (user space) operations for ALSA API */ |
1922 | - mutex_lock(&snd_card_mutex); |
1923 | - snd_cards[card->number] = NULL; |
1924 | - clear_bit(card->number, snd_cards_lock); |
1925 | - mutex_unlock(&snd_card_mutex); |
1926 | - |
1927 | - /* phase 2: replace file->f_op with special dummy operations */ |
1928 | - |
1929 | + /* replace file->f_op with special dummy operations */ |
1930 | spin_lock(&card->files_lock); |
1931 | list_for_each_entry(mfile, &card->files_list, list) { |
1932 | /* it's critical part, use endless loop */ |
1933 | @@ -431,7 +424,7 @@ int snd_card_disconnect(struct snd_card *card) |
1934 | } |
1935 | spin_unlock(&card->files_lock); |
1936 | |
1937 | - /* phase 3: notify all connected devices about disconnection */ |
1938 | + /* notify all connected devices about disconnection */ |
1939 | /* at this point, they cannot respond to any calls except release() */ |
1940 | |
1941 | #if IS_ENABLED(CONFIG_SND_MIXER_OSS) |
1942 | @@ -447,6 +440,13 @@ int snd_card_disconnect(struct snd_card *card) |
1943 | device_del(&card->card_dev); |
1944 | card->registered = false; |
1945 | } |
1946 | + |
1947 | + /* disable fops (user space) operations for ALSA API */ |
1948 | + mutex_lock(&snd_card_mutex); |
1949 | + snd_cards[card->number] = NULL; |
1950 | + clear_bit(card->number, snd_cards_lock); |
1951 | + mutex_unlock(&snd_card_mutex); |
1952 | + |
1953 | #ifdef CONFIG_PM |
1954 | wake_up(&card->power_sleep); |
1955 | #endif |