Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.13 commit in: /
Date: Wed, 15 Nov 2017 11:17:58
Message-Id: 1510744658.ed6af92327ec6ed1cc218729516e64ff22a09fc6.mpagano@gentoo
1 commit: ed6af92327ec6ed1cc218729516e64ff22a09fc6
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 15 11:17:38 2017 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 15 11:17:38 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=ed6af923
7
8 Linux patch 4.13.13
9
10 0000_README | 4 +
11 1012_linux-4.13.13.patch | 1467 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 1471 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 878d286..5edbdf0 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -91,6 +91,10 @@ Patch: 1011_linux-4.13.12.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.13.12
21
22 +Patch: 1012_linux-4.13.13.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.13.13
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1012_linux-4.13.13.patch b/1012_linux-4.13.13.patch
31 new file mode 100644
32 index 0000000..dce5871
33 --- /dev/null
34 +++ b/1012_linux-4.13.13.patch
35 @@ -0,0 +1,1467 @@
36 +diff --git a/Makefile b/Makefile
37 +index a7c847f495b0..1608a9b71381 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 4
42 + PATCHLEVEL = 13
43 +-SUBLEVEL = 12
44 ++SUBLEVEL = 13
45 + EXTRAVERSION =
46 + NAME = Fearless Coyote
47 +
48 +diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
49 +index 948c648fea00..0fcd82f01388 100644
50 +--- a/arch/arm/kernel/traps.c
51 ++++ b/arch/arm/kernel/traps.c
52 +@@ -154,30 +154,26 @@ static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
53 + set_fs(fs);
54 + }
55 +
56 +-static void dump_instr(const char *lvl, struct pt_regs *regs)
57 ++static void __dump_instr(const char *lvl, struct pt_regs *regs)
58 + {
59 + unsigned long addr = instruction_pointer(regs);
60 + const int thumb = thumb_mode(regs);
61 + const int width = thumb ? 4 : 8;
62 +- mm_segment_t fs;
63 + char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;
64 + int i;
65 +
66 + /*
67 +- * We need to switch to kernel mode so that we can use __get_user
68 +- * to safely read from kernel space. Note that we now dump the
69 +- * code first, just in case the backtrace kills us.
70 ++ * Note that we now dump the code first, just in case the backtrace
71 ++ * kills us.
72 + */
73 +- fs = get_fs();
74 +- set_fs(KERNEL_DS);
75 +
76 + for (i = -4; i < 1 + !!thumb; i++) {
77 + unsigned int val, bad;
78 +
79 + if (thumb)
80 +- bad = __get_user(val, &((u16 *)addr)[i]);
81 ++ bad = get_user(val, &((u16 *)addr)[i]);
82 + else
83 +- bad = __get_user(val, &((u32 *)addr)[i]);
84 ++ bad = get_user(val, &((u32 *)addr)[i]);
85 +
86 + if (!bad)
87 + p += sprintf(p, i == 0 ? "(%0*x) " : "%0*x ",
88 +@@ -188,8 +184,20 @@ static void dump_instr(const char *lvl, struct pt_regs *regs)
89 + }
90 + }
91 + printk("%sCode: %s\n", lvl, str);
92 ++}
93 +
94 +- set_fs(fs);
95 ++static void dump_instr(const char *lvl, struct pt_regs *regs)
96 ++{
97 ++ mm_segment_t fs;
98 ++
99 ++ if (!user_mode(regs)) {
100 ++ fs = get_fs();
101 ++ set_fs(KERNEL_DS);
102 ++ __dump_instr(lvl, regs);
103 ++ set_fs(fs);
104 ++ } else {
105 ++ __dump_instr(lvl, regs);
106 ++ }
107 + }
108 +
109 + #ifdef CONFIG_ARM_UNWIND
110 +diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
111 +index df7acea3747a..4674f1efbe7a 100644
112 +--- a/arch/mips/ar7/platform.c
113 ++++ b/arch/mips/ar7/platform.c
114 +@@ -575,6 +575,7 @@ static int __init ar7_register_uarts(void)
115 + uart_port.type = PORT_AR7;
116 + uart_port.uartclk = clk_get_rate(bus_clk) / 2;
117 + uart_port.iotype = UPIO_MEM32;
118 ++ uart_port.flags = UPF_FIXED_TYPE;
119 + uart_port.regshift = 2;
120 +
121 + uart_port.line = 0;
122 +@@ -653,6 +654,10 @@ static int __init ar7_register_devices(void)
123 + u32 val;
124 + int res;
125 +
126 ++ res = ar7_gpio_init();
127 ++ if (res)
128 ++ pr_warn("unable to register gpios: %d\n", res);
129 ++
130 + res = ar7_register_uarts();
131 + if (res)
132 + pr_err("unable to setup uart(s): %d\n", res);
133 +diff --git a/arch/mips/ar7/prom.c b/arch/mips/ar7/prom.c
134 +index 4fd83336131a..dd53987a690f 100644
135 +--- a/arch/mips/ar7/prom.c
136 ++++ b/arch/mips/ar7/prom.c
137 +@@ -246,8 +246,6 @@ void __init prom_init(void)
138 + ar7_init_cmdline(fw_arg0, (char **)fw_arg1);
139 + ar7_init_env((struct env_var *)fw_arg2);
140 + console_config();
141 +-
142 +- ar7_gpio_init();
143 + }
144 +
145 + #define PORT(offset) (KSEG1ADDR(AR7_REGS_UART0 + (offset * 4)))
146 +diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
147 +index cfdbab015769..163317fd3d7e 100644
148 +--- a/arch/mips/include/asm/mips-cm.h
149 ++++ b/arch/mips/include/asm/mips-cm.h
150 +@@ -240,8 +240,8 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80)
151 + #define CM_GCR_BASE_GCRBASE_MSK (_ULCAST_(0x1ffff) << 15)
152 + #define CM_GCR_BASE_CMDEFTGT_SHF 0
153 + #define CM_GCR_BASE_CMDEFTGT_MSK (_ULCAST_(0x3) << 0)
154 +-#define CM_GCR_BASE_CMDEFTGT_DISABLED 0
155 +-#define CM_GCR_BASE_CMDEFTGT_MEM 1
156 ++#define CM_GCR_BASE_CMDEFTGT_MEM 0
157 ++#define CM_GCR_BASE_CMDEFTGT_RESERVED 1
158 + #define CM_GCR_BASE_CMDEFTGT_IOCU0 2
159 + #define CM_GCR_BASE_CMDEFTGT_IOCU1 3
160 +
161 +diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
162 +index 1b070a76fcdd..5e0d87f4958f 100644
163 +--- a/arch/mips/kernel/smp-bmips.c
164 ++++ b/arch/mips/kernel/smp-bmips.c
165 +@@ -589,11 +589,11 @@ void __init bmips_cpu_setup(void)
166 +
167 + /* Flush and enable RAC */
168 + cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG);
169 +- __raw_writel(cfg | 0x100, BMIPS_RAC_CONFIG);
170 ++ __raw_writel(cfg | 0x100, cbr + BMIPS_RAC_CONFIG);
171 + __raw_readl(cbr + BMIPS_RAC_CONFIG);
172 +
173 + cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG);
174 +- __raw_writel(cfg | 0xf, BMIPS_RAC_CONFIG);
175 ++ __raw_writel(cfg | 0xf, cbr + BMIPS_RAC_CONFIG);
176 + __raw_readl(cbr + BMIPS_RAC_CONFIG);
177 +
178 + cfg = __raw_readl(cbr + BMIPS_RAC_ADDRESS_RANGE);
179 +diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
180 +index b42812e014c0..1fcc30ff9569 100644
181 +--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
182 ++++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
183 +@@ -645,6 +645,16 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
184 + hnow_v = hpte_new_to_old_v(hnow_v, hnow_r);
185 + hnow_r = hpte_new_to_old_r(hnow_r);
186 + }
187 ++
188 ++ /*
189 ++ * If the HPT is being resized, don't update the HPTE,
190 ++ * instead let the guest retry after the resize operation is complete.
191 ++ * The synchronization for hpte_setup_done test vs. set is provided
192 ++ * by the HPTE lock.
193 ++ */
194 ++ if (!kvm->arch.hpte_setup_done)
195 ++ goto out_unlock;
196 ++
197 + if ((hnow_v & ~HPTE_V_HVLOCK) != hpte[0] || hnow_r != hpte[1] ||
198 + rev->guest_rpte != hpte[2])
199 + /* HPTE has been changed under us; let the guest retry */
200 +diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
201 +index 9ecd9aea0b54..c059541743f0 100644
202 +--- a/arch/powerpc/kvm/book3s_hv.c
203 ++++ b/arch/powerpc/kvm/book3s_hv.c
204 +@@ -2688,11 +2688,14 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)
205 + * Hard-disable interrupts, and check resched flag and signals.
206 + * If we need to reschedule or deliver a signal, clean up
207 + * and return without going into the guest(s).
208 ++ * If the hpte_setup_done flag has been cleared, don't go into the
209 ++ * guest because that means a HPT resize operation is in progress.
210 + */
211 + local_irq_disable();
212 + hard_irq_disable();
213 + if (lazy_irq_pending() || need_resched() ||
214 +- recheck_signals(&core_info)) {
215 ++ recheck_signals(&core_info) ||
216 ++ (!kvm_is_radix(vc->kvm) && !vc->kvm->arch.hpte_setup_done)) {
217 + local_irq_enable();
218 + vc->vcore_state = VCORE_INACTIVE;
219 + /* Unlock all except the primary vcore */
220 +@@ -3061,7 +3064,7 @@ static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc)
221 +
222 + static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
223 + {
224 +- int n_ceded, i;
225 ++ int n_ceded, i, r;
226 + struct kvmppc_vcore *vc;
227 + struct kvm_vcpu *v;
228 +
229 +@@ -3115,6 +3118,20 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
230 +
231 + while (vcpu->arch.state == KVMPPC_VCPU_RUNNABLE &&
232 + !signal_pending(current)) {
233 ++ /* See if the HPT and VRMA are ready to go */
234 ++ if (!kvm_is_radix(vcpu->kvm) &&
235 ++ !vcpu->kvm->arch.hpte_setup_done) {
236 ++ spin_unlock(&vc->lock);
237 ++ r = kvmppc_hv_setup_htab_rma(vcpu);
238 ++ spin_lock(&vc->lock);
239 ++ if (r) {
240 ++ kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY;
241 ++ kvm_run->fail_entry.hardware_entry_failure_reason = 0;
242 ++ vcpu->arch.ret = r;
243 ++ break;
244 ++ }
245 ++ }
246 ++
247 + if (vc->vcore_state == VCORE_PREEMPT && vc->runner == NULL)
248 + kvmppc_vcore_end_preempt(vc);
249 +
250 +@@ -3232,13 +3249,6 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu)
251 + /* Order vcpus_running vs. hpte_setup_done, see kvmppc_alloc_reset_hpt */
252 + smp_mb();
253 +
254 +- /* On the first time here, set up HTAB and VRMA */
255 +- if (!kvm_is_radix(vcpu->kvm) && !vcpu->kvm->arch.hpte_setup_done) {
256 +- r = kvmppc_hv_setup_htab_rma(vcpu);
257 +- if (r)
258 +- goto out;
259 +- }
260 +-
261 + flush_all_to_thread(current);
262 +
263 + /* Save userspace EBB and other register values */
264 +@@ -3286,7 +3296,6 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu)
265 + }
266 + mtspr(SPRN_VRSAVE, user_vrsave);
267 +
268 +- out:
269 + vcpu->arch.state = KVMPPC_VCPU_NOTREADY;
270 + atomic_dec(&vcpu->kvm->arch.vcpus_running);
271 + return r;
272 +diff --git a/arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S b/arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S
273 +index 93b945597ecf..7cfba738f104 100644
274 +--- a/arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S
275 ++++ b/arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S
276 +@@ -157,8 +157,8 @@ LABEL skip_ %I
277 + .endr
278 +
279 + # Find min length
280 +- vmovdqa _lens+0*16(state), %xmm0
281 +- vmovdqa _lens+1*16(state), %xmm1
282 ++ vmovdqu _lens+0*16(state), %xmm0
283 ++ vmovdqu _lens+1*16(state), %xmm1
284 +
285 + vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
286 + vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
287 +@@ -178,8 +178,8 @@ LABEL skip_ %I
288 + vpsubd %xmm2, %xmm0, %xmm0
289 + vpsubd %xmm2, %xmm1, %xmm1
290 +
291 +- vmovdqa %xmm0, _lens+0*16(state)
292 +- vmovdqa %xmm1, _lens+1*16(state)
293 ++ vmovdqu %xmm0, _lens+0*16(state)
294 ++ vmovdqu %xmm1, _lens+1*16(state)
295 +
296 + # "state" and "args" are the same address, arg1
297 + # len is arg2
298 +@@ -235,8 +235,8 @@ ENTRY(sha1_mb_mgr_get_comp_job_avx2)
299 + jc .return_null
300 +
301 + # Find min length
302 +- vmovdqa _lens(state), %xmm0
303 +- vmovdqa _lens+1*16(state), %xmm1
304 ++ vmovdqu _lens(state), %xmm0
305 ++ vmovdqu _lens+1*16(state), %xmm1
306 +
307 + vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
308 + vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
309 +diff --git a/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S b/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S
310 +index 8fe6338bcc84..16c4ccb1f154 100644
311 +--- a/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S
312 ++++ b/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S
313 +@@ -155,8 +155,8 @@ LABEL skip_ %I
314 + .endr
315 +
316 + # Find min length
317 +- vmovdqa _lens+0*16(state), %xmm0
318 +- vmovdqa _lens+1*16(state), %xmm1
319 ++ vmovdqu _lens+0*16(state), %xmm0
320 ++ vmovdqu _lens+1*16(state), %xmm1
321 +
322 + vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
323 + vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
324 +@@ -176,8 +176,8 @@ LABEL skip_ %I
325 + vpsubd %xmm2, %xmm0, %xmm0
326 + vpsubd %xmm2, %xmm1, %xmm1
327 +
328 +- vmovdqa %xmm0, _lens+0*16(state)
329 +- vmovdqa %xmm1, _lens+1*16(state)
330 ++ vmovdqu %xmm0, _lens+0*16(state)
331 ++ vmovdqu %xmm1, _lens+1*16(state)
332 +
333 + # "state" and "args" are the same address, arg1
334 + # len is arg2
335 +@@ -234,8 +234,8 @@ ENTRY(sha256_mb_mgr_get_comp_job_avx2)
336 + jc .return_null
337 +
338 + # Find min length
339 +- vmovdqa _lens(state), %xmm0
340 +- vmovdqa _lens+1*16(state), %xmm1
341 ++ vmovdqu _lens(state), %xmm0
342 ++ vmovdqu _lens+1*16(state), %xmm1
343 +
344 + vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
345 + vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
346 +diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
347 +index 836877e2da22..cdf82492b770 100644
348 +--- a/arch/x86/kernel/cpu/Makefile
349 ++++ b/arch/x86/kernel/cpu/Makefile
350 +@@ -21,7 +21,7 @@ obj-y += common.o
351 + obj-y += rdrand.o
352 + obj-y += match.o
353 + obj-y += bugs.o
354 +-obj-y += aperfmperf.o
355 ++obj-$(CONFIG_CPU_FREQ) += aperfmperf.o
356 +
357 + obj-$(CONFIG_PROC_FS) += proc.o
358 + obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o
359 +diff --git a/arch/x86/kernel/cpu/aperfmperf.c b/arch/x86/kernel/cpu/aperfmperf.c
360 +index 957813e0180d..0ee83321a313 100644
361 +--- a/arch/x86/kernel/cpu/aperfmperf.c
362 ++++ b/arch/x86/kernel/cpu/aperfmperf.c
363 +@@ -42,6 +42,10 @@ static void aperfmperf_snapshot_khz(void *dummy)
364 + s64 time_delta = ktime_ms_delta(now, s->time);
365 + unsigned long flags;
366 +
367 ++ /* Don't bother re-computing within the cache threshold time. */
368 ++ if (time_delta < APERFMPERF_CACHE_THRESHOLD_MS)
369 ++ return;
370 ++
371 + local_irq_save(flags);
372 + rdmsrl(MSR_IA32_APERF, aperf);
373 + rdmsrl(MSR_IA32_MPERF, mperf);
374 +@@ -70,7 +74,6 @@ static void aperfmperf_snapshot_khz(void *dummy)
375 +
376 + unsigned int arch_freq_get_on_cpu(int cpu)
377 + {
378 +- s64 time_delta;
379 + unsigned int khz;
380 +
381 + if (!cpu_khz)
382 +@@ -79,12 +82,6 @@ unsigned int arch_freq_get_on_cpu(int cpu)
383 + if (!static_cpu_has(X86_FEATURE_APERFMPERF))
384 + return 0;
385 +
386 +- /* Don't bother re-computing within the cache threshold time. */
387 +- time_delta = ktime_ms_delta(ktime_get(), per_cpu(samples.time, cpu));
388 +- khz = per_cpu(samples.khz, cpu);
389 +- if (khz && time_delta < APERFMPERF_CACHE_THRESHOLD_MS)
390 +- return khz;
391 +-
392 + smp_call_function_single(cpu, aperfmperf_snapshot_khz, NULL, 1);
393 + khz = per_cpu(samples.khz, cpu);
394 + if (khz)
395 +diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
396 +index 510e69596278..6df621ae62a7 100644
397 +--- a/arch/x86/kernel/cpu/proc.c
398 ++++ b/arch/x86/kernel/cpu/proc.c
399 +@@ -77,10 +77,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
400 + seq_printf(m, "microcode\t: 0x%x\n", c->microcode);
401 +
402 + if (cpu_has(c, X86_FEATURE_TSC)) {
403 +- unsigned int freq = arch_freq_get_on_cpu(cpu);
404 ++ unsigned int freq = cpufreq_quick_get(cpu);
405 +
406 +- if (!freq)
407 +- freq = cpufreq_quick_get(cpu);
408 + if (!freq)
409 + freq = cpu_khz;
410 + seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
411 +diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
412 +index 54b9e89d4d6b..893fd8c849e2 100644
413 +--- a/arch/x86/kernel/smpboot.c
414 ++++ b/arch/x86/kernel/smpboot.c
415 +@@ -193,6 +193,12 @@ static void smp_callin(void)
416 + */
417 + smp_store_cpu_info(cpuid);
418 +
419 ++ /*
420 ++ * The topology information must be up to date before
421 ++ * calibrate_delay() and notify_cpu_starting().
422 ++ */
423 ++ set_cpu_sibling_map(raw_smp_processor_id());
424 ++
425 + /*
426 + * Get our bogomips.
427 + * Update loops_per_jiffy in cpu_data. Previous call to
428 +@@ -203,11 +209,6 @@ static void smp_callin(void)
429 + cpu_data(cpuid).loops_per_jiffy = loops_per_jiffy;
430 + pr_debug("Stack at about %p\n", &cpuid);
431 +
432 +- /*
433 +- * This must be done before setting cpu_online_mask
434 +- * or calling notify_cpu_starting.
435 +- */
436 +- set_cpu_sibling_map(raw_smp_processor_id());
437 + wmb();
438 +
439 + notify_cpu_starting(cpuid);
440 +diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
441 +index bf54309b85da..b2157d4a5338 100644
442 +--- a/arch/x86/kernel/traps.c
443 ++++ b/arch/x86/kernel/traps.c
444 +@@ -221,9 +221,6 @@ do_trap_no_signal(struct task_struct *tsk, int trapnr, char *str,
445 + if (fixup_exception(regs, trapnr))
446 + return 0;
447 +
448 +- if (fixup_bug(regs, trapnr))
449 +- return 0;
450 +-
451 + tsk->thread.error_code = error_code;
452 + tsk->thread.trap_nr = trapnr;
453 + die(str, regs, error_code);
454 +@@ -304,6 +301,13 @@ static void do_error_trap(struct pt_regs *regs, long error_code, char *str,
455 +
456 + RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
457 +
458 ++ /*
459 ++ * WARN*()s end up here; fix them up before we call the
460 ++ * notifier chain.
461 ++ */
462 ++ if (!user_mode(regs) && fixup_bug(regs, trapnr))
463 ++ return;
464 ++
465 + if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) !=
466 + NOTIFY_STOP) {
467 + cond_local_irq_enable(regs);
468 +diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
469 +index 796d96bb0821..ad2b925a808e 100644
470 +--- a/arch/x86/kernel/tsc.c
471 ++++ b/arch/x86/kernel/tsc.c
472 +@@ -1346,12 +1346,10 @@ void __init tsc_init(void)
473 + unsigned long calibrate_delay_is_known(void)
474 + {
475 + int sibling, cpu = smp_processor_id();
476 +- struct cpumask *mask = topology_core_cpumask(cpu);
477 ++ int constant_tsc = cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC);
478 ++ const struct cpumask *mask = topology_core_cpumask(cpu);
479 +
480 +- if (!tsc_disabled && !cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC))
481 +- return 0;
482 +-
483 +- if (!mask)
484 ++ if (tsc_disabled || !constant_tsc || !mask)
485 + return 0;
486 +
487 + sibling = cpumask_any_but(mask, cpu);
488 +diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
489 +index 350f7096baac..7913b6921959 100644
490 +--- a/arch/x86/oprofile/op_model_ppro.c
491 ++++ b/arch/x86/oprofile/op_model_ppro.c
492 +@@ -212,8 +212,8 @@ static void arch_perfmon_setup_counters(void)
493 + eax.full = cpuid_eax(0xa);
494 +
495 + /* Workaround for BIOS bugs in 6/15. Taken from perfmon2 */
496 +- if (eax.split.version_id == 0 && __this_cpu_read(cpu_info.x86) == 6 &&
497 +- __this_cpu_read(cpu_info.x86_model) == 15) {
498 ++ if (eax.split.version_id == 0 && boot_cpu_data.x86 == 6 &&
499 ++ boot_cpu_data.x86_model == 15) {
500 + eax.split.version_id = 2;
501 + eax.split.num_counters = 2;
502 + eax.split.bit_width = 40;
503 +diff --git a/crypto/ccm.c b/crypto/ccm.c
504 +index 1ce37ae0ce56..0a083342ec8c 100644
505 +--- a/crypto/ccm.c
506 ++++ b/crypto/ccm.c
507 +@@ -363,7 +363,7 @@ static int crypto_ccm_decrypt(struct aead_request *req)
508 + unsigned int cryptlen = req->cryptlen;
509 + u8 *authtag = pctx->auth_tag;
510 + u8 *odata = pctx->odata;
511 +- u8 *iv = req->iv;
512 ++ u8 *iv = pctx->idata;
513 + int err;
514 +
515 + cryptlen -= authsize;
516 +@@ -379,6 +379,8 @@ static int crypto_ccm_decrypt(struct aead_request *req)
517 + if (req->src != req->dst)
518 + dst = pctx->dst;
519 +
520 ++ memcpy(iv, req->iv, 16);
521 ++
522 + skcipher_request_set_tfm(skreq, ctx->ctr);
523 + skcipher_request_set_callback(skreq, pctx->flags,
524 + crypto_ccm_decrypt_done, req);
525 +diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
526 +index 9c941947a063..3a3cb8624f41 100644
527 +--- a/drivers/acpi/acpica/evgpeblk.c
528 ++++ b/drivers/acpi/acpica/evgpeblk.c
529 +@@ -440,9 +440,11 @@ acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
530 + void *ignored)
531 + {
532 + acpi_status status;
533 ++ acpi_event_status event_status;
534 + struct acpi_gpe_event_info *gpe_event_info;
535 + u32 gpe_enabled_count;
536 + u32 gpe_index;
537 ++ u32 gpe_number;
538 + u32 i;
539 + u32 j;
540 +
541 +@@ -470,30 +472,40 @@ acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
542 +
543 + gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j;
544 + gpe_event_info = &gpe_block->event_info[gpe_index];
545 ++ gpe_number = gpe_block->block_base_number + gpe_index;
546 +
547 + /*
548 + * Ignore GPEs that have no corresponding _Lxx/_Exx method
549 +- * and GPEs that are used to wake the system
550 ++ * and GPEs that are used for wakeup
551 + */
552 +- if ((ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
553 +- ACPI_GPE_DISPATCH_NONE)
554 +- || (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
555 +- ACPI_GPE_DISPATCH_HANDLER)
556 +- || (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) ==
557 +- ACPI_GPE_DISPATCH_RAW_HANDLER)
558 ++ if ((ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) !=
559 ++ ACPI_GPE_DISPATCH_METHOD)
560 + || (gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
561 + continue;
562 + }
563 +
564 ++ event_status = 0;
565 ++ (void)acpi_hw_get_gpe_status(gpe_event_info,
566 ++ &event_status);
567 ++
568 + status = acpi_ev_add_gpe_reference(gpe_event_info);
569 + if (ACPI_FAILURE(status)) {
570 + ACPI_EXCEPTION((AE_INFO, status,
571 + "Could not enable GPE 0x%02X",
572 +- gpe_index +
573 +- gpe_block->block_base_number));
574 ++ gpe_number));
575 + continue;
576 + }
577 +
578 ++ gpe_event_info->flags |= ACPI_GPE_AUTO_ENABLED;
579 ++
580 ++ if (event_status & ACPI_EVENT_FLAG_STATUS_SET) {
581 ++ ACPI_INFO(("GPE 0x%02X active on init",
582 ++ gpe_number));
583 ++ (void)acpi_ev_gpe_dispatch(gpe_block->node,
584 ++ gpe_event_info,
585 ++ gpe_number);
586 ++ }
587 ++
588 + gpe_enabled_count++;
589 + }
590 + }
591 +diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c
592 +index 57718a3e029a..67c7c4ce276c 100644
593 +--- a/drivers/acpi/acpica/evxfgpe.c
594 ++++ b/drivers/acpi/acpica/evxfgpe.c
595 +@@ -435,6 +435,14 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device,
596 + */
597 + gpe_event_info->flags =
598 + (ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED);
599 ++ } else if (gpe_event_info->flags & ACPI_GPE_AUTO_ENABLED) {
600 ++ /*
601 ++ * A reference to this GPE has been added during the GPE block
602 ++ * initialization, so drop it now to prevent the GPE from being
603 ++ * permanently enabled and clear its ACPI_GPE_AUTO_ENABLED flag.
604 ++ */
605 ++ (void)acpi_ev_remove_gpe_reference(gpe_event_info);
606 ++ gpe_event_info->flags &= ~ACPI_GPE_AUTO_ENABLED;
607 + }
608 +
609 + /*
610 +diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
611 +index 70fd5502c284..b7bdf9d0f5c0 100644
612 +--- a/drivers/acpi/scan.c
613 ++++ b/drivers/acpi/scan.c
614 +@@ -2058,6 +2058,9 @@ int __init acpi_scan_init(void)
615 + acpi_get_spcr_uart_addr();
616 + }
617 +
618 ++ acpi_gpe_apply_masked_gpes();
619 ++ acpi_update_all_gpes();
620 ++
621 + mutex_lock(&acpi_scan_lock);
622 + /*
623 + * Enumerate devices in the ACPI namespace.
624 +@@ -2082,9 +2085,6 @@ int __init acpi_scan_init(void)
625 + }
626 + }
627 +
628 +- acpi_gpe_apply_masked_gpes();
629 +- acpi_update_all_gpes();
630 +-
631 + acpi_scan_initialized = true;
632 +
633 + out:
634 +diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
635 +index fa8243c5c062..59b78e42a58b 100644
636 +--- a/drivers/acpi/sleep.c
637 ++++ b/drivers/acpi/sleep.c
638 +@@ -160,6 +160,14 @@ static int __init init_nvs_nosave(const struct dmi_system_id *d)
639 + return 0;
640 + }
641 +
642 ++static bool acpi_sleep_no_lps0;
643 ++
644 ++static int __init init_no_lps0(const struct dmi_system_id *d)
645 ++{
646 ++ acpi_sleep_no_lps0 = true;
647 ++ return 0;
648 ++}
649 ++
650 + static struct dmi_system_id acpisleep_dmi_table[] __initdata = {
651 + {
652 + .callback = init_old_suspend_ordering,
653 +@@ -343,6 +351,19 @@ static struct dmi_system_id acpisleep_dmi_table[] __initdata = {
654 + DMI_MATCH(DMI_PRODUCT_NAME, "80E3"),
655 + },
656 + },
657 ++ /*
658 ++ * https://bugzilla.kernel.org/show_bug.cgi?id=196907
659 ++ * Some Dell XPS13 9360 cannot do suspend-to-idle using the Low Power
660 ++ * S0 Idle firmware interface.
661 ++ */
662 ++ {
663 ++ .callback = init_no_lps0,
664 ++ .ident = "Dell XPS13 9360",
665 ++ .matches = {
666 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
667 ++ DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9360"),
668 ++ },
669 ++ },
670 + {},
671 + };
672 +
673 +@@ -485,6 +506,7 @@ static void acpi_pm_end(void)
674 + }
675 + #else /* !CONFIG_ACPI_SLEEP */
676 + #define acpi_target_sleep_state ACPI_STATE_S0
677 ++#define acpi_sleep_no_lps0 (false)
678 + static inline void acpi_sleep_dmi_check(void) {}
679 + #endif /* CONFIG_ACPI_SLEEP */
680 +
681 +@@ -702,6 +724,12 @@ static int lps0_device_attach(struct acpi_device *adev,
682 + if (lps0_device_handle)
683 + return 0;
684 +
685 ++ if (acpi_sleep_no_lps0) {
686 ++ acpi_handle_info(adev->handle,
687 ++ "Low Power S0 Idle interface disabled\n");
688 ++ return 0;
689 ++ }
690 ++
691 + if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
692 + return 0;
693 +
694 +diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
695 +index b008b6a98098..cf54a1cf8c55 100644
696 +--- a/drivers/block/rbd.c
697 ++++ b/drivers/block/rbd.c
698 +@@ -2692,7 +2692,7 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request)
699 + * from the parent.
700 + */
701 + page_count = (u32)calc_pages_for(0, length);
702 +- pages = ceph_alloc_page_vector(page_count, GFP_KERNEL);
703 ++ pages = ceph_alloc_page_vector(page_count, GFP_NOIO);
704 + if (IS_ERR(pages)) {
705 + result = PTR_ERR(pages);
706 + pages = NULL;
707 +@@ -2827,7 +2827,7 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
708 + */
709 + size = sizeof (__le64) + sizeof (__le32) + sizeof (__le32);
710 + page_count = (u32)calc_pages_for(0, size);
711 +- pages = ceph_alloc_page_vector(page_count, GFP_KERNEL);
712 ++ pages = ceph_alloc_page_vector(page_count, GFP_NOIO);
713 + if (IS_ERR(pages)) {
714 + ret = PTR_ERR(pages);
715 + goto fail_stat_request;
716 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
717 +index 4436d53ae16c..f160a66b7098 100644
718 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
719 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
720 +@@ -722,7 +722,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
721 + * allocation taken by fbdev
722 + */
723 + if (!(dev_priv->capabilities & SVGA_CAP_3D))
724 +- mem_size *= 2;
725 ++ mem_size *= 3;
726 +
727 + dev_priv->max_mob_pages = mem_size * 1024 / PAGE_SIZE;
728 + dev_priv->prim_bb_mem =
729 +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
730 +index a6b762271a40..47a9696e7874 100644
731 +--- a/drivers/input/mouse/elan_i2c_core.c
732 ++++ b/drivers/input/mouse/elan_i2c_core.c
733 +@@ -1253,6 +1253,7 @@ static const struct acpi_device_id elan_acpi_id[] = {
734 + { "ELAN0605", 0 },
735 + { "ELAN0609", 0 },
736 + { "ELAN060B", 0 },
737 ++ { "ELAN060C", 0 },
738 + { "ELAN0611", 0 },
739 + { "ELAN1000", 0 },
740 + { }
741 +diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c
742 +index cf7c18947189..d065c0e2d18e 100644
743 +--- a/drivers/net/can/c_can/c_can_pci.c
744 ++++ b/drivers/net/can/c_can/c_can_pci.c
745 +@@ -178,7 +178,6 @@ static int c_can_pci_probe(struct pci_dev *pdev,
746 + break;
747 + case BOSCH_D_CAN:
748 + priv->regs = reg_map_d_can;
749 +- priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
750 + break;
751 + default:
752 + ret = -EINVAL;
753 +diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
754 +index e36d10520e24..717530eac70c 100644
755 +--- a/drivers/net/can/c_can/c_can_platform.c
756 ++++ b/drivers/net/can/c_can/c_can_platform.c
757 +@@ -320,7 +320,6 @@ static int c_can_plat_probe(struct platform_device *pdev)
758 + break;
759 + case BOSCH_D_CAN:
760 + priv->regs = reg_map_d_can;
761 +- priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
762 + priv->read_reg = c_can_plat_read_reg_aligned_to_16bit;
763 + priv->write_reg = c_can_plat_write_reg_aligned_to_16bit;
764 + priv->read_reg32 = d_can_plat_read_reg32;
765 +diff --git a/drivers/net/can/ifi_canfd/ifi_canfd.c b/drivers/net/can/ifi_canfd/ifi_canfd.c
766 +index 4d1fe8d95042..2772d05ff11c 100644
767 +--- a/drivers/net/can/ifi_canfd/ifi_canfd.c
768 ++++ b/drivers/net/can/ifi_canfd/ifi_canfd.c
769 +@@ -670,9 +670,9 @@ static void ifi_canfd_set_bittiming(struct net_device *ndev)
770 + priv->base + IFI_CANFD_FTIME);
771 +
772 + /* Configure transmitter delay */
773 +- tdc = (dbt->brp * (dbt->phase_seg1 + 1)) & IFI_CANFD_TDELAY_MASK;
774 +- writel(IFI_CANFD_TDELAY_EN | IFI_CANFD_TDELAY_ABS | tdc,
775 +- priv->base + IFI_CANFD_TDELAY);
776 ++ tdc = dbt->brp * (dbt->prop_seg + dbt->phase_seg1);
777 ++ tdc &= IFI_CANFD_TDELAY_MASK;
778 ++ writel(IFI_CANFD_TDELAY_EN | tdc, priv->base + IFI_CANFD_TDELAY);
779 + }
780 +
781 + static void ifi_canfd_set_filter(struct net_device *ndev, const u32 id,
782 +diff --git a/drivers/net/can/peak_canfd/peak_pciefd_main.c b/drivers/net/can/peak_canfd/peak_pciefd_main.c
783 +index 51c2d182a33a..b4efd711f824 100644
784 +--- a/drivers/net/can/peak_canfd/peak_pciefd_main.c
785 ++++ b/drivers/net/can/peak_canfd/peak_pciefd_main.c
786 +@@ -29,14 +29,19 @@
787 + #include "peak_canfd_user.h"
788 +
789 + MODULE_AUTHOR("Stephane Grosjean <s.grosjean@×××××××××××.com>");
790 +-MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCIe FD family cards");
791 +-MODULE_SUPPORTED_DEVICE("PEAK PCAN PCIe FD CAN cards");
792 ++MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCIe/M.2 FD family cards");
793 ++MODULE_SUPPORTED_DEVICE("PEAK PCAN PCIe/M.2 FD CAN cards");
794 + MODULE_LICENSE("GPL v2");
795 +
796 + #define PCIEFD_DRV_NAME "peak_pciefd"
797 +
798 + #define PEAK_PCI_VENDOR_ID 0x001c /* The PCI device and vendor IDs */
799 + #define PEAK_PCIEFD_ID 0x0013 /* for PCIe slot cards */
800 ++#define PCAN_CPCIEFD_ID 0x0014 /* for Compact-PCI Serial slot cards */
801 ++#define PCAN_PCIE104FD_ID 0x0017 /* for PCIe-104 Express slot cards */
802 ++#define PCAN_MINIPCIEFD_ID 0x0018 /* for mini-PCIe slot cards */
803 ++#define PCAN_PCIEFD_OEM_ID 0x0019 /* for PCIe slot OEM cards */
804 ++#define PCAN_M2_ID 0x001a /* for M2 slot cards */
805 +
806 + /* PEAK PCIe board access description */
807 + #define PCIEFD_BAR0_SIZE (64 * 1024)
808 +@@ -203,6 +208,11 @@ struct pciefd_board {
809 + /* supported device ids. */
810 + static const struct pci_device_id peak_pciefd_tbl[] = {
811 + {PEAK_PCI_VENDOR_ID, PEAK_PCIEFD_ID, PCI_ANY_ID, PCI_ANY_ID,},
812 ++ {PEAK_PCI_VENDOR_ID, PCAN_CPCIEFD_ID, PCI_ANY_ID, PCI_ANY_ID,},
813 ++ {PEAK_PCI_VENDOR_ID, PCAN_PCIE104FD_ID, PCI_ANY_ID, PCI_ANY_ID,},
814 ++ {PEAK_PCI_VENDOR_ID, PCAN_MINIPCIEFD_ID, PCI_ANY_ID, PCI_ANY_ID,},
815 ++ {PEAK_PCI_VENDOR_ID, PCAN_PCIEFD_OEM_ID, PCI_ANY_ID, PCI_ANY_ID,},
816 ++ {PEAK_PCI_VENDOR_ID, PCAN_M2_ID, PCI_ANY_ID, PCI_ANY_ID,},
817 + {0,}
818 + };
819 +
820 +diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c
821 +index b0c80859f746..1ac2090a1721 100644
822 +--- a/drivers/net/can/sun4i_can.c
823 ++++ b/drivers/net/can/sun4i_can.c
824 +@@ -539,6 +539,13 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)
825 + }
826 + stats->rx_over_errors++;
827 + stats->rx_errors++;
828 ++
829 ++ /* reset the CAN IP by entering reset mode
830 ++ * ignoring timeout error
831 ++ */
832 ++ set_reset_mode(dev);
833 ++ set_normal_mode(dev);
834 ++
835 + /* clear bit */
836 + sun4i_can_write_cmdreg(priv, SUN4I_CMD_CLEAR_OR_FLAG);
837 + }
838 +@@ -653,8 +660,9 @@ static irqreturn_t sun4i_can_interrupt(int irq, void *dev_id)
839 + netif_wake_queue(dev);
840 + can_led_event(dev, CAN_LED_EVENT_TX);
841 + }
842 +- if (isrc & SUN4I_INT_RBUF_VLD) {
843 +- /* receive interrupt */
844 ++ if ((isrc & SUN4I_INT_RBUF_VLD) &&
845 ++ !(isrc & SUN4I_INT_DATA_OR)) {
846 ++ /* receive interrupt - don't read if overrun occurred */
847 + while (status & SUN4I_STA_RBUF_RDY) {
848 + /* RX buffer is not empty */
849 + sun4i_can_rx(dev);
850 +diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
851 +index 2fcbaec8b368..71eddf645566 100644
852 +--- a/include/acpi/actypes.h
853 ++++ b/include/acpi/actypes.h
854 +@@ -775,7 +775,7 @@ typedef u32 acpi_event_status;
855 + * | | | | +-- Type of dispatch:to method, handler, notify, or none
856 + * | | | +----- Interrupt type: edge or level triggered
857 + * | | +------- Is a Wake GPE
858 +- * | +--------- Is GPE masked by the software GPE masking mechanism
859 ++ * | +--------- Has been enabled automatically at init time
860 + * +------------ <Reserved>
861 + */
862 + #define ACPI_GPE_DISPATCH_NONE (u8) 0x00
863 +@@ -791,6 +791,7 @@ typedef u32 acpi_event_status;
864 + #define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x08
865 +
866 + #define ACPI_GPE_CAN_WAKE (u8) 0x10
867 ++#define ACPI_GPE_AUTO_ENABLED (u8) 0x20
868 +
869 + /*
870 + * Flags for GPE and Lock interfaces
871 +diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
872 +index 48407569585d..a7c2cee39570 100644
873 +--- a/include/net/netfilter/nf_conntrack.h
874 ++++ b/include/net/netfilter/nf_conntrack.h
875 +@@ -17,7 +17,6 @@
876 + #include <linux/bitops.h>
877 + #include <linux/compiler.h>
878 + #include <linux/atomic.h>
879 +-#include <linux/rhashtable.h>
880 +
881 + #include <linux/netfilter/nf_conntrack_tcp.h>
882 + #include <linux/netfilter/nf_conntrack_dccp.h>
883 +@@ -83,7 +82,7 @@ struct nf_conn {
884 + possible_net_t ct_net;
885 +
886 + #if IS_ENABLED(CONFIG_NF_NAT)
887 +- struct rhlist_head nat_bysource;
888 ++ struct hlist_node nat_bysource;
889 + #endif
890 + /* all members below initialized via memset */
891 + u8 __nfct_init_offset[0];
892 +diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
893 +index 05c82a1a4267..b71701302e61 100644
894 +--- a/include/net/netfilter/nf_nat.h
895 ++++ b/include/net/netfilter/nf_nat.h
896 +@@ -1,6 +1,5 @@
897 + #ifndef _NF_NAT_H
898 + #define _NF_NAT_H
899 +-#include <linux/rhashtable.h>
900 + #include <linux/netfilter_ipv4.h>
901 + #include <linux/netfilter/nf_nat.h>
902 + #include <net/netfilter/nf_conntrack_tuple.h>
903 +diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h
904 +index feb58d455560..4b9ee3009aa0 100644
905 +--- a/include/sound/seq_kernel.h
906 ++++ b/include/sound/seq_kernel.h
907 +@@ -49,7 +49,8 @@ typedef union snd_seq_timestamp snd_seq_timestamp_t;
908 + #define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 200
909 +
910 + /* max delivery path length */
911 +-#define SNDRV_SEQ_MAX_HOPS 10
912 ++/* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */
913 ++#define SNDRV_SEQ_MAX_HOPS 8
914 +
915 + /* max size of event size */
916 + #define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
917 +diff --git a/include/sound/timer.h b/include/sound/timer.h
918 +index c4d76ff056c6..7ae226ab6990 100644
919 +--- a/include/sound/timer.h
920 ++++ b/include/sound/timer.h
921 +@@ -90,6 +90,8 @@ struct snd_timer {
922 + struct list_head ack_list_head;
923 + struct list_head sack_list_head; /* slow ack list head */
924 + struct tasklet_struct task_queue;
925 ++ int max_instances; /* upper limit of timer instances */
926 ++ int num_instances; /* current number of timer instances */
927 + };
928 +
929 + struct snd_timer_instance {
930 +diff --git a/kernel/workqueue_internal.h b/kernel/workqueue_internal.h
931 +index 8635417c587b..29fa81f0f51a 100644
932 +--- a/kernel/workqueue_internal.h
933 ++++ b/kernel/workqueue_internal.h
934 +@@ -9,6 +9,7 @@
935 +
936 + #include <linux/workqueue.h>
937 + #include <linux/kthread.h>
938 ++#include <linux/preempt.h>
939 +
940 + struct worker_pool;
941 +
942 +@@ -59,7 +60,7 @@ struct worker {
943 + */
944 + static inline struct worker *current_wq_worker(void)
945 + {
946 +- if (current->flags & PF_WQ_WORKER)
947 ++ if (in_task() && (current->flags & PF_WQ_WORKER))
948 + return kthread_data(current);
949 + return NULL;
950 + }
951 +diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
952 +index fef5d2e114be..1ef0cec38d78 100644
953 +--- a/lib/asn1_decoder.c
954 ++++ b/lib/asn1_decoder.c
955 +@@ -228,7 +228,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
956 + hdr = 2;
957 +
958 + /* Extract a tag from the data */
959 +- if (unlikely(dp >= datalen - 1))
960 ++ if (unlikely(datalen - dp < 2))
961 + goto data_overrun_error;
962 + tag = data[dp++];
963 + if (unlikely((tag & 0x1f) == ASN1_LONG_TAG))
964 +@@ -274,7 +274,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
965 + int n = len - 0x80;
966 + if (unlikely(n > 2))
967 + goto length_too_long;
968 +- if (unlikely(dp >= datalen - n))
969 ++ if (unlikely(n > datalen - dp))
970 + goto data_overrun_error;
971 + hdr += n;
972 + for (len = 0; n > 0; n--) {
973 +diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
974 +index b1d3740ae36a..2fb80a4bfb34 100644
975 +--- a/net/netfilter/nf_nat_core.c
976 ++++ b/net/netfilter/nf_nat_core.c
977 +@@ -30,19 +30,17 @@
978 + #include <net/netfilter/nf_conntrack_zones.h>
979 + #include <linux/netfilter/nf_nat.h>
980 +
981 ++static DEFINE_SPINLOCK(nf_nat_lock);
982 ++
983 + static DEFINE_MUTEX(nf_nat_proto_mutex);
984 + static const struct nf_nat_l3proto __rcu *nf_nat_l3protos[NFPROTO_NUMPROTO]
985 + __read_mostly;
986 + static const struct nf_nat_l4proto __rcu **nf_nat_l4protos[NFPROTO_NUMPROTO]
987 + __read_mostly;
988 +
989 +-struct nf_nat_conn_key {
990 +- const struct net *net;
991 +- const struct nf_conntrack_tuple *tuple;
992 +- const struct nf_conntrack_zone *zone;
993 +-};
994 +-
995 +-static struct rhltable nf_nat_bysource_table;
996 ++static struct hlist_head *nf_nat_bysource __read_mostly;
997 ++static unsigned int nf_nat_htable_size __read_mostly;
998 ++static unsigned int nf_nat_hash_rnd __read_mostly;
999 +
1000 + inline const struct nf_nat_l3proto *
1001 + __nf_nat_l3proto_find(u8 family)
1002 +@@ -118,17 +116,19 @@ int nf_xfrm_me_harder(struct net *net, struct sk_buff *skb, unsigned int family)
1003 + EXPORT_SYMBOL(nf_xfrm_me_harder);
1004 + #endif /* CONFIG_XFRM */
1005 +
1006 +-static u32 nf_nat_bysource_hash(const void *data, u32 len, u32 seed)
1007 ++/* We keep an extra hash for each conntrack, for fast searching. */
1008 ++static unsigned int
1009 ++hash_by_src(const struct net *n, const struct nf_conntrack_tuple *tuple)
1010 + {
1011 +- const struct nf_conntrack_tuple *t;
1012 +- const struct nf_conn *ct = data;
1013 ++ unsigned int hash;
1014 ++
1015 ++ get_random_once(&nf_nat_hash_rnd, sizeof(nf_nat_hash_rnd));
1016 +
1017 +- t = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple;
1018 + /* Original src, to ensure we map it consistently if poss. */
1019 ++ hash = jhash2((u32 *)&tuple->src, sizeof(tuple->src) / sizeof(u32),
1020 ++ tuple->dst.protonum ^ nf_nat_hash_rnd ^ net_hash_mix(n));
1021 +
1022 +- seed ^= net_hash_mix(nf_ct_net(ct));
1023 +- return jhash2((const u32 *)&t->src, sizeof(t->src) / sizeof(u32),
1024 +- t->dst.protonum ^ seed);
1025 ++ return reciprocal_scale(hash, nf_nat_htable_size);
1026 + }
1027 +
1028 + /* Is this tuple already taken? (not by us) */
1029 +@@ -184,28 +184,6 @@ same_src(const struct nf_conn *ct,
1030 + t->src.u.all == tuple->src.u.all);
1031 + }
1032 +
1033 +-static int nf_nat_bysource_cmp(struct rhashtable_compare_arg *arg,
1034 +- const void *obj)
1035 +-{
1036 +- const struct nf_nat_conn_key *key = arg->key;
1037 +- const struct nf_conn *ct = obj;
1038 +-
1039 +- if (!same_src(ct, key->tuple) ||
1040 +- !net_eq(nf_ct_net(ct), key->net) ||
1041 +- !nf_ct_zone_equal(ct, key->zone, IP_CT_DIR_ORIGINAL))
1042 +- return 1;
1043 +-
1044 +- return 0;
1045 +-}
1046 +-
1047 +-static struct rhashtable_params nf_nat_bysource_params = {
1048 +- .head_offset = offsetof(struct nf_conn, nat_bysource),
1049 +- .obj_hashfn = nf_nat_bysource_hash,
1050 +- .obj_cmpfn = nf_nat_bysource_cmp,
1051 +- .nelem_hint = 256,
1052 +- .min_size = 1024,
1053 +-};
1054 +-
1055 + /* Only called for SRC manip */
1056 + static int
1057 + find_appropriate_src(struct net *net,
1058 +@@ -216,26 +194,22 @@ find_appropriate_src(struct net *net,
1059 + struct nf_conntrack_tuple *result,
1060 + const struct nf_nat_range *range)
1061 + {
1062 ++ unsigned int h = hash_by_src(net, tuple);
1063 + const struct nf_conn *ct;
1064 +- struct nf_nat_conn_key key = {
1065 +- .net = net,
1066 +- .tuple = tuple,
1067 +- .zone = zone
1068 +- };
1069 +- struct rhlist_head *hl, *h;
1070 +-
1071 +- hl = rhltable_lookup(&nf_nat_bysource_table, &key,
1072 +- nf_nat_bysource_params);
1073 +
1074 +- rhl_for_each_entry_rcu(ct, h, hl, nat_bysource) {
1075 +- nf_ct_invert_tuplepr(result,
1076 +- &ct->tuplehash[IP_CT_DIR_REPLY].tuple);
1077 +- result->dst = tuple->dst;
1078 +-
1079 +- if (in_range(l3proto, l4proto, result, range))
1080 +- return 1;
1081 ++ hlist_for_each_entry_rcu(ct, &nf_nat_bysource[h], nat_bysource) {
1082 ++ if (same_src(ct, tuple) &&
1083 ++ net_eq(net, nf_ct_net(ct)) &&
1084 ++ nf_ct_zone_equal(ct, zone, IP_CT_DIR_ORIGINAL)) {
1085 ++ /* Copy source part from reply tuple. */
1086 ++ nf_ct_invert_tuplepr(result,
1087 ++ &ct->tuplehash[IP_CT_DIR_REPLY].tuple);
1088 ++ result->dst = tuple->dst;
1089 ++
1090 ++ if (in_range(l3proto, l4proto, result, range))
1091 ++ return 1;
1092 ++ }
1093 + }
1094 +-
1095 + return 0;
1096 + }
1097 +
1098 +@@ -408,6 +382,7 @@ nf_nat_setup_info(struct nf_conn *ct,
1099 + const struct nf_nat_range *range,
1100 + enum nf_nat_manip_type maniptype)
1101 + {
1102 ++ struct net *net = nf_ct_net(ct);
1103 + struct nf_conntrack_tuple curr_tuple, new_tuple;
1104 +
1105 + /* Can't setup nat info for confirmed ct. */
1106 +@@ -447,19 +422,14 @@ nf_nat_setup_info(struct nf_conn *ct,
1107 + }
1108 +
1109 + if (maniptype == NF_NAT_MANIP_SRC) {
1110 +- struct nf_nat_conn_key key = {
1111 +- .net = nf_ct_net(ct),
1112 +- .tuple = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
1113 +- .zone = nf_ct_zone(ct),
1114 +- };
1115 +- int err;
1116 +-
1117 +- err = rhltable_insert_key(&nf_nat_bysource_table,
1118 +- &key,
1119 +- &ct->nat_bysource,
1120 +- nf_nat_bysource_params);
1121 +- if (err)
1122 +- return NF_DROP;
1123 ++ unsigned int srchash;
1124 ++
1125 ++ srchash = hash_by_src(net,
1126 ++ &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
1127 ++ spin_lock_bh(&nf_nat_lock);
1128 ++ hlist_add_head_rcu(&ct->nat_bysource,
1129 ++ &nf_nat_bysource[srchash]);
1130 ++ spin_unlock_bh(&nf_nat_lock);
1131 + }
1132 +
1133 + /* It's done. */
1134 +@@ -568,8 +538,9 @@ static int nf_nat_proto_clean(struct nf_conn *ct, void *data)
1135 + * will delete entry from already-freed table.
1136 + */
1137 + clear_bit(IPS_SRC_NAT_DONE_BIT, &ct->status);
1138 +- rhltable_remove(&nf_nat_bysource_table, &ct->nat_bysource,
1139 +- nf_nat_bysource_params);
1140 ++ spin_lock_bh(&nf_nat_lock);
1141 ++ hlist_del_rcu(&ct->nat_bysource);
1142 ++ spin_unlock_bh(&nf_nat_lock);
1143 +
1144 + /* don't delete conntrack. Although that would make things a lot
1145 + * simpler, we'd end up flushing all conntracks on nat rmmod.
1146 +@@ -697,9 +668,11 @@ EXPORT_SYMBOL_GPL(nf_nat_l3proto_unregister);
1147 + /* No one using conntrack by the time this called. */
1148 + static void nf_nat_cleanup_conntrack(struct nf_conn *ct)
1149 + {
1150 +- if (ct->status & IPS_SRC_NAT_DONE)
1151 +- rhltable_remove(&nf_nat_bysource_table, &ct->nat_bysource,
1152 +- nf_nat_bysource_params);
1153 ++ if (ct->status & IPS_SRC_NAT_DONE) {
1154 ++ spin_lock_bh(&nf_nat_lock);
1155 ++ hlist_del_rcu(&ct->nat_bysource);
1156 ++ spin_unlock_bh(&nf_nat_lock);
1157 ++ }
1158 + }
1159 +
1160 + static struct nf_ct_ext_type nat_extend __read_mostly = {
1161 +@@ -823,13 +796,16 @@ static int __init nf_nat_init(void)
1162 + {
1163 + int ret;
1164 +
1165 +- ret = rhltable_init(&nf_nat_bysource_table, &nf_nat_bysource_params);
1166 +- if (ret)
1167 +- return ret;
1168 ++ /* Leave them the same for the moment. */
1169 ++ nf_nat_htable_size = nf_conntrack_htable_size;
1170 ++
1171 ++ nf_nat_bysource = nf_ct_alloc_hashtable(&nf_nat_htable_size, 0);
1172 ++ if (!nf_nat_bysource)
1173 ++ return -ENOMEM;
1174 +
1175 + ret = nf_ct_extend_register(&nat_extend);
1176 + if (ret < 0) {
1177 +- rhltable_destroy(&nf_nat_bysource_table);
1178 ++ nf_ct_free_hashtable(nf_nat_bysource, nf_nat_htable_size);
1179 + printk(KERN_ERR "nf_nat_core: Unable to register extension\n");
1180 + return ret;
1181 + }
1182 +@@ -863,8 +839,8 @@ static void __exit nf_nat_cleanup(void)
1183 +
1184 + for (i = 0; i < NFPROTO_NUMPROTO; i++)
1185 + kfree(nf_nat_l4protos[i]);
1186 +-
1187 +- rhltable_destroy(&nf_nat_bysource_table);
1188 ++ synchronize_net();
1189 ++ nf_ct_free_hashtable(nf_nat_bysource, nf_nat_htable_size);
1190 + }
1191 +
1192 + MODULE_LICENSE("GPL");
1193 +diff --git a/net/netfilter/nft_set_hash.c b/net/netfilter/nft_set_hash.c
1194 +index 0fa01d772c5e..9c0d5a7ce5f9 100644
1195 +--- a/net/netfilter/nft_set_hash.c
1196 ++++ b/net/netfilter/nft_set_hash.c
1197 +@@ -643,7 +643,6 @@ nft_hash_select_ops(const struct nft_ctx *ctx, const struct nft_set_desc *desc,
1198 + {
1199 + if (desc->size) {
1200 + switch (desc->klen) {
1201 +- case 2:
1202 + case 4:
1203 + return &nft_hash_fast_ops;
1204 + default:
1205 +diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c
1206 +index 1ac0c423903e..6e47b823bcaa 100644
1207 +--- a/sound/core/hrtimer.c
1208 ++++ b/sound/core/hrtimer.c
1209 +@@ -159,6 +159,7 @@ static int __init snd_hrtimer_init(void)
1210 + timer->hw = hrtimer_hw;
1211 + timer->hw.resolution = resolution;
1212 + timer->hw.ticks = NANO_SEC / resolution;
1213 ++ timer->max_instances = 100; /* lower the limit */
1214 +
1215 + err = snd_timer_global_register(timer);
1216 + if (err < 0) {
1217 +diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c
1218 +index aaff9ee32695..b30b2139e3f0 100644
1219 +--- a/sound/core/seq/oss/seq_oss_midi.c
1220 ++++ b/sound/core/seq/oss/seq_oss_midi.c
1221 +@@ -612,9 +612,7 @@ send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, struct seq
1222 + if (!dp->timer->running)
1223 + len = snd_seq_oss_timer_start(dp->timer);
1224 + if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {
1225 +- if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
1226 +- snd_seq_oss_readq_puts(dp->readq, mdev->seq_device,
1227 +- ev->data.ext.ptr, ev->data.ext.len);
1228 ++ snd_seq_oss_readq_sysex(dp->readq, mdev->seq_device, ev);
1229 + } else {
1230 + len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev);
1231 + if (len > 0)
1232 +diff --git a/sound/core/seq/oss/seq_oss_readq.c b/sound/core/seq/oss/seq_oss_readq.c
1233 +index 046cb586fb2f..06b21226b4e7 100644
1234 +--- a/sound/core/seq/oss/seq_oss_readq.c
1235 ++++ b/sound/core/seq/oss/seq_oss_readq.c
1236 +@@ -117,6 +117,35 @@ snd_seq_oss_readq_puts(struct seq_oss_readq *q, int dev, unsigned char *data, in
1237 + return 0;
1238 + }
1239 +
1240 ++/*
1241 ++ * put MIDI sysex bytes; the event buffer may be chained, thus it has
1242 ++ * to be expanded via snd_seq_dump_var_event().
1243 ++ */
1244 ++struct readq_sysex_ctx {
1245 ++ struct seq_oss_readq *readq;
1246 ++ int dev;
1247 ++};
1248 ++
1249 ++static int readq_dump_sysex(void *ptr, void *buf, int count)
1250 ++{
1251 ++ struct readq_sysex_ctx *ctx = ptr;
1252 ++
1253 ++ return snd_seq_oss_readq_puts(ctx->readq, ctx->dev, buf, count);
1254 ++}
1255 ++
1256 ++int snd_seq_oss_readq_sysex(struct seq_oss_readq *q, int dev,
1257 ++ struct snd_seq_event *ev)
1258 ++{
1259 ++ struct readq_sysex_ctx ctx = {
1260 ++ .readq = q,
1261 ++ .dev = dev
1262 ++ };
1263 ++
1264 ++ if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
1265 ++ return 0;
1266 ++ return snd_seq_dump_var_event(ev, readq_dump_sysex, &ctx);
1267 ++}
1268 ++
1269 + /*
1270 + * copy an event to input queue:
1271 + * return zero if enqueued
1272 +diff --git a/sound/core/seq/oss/seq_oss_readq.h b/sound/core/seq/oss/seq_oss_readq.h
1273 +index f1463f1f449e..8d033ca2d23f 100644
1274 +--- a/sound/core/seq/oss/seq_oss_readq.h
1275 ++++ b/sound/core/seq/oss/seq_oss_readq.h
1276 +@@ -44,6 +44,8 @@ void snd_seq_oss_readq_delete(struct seq_oss_readq *q);
1277 + void snd_seq_oss_readq_clear(struct seq_oss_readq *readq);
1278 + unsigned int snd_seq_oss_readq_poll(struct seq_oss_readq *readq, struct file *file, poll_table *wait);
1279 + int snd_seq_oss_readq_puts(struct seq_oss_readq *readq, int dev, unsigned char *data, int len);
1280 ++int snd_seq_oss_readq_sysex(struct seq_oss_readq *q, int dev,
1281 ++ struct snd_seq_event *ev);
1282 + int snd_seq_oss_readq_put_event(struct seq_oss_readq *readq, union evrec *ev);
1283 + int snd_seq_oss_readq_put_timestamp(struct seq_oss_readq *readq, unsigned long curt, int seq_mode);
1284 + int snd_seq_oss_readq_pick(struct seq_oss_readq *q, union evrec *rec);
1285 +diff --git a/sound/core/timer.c b/sound/core/timer.c
1286 +index a9b9a277e00c..c8e4d0da13b4 100644
1287 +--- a/sound/core/timer.c
1288 ++++ b/sound/core/timer.c
1289 +@@ -180,7 +180,7 @@ static void snd_timer_request(struct snd_timer_id *tid)
1290 + *
1291 + * call this with register_mutex down.
1292 + */
1293 +-static void snd_timer_check_slave(struct snd_timer_instance *slave)
1294 ++static int snd_timer_check_slave(struct snd_timer_instance *slave)
1295 + {
1296 + struct snd_timer *timer;
1297 + struct snd_timer_instance *master;
1298 +@@ -190,16 +190,21 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave)
1299 + list_for_each_entry(master, &timer->open_list_head, open_list) {
1300 + if (slave->slave_class == master->slave_class &&
1301 + slave->slave_id == master->slave_id) {
1302 ++ if (master->timer->num_instances >=
1303 ++ master->timer->max_instances)
1304 ++ return -EBUSY;
1305 + list_move_tail(&slave->open_list,
1306 + &master->slave_list_head);
1307 ++ master->timer->num_instances++;
1308 + spin_lock_irq(&slave_active_lock);
1309 + slave->master = master;
1310 + slave->timer = master->timer;
1311 + spin_unlock_irq(&slave_active_lock);
1312 +- return;
1313 ++ return 0;
1314 + }
1315 + }
1316 + }
1317 ++ return 0;
1318 + }
1319 +
1320 + /*
1321 +@@ -208,7 +213,7 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave)
1322 + *
1323 + * call this with register_mutex down.
1324 + */
1325 +-static void snd_timer_check_master(struct snd_timer_instance *master)
1326 ++static int snd_timer_check_master(struct snd_timer_instance *master)
1327 + {
1328 + struct snd_timer_instance *slave, *tmp;
1329 +
1330 +@@ -216,7 +221,11 @@ static void snd_timer_check_master(struct snd_timer_instance *master)
1331 + list_for_each_entry_safe(slave, tmp, &snd_timer_slave_list, open_list) {
1332 + if (slave->slave_class == master->slave_class &&
1333 + slave->slave_id == master->slave_id) {
1334 ++ if (master->timer->num_instances >=
1335 ++ master->timer->max_instances)
1336 ++ return -EBUSY;
1337 + list_move_tail(&slave->open_list, &master->slave_list_head);
1338 ++ master->timer->num_instances++;
1339 + spin_lock_irq(&slave_active_lock);
1340 + spin_lock(&master->timer->lock);
1341 + slave->master = master;
1342 +@@ -228,8 +237,11 @@ static void snd_timer_check_master(struct snd_timer_instance *master)
1343 + spin_unlock_irq(&slave_active_lock);
1344 + }
1345 + }
1346 ++ return 0;
1347 + }
1348 +
1349 ++static int snd_timer_close_locked(struct snd_timer_instance *timeri);
1350 ++
1351 + /*
1352 + * open a timer instance
1353 + * when opening a master, the slave id must be here given.
1354 +@@ -240,6 +252,7 @@ int snd_timer_open(struct snd_timer_instance **ti,
1355 + {
1356 + struct snd_timer *timer;
1357 + struct snd_timer_instance *timeri = NULL;
1358 ++ int err;
1359 +
1360 + if (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) {
1361 + /* open a slave instance */
1362 +@@ -259,10 +272,14 @@ int snd_timer_open(struct snd_timer_instance **ti,
1363 + timeri->slave_id = tid->device;
1364 + timeri->flags |= SNDRV_TIMER_IFLG_SLAVE;
1365 + list_add_tail(&timeri->open_list, &snd_timer_slave_list);
1366 +- snd_timer_check_slave(timeri);
1367 ++ err = snd_timer_check_slave(timeri);
1368 ++ if (err < 0) {
1369 ++ snd_timer_close_locked(timeri);
1370 ++ timeri = NULL;
1371 ++ }
1372 + mutex_unlock(&register_mutex);
1373 + *ti = timeri;
1374 +- return 0;
1375 ++ return err;
1376 + }
1377 +
1378 + /* open a master instance */
1379 +@@ -288,6 +305,10 @@ int snd_timer_open(struct snd_timer_instance **ti,
1380 + return -EBUSY;
1381 + }
1382 + }
1383 ++ if (timer->num_instances >= timer->max_instances) {
1384 ++ mutex_unlock(&register_mutex);
1385 ++ return -EBUSY;
1386 ++ }
1387 + timeri = snd_timer_instance_new(owner, timer);
1388 + if (!timeri) {
1389 + mutex_unlock(&register_mutex);
1390 +@@ -314,25 +335,27 @@ int snd_timer_open(struct snd_timer_instance **ti,
1391 + }
1392 +
1393 + list_add_tail(&timeri->open_list, &timer->open_list_head);
1394 +- snd_timer_check_master(timeri);
1395 ++ timer->num_instances++;
1396 ++ err = snd_timer_check_master(timeri);
1397 ++ if (err < 0) {
1398 ++ snd_timer_close_locked(timeri);
1399 ++ timeri = NULL;
1400 ++ }
1401 + mutex_unlock(&register_mutex);
1402 + *ti = timeri;
1403 +- return 0;
1404 ++ return err;
1405 + }
1406 + EXPORT_SYMBOL(snd_timer_open);
1407 +
1408 + /*
1409 + * close a timer instance
1410 ++ * call this with register_mutex down.
1411 + */
1412 +-int snd_timer_close(struct snd_timer_instance *timeri)
1413 ++static int snd_timer_close_locked(struct snd_timer_instance *timeri)
1414 + {
1415 + struct snd_timer *timer = NULL;
1416 + struct snd_timer_instance *slave, *tmp;
1417 +
1418 +- if (snd_BUG_ON(!timeri))
1419 +- return -ENXIO;
1420 +-
1421 +- mutex_lock(&register_mutex);
1422 + list_del(&timeri->open_list);
1423 +
1424 + /* force to stop the timer */
1425 +@@ -340,6 +363,7 @@ int snd_timer_close(struct snd_timer_instance *timeri)
1426 +
1427 + timer = timeri->timer;
1428 + if (timer) {
1429 ++ timer->num_instances--;
1430 + /* wait, until the active callback is finished */
1431 + spin_lock_irq(&timer->lock);
1432 + while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) {
1433 +@@ -355,6 +379,7 @@ int snd_timer_close(struct snd_timer_instance *timeri)
1434 + list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head,
1435 + open_list) {
1436 + list_move_tail(&slave->open_list, &snd_timer_slave_list);
1437 ++ timer->num_instances--;
1438 + slave->master = NULL;
1439 + slave->timer = NULL;
1440 + list_del_init(&slave->ack_list);
1441 +@@ -382,9 +407,24 @@ int snd_timer_close(struct snd_timer_instance *timeri)
1442 + module_put(timer->module);
1443 + }
1444 +
1445 +- mutex_unlock(&register_mutex);
1446 + return 0;
1447 + }
1448 ++
1449 ++/*
1450 ++ * close a timer instance
1451 ++ */
1452 ++int snd_timer_close(struct snd_timer_instance *timeri)
1453 ++{
1454 ++ int err;
1455 ++
1456 ++ if (snd_BUG_ON(!timeri))
1457 ++ return -ENXIO;
1458 ++
1459 ++ mutex_lock(&register_mutex);
1460 ++ err = snd_timer_close_locked(timeri);
1461 ++ mutex_unlock(&register_mutex);
1462 ++ return err;
1463 ++}
1464 + EXPORT_SYMBOL(snd_timer_close);
1465 +
1466 + unsigned long snd_timer_resolution(struct snd_timer_instance *timeri)
1467 +@@ -855,6 +895,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
1468 + spin_lock_init(&timer->lock);
1469 + tasklet_init(&timer->task_queue, snd_timer_tasklet,
1470 + (unsigned long)timer);
1471 ++ timer->max_instances = 1000; /* default limit per timer */
1472 + if (card != NULL) {
1473 + timer->module = card->module;
1474 + err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops);
1475 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1476 +index fe4d06398fc3..c5f0e8d42d22 100644
1477 +--- a/sound/pci/hda/patch_realtek.c
1478 ++++ b/sound/pci/hda/patch_realtek.c
1479 +@@ -6527,6 +6527,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
1480 + {0x14, 0x90170110},
1481 + {0x1b, 0x90a70130},
1482 + {0x21, 0x03211020}),
1483 ++ SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
1484 ++ {0x12, 0xb7a60130},
1485 ++ {0x13, 0xb8a61140},
1486 ++ {0x16, 0x90170110},
1487 ++ {0x21, 0x04211020}),
1488 + SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
1489 + {0x12, 0x90a60130},
1490 + {0x14, 0x90170110},
1491 +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
1492 +index 0e54fe490458..f910c4fd932b 100644
1493 +--- a/sound/usb/quirks.c
1494 ++++ b/sound/usb/quirks.c
1495 +@@ -1373,6 +1373,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
1496 + case 0x199:
1497 + return SNDRV_PCM_FMTBIT_DSD_U32_LE;
1498 + case 0x19b:
1499 ++ case 0x203:
1500 + return SNDRV_PCM_FMTBIT_DSD_U32_BE;
1501 + default:
1502 + break;