Annotation of /trunk/kernel-alx/patches-4.9/0282-4.9.183-all-fixes.patch
Parent Directory | Revision Log
Revision 3362 -
(hide annotations)
(download)
Tue Jun 25 14:03:10 2019 UTC (4 years, 10 months ago) by niro
File size: 105111 byte(s)
Tue Jun 25 14:03:10 2019 UTC (4 years, 10 months ago) by niro
File size: 105111 byte(s)
-linux-4.9.183
1 | niro | 3362 | diff --git a/Makefile b/Makefile |
2 | index f34cb9225255..e63ace93b67b 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,6 +1,6 @@ | ||
6 | VERSION = 4 | ||
7 | PATCHLEVEL = 9 | ||
8 | -SUBLEVEL = 182 | ||
9 | +SUBLEVEL = 183 | ||
10 | EXTRAVERSION = | ||
11 | NAME = Roaring Lionus | ||
12 | |||
13 | diff --git a/arch/arm/boot/dts/exynos5420-arndale-octa.dts b/arch/arm/boot/dts/exynos5420-arndale-octa.dts | ||
14 | index 9cc83c51c925..e664c33c3c64 100644 | ||
15 | --- a/arch/arm/boot/dts/exynos5420-arndale-octa.dts | ||
16 | +++ b/arch/arm/boot/dts/exynos5420-arndale-octa.dts | ||
17 | @@ -110,6 +110,7 @@ | ||
18 | regulator-name = "PVDD_APIO_1V8"; | ||
19 | regulator-min-microvolt = <1800000>; | ||
20 | regulator-max-microvolt = <1800000>; | ||
21 | + regulator-always-on; | ||
22 | }; | ||
23 | |||
24 | ldo3_reg: LDO3 { | ||
25 | @@ -148,6 +149,7 @@ | ||
26 | regulator-name = "PVDD_ABB_1V8"; | ||
27 | regulator-min-microvolt = <1800000>; | ||
28 | regulator-max-microvolt = <1800000>; | ||
29 | + regulator-always-on; | ||
30 | }; | ||
31 | |||
32 | ldo9_reg: LDO9 { | ||
33 | diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi | ||
34 | index b13b0b2db881..8ccafdfbe87c 100644 | ||
35 | --- a/arch/arm/boot/dts/imx6qdl.dtsi | ||
36 | +++ b/arch/arm/boot/dts/imx6qdl.dtsi | ||
37 | @@ -875,7 +875,7 @@ | ||
38 | compatible = "fsl,imx6q-sdma", "fsl,imx35-sdma"; | ||
39 | reg = <0x020ec000 0x4000>; | ||
40 | interrupts = <0 2 IRQ_TYPE_LEVEL_HIGH>; | ||
41 | - clocks = <&clks IMX6QDL_CLK_SDMA>, | ||
42 | + clocks = <&clks IMX6QDL_CLK_IPG>, | ||
43 | <&clks IMX6QDL_CLK_SDMA>; | ||
44 | clock-names = "ipg", "ahb"; | ||
45 | #dma-cells = <3>; | ||
46 | diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi | ||
47 | index 02378db3f5fc..a2c76797e871 100644 | ||
48 | --- a/arch/arm/boot/dts/imx6sl.dtsi | ||
49 | +++ b/arch/arm/boot/dts/imx6sl.dtsi | ||
50 | @@ -704,7 +704,7 @@ | ||
51 | reg = <0x020ec000 0x4000>; | ||
52 | interrupts = <0 2 IRQ_TYPE_LEVEL_HIGH>; | ||
53 | clocks = <&clks IMX6SL_CLK_SDMA>, | ||
54 | - <&clks IMX6SL_CLK_SDMA>; | ||
55 | + <&clks IMX6SL_CLK_AHB>; | ||
56 | clock-names = "ipg", "ahb"; | ||
57 | #dma-cells = <3>; | ||
58 | /* imx6sl reuses imx6q sdma firmware */ | ||
59 | diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi | ||
60 | index a885052157f0..5834194b62e1 100644 | ||
61 | --- a/arch/arm/boot/dts/imx6sx.dtsi | ||
62 | +++ b/arch/arm/boot/dts/imx6sx.dtsi | ||
63 | @@ -751,7 +751,7 @@ | ||
64 | compatible = "fsl,imx6sx-sdma", "fsl,imx6q-sdma"; | ||
65 | reg = <0x020ec000 0x4000>; | ||
66 | interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; | ||
67 | - clocks = <&clks IMX6SX_CLK_SDMA>, | ||
68 | + clocks = <&clks IMX6SX_CLK_IPG>, | ||
69 | <&clks IMX6SX_CLK_SDMA>; | ||
70 | clock-names = "ipg", "ahb"; | ||
71 | #dma-cells = <3>; | ||
72 | diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi | ||
73 | index c5c05fdccc78..7839300fe46b 100644 | ||
74 | --- a/arch/arm/boot/dts/imx6ul.dtsi | ||
75 | +++ b/arch/arm/boot/dts/imx6ul.dtsi | ||
76 | @@ -669,7 +669,7 @@ | ||
77 | "fsl,imx35-sdma"; | ||
78 | reg = <0x020ec000 0x4000>; | ||
79 | interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; | ||
80 | - clocks = <&clks IMX6UL_CLK_SDMA>, | ||
81 | + clocks = <&clks IMX6UL_CLK_IPG>, | ||
82 | <&clks IMX6UL_CLK_SDMA>; | ||
83 | clock-names = "ipg", "ahb"; | ||
84 | #dma-cells = <3>; | ||
85 | diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi | ||
86 | index 2b6cb05bc01a..edc5ddeb851a 100644 | ||
87 | --- a/arch/arm/boot/dts/imx7s.dtsi | ||
88 | +++ b/arch/arm/boot/dts/imx7s.dtsi | ||
89 | @@ -962,8 +962,8 @@ | ||
90 | compatible = "fsl,imx7d-sdma", "fsl,imx35-sdma"; | ||
91 | reg = <0x30bd0000 0x10000>; | ||
92 | interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; | ||
93 | - clocks = <&clks IMX7D_SDMA_CORE_CLK>, | ||
94 | - <&clks IMX7D_AHB_CHANNEL_ROOT_CLK>; | ||
95 | + clocks = <&clks IMX7D_IPG_ROOT_CLK>, | ||
96 | + <&clks IMX7D_SDMA_CORE_CLK>; | ||
97 | clock-names = "ipg", "ahb"; | ||
98 | #dma-cells = <3>; | ||
99 | fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin"; | ||
100 | diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h | ||
101 | index 3d7351c844aa..2fd0a2619b0b 100644 | ||
102 | --- a/arch/arm/include/asm/hardirq.h | ||
103 | +++ b/arch/arm/include/asm/hardirq.h | ||
104 | @@ -5,6 +5,7 @@ | ||
105 | #include <linux/threads.h> | ||
106 | #include <asm/irq.h> | ||
107 | |||
108 | +/* number of IPIS _not_ including IPI_CPU_BACKTRACE */ | ||
109 | #define NR_IPI 7 | ||
110 | |||
111 | typedef struct { | ||
112 | diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c | ||
113 | index 7a5dc011c523..deea60f01d24 100644 | ||
114 | --- a/arch/arm/kernel/smp.c | ||
115 | +++ b/arch/arm/kernel/smp.c | ||
116 | @@ -75,6 +75,10 @@ enum ipi_msg_type { | ||
117 | IPI_CPU_STOP, | ||
118 | IPI_IRQ_WORK, | ||
119 | IPI_COMPLETION, | ||
120 | + /* | ||
121 | + * CPU_BACKTRACE is special and not included in NR_IPI | ||
122 | + * or tracable with trace_ipi_* | ||
123 | + */ | ||
124 | IPI_CPU_BACKTRACE, | ||
125 | /* | ||
126 | * SGI8-15 can be reserved by secure firmware, and thus may | ||
127 | @@ -801,7 +805,7 @@ core_initcall(register_cpufreq_notifier); | ||
128 | |||
129 | static void raise_nmi(cpumask_t *mask) | ||
130 | { | ||
131 | - smp_cross_call(mask, IPI_CPU_BACKTRACE); | ||
132 | + __smp_cross_call(mask, IPI_CPU_BACKTRACE); | ||
133 | } | ||
134 | |||
135 | void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self) | ||
136 | diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c | ||
137 | index 81c935ce089b..b406c12077b9 100644 | ||
138 | --- a/arch/arm/mach-exynos/suspend.c | ||
139 | +++ b/arch/arm/mach-exynos/suspend.c | ||
140 | @@ -500,8 +500,27 @@ early_wakeup: | ||
141 | |||
142 | static void exynos5420_prepare_pm_resume(void) | ||
143 | { | ||
144 | + unsigned int mpidr, cluster; | ||
145 | + | ||
146 | + mpidr = read_cpuid_mpidr(); | ||
147 | + cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); | ||
148 | + | ||
149 | if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) | ||
150 | WARN_ON(mcpm_cpu_powered_up()); | ||
151 | + | ||
152 | + if (IS_ENABLED(CONFIG_HW_PERF_EVENTS) && cluster != 0) { | ||
153 | + /* | ||
154 | + * When system is resumed on the LITTLE/KFC core (cluster 1), | ||
155 | + * the DSCR is not properly updated until the power is turned | ||
156 | + * on also for the cluster 0. Enable it for a while to | ||
157 | + * propagate the SPNIDEN and SPIDEN signals from Secure JTAG | ||
158 | + * block and avoid undefined instruction issue on CP14 reset. | ||
159 | + */ | ||
160 | + pmu_raw_writel(S5P_CORE_LOCAL_PWR_EN, | ||
161 | + EXYNOS_COMMON_CONFIGURATION(0)); | ||
162 | + pmu_raw_writel(0, | ||
163 | + EXYNOS_COMMON_CONFIGURATION(0)); | ||
164 | + } | ||
165 | } | ||
166 | |||
167 | static void exynos5420_pm_resume(void) | ||
168 | diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c | ||
169 | index 0a56898f8410..efd65fc85238 100644 | ||
170 | --- a/arch/arm64/mm/mmu.c | ||
171 | +++ b/arch/arm64/mm/mmu.c | ||
172 | @@ -765,13 +765,18 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys) | ||
173 | |||
174 | int __init arch_ioremap_pud_supported(void) | ||
175 | { | ||
176 | - /* only 4k granule supports level 1 block mappings */ | ||
177 | - return IS_ENABLED(CONFIG_ARM64_4K_PAGES); | ||
178 | + /* | ||
179 | + * Only 4k granule supports level 1 block mappings. | ||
180 | + * SW table walks can't handle removal of intermediate entries. | ||
181 | + */ | ||
182 | + return IS_ENABLED(CONFIG_ARM64_4K_PAGES) && | ||
183 | + !IS_ENABLED(CONFIG_ARM64_PTDUMP_DEBUGFS); | ||
184 | } | ||
185 | |||
186 | int __init arch_ioremap_pmd_supported(void) | ||
187 | { | ||
188 | - return 1; | ||
189 | + /* See arch_ioremap_pud_supported() */ | ||
190 | + return !IS_ENABLED(CONFIG_ARM64_PTDUMP_DEBUGFS); | ||
191 | } | ||
192 | |||
193 | int pud_set_huge(pud_t *pud, phys_addr_t phys, pgprot_t prot) | ||
194 | diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c | ||
195 | index aa19b7ac8222..476c7b4be378 100644 | ||
196 | --- a/arch/ia64/mm/numa.c | ||
197 | +++ b/arch/ia64/mm/numa.c | ||
198 | @@ -49,6 +49,7 @@ paddr_to_nid(unsigned long paddr) | ||
199 | |||
200 | return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0); | ||
201 | } | ||
202 | +EXPORT_SYMBOL(paddr_to_nid); | ||
203 | |||
204 | #if defined(CONFIG_SPARSEMEM) && defined(CONFIG_NUMA) | ||
205 | /* | ||
206 | diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h | ||
207 | index 5e12e19940e2..defa553fe823 100644 | ||
208 | --- a/arch/powerpc/include/asm/kvm_host.h | ||
209 | +++ b/arch/powerpc/include/asm/kvm_host.h | ||
210 | @@ -271,6 +271,7 @@ struct kvm_arch { | ||
211 | #ifdef CONFIG_PPC_BOOK3S_64 | ||
212 | struct list_head spapr_tce_tables; | ||
213 | struct list_head rtas_tokens; | ||
214 | + struct mutex rtas_token_lock; | ||
215 | DECLARE_BITMAP(enabled_hcalls, MAX_HCALL_OPCODE/4 + 1); | ||
216 | #endif | ||
217 | #ifdef CONFIG_KVM_MPIC | ||
218 | diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c | ||
219 | index b6952dd23152..73c3c127d858 100644 | ||
220 | --- a/arch/powerpc/kvm/book3s.c | ||
221 | +++ b/arch/powerpc/kvm/book3s.c | ||
222 | @@ -811,6 +811,7 @@ int kvmppc_core_init_vm(struct kvm *kvm) | ||
223 | #ifdef CONFIG_PPC64 | ||
224 | INIT_LIST_HEAD_RCU(&kvm->arch.spapr_tce_tables); | ||
225 | INIT_LIST_HEAD(&kvm->arch.rtas_tokens); | ||
226 | + mutex_init(&kvm->arch.rtas_token_lock); | ||
227 | #endif | ||
228 | |||
229 | return kvm->arch.kvm_ops->init_vm(kvm); | ||
230 | diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c | ||
231 | index 0a2b247dbc6b..e840f943cd2c 100644 | ||
232 | --- a/arch/powerpc/kvm/book3s_hv.c | ||
233 | +++ b/arch/powerpc/kvm/book3s_hv.c | ||
234 | @@ -374,12 +374,7 @@ static void kvmppc_dump_regs(struct kvm_vcpu *vcpu) | ||
235 | |||
236 | static struct kvm_vcpu *kvmppc_find_vcpu(struct kvm *kvm, int id) | ||
237 | { | ||
238 | - struct kvm_vcpu *ret; | ||
239 | - | ||
240 | - mutex_lock(&kvm->lock); | ||
241 | - ret = kvm_get_vcpu_by_id(kvm, id); | ||
242 | - mutex_unlock(&kvm->lock); | ||
243 | - return ret; | ||
244 | + return kvm_get_vcpu_by_id(kvm, id); | ||
245 | } | ||
246 | |||
247 | static void init_vpa(struct kvm_vcpu *vcpu, struct lppaca *vpa) | ||
248 | @@ -1098,7 +1093,6 @@ static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr, | ||
249 | struct kvmppc_vcore *vc = vcpu->arch.vcore; | ||
250 | u64 mask; | ||
251 | |||
252 | - mutex_lock(&kvm->lock); | ||
253 | spin_lock(&vc->lock); | ||
254 | /* | ||
255 | * If ILE (interrupt little-endian) has changed, update the | ||
256 | @@ -1132,7 +1126,6 @@ static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr, | ||
257 | mask &= 0xFFFFFFFF; | ||
258 | vc->lpcr = (vc->lpcr & ~mask) | (new_lpcr & mask); | ||
259 | spin_unlock(&vc->lock); | ||
260 | - mutex_unlock(&kvm->lock); | ||
261 | } | ||
262 | |||
263 | static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id, | ||
264 | diff --git a/arch/powerpc/kvm/book3s_rtas.c b/arch/powerpc/kvm/book3s_rtas.c | ||
265 | index ef27fbd5d9c5..b1b2273d1f6d 100644 | ||
266 | --- a/arch/powerpc/kvm/book3s_rtas.c | ||
267 | +++ b/arch/powerpc/kvm/book3s_rtas.c | ||
268 | @@ -133,7 +133,7 @@ static int rtas_token_undefine(struct kvm *kvm, char *name) | ||
269 | { | ||
270 | struct rtas_token_definition *d, *tmp; | ||
271 | |||
272 | - lockdep_assert_held(&kvm->lock); | ||
273 | + lockdep_assert_held(&kvm->arch.rtas_token_lock); | ||
274 | |||
275 | list_for_each_entry_safe(d, tmp, &kvm->arch.rtas_tokens, list) { | ||
276 | if (rtas_name_matches(d->handler->name, name)) { | ||
277 | @@ -154,7 +154,7 @@ static int rtas_token_define(struct kvm *kvm, char *name, u64 token) | ||
278 | bool found; | ||
279 | int i; | ||
280 | |||
281 | - lockdep_assert_held(&kvm->lock); | ||
282 | + lockdep_assert_held(&kvm->arch.rtas_token_lock); | ||
283 | |||
284 | list_for_each_entry(d, &kvm->arch.rtas_tokens, list) { | ||
285 | if (d->token == token) | ||
286 | @@ -193,14 +193,14 @@ int kvm_vm_ioctl_rtas_define_token(struct kvm *kvm, void __user *argp) | ||
287 | if (copy_from_user(&args, argp, sizeof(args))) | ||
288 | return -EFAULT; | ||
289 | |||
290 | - mutex_lock(&kvm->lock); | ||
291 | + mutex_lock(&kvm->arch.rtas_token_lock); | ||
292 | |||
293 | if (args.token) | ||
294 | rc = rtas_token_define(kvm, args.name, args.token); | ||
295 | else | ||
296 | rc = rtas_token_undefine(kvm, args.name); | ||
297 | |||
298 | - mutex_unlock(&kvm->lock); | ||
299 | + mutex_unlock(&kvm->arch.rtas_token_lock); | ||
300 | |||
301 | return rc; | ||
302 | } | ||
303 | @@ -232,7 +232,7 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu) | ||
304 | orig_rets = args.rets; | ||
305 | args.rets = &args.args[be32_to_cpu(args.nargs)]; | ||
306 | |||
307 | - mutex_lock(&vcpu->kvm->lock); | ||
308 | + mutex_lock(&vcpu->kvm->arch.rtas_token_lock); | ||
309 | |||
310 | rc = -ENOENT; | ||
311 | list_for_each_entry(d, &vcpu->kvm->arch.rtas_tokens, list) { | ||
312 | @@ -243,7 +243,7 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu) | ||
313 | } | ||
314 | } | ||
315 | |||
316 | - mutex_unlock(&vcpu->kvm->lock); | ||
317 | + mutex_unlock(&vcpu->kvm->arch.rtas_token_lock); | ||
318 | |||
319 | if (rc == 0) { | ||
320 | args.rets = orig_rets; | ||
321 | @@ -269,8 +269,6 @@ void kvmppc_rtas_tokens_free(struct kvm *kvm) | ||
322 | { | ||
323 | struct rtas_token_definition *d, *tmp; | ||
324 | |||
325 | - lockdep_assert_held(&kvm->lock); | ||
326 | - | ||
327 | list_for_each_entry_safe(d, tmp, &kvm->arch.rtas_tokens, list) { | ||
328 | list_del(&d->list); | ||
329 | kfree(d); | ||
330 | diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c | ||
331 | index 2032ab81b2d7..07f571900676 100644 | ||
332 | --- a/arch/s390/kvm/kvm-s390.c | ||
333 | +++ b/arch/s390/kvm/kvm-s390.c | ||
334 | @@ -3288,21 +3288,28 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, | ||
335 | const struct kvm_memory_slot *new, | ||
336 | enum kvm_mr_change change) | ||
337 | { | ||
338 | - int rc; | ||
339 | - | ||
340 | - /* If the basics of the memslot do not change, we do not want | ||
341 | - * to update the gmap. Every update causes several unnecessary | ||
342 | - * segment translation exceptions. This is usually handled just | ||
343 | - * fine by the normal fault handler + gmap, but it will also | ||
344 | - * cause faults on the prefix page of running guest CPUs. | ||
345 | - */ | ||
346 | - if (old->userspace_addr == mem->userspace_addr && | ||
347 | - old->base_gfn * PAGE_SIZE == mem->guest_phys_addr && | ||
348 | - old->npages * PAGE_SIZE == mem->memory_size) | ||
349 | - return; | ||
350 | + int rc = 0; | ||
351 | |||
352 | - rc = gmap_map_segment(kvm->arch.gmap, mem->userspace_addr, | ||
353 | - mem->guest_phys_addr, mem->memory_size); | ||
354 | + switch (change) { | ||
355 | + case KVM_MR_DELETE: | ||
356 | + rc = gmap_unmap_segment(kvm->arch.gmap, old->base_gfn * PAGE_SIZE, | ||
357 | + old->npages * PAGE_SIZE); | ||
358 | + break; | ||
359 | + case KVM_MR_MOVE: | ||
360 | + rc = gmap_unmap_segment(kvm->arch.gmap, old->base_gfn * PAGE_SIZE, | ||
361 | + old->npages * PAGE_SIZE); | ||
362 | + if (rc) | ||
363 | + break; | ||
364 | + /* FALLTHROUGH */ | ||
365 | + case KVM_MR_CREATE: | ||
366 | + rc = gmap_map_segment(kvm->arch.gmap, mem->userspace_addr, | ||
367 | + mem->guest_phys_addr, mem->memory_size); | ||
368 | + break; | ||
369 | + case KVM_MR_FLAGS_ONLY: | ||
370 | + break; | ||
371 | + default: | ||
372 | + WARN(1, "Unknown KVM MR CHANGE: %d\n", change); | ||
373 | + } | ||
374 | if (rc) | ||
375 | pr_warn("failed to commit memory region\n"); | ||
376 | return; | ||
377 | diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c | ||
378 | index 25c23666d592..040e3efdc9a6 100644 | ||
379 | --- a/arch/um/kernel/time.c | ||
380 | +++ b/arch/um/kernel/time.c | ||
381 | @@ -56,7 +56,7 @@ static int itimer_one_shot(struct clock_event_device *evt) | ||
382 | static struct clock_event_device timer_clockevent = { | ||
383 | .name = "posix-timer", | ||
384 | .rating = 250, | ||
385 | - .cpumask = cpu_all_mask, | ||
386 | + .cpumask = cpu_possible_mask, | ||
387 | .features = CLOCK_EVT_FEAT_PERIODIC | | ||
388 | CLOCK_EVT_FEAT_ONESHOT, | ||
389 | .set_state_shutdown = itimer_shutdown, | ||
390 | diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c | ||
391 | index cb8178a2783a..e98e238d3775 100644 | ||
392 | --- a/arch/x86/events/intel/core.c | ||
393 | +++ b/arch/x86/events/intel/core.c | ||
394 | @@ -2867,7 +2867,7 @@ static int intel_pmu_hw_config(struct perf_event *event) | ||
395 | return ret; | ||
396 | |||
397 | if (event->attr.precise_ip) { | ||
398 | - if (!(event->attr.freq || event->attr.wakeup_events)) { | ||
399 | + if (!(event->attr.freq || (event->attr.wakeup_events && !event->attr.watermark))) { | ||
400 | event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD; | ||
401 | if (!(event->attr.sample_type & | ||
402 | ~intel_pmu_free_running_flags(event))) | ||
403 | diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c | ||
404 | index f26e26e4d84f..ad31c01f810f 100644 | ||
405 | --- a/arch/x86/events/intel/ds.c | ||
406 | +++ b/arch/x86/events/intel/ds.c | ||
407 | @@ -655,7 +655,7 @@ struct event_constraint intel_core2_pebs_event_constraints[] = { | ||
408 | INTEL_FLAGS_UEVENT_CONSTRAINT(0x1fc7, 0x1), /* SIMD_INST_RETURED.ANY */ | ||
409 | INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */ | ||
410 | /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */ | ||
411 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x01), | ||
412 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108000c0, 0x01), | ||
413 | EVENT_CONSTRAINT_END | ||
414 | }; | ||
415 | |||
416 | @@ -664,7 +664,7 @@ struct event_constraint intel_atom_pebs_event_constraints[] = { | ||
417 | INTEL_FLAGS_UEVENT_CONSTRAINT(0x00c5, 0x1), /* MISPREDICTED_BRANCH_RETIRED */ | ||
418 | INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */ | ||
419 | /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */ | ||
420 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x01), | ||
421 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108000c0, 0x01), | ||
422 | /* Allow all events as PEBS with no flags */ | ||
423 | INTEL_ALL_EVENT_CONSTRAINT(0, 0x1), | ||
424 | EVENT_CONSTRAINT_END | ||
425 | @@ -672,7 +672,7 @@ struct event_constraint intel_atom_pebs_event_constraints[] = { | ||
426 | |||
427 | struct event_constraint intel_slm_pebs_event_constraints[] = { | ||
428 | /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */ | ||
429 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x1), | ||
430 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108000c0, 0x1), | ||
431 | /* Allow all events as PEBS with no flags */ | ||
432 | INTEL_ALL_EVENT_CONSTRAINT(0, 0x1), | ||
433 | EVENT_CONSTRAINT_END | ||
434 | @@ -697,7 +697,7 @@ struct event_constraint intel_nehalem_pebs_event_constraints[] = { | ||
435 | INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */ | ||
436 | INTEL_FLAGS_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */ | ||
437 | /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */ | ||
438 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x0f), | ||
439 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108000c0, 0x0f), | ||
440 | EVENT_CONSTRAINT_END | ||
441 | }; | ||
442 | |||
443 | @@ -714,7 +714,7 @@ struct event_constraint intel_westmere_pebs_event_constraints[] = { | ||
444 | INTEL_FLAGS_EVENT_CONSTRAINT(0xcb, 0xf), /* MEM_LOAD_RETIRED.* */ | ||
445 | INTEL_FLAGS_EVENT_CONSTRAINT(0xf7, 0xf), /* FP_ASSIST.* */ | ||
446 | /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */ | ||
447 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x0f), | ||
448 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108000c0, 0x0f), | ||
449 | EVENT_CONSTRAINT_END | ||
450 | }; | ||
451 | |||
452 | @@ -723,7 +723,7 @@ struct event_constraint intel_snb_pebs_event_constraints[] = { | ||
453 | INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.LAT_ABOVE_THR */ | ||
454 | INTEL_PST_CONSTRAINT(0x02cd, 0x8), /* MEM_TRANS_RETIRED.PRECISE_STORES */ | ||
455 | /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ | ||
456 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c2, 0xf), | ||
457 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c2, 0xf), | ||
458 | INTEL_EXCLEVT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */ | ||
459 | INTEL_EXCLEVT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ | ||
460 | INTEL_EXCLEVT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ | ||
461 | @@ -738,9 +738,9 @@ struct event_constraint intel_ivb_pebs_event_constraints[] = { | ||
462 | INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.LAT_ABOVE_THR */ | ||
463 | INTEL_PST_CONSTRAINT(0x02cd, 0x8), /* MEM_TRANS_RETIRED.PRECISE_STORES */ | ||
464 | /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ | ||
465 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c2, 0xf), | ||
466 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c2, 0xf), | ||
467 | /* INST_RETIRED.PREC_DIST, inv=1, cmask=16 (cycles:ppp). */ | ||
468 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c0, 0x2), | ||
469 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c0, 0x2), | ||
470 | INTEL_EXCLEVT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */ | ||
471 | INTEL_EXCLEVT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ | ||
472 | INTEL_EXCLEVT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ | ||
473 | @@ -754,9 +754,9 @@ struct event_constraint intel_hsw_pebs_event_constraints[] = { | ||
474 | INTEL_FLAGS_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */ | ||
475 | INTEL_PLD_CONSTRAINT(0x01cd, 0xf), /* MEM_TRANS_RETIRED.* */ | ||
476 | /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ | ||
477 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c2, 0xf), | ||
478 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c2, 0xf), | ||
479 | /* INST_RETIRED.PREC_DIST, inv=1, cmask=16 (cycles:ppp). */ | ||
480 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c0, 0x2), | ||
481 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c0, 0x2), | ||
482 | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA(0x01c2, 0xf), /* UOPS_RETIRED.ALL */ | ||
483 | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_XLD(0x11d0, 0xf), /* MEM_UOPS_RETIRED.STLB_MISS_LOADS */ | ||
484 | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_XLD(0x21d0, 0xf), /* MEM_UOPS_RETIRED.LOCK_LOADS */ | ||
485 | @@ -777,9 +777,9 @@ struct event_constraint intel_bdw_pebs_event_constraints[] = { | ||
486 | INTEL_FLAGS_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */ | ||
487 | INTEL_PLD_CONSTRAINT(0x01cd, 0xf), /* MEM_TRANS_RETIRED.* */ | ||
488 | /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ | ||
489 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c2, 0xf), | ||
490 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c2, 0xf), | ||
491 | /* INST_RETIRED.PREC_DIST, inv=1, cmask=16 (cycles:ppp). */ | ||
492 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c0, 0x2), | ||
493 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c0, 0x2), | ||
494 | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA(0x01c2, 0xf), /* UOPS_RETIRED.ALL */ | ||
495 | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_UOPS_RETIRED.STLB_MISS_LOADS */ | ||
496 | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x21d0, 0xf), /* MEM_UOPS_RETIRED.LOCK_LOADS */ | ||
497 | @@ -800,9 +800,9 @@ struct event_constraint intel_bdw_pebs_event_constraints[] = { | ||
498 | struct event_constraint intel_skl_pebs_event_constraints[] = { | ||
499 | INTEL_FLAGS_UEVENT_CONSTRAINT(0x1c0, 0x2), /* INST_RETIRED.PREC_DIST */ | ||
500 | /* INST_RETIRED.PREC_DIST, inv=1, cmask=16 (cycles:ppp). */ | ||
501 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c0, 0x2), | ||
502 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108001c0, 0x2), | ||
503 | /* INST_RETIRED.TOTAL_CYCLES_PS (inv=1, cmask=16) (cycles:p). */ | ||
504 | - INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x0f), | ||
505 | + INTEL_FLAGS_UEVENT_CONSTRAINT(0x108000c0, 0x0f), | ||
506 | INTEL_PLD_CONSTRAINT(0x1cd, 0xf), /* MEM_TRANS_RETIRED.* */ | ||
507 | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */ | ||
508 | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x12d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_STORES */ | ||
509 | diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c | ||
510 | index be6d0543e626..52a65f14db06 100644 | ||
511 | --- a/arch/x86/kernel/cpu/amd.c | ||
512 | +++ b/arch/x86/kernel/cpu/amd.c | ||
513 | @@ -766,8 +766,11 @@ static void init_amd_zn(struct cpuinfo_x86 *c) | ||
514 | { | ||
515 | set_cpu_cap(c, X86_FEATURE_ZEN); | ||
516 | |||
517 | - /* Fix erratum 1076: CPB feature bit not being set in CPUID. */ | ||
518 | - if (!cpu_has(c, X86_FEATURE_CPB)) | ||
519 | + /* | ||
520 | + * Fix erratum 1076: CPB feature bit not being set in CPUID. | ||
521 | + * Always set it, except when running under a hypervisor. | ||
522 | + */ | ||
523 | + if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && !cpu_has(c, X86_FEATURE_CPB)) | ||
524 | set_cpu_cap(c, X86_FEATURE_CPB); | ||
525 | } | ||
526 | |||
527 | diff --git a/arch/x86/kvm/pmu_intel.c b/arch/x86/kvm/pmu_intel.c | ||
528 | index 5ab4a364348e..2729131fe9bf 100644 | ||
529 | --- a/arch/x86/kvm/pmu_intel.c | ||
530 | +++ b/arch/x86/kvm/pmu_intel.c | ||
531 | @@ -235,11 +235,14 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | ||
532 | } | ||
533 | break; | ||
534 | default: | ||
535 | - if ((pmc = get_gp_pmc(pmu, msr, MSR_IA32_PERFCTR0)) || | ||
536 | - (pmc = get_fixed_pmc(pmu, msr))) { | ||
537 | - if (!msr_info->host_initiated) | ||
538 | - data = (s64)(s32)data; | ||
539 | - pmc->counter += data - pmc_read_counter(pmc); | ||
540 | + if ((pmc = get_gp_pmc(pmu, msr, MSR_IA32_PERFCTR0))) { | ||
541 | + if (msr_info->host_initiated) | ||
542 | + pmc->counter = data; | ||
543 | + else | ||
544 | + pmc->counter = (s32)data; | ||
545 | + return 0; | ||
546 | + } else if ((pmc = get_fixed_pmc(pmu, msr))) { | ||
547 | + pmc->counter = data; | ||
548 | return 0; | ||
549 | } else if ((pmc = get_gp_pmc(pmu, msr, MSR_P6_EVNTSEL0))) { | ||
550 | if (data == pmc->eventsel) | ||
551 | diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c | ||
552 | index 9bd115484745..5f0e596b0519 100644 | ||
553 | --- a/arch/x86/pci/irq.c | ||
554 | +++ b/arch/x86/pci/irq.c | ||
555 | @@ -1117,6 +1117,8 @@ static struct dmi_system_id __initdata pciirq_dmi_table[] = { | ||
556 | |||
557 | void __init pcibios_irq_init(void) | ||
558 | { | ||
559 | + struct irq_routing_table *rtable = NULL; | ||
560 | + | ||
561 | DBG(KERN_DEBUG "PCI: IRQ init\n"); | ||
562 | |||
563 | if (raw_pci_ops == NULL) | ||
564 | @@ -1127,8 +1129,10 @@ void __init pcibios_irq_init(void) | ||
565 | pirq_table = pirq_find_routing_table(); | ||
566 | |||
567 | #ifdef CONFIG_PCI_BIOS | ||
568 | - if (!pirq_table && (pci_probe & PCI_BIOS_IRQ_SCAN)) | ||
569 | + if (!pirq_table && (pci_probe & PCI_BIOS_IRQ_SCAN)) { | ||
570 | pirq_table = pcibios_get_irq_routing_table(); | ||
571 | + rtable = pirq_table; | ||
572 | + } | ||
573 | #endif | ||
574 | if (pirq_table) { | ||
575 | pirq_peer_trick(); | ||
576 | @@ -1143,8 +1147,10 @@ void __init pcibios_irq_init(void) | ||
577 | * If we're using the I/O APIC, avoid using the PCI IRQ | ||
578 | * routing table | ||
579 | */ | ||
580 | - if (io_apic_assign_pci_irqs) | ||
581 | + if (io_apic_assign_pci_irqs) { | ||
582 | + kfree(rtable); | ||
583 | pirq_table = NULL; | ||
584 | + } | ||
585 | } | ||
586 | |||
587 | x86_init.pci.fixup_irqs(); | ||
588 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c | ||
589 | index 35be49f5791d..da1a987c622a 100644 | ||
590 | --- a/drivers/ata/libata-core.c | ||
591 | +++ b/drivers/ata/libata-core.c | ||
592 | @@ -4355,9 +4355,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | ||
593 | { "ST3320[68]13AS", "SD1[5-9]", ATA_HORKAGE_NONCQ | | ||
594 | ATA_HORKAGE_FIRMWARE_WARN }, | ||
595 | |||
596 | - /* drives which fail FPDMA_AA activation (some may freeze afterwards) */ | ||
597 | - { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA }, | ||
598 | - { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA }, | ||
599 | + /* drives which fail FPDMA_AA activation (some may freeze afterwards) | ||
600 | + the ST disks also have LPM issues */ | ||
601 | + { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA | | ||
602 | + ATA_HORKAGE_NOLPM, }, | ||
603 | + { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA | | ||
604 | + ATA_HORKAGE_NOLPM, }, | ||
605 | { "VB0250EAVER", "HPG7", ATA_HORKAGE_BROKEN_FPDMA_AA }, | ||
606 | |||
607 | /* Blacklist entries taken from Silicon Image 3124/3132 | ||
608 | diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c | ||
609 | index 39af05a589b3..32b130c53ff9 100644 | ||
610 | --- a/drivers/clk/rockchip/clk-rk3288.c | ||
611 | +++ b/drivers/clk/rockchip/clk-rk3288.c | ||
612 | @@ -826,6 +826,9 @@ static const int rk3288_saved_cru_reg_ids[] = { | ||
613 | RK3288_CLKSEL_CON(10), | ||
614 | RK3288_CLKSEL_CON(33), | ||
615 | RK3288_CLKSEL_CON(37), | ||
616 | + | ||
617 | + /* We turn aclk_dmac1 on for suspend; this will restore it */ | ||
618 | + RK3288_CLKGATE_CON(10), | ||
619 | }; | ||
620 | |||
621 | static u32 rk3288_saved_cru_regs[ARRAY_SIZE(rk3288_saved_cru_reg_ids)]; | ||
622 | @@ -841,6 +844,14 @@ static int rk3288_clk_suspend(void) | ||
623 | readl_relaxed(rk3288_cru_base + reg_id); | ||
624 | } | ||
625 | |||
626 | + /* | ||
627 | + * Going into deep sleep (specifically setting PMU_CLR_DMA in | ||
628 | + * RK3288_PMU_PWRMODE_CON1) appears to fail unless | ||
629 | + * "aclk_dmac1" is on. | ||
630 | + */ | ||
631 | + writel_relaxed(1 << (12 + 16), | ||
632 | + rk3288_cru_base + RK3288_CLKGATE_CON(10)); | ||
633 | + | ||
634 | /* | ||
635 | * Switch PLLs other than DPLL (for SDRAM) to slow mode to | ||
636 | * avoid crashes on resume. The Mask ROM on the system will | ||
637 | diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c | ||
638 | index 1953e57505f4..f17a4c7a1781 100644 | ||
639 | --- a/drivers/dma/idma64.c | ||
640 | +++ b/drivers/dma/idma64.c | ||
641 | @@ -589,7 +589,7 @@ static int idma64_probe(struct idma64_chip *chip) | ||
642 | idma64->dma.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); | ||
643 | idma64->dma.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; | ||
644 | |||
645 | - idma64->dma.dev = chip->dev; | ||
646 | + idma64->dma.dev = chip->sysdev; | ||
647 | |||
648 | dma_set_max_seg_size(idma64->dma.dev, IDMA64C_CTLH_BLOCK_TS_MASK); | ||
649 | |||
650 | @@ -629,6 +629,7 @@ static int idma64_platform_probe(struct platform_device *pdev) | ||
651 | { | ||
652 | struct idma64_chip *chip; | ||
653 | struct device *dev = &pdev->dev; | ||
654 | + struct device *sysdev = dev->parent; | ||
655 | struct resource *mem; | ||
656 | int ret; | ||
657 | |||
658 | @@ -645,11 +646,12 @@ static int idma64_platform_probe(struct platform_device *pdev) | ||
659 | if (IS_ERR(chip->regs)) | ||
660 | return PTR_ERR(chip->regs); | ||
661 | |||
662 | - ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); | ||
663 | + ret = dma_coerce_mask_and_coherent(sysdev, DMA_BIT_MASK(64)); | ||
664 | if (ret) | ||
665 | return ret; | ||
666 | |||
667 | chip->dev = dev; | ||
668 | + chip->sysdev = sysdev; | ||
669 | |||
670 | ret = idma64_probe(chip); | ||
671 | if (ret) | ||
672 | diff --git a/drivers/dma/idma64.h b/drivers/dma/idma64.h | ||
673 | index 6b816878e5e7..baa32e1425de 100644 | ||
674 | --- a/drivers/dma/idma64.h | ||
675 | +++ b/drivers/dma/idma64.h | ||
676 | @@ -216,12 +216,14 @@ static inline void idma64_writel(struct idma64 *idma64, int offset, u32 value) | ||
677 | /** | ||
678 | * struct idma64_chip - representation of iDMA 64-bit controller hardware | ||
679 | * @dev: struct device of the DMA controller | ||
680 | + * @sysdev: struct device of the physical device that does DMA | ||
681 | * @irq: irq line | ||
682 | * @regs: memory mapped I/O space | ||
683 | * @idma64: struct idma64 that is filed by idma64_probe() | ||
684 | */ | ||
685 | struct idma64_chip { | ||
686 | struct device *dev; | ||
687 | + struct device *sysdev; | ||
688 | int irq; | ||
689 | void __iomem *regs; | ||
690 | struct idma64 *idma64; | ||
691 | diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig | ||
692 | index 12d417a4d4a8..b992badb99dd 100644 | ||
693 | --- a/drivers/gpio/Kconfig | ||
694 | +++ b/drivers/gpio/Kconfig | ||
695 | @@ -670,6 +670,7 @@ config GPIO_ADP5588 | ||
696 | config GPIO_ADP5588_IRQ | ||
697 | bool "Interrupt controller support for ADP5588" | ||
698 | depends on GPIO_ADP5588=y | ||
699 | + select GPIOLIB_IRQCHIP | ||
700 | help | ||
701 | Say yes here to enable the adp5588 to be used as an interrupt | ||
702 | controller. It requires the driver to be built in the kernel. | ||
703 | diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c | ||
704 | index 75f30a0c418a..038882183bdf 100644 | ||
705 | --- a/drivers/gpio/gpio-omap.c | ||
706 | +++ b/drivers/gpio/gpio-omap.c | ||
707 | @@ -296,6 +296,22 @@ static void omap_clear_gpio_debounce(struct gpio_bank *bank, unsigned offset) | ||
708 | } | ||
709 | } | ||
710 | |||
711 | +/* | ||
712 | + * Off mode wake-up capable GPIOs in bank(s) that are in the wakeup domain. | ||
713 | + * See TRM section for GPIO for "Wake-Up Generation" for the list of GPIOs | ||
714 | + * in wakeup domain. If bank->non_wakeup_gpios is not configured, assume none | ||
715 | + * are capable waking up the system from off mode. | ||
716 | + */ | ||
717 | +static bool omap_gpio_is_off_wakeup_capable(struct gpio_bank *bank, u32 gpio_mask) | ||
718 | +{ | ||
719 | + u32 no_wake = bank->non_wakeup_gpios; | ||
720 | + | ||
721 | + if (no_wake) | ||
722 | + return !!(~no_wake & gpio_mask); | ||
723 | + | ||
724 | + return false; | ||
725 | +} | ||
726 | + | ||
727 | static inline void omap_set_gpio_trigger(struct gpio_bank *bank, int gpio, | ||
728 | unsigned trigger) | ||
729 | { | ||
730 | @@ -327,13 +343,7 @@ static inline void omap_set_gpio_trigger(struct gpio_bank *bank, int gpio, | ||
731 | } | ||
732 | |||
733 | /* This part needs to be executed always for OMAP{34xx, 44xx} */ | ||
734 | - if (!bank->regs->irqctrl) { | ||
735 | - /* On omap24xx proceed only when valid GPIO bit is set */ | ||
736 | - if (bank->non_wakeup_gpios) { | ||
737 | - if (!(bank->non_wakeup_gpios & gpio_bit)) | ||
738 | - goto exit; | ||
739 | - } | ||
740 | - | ||
741 | + if (!bank->regs->irqctrl && !omap_gpio_is_off_wakeup_capable(bank, gpio)) { | ||
742 | /* | ||
743 | * Log the edge gpio and manually trigger the IRQ | ||
744 | * after resume if the input level changes | ||
745 | @@ -346,7 +356,6 @@ static inline void omap_set_gpio_trigger(struct gpio_bank *bank, int gpio, | ||
746 | bank->enabled_non_wakeup_gpios &= ~gpio_bit; | ||
747 | } | ||
748 | |||
749 | -exit: | ||
750 | bank->level_mask = | ||
751 | readl_relaxed(bank->base + bank->regs->leveldetect0) | | ||
752 | readl_relaxed(bank->base + bank->regs->leveldetect1); | ||
753 | diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | ||
754 | index 32ab5c32834b..1b2fae915ecc 100644 | ||
755 | --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | ||
756 | +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | ||
757 | @@ -735,11 +735,11 @@ static void adv7511_mode_set(struct adv7511 *adv7511, | ||
758 | vsync_polarity = 1; | ||
759 | } | ||
760 | |||
761 | - if (mode->vrefresh <= 24000) | ||
762 | + if (drm_mode_vrefresh(mode) <= 24) | ||
763 | low_refresh_rate = ADV7511_LOW_REFRESH_RATE_24HZ; | ||
764 | - else if (mode->vrefresh <= 25000) | ||
765 | + else if (drm_mode_vrefresh(mode) <= 25) | ||
766 | low_refresh_rate = ADV7511_LOW_REFRESH_RATE_25HZ; | ||
767 | - else if (mode->vrefresh <= 30000) | ||
768 | + else if (drm_mode_vrefresh(mode) <= 30) | ||
769 | low_refresh_rate = ADV7511_LOW_REFRESH_RATE_30HZ; | ||
770 | else | ||
771 | low_refresh_rate = ADV7511_LOW_REFRESH_RATE_NONE; | ||
772 | diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | ||
773 | index 9fe8eda7c859..40c1e89ed361 100644 | ||
774 | --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | ||
775 | +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | ||
776 | @@ -2493,7 +2493,8 @@ static int vmw_cmd_dx_set_shader(struct vmw_private *dev_priv, | ||
777 | |||
778 | cmd = container_of(header, typeof(*cmd), header); | ||
779 | |||
780 | - if (cmd->body.type >= SVGA3D_SHADERTYPE_DX10_MAX) { | ||
781 | + if (cmd->body.type >= SVGA3D_SHADERTYPE_DX10_MAX || | ||
782 | + cmd->body.type < SVGA3D_SHADERTYPE_MIN) { | ||
783 | DRM_ERROR("Illegal shader type %u.\n", | ||
784 | (unsigned) cmd->body.type); | ||
785 | return -EINVAL; | ||
786 | @@ -2732,6 +2733,10 @@ static int vmw_cmd_dx_view_define(struct vmw_private *dev_priv, | ||
787 | if (view_type == vmw_view_max) | ||
788 | return -EINVAL; | ||
789 | cmd = container_of(header, typeof(*cmd), header); | ||
790 | + if (unlikely(cmd->sid == SVGA3D_INVALID_ID)) { | ||
791 | + DRM_ERROR("Invalid surface id.\n"); | ||
792 | + return -EINVAL; | ||
793 | + } | ||
794 | ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, | ||
795 | user_surface_converter, | ||
796 | &cmd->sid, &srf_node); | ||
797 | diff --git a/drivers/i2c/busses/i2c-acorn.c b/drivers/i2c/busses/i2c-acorn.c | ||
798 | index 9d7be5af2bf2..6618db75fa25 100644 | ||
799 | --- a/drivers/i2c/busses/i2c-acorn.c | ||
800 | +++ b/drivers/i2c/busses/i2c-acorn.c | ||
801 | @@ -83,6 +83,7 @@ static struct i2c_algo_bit_data ioc_data = { | ||
802 | |||
803 | static struct i2c_adapter ioc_ops = { | ||
804 | .nr = 0, | ||
805 | + .name = "ioc", | ||
806 | .algo_data = &ioc_data, | ||
807 | }; | ||
808 | |||
809 | diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c | ||
810 | index 00e8e675cbeb..eaa312bc3a3c 100644 | ||
811 | --- a/drivers/i2c/i2c-dev.c | ||
812 | +++ b/drivers/i2c/i2c-dev.c | ||
813 | @@ -297,6 +297,7 @@ static noinline int i2cdev_ioctl_rdwr(struct i2c_client *client, | ||
814 | rdwr_pa[i].buf[0] < 1 || | ||
815 | rdwr_pa[i].len < rdwr_pa[i].buf[0] + | ||
816 | I2C_SMBUS_BLOCK_MAX) { | ||
817 | + i++; | ||
818 | res = -EINVAL; | ||
819 | break; | ||
820 | } | ||
821 | diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c | ||
822 | index 28feb1744710..25cc6ae87039 100644 | ||
823 | --- a/drivers/iommu/intel-iommu.c | ||
824 | +++ b/drivers/iommu/intel-iommu.c | ||
825 | @@ -4119,9 +4119,7 @@ static void __init init_no_remapping_devices(void) | ||
826 | |||
827 | /* This IOMMU has *only* gfx devices. Either bypass it or | ||
828 | set the gfx_mapped flag, as appropriate */ | ||
829 | - if (dmar_map_gfx) { | ||
830 | - intel_iommu_gfx_mapped = 1; | ||
831 | - } else { | ||
832 | + if (!dmar_map_gfx) { | ||
833 | drhd->ignored = 1; | ||
834 | for_each_active_dev_scope(drhd->devices, | ||
835 | drhd->devices_cnt, i, dev) | ||
836 | @@ -4870,6 +4868,9 @@ int __init intel_iommu_init(void) | ||
837 | goto out_free_reserved_range; | ||
838 | } | ||
839 | |||
840 | + if (dmar_map_gfx) | ||
841 | + intel_iommu_gfx_mapped = 1; | ||
842 | + | ||
843 | init_no_remapping_devices(); | ||
844 | |||
845 | ret = init_dmars(); | ||
846 | diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c | ||
847 | index f96b8f2bdf74..d7c986fb0b3b 100644 | ||
848 | --- a/drivers/isdn/mISDN/socket.c | ||
849 | +++ b/drivers/isdn/mISDN/socket.c | ||
850 | @@ -394,7 +394,7 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | ||
851 | memcpy(di.channelmap, dev->channelmap, | ||
852 | sizeof(di.channelmap)); | ||
853 | di.nrbchan = dev->nrbchan; | ||
854 | - strcpy(di.name, dev_name(&dev->dev)); | ||
855 | + strscpy(di.name, dev_name(&dev->dev), sizeof(di.name)); | ||
856 | if (copy_to_user((void __user *)arg, &di, sizeof(di))) | ||
857 | err = -EFAULT; | ||
858 | } else | ||
859 | @@ -678,7 +678,7 @@ base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | ||
860 | memcpy(di.channelmap, dev->channelmap, | ||
861 | sizeof(di.channelmap)); | ||
862 | di.nrbchan = dev->nrbchan; | ||
863 | - strcpy(di.name, dev_name(&dev->dev)); | ||
864 | + strscpy(di.name, dev_name(&dev->dev), sizeof(di.name)); | ||
865 | if (copy_to_user((void __user *)arg, &di, sizeof(di))) | ||
866 | err = -EFAULT; | ||
867 | } else | ||
868 | @@ -692,6 +692,7 @@ base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | ||
869 | err = -EFAULT; | ||
870 | break; | ||
871 | } | ||
872 | + dn.name[sizeof(dn.name) - 1] = '\0'; | ||
873 | dev = get_mdevice(dn.id); | ||
874 | if (dev) | ||
875 | err = device_rename(&dev->dev, dn.name); | ||
876 | diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c | ||
877 | index 646fe85261c1..158eae17031c 100644 | ||
878 | --- a/drivers/md/bcache/bset.c | ||
879 | +++ b/drivers/md/bcache/bset.c | ||
880 | @@ -823,12 +823,22 @@ unsigned bch_btree_insert_key(struct btree_keys *b, struct bkey *k, | ||
881 | struct bset *i = bset_tree_last(b)->data; | ||
882 | struct bkey *m, *prev = NULL; | ||
883 | struct btree_iter iter; | ||
884 | + struct bkey preceding_key_on_stack = ZERO_KEY; | ||
885 | + struct bkey *preceding_key_p = &preceding_key_on_stack; | ||
886 | |||
887 | BUG_ON(b->ops->is_extents && !KEY_SIZE(k)); | ||
888 | |||
889 | - m = bch_btree_iter_init(b, &iter, b->ops->is_extents | ||
890 | - ? PRECEDING_KEY(&START_KEY(k)) | ||
891 | - : PRECEDING_KEY(k)); | ||
892 | + /* | ||
893 | + * If k has preceding key, preceding_key_p will be set to address | ||
894 | + * of k's preceding key; otherwise preceding_key_p will be set | ||
895 | + * to NULL inside preceding_key(). | ||
896 | + */ | ||
897 | + if (b->ops->is_extents) | ||
898 | + preceding_key(&START_KEY(k), &preceding_key_p); | ||
899 | + else | ||
900 | + preceding_key(k, &preceding_key_p); | ||
901 | + | ||
902 | + m = bch_btree_iter_init(b, &iter, preceding_key_p); | ||
903 | |||
904 | if (b->ops->insert_fixup(b, k, &iter, replace_key)) | ||
905 | return status; | ||
906 | diff --git a/drivers/md/bcache/bset.h b/drivers/md/bcache/bset.h | ||
907 | index ae964624efb2..b935839ab79c 100644 | ||
908 | --- a/drivers/md/bcache/bset.h | ||
909 | +++ b/drivers/md/bcache/bset.h | ||
910 | @@ -417,20 +417,26 @@ static inline bool bch_cut_back(const struct bkey *where, struct bkey *k) | ||
911 | return __bch_cut_back(where, k); | ||
912 | } | ||
913 | |||
914 | -#define PRECEDING_KEY(_k) \ | ||
915 | -({ \ | ||
916 | - struct bkey *_ret = NULL; \ | ||
917 | - \ | ||
918 | - if (KEY_INODE(_k) || KEY_OFFSET(_k)) { \ | ||
919 | - _ret = &KEY(KEY_INODE(_k), KEY_OFFSET(_k), 0); \ | ||
920 | - \ | ||
921 | - if (!_ret->low) \ | ||
922 | - _ret->high--; \ | ||
923 | - _ret->low--; \ | ||
924 | - } \ | ||
925 | - \ | ||
926 | - _ret; \ | ||
927 | -}) | ||
928 | +/* | ||
929 | + * Pointer '*preceding_key_p' points to a memory object to store preceding | ||
930 | + * key of k. If the preceding key does not exist, set '*preceding_key_p' to | ||
931 | + * NULL. So the caller of preceding_key() needs to take care of memory | ||
932 | + * which '*preceding_key_p' pointed to before calling preceding_key(). | ||
933 | + * Currently the only caller of preceding_key() is bch_btree_insert_key(), | ||
934 | + * and it points to an on-stack variable, so the memory release is handled | ||
935 | + * by stackframe itself. | ||
936 | + */ | ||
937 | +static inline void preceding_key(struct bkey *k, struct bkey **preceding_key_p) | ||
938 | +{ | ||
939 | + if (KEY_INODE(k) || KEY_OFFSET(k)) { | ||
940 | + (**preceding_key_p) = KEY(KEY_INODE(k), KEY_OFFSET(k), 0); | ||
941 | + if (!(*preceding_key_p)->low) | ||
942 | + (*preceding_key_p)->high--; | ||
943 | + (*preceding_key_p)->low--; | ||
944 | + } else { | ||
945 | + (*preceding_key_p) = NULL; | ||
946 | + } | ||
947 | +} | ||
948 | |||
949 | static inline bool bch_ptr_invalid(struct btree_keys *b, const struct bkey *k) | ||
950 | { | ||
951 | diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c | ||
952 | index 4510e8a37244..699e5f8e0a71 100644 | ||
953 | --- a/drivers/media/v4l2-core/v4l2-ioctl.c | ||
954 | +++ b/drivers/media/v4l2-core/v4l2-ioctl.c | ||
955 | @@ -1959,7 +1959,22 @@ static int v4l_s_parm(const struct v4l2_ioctl_ops *ops, | ||
956 | struct v4l2_streamparm *p = arg; | ||
957 | int ret = check_fmt(file, p->type); | ||
958 | |||
959 | - return ret ? ret : ops->vidioc_s_parm(file, fh, p); | ||
960 | + if (ret) | ||
961 | + return ret; | ||
962 | + | ||
963 | + /* Note: extendedmode is never used in drivers */ | ||
964 | + if (V4L2_TYPE_IS_OUTPUT(p->type)) { | ||
965 | + memset(p->parm.output.reserved, 0, | ||
966 | + sizeof(p->parm.output.reserved)); | ||
967 | + p->parm.output.extendedmode = 0; | ||
968 | + p->parm.output.outputmode &= V4L2_MODE_HIGHQUALITY; | ||
969 | + } else { | ||
970 | + memset(p->parm.capture.reserved, 0, | ||
971 | + sizeof(p->parm.capture.reserved)); | ||
972 | + p->parm.capture.extendedmode = 0; | ||
973 | + p->parm.capture.capturemode &= V4L2_MODE_HIGHQUALITY; | ||
974 | + } | ||
975 | + return ops->vidioc_s_parm(file, fh, p); | ||
976 | } | ||
977 | |||
978 | static int v4l_queryctrl(const struct v4l2_ioctl_ops *ops, | ||
979 | diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c | ||
980 | index 19ac8bc8e7ea..22dd8c055048 100644 | ||
981 | --- a/drivers/mfd/intel-lpss.c | ||
982 | +++ b/drivers/mfd/intel-lpss.c | ||
983 | @@ -273,6 +273,9 @@ static void intel_lpss_init_dev(const struct intel_lpss *lpss) | ||
984 | { | ||
985 | u32 value = LPSS_PRIV_SSP_REG_DIS_DMA_FIN; | ||
986 | |||
987 | + /* Set the device in reset state */ | ||
988 | + writel(0, lpss->priv + LPSS_PRIV_RESETS); | ||
989 | + | ||
990 | intel_lpss_deassert_reset(lpss); | ||
991 | |||
992 | intel_lpss_set_remap_addr(lpss); | ||
993 | diff --git a/drivers/mfd/tps65912-spi.c b/drivers/mfd/tps65912-spi.c | ||
994 | index 4aeba9b6942a..ec37cfe32ca3 100644 | ||
995 | --- a/drivers/mfd/tps65912-spi.c | ||
996 | +++ b/drivers/mfd/tps65912-spi.c | ||
997 | @@ -27,6 +27,7 @@ static const struct of_device_id tps65912_spi_of_match_table[] = { | ||
998 | { .compatible = "ti,tps65912", }, | ||
999 | { /* sentinel */ } | ||
1000 | }; | ||
1001 | +MODULE_DEVICE_TABLE(of, tps65912_spi_of_match_table); | ||
1002 | |||
1003 | static int tps65912_spi_probe(struct spi_device *spi) | ||
1004 | { | ||
1005 | diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c | ||
1006 | index dd19f17a1b63..2b8c479dbfa6 100644 | ||
1007 | --- a/drivers/mfd/twl6040.c | ||
1008 | +++ b/drivers/mfd/twl6040.c | ||
1009 | @@ -322,8 +322,19 @@ int twl6040_power(struct twl6040 *twl6040, int on) | ||
1010 | } | ||
1011 | } | ||
1012 | |||
1013 | + /* | ||
1014 | + * Register access can produce errors after power-up unless we | ||
1015 | + * wait at least 8ms based on measurements on duovero. | ||
1016 | + */ | ||
1017 | + usleep_range(10000, 12000); | ||
1018 | + | ||
1019 | /* Sync with the HW */ | ||
1020 | - regcache_sync(twl6040->regmap); | ||
1021 | + ret = regcache_sync(twl6040->regmap); | ||
1022 | + if (ret) { | ||
1023 | + dev_err(twl6040->dev, "Failed to sync with the HW: %i\n", | ||
1024 | + ret); | ||
1025 | + goto out; | ||
1026 | + } | ||
1027 | |||
1028 | /* Default PLL configuration after power up */ | ||
1029 | twl6040->pll = TWL6040_SYSCLK_SEL_LPPLL; | ||
1030 | diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c | ||
1031 | index 99635dd9dbac..bb3a76ad80da 100644 | ||
1032 | --- a/drivers/misc/kgdbts.c | ||
1033 | +++ b/drivers/misc/kgdbts.c | ||
1034 | @@ -1132,7 +1132,7 @@ static void kgdbts_put_char(u8 chr) | ||
1035 | |||
1036 | static int param_set_kgdbts_var(const char *kmessage, struct kernel_param *kp) | ||
1037 | { | ||
1038 | - int len = strlen(kmessage); | ||
1039 | + size_t len = strlen(kmessage); | ||
1040 | |||
1041 | if (len >= MAX_CONFIG_LEN) { | ||
1042 | printk(KERN_ERR "kgdbts: config string too long\n"); | ||
1043 | @@ -1152,7 +1152,7 @@ static int param_set_kgdbts_var(const char *kmessage, struct kernel_param *kp) | ||
1044 | |||
1045 | strcpy(config, kmessage); | ||
1046 | /* Chop out \n char as a result of echo */ | ||
1047 | - if (config[len - 1] == '\n') | ||
1048 | + if (len && config[len - 1] == '\n') | ||
1049 | config[len - 1] = '\0'; | ||
1050 | |||
1051 | /* Go and configure with the new params. */ | ||
1052 | diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c | ||
1053 | index 6620fc861c47..005c79b5b3f0 100644 | ||
1054 | --- a/drivers/net/ethernet/dec/tulip/de4x5.c | ||
1055 | +++ b/drivers/net/ethernet/dec/tulip/de4x5.c | ||
1056 | @@ -2109,7 +2109,6 @@ static struct eisa_driver de4x5_eisa_driver = { | ||
1057 | .remove = de4x5_eisa_remove, | ||
1058 | } | ||
1059 | }; | ||
1060 | -MODULE_DEVICE_TABLE(eisa, de4x5_eisa_ids); | ||
1061 | #endif | ||
1062 | |||
1063 | #ifdef CONFIG_PCI | ||
1064 | diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c | ||
1065 | index 0a48a31225e6..345818193de9 100644 | ||
1066 | --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c | ||
1067 | +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c | ||
1068 | @@ -1108,7 +1108,7 @@ static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd, | ||
1069 | cmd->data = be_get_rss_hash_opts(adapter, cmd->flow_type); | ||
1070 | break; | ||
1071 | case ETHTOOL_GRXRINGS: | ||
1072 | - cmd->data = adapter->num_rx_qs - 1; | ||
1073 | + cmd->data = adapter->num_rx_qs; | ||
1074 | break; | ||
1075 | default: | ||
1076 | return -EINVAL; | ||
1077 | diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | ||
1078 | index e3ed70a24029..585a40cc6470 100644 | ||
1079 | --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | ||
1080 | +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | ||
1081 | @@ -2044,6 +2044,10 @@ mlxsw_sp_port_set_link_ksettings(struct net_device *dev, | ||
1082 | mlxsw_reg_ptys_unpack(ptys_pl, ð_proto_cap, NULL, NULL); | ||
1083 | |||
1084 | autoneg = cmd->base.autoneg == AUTONEG_ENABLE; | ||
1085 | + if (!autoneg && cmd->base.speed == SPEED_56000) { | ||
1086 | + netdev_err(dev, "56G not supported with autoneg off\n"); | ||
1087 | + return -EINVAL; | ||
1088 | + } | ||
1089 | eth_proto_new = autoneg ? | ||
1090 | mlxsw_sp_to_ptys_advert_link(cmd) : | ||
1091 | mlxsw_sp_to_ptys_speed(cmd->base.speed); | ||
1092 | diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c | ||
1093 | index c59e8fe37069..49300194d3f9 100644 | ||
1094 | --- a/drivers/net/ethernet/renesas/sh_eth.c | ||
1095 | +++ b/drivers/net/ethernet/renesas/sh_eth.c | ||
1096 | @@ -1388,6 +1388,10 @@ static void sh_eth_dev_exit(struct net_device *ndev) | ||
1097 | sh_eth_get_stats(ndev); | ||
1098 | sh_eth_reset(ndev); | ||
1099 | |||
1100 | + /* Set the RMII mode again if required */ | ||
1101 | + if (mdp->cd->rmiimode) | ||
1102 | + sh_eth_write(ndev, 0x1, RMIIMODE); | ||
1103 | + | ||
1104 | /* Set MAC address again */ | ||
1105 | update_mac_address(ndev); | ||
1106 | } | ||
1107 | diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c | ||
1108 | index 01f95d192d25..2b16a5fed9de 100644 | ||
1109 | --- a/drivers/net/usb/ipheth.c | ||
1110 | +++ b/drivers/net/usb/ipheth.c | ||
1111 | @@ -437,17 +437,18 @@ static int ipheth_tx(struct sk_buff *skb, struct net_device *net) | ||
1112 | dev); | ||
1113 | dev->tx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
1114 | |||
1115 | + netif_stop_queue(net); | ||
1116 | retval = usb_submit_urb(dev->tx_urb, GFP_ATOMIC); | ||
1117 | if (retval) { | ||
1118 | dev_err(&dev->intf->dev, "%s: usb_submit_urb: %d\n", | ||
1119 | __func__, retval); | ||
1120 | dev->net->stats.tx_errors++; | ||
1121 | dev_kfree_skb_any(skb); | ||
1122 | + netif_wake_queue(net); | ||
1123 | } else { | ||
1124 | dev->net->stats.tx_packets++; | ||
1125 | dev->net->stats.tx_bytes += skb->len; | ||
1126 | dev_consume_skb_any(skb); | ||
1127 | - netif_stop_queue(net); | ||
1128 | } | ||
1129 | |||
1130 | return NETDEV_TX_OK; | ||
1131 | diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c | ||
1132 | index 824e282cd80e..bb2f79933b17 100644 | ||
1133 | --- a/drivers/nvmem/core.c | ||
1134 | +++ b/drivers/nvmem/core.c | ||
1135 | @@ -934,7 +934,7 @@ static inline void nvmem_shift_read_buffer_in_place(struct nvmem_cell *cell, | ||
1136 | void *buf) | ||
1137 | { | ||
1138 | u8 *p, *b; | ||
1139 | - int i, bit_offset = cell->bit_offset; | ||
1140 | + int i, extra, bit_offset = cell->bit_offset; | ||
1141 | |||
1142 | p = b = buf; | ||
1143 | if (bit_offset) { | ||
1144 | @@ -949,11 +949,16 @@ static inline void nvmem_shift_read_buffer_in_place(struct nvmem_cell *cell, | ||
1145 | p = b; | ||
1146 | *b++ >>= bit_offset; | ||
1147 | } | ||
1148 | - | ||
1149 | - /* result fits in less bytes */ | ||
1150 | - if (cell->bytes != DIV_ROUND_UP(cell->nbits, BITS_PER_BYTE)) | ||
1151 | - *p-- = 0; | ||
1152 | + } else { | ||
1153 | + /* point to the msb */ | ||
1154 | + p += cell->bytes - 1; | ||
1155 | } | ||
1156 | + | ||
1157 | + /* result fits in less bytes */ | ||
1158 | + extra = cell->bytes - DIV_ROUND_UP(cell->nbits, BITS_PER_BYTE); | ||
1159 | + while (--extra >= 0) | ||
1160 | + *p-- = 0; | ||
1161 | + | ||
1162 | /* clear msb bits if any leftover in the last byte */ | ||
1163 | *p &= GENMASK((cell->nbits%BITS_PER_BYTE) - 1, 0); | ||
1164 | } | ||
1165 | diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c | ||
1166 | index d6196f7b1d58..7f6b454bca65 100644 | ||
1167 | --- a/drivers/pci/host/pcie-rcar.c | ||
1168 | +++ b/drivers/pci/host/pcie-rcar.c | ||
1169 | @@ -847,7 +847,7 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie) | ||
1170 | { | ||
1171 | struct device *dev = pcie->dev; | ||
1172 | struct rcar_msi *msi = &pcie->msi; | ||
1173 | - unsigned long base; | ||
1174 | + phys_addr_t base; | ||
1175 | int err, i; | ||
1176 | |||
1177 | mutex_init(&msi->lock); | ||
1178 | @@ -886,10 +886,14 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie) | ||
1179 | |||
1180 | /* setup MSI data target */ | ||
1181 | msi->pages = __get_free_pages(GFP_KERNEL, 0); | ||
1182 | + if (!msi->pages) { | ||
1183 | + err = -ENOMEM; | ||
1184 | + goto err; | ||
1185 | + } | ||
1186 | base = virt_to_phys((void *)msi->pages); | ||
1187 | |||
1188 | - rcar_pci_write_reg(pcie, base | MSIFE, PCIEMSIALR); | ||
1189 | - rcar_pci_write_reg(pcie, 0, PCIEMSIAUR); | ||
1190 | + rcar_pci_write_reg(pcie, lower_32_bits(base) | MSIFE, PCIEMSIALR); | ||
1191 | + rcar_pci_write_reg(pcie, upper_32_bits(base), PCIEMSIAUR); | ||
1192 | |||
1193 | /* enable all MSI interrupts */ | ||
1194 | rcar_pci_write_reg(pcie, 0xffffffff, PCIEMSIIER); | ||
1195 | diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c | ||
1196 | index 61332f4d51c3..c3964fca57b0 100644 | ||
1197 | --- a/drivers/pci/host/pcie-xilinx.c | ||
1198 | +++ b/drivers/pci/host/pcie-xilinx.c | ||
1199 | @@ -337,14 +337,19 @@ static const struct irq_domain_ops msi_domain_ops = { | ||
1200 | * xilinx_pcie_enable_msi - Enable MSI support | ||
1201 | * @port: PCIe port information | ||
1202 | */ | ||
1203 | -static void xilinx_pcie_enable_msi(struct xilinx_pcie_port *port) | ||
1204 | +static int xilinx_pcie_enable_msi(struct xilinx_pcie_port *port) | ||
1205 | { | ||
1206 | phys_addr_t msg_addr; | ||
1207 | |||
1208 | port->msi_pages = __get_free_pages(GFP_KERNEL, 0); | ||
1209 | + if (!port->msi_pages) | ||
1210 | + return -ENOMEM; | ||
1211 | + | ||
1212 | msg_addr = virt_to_phys((void *)port->msi_pages); | ||
1213 | pcie_write(port, 0x0, XILINX_PCIE_REG_MSIBASE1); | ||
1214 | pcie_write(port, msg_addr, XILINX_PCIE_REG_MSIBASE2); | ||
1215 | + | ||
1216 | + return 0; | ||
1217 | } | ||
1218 | |||
1219 | /* INTx Functions */ | ||
1220 | @@ -516,6 +521,7 @@ static int xilinx_pcie_init_irq_domain(struct xilinx_pcie_port *port) | ||
1221 | struct device *dev = port->dev; | ||
1222 | struct device_node *node = dev->of_node; | ||
1223 | struct device_node *pcie_intc_node; | ||
1224 | + int ret; | ||
1225 | |||
1226 | /* Setup INTx */ | ||
1227 | pcie_intc_node = of_get_next_child(node, NULL); | ||
1228 | @@ -544,7 +550,9 @@ static int xilinx_pcie_init_irq_domain(struct xilinx_pcie_port *port) | ||
1229 | return -ENODEV; | ||
1230 | } | ||
1231 | |||
1232 | - xilinx_pcie_enable_msi(port); | ||
1233 | + ret = xilinx_pcie_enable_msi(port); | ||
1234 | + if (ret) | ||
1235 | + return ret; | ||
1236 | } | ||
1237 | |||
1238 | return 0; | ||
1239 | diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c | ||
1240 | index c614ff7c3bc3..d3562df64456 100644 | ||
1241 | --- a/drivers/pci/hotplug/rpadlpar_core.c | ||
1242 | +++ b/drivers/pci/hotplug/rpadlpar_core.c | ||
1243 | @@ -55,6 +55,7 @@ static struct device_node *find_vio_slot_node(char *drc_name) | ||
1244 | if ((rc == 0) && (!strcmp(drc_name, name))) | ||
1245 | break; | ||
1246 | } | ||
1247 | + of_node_put(parent); | ||
1248 | |||
1249 | return dn; | ||
1250 | } | ||
1251 | @@ -78,6 +79,7 @@ static struct device_node *find_php_slot_pci_node(char *drc_name, | ||
1252 | return np; | ||
1253 | } | ||
1254 | |||
1255 | +/* Returns a device_node with its reference count incremented */ | ||
1256 | static struct device_node *find_dlpar_node(char *drc_name, int *node_type) | ||
1257 | { | ||
1258 | struct device_node *dn; | ||
1259 | @@ -313,6 +315,7 @@ int dlpar_add_slot(char *drc_name) | ||
1260 | rc = dlpar_add_phb(drc_name, dn); | ||
1261 | break; | ||
1262 | } | ||
1263 | + of_node_put(dn); | ||
1264 | |||
1265 | printk(KERN_INFO "%s: slot %s added\n", DLPAR_MODULE_NAME, drc_name); | ||
1266 | exit: | ||
1267 | @@ -446,6 +449,7 @@ int dlpar_remove_slot(char *drc_name) | ||
1268 | rc = dlpar_remove_pci_slot(drc_name, dn); | ||
1269 | break; | ||
1270 | } | ||
1271 | + of_node_put(dn); | ||
1272 | vm_unmap_aliases(); | ||
1273 | |||
1274 | printk(KERN_INFO "%s: slot %s removed\n", DLPAR_MODULE_NAME, drc_name); | ||
1275 | diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c | ||
1276 | index cfa3e850c49f..d225a835a64c 100644 | ||
1277 | --- a/drivers/platform/chrome/cros_ec_proto.c | ||
1278 | +++ b/drivers/platform/chrome/cros_ec_proto.c | ||
1279 | @@ -67,6 +67,17 @@ static int send_command(struct cros_ec_device *ec_dev, | ||
1280 | else | ||
1281 | xfer_fxn = ec_dev->cmd_xfer; | ||
1282 | |||
1283 | + if (!xfer_fxn) { | ||
1284 | + /* | ||
1285 | + * This error can happen if a communication error happened and | ||
1286 | + * the EC is trying to use protocol v2, on an underlying | ||
1287 | + * communication mechanism that does not support v2. | ||
1288 | + */ | ||
1289 | + dev_err_once(ec_dev->dev, | ||
1290 | + "missing EC transfer API, cannot send command\n"); | ||
1291 | + return -EIO; | ||
1292 | + } | ||
1293 | + | ||
1294 | ret = (*xfer_fxn)(ec_dev, msg); | ||
1295 | if (msg->result == EC_RES_IN_PROGRESS) { | ||
1296 | int i; | ||
1297 | diff --git a/drivers/platform/x86/intel_pmc_ipc.c b/drivers/platform/x86/intel_pmc_ipc.c | ||
1298 | index 0bf51d574fa9..f2b9dd82128f 100644 | ||
1299 | --- a/drivers/platform/x86/intel_pmc_ipc.c | ||
1300 | +++ b/drivers/platform/x86/intel_pmc_ipc.c | ||
1301 | @@ -620,13 +620,17 @@ static int ipc_create_pmc_devices(void) | ||
1302 | if (ret) { | ||
1303 | dev_err(ipcdev.dev, "Failed to add punit platform device\n"); | ||
1304 | platform_device_unregister(ipcdev.tco_dev); | ||
1305 | + return ret; | ||
1306 | } | ||
1307 | |||
1308 | if (!ipcdev.telem_res_inval) { | ||
1309 | ret = ipc_create_telemetry_device(); | ||
1310 | - if (ret) | ||
1311 | + if (ret) { | ||
1312 | dev_warn(ipcdev.dev, | ||
1313 | "Failed to add telemetry platform device\n"); | ||
1314 | + platform_device_unregister(ipcdev.punit_dev); | ||
1315 | + platform_device_unregister(ipcdev.tco_dev); | ||
1316 | + } | ||
1317 | } | ||
1318 | |||
1319 | return ret; | ||
1320 | diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c | ||
1321 | index 172ef8245811..a19246455c13 100644 | ||
1322 | --- a/drivers/pwm/core.c | ||
1323 | +++ b/drivers/pwm/core.c | ||
1324 | @@ -302,10 +302,12 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip, | ||
1325 | if (IS_ENABLED(CONFIG_OF)) | ||
1326 | of_pwmchip_add(chip); | ||
1327 | |||
1328 | - pwmchip_sysfs_export(chip); | ||
1329 | - | ||
1330 | out: | ||
1331 | mutex_unlock(&pwm_lock); | ||
1332 | + | ||
1333 | + if (!ret) | ||
1334 | + pwmchip_sysfs_export(chip); | ||
1335 | + | ||
1336 | return ret; | ||
1337 | } | ||
1338 | EXPORT_SYMBOL_GPL(pwmchip_add_with_polarity); | ||
1339 | @@ -339,7 +341,7 @@ int pwmchip_remove(struct pwm_chip *chip) | ||
1340 | unsigned int i; | ||
1341 | int ret = 0; | ||
1342 | |||
1343 | - pwmchip_sysfs_unexport_children(chip); | ||
1344 | + pwmchip_sysfs_unexport(chip); | ||
1345 | |||
1346 | mutex_lock(&pwm_lock); | ||
1347 | |||
1348 | @@ -359,8 +361,6 @@ int pwmchip_remove(struct pwm_chip *chip) | ||
1349 | |||
1350 | free_pwms(chip); | ||
1351 | |||
1352 | - pwmchip_sysfs_unexport(chip); | ||
1353 | - | ||
1354 | out: | ||
1355 | mutex_unlock(&pwm_lock); | ||
1356 | return ret; | ||
1357 | diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c | ||
1358 | index 9d5bd7d5c610..f58a4867b519 100644 | ||
1359 | --- a/drivers/pwm/pwm-meson.c | ||
1360 | +++ b/drivers/pwm/pwm-meson.c | ||
1361 | @@ -110,6 +110,10 @@ struct meson_pwm { | ||
1362 | const struct meson_pwm_data *data; | ||
1363 | void __iomem *base; | ||
1364 | u8 inverter_mask; | ||
1365 | + /* | ||
1366 | + * Protects register (write) access to the REG_MISC_AB register | ||
1367 | + * that is shared between the two PWMs. | ||
1368 | + */ | ||
1369 | spinlock_t lock; | ||
1370 | }; | ||
1371 | |||
1372 | @@ -230,6 +234,7 @@ static void meson_pwm_enable(struct meson_pwm *meson, | ||
1373 | { | ||
1374 | u32 value, clk_shift, clk_enable, enable; | ||
1375 | unsigned int offset; | ||
1376 | + unsigned long flags; | ||
1377 | |||
1378 | switch (id) { | ||
1379 | case 0: | ||
1380 | @@ -250,6 +255,8 @@ static void meson_pwm_enable(struct meson_pwm *meson, | ||
1381 | return; | ||
1382 | } | ||
1383 | |||
1384 | + spin_lock_irqsave(&meson->lock, flags); | ||
1385 | + | ||
1386 | value = readl(meson->base + REG_MISC_AB); | ||
1387 | value &= ~(MISC_CLK_DIV_MASK << clk_shift); | ||
1388 | value |= channel->pre_div << clk_shift; | ||
1389 | @@ -262,11 +269,14 @@ static void meson_pwm_enable(struct meson_pwm *meson, | ||
1390 | value = readl(meson->base + REG_MISC_AB); | ||
1391 | value |= enable; | ||
1392 | writel(value, meson->base + REG_MISC_AB); | ||
1393 | + | ||
1394 | + spin_unlock_irqrestore(&meson->lock, flags); | ||
1395 | } | ||
1396 | |||
1397 | static void meson_pwm_disable(struct meson_pwm *meson, unsigned int id) | ||
1398 | { | ||
1399 | u32 value, enable; | ||
1400 | + unsigned long flags; | ||
1401 | |||
1402 | switch (id) { | ||
1403 | case 0: | ||
1404 | @@ -281,9 +291,13 @@ static void meson_pwm_disable(struct meson_pwm *meson, unsigned int id) | ||
1405 | return; | ||
1406 | } | ||
1407 | |||
1408 | + spin_lock_irqsave(&meson->lock, flags); | ||
1409 | + | ||
1410 | value = readl(meson->base + REG_MISC_AB); | ||
1411 | value &= ~enable; | ||
1412 | writel(value, meson->base + REG_MISC_AB); | ||
1413 | + | ||
1414 | + spin_unlock_irqrestore(&meson->lock, flags); | ||
1415 | } | ||
1416 | |||
1417 | static int meson_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, | ||
1418 | @@ -291,19 +305,16 @@ static int meson_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, | ||
1419 | { | ||
1420 | struct meson_pwm_channel *channel = pwm_get_chip_data(pwm); | ||
1421 | struct meson_pwm *meson = to_meson_pwm(chip); | ||
1422 | - unsigned long flags; | ||
1423 | int err = 0; | ||
1424 | |||
1425 | if (!state) | ||
1426 | return -EINVAL; | ||
1427 | |||
1428 | - spin_lock_irqsave(&meson->lock, flags); | ||
1429 | - | ||
1430 | if (!state->enabled) { | ||
1431 | meson_pwm_disable(meson, pwm->hwpwm); | ||
1432 | channel->state.enabled = false; | ||
1433 | |||
1434 | - goto unlock; | ||
1435 | + return 0; | ||
1436 | } | ||
1437 | |||
1438 | if (state->period != channel->state.period || | ||
1439 | @@ -324,7 +335,7 @@ static int meson_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, | ||
1440 | err = meson_pwm_calc(meson, channel, pwm->hwpwm, | ||
1441 | state->duty_cycle, state->period); | ||
1442 | if (err < 0) | ||
1443 | - goto unlock; | ||
1444 | + return err; | ||
1445 | |||
1446 | channel->state.polarity = state->polarity; | ||
1447 | channel->state.period = state->period; | ||
1448 | @@ -336,9 +347,7 @@ static int meson_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, | ||
1449 | channel->state.enabled = true; | ||
1450 | } | ||
1451 | |||
1452 | -unlock: | ||
1453 | - spin_unlock_irqrestore(&meson->lock, flags); | ||
1454 | - return err; | ||
1455 | + return 0; | ||
1456 | } | ||
1457 | |||
1458 | static void meson_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, | ||
1459 | diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c | ||
1460 | index c0e06f0c19d1..9a232ebbbf96 100644 | ||
1461 | --- a/drivers/pwm/pwm-tiehrpwm.c | ||
1462 | +++ b/drivers/pwm/pwm-tiehrpwm.c | ||
1463 | @@ -383,6 +383,8 @@ static void ehrpwm_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) | ||
1464 | } | ||
1465 | |||
1466 | /* Update shadow register first before modifying active register */ | ||
1467 | + ehrpwm_modify(pc->mmio_base, AQSFRC, AQSFRC_RLDCSF_MASK, | ||
1468 | + AQSFRC_RLDCSF_ZRO); | ||
1469 | ehrpwm_modify(pc->mmio_base, AQCSFRC, aqcsfrc_mask, aqcsfrc_val); | ||
1470 | /* | ||
1471 | * Changes to immediate action on Action Qualifier. This puts | ||
1472 | diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c | ||
1473 | index a813239300c3..0850b11dfd83 100644 | ||
1474 | --- a/drivers/pwm/sysfs.c | ||
1475 | +++ b/drivers/pwm/sysfs.c | ||
1476 | @@ -397,19 +397,6 @@ void pwmchip_sysfs_export(struct pwm_chip *chip) | ||
1477 | } | ||
1478 | |||
1479 | void pwmchip_sysfs_unexport(struct pwm_chip *chip) | ||
1480 | -{ | ||
1481 | - struct device *parent; | ||
1482 | - | ||
1483 | - parent = class_find_device(&pwm_class, NULL, chip, | ||
1484 | - pwmchip_sysfs_match); | ||
1485 | - if (parent) { | ||
1486 | - /* for class_find_device() */ | ||
1487 | - put_device(parent); | ||
1488 | - device_unregister(parent); | ||
1489 | - } | ||
1490 | -} | ||
1491 | - | ||
1492 | -void pwmchip_sysfs_unexport_children(struct pwm_chip *chip) | ||
1493 | { | ||
1494 | struct device *parent; | ||
1495 | unsigned int i; | ||
1496 | @@ -427,6 +414,7 @@ void pwmchip_sysfs_unexport_children(struct pwm_chip *chip) | ||
1497 | } | ||
1498 | |||
1499 | put_device(parent); | ||
1500 | + device_unregister(parent); | ||
1501 | } | ||
1502 | |||
1503 | static int __init pwm_sysfs_init(void) | ||
1504 | diff --git a/drivers/rapidio/rio_cm.c b/drivers/rapidio/rio_cm.c | ||
1505 | index bad0e0ea4f30..ef989a15aefc 100644 | ||
1506 | --- a/drivers/rapidio/rio_cm.c | ||
1507 | +++ b/drivers/rapidio/rio_cm.c | ||
1508 | @@ -2145,6 +2145,14 @@ static int riocm_add_mport(struct device *dev, | ||
1509 | mutex_init(&cm->rx_lock); | ||
1510 | riocm_rx_fill(cm, RIOCM_RX_RING_SIZE); | ||
1511 | cm->rx_wq = create_workqueue(DRV_NAME "/rxq"); | ||
1512 | + if (!cm->rx_wq) { | ||
1513 | + riocm_error("failed to allocate IBMBOX_%d on %s", | ||
1514 | + cmbox, mport->name); | ||
1515 | + rio_release_outb_mbox(mport, cmbox); | ||
1516 | + kfree(cm); | ||
1517 | + return -ENOMEM; | ||
1518 | + } | ||
1519 | + | ||
1520 | INIT_WORK(&cm->rx_work, rio_ibmsg_handler); | ||
1521 | |||
1522 | cm->tx_slot = 0; | ||
1523 | diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c | ||
1524 | index 28c48b3c1946..3c8c6f942e67 100644 | ||
1525 | --- a/drivers/rtc/rtc-pcf8523.c | ||
1526 | +++ b/drivers/rtc/rtc-pcf8523.c | ||
1527 | @@ -82,6 +82,18 @@ static int pcf8523_write(struct i2c_client *client, u8 reg, u8 value) | ||
1528 | return 0; | ||
1529 | } | ||
1530 | |||
1531 | +static int pcf8523_voltage_low(struct i2c_client *client) | ||
1532 | +{ | ||
1533 | + u8 value; | ||
1534 | + int err; | ||
1535 | + | ||
1536 | + err = pcf8523_read(client, REG_CONTROL3, &value); | ||
1537 | + if (err < 0) | ||
1538 | + return err; | ||
1539 | + | ||
1540 | + return !!(value & REG_CONTROL3_BLF); | ||
1541 | +} | ||
1542 | + | ||
1543 | static int pcf8523_select_capacitance(struct i2c_client *client, bool high) | ||
1544 | { | ||
1545 | u8 value; | ||
1546 | @@ -164,6 +176,14 @@ static int pcf8523_rtc_read_time(struct device *dev, struct rtc_time *tm) | ||
1547 | struct i2c_msg msgs[2]; | ||
1548 | int err; | ||
1549 | |||
1550 | + err = pcf8523_voltage_low(client); | ||
1551 | + if (err < 0) { | ||
1552 | + return err; | ||
1553 | + } else if (err > 0) { | ||
1554 | + dev_err(dev, "low voltage detected, time is unreliable\n"); | ||
1555 | + return -EINVAL; | ||
1556 | + } | ||
1557 | + | ||
1558 | msgs[0].addr = client->addr; | ||
1559 | msgs[0].flags = 0; | ||
1560 | msgs[0].len = 1; | ||
1561 | @@ -248,17 +268,13 @@ static int pcf8523_rtc_ioctl(struct device *dev, unsigned int cmd, | ||
1562 | unsigned long arg) | ||
1563 | { | ||
1564 | struct i2c_client *client = to_i2c_client(dev); | ||
1565 | - u8 value; | ||
1566 | - int ret = 0, err; | ||
1567 | + int ret; | ||
1568 | |||
1569 | switch (cmd) { | ||
1570 | case RTC_VL_READ: | ||
1571 | - err = pcf8523_read(client, REG_CONTROL3, &value); | ||
1572 | - if (err < 0) | ||
1573 | - return err; | ||
1574 | - | ||
1575 | - if (value & REG_CONTROL3_BLF) | ||
1576 | - ret = 1; | ||
1577 | + ret = pcf8523_voltage_low(client); | ||
1578 | + if (ret < 0) | ||
1579 | + return ret; | ||
1580 | |||
1581 | if (copy_to_user((void __user *)arg, &ret, sizeof(int))) | ||
1582 | return -EFAULT; | ||
1583 | diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c | ||
1584 | index 5ff9f89c17c7..39b2f60149d9 100644 | ||
1585 | --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c | ||
1586 | +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c | ||
1587 | @@ -829,7 +829,7 @@ ret_err_rqe: | ||
1588 | ((u64)err_entry->data.err_warn_bitmap_hi << 32) | | ||
1589 | (u64)err_entry->data.err_warn_bitmap_lo; | ||
1590 | for (i = 0; i < BNX2FC_NUM_ERR_BITS; i++) { | ||
1591 | - if (err_warn_bit_map & (u64) (1 << i)) { | ||
1592 | + if (err_warn_bit_map & ((u64)1 << i)) { | ||
1593 | err_warn = i; | ||
1594 | break; | ||
1595 | } | ||
1596 | diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c | ||
1597 | index 2ffe029ff2b6..e974106f2bb5 100644 | ||
1598 | --- a/drivers/scsi/cxgbi/libcxgbi.c | ||
1599 | +++ b/drivers/scsi/cxgbi/libcxgbi.c | ||
1600 | @@ -637,6 +637,10 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr) | ||
1601 | |||
1602 | if (ndev->flags & IFF_LOOPBACK) { | ||
1603 | ndev = ip_dev_find(&init_net, daddr->sin_addr.s_addr); | ||
1604 | + if (!ndev) { | ||
1605 | + err = -ENETUNREACH; | ||
1606 | + goto rel_neigh; | ||
1607 | + } | ||
1608 | mtu = ndev->mtu; | ||
1609 | pr_info("rt dev %s, loopback -> %s, mtu %u.\n", | ||
1610 | n->dev->name, ndev->name, mtu); | ||
1611 | diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c | ||
1612 | index ee1f9ee995e5..400eee9d7783 100644 | ||
1613 | --- a/drivers/scsi/libsas/sas_expander.c | ||
1614 | +++ b/drivers/scsi/libsas/sas_expander.c | ||
1615 | @@ -978,6 +978,8 @@ static struct domain_device *sas_ex_discover_expander( | ||
1616 | list_del(&child->dev_list_node); | ||
1617 | spin_unlock_irq(&parent->port->dev_list_lock); | ||
1618 | sas_put_device(child); | ||
1619 | + sas_port_delete(phy->port); | ||
1620 | + phy->port = NULL; | ||
1621 | return NULL; | ||
1622 | } | ||
1623 | list_add_tail(&child->siblings, &parent->ex_dev.children); | ||
1624 | diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c | ||
1625 | index 4905455bbfc7..b5be4df05733 100644 | ||
1626 | --- a/drivers/scsi/lpfc/lpfc_els.c | ||
1627 | +++ b/drivers/scsi/lpfc/lpfc_els.c | ||
1628 | @@ -6789,7 +6789,10 @@ int | ||
1629 | lpfc_send_rrq(struct lpfc_hba *phba, struct lpfc_node_rrq *rrq) | ||
1630 | { | ||
1631 | struct lpfc_nodelist *ndlp = lpfc_findnode_did(rrq->vport, | ||
1632 | - rrq->nlp_DID); | ||
1633 | + rrq->nlp_DID); | ||
1634 | + if (!ndlp) | ||
1635 | + return 1; | ||
1636 | + | ||
1637 | if (lpfc_test_rrq_active(phba, ndlp, rrq->xritag)) | ||
1638 | return lpfc_issue_els_rrq(rrq->vport, ndlp, | ||
1639 | rrq->nlp_DID, rrq); | ||
1640 | diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c | ||
1641 | index 06a062455404..b12f7f952b70 100644 | ||
1642 | --- a/drivers/scsi/smartpqi/smartpqi_init.c | ||
1643 | +++ b/drivers/scsi/smartpqi/smartpqi_init.c | ||
1644 | @@ -5478,7 +5478,7 @@ static int pqi_pci_init(struct pqi_ctrl_info *ctrl_info) | ||
1645 | else | ||
1646 | mask = DMA_BIT_MASK(32); | ||
1647 | |||
1648 | - rc = dma_set_mask(&ctrl_info->pci_dev->dev, mask); | ||
1649 | + rc = dma_set_mask_and_coherent(&ctrl_info->pci_dev->dev, mask); | ||
1650 | if (rc) { | ||
1651 | dev_err(&ctrl_info->pci_dev->dev, "failed to set DMA mask\n"); | ||
1652 | goto disable_device; | ||
1653 | diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c | ||
1654 | index e929f5142862..36226976773f 100644 | ||
1655 | --- a/drivers/soc/mediatek/mtk-pmic-wrap.c | ||
1656 | +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c | ||
1657 | @@ -778,7 +778,7 @@ static bool pwrap_is_pmic_cipher_ready(struct pmic_wrapper *wrp) | ||
1658 | static int pwrap_init_cipher(struct pmic_wrapper *wrp) | ||
1659 | { | ||
1660 | int ret; | ||
1661 | - u32 rdata; | ||
1662 | + u32 rdata = 0; | ||
1663 | |||
1664 | pwrap_writel(wrp, 0x1, PWRAP_CIPHER_SWRST); | ||
1665 | pwrap_writel(wrp, 0x0, PWRAP_CIPHER_SWRST); | ||
1666 | diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c | ||
1667 | index 8b618f0fa459..6dd195b94c57 100644 | ||
1668 | --- a/drivers/spi/spi-pxa2xx.c | ||
1669 | +++ b/drivers/spi/spi-pxa2xx.c | ||
1670 | @@ -1475,12 +1475,7 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = { | ||
1671 | |||
1672 | static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param) | ||
1673 | { | ||
1674 | - struct device *dev = param; | ||
1675 | - | ||
1676 | - if (dev != chan->device->dev->parent) | ||
1677 | - return false; | ||
1678 | - | ||
1679 | - return true; | ||
1680 | + return param == chan->device->dev; | ||
1681 | } | ||
1682 | |||
1683 | static struct pxa2xx_spi_master * | ||
1684 | diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | ||
1685 | index 94590ac5b3cf..f72eebc71dd8 100644 | ||
1686 | --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | ||
1687 | +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | ||
1688 | @@ -381,18 +381,9 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, | ||
1689 | int run, addridx, actual_pages; | ||
1690 | unsigned long *need_release; | ||
1691 | |||
1692 | - if (count >= INT_MAX - PAGE_SIZE) | ||
1693 | - return NULL; | ||
1694 | - | ||
1695 | offset = (unsigned int)buf & (PAGE_SIZE - 1); | ||
1696 | num_pages = (count + offset + PAGE_SIZE - 1) / PAGE_SIZE; | ||
1697 | |||
1698 | - if (num_pages > (SIZE_MAX - sizeof(PAGELIST_T) - | ||
1699 | - sizeof(struct vchiq_pagelist_info)) / | ||
1700 | - (sizeof(u32) + sizeof(pages[0]) + | ||
1701 | - sizeof(struct scatterlist))) | ||
1702 | - return NULL; | ||
1703 | - | ||
1704 | *ppagelist = NULL; | ||
1705 | |||
1706 | /* Allocate enough storage to hold the page pointers and the page | ||
1707 | diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c | ||
1708 | index 3f9fe6aa51cc..ebbe1ec7b9e8 100644 | ||
1709 | --- a/drivers/thermal/qcom/tsens.c | ||
1710 | +++ b/drivers/thermal/qcom/tsens.c | ||
1711 | @@ -162,7 +162,8 @@ static int tsens_probe(struct platform_device *pdev) | ||
1712 | if (tmdev->ops->calibrate) { | ||
1713 | ret = tmdev->ops->calibrate(tmdev); | ||
1714 | if (ret < 0) { | ||
1715 | - dev_err(dev, "tsens calibration failed\n"); | ||
1716 | + if (ret != -EPROBE_DEFER) | ||
1717 | + dev_err(dev, "tsens calibration failed\n"); | ||
1718 | return ret; | ||
1719 | } | ||
1720 | } | ||
1721 | diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c | ||
1722 | index 3177264a1166..22d65a33059e 100644 | ||
1723 | --- a/drivers/tty/serial/8250/8250_dw.c | ||
1724 | +++ b/drivers/tty/serial/8250/8250_dw.c | ||
1725 | @@ -269,7 +269,7 @@ static bool dw8250_fallback_dma_filter(struct dma_chan *chan, void *param) | ||
1726 | |||
1727 | static bool dw8250_idma_filter(struct dma_chan *chan, void *param) | ||
1728 | { | ||
1729 | - return param == chan->device->dev->parent; | ||
1730 | + return param == chan->device->dev; | ||
1731 | } | ||
1732 | |||
1733 | static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) | ||
1734 | @@ -311,7 +311,7 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) | ||
1735 | p->set_termios = dw8250_set_termios; | ||
1736 | } | ||
1737 | |||
1738 | - /* Platforms with iDMA */ | ||
1739 | + /* Platforms with iDMA 64-bit */ | ||
1740 | if (platform_get_resource_byname(to_platform_device(p->dev), | ||
1741 | IORESOURCE_MEM, "lpss_priv")) { | ||
1742 | p->set_termios = dw8250_set_termios; | ||
1743 | diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c | ||
1744 | index 59828d819145..5ad978acd90c 100644 | ||
1745 | --- a/drivers/tty/serial/sunhv.c | ||
1746 | +++ b/drivers/tty/serial/sunhv.c | ||
1747 | @@ -392,7 +392,7 @@ static struct uart_ops sunhv_pops = { | ||
1748 | static struct uart_driver sunhv_reg = { | ||
1749 | .owner = THIS_MODULE, | ||
1750 | .driver_name = "sunhv", | ||
1751 | - .dev_name = "ttyS", | ||
1752 | + .dev_name = "ttyHV", | ||
1753 | .major = TTY_MAJOR, | ||
1754 | }; | ||
1755 | |||
1756 | diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c | ||
1757 | index 38c7676e7a82..19e819aa2419 100644 | ||
1758 | --- a/drivers/usb/core/quirks.c | ||
1759 | +++ b/drivers/usb/core/quirks.c | ||
1760 | @@ -70,6 +70,9 @@ static const struct usb_device_id usb_quirk_list[] = { | ||
1761 | /* Cherry Stream G230 2.0 (G85-231) and 3.0 (G85-232) */ | ||
1762 | { USB_DEVICE(0x046a, 0x0023), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
1763 | |||
1764 | + /* Logitech HD Webcam C270 */ | ||
1765 | + { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
1766 | + | ||
1767 | /* Logitech HD Pro Webcams C920, C920-C, C925e and C930e */ | ||
1768 | { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
1769 | { USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
1770 | diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c | ||
1771 | index 0e5435330c07..120c8f716acf 100644 | ||
1772 | --- a/drivers/usb/dwc2/hcd.c | ||
1773 | +++ b/drivers/usb/dwc2/hcd.c | ||
1774 | @@ -2552,8 +2552,10 @@ static void dwc2_free_dma_aligned_buffer(struct urb *urb) | ||
1775 | return; | ||
1776 | |||
1777 | /* Restore urb->transfer_buffer from the end of the allocated area */ | ||
1778 | - memcpy(&stored_xfer_buffer, urb->transfer_buffer + | ||
1779 | - urb->transfer_buffer_length, sizeof(urb->transfer_buffer)); | ||
1780 | + memcpy(&stored_xfer_buffer, | ||
1781 | + PTR_ALIGN(urb->transfer_buffer + urb->transfer_buffer_length, | ||
1782 | + dma_get_cache_alignment()), | ||
1783 | + sizeof(urb->transfer_buffer)); | ||
1784 | |||
1785 | if (usb_urb_dir_in(urb)) | ||
1786 | memcpy(stored_xfer_buffer, urb->transfer_buffer, | ||
1787 | @@ -2580,6 +2582,7 @@ static int dwc2_alloc_dma_aligned_buffer(struct urb *urb, gfp_t mem_flags) | ||
1788 | * DMA | ||
1789 | */ | ||
1790 | kmalloc_size = urb->transfer_buffer_length + | ||
1791 | + (dma_get_cache_alignment() - 1) + | ||
1792 | sizeof(urb->transfer_buffer); | ||
1793 | |||
1794 | kmalloc_ptr = kmalloc(kmalloc_size, mem_flags); | ||
1795 | @@ -2590,7 +2593,8 @@ static int dwc2_alloc_dma_aligned_buffer(struct urb *urb, gfp_t mem_flags) | ||
1796 | * Position value of original urb->transfer_buffer pointer to the end | ||
1797 | * of allocation for later referencing | ||
1798 | */ | ||
1799 | - memcpy(kmalloc_ptr + urb->transfer_buffer_length, | ||
1800 | + memcpy(PTR_ALIGN(kmalloc_ptr + urb->transfer_buffer_length, | ||
1801 | + dma_get_cache_alignment()), | ||
1802 | &urb->transfer_buffer, sizeof(urb->transfer_buffer)); | ||
1803 | |||
1804 | if (usb_urb_dir_out(urb)) | ||
1805 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c | ||
1806 | index 9f96dd274370..1effe74ec638 100644 | ||
1807 | --- a/drivers/usb/serial/option.c | ||
1808 | +++ b/drivers/usb/serial/option.c | ||
1809 | @@ -1166,6 +1166,10 @@ static const struct usb_device_id option_ids[] = { | ||
1810 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1213, 0xff) }, | ||
1811 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1214), | ||
1812 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) }, | ||
1813 | + { USB_DEVICE(TELIT_VENDOR_ID, 0x1260), | ||
1814 | + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, | ||
1815 | + { USB_DEVICE(TELIT_VENDOR_ID, 0x1261), | ||
1816 | + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, | ||
1817 | { USB_DEVICE(TELIT_VENDOR_ID, 0x1900), /* Telit LN940 (QMI) */ | ||
1818 | .driver_info = NCTRL(0) | RSVD(1) }, | ||
1819 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff), /* Telit LN940 (MBIM) */ | ||
1820 | @@ -1767,6 +1771,8 @@ static const struct usb_device_id option_ids[] = { | ||
1821 | { USB_DEVICE(ALINK_VENDOR_ID, SIMCOM_PRODUCT_SIM7100E), | ||
1822 | .driver_info = RSVD(5) | RSVD(6) }, | ||
1823 | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9003, 0xff) }, /* Simcom SIM7500/SIM7600 MBIM mode */ | ||
1824 | + { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9011, 0xff), /* Simcom SIM7500/SIM7600 RNDIS mode */ | ||
1825 | + .driver_info = RSVD(7) }, | ||
1826 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), | ||
1827 | .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) }, | ||
1828 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D), | ||
1829 | diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c | ||
1830 | index 9706d214c409..8fd5e19846ef 100644 | ||
1831 | --- a/drivers/usb/serial/pl2303.c | ||
1832 | +++ b/drivers/usb/serial/pl2303.c | ||
1833 | @@ -101,6 +101,7 @@ static const struct usb_device_id id_table[] = { | ||
1834 | { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) }, | ||
1835 | { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) }, | ||
1836 | { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) }, | ||
1837 | + { USB_DEVICE(AT_VENDOR_ID, AT_VTKIT3_PRODUCT_ID) }, | ||
1838 | { } /* Terminating entry */ | ||
1839 | }; | ||
1840 | |||
1841 | diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h | ||
1842 | index d84c3b3d477b..496cbccbf26c 100644 | ||
1843 | --- a/drivers/usb/serial/pl2303.h | ||
1844 | +++ b/drivers/usb/serial/pl2303.h | ||
1845 | @@ -159,3 +159,6 @@ | ||
1846 | #define SMART_VENDOR_ID 0x0b8c | ||
1847 | #define SMART_PRODUCT_ID 0x2303 | ||
1848 | |||
1849 | +/* Allied Telesis VT-Kit3 */ | ||
1850 | +#define AT_VENDOR_ID 0x0caa | ||
1851 | +#define AT_VTKIT3_PRODUCT_ID 0x3001 | ||
1852 | diff --git a/drivers/usb/storage/unusual_realtek.h b/drivers/usb/storage/unusual_realtek.h | ||
1853 | index 7ca779493671..dee100dd02e1 100644 | ||
1854 | --- a/drivers/usb/storage/unusual_realtek.h | ||
1855 | +++ b/drivers/usb/storage/unusual_realtek.h | ||
1856 | @@ -29,6 +29,11 @@ UNUSUAL_DEV(0x0bda, 0x0138, 0x0000, 0x9999, | ||
1857 | "USB Card Reader", | ||
1858 | USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0), | ||
1859 | |||
1860 | +UNUSUAL_DEV(0x0bda, 0x0153, 0x0000, 0x9999, | ||
1861 | + "Realtek", | ||
1862 | + "USB Card Reader", | ||
1863 | + USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0), | ||
1864 | + | ||
1865 | UNUSUAL_DEV(0x0bda, 0x0158, 0x0000, 0x9999, | ||
1866 | "Realtek", | ||
1867 | "USB Card Reader", | ||
1868 | diff --git a/drivers/video/fbdev/hgafb.c b/drivers/video/fbdev/hgafb.c | ||
1869 | index 463028543173..59e1cae57948 100644 | ||
1870 | --- a/drivers/video/fbdev/hgafb.c | ||
1871 | +++ b/drivers/video/fbdev/hgafb.c | ||
1872 | @@ -285,6 +285,8 @@ static int hga_card_detect(void) | ||
1873 | hga_vram_len = 0x08000; | ||
1874 | |||
1875 | hga_vram = ioremap(0xb0000, hga_vram_len); | ||
1876 | + if (!hga_vram) | ||
1877 | + goto error; | ||
1878 | |||
1879 | if (request_region(0x3b0, 12, "hgafb")) | ||
1880 | release_io_ports = 1; | ||
1881 | diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c | ||
1882 | index 4363c64d74e8..4ef9dc94e813 100644 | ||
1883 | --- a/drivers/video/fbdev/imsttfb.c | ||
1884 | +++ b/drivers/video/fbdev/imsttfb.c | ||
1885 | @@ -1516,6 +1516,11 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
1886 | info->fix.smem_start = addr; | ||
1887 | info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? | ||
1888 | 0x400000 : 0x800000); | ||
1889 | + if (!info->screen_base) { | ||
1890 | + release_mem_region(addr, size); | ||
1891 | + framebuffer_release(info); | ||
1892 | + return -ENOMEM; | ||
1893 | + } | ||
1894 | info->fix.mmio_start = addr + 0x800000; | ||
1895 | par->dc_regs = ioremap(addr + 0x800000, 0x1000); | ||
1896 | par->cmap_regs_phys = addr + 0x840000; | ||
1897 | diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig | ||
1898 | index 8f8909a668d7..78fffca4c119 100644 | ||
1899 | --- a/drivers/watchdog/Kconfig | ||
1900 | +++ b/drivers/watchdog/Kconfig | ||
1901 | @@ -1850,6 +1850,7 @@ comment "Watchdog Pretimeout Governors" | ||
1902 | |||
1903 | config WATCHDOG_PRETIMEOUT_GOV | ||
1904 | bool "Enable watchdog pretimeout governors" | ||
1905 | + depends on WATCHDOG_CORE | ||
1906 | help | ||
1907 | The option allows to select watchdog pretimeout governors. | ||
1908 | |||
1909 | diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c | ||
1910 | index 518dfa1047cb..5098982e1a58 100644 | ||
1911 | --- a/drivers/watchdog/imx2_wdt.c | ||
1912 | +++ b/drivers/watchdog/imx2_wdt.c | ||
1913 | @@ -181,8 +181,10 @@ static void __imx2_wdt_set_timeout(struct watchdog_device *wdog, | ||
1914 | static int imx2_wdt_set_timeout(struct watchdog_device *wdog, | ||
1915 | unsigned int new_timeout) | ||
1916 | { | ||
1917 | - __imx2_wdt_set_timeout(wdog, new_timeout); | ||
1918 | + unsigned int actual; | ||
1919 | |||
1920 | + actual = min(new_timeout, wdog->max_hw_heartbeat_ms * 1000); | ||
1921 | + __imx2_wdt_set_timeout(wdog, actual); | ||
1922 | wdog->timeout = new_timeout; | ||
1923 | return 0; | ||
1924 | } | ||
1925 | diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c | ||
1926 | index d2a1a79fa324..a1985a9ad2d6 100644 | ||
1927 | --- a/fs/configfs/dir.c | ||
1928 | +++ b/fs/configfs/dir.c | ||
1929 | @@ -58,15 +58,13 @@ static void configfs_d_iput(struct dentry * dentry, | ||
1930 | if (sd) { | ||
1931 | /* Coordinate with configfs_readdir */ | ||
1932 | spin_lock(&configfs_dirent_lock); | ||
1933 | - /* Coordinate with configfs_attach_attr where will increase | ||
1934 | - * sd->s_count and update sd->s_dentry to new allocated one. | ||
1935 | - * Only set sd->dentry to null when this dentry is the only | ||
1936 | - * sd owner. | ||
1937 | - * If not do so, configfs_d_iput may run just after | ||
1938 | - * configfs_attach_attr and set sd->s_dentry to null | ||
1939 | - * even it's still in use. | ||
1940 | + /* | ||
1941 | + * Set sd->s_dentry to null only when this dentry is the one | ||
1942 | + * that is going to be killed. Otherwise configfs_d_iput may | ||
1943 | + * run just after configfs_attach_attr and set sd->s_dentry to | ||
1944 | + * NULL even it's still in use. | ||
1945 | */ | ||
1946 | - if (atomic_read(&sd->s_count) <= 2) | ||
1947 | + if (sd->s_dentry == dentry) | ||
1948 | sd->s_dentry = NULL; | ||
1949 | |||
1950 | spin_unlock(&configfs_dirent_lock); | ||
1951 | @@ -1755,12 +1753,19 @@ int configfs_register_group(struct config_group *parent_group, | ||
1952 | |||
1953 | inode_lock_nested(d_inode(parent), I_MUTEX_PARENT); | ||
1954 | ret = create_default_group(parent_group, group); | ||
1955 | - if (!ret) { | ||
1956 | - spin_lock(&configfs_dirent_lock); | ||
1957 | - configfs_dir_set_ready(group->cg_item.ci_dentry->d_fsdata); | ||
1958 | - spin_unlock(&configfs_dirent_lock); | ||
1959 | - } | ||
1960 | + if (ret) | ||
1961 | + goto err_out; | ||
1962 | + | ||
1963 | + spin_lock(&configfs_dirent_lock); | ||
1964 | + configfs_dir_set_ready(group->cg_item.ci_dentry->d_fsdata); | ||
1965 | + spin_unlock(&configfs_dirent_lock); | ||
1966 | + inode_unlock(d_inode(parent)); | ||
1967 | + return 0; | ||
1968 | +err_out: | ||
1969 | inode_unlock(d_inode(parent)); | ||
1970 | + mutex_lock(&subsys->su_mutex); | ||
1971 | + unlink_group(group); | ||
1972 | + mutex_unlock(&subsys->su_mutex); | ||
1973 | return ret; | ||
1974 | } | ||
1975 | EXPORT_SYMBOL(configfs_register_group); | ||
1976 | diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c | ||
1977 | index 1de02c31756b..c56d04ec45dc 100644 | ||
1978 | --- a/fs/f2fs/inode.c | ||
1979 | +++ b/fs/f2fs/inode.c | ||
1980 | @@ -288,6 +288,7 @@ make_now: | ||
1981 | return inode; | ||
1982 | |||
1983 | bad_inode: | ||
1984 | + f2fs_inode_synced(inode); | ||
1985 | iget_failed(inode); | ||
1986 | trace_f2fs_iget_exit(inode, ret); | ||
1987 | return ERR_PTR(ret); | ||
1988 | diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c | ||
1989 | index e59eeaf02eaa..9de1480a86bd 100644 | ||
1990 | --- a/fs/f2fs/recovery.c | ||
1991 | +++ b/fs/f2fs/recovery.c | ||
1992 | @@ -407,7 +407,15 @@ retry_dn: | ||
1993 | |||
1994 | get_node_info(sbi, dn.nid, &ni); | ||
1995 | f2fs_bug_on(sbi, ni.ino != ino_of_node(page)); | ||
1996 | - f2fs_bug_on(sbi, ofs_of_node(dn.node_page) != ofs_of_node(page)); | ||
1997 | + | ||
1998 | + if (ofs_of_node(dn.node_page) != ofs_of_node(page)) { | ||
1999 | + f2fs_msg(sbi->sb, KERN_WARNING, | ||
2000 | + "Inconsistent ofs_of_node, ino:%lu, ofs:%u, %u", | ||
2001 | + inode->i_ino, ofs_of_node(dn.node_page), | ||
2002 | + ofs_of_node(page)); | ||
2003 | + err = -EFAULT; | ||
2004 | + goto err; | ||
2005 | + } | ||
2006 | |||
2007 | for (; start < end; start++, dn.ofs_in_node++) { | ||
2008 | block_t src, dest; | ||
2009 | diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h | ||
2010 | index 893723978f5e..faca7fdb54b0 100644 | ||
2011 | --- a/fs/f2fs/segment.h | ||
2012 | +++ b/fs/f2fs/segment.h | ||
2013 | @@ -613,7 +613,6 @@ static inline void verify_block_addr(struct f2fs_io_info *fio, block_t blk_addr) | ||
2014 | static inline int check_block_count(struct f2fs_sb_info *sbi, | ||
2015 | int segno, struct f2fs_sit_entry *raw_sit) | ||
2016 | { | ||
2017 | -#ifdef CONFIG_F2FS_CHECK_FS | ||
2018 | bool is_valid = test_bit_le(0, raw_sit->valid_map) ? true : false; | ||
2019 | int valid_blocks = 0; | ||
2020 | int cur_pos = 0, next_pos; | ||
2021 | @@ -640,7 +639,7 @@ static inline int check_block_count(struct f2fs_sb_info *sbi, | ||
2022 | set_sbi_flag(sbi, SBI_NEED_FSCK); | ||
2023 | return -EINVAL; | ||
2024 | } | ||
2025 | -#endif | ||
2026 | + | ||
2027 | /* check segment usage, and check boundary of a given segment number */ | ||
2028 | if (unlikely(GET_SIT_VBLOCKS(raw_sit) > sbi->blocks_per_seg | ||
2029 | || segno > TOTAL_SEGS(sbi) - 1)) { | ||
2030 | diff --git a/fs/fat/file.c b/fs/fat/file.c | ||
2031 | index 3d04b124bce0..392ec5641f38 100644 | ||
2032 | --- a/fs/fat/file.c | ||
2033 | +++ b/fs/fat/file.c | ||
2034 | @@ -160,12 +160,17 @@ static int fat_file_release(struct inode *inode, struct file *filp) | ||
2035 | int fat_file_fsync(struct file *filp, loff_t start, loff_t end, int datasync) | ||
2036 | { | ||
2037 | struct inode *inode = filp->f_mapping->host; | ||
2038 | - int res, err; | ||
2039 | + int err; | ||
2040 | + | ||
2041 | + err = __generic_file_fsync(filp, start, end, datasync); | ||
2042 | + if (err) | ||
2043 | + return err; | ||
2044 | |||
2045 | - res = generic_file_fsync(filp, start, end, datasync); | ||
2046 | err = sync_mapping_buffers(MSDOS_SB(inode->i_sb)->fat_inode->i_mapping); | ||
2047 | + if (err) | ||
2048 | + return err; | ||
2049 | |||
2050 | - return res ? res : err; | ||
2051 | + return blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); | ||
2052 | } | ||
2053 | |||
2054 | |||
2055 | diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c | ||
2056 | index eaedbc1a3e95..8016cd059db1 100644 | ||
2057 | --- a/fs/fuse/dev.c | ||
2058 | +++ b/fs/fuse/dev.c | ||
2059 | @@ -1668,7 +1668,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, | ||
2060 | offset = outarg->offset & ~PAGE_MASK; | ||
2061 | file_size = i_size_read(inode); | ||
2062 | |||
2063 | - num = outarg->size; | ||
2064 | + num = min(outarg->size, fc->max_write); | ||
2065 | if (outarg->offset > file_size) | ||
2066 | num = 0; | ||
2067 | else if (outarg->offset + num > file_size) | ||
2068 | diff --git a/fs/inode.c b/fs/inode.c | ||
2069 | index 2071ff5343c5..30a97292e965 100644 | ||
2070 | --- a/fs/inode.c | ||
2071 | +++ b/fs/inode.c | ||
2072 | @@ -1804,8 +1804,13 @@ int file_remove_privs(struct file *file) | ||
2073 | int kill; | ||
2074 | int error = 0; | ||
2075 | |||
2076 | - /* Fast path for nothing security related */ | ||
2077 | - if (IS_NOSEC(inode)) | ||
2078 | + /* | ||
2079 | + * Fast path for nothing security related. | ||
2080 | + * As well for non-regular files, e.g. blkdev inodes. | ||
2081 | + * For example, blkdev_write_iter() might get here | ||
2082 | + * trying to remove privs which it is not allowed to. | ||
2083 | + */ | ||
2084 | + if (IS_NOSEC(inode) || !S_ISREG(inode->i_mode)) | ||
2085 | return 0; | ||
2086 | |||
2087 | kill = dentry_needs_remove_privs(dentry); | ||
2088 | diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h | ||
2089 | index 0bf9e7bf5800..9140b9cf3870 100644 | ||
2090 | --- a/fs/nfsd/vfs.h | ||
2091 | +++ b/fs/nfsd/vfs.h | ||
2092 | @@ -116,8 +116,11 @@ void nfsd_put_raparams(struct file *file, struct raparms *ra); | ||
2093 | |||
2094 | static inline int fh_want_write(struct svc_fh *fh) | ||
2095 | { | ||
2096 | - int ret = mnt_want_write(fh->fh_export->ex_path.mnt); | ||
2097 | + int ret; | ||
2098 | |||
2099 | + if (fh->fh_want_write) | ||
2100 | + return 0; | ||
2101 | + ret = mnt_want_write(fh->fh_export->ex_path.mnt); | ||
2102 | if (!ret) | ||
2103 | fh->fh_want_write = true; | ||
2104 | return ret; | ||
2105 | diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c | ||
2106 | index 290373024d9d..e8ace3b54e9c 100644 | ||
2107 | --- a/fs/ocfs2/dcache.c | ||
2108 | +++ b/fs/ocfs2/dcache.c | ||
2109 | @@ -310,6 +310,18 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry, | ||
2110 | |||
2111 | out_attach: | ||
2112 | spin_lock(&dentry_attach_lock); | ||
2113 | + if (unlikely(dentry->d_fsdata && !alias)) { | ||
2114 | + /* d_fsdata is set by a racing thread which is doing | ||
2115 | + * the same thing as this thread is doing. Leave the racing | ||
2116 | + * thread going ahead and we return here. | ||
2117 | + */ | ||
2118 | + spin_unlock(&dentry_attach_lock); | ||
2119 | + iput(dl->dl_inode); | ||
2120 | + ocfs2_lock_res_free(&dl->dl_lockres); | ||
2121 | + kfree(dl); | ||
2122 | + return 0; | ||
2123 | + } | ||
2124 | + | ||
2125 | dentry->d_fsdata = dl; | ||
2126 | dl->dl_count++; | ||
2127 | spin_unlock(&dentry_attach_lock); | ||
2128 | diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h | ||
2129 | index 7620a8bc0493..8be03520995c 100644 | ||
2130 | --- a/include/linux/cgroup.h | ||
2131 | +++ b/include/linux/cgroup.h | ||
2132 | @@ -462,7 +462,7 @@ static inline struct cgroup_subsys_state *task_css(struct task_struct *task, | ||
2133 | * | ||
2134 | * Find the css for the (@task, @subsys_id) combination, increment a | ||
2135 | * reference on and return it. This function is guaranteed to return a | ||
2136 | - * valid css. | ||
2137 | + * valid css. The returned css may already have been offlined. | ||
2138 | */ | ||
2139 | static inline struct cgroup_subsys_state * | ||
2140 | task_get_css(struct task_struct *task, int subsys_id) | ||
2141 | @@ -472,7 +472,13 @@ task_get_css(struct task_struct *task, int subsys_id) | ||
2142 | rcu_read_lock(); | ||
2143 | while (true) { | ||
2144 | css = task_css(task, subsys_id); | ||
2145 | - if (likely(css_tryget_online(css))) | ||
2146 | + /* | ||
2147 | + * Can't use css_tryget_online() here. A task which has | ||
2148 | + * PF_EXITING set may stay associated with an offline css. | ||
2149 | + * If such task calls this function, css_tryget_online() | ||
2150 | + * will keep failing. | ||
2151 | + */ | ||
2152 | + if (likely(css_tryget(css))) | ||
2153 | break; | ||
2154 | cpu_relax(); | ||
2155 | } | ||
2156 | diff --git a/include/linux/pwm.h b/include/linux/pwm.h | ||
2157 | index 2c6c5114c089..f1bbae014889 100644 | ||
2158 | --- a/include/linux/pwm.h | ||
2159 | +++ b/include/linux/pwm.h | ||
2160 | @@ -641,7 +641,6 @@ static inline void pwm_remove_table(struct pwm_lookup *table, size_t num) | ||
2161 | #ifdef CONFIG_PWM_SYSFS | ||
2162 | void pwmchip_sysfs_export(struct pwm_chip *chip); | ||
2163 | void pwmchip_sysfs_unexport(struct pwm_chip *chip); | ||
2164 | -void pwmchip_sysfs_unexport_children(struct pwm_chip *chip); | ||
2165 | #else | ||
2166 | static inline void pwmchip_sysfs_export(struct pwm_chip *chip) | ||
2167 | { | ||
2168 | @@ -650,10 +649,6 @@ static inline void pwmchip_sysfs_export(struct pwm_chip *chip) | ||
2169 | static inline void pwmchip_sysfs_unexport(struct pwm_chip *chip) | ||
2170 | { | ||
2171 | } | ||
2172 | - | ||
2173 | -static inline void pwmchip_sysfs_unexport_children(struct pwm_chip *chip) | ||
2174 | -{ | ||
2175 | -} | ||
2176 | #endif /* CONFIG_PWM_SYSFS */ | ||
2177 | |||
2178 | #endif /* __LINUX_PWM_H */ | ||
2179 | diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h | ||
2180 | index 57a7dba49d29..4931787193c3 100644 | ||
2181 | --- a/include/net/bluetooth/hci_core.h | ||
2182 | +++ b/include/net/bluetooth/hci_core.h | ||
2183 | @@ -176,9 +176,6 @@ struct adv_info { | ||
2184 | |||
2185 | #define HCI_MAX_SHORT_NAME_LENGTH 10 | ||
2186 | |||
2187 | -/* Min encryption key size to match with SMP */ | ||
2188 | -#define HCI_MIN_ENC_KEY_SIZE 7 | ||
2189 | - | ||
2190 | /* Default LE RPA expiry time, 15 minutes */ | ||
2191 | #define HCI_DEFAULT_RPA_TIMEOUT (15 * 60) | ||
2192 | |||
2193 | diff --git a/ipc/mqueue.c b/ipc/mqueue.c | ||
2194 | index 28a142f1be36..d5491a880751 100644 | ||
2195 | --- a/ipc/mqueue.c | ||
2196 | +++ b/ipc/mqueue.c | ||
2197 | @@ -371,7 +371,8 @@ static void mqueue_evict_inode(struct inode *inode) | ||
2198 | struct user_struct *user; | ||
2199 | unsigned long mq_bytes, mq_treesize; | ||
2200 | struct ipc_namespace *ipc_ns; | ||
2201 | - struct msg_msg *msg; | ||
2202 | + struct msg_msg *msg, *nmsg; | ||
2203 | + LIST_HEAD(tmp_msg); | ||
2204 | |||
2205 | clear_inode(inode); | ||
2206 | |||
2207 | @@ -382,10 +383,15 @@ static void mqueue_evict_inode(struct inode *inode) | ||
2208 | info = MQUEUE_I(inode); | ||
2209 | spin_lock(&info->lock); | ||
2210 | while ((msg = msg_get(info)) != NULL) | ||
2211 | - free_msg(msg); | ||
2212 | + list_add_tail(&msg->m_list, &tmp_msg); | ||
2213 | kfree(info->node_cache); | ||
2214 | spin_unlock(&info->lock); | ||
2215 | |||
2216 | + list_for_each_entry_safe(msg, nmsg, &tmp_msg, m_list) { | ||
2217 | + list_del(&msg->m_list); | ||
2218 | + free_msg(msg); | ||
2219 | + } | ||
2220 | + | ||
2221 | /* Total amount of bytes accounted for the mqueue */ | ||
2222 | mq_treesize = info->attr.mq_maxmsg * sizeof(struct msg_msg) + | ||
2223 | min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * | ||
2224 | diff --git a/ipc/msgutil.c b/ipc/msgutil.c | ||
2225 | index bf74eaa5c39f..6d90b191c638 100644 | ||
2226 | --- a/ipc/msgutil.c | ||
2227 | +++ b/ipc/msgutil.c | ||
2228 | @@ -18,6 +18,7 @@ | ||
2229 | #include <linux/utsname.h> | ||
2230 | #include <linux/proc_ns.h> | ||
2231 | #include <linux/uaccess.h> | ||
2232 | +#include <linux/sched.h> | ||
2233 | |||
2234 | #include "util.h" | ||
2235 | |||
2236 | @@ -64,6 +65,9 @@ static struct msg_msg *alloc_msg(size_t len) | ||
2237 | pseg = &msg->next; | ||
2238 | while (len > 0) { | ||
2239 | struct msg_msgseg *seg; | ||
2240 | + | ||
2241 | + cond_resched(); | ||
2242 | + | ||
2243 | alen = min(len, DATALEN_SEG); | ||
2244 | seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL_ACCOUNT); | ||
2245 | if (seg == NULL) | ||
2246 | @@ -176,6 +180,8 @@ void free_msg(struct msg_msg *msg) | ||
2247 | kfree(msg); | ||
2248 | while (seg != NULL) { | ||
2249 | struct msg_msgseg *tmp = seg->next; | ||
2250 | + | ||
2251 | + cond_resched(); | ||
2252 | kfree(seg); | ||
2253 | seg = tmp; | ||
2254 | } | ||
2255 | diff --git a/kernel/Makefile b/kernel/Makefile | ||
2256 | index 314e7d62f5f0..184fa9aa5802 100644 | ||
2257 | --- a/kernel/Makefile | ||
2258 | +++ b/kernel/Makefile | ||
2259 | @@ -28,6 +28,7 @@ KCOV_INSTRUMENT_extable.o := n | ||
2260 | # Don't self-instrument. | ||
2261 | KCOV_INSTRUMENT_kcov.o := n | ||
2262 | KASAN_SANITIZE_kcov.o := n | ||
2263 | +CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | ||
2264 | |||
2265 | # cond_syscall is currently not LTO compatible | ||
2266 | CFLAGS_sys_ni.o = $(DISABLE_LTO) | ||
2267 | diff --git a/kernel/cred.c b/kernel/cred.c | ||
2268 | index 5f264fb5737d..7b925925be95 100644 | ||
2269 | --- a/kernel/cred.c | ||
2270 | +++ b/kernel/cred.c | ||
2271 | @@ -447,6 +447,15 @@ int commit_creds(struct cred *new) | ||
2272 | if (task->mm) | ||
2273 | set_dumpable(task->mm, suid_dumpable); | ||
2274 | task->pdeath_signal = 0; | ||
2275 | + /* | ||
2276 | + * If a task drops privileges and becomes nondumpable, | ||
2277 | + * the dumpability change must become visible before | ||
2278 | + * the credential change; otherwise, a __ptrace_may_access() | ||
2279 | + * racing with this change may be able to attach to a task it | ||
2280 | + * shouldn't be able to attach to (as if the task had dropped | ||
2281 | + * privileges without becoming nondumpable). | ||
2282 | + * Pairs with a read barrier in __ptrace_may_access(). | ||
2283 | + */ | ||
2284 | smp_wmb(); | ||
2285 | } | ||
2286 | |||
2287 | diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c | ||
2288 | index 99becab2c1ce..8e8b903b7613 100644 | ||
2289 | --- a/kernel/events/ring_buffer.c | ||
2290 | +++ b/kernel/events/ring_buffer.c | ||
2291 | @@ -49,14 +49,30 @@ static void perf_output_put_handle(struct perf_output_handle *handle) | ||
2292 | unsigned long head; | ||
2293 | |||
2294 | again: | ||
2295 | + /* | ||
2296 | + * In order to avoid publishing a head value that goes backwards, | ||
2297 | + * we must ensure the load of @rb->head happens after we've | ||
2298 | + * incremented @rb->nest. | ||
2299 | + * | ||
2300 | + * Otherwise we can observe a @rb->head value before one published | ||
2301 | + * by an IRQ/NMI happening between the load and the increment. | ||
2302 | + */ | ||
2303 | + barrier(); | ||
2304 | head = local_read(&rb->head); | ||
2305 | |||
2306 | /* | ||
2307 | - * IRQ/NMI can happen here, which means we can miss a head update. | ||
2308 | + * IRQ/NMI can happen here and advance @rb->head, causing our | ||
2309 | + * load above to be stale. | ||
2310 | */ | ||
2311 | |||
2312 | - if (!local_dec_and_test(&rb->nest)) | ||
2313 | + /* | ||
2314 | + * If this isn't the outermost nesting, we don't have to update | ||
2315 | + * @rb->user_page->data_head. | ||
2316 | + */ | ||
2317 | + if (local_read(&rb->nest) > 1) { | ||
2318 | + local_dec(&rb->nest); | ||
2319 | goto out; | ||
2320 | + } | ||
2321 | |||
2322 | /* | ||
2323 | * Since the mmap() consumer (userspace) can run on a different CPU: | ||
2324 | @@ -88,9 +104,18 @@ again: | ||
2325 | rb->user_page->data_head = head; | ||
2326 | |||
2327 | /* | ||
2328 | - * Now check if we missed an update -- rely on previous implied | ||
2329 | - * compiler barriers to force a re-read. | ||
2330 | + * We must publish the head before decrementing the nest count, | ||
2331 | + * otherwise an IRQ/NMI can publish a more recent head value and our | ||
2332 | + * write will (temporarily) publish a stale value. | ||
2333 | + */ | ||
2334 | + barrier(); | ||
2335 | + local_set(&rb->nest, 0); | ||
2336 | + | ||
2337 | + /* | ||
2338 | + * Ensure we decrement @rb->nest before we validate the @rb->head. | ||
2339 | + * Otherwise we cannot be sure we caught the 'last' nested update. | ||
2340 | */ | ||
2341 | + barrier(); | ||
2342 | if (unlikely(head != local_read(&rb->head))) { | ||
2343 | local_inc(&rb->nest); | ||
2344 | goto again; | ||
2345 | diff --git a/kernel/ptrace.c b/kernel/ptrace.c | ||
2346 | index efba851ee018..f447f1e36185 100644 | ||
2347 | --- a/kernel/ptrace.c | ||
2348 | +++ b/kernel/ptrace.c | ||
2349 | @@ -322,6 +322,16 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode) | ||
2350 | return -EPERM; | ||
2351 | ok: | ||
2352 | rcu_read_unlock(); | ||
2353 | + /* | ||
2354 | + * If a task drops privileges and becomes nondumpable (through a syscall | ||
2355 | + * like setresuid()) while we are trying to access it, we must ensure | ||
2356 | + * that the dumpability is read after the credentials; otherwise, | ||
2357 | + * we may be able to attach to a task that we shouldn't be able to | ||
2358 | + * attach to (as if the task had dropped privileges without becoming | ||
2359 | + * nondumpable). | ||
2360 | + * Pairs with a write barrier in commit_creds(). | ||
2361 | + */ | ||
2362 | + smp_rmb(); | ||
2363 | mm = task->mm; | ||
2364 | if (mm && | ||
2365 | ((get_dumpable(mm) != SUID_DUMP_USER) && | ||
2366 | @@ -710,6 +720,10 @@ static int ptrace_peek_siginfo(struct task_struct *child, | ||
2367 | if (arg.nr < 0) | ||
2368 | return -EINVAL; | ||
2369 | |||
2370 | + /* Ensure arg.off fits in an unsigned long */ | ||
2371 | + if (arg.off > ULONG_MAX) | ||
2372 | + return 0; | ||
2373 | + | ||
2374 | if (arg.flags & PTRACE_PEEKSIGINFO_SHARED) | ||
2375 | pending = &child->signal->shared_pending; | ||
2376 | else | ||
2377 | @@ -717,18 +731,20 @@ static int ptrace_peek_siginfo(struct task_struct *child, | ||
2378 | |||
2379 | for (i = 0; i < arg.nr; ) { | ||
2380 | siginfo_t info; | ||
2381 | - s32 off = arg.off + i; | ||
2382 | + unsigned long off = arg.off + i; | ||
2383 | + bool found = false; | ||
2384 | |||
2385 | spin_lock_irq(&child->sighand->siglock); | ||
2386 | list_for_each_entry(q, &pending->list, list) { | ||
2387 | if (!off--) { | ||
2388 | + found = true; | ||
2389 | copy_siginfo(&info, &q->info); | ||
2390 | break; | ||
2391 | } | ||
2392 | } | ||
2393 | spin_unlock_irq(&child->sighand->siglock); | ||
2394 | |||
2395 | - if (off >= 0) /* beyond the end of the list */ | ||
2396 | + if (!found) /* beyond the end of the list */ | ||
2397 | break; | ||
2398 | |||
2399 | #ifdef CONFIG_COMPAT | ||
2400 | diff --git a/kernel/sys.c b/kernel/sys.c | ||
2401 | index 6c4e9b533258..157277cbf83a 100644 | ||
2402 | --- a/kernel/sys.c | ||
2403 | +++ b/kernel/sys.c | ||
2404 | @@ -1762,7 +1762,7 @@ static int validate_prctl_map(struct prctl_mm_map *prctl_map) | ||
2405 | ((unsigned long)prctl_map->__m1 __op \ | ||
2406 | (unsigned long)prctl_map->__m2) ? 0 : -EINVAL | ||
2407 | error = __prctl_check_order(start_code, <, end_code); | ||
2408 | - error |= __prctl_check_order(start_data, <, end_data); | ||
2409 | + error |= __prctl_check_order(start_data,<=, end_data); | ||
2410 | error |= __prctl_check_order(start_brk, <=, brk); | ||
2411 | error |= __prctl_check_order(arg_start, <=, arg_end); | ||
2412 | error |= __prctl_check_order(env_start, <=, env_end); | ||
2413 | diff --git a/kernel/sysctl.c b/kernel/sysctl.c | ||
2414 | index cf0aeaae567e..6af1ac551ea3 100644 | ||
2415 | --- a/kernel/sysctl.c | ||
2416 | +++ b/kernel/sysctl.c | ||
2417 | @@ -2527,8 +2527,10 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int | ||
2418 | if (neg) | ||
2419 | continue; | ||
2420 | val = convmul * val / convdiv; | ||
2421 | - if ((min && val < *min) || (max && val > *max)) | ||
2422 | - continue; | ||
2423 | + if ((min && val < *min) || (max && val > *max)) { | ||
2424 | + err = -EINVAL; | ||
2425 | + break; | ||
2426 | + } | ||
2427 | *i = val; | ||
2428 | } else { | ||
2429 | val = convdiv * (*i) / convmul; | ||
2430 | diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c | ||
2431 | index 6df8927c58a5..0a16419006f3 100644 | ||
2432 | --- a/kernel/time/ntp.c | ||
2433 | +++ b/kernel/time/ntp.c | ||
2434 | @@ -639,7 +639,7 @@ static inline void process_adjtimex_modes(struct timex *txc, | ||
2435 | time_constant = max(time_constant, 0l); | ||
2436 | } | ||
2437 | |||
2438 | - if (txc->modes & ADJ_TAI && txc->constant > 0) | ||
2439 | + if (txc->modes & ADJ_TAI && txc->constant >= 0) | ||
2440 | *time_tai = txc->constant; | ||
2441 | |||
2442 | if (txc->modes & ADJ_OFFSET) | ||
2443 | diff --git a/mm/cma.c b/mm/cma.c | ||
2444 | index b5d8847497a3..4ea0f32761c1 100644 | ||
2445 | --- a/mm/cma.c | ||
2446 | +++ b/mm/cma.c | ||
2447 | @@ -100,8 +100,10 @@ static int __init cma_activate_area(struct cma *cma) | ||
2448 | |||
2449 | cma->bitmap = kzalloc(bitmap_size, GFP_KERNEL); | ||
2450 | |||
2451 | - if (!cma->bitmap) | ||
2452 | + if (!cma->bitmap) { | ||
2453 | + cma->count = 0; | ||
2454 | return -ENOMEM; | ||
2455 | + } | ||
2456 | |||
2457 | WARN_ON_ONCE(!pfn_valid(pfn)); | ||
2458 | zone = page_zone(pfn_to_page(pfn)); | ||
2459 | diff --git a/mm/cma_debug.c b/mm/cma_debug.c | ||
2460 | index f8e4b60db167..da50dab56b70 100644 | ||
2461 | --- a/mm/cma_debug.c | ||
2462 | +++ b/mm/cma_debug.c | ||
2463 | @@ -57,7 +57,7 @@ static int cma_maxchunk_get(void *data, u64 *val) | ||
2464 | mutex_lock(&cma->lock); | ||
2465 | for (;;) { | ||
2466 | start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end); | ||
2467 | - if (start >= cma->count) | ||
2468 | + if (start >= bitmap_maxno) | ||
2469 | break; | ||
2470 | end = find_next_bit(cma->bitmap, bitmap_maxno, start); | ||
2471 | maxchunk = max(end - start, maxchunk); | ||
2472 | diff --git a/mm/hugetlb.c b/mm/hugetlb.c | ||
2473 | index 6b03cd9b6d37..9914da93069e 100644 | ||
2474 | --- a/mm/hugetlb.c | ||
2475 | +++ b/mm/hugetlb.c | ||
2476 | @@ -1247,12 +1247,23 @@ void free_huge_page(struct page *page) | ||
2477 | ClearPagePrivate(page); | ||
2478 | |||
2479 | /* | ||
2480 | - * A return code of zero implies that the subpool will be under its | ||
2481 | - * minimum size if the reservation is not restored after page is free. | ||
2482 | - * Therefore, force restore_reserve operation. | ||
2483 | + * If PagePrivate() was set on page, page allocation consumed a | ||
2484 | + * reservation. If the page was associated with a subpool, there | ||
2485 | + * would have been a page reserved in the subpool before allocation | ||
2486 | + * via hugepage_subpool_get_pages(). Since we are 'restoring' the | ||
2487 | + * reservtion, do not call hugepage_subpool_put_pages() as this will | ||
2488 | + * remove the reserved page from the subpool. | ||
2489 | */ | ||
2490 | - if (hugepage_subpool_put_pages(spool, 1) == 0) | ||
2491 | - restore_reserve = true; | ||
2492 | + if (!restore_reserve) { | ||
2493 | + /* | ||
2494 | + * A return code of zero implies that the subpool will be | ||
2495 | + * under its minimum size if the reservation is not restored | ||
2496 | + * after page is free. Therefore, force restore_reserve | ||
2497 | + * operation. | ||
2498 | + */ | ||
2499 | + if (hugepage_subpool_put_pages(spool, 1) == 0) | ||
2500 | + restore_reserve = true; | ||
2501 | + } | ||
2502 | |||
2503 | spin_lock(&hugetlb_lock); | ||
2504 | clear_page_huge_active(page); | ||
2505 | diff --git a/mm/list_lru.c b/mm/list_lru.c | ||
2506 | index db3a77c60201..16361c989af9 100644 | ||
2507 | --- a/mm/list_lru.c | ||
2508 | +++ b/mm/list_lru.c | ||
2509 | @@ -313,7 +313,7 @@ static int __memcg_init_list_lru_node(struct list_lru_memcg *memcg_lrus, | ||
2510 | } | ||
2511 | return 0; | ||
2512 | fail: | ||
2513 | - __memcg_destroy_list_lru_node(memcg_lrus, begin, i - 1); | ||
2514 | + __memcg_destroy_list_lru_node(memcg_lrus, begin, i); | ||
2515 | return -ENOMEM; | ||
2516 | } | ||
2517 | |||
2518 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c | ||
2519 | index 05f141e39ac1..13a642192e12 100644 | ||
2520 | --- a/mm/page_alloc.c | ||
2521 | +++ b/mm/page_alloc.c | ||
2522 | @@ -5491,13 +5491,15 @@ static unsigned long __meminit zone_spanned_pages_in_node(int nid, | ||
2523 | unsigned long *zone_end_pfn, | ||
2524 | unsigned long *ignored) | ||
2525 | { | ||
2526 | + unsigned long zone_low = arch_zone_lowest_possible_pfn[zone_type]; | ||
2527 | + unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type]; | ||
2528 | /* When hotadd a new node from cpu_up(), the node should be empty */ | ||
2529 | if (!node_start_pfn && !node_end_pfn) | ||
2530 | return 0; | ||
2531 | |||
2532 | /* Get the start and end of the zone */ | ||
2533 | - *zone_start_pfn = arch_zone_lowest_possible_pfn[zone_type]; | ||
2534 | - *zone_end_pfn = arch_zone_highest_possible_pfn[zone_type]; | ||
2535 | + *zone_start_pfn = clamp(node_start_pfn, zone_low, zone_high); | ||
2536 | + *zone_end_pfn = clamp(node_end_pfn, zone_low, zone_high); | ||
2537 | adjust_zone_range_for_zone_movable(nid, zone_type, | ||
2538 | node_start_pfn, node_end_pfn, | ||
2539 | zone_start_pfn, zone_end_pfn); | ||
2540 | diff --git a/mm/slab.c b/mm/slab.c | ||
2541 | index d2c0499c6b15..9547f02b4af9 100644 | ||
2542 | --- a/mm/slab.c | ||
2543 | +++ b/mm/slab.c | ||
2544 | @@ -4365,8 +4365,12 @@ static int leaks_show(struct seq_file *m, void *p) | ||
2545 | * whole processing. | ||
2546 | */ | ||
2547 | do { | ||
2548 | - set_store_user_clean(cachep); | ||
2549 | drain_cpu_caches(cachep); | ||
2550 | + /* | ||
2551 | + * drain_cpu_caches() could make kmemleak_object and | ||
2552 | + * debug_objects_cache dirty, so reset afterwards. | ||
2553 | + */ | ||
2554 | + set_store_user_clean(cachep); | ||
2555 | |||
2556 | x[1] = 0; | ||
2557 | |||
2558 | diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c | ||
2559 | index 149f82bd83fd..6ba56f215229 100644 | ||
2560 | --- a/net/ax25/ax25_route.c | ||
2561 | +++ b/net/ax25/ax25_route.c | ||
2562 | @@ -443,9 +443,11 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr) | ||
2563 | } | ||
2564 | |||
2565 | if (ax25->sk != NULL) { | ||
2566 | + local_bh_disable(); | ||
2567 | bh_lock_sock(ax25->sk); | ||
2568 | sock_reset_flag(ax25->sk, SOCK_ZAPPED); | ||
2569 | bh_unlock_sock(ax25->sk); | ||
2570 | + local_bh_enable(); | ||
2571 | } | ||
2572 | |||
2573 | put: | ||
2574 | diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c | ||
2575 | index fe4fb0c1fa61..cc061495f653 100644 | ||
2576 | --- a/net/bluetooth/hci_conn.c | ||
2577 | +++ b/net/bluetooth/hci_conn.c | ||
2578 | @@ -1165,14 +1165,6 @@ int hci_conn_check_link_mode(struct hci_conn *conn) | ||
2579 | !test_bit(HCI_CONN_ENCRYPT, &conn->flags)) | ||
2580 | return 0; | ||
2581 | |||
2582 | - /* The minimum encryption key size needs to be enforced by the | ||
2583 | - * host stack before establishing any L2CAP connections. The | ||
2584 | - * specification in theory allows a minimum of 1, but to align | ||
2585 | - * BR/EDR and LE transports, a minimum of 7 is chosen. | ||
2586 | - */ | ||
2587 | - if (conn->enc_key_size < HCI_MIN_ENC_KEY_SIZE) | ||
2588 | - return 0; | ||
2589 | - | ||
2590 | return 1; | ||
2591 | } | ||
2592 | |||
2593 | diff --git a/net/core/neighbour.c b/net/core/neighbour.c | ||
2594 | index 428dd614a18a..01cdfe85bb09 100644 | ||
2595 | --- a/net/core/neighbour.c | ||
2596 | +++ b/net/core/neighbour.c | ||
2597 | @@ -2704,6 +2704,7 @@ static void *neigh_get_idx_any(struct seq_file *seq, loff_t *pos) | ||
2598 | } | ||
2599 | |||
2600 | void *neigh_seq_start(struct seq_file *seq, loff_t *pos, struct neigh_table *tbl, unsigned int neigh_seq_flags) | ||
2601 | + __acquires(tbl->lock) | ||
2602 | __acquires(rcu_bh) | ||
2603 | { | ||
2604 | struct neigh_seq_state *state = seq->private; | ||
2605 | @@ -2714,6 +2715,7 @@ void *neigh_seq_start(struct seq_file *seq, loff_t *pos, struct neigh_table *tbl | ||
2606 | |||
2607 | rcu_read_lock_bh(); | ||
2608 | state->nht = rcu_dereference_bh(tbl->nht); | ||
2609 | + read_lock(&tbl->lock); | ||
2610 | |||
2611 | return *pos ? neigh_get_idx_any(seq, pos) : SEQ_START_TOKEN; | ||
2612 | } | ||
2613 | @@ -2747,8 +2749,13 @@ out: | ||
2614 | EXPORT_SYMBOL(neigh_seq_next); | ||
2615 | |||
2616 | void neigh_seq_stop(struct seq_file *seq, void *v) | ||
2617 | + __releases(tbl->lock) | ||
2618 | __releases(rcu_bh) | ||
2619 | { | ||
2620 | + struct neigh_seq_state *state = seq->private; | ||
2621 | + struct neigh_table *tbl = state->tbl; | ||
2622 | + | ||
2623 | + read_unlock(&tbl->lock); | ||
2624 | rcu_read_unlock_bh(); | ||
2625 | } | ||
2626 | EXPORT_SYMBOL(neigh_seq_stop); | ||
2627 | diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c | ||
2628 | index 8c2f9aedc2af..6a6011160f18 100644 | ||
2629 | --- a/net/ipv6/ip6_flowlabel.c | ||
2630 | +++ b/net/ipv6/ip6_flowlabel.c | ||
2631 | @@ -254,9 +254,9 @@ struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label) | ||
2632 | rcu_read_lock_bh(); | ||
2633 | for_each_sk_fl_rcu(np, sfl) { | ||
2634 | struct ip6_flowlabel *fl = sfl->fl; | ||
2635 | - if (fl->label == label) { | ||
2636 | + | ||
2637 | + if (fl->label == label && atomic_inc_not_zero(&fl->users)) { | ||
2638 | fl->lastuse = jiffies; | ||
2639 | - atomic_inc(&fl->users); | ||
2640 | rcu_read_unlock_bh(); | ||
2641 | return fl; | ||
2642 | } | ||
2643 | @@ -623,7 +623,8 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen) | ||
2644 | goto done; | ||
2645 | } | ||
2646 | fl1 = sfl->fl; | ||
2647 | - atomic_inc(&fl1->users); | ||
2648 | + if (!atomic_inc_not_zero(&fl1->users)) | ||
2649 | + fl1 = NULL; | ||
2650 | break; | ||
2651 | } | ||
2652 | } | ||
2653 | diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c | ||
2654 | index fc60d9d738b5..cdb913e7627e 100644 | ||
2655 | --- a/net/lapb/lapb_iface.c | ||
2656 | +++ b/net/lapb/lapb_iface.c | ||
2657 | @@ -182,6 +182,7 @@ int lapb_unregister(struct net_device *dev) | ||
2658 | lapb = __lapb_devtostruct(dev); | ||
2659 | if (!lapb) | ||
2660 | goto out; | ||
2661 | + lapb_put(lapb); | ||
2662 | |||
2663 | lapb_stop_t1timer(lapb); | ||
2664 | lapb_stop_t2timer(lapb); | ||
2665 | diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c | ||
2666 | index 09491b27092e..bc6d371031fc 100644 | ||
2667 | --- a/sound/core/seq/seq_clientmgr.c | ||
2668 | +++ b/sound/core/seq/seq_clientmgr.c | ||
2669 | @@ -1905,20 +1905,14 @@ static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client, | ||
2670 | int result; | ||
2671 | struct snd_seq_client *sender = NULL; | ||
2672 | struct snd_seq_client_port *sport = NULL; | ||
2673 | - struct snd_seq_subscribers *p; | ||
2674 | |||
2675 | result = -EINVAL; | ||
2676 | if ((sender = snd_seq_client_use_ptr(subs->sender.client)) == NULL) | ||
2677 | goto __end; | ||
2678 | if ((sport = snd_seq_port_use_ptr(sender, subs->sender.port)) == NULL) | ||
2679 | goto __end; | ||
2680 | - p = snd_seq_port_get_subscription(&sport->c_src, &subs->dest); | ||
2681 | - if (p) { | ||
2682 | - result = 0; | ||
2683 | - *subs = p->info; | ||
2684 | - } else | ||
2685 | - result = -ENOENT; | ||
2686 | - | ||
2687 | + result = snd_seq_port_get_subscription(&sport->c_src, &subs->dest, | ||
2688 | + subs); | ||
2689 | __end: | ||
2690 | if (sport) | ||
2691 | snd_seq_port_unlock(sport); | ||
2692 | diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c | ||
2693 | index f04714d70bf7..9cfe4fcee9a5 100644 | ||
2694 | --- a/sound/core/seq/seq_ports.c | ||
2695 | +++ b/sound/core/seq/seq_ports.c | ||
2696 | @@ -550,10 +550,10 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client, | ||
2697 | list_del_init(list); | ||
2698 | grp->exclusive = 0; | ||
2699 | write_unlock_irq(&grp->list_lock); | ||
2700 | - up_write(&grp->list_mutex); | ||
2701 | |||
2702 | if (!empty) | ||
2703 | unsubscribe_port(client, port, grp, &subs->info, ack); | ||
2704 | + up_write(&grp->list_mutex); | ||
2705 | } | ||
2706 | |||
2707 | /* connect two ports */ | ||
2708 | @@ -635,20 +635,23 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector, | ||
2709 | |||
2710 | |||
2711 | /* get matched subscriber */ | ||
2712 | -struct snd_seq_subscribers *snd_seq_port_get_subscription(struct snd_seq_port_subs_info *src_grp, | ||
2713 | - struct snd_seq_addr *dest_addr) | ||
2714 | +int snd_seq_port_get_subscription(struct snd_seq_port_subs_info *src_grp, | ||
2715 | + struct snd_seq_addr *dest_addr, | ||
2716 | + struct snd_seq_port_subscribe *subs) | ||
2717 | { | ||
2718 | - struct snd_seq_subscribers *s, *found = NULL; | ||
2719 | + struct snd_seq_subscribers *s; | ||
2720 | + int err = -ENOENT; | ||
2721 | |||
2722 | down_read(&src_grp->list_mutex); | ||
2723 | list_for_each_entry(s, &src_grp->list_head, src_list) { | ||
2724 | if (addr_match(dest_addr, &s->info.dest)) { | ||
2725 | - found = s; | ||
2726 | + *subs = s->info; | ||
2727 | + err = 0; | ||
2728 | break; | ||
2729 | } | ||
2730 | } | ||
2731 | up_read(&src_grp->list_mutex); | ||
2732 | - return found; | ||
2733 | + return err; | ||
2734 | } | ||
2735 | |||
2736 | /* | ||
2737 | diff --git a/sound/core/seq/seq_ports.h b/sound/core/seq/seq_ports.h | ||
2738 | index 26bd71f36c41..06003b36652e 100644 | ||
2739 | --- a/sound/core/seq/seq_ports.h | ||
2740 | +++ b/sound/core/seq/seq_ports.h | ||
2741 | @@ -135,7 +135,8 @@ int snd_seq_port_subscribe(struct snd_seq_client_port *port, | ||
2742 | struct snd_seq_port_subscribe *info); | ||
2743 | |||
2744 | /* get matched subscriber */ | ||
2745 | -struct snd_seq_subscribers *snd_seq_port_get_subscription(struct snd_seq_port_subs_info *src_grp, | ||
2746 | - struct snd_seq_addr *dest_addr); | ||
2747 | +int snd_seq_port_get_subscription(struct snd_seq_port_subs_info *src_grp, | ||
2748 | + struct snd_seq_addr *dest_addr, | ||
2749 | + struct snd_seq_port_subscribe *subs); | ||
2750 | |||
2751 | #endif | ||
2752 | diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c | ||
2753 | index b0395c4209ab..a7ab34d5e7b0 100644 | ||
2754 | --- a/sound/firewire/oxfw/oxfw.c | ||
2755 | +++ b/sound/firewire/oxfw/oxfw.c | ||
2756 | @@ -175,9 +175,6 @@ static int detect_quirks(struct snd_oxfw *oxfw) | ||
2757 | oxfw->midi_input_ports = 0; | ||
2758 | oxfw->midi_output_ports = 0; | ||
2759 | |||
2760 | - /* Output stream exists but no data channels are useful. */ | ||
2761 | - oxfw->has_output = false; | ||
2762 | - | ||
2763 | return snd_oxfw_scs1x_add(oxfw); | ||
2764 | } | ||
2765 | |||
2766 | diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c | ||
2767 | index 789eca17fc60..f2f1d9fd848c 100644 | ||
2768 | --- a/sound/pci/hda/hda_intel.c | ||
2769 | +++ b/sound/pci/hda/hda_intel.c | ||
2770 | @@ -1700,9 +1700,6 @@ static int azx_first_init(struct azx *chip) | ||
2771 | chip->msi = 0; | ||
2772 | } | ||
2773 | |||
2774 | - if (azx_acquire_irq(chip, 0) < 0) | ||
2775 | - return -EBUSY; | ||
2776 | - | ||
2777 | pci_set_master(pci); | ||
2778 | synchronize_irq(bus->irq); | ||
2779 | |||
2780 | @@ -1809,6 +1806,9 @@ static int azx_first_init(struct azx *chip) | ||
2781 | return -ENODEV; | ||
2782 | } | ||
2783 | |||
2784 | + if (azx_acquire_irq(chip, 0) < 0) | ||
2785 | + return -EBUSY; | ||
2786 | + | ||
2787 | strcpy(card->driver, "HDA-Intel"); | ||
2788 | strlcpy(card->shortname, driver_short_names[chip->driver_type], | ||
2789 | sizeof(card->shortname)); | ||
2790 | diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c | ||
2791 | index b4d87379d2bc..462341fef5a9 100644 | ||
2792 | --- a/sound/soc/codecs/cs42xx8.c | ||
2793 | +++ b/sound/soc/codecs/cs42xx8.c | ||
2794 | @@ -569,6 +569,7 @@ static int cs42xx8_runtime_resume(struct device *dev) | ||
2795 | msleep(5); | ||
2796 | |||
2797 | regcache_cache_only(cs42xx8->regmap, false); | ||
2798 | + regcache_mark_dirty(cs42xx8->regmap); | ||
2799 | |||
2800 | ret = regcache_sync(cs42xx8->regmap); | ||
2801 | if (ret) { | ||
2802 | diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c | ||
2803 | index 1d82f68305c3..88a438f6c2de 100644 | ||
2804 | --- a/sound/soc/fsl/fsl_asrc.c | ||
2805 | +++ b/sound/soc/fsl/fsl_asrc.c | ||
2806 | @@ -286,8 +286,8 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair) | ||
2807 | return -EINVAL; | ||
2808 | } | ||
2809 | |||
2810 | - if ((outrate > 8000 && outrate < 30000) && | ||
2811 | - (outrate/inrate > 24 || inrate/outrate > 8)) { | ||
2812 | + if ((outrate >= 8000 && outrate <= 30000) && | ||
2813 | + (outrate > 24 * inrate || inrate > 8 * outrate)) { | ||
2814 | pair_err("exceed supported ratio range [1/24, 8] for \ | ||
2815 | inrate/outrate: %d/%d\n", inrate, outrate); | ||
2816 | return -EINVAL; | ||
2817 | diff --git a/tools/objtool/check.c b/tools/objtool/check.c | ||
2818 | index ae3446768181..95326c6a7a24 100644 | ||
2819 | --- a/tools/objtool/check.c | ||
2820 | +++ b/tools/objtool/check.c | ||
2821 | @@ -28,6 +28,8 @@ | ||
2822 | #include <linux/hashtable.h> | ||
2823 | #include <linux/kernel.h> | ||
2824 | |||
2825 | +#define FAKE_JUMP_OFFSET -1 | ||
2826 | + | ||
2827 | struct alternative { | ||
2828 | struct list_head list; | ||
2829 | struct instruction *insn; | ||
2830 | @@ -498,7 +500,7 @@ static int add_jump_destinations(struct objtool_file *file) | ||
2831 | insn->type != INSN_JUMP_UNCONDITIONAL) | ||
2832 | continue; | ||
2833 | |||
2834 | - if (insn->ignore) | ||
2835 | + if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET) | ||
2836 | continue; | ||
2837 | |||
2838 | rela = find_rela_by_dest_range(insn->sec, insn->offset, | ||
2839 | @@ -645,10 +647,10 @@ static int handle_group_alt(struct objtool_file *file, | ||
2840 | clear_insn_state(&fake_jump->state); | ||
2841 | |||
2842 | fake_jump->sec = special_alt->new_sec; | ||
2843 | - fake_jump->offset = -1; | ||
2844 | + fake_jump->offset = FAKE_JUMP_OFFSET; | ||
2845 | fake_jump->type = INSN_JUMP_UNCONDITIONAL; | ||
2846 | fake_jump->jump_dest = list_next_entry(last_orig_insn, list); | ||
2847 | - fake_jump->ignore = true; | ||
2848 | + fake_jump->func = orig_insn->func; | ||
2849 | } | ||
2850 | |||
2851 | if (!special_alt->new_len) { | ||
2852 | diff --git a/tools/perf/arch/s390/util/machine.c b/tools/perf/arch/s390/util/machine.c | ||
2853 | index b9a95a1a8e69..d3d1452021d4 100644 | ||
2854 | --- a/tools/perf/arch/s390/util/machine.c | ||
2855 | +++ b/tools/perf/arch/s390/util/machine.c | ||
2856 | @@ -4,16 +4,19 @@ | ||
2857 | #include "util.h" | ||
2858 | #include "machine.h" | ||
2859 | #include "api/fs/fs.h" | ||
2860 | +#include "debug.h" | ||
2861 | |||
2862 | int arch__fix_module_text_start(u64 *start, const char *name) | ||
2863 | { | ||
2864 | + u64 m_start = *start; | ||
2865 | char path[PATH_MAX]; | ||
2866 | |||
2867 | snprintf(path, PATH_MAX, "module/%.*s/sections/.text", | ||
2868 | (int)strlen(name) - 2, name + 1); | ||
2869 | - | ||
2870 | - if (sysfs__read_ull(path, (unsigned long long *)start) < 0) | ||
2871 | - return -1; | ||
2872 | + if (sysfs__read_ull(path, (unsigned long long *)start) < 0) { | ||
2873 | + pr_debug2("Using module %s start:%#lx\n", path, m_start); | ||
2874 | + *start = m_start; | ||
2875 | + } | ||
2876 | |||
2877 | return 0; | ||
2878 | } | ||
2879 | diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c | ||
2880 | index 7123f4de32cc..226f4312b8f3 100644 | ||
2881 | --- a/tools/perf/util/data-convert-bt.c | ||
2882 | +++ b/tools/perf/util/data-convert-bt.c | ||
2883 | @@ -265,7 +265,7 @@ static int string_set_value(struct bt_ctf_field *field, const char *string) | ||
2884 | if (i > 0) | ||
2885 | strncpy(buffer, string, i); | ||
2886 | } | ||
2887 | - strncat(buffer + p, numstr, 4); | ||
2888 | + memcpy(buffer + p, numstr, 4); | ||
2889 | p += 3; | ||
2890 | } | ||
2891 | } | ||
2892 | diff --git a/tools/testing/selftests/netfilter/nft_nat.sh b/tools/testing/selftests/netfilter/nft_nat.sh | ||
2893 | index 8ec76681605c..f25f72a75cf3 100755 | ||
2894 | --- a/tools/testing/selftests/netfilter/nft_nat.sh | ||
2895 | +++ b/tools/testing/selftests/netfilter/nft_nat.sh | ||
2896 | @@ -23,7 +23,11 @@ ip netns add ns0 | ||
2897 | ip netns add ns1 | ||
2898 | ip netns add ns2 | ||
2899 | |||
2900 | -ip link add veth0 netns ns0 type veth peer name eth0 netns ns1 | ||
2901 | +ip link add veth0 netns ns0 type veth peer name eth0 netns ns1 > /dev/null 2>&1 | ||
2902 | +if [ $? -ne 0 ];then | ||
2903 | + echo "SKIP: No virtual ethernet pair device support in kernel" | ||
2904 | + exit $ksft_skip | ||
2905 | +fi | ||
2906 | ip link add veth1 netns ns0 type veth peer name eth0 netns ns2 | ||
2907 | |||
2908 | ip -net ns0 link set lo up | ||
2909 | diff --git a/tools/testing/selftests/timers/adjtick.c b/tools/testing/selftests/timers/adjtick.c | ||
2910 | index 9887fd538fec..91316ab4b041 100644 | ||
2911 | --- a/tools/testing/selftests/timers/adjtick.c | ||
2912 | +++ b/tools/testing/selftests/timers/adjtick.c | ||
2913 | @@ -147,6 +147,7 @@ int check_tick_adj(long tickval) | ||
2914 | |||
2915 | eppm = get_ppm_drift(); | ||
2916 | printf("%lld usec, %lld ppm", systick + (systick * eppm / MILLION), eppm); | ||
2917 | + fflush(stdout); | ||
2918 | |||
2919 | tx1.modes = 0; | ||
2920 | adjtimex(&tx1); | ||
2921 | diff --git a/tools/testing/selftests/timers/leapcrash.c b/tools/testing/selftests/timers/leapcrash.c | ||
2922 | index a1071bdbdeb7..a77c70b47495 100644 | ||
2923 | --- a/tools/testing/selftests/timers/leapcrash.c | ||
2924 | +++ b/tools/testing/selftests/timers/leapcrash.c | ||
2925 | @@ -114,6 +114,7 @@ int main(void) | ||
2926 | } | ||
2927 | clear_time_state(); | ||
2928 | printf("."); | ||
2929 | + fflush(stdout); | ||
2930 | } | ||
2931 | printf("[OK]\n"); | ||
2932 | return ksft_exit_pass(); | ||
2933 | diff --git a/tools/testing/selftests/timers/mqueue-lat.c b/tools/testing/selftests/timers/mqueue-lat.c | ||
2934 | index a2a3924d0b41..efdb62470052 100644 | ||
2935 | --- a/tools/testing/selftests/timers/mqueue-lat.c | ||
2936 | +++ b/tools/testing/selftests/timers/mqueue-lat.c | ||
2937 | @@ -113,6 +113,7 @@ int main(int argc, char **argv) | ||
2938 | int ret; | ||
2939 | |||
2940 | printf("Mqueue latency : "); | ||
2941 | + fflush(stdout); | ||
2942 | |||
2943 | ret = mqueue_lat_test(); | ||
2944 | if (ret < 0) { | ||
2945 | diff --git a/tools/testing/selftests/timers/nanosleep.c b/tools/testing/selftests/timers/nanosleep.c | ||
2946 | index ff942ff7c9b3..2e6e94c02a33 100644 | ||
2947 | --- a/tools/testing/selftests/timers/nanosleep.c | ||
2948 | +++ b/tools/testing/selftests/timers/nanosleep.c | ||
2949 | @@ -153,6 +153,7 @@ int main(int argc, char **argv) | ||
2950 | continue; | ||
2951 | |||
2952 | printf("Nanosleep %-31s ", clockstring(clockid)); | ||
2953 | + fflush(stdout); | ||
2954 | |||
2955 | length = 10; | ||
2956 | while (length <= (NSEC_PER_SEC * 10)) { | ||
2957 | diff --git a/tools/testing/selftests/timers/nsleep-lat.c b/tools/testing/selftests/timers/nsleep-lat.c | ||
2958 | index 2d7898fda0f1..ac06cf10a5c2 100644 | ||
2959 | --- a/tools/testing/selftests/timers/nsleep-lat.c | ||
2960 | +++ b/tools/testing/selftests/timers/nsleep-lat.c | ||
2961 | @@ -166,6 +166,7 @@ int main(int argc, char **argv) | ||
2962 | continue; | ||
2963 | |||
2964 | printf("nsleep latency %-26s ", clockstring(clockid)); | ||
2965 | + fflush(stdout); | ||
2966 | |||
2967 | length = 10; | ||
2968 | while (length <= (NSEC_PER_SEC * 10)) { | ||
2969 | diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c | ||
2970 | index 0ab937a17ebb..4e631da7f956 100644 | ||
2971 | --- a/tools/testing/selftests/timers/raw_skew.c | ||
2972 | +++ b/tools/testing/selftests/timers/raw_skew.c | ||
2973 | @@ -124,6 +124,7 @@ int main(int argv, char **argc) | ||
2974 | printf("WARNING: ADJ_OFFSET in progress, this will cause inaccurate results\n"); | ||
2975 | |||
2976 | printf("Estimating clock drift: "); | ||
2977 | + fflush(stdout); | ||
2978 | sleep(120); | ||
2979 | |||
2980 | get_monotonic_and_raw(&mon, &raw); | ||
2981 | diff --git a/tools/testing/selftests/timers/set-tai.c b/tools/testing/selftests/timers/set-tai.c | ||
2982 | index dc88dbc8831f..3ae76ab483de 100644 | ||
2983 | --- a/tools/testing/selftests/timers/set-tai.c | ||
2984 | +++ b/tools/testing/selftests/timers/set-tai.c | ||
2985 | @@ -66,6 +66,7 @@ int main(int argc, char **argv) | ||
2986 | printf("tai offset started at %i\n", ret); | ||
2987 | |||
2988 | printf("Checking tai offsets can be properly set: "); | ||
2989 | + fflush(stdout); | ||
2990 | for (i = 1; i <= 60; i++) { | ||
2991 | ret = set_tai(i); | ||
2992 | ret = get_tai(); | ||
2993 | diff --git a/tools/testing/selftests/timers/set-tz.c b/tools/testing/selftests/timers/set-tz.c | ||
2994 | index f4184928b16b..b038131c9682 100644 | ||
2995 | --- a/tools/testing/selftests/timers/set-tz.c | ||
2996 | +++ b/tools/testing/selftests/timers/set-tz.c | ||
2997 | @@ -76,6 +76,7 @@ int main(int argc, char **argv) | ||
2998 | printf("tz_minuteswest started at %i, dst at %i\n", min, dst); | ||
2999 | |||
3000 | printf("Checking tz_minuteswest can be properly set: "); | ||
3001 | + fflush(stdout); | ||
3002 | for (i = -15*60; i < 15*60; i += 30) { | ||
3003 | ret = set_tz(i, dst); | ||
3004 | ret = get_tz_min(); | ||
3005 | @@ -87,6 +88,7 @@ int main(int argc, char **argv) | ||
3006 | printf("[OK]\n"); | ||
3007 | |||
3008 | printf("Checking invalid tz_minuteswest values are caught: "); | ||
3009 | + fflush(stdout); | ||
3010 | |||
3011 | if (!set_tz(-15*60-1, dst)) { | ||
3012 | printf("[FAILED] %i didn't return failure!\n", -15*60-1); | ||
3013 | diff --git a/tools/testing/selftests/timers/threadtest.c b/tools/testing/selftests/timers/threadtest.c | ||
3014 | index e632e116f05e..a4bf736dd842 100644 | ||
3015 | --- a/tools/testing/selftests/timers/threadtest.c | ||
3016 | +++ b/tools/testing/selftests/timers/threadtest.c | ||
3017 | @@ -175,6 +175,7 @@ int main(int argc, char **argv) | ||
3018 | strftime(buf, 255, "%a, %d %b %Y %T %z", localtime(&start)); | ||
3019 | printf("%s\n", buf); | ||
3020 | printf("Testing consistency with %i threads for %ld seconds: ", thread_count, runtime); | ||
3021 | + fflush(stdout); | ||
3022 | |||
3023 | /* spawn */ | ||
3024 | for (i = 0; i < thread_count; i++) | ||
3025 | diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testing/selftests/timers/valid-adjtimex.c | ||
3026 | index 60fe3c569bd9..a747645d79f4 100644 | ||
3027 | --- a/tools/testing/selftests/timers/valid-adjtimex.c | ||
3028 | +++ b/tools/testing/selftests/timers/valid-adjtimex.c | ||
3029 | @@ -134,6 +134,7 @@ int validate_freq(void) | ||
3030 | /* Set the leap second insert flag */ | ||
3031 | |||
3032 | printf("Testing ADJ_FREQ... "); | ||
3033 | + fflush(stdout); | ||
3034 | for (i = 0; i < NUM_FREQ_VALID; i++) { | ||
3035 | tx.modes = ADJ_FREQUENCY; | ||
3036 | tx.freq = valid_freq[i]; | ||
3037 | @@ -261,6 +262,7 @@ int set_bad_offset(long sec, long usec, int use_nano) | ||
3038 | int validate_set_offset(void) | ||
3039 | { | ||
3040 | printf("Testing ADJ_SETOFFSET... "); | ||
3041 | + fflush(stdout); | ||
3042 | |||
3043 | /* Test valid values */ | ||
3044 | if (set_offset(NSEC_PER_SEC - 1, 1)) |