Annotation of /trunk/kernel-alx/patches-4.9/0327-4.9.228-all-fixes.patch
Parent Directory
|
Revision Log
Revision 3602 -
(hide annotations)
(download)
Thu Aug 13 10:21:42 2020 UTC (4 years, 1 month ago) by niro
File size: 139698 byte(s)
Thu Aug 13 10:21:42 2020 UTC (4 years, 1 month ago) by niro
File size: 139698 byte(s)
linux-228
1 | niro | 3602 | diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt |
2 | index b6a7e7397b8b..b944fe067188 100644 | ||
3 | --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt | ||
4 | +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt | ||
5 | @@ -16,6 +16,9 @@ Required properties: | ||
6 | Documentation/devicetree/bindings/graph.txt. This port should be connected | ||
7 | to the input port of an attached HDMI or LVDS encoder chip. | ||
8 | |||
9 | +Optional properties: | ||
10 | +- pinctrl-names: Contain "default" and "sleep". | ||
11 | + | ||
12 | Example: | ||
13 | |||
14 | dpi0: dpi@1401d000 { | ||
15 | @@ -26,6 +29,9 @@ dpi0: dpi@1401d000 { | ||
16 | <&mmsys CLK_MM_DPI_ENGINE>, | ||
17 | <&apmixedsys CLK_APMIXED_TVDPLL>; | ||
18 | clock-names = "pixel", "engine", "pll"; | ||
19 | + pinctrl-names = "default", "sleep"; | ||
20 | + pinctrl-0 = <&dpi_pin_func>; | ||
21 | + pinctrl-1 = <&dpi_pin_idle>; | ||
22 | |||
23 | port { | ||
24 | dpi0_out: endpoint { | ||
25 | diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt | ||
26 | index d1908e50b506..b8f5bf2a890a 100644 | ||
27 | --- a/Documentation/virtual/kvm/api.txt | ||
28 | +++ b/Documentation/virtual/kvm/api.txt | ||
29 | @@ -3534,9 +3534,11 @@ EOI was received. | ||
30 | #define KVM_EXIT_HYPERV_SYNIC 1 | ||
31 | #define KVM_EXIT_HYPERV_HCALL 2 | ||
32 | __u32 type; | ||
33 | + __u32 pad1; | ||
34 | union { | ||
35 | struct { | ||
36 | __u32 msr; | ||
37 | + __u32 pad2; | ||
38 | __u64 control; | ||
39 | __u64 evt_page; | ||
40 | __u64 msg_page; | ||
41 | diff --git a/Makefile b/Makefile | ||
42 | index 6c3c6e193621..af23d7b67442 100644 | ||
43 | --- a/Makefile | ||
44 | +++ b/Makefile | ||
45 | @@ -1,6 +1,6 @@ | ||
46 | VERSION = 4 | ||
47 | PATCHLEVEL = 9 | ||
48 | -SUBLEVEL = 227 | ||
49 | +SUBLEVEL = 228 | ||
50 | EXTRAVERSION = | ||
51 | NAME = Roaring Lionus | ||
52 | |||
53 | @@ -313,12 +313,8 @@ KBUILD_MODULES := | ||
54 | KBUILD_BUILTIN := 1 | ||
55 | |||
56 | # If we have only "make modules", don't compile built-in objects. | ||
57 | -# When we're building modules with modversions, we need to consider | ||
58 | -# the built-in objects during the descend as well, in order to | ||
59 | -# make sure the checksums are up to date before we record them. | ||
60 | - | ||
61 | ifeq ($(MAKECMDGOALS),modules) | ||
62 | - KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) | ||
63 | + KBUILD_BUILTIN := | ||
64 | endif | ||
65 | |||
66 | # If we have "make <whatever> modules", compile modules | ||
67 | @@ -1237,6 +1233,13 @@ ifdef CONFIG_MODULES | ||
68 | |||
69 | all: modules | ||
70 | |||
71 | +# When we're building modules with modversions, we need to consider | ||
72 | +# the built-in objects during the descend as well, in order to | ||
73 | +# make sure the checksums are up to date before we record them. | ||
74 | +ifdef CONFIG_MODVERSIONS | ||
75 | + KBUILD_BUILTIN := 1 | ||
76 | +endif | ||
77 | + | ||
78 | # Build modules | ||
79 | # | ||
80 | # A module can be listed more than once in obj-m resulting in | ||
81 | diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c | ||
82 | index ae738a6319f6..364985c96a92 100644 | ||
83 | --- a/arch/arm/kernel/ptrace.c | ||
84 | +++ b/arch/arm/kernel/ptrace.c | ||
85 | @@ -227,8 +227,8 @@ static struct undef_hook arm_break_hook = { | ||
86 | }; | ||
87 | |||
88 | static struct undef_hook thumb_break_hook = { | ||
89 | - .instr_mask = 0xffff, | ||
90 | - .instr_val = 0xde01, | ||
91 | + .instr_mask = 0xffffffff, | ||
92 | + .instr_val = 0x0000de01, | ||
93 | .cpsr_mask = PSR_T_BIT, | ||
94 | .cpsr_val = PSR_T_BIT, | ||
95 | .fn = break_trap, | ||
96 | diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c | ||
97 | index e01cbca196b5..a67fcf7a5643 100644 | ||
98 | --- a/arch/arm/mach-tegra/tegra.c | ||
99 | +++ b/arch/arm/mach-tegra/tegra.c | ||
100 | @@ -137,8 +137,8 @@ static const char * const tegra_dt_board_compat[] = { | ||
101 | }; | ||
102 | |||
103 | DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)") | ||
104 | - .l2c_aux_val = 0x3c400001, | ||
105 | - .l2c_aux_mask = 0xc20fc3fe, | ||
106 | + .l2c_aux_val = 0x3c400000, | ||
107 | + .l2c_aux_mask = 0xc20fc3ff, | ||
108 | .smp = smp_ops(tegra_smp_ops), | ||
109 | .map_io = tegra_map_common_io, | ||
110 | .init_early = tegra_init_early, | ||
111 | diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S | ||
112 | index f8bb65032b79..796e8f675a93 100644 | ||
113 | --- a/arch/arm/mm/proc-macros.S | ||
114 | +++ b/arch/arm/mm/proc-macros.S | ||
115 | @@ -4,6 +4,7 @@ | ||
116 | * VMA_VM_FLAGS | ||
117 | * VM_EXEC | ||
118 | */ | ||
119 | +#include <linux/const.h> | ||
120 | #include <asm/asm-offsets.h> | ||
121 | #include <asm/thread_info.h> | ||
122 | |||
123 | @@ -34,7 +35,7 @@ | ||
124 | * act_mm - get current->active_mm | ||
125 | */ | ||
126 | .macro act_mm, rd | ||
127 | - bic \rd, sp, #8128 | ||
128 | + bic \rd, sp, #(THREAD_SIZE - 1) & ~63 | ||
129 | bic \rd, \rd, #63 | ||
130 | ldr \rd, [\rd, #TI_TASK] | ||
131 | ldr \rd, [\rd, #TSK_ACTIVE_MM] | ||
132 | diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h | ||
133 | index 4cdfbd01b2de..367ebb48170b 100644 | ||
134 | --- a/arch/arm64/include/asm/kvm_host.h | ||
135 | +++ b/arch/arm64/include/asm/kvm_host.h | ||
136 | @@ -290,8 +290,10 @@ struct kvm_vcpu_arch { | ||
137 | * CP14 and CP15 live in the same array, as they are backed by the | ||
138 | * same system registers. | ||
139 | */ | ||
140 | -#define vcpu_cp14(v,r) ((v)->arch.ctxt.copro[(r)]) | ||
141 | -#define vcpu_cp15(v,r) ((v)->arch.ctxt.copro[(r)]) | ||
142 | +#define CPx_BIAS IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) | ||
143 | + | ||
144 | +#define vcpu_cp14(v,r) ((v)->arch.ctxt.copro[(r) ^ CPx_BIAS]) | ||
145 | +#define vcpu_cp15(v,r) ((v)->arch.ctxt.copro[(r) ^ CPx_BIAS]) | ||
146 | |||
147 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
148 | #define vcpu_cp15_64_high(v,r) vcpu_cp15((v),(r)) | ||
149 | diff --git a/arch/m68k/include/asm/mac_via.h b/arch/m68k/include/asm/mac_via.h | ||
150 | index 53c632c85b03..dff6db19ae4d 100644 | ||
151 | --- a/arch/m68k/include/asm/mac_via.h | ||
152 | +++ b/arch/m68k/include/asm/mac_via.h | ||
153 | @@ -256,6 +256,7 @@ extern int rbv_present,via_alt_mapping; | ||
154 | |||
155 | struct irq_desc; | ||
156 | |||
157 | +extern void via_l2_flush(int writeback); | ||
158 | extern void via_register_interrupts(void); | ||
159 | extern void via_irq_enable(int); | ||
160 | extern void via_irq_disable(int); | ||
161 | diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c | ||
162 | index e46895316eb0..dcf18e1ca0bb 100644 | ||
163 | --- a/arch/m68k/mac/config.c | ||
164 | +++ b/arch/m68k/mac/config.c | ||
165 | @@ -61,7 +61,6 @@ extern void iop_preinit(void); | ||
166 | extern void iop_init(void); | ||
167 | extern void via_init(void); | ||
168 | extern void via_init_clock(irq_handler_t func); | ||
169 | -extern void via_flush_cache(void); | ||
170 | extern void oss_init(void); | ||
171 | extern void psc_init(void); | ||
172 | extern void baboon_init(void); | ||
173 | @@ -132,21 +131,6 @@ int __init mac_parse_bootinfo(const struct bi_record *record) | ||
174 | return unknown; | ||
175 | } | ||
176 | |||
177 | -/* | ||
178 | - * Flip into 24bit mode for an instant - flushes the L2 cache card. We | ||
179 | - * have to disable interrupts for this. Our IRQ handlers will crap | ||
180 | - * themselves if they take an IRQ in 24bit mode! | ||
181 | - */ | ||
182 | - | ||
183 | -static void mac_cache_card_flush(int writeback) | ||
184 | -{ | ||
185 | - unsigned long flags; | ||
186 | - | ||
187 | - local_irq_save(flags); | ||
188 | - via_flush_cache(); | ||
189 | - local_irq_restore(flags); | ||
190 | -} | ||
191 | - | ||
192 | void __init config_mac(void) | ||
193 | { | ||
194 | if (!MACH_IS_MAC) | ||
195 | @@ -179,9 +163,8 @@ void __init config_mac(void) | ||
196 | * not. | ||
197 | */ | ||
198 | |||
199 | - if (macintosh_config->ident == MAC_MODEL_IICI | ||
200 | - || macintosh_config->ident == MAC_MODEL_IIFX) | ||
201 | - mach_l2_flush = mac_cache_card_flush; | ||
202 | + if (macintosh_config->ident == MAC_MODEL_IICI) | ||
203 | + mach_l2_flush = via_l2_flush; | ||
204 | } | ||
205 | |||
206 | |||
207 | diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c | ||
208 | index a435aced6e43..35382c1b563f 100644 | ||
209 | --- a/arch/m68k/mac/via.c | ||
210 | +++ b/arch/m68k/mac/via.c | ||
211 | @@ -299,10 +299,14 @@ void via_debug_dump(void) | ||
212 | * the system into 24-bit mode for an instant. | ||
213 | */ | ||
214 | |||
215 | -void via_flush_cache(void) | ||
216 | +void via_l2_flush(int writeback) | ||
217 | { | ||
218 | + unsigned long flags; | ||
219 | + | ||
220 | + local_irq_save(flags); | ||
221 | via2[gBufB] &= ~VIA2B_vMode32; | ||
222 | via2[gBufB] |= VIA2B_vMode32; | ||
223 | + local_irq_restore(flags); | ||
224 | } | ||
225 | |||
226 | /* | ||
227 | diff --git a/arch/mips/Makefile b/arch/mips/Makefile | ||
228 | index 1a6bac7b076f..25f3bfef9b39 100644 | ||
229 | --- a/arch/mips/Makefile | ||
230 | +++ b/arch/mips/Makefile | ||
231 | @@ -256,12 +256,23 @@ ifdef CONFIG_64BIT | ||
232 | endif | ||
233 | endif | ||
234 | |||
235 | +# When linking a 32-bit executable the LLVM linker cannot cope with a | ||
236 | +# 32-bit load address that has been sign-extended to 64 bits. Simply | ||
237 | +# remove the upper 32 bits then, as it is safe to do so with other | ||
238 | +# linkers. | ||
239 | +ifdef CONFIG_64BIT | ||
240 | + load-ld = $(load-y) | ||
241 | +else | ||
242 | + load-ld = $(subst 0xffffffff,0x,$(load-y)) | ||
243 | +endif | ||
244 | + | ||
245 | KBUILD_AFLAGS += $(cflags-y) | ||
246 | KBUILD_CFLAGS += $(cflags-y) | ||
247 | -KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) | ||
248 | +KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) -DLINKER_LOAD_ADDRESS=$(load-ld) | ||
249 | KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0) | ||
250 | |||
251 | bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \ | ||
252 | + LINKER_LOAD_ADDRESS=$(load-ld) \ | ||
253 | VMLINUX_ENTRY_ADDRESS=$(entry-y) \ | ||
254 | PLATFORM="$(platform-y)" | ||
255 | ifdef CONFIG_32BIT | ||
256 | diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile | ||
257 | index 2f77e250b91d..0fa91c981658 100644 | ||
258 | --- a/arch/mips/boot/compressed/Makefile | ||
259 | +++ b/arch/mips/boot/compressed/Makefile | ||
260 | @@ -87,7 +87,7 @@ ifneq ($(zload-y),) | ||
261 | VMLINUZ_LOAD_ADDRESS := $(zload-y) | ||
262 | else | ||
263 | VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \ | ||
264 | - $(obj)/vmlinux.bin $(VMLINUX_LOAD_ADDRESS)) | ||
265 | + $(obj)/vmlinux.bin $(LINKER_LOAD_ADDRESS)) | ||
266 | endif | ||
267 | |||
268 | vmlinuzobjs-y += $(obj)/piggy.o | ||
269 | diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h | ||
270 | index bebec370324f..22573b4f25b6 100644 | ||
271 | --- a/arch/mips/include/asm/kvm_host.h | ||
272 | +++ b/arch/mips/include/asm/kvm_host.h | ||
273 | @@ -243,8 +243,12 @@ enum emulation_result { | ||
274 | #define MIPS3_PG_SHIFT 6 | ||
275 | #define MIPS3_PG_FRAME 0x3fffffc0 | ||
276 | |||
277 | +#if defined(CONFIG_64BIT) | ||
278 | +#define VPN2_MASK GENMASK(cpu_vmbits - 1, 13) | ||
279 | +#else | ||
280 | #define VPN2_MASK 0xffffe000 | ||
281 | -#define KVM_ENTRYHI_ASID MIPS_ENTRYHI_ASID | ||
282 | +#endif | ||
283 | +#define KVM_ENTRYHI_ASID cpu_asid_mask(&boot_cpu_data) | ||
284 | #define TLB_IS_GLOBAL(x) ((x).tlb_lo[0] & (x).tlb_lo[1] & ENTRYLO_G) | ||
285 | #define TLB_VPN2(x) ((x).tlb_hi & VPN2_MASK) | ||
286 | #define TLB_ASID(x) ((x).tlb_hi & KVM_ENTRYHI_ASID) | ||
287 | diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S | ||
288 | index ae810da4d499..59ed811eb32a 100644 | ||
289 | --- a/arch/mips/kernel/genex.S | ||
290 | +++ b/arch/mips/kernel/genex.S | ||
291 | @@ -429,20 +429,20 @@ NESTED(nmi_handler, PT_SIZE, sp) | ||
292 | .endm | ||
293 | |||
294 | .macro __build_clear_fpe | ||
295 | + CLI | ||
296 | + TRACE_IRQS_OFF | ||
297 | .set push | ||
298 | /* gas fails to assemble cfc1 for some archs (octeon).*/ \ | ||
299 | .set mips1 | ||
300 | SET_HARDFLOAT | ||
301 | cfc1 a1, fcr31 | ||
302 | .set pop | ||
303 | - CLI | ||
304 | - TRACE_IRQS_OFF | ||
305 | .endm | ||
306 | |||
307 | .macro __build_clear_msa_fpe | ||
308 | - _cfcmsa a1, MSA_CSR | ||
309 | CLI | ||
310 | TRACE_IRQS_OFF | ||
311 | + _cfcmsa a1, MSA_CSR | ||
312 | .endm | ||
313 | |||
314 | .macro __build_clear_ade | ||
315 | diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c | ||
316 | index 60177a612cb1..df65516778a2 100644 | ||
317 | --- a/arch/mips/kernel/mips-cm.c | ||
318 | +++ b/arch/mips/kernel/mips-cm.c | ||
319 | @@ -123,9 +123,9 @@ static char *cm2_causes[32] = { | ||
320 | "COH_RD_ERR", "MMIO_WR_ERR", "MMIO_RD_ERR", "0x07", | ||
321 | "0x08", "0x09", "0x0a", "0x0b", | ||
322 | "0x0c", "0x0d", "0x0e", "0x0f", | ||
323 | - "0x10", "0x11", "0x12", "0x13", | ||
324 | - "0x14", "0x15", "0x16", "INTVN_WR_ERR", | ||
325 | - "INTVN_RD_ERR", "0x19", "0x1a", "0x1b", | ||
326 | + "0x10", "INTVN_WR_ERR", "INTVN_RD_ERR", "0x13", | ||
327 | + "0x14", "0x15", "0x16", "0x17", | ||
328 | + "0x18", "0x19", "0x1a", "0x1b", | ||
329 | "0x1c", "0x1d", "0x1e", "0x1f" | ||
330 | }; | ||
331 | |||
332 | diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c | ||
333 | index 7cc1d29334ee..2c3b89a65317 100644 | ||
334 | --- a/arch/mips/kernel/setup.c | ||
335 | +++ b/arch/mips/kernel/setup.c | ||
336 | @@ -847,7 +847,17 @@ static void __init arch_mem_init(char **cmdline_p) | ||
337 | BOOTMEM_DEFAULT); | ||
338 | #endif | ||
339 | device_tree_init(); | ||
340 | + | ||
341 | + /* | ||
342 | + * In order to reduce the possibility of kernel panic when failed to | ||
343 | + * get IO TLB memory under CONFIG_SWIOTLB, it is better to allocate | ||
344 | + * low memory as small as possible before plat_swiotlb_setup(), so | ||
345 | + * make sparse_init() using top-down allocation. | ||
346 | + */ | ||
347 | + memblock_set_bottom_up(false); | ||
348 | sparse_init(); | ||
349 | + memblock_set_bottom_up(true); | ||
350 | + | ||
351 | plat_swiotlb_setup(); | ||
352 | |||
353 | dma_contiguous_reserve(PFN_PHYS(max_low_pfn)); | ||
354 | diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c | ||
355 | index a7f81261c781..b7f7e08e1ce4 100644 | ||
356 | --- a/arch/mips/kernel/time.c | ||
357 | +++ b/arch/mips/kernel/time.c | ||
358 | @@ -22,12 +22,82 @@ | ||
359 | #include <linux/smp.h> | ||
360 | #include <linux/spinlock.h> | ||
361 | #include <linux/export.h> | ||
362 | +#include <linux/cpufreq.h> | ||
363 | +#include <linux/delay.h> | ||
364 | |||
365 | #include <asm/cpu-features.h> | ||
366 | #include <asm/cpu-type.h> | ||
367 | #include <asm/div64.h> | ||
368 | #include <asm/time.h> | ||
369 | |||
370 | +#ifdef CONFIG_CPU_FREQ | ||
371 | + | ||
372 | +static DEFINE_PER_CPU(unsigned long, pcp_lpj_ref); | ||
373 | +static DEFINE_PER_CPU(unsigned long, pcp_lpj_ref_freq); | ||
374 | +static unsigned long glb_lpj_ref; | ||
375 | +static unsigned long glb_lpj_ref_freq; | ||
376 | + | ||
377 | +static int cpufreq_callback(struct notifier_block *nb, | ||
378 | + unsigned long val, void *data) | ||
379 | +{ | ||
380 | + struct cpufreq_freqs *freq = data; | ||
381 | + struct cpumask *cpus = freq->policy->cpus; | ||
382 | + unsigned long lpj; | ||
383 | + int cpu; | ||
384 | + | ||
385 | + /* | ||
386 | + * Skip lpj numbers adjustment if the CPU-freq transition is safe for | ||
387 | + * the loops delay. (Is this possible?) | ||
388 | + */ | ||
389 | + if (freq->flags & CPUFREQ_CONST_LOOPS) | ||
390 | + return NOTIFY_OK; | ||
391 | + | ||
392 | + /* Save the initial values of the lpjes for future scaling. */ | ||
393 | + if (!glb_lpj_ref) { | ||
394 | + glb_lpj_ref = boot_cpu_data.udelay_val; | ||
395 | + glb_lpj_ref_freq = freq->old; | ||
396 | + | ||
397 | + for_each_online_cpu(cpu) { | ||
398 | + per_cpu(pcp_lpj_ref, cpu) = | ||
399 | + cpu_data[cpu].udelay_val; | ||
400 | + per_cpu(pcp_lpj_ref_freq, cpu) = freq->old; | ||
401 | + } | ||
402 | + } | ||
403 | + | ||
404 | + /* | ||
405 | + * Adjust global lpj variable and per-CPU udelay_val number in | ||
406 | + * accordance with the new CPU frequency. | ||
407 | + */ | ||
408 | + if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || | ||
409 | + (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) { | ||
410 | + loops_per_jiffy = cpufreq_scale(glb_lpj_ref, | ||
411 | + glb_lpj_ref_freq, | ||
412 | + freq->new); | ||
413 | + | ||
414 | + for_each_cpu(cpu, cpus) { | ||
415 | + lpj = cpufreq_scale(per_cpu(pcp_lpj_ref, cpu), | ||
416 | + per_cpu(pcp_lpj_ref_freq, cpu), | ||
417 | + freq->new); | ||
418 | + cpu_data[cpu].udelay_val = (unsigned int)lpj; | ||
419 | + } | ||
420 | + } | ||
421 | + | ||
422 | + return NOTIFY_OK; | ||
423 | +} | ||
424 | + | ||
425 | +static struct notifier_block cpufreq_notifier = { | ||
426 | + .notifier_call = cpufreq_callback, | ||
427 | +}; | ||
428 | + | ||
429 | +static int __init register_cpufreq_notifier(void) | ||
430 | +{ | ||
431 | + return cpufreq_register_notifier(&cpufreq_notifier, | ||
432 | + CPUFREQ_TRANSITION_NOTIFIER); | ||
433 | +} | ||
434 | +core_initcall(register_cpufreq_notifier); | ||
435 | + | ||
436 | +#endif /* CONFIG_CPU_FREQ */ | ||
437 | + | ||
438 | /* | ||
439 | * forward reference | ||
440 | */ | ||
441 | diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S | ||
442 | index 2d965d91fee4..612b2b301280 100644 | ||
443 | --- a/arch/mips/kernel/vmlinux.lds.S | ||
444 | +++ b/arch/mips/kernel/vmlinux.lds.S | ||
445 | @@ -49,7 +49,7 @@ SECTIONS | ||
446 | /* . = 0xa800000000300000; */ | ||
447 | . = 0xffffffff80300000; | ||
448 | #endif | ||
449 | - . = VMLINUX_LOAD_ADDRESS; | ||
450 | + . = LINKER_LOAD_ADDRESS; | ||
451 | /* read-only */ | ||
452 | _text = .; /* Text and read-only data */ | ||
453 | .text : { | ||
454 | diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c | ||
455 | index 06254467e4dd..f12b00a056cb 100644 | ||
456 | --- a/arch/powerpc/platforms/cell/spufs/file.c | ||
457 | +++ b/arch/powerpc/platforms/cell/spufs/file.c | ||
458 | @@ -2044,8 +2044,9 @@ static ssize_t __spufs_mbox_info_read(struct spu_context *ctx, | ||
459 | static ssize_t spufs_mbox_info_read(struct file *file, char __user *buf, | ||
460 | size_t len, loff_t *pos) | ||
461 | { | ||
462 | - int ret; | ||
463 | struct spu_context *ctx = file->private_data; | ||
464 | + u32 stat, data; | ||
465 | + int ret; | ||
466 | |||
467 | if (!access_ok(VERIFY_WRITE, buf, len)) | ||
468 | return -EFAULT; | ||
469 | @@ -2054,11 +2055,16 @@ static ssize_t spufs_mbox_info_read(struct file *file, char __user *buf, | ||
470 | if (ret) | ||
471 | return ret; | ||
472 | spin_lock(&ctx->csa.register_lock); | ||
473 | - ret = __spufs_mbox_info_read(ctx, buf, len, pos); | ||
474 | + stat = ctx->csa.prob.mb_stat_R; | ||
475 | + data = ctx->csa.prob.pu_mb_R; | ||
476 | spin_unlock(&ctx->csa.register_lock); | ||
477 | spu_release_saved(ctx); | ||
478 | |||
479 | - return ret; | ||
480 | + /* EOF if there's no entry in the mbox */ | ||
481 | + if (!(stat & 0x0000ff)) | ||
482 | + return 0; | ||
483 | + | ||
484 | + return simple_read_from_buffer(buf, len, pos, &data, sizeof(data)); | ||
485 | } | ||
486 | |||
487 | static const struct file_operations spufs_mbox_info_fops = { | ||
488 | @@ -2085,6 +2091,7 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf, | ||
489 | size_t len, loff_t *pos) | ||
490 | { | ||
491 | struct spu_context *ctx = file->private_data; | ||
492 | + u32 stat, data; | ||
493 | int ret; | ||
494 | |||
495 | if (!access_ok(VERIFY_WRITE, buf, len)) | ||
496 | @@ -2094,11 +2101,16 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf, | ||
497 | if (ret) | ||
498 | return ret; | ||
499 | spin_lock(&ctx->csa.register_lock); | ||
500 | - ret = __spufs_ibox_info_read(ctx, buf, len, pos); | ||
501 | + stat = ctx->csa.prob.mb_stat_R; | ||
502 | + data = ctx->csa.priv2.puint_mb_R; | ||
503 | spin_unlock(&ctx->csa.register_lock); | ||
504 | spu_release_saved(ctx); | ||
505 | |||
506 | - return ret; | ||
507 | + /* EOF if there's no entry in the ibox */ | ||
508 | + if (!(stat & 0xff0000)) | ||
509 | + return 0; | ||
510 | + | ||
511 | + return simple_read_from_buffer(buf, len, pos, &data, sizeof(data)); | ||
512 | } | ||
513 | |||
514 | static const struct file_operations spufs_ibox_info_fops = { | ||
515 | @@ -2107,6 +2119,11 @@ static const struct file_operations spufs_ibox_info_fops = { | ||
516 | .llseek = generic_file_llseek, | ||
517 | }; | ||
518 | |||
519 | +static size_t spufs_wbox_info_cnt(struct spu_context *ctx) | ||
520 | +{ | ||
521 | + return (4 - ((ctx->csa.prob.mb_stat_R & 0x00ff00) >> 8)) * sizeof(u32); | ||
522 | +} | ||
523 | + | ||
524 | static ssize_t __spufs_wbox_info_read(struct spu_context *ctx, | ||
525 | char __user *buf, size_t len, loff_t *pos) | ||
526 | { | ||
527 | @@ -2115,7 +2132,7 @@ static ssize_t __spufs_wbox_info_read(struct spu_context *ctx, | ||
528 | u32 wbox_stat; | ||
529 | |||
530 | wbox_stat = ctx->csa.prob.mb_stat_R; | ||
531 | - cnt = 4 - ((wbox_stat & 0x00ff00) >> 8); | ||
532 | + cnt = spufs_wbox_info_cnt(ctx); | ||
533 | for (i = 0; i < cnt; i++) { | ||
534 | data[i] = ctx->csa.spu_mailbox_data[i]; | ||
535 | } | ||
536 | @@ -2128,7 +2145,8 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf, | ||
537 | size_t len, loff_t *pos) | ||
538 | { | ||
539 | struct spu_context *ctx = file->private_data; | ||
540 | - int ret; | ||
541 | + u32 data[ARRAY_SIZE(ctx->csa.spu_mailbox_data)]; | ||
542 | + int ret, count; | ||
543 | |||
544 | if (!access_ok(VERIFY_WRITE, buf, len)) | ||
545 | return -EFAULT; | ||
546 | @@ -2137,11 +2155,13 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf, | ||
547 | if (ret) | ||
548 | return ret; | ||
549 | spin_lock(&ctx->csa.register_lock); | ||
550 | - ret = __spufs_wbox_info_read(ctx, buf, len, pos); | ||
551 | + count = spufs_wbox_info_cnt(ctx); | ||
552 | + memcpy(&data, &ctx->csa.spu_mailbox_data, sizeof(data)); | ||
553 | spin_unlock(&ctx->csa.register_lock); | ||
554 | spu_release_saved(ctx); | ||
555 | |||
556 | - return ret; | ||
557 | + return simple_read_from_buffer(buf, len, pos, &data, | ||
558 | + count * sizeof(u32)); | ||
559 | } | ||
560 | |||
561 | static const struct file_operations spufs_wbox_info_fops = { | ||
562 | @@ -2150,27 +2170,33 @@ static const struct file_operations spufs_wbox_info_fops = { | ||
563 | .llseek = generic_file_llseek, | ||
564 | }; | ||
565 | |||
566 | -static ssize_t __spufs_dma_info_read(struct spu_context *ctx, | ||
567 | - char __user *buf, size_t len, loff_t *pos) | ||
568 | +static void spufs_get_dma_info(struct spu_context *ctx, | ||
569 | + struct spu_dma_info *info) | ||
570 | { | ||
571 | - struct spu_dma_info info; | ||
572 | - struct mfc_cq_sr *qp, *spuqp; | ||
573 | int i; | ||
574 | |||
575 | - info.dma_info_type = ctx->csa.priv2.spu_tag_status_query_RW; | ||
576 | - info.dma_info_mask = ctx->csa.lscsa->tag_mask.slot[0]; | ||
577 | - info.dma_info_status = ctx->csa.spu_chnldata_RW[24]; | ||
578 | - info.dma_info_stall_and_notify = ctx->csa.spu_chnldata_RW[25]; | ||
579 | - info.dma_info_atomic_command_status = ctx->csa.spu_chnldata_RW[27]; | ||
580 | + info->dma_info_type = ctx->csa.priv2.spu_tag_status_query_RW; | ||
581 | + info->dma_info_mask = ctx->csa.lscsa->tag_mask.slot[0]; | ||
582 | + info->dma_info_status = ctx->csa.spu_chnldata_RW[24]; | ||
583 | + info->dma_info_stall_and_notify = ctx->csa.spu_chnldata_RW[25]; | ||
584 | + info->dma_info_atomic_command_status = ctx->csa.spu_chnldata_RW[27]; | ||
585 | for (i = 0; i < 16; i++) { | ||
586 | - qp = &info.dma_info_command_data[i]; | ||
587 | - spuqp = &ctx->csa.priv2.spuq[i]; | ||
588 | + struct mfc_cq_sr *qp = &info->dma_info_command_data[i]; | ||
589 | + struct mfc_cq_sr *spuqp = &ctx->csa.priv2.spuq[i]; | ||
590 | |||
591 | qp->mfc_cq_data0_RW = spuqp->mfc_cq_data0_RW; | ||
592 | qp->mfc_cq_data1_RW = spuqp->mfc_cq_data1_RW; | ||
593 | qp->mfc_cq_data2_RW = spuqp->mfc_cq_data2_RW; | ||
594 | qp->mfc_cq_data3_RW = spuqp->mfc_cq_data3_RW; | ||
595 | } | ||
596 | +} | ||
597 | + | ||
598 | +static ssize_t __spufs_dma_info_read(struct spu_context *ctx, | ||
599 | + char __user *buf, size_t len, loff_t *pos) | ||
600 | +{ | ||
601 | + struct spu_dma_info info; | ||
602 | + | ||
603 | + spufs_get_dma_info(ctx, &info); | ||
604 | |||
605 | return simple_read_from_buffer(buf, len, pos, &info, | ||
606 | sizeof info); | ||
607 | @@ -2180,6 +2206,7 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf, | ||
608 | size_t len, loff_t *pos) | ||
609 | { | ||
610 | struct spu_context *ctx = file->private_data; | ||
611 | + struct spu_dma_info info; | ||
612 | int ret; | ||
613 | |||
614 | if (!access_ok(VERIFY_WRITE, buf, len)) | ||
615 | @@ -2189,11 +2216,12 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf, | ||
616 | if (ret) | ||
617 | return ret; | ||
618 | spin_lock(&ctx->csa.register_lock); | ||
619 | - ret = __spufs_dma_info_read(ctx, buf, len, pos); | ||
620 | + spufs_get_dma_info(ctx, &info); | ||
621 | spin_unlock(&ctx->csa.register_lock); | ||
622 | spu_release_saved(ctx); | ||
623 | |||
624 | - return ret; | ||
625 | + return simple_read_from_buffer(buf, len, pos, &info, | ||
626 | + sizeof(info)); | ||
627 | } | ||
628 | |||
629 | static const struct file_operations spufs_dma_info_fops = { | ||
630 | @@ -2202,13 +2230,31 @@ static const struct file_operations spufs_dma_info_fops = { | ||
631 | .llseek = no_llseek, | ||
632 | }; | ||
633 | |||
634 | +static void spufs_get_proxydma_info(struct spu_context *ctx, | ||
635 | + struct spu_proxydma_info *info) | ||
636 | +{ | ||
637 | + int i; | ||
638 | + | ||
639 | + info->proxydma_info_type = ctx->csa.prob.dma_querytype_RW; | ||
640 | + info->proxydma_info_mask = ctx->csa.prob.dma_querymask_RW; | ||
641 | + info->proxydma_info_status = ctx->csa.prob.dma_tagstatus_R; | ||
642 | + | ||
643 | + for (i = 0; i < 8; i++) { | ||
644 | + struct mfc_cq_sr *qp = &info->proxydma_info_command_data[i]; | ||
645 | + struct mfc_cq_sr *puqp = &ctx->csa.priv2.puq[i]; | ||
646 | + | ||
647 | + qp->mfc_cq_data0_RW = puqp->mfc_cq_data0_RW; | ||
648 | + qp->mfc_cq_data1_RW = puqp->mfc_cq_data1_RW; | ||
649 | + qp->mfc_cq_data2_RW = puqp->mfc_cq_data2_RW; | ||
650 | + qp->mfc_cq_data3_RW = puqp->mfc_cq_data3_RW; | ||
651 | + } | ||
652 | +} | ||
653 | + | ||
654 | static ssize_t __spufs_proxydma_info_read(struct spu_context *ctx, | ||
655 | char __user *buf, size_t len, loff_t *pos) | ||
656 | { | ||
657 | struct spu_proxydma_info info; | ||
658 | - struct mfc_cq_sr *qp, *puqp; | ||
659 | int ret = sizeof info; | ||
660 | - int i; | ||
661 | |||
662 | if (len < ret) | ||
663 | return -EINVAL; | ||
664 | @@ -2216,18 +2262,7 @@ static ssize_t __spufs_proxydma_info_read(struct spu_context *ctx, | ||
665 | if (!access_ok(VERIFY_WRITE, buf, len)) | ||
666 | return -EFAULT; | ||
667 | |||
668 | - info.proxydma_info_type = ctx->csa.prob.dma_querytype_RW; | ||
669 | - info.proxydma_info_mask = ctx->csa.prob.dma_querymask_RW; | ||
670 | - info.proxydma_info_status = ctx->csa.prob.dma_tagstatus_R; | ||
671 | - for (i = 0; i < 8; i++) { | ||
672 | - qp = &info.proxydma_info_command_data[i]; | ||
673 | - puqp = &ctx->csa.priv2.puq[i]; | ||
674 | - | ||
675 | - qp->mfc_cq_data0_RW = puqp->mfc_cq_data0_RW; | ||
676 | - qp->mfc_cq_data1_RW = puqp->mfc_cq_data1_RW; | ||
677 | - qp->mfc_cq_data2_RW = puqp->mfc_cq_data2_RW; | ||
678 | - qp->mfc_cq_data3_RW = puqp->mfc_cq_data3_RW; | ||
679 | - } | ||
680 | + spufs_get_proxydma_info(ctx, &info); | ||
681 | |||
682 | return simple_read_from_buffer(buf, len, pos, &info, | ||
683 | sizeof info); | ||
684 | @@ -2237,17 +2272,19 @@ static ssize_t spufs_proxydma_info_read(struct file *file, char __user *buf, | ||
685 | size_t len, loff_t *pos) | ||
686 | { | ||
687 | struct spu_context *ctx = file->private_data; | ||
688 | + struct spu_proxydma_info info; | ||
689 | int ret; | ||
690 | |||
691 | ret = spu_acquire_saved(ctx); | ||
692 | if (ret) | ||
693 | return ret; | ||
694 | spin_lock(&ctx->csa.register_lock); | ||
695 | - ret = __spufs_proxydma_info_read(ctx, buf, len, pos); | ||
696 | + spufs_get_proxydma_info(ctx, &info); | ||
697 | spin_unlock(&ctx->csa.register_lock); | ||
698 | spu_release_saved(ctx); | ||
699 | |||
700 | - return ret; | ||
701 | + return simple_read_from_buffer(buf, len, pos, &info, | ||
702 | + sizeof(info)); | ||
703 | } | ||
704 | |||
705 | static const struct file_operations spufs_proxydma_info_fops = { | ||
706 | diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c | ||
707 | index a331fdc11a2c..396dbdea0cfa 100644 | ||
708 | --- a/arch/sparc/kernel/ptrace_32.c | ||
709 | +++ b/arch/sparc/kernel/ptrace_32.c | ||
710 | @@ -45,82 +45,79 @@ enum sparc_regset { | ||
711 | REGSET_FP, | ||
712 | }; | ||
713 | |||
714 | +static int regwindow32_get(struct task_struct *target, | ||
715 | + const struct pt_regs *regs, | ||
716 | + u32 *uregs) | ||
717 | +{ | ||
718 | + unsigned long reg_window = regs->u_regs[UREG_I6]; | ||
719 | + int size = 16 * sizeof(u32); | ||
720 | + | ||
721 | + if (target == current) { | ||
722 | + if (copy_from_user(uregs, (void __user *)reg_window, size)) | ||
723 | + return -EFAULT; | ||
724 | + } else { | ||
725 | + if (access_process_vm(target, reg_window, uregs, size, | ||
726 | + FOLL_FORCE) != size) | ||
727 | + return -EFAULT; | ||
728 | + } | ||
729 | + return 0; | ||
730 | +} | ||
731 | + | ||
732 | +static int regwindow32_set(struct task_struct *target, | ||
733 | + const struct pt_regs *regs, | ||
734 | + u32 *uregs) | ||
735 | +{ | ||
736 | + unsigned long reg_window = regs->u_regs[UREG_I6]; | ||
737 | + int size = 16 * sizeof(u32); | ||
738 | + | ||
739 | + if (target == current) { | ||
740 | + if (copy_to_user((void __user *)reg_window, uregs, size)) | ||
741 | + return -EFAULT; | ||
742 | + } else { | ||
743 | + if (access_process_vm(target, reg_window, uregs, size, | ||
744 | + FOLL_FORCE | FOLL_WRITE) != size) | ||
745 | + return -EFAULT; | ||
746 | + } | ||
747 | + return 0; | ||
748 | +} | ||
749 | + | ||
750 | static int genregs32_get(struct task_struct *target, | ||
751 | const struct user_regset *regset, | ||
752 | unsigned int pos, unsigned int count, | ||
753 | void *kbuf, void __user *ubuf) | ||
754 | { | ||
755 | const struct pt_regs *regs = target->thread.kregs; | ||
756 | - unsigned long __user *reg_window; | ||
757 | - unsigned long *k = kbuf; | ||
758 | - unsigned long __user *u = ubuf; | ||
759 | - unsigned long reg; | ||
760 | + u32 uregs[16]; | ||
761 | + int ret; | ||
762 | |||
763 | if (target == current) | ||
764 | flush_user_windows(); | ||
765 | |||
766 | - pos /= sizeof(reg); | ||
767 | - count /= sizeof(reg); | ||
768 | - | ||
769 | - if (kbuf) { | ||
770 | - for (; count > 0 && pos < 16; count--) | ||
771 | - *k++ = regs->u_regs[pos++]; | ||
772 | - | ||
773 | - reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; | ||
774 | - reg_window -= 16; | ||
775 | - for (; count > 0 && pos < 32; count--) { | ||
776 | - if (get_user(*k++, ®_window[pos++])) | ||
777 | - return -EFAULT; | ||
778 | - } | ||
779 | - } else { | ||
780 | - for (; count > 0 && pos < 16; count--) { | ||
781 | - if (put_user(regs->u_regs[pos++], u++)) | ||
782 | - return -EFAULT; | ||
783 | - } | ||
784 | - | ||
785 | - reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; | ||
786 | - reg_window -= 16; | ||
787 | - for (; count > 0 && pos < 32; count--) { | ||
788 | - if (get_user(reg, ®_window[pos++]) || | ||
789 | - put_user(reg, u++)) | ||
790 | - return -EFAULT; | ||
791 | - } | ||
792 | - } | ||
793 | - while (count > 0) { | ||
794 | - switch (pos) { | ||
795 | - case 32: /* PSR */ | ||
796 | - reg = regs->psr; | ||
797 | - break; | ||
798 | - case 33: /* PC */ | ||
799 | - reg = regs->pc; | ||
800 | - break; | ||
801 | - case 34: /* NPC */ | ||
802 | - reg = regs->npc; | ||
803 | - break; | ||
804 | - case 35: /* Y */ | ||
805 | - reg = regs->y; | ||
806 | - break; | ||
807 | - case 36: /* WIM */ | ||
808 | - case 37: /* TBR */ | ||
809 | - reg = 0; | ||
810 | - break; | ||
811 | - default: | ||
812 | - goto finish; | ||
813 | - } | ||
814 | + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, | ||
815 | + regs->u_regs, | ||
816 | + 0, 16 * sizeof(u32)); | ||
817 | + if (ret || !count) | ||
818 | + return ret; | ||
819 | |||
820 | - if (kbuf) | ||
821 | - *k++ = reg; | ||
822 | - else if (put_user(reg, u++)) | ||
823 | + if (pos < 32 * sizeof(u32)) { | ||
824 | + if (regwindow32_get(target, regs, uregs)) | ||
825 | return -EFAULT; | ||
826 | - pos++; | ||
827 | - count--; | ||
828 | + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, | ||
829 | + uregs, | ||
830 | + 16 * sizeof(u32), 32 * sizeof(u32)); | ||
831 | + if (ret || !count) | ||
832 | + return ret; | ||
833 | } | ||
834 | -finish: | ||
835 | - pos *= sizeof(reg); | ||
836 | - count *= sizeof(reg); | ||
837 | |||
838 | - return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, | ||
839 | - 38 * sizeof(reg), -1); | ||
840 | + uregs[0] = regs->psr; | ||
841 | + uregs[1] = regs->pc; | ||
842 | + uregs[2] = regs->npc; | ||
843 | + uregs[3] = regs->y; | ||
844 | + uregs[4] = 0; /* WIM */ | ||
845 | + uregs[5] = 0; /* TBR */ | ||
846 | + return user_regset_copyout(&pos, &count, &kbuf, &ubuf, | ||
847 | + uregs, | ||
848 | + 32 * sizeof(u32), 38 * sizeof(u32)); | ||
849 | } | ||
850 | |||
851 | static int genregs32_set(struct task_struct *target, | ||
852 | @@ -129,82 +126,53 @@ static int genregs32_set(struct task_struct *target, | ||
853 | const void *kbuf, const void __user *ubuf) | ||
854 | { | ||
855 | struct pt_regs *regs = target->thread.kregs; | ||
856 | - unsigned long __user *reg_window; | ||
857 | - const unsigned long *k = kbuf; | ||
858 | - const unsigned long __user *u = ubuf; | ||
859 | - unsigned long reg; | ||
860 | + u32 uregs[16]; | ||
861 | + u32 psr; | ||
862 | + int ret; | ||
863 | |||
864 | if (target == current) | ||
865 | flush_user_windows(); | ||
866 | |||
867 | - pos /= sizeof(reg); | ||
868 | - count /= sizeof(reg); | ||
869 | - | ||
870 | - if (kbuf) { | ||
871 | - for (; count > 0 && pos < 16; count--) | ||
872 | - regs->u_regs[pos++] = *k++; | ||
873 | - | ||
874 | - reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; | ||
875 | - reg_window -= 16; | ||
876 | - for (; count > 0 && pos < 32; count--) { | ||
877 | - if (put_user(*k++, ®_window[pos++])) | ||
878 | - return -EFAULT; | ||
879 | - } | ||
880 | - } else { | ||
881 | - for (; count > 0 && pos < 16; count--) { | ||
882 | - if (get_user(reg, u++)) | ||
883 | - return -EFAULT; | ||
884 | - regs->u_regs[pos++] = reg; | ||
885 | - } | ||
886 | - | ||
887 | - reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; | ||
888 | - reg_window -= 16; | ||
889 | - for (; count > 0 && pos < 32; count--) { | ||
890 | - if (get_user(reg, u++) || | ||
891 | - put_user(reg, ®_window[pos++])) | ||
892 | - return -EFAULT; | ||
893 | - } | ||
894 | - } | ||
895 | - while (count > 0) { | ||
896 | - unsigned long psr; | ||
897 | + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | ||
898 | + regs->u_regs, | ||
899 | + 0, 16 * sizeof(u32)); | ||
900 | + if (ret || !count) | ||
901 | + return ret; | ||
902 | |||
903 | - if (kbuf) | ||
904 | - reg = *k++; | ||
905 | - else if (get_user(reg, u++)) | ||
906 | + if (pos < 32 * sizeof(u32)) { | ||
907 | + if (regwindow32_get(target, regs, uregs)) | ||
908 | return -EFAULT; | ||
909 | - | ||
910 | - switch (pos) { | ||
911 | - case 32: /* PSR */ | ||
912 | - psr = regs->psr; | ||
913 | - psr &= ~(PSR_ICC | PSR_SYSCALL); | ||
914 | - psr |= (reg & (PSR_ICC | PSR_SYSCALL)); | ||
915 | - regs->psr = psr; | ||
916 | - break; | ||
917 | - case 33: /* PC */ | ||
918 | - regs->pc = reg; | ||
919 | - break; | ||
920 | - case 34: /* NPC */ | ||
921 | - regs->npc = reg; | ||
922 | - break; | ||
923 | - case 35: /* Y */ | ||
924 | - regs->y = reg; | ||
925 | - break; | ||
926 | - case 36: /* WIM */ | ||
927 | - case 37: /* TBR */ | ||
928 | - break; | ||
929 | - default: | ||
930 | - goto finish; | ||
931 | - } | ||
932 | - | ||
933 | - pos++; | ||
934 | - count--; | ||
935 | + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | ||
936 | + uregs, | ||
937 | + 16 * sizeof(u32), 32 * sizeof(u32)); | ||
938 | + if (ret) | ||
939 | + return ret; | ||
940 | + if (regwindow32_set(target, regs, uregs)) | ||
941 | + return -EFAULT; | ||
942 | + if (!count) | ||
943 | + return 0; | ||
944 | } | ||
945 | -finish: | ||
946 | - pos *= sizeof(reg); | ||
947 | - count *= sizeof(reg); | ||
948 | - | ||
949 | + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | ||
950 | + &psr, | ||
951 | + 32 * sizeof(u32), 33 * sizeof(u32)); | ||
952 | + if (ret) | ||
953 | + return ret; | ||
954 | + regs->psr = (regs->psr & ~(PSR_ICC | PSR_SYSCALL)) | | ||
955 | + (psr & (PSR_ICC | PSR_SYSCALL)); | ||
956 | + if (!count) | ||
957 | + return 0; | ||
958 | + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | ||
959 | + ®s->pc, | ||
960 | + 33 * sizeof(u32), 34 * sizeof(u32)); | ||
961 | + if (ret || !count) | ||
962 | + return ret; | ||
963 | + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | ||
964 | + ®s->y, | ||
965 | + 34 * sizeof(u32), 35 * sizeof(u32)); | ||
966 | + if (ret || !count) | ||
967 | + return ret; | ||
968 | return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, | ||
969 | - 38 * sizeof(reg), -1); | ||
970 | + 35 * sizeof(u32), 38 * sizeof(u32)); | ||
971 | } | ||
972 | |||
973 | static int fpregs32_get(struct task_struct *target, | ||
974 | diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c | ||
975 | index 7037ca3b4328..0a89a0546077 100644 | ||
976 | --- a/arch/sparc/kernel/ptrace_64.c | ||
977 | +++ b/arch/sparc/kernel/ptrace_64.c | ||
978 | @@ -533,19 +533,13 @@ static int genregs32_get(struct task_struct *target, | ||
979 | for (; count > 0 && pos < 32; count--) { | ||
980 | if (access_process_vm(target, | ||
981 | (unsigned long) | ||
982 | - ®_window[pos], | ||
983 | + ®_window[pos++], | ||
984 | ®, sizeof(reg), | ||
985 | FOLL_FORCE) | ||
986 | != sizeof(reg)) | ||
987 | return -EFAULT; | ||
988 | - if (access_process_vm(target, | ||
989 | - (unsigned long) u, | ||
990 | - ®, sizeof(reg), | ||
991 | - FOLL_FORCE | FOLL_WRITE) | ||
992 | - != sizeof(reg)) | ||
993 | + if (put_user(reg, u++)) | ||
994 | return -EFAULT; | ||
995 | - pos++; | ||
996 | - u++; | ||
997 | } | ||
998 | } | ||
999 | } | ||
1000 | @@ -645,12 +639,7 @@ static int genregs32_set(struct task_struct *target, | ||
1001 | } | ||
1002 | } else { | ||
1003 | for (; count > 0 && pos < 32; count--) { | ||
1004 | - if (access_process_vm(target, | ||
1005 | - (unsigned long) | ||
1006 | - u, | ||
1007 | - ®, sizeof(reg), | ||
1008 | - FOLL_FORCE) | ||
1009 | - != sizeof(reg)) | ||
1010 | + if (get_user(reg, u++)) | ||
1011 | return -EFAULT; | ||
1012 | if (access_process_vm(target, | ||
1013 | (unsigned long) | ||
1014 | diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S | ||
1015 | index 7532f6f53677..93f41b4f05ce 100644 | ||
1016 | --- a/arch/x86/boot/compressed/head_32.S | ||
1017 | +++ b/arch/x86/boot/compressed/head_32.S | ||
1018 | @@ -48,16 +48,17 @@ | ||
1019 | * Position Independent Executable (PIE) so that linker won't optimize | ||
1020 | * R_386_GOT32X relocation to its fixed symbol address. Older | ||
1021 | * linkers generate R_386_32 relocations against locally defined symbols, | ||
1022 | - * _bss, _ebss, _got and _egot, in PIE. It isn't wrong, just less | ||
1023 | + * _bss, _ebss, _got, _egot and _end, in PIE. It isn't wrong, just less | ||
1024 | * optimal than R_386_RELATIVE. But the x86 kernel fails to properly handle | ||
1025 | * R_386_32 relocations when relocating the kernel. To generate | ||
1026 | - * R_386_RELATIVE relocations, we mark _bss, _ebss, _got and _egot as | ||
1027 | + * R_386_RELATIVE relocations, we mark _bss, _ebss, _got, _egot and _end as | ||
1028 | * hidden: | ||
1029 | */ | ||
1030 | .hidden _bss | ||
1031 | .hidden _ebss | ||
1032 | .hidden _got | ||
1033 | .hidden _egot | ||
1034 | + .hidden _end | ||
1035 | |||
1036 | __HEAD | ||
1037 | ENTRY(startup_32) | ||
1038 | diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S | ||
1039 | index 3fac2d133e4e..d096bcfcb3f6 100644 | ||
1040 | --- a/arch/x86/boot/compressed/head_64.S | ||
1041 | +++ b/arch/x86/boot/compressed/head_64.S | ||
1042 | @@ -40,6 +40,7 @@ | ||
1043 | .hidden _ebss | ||
1044 | .hidden _got | ||
1045 | .hidden _egot | ||
1046 | + .hidden _end | ||
1047 | |||
1048 | __HEAD | ||
1049 | .code32 | ||
1050 | diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h | ||
1051 | index 2cd5d12a842c..8ceb7a8a249c 100644 | ||
1052 | --- a/arch/x86/include/asm/cpufeatures.h | ||
1053 | +++ b/arch/x86/include/asm/cpufeatures.h | ||
1054 | @@ -273,6 +273,7 @@ | ||
1055 | #define X86_FEATURE_AMD_IBPB (13*32+12) /* "" Indirect Branch Prediction Barrier */ | ||
1056 | #define X86_FEATURE_AMD_IBRS (13*32+14) /* "" Indirect Branch Restricted Speculation */ | ||
1057 | #define X86_FEATURE_AMD_STIBP (13*32+15) /* "" Single Thread Indirect Branch Predictors */ | ||
1058 | +#define X86_FEATURE_AMD_STIBP_ALWAYS_ON (13*32+17) /* "" Single Thread Indirect Branch Predictors always-on preferred */ | ||
1059 | #define X86_FEATURE_AMD_SSBD (13*32+24) /* "" Speculative Store Bypass Disable */ | ||
1060 | #define X86_FEATURE_VIRT_SSBD (13*32+25) /* Virtualized Speculative Store Bypass Disable */ | ||
1061 | #define X86_FEATURE_AMD_SSB_NO (13*32+26) /* "" Speculative Store Bypass is fixed in hardware. */ | ||
1062 | @@ -312,7 +313,6 @@ | ||
1063 | #define X86_FEATURE_SUCCOR (17*32+1) /* Uncorrectable error containment and recovery */ | ||
1064 | #define X86_FEATURE_SMCA (17*32+3) /* Scalable MCA */ | ||
1065 | |||
1066 | - | ||
1067 | /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ | ||
1068 | #define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */ | ||
1069 | #define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */ | ||
1070 | diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h | ||
1071 | index 8d56d701b5f7..4af16acc001a 100644 | ||
1072 | --- a/arch/x86/include/asm/nospec-branch.h | ||
1073 | +++ b/arch/x86/include/asm/nospec-branch.h | ||
1074 | @@ -223,6 +223,7 @@ enum spectre_v2_mitigation { | ||
1075 | enum spectre_v2_user_mitigation { | ||
1076 | SPECTRE_V2_USER_NONE, | ||
1077 | SPECTRE_V2_USER_STRICT, | ||
1078 | + SPECTRE_V2_USER_STRICT_PREFERRED, | ||
1079 | SPECTRE_V2_USER_PRCTL, | ||
1080 | SPECTRE_V2_USER_SECCOMP, | ||
1081 | }; | ||
1082 | diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c | ||
1083 | index 5ef0a2b34261..85c1cc0305f3 100644 | ||
1084 | --- a/arch/x86/kernel/cpu/bugs.c | ||
1085 | +++ b/arch/x86/kernel/cpu/bugs.c | ||
1086 | @@ -60,7 +60,7 @@ static u64 __ro_after_init x86_spec_ctrl_mask = SPEC_CTRL_IBRS; | ||
1087 | u64 __ro_after_init x86_amd_ls_cfg_base; | ||
1088 | u64 __ro_after_init x86_amd_ls_cfg_ssbd_mask; | ||
1089 | |||
1090 | -/* Control conditional STIPB in switch_to() */ | ||
1091 | +/* Control conditional STIBP in switch_to() */ | ||
1092 | DEFINE_STATIC_KEY_FALSE(switch_to_cond_stibp); | ||
1093 | /* Control conditional IBPB in switch_mm() */ | ||
1094 | DEFINE_STATIC_KEY_FALSE(switch_mm_cond_ibpb); | ||
1095 | @@ -580,7 +580,9 @@ early_param("nospectre_v1", nospectre_v1_cmdline); | ||
1096 | static enum spectre_v2_mitigation spectre_v2_enabled __ro_after_init = | ||
1097 | SPECTRE_V2_NONE; | ||
1098 | |||
1099 | -static enum spectre_v2_user_mitigation spectre_v2_user __ro_after_init = | ||
1100 | +static enum spectre_v2_user_mitigation spectre_v2_user_stibp __ro_after_init = | ||
1101 | + SPECTRE_V2_USER_NONE; | ||
1102 | +static enum spectre_v2_user_mitigation spectre_v2_user_ibpb __ro_after_init = | ||
1103 | SPECTRE_V2_USER_NONE; | ||
1104 | |||
1105 | #ifdef RETPOLINE | ||
1106 | @@ -632,10 +634,11 @@ enum spectre_v2_user_cmd { | ||
1107 | }; | ||
1108 | |||
1109 | static const char * const spectre_v2_user_strings[] = { | ||
1110 | - [SPECTRE_V2_USER_NONE] = "User space: Vulnerable", | ||
1111 | - [SPECTRE_V2_USER_STRICT] = "User space: Mitigation: STIBP protection", | ||
1112 | - [SPECTRE_V2_USER_PRCTL] = "User space: Mitigation: STIBP via prctl", | ||
1113 | - [SPECTRE_V2_USER_SECCOMP] = "User space: Mitigation: STIBP via seccomp and prctl", | ||
1114 | + [SPECTRE_V2_USER_NONE] = "User space: Vulnerable", | ||
1115 | + [SPECTRE_V2_USER_STRICT] = "User space: Mitigation: STIBP protection", | ||
1116 | + [SPECTRE_V2_USER_STRICT_PREFERRED] = "User space: Mitigation: STIBP always-on protection", | ||
1117 | + [SPECTRE_V2_USER_PRCTL] = "User space: Mitigation: STIBP via prctl", | ||
1118 | + [SPECTRE_V2_USER_SECCOMP] = "User space: Mitigation: STIBP via seccomp and prctl", | ||
1119 | }; | ||
1120 | |||
1121 | static const struct { | ||
1122 | @@ -747,23 +750,36 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd) | ||
1123 | pr_info("mitigation: Enabling %s Indirect Branch Prediction Barrier\n", | ||
1124 | static_key_enabled(&switch_mm_always_ibpb) ? | ||
1125 | "always-on" : "conditional"); | ||
1126 | + | ||
1127 | + spectre_v2_user_ibpb = mode; | ||
1128 | } | ||
1129 | |||
1130 | - /* If enhanced IBRS is enabled no STIPB required */ | ||
1131 | - if (spectre_v2_enabled == SPECTRE_V2_IBRS_ENHANCED) | ||
1132 | + /* | ||
1133 | + * If enhanced IBRS is enabled or SMT impossible, STIBP is not | ||
1134 | + * required. | ||
1135 | + */ | ||
1136 | + if (!smt_possible || spectre_v2_enabled == SPECTRE_V2_IBRS_ENHANCED) | ||
1137 | return; | ||
1138 | |||
1139 | /* | ||
1140 | - * If SMT is not possible or STIBP is not available clear the STIPB | ||
1141 | - * mode. | ||
1142 | + * At this point, an STIBP mode other than "off" has been set. | ||
1143 | + * If STIBP support is not being forced, check if STIBP always-on | ||
1144 | + * is preferred. | ||
1145 | */ | ||
1146 | - if (!smt_possible || !boot_cpu_has(X86_FEATURE_STIBP)) | ||
1147 | + if (mode != SPECTRE_V2_USER_STRICT && | ||
1148 | + boot_cpu_has(X86_FEATURE_AMD_STIBP_ALWAYS_ON)) | ||
1149 | + mode = SPECTRE_V2_USER_STRICT_PREFERRED; | ||
1150 | + | ||
1151 | + /* | ||
1152 | + * If STIBP is not available, clear the STIBP mode. | ||
1153 | + */ | ||
1154 | + if (!boot_cpu_has(X86_FEATURE_STIBP)) | ||
1155 | mode = SPECTRE_V2_USER_NONE; | ||
1156 | + | ||
1157 | + spectre_v2_user_stibp = mode; | ||
1158 | + | ||
1159 | set_mode: | ||
1160 | - spectre_v2_user = mode; | ||
1161 | - /* Only print the STIBP mode when SMT possible */ | ||
1162 | - if (smt_possible) | ||
1163 | - pr_info("%s\n", spectre_v2_user_strings[mode]); | ||
1164 | + pr_info("%s\n", spectre_v2_user_strings[mode]); | ||
1165 | } | ||
1166 | |||
1167 | static const char * const spectre_v2_strings[] = { | ||
1168 | @@ -1003,10 +1019,11 @@ void arch_smt_update(void) | ||
1169 | { | ||
1170 | mutex_lock(&spec_ctrl_mutex); | ||
1171 | |||
1172 | - switch (spectre_v2_user) { | ||
1173 | + switch (spectre_v2_user_stibp) { | ||
1174 | case SPECTRE_V2_USER_NONE: | ||
1175 | break; | ||
1176 | case SPECTRE_V2_USER_STRICT: | ||
1177 | + case SPECTRE_V2_USER_STRICT_PREFERRED: | ||
1178 | update_stibp_strict(); | ||
1179 | break; | ||
1180 | case SPECTRE_V2_USER_PRCTL: | ||
1181 | @@ -1235,13 +1252,19 @@ static int ib_prctl_set(struct task_struct *task, unsigned long ctrl) | ||
1182 | { | ||
1183 | switch (ctrl) { | ||
1184 | case PR_SPEC_ENABLE: | ||
1185 | - if (spectre_v2_user == SPECTRE_V2_USER_NONE) | ||
1186 | + if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE && | ||
1187 | + spectre_v2_user_stibp == SPECTRE_V2_USER_NONE) | ||
1188 | return 0; | ||
1189 | /* | ||
1190 | * Indirect branch speculation is always disabled in strict | ||
1191 | - * mode. | ||
1192 | + * mode. It can neither be enabled if it was force-disabled | ||
1193 | + * by a previous prctl call. | ||
1194 | + | ||
1195 | */ | ||
1196 | - if (spectre_v2_user == SPECTRE_V2_USER_STRICT) | ||
1197 | + if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT || | ||
1198 | + spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT || | ||
1199 | + spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED || | ||
1200 | + task_spec_ib_force_disable(task)) | ||
1201 | return -EPERM; | ||
1202 | task_clear_spec_ib_disable(task); | ||
1203 | task_update_spec_tif(task); | ||
1204 | @@ -1252,9 +1275,12 @@ static int ib_prctl_set(struct task_struct *task, unsigned long ctrl) | ||
1205 | * Indirect branch speculation is always allowed when | ||
1206 | * mitigation is force disabled. | ||
1207 | */ | ||
1208 | - if (spectre_v2_user == SPECTRE_V2_USER_NONE) | ||
1209 | + if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE && | ||
1210 | + spectre_v2_user_stibp == SPECTRE_V2_USER_NONE) | ||
1211 | return -EPERM; | ||
1212 | - if (spectre_v2_user == SPECTRE_V2_USER_STRICT) | ||
1213 | + if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT || | ||
1214 | + spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT || | ||
1215 | + spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED) | ||
1216 | return 0; | ||
1217 | task_set_spec_ib_disable(task); | ||
1218 | if (ctrl == PR_SPEC_FORCE_DISABLE) | ||
1219 | @@ -1285,7 +1311,8 @@ void arch_seccomp_spec_mitigate(struct task_struct *task) | ||
1220 | { | ||
1221 | if (ssb_mode == SPEC_STORE_BYPASS_SECCOMP) | ||
1222 | ssb_prctl_set(task, PR_SPEC_FORCE_DISABLE); | ||
1223 | - if (spectre_v2_user == SPECTRE_V2_USER_SECCOMP) | ||
1224 | + if (spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP || | ||
1225 | + spectre_v2_user_stibp == SPECTRE_V2_USER_SECCOMP) | ||
1226 | ib_prctl_set(task, PR_SPEC_FORCE_DISABLE); | ||
1227 | } | ||
1228 | #endif | ||
1229 | @@ -1314,21 +1341,24 @@ static int ib_prctl_get(struct task_struct *task) | ||
1230 | if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2)) | ||
1231 | return PR_SPEC_NOT_AFFECTED; | ||
1232 | |||
1233 | - switch (spectre_v2_user) { | ||
1234 | - case SPECTRE_V2_USER_NONE: | ||
1235 | + if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE && | ||
1236 | + spectre_v2_user_stibp == SPECTRE_V2_USER_NONE) | ||
1237 | return PR_SPEC_ENABLE; | ||
1238 | - case SPECTRE_V2_USER_PRCTL: | ||
1239 | - case SPECTRE_V2_USER_SECCOMP: | ||
1240 | + else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT || | ||
1241 | + spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT || | ||
1242 | + spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED) | ||
1243 | + return PR_SPEC_DISABLE; | ||
1244 | + else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_PRCTL || | ||
1245 | + spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP || | ||
1246 | + spectre_v2_user_stibp == SPECTRE_V2_USER_PRCTL || | ||
1247 | + spectre_v2_user_stibp == SPECTRE_V2_USER_SECCOMP) { | ||
1248 | if (task_spec_ib_force_disable(task)) | ||
1249 | return PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE; | ||
1250 | if (task_spec_ib_disable(task)) | ||
1251 | return PR_SPEC_PRCTL | PR_SPEC_DISABLE; | ||
1252 | return PR_SPEC_PRCTL | PR_SPEC_ENABLE; | ||
1253 | - case SPECTRE_V2_USER_STRICT: | ||
1254 | - return PR_SPEC_DISABLE; | ||
1255 | - default: | ||
1256 | + } else | ||
1257 | return PR_SPEC_NOT_AFFECTED; | ||
1258 | - } | ||
1259 | } | ||
1260 | |||
1261 | int arch_prctl_spec_ctrl_get(struct task_struct *task, unsigned long which) | ||
1262 | @@ -1569,11 +1599,13 @@ static char *stibp_state(void) | ||
1263 | if (spectre_v2_enabled == SPECTRE_V2_IBRS_ENHANCED) | ||
1264 | return ""; | ||
1265 | |||
1266 | - switch (spectre_v2_user) { | ||
1267 | + switch (spectre_v2_user_stibp) { | ||
1268 | case SPECTRE_V2_USER_NONE: | ||
1269 | return ", STIBP: disabled"; | ||
1270 | case SPECTRE_V2_USER_STRICT: | ||
1271 | return ", STIBP: forced"; | ||
1272 | + case SPECTRE_V2_USER_STRICT_PREFERRED: | ||
1273 | + return ", STIBP: always-on"; | ||
1274 | case SPECTRE_V2_USER_PRCTL: | ||
1275 | case SPECTRE_V2_USER_SECCOMP: | ||
1276 | if (static_key_enabled(&switch_to_cond_stibp)) | ||
1277 | diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c | ||
1278 | index 2e4eab22ca37..f58e4cc20c1c 100644 | ||
1279 | --- a/arch/x86/kernel/process.c | ||
1280 | +++ b/arch/x86/kernel/process.c | ||
1281 | @@ -337,28 +337,20 @@ static __always_inline void __speculation_ctrl_update(unsigned long tifp, | ||
1282 | u64 msr = x86_spec_ctrl_base; | ||
1283 | bool updmsr = false; | ||
1284 | |||
1285 | - /* | ||
1286 | - * If TIF_SSBD is different, select the proper mitigation | ||
1287 | - * method. Note that if SSBD mitigation is disabled or permanentely | ||
1288 | - * enabled this branch can't be taken because nothing can set | ||
1289 | - * TIF_SSBD. | ||
1290 | - */ | ||
1291 | - if (tif_diff & _TIF_SSBD) { | ||
1292 | - if (static_cpu_has(X86_FEATURE_VIRT_SSBD)) { | ||
1293 | + /* Handle change of TIF_SSBD depending on the mitigation method. */ | ||
1294 | + if (static_cpu_has(X86_FEATURE_VIRT_SSBD)) { | ||
1295 | + if (tif_diff & _TIF_SSBD) | ||
1296 | amd_set_ssb_virt_state(tifn); | ||
1297 | - } else if (static_cpu_has(X86_FEATURE_LS_CFG_SSBD)) { | ||
1298 | + } else if (static_cpu_has(X86_FEATURE_LS_CFG_SSBD)) { | ||
1299 | + if (tif_diff & _TIF_SSBD) | ||
1300 | amd_set_core_ssb_state(tifn); | ||
1301 | - } else if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) || | ||
1302 | - static_cpu_has(X86_FEATURE_AMD_SSBD)) { | ||
1303 | - msr |= ssbd_tif_to_spec_ctrl(tifn); | ||
1304 | - updmsr = true; | ||
1305 | - } | ||
1306 | + } else if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) || | ||
1307 | + static_cpu_has(X86_FEATURE_AMD_SSBD)) { | ||
1308 | + updmsr |= !!(tif_diff & _TIF_SSBD); | ||
1309 | + msr |= ssbd_tif_to_spec_ctrl(tifn); | ||
1310 | } | ||
1311 | |||
1312 | - /* | ||
1313 | - * Only evaluate TIF_SPEC_IB if conditional STIBP is enabled, | ||
1314 | - * otherwise avoid the MSR write. | ||
1315 | - */ | ||
1316 | + /* Only evaluate TIF_SPEC_IB if conditional STIBP is enabled. */ | ||
1317 | if (IS_ENABLED(CONFIG_SMP) && | ||
1318 | static_branch_unlikely(&switch_to_cond_stibp)) { | ||
1319 | updmsr |= !!(tif_diff & _TIF_SPEC_IB); | ||
1320 | diff --git a/arch/x86/kernel/process.h b/arch/x86/kernel/process.h | ||
1321 | index 898e97cf6629..320ab978fb1f 100644 | ||
1322 | --- a/arch/x86/kernel/process.h | ||
1323 | +++ b/arch/x86/kernel/process.h | ||
1324 | @@ -19,7 +19,7 @@ static inline void switch_to_extra(struct task_struct *prev, | ||
1325 | if (IS_ENABLED(CONFIG_SMP)) { | ||
1326 | /* | ||
1327 | * Avoid __switch_to_xtra() invocation when conditional | ||
1328 | - * STIPB is disabled and the only different bit is | ||
1329 | + * STIBP is disabled and the only different bit is | ||
1330 | * TIF_SPEC_IB. For CONFIG_SMP=n TIF_SPEC_IB is not | ||
1331 | * in the TIF_WORK_CTXSW masks. | ||
1332 | */ | ||
1333 | diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c | ||
1334 | index c55b11fe8e9f..b427dc73ba27 100644 | ||
1335 | --- a/arch/x86/kernel/reboot.c | ||
1336 | +++ b/arch/x86/kernel/reboot.c | ||
1337 | @@ -198,6 +198,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { | ||
1338 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5"), | ||
1339 | }, | ||
1340 | }, | ||
1341 | + { /* Handle problems with rebooting on Apple MacBook6,1 */ | ||
1342 | + .callback = set_pci_reboot, | ||
1343 | + .ident = "Apple MacBook6,1", | ||
1344 | + .matches = { | ||
1345 | + DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | ||
1346 | + DMI_MATCH(DMI_PRODUCT_NAME, "MacBook6,1"), | ||
1347 | + }, | ||
1348 | + }, | ||
1349 | { /* Handle problems with rebooting on Apple MacBookPro5 */ | ||
1350 | .callback = set_pci_reboot, | ||
1351 | .ident = "Apple MacBookPro5", | ||
1352 | diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c | ||
1353 | index 89d1190b9d94..5e5de7a7f38d 100644 | ||
1354 | --- a/arch/x86/kernel/time.c | ||
1355 | +++ b/arch/x86/kernel/time.c | ||
1356 | @@ -23,10 +23,6 @@ | ||
1357 | #include <asm/hpet.h> | ||
1358 | #include <asm/time.h> | ||
1359 | |||
1360 | -#ifdef CONFIG_X86_64 | ||
1361 | -__visible volatile unsigned long jiffies __cacheline_aligned_in_smp = INITIAL_JIFFIES; | ||
1362 | -#endif | ||
1363 | - | ||
1364 | unsigned long profile_pc(struct pt_regs *regs) | ||
1365 | { | ||
1366 | unsigned long pc = instruction_pointer(regs); | ||
1367 | diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S | ||
1368 | index 55f04875293f..097268f85e4e 100644 | ||
1369 | --- a/arch/x86/kernel/vmlinux.lds.S | ||
1370 | +++ b/arch/x86/kernel/vmlinux.lds.S | ||
1371 | @@ -34,13 +34,13 @@ OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT) | ||
1372 | #ifdef CONFIG_X86_32 | ||
1373 | OUTPUT_ARCH(i386) | ||
1374 | ENTRY(phys_startup_32) | ||
1375 | -jiffies = jiffies_64; | ||
1376 | #else | ||
1377 | OUTPUT_ARCH(i386:x86-64) | ||
1378 | ENTRY(phys_startup_64) | ||
1379 | -jiffies_64 = jiffies; | ||
1380 | #endif | ||
1381 | |||
1382 | +jiffies = jiffies_64; | ||
1383 | + | ||
1384 | #if defined(CONFIG_X86_64) | ||
1385 | /* | ||
1386 | * On 64-bit, align RODATA to 2MB so we retain large page mappings for | ||
1387 | diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c | ||
1388 | index 1079228e4fef..29078eaf18c9 100644 | ||
1389 | --- a/arch/x86/kvm/svm.c | ||
1390 | +++ b/arch/x86/kvm/svm.c | ||
1391 | @@ -2734,7 +2734,7 @@ static inline void copy_vmcb_control_area(struct vmcb *dst_vmcb, struct vmcb *fr | ||
1392 | dst->iopm_base_pa = from->iopm_base_pa; | ||
1393 | dst->msrpm_base_pa = from->msrpm_base_pa; | ||
1394 | dst->tsc_offset = from->tsc_offset; | ||
1395 | - dst->asid = from->asid; | ||
1396 | + /* asid not copied, it is handled manually for svm->vmcb. */ | ||
1397 | dst->tlb_ctl = from->tlb_ctl; | ||
1398 | dst->int_ctl = from->int_ctl; | ||
1399 | dst->int_vector = from->int_vector; | ||
1400 | diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c | ||
1401 | index b62886f10dc1..e7fe5974c81c 100644 | ||
1402 | --- a/arch/x86/kvm/vmx.c | ||
1403 | +++ b/arch/x86/kvm/vmx.c | ||
1404 | @@ -8207,7 +8207,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) | ||
1405 | return true; | ||
1406 | } | ||
1407 | |||
1408 | - switch (exit_reason) { | ||
1409 | + switch ((u16)exit_reason) { | ||
1410 | case EXIT_REASON_EXCEPTION_NMI: | ||
1411 | if (is_nmi(intr_info)) | ||
1412 | return false; | ||
1413 | diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c | ||
1414 | index ce092a62fc5d..bc2455c2fcab 100644 | ||
1415 | --- a/arch/x86/mm/init.c | ||
1416 | +++ b/arch/x86/mm/init.c | ||
1417 | @@ -110,8 +110,6 @@ __ref void *alloc_low_pages(unsigned int num) | ||
1418 | } else { | ||
1419 | pfn = pgt_buf_end; | ||
1420 | pgt_buf_end += num; | ||
1421 | - printk(KERN_DEBUG "BRK [%#010lx, %#010lx] PGTABLE\n", | ||
1422 | - pfn << PAGE_SHIFT, (pgt_buf_end << PAGE_SHIFT) - 1); | ||
1423 | } | ||
1424 | |||
1425 | for (i = 0; i < num; i++) { | ||
1426 | diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c | ||
1427 | index 62950ef7f84e..68e86d7cc94d 100644 | ||
1428 | --- a/arch/x86/pci/fixup.c | ||
1429 | +++ b/arch/x86/pci/fixup.c | ||
1430 | @@ -571,6 +571,10 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2fc0, pci_invalid_bar); | ||
1431 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6f60, pci_invalid_bar); | ||
1432 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_invalid_bar); | ||
1433 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_invalid_bar); | ||
1434 | +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0xa1ec, pci_invalid_bar); | ||
1435 | +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0xa1ed, pci_invalid_bar); | ||
1436 | +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0xa26c, pci_invalid_bar); | ||
1437 | +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0xa26d, pci_invalid_bar); | ||
1438 | |||
1439 | /* | ||
1440 | * Device [1022:7914] | ||
1441 | diff --git a/block/blk-mq.c b/block/blk-mq.c | ||
1442 | index 58be2eaa5aaa..e0ed7317e98c 100644 | ||
1443 | --- a/block/blk-mq.c | ||
1444 | +++ b/block/blk-mq.c | ||
1445 | @@ -2331,6 +2331,10 @@ void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues) | ||
1446 | |||
1447 | list_for_each_entry(q, &set->tag_list, tag_set_list) | ||
1448 | blk_mq_freeze_queue(q); | ||
1449 | + /* | ||
1450 | + * Sync with blk_mq_queue_tag_busy_iter. | ||
1451 | + */ | ||
1452 | + synchronize_rcu(); | ||
1453 | |||
1454 | set->nr_hw_queues = nr_hw_queues; | ||
1455 | list_for_each_entry(q, &set->tag_list, tag_set_list) { | ||
1456 | @@ -2346,10 +2350,6 @@ void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues) | ||
1457 | |||
1458 | list_for_each_entry(q, &set->tag_list, tag_set_list) | ||
1459 | blk_mq_unfreeze_queue(q); | ||
1460 | - /* | ||
1461 | - * Sync with blk_mq_queue_tag_busy_iter. | ||
1462 | - */ | ||
1463 | - synchronize_rcu(); | ||
1464 | } | ||
1465 | EXPORT_SYMBOL_GPL(blk_mq_update_nr_hw_queues); | ||
1466 | |||
1467 | diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c | ||
1468 | index 9ec4618df533..318bdfb8703c 100644 | ||
1469 | --- a/drivers/acpi/cppc_acpi.c | ||
1470 | +++ b/drivers/acpi/cppc_acpi.c | ||
1471 | @@ -793,8 +793,10 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) | ||
1472 | |||
1473 | ret = kobject_init_and_add(&cpc_ptr->kobj, &cppc_ktype, &cpu_dev->kobj, | ||
1474 | "acpi_cppc"); | ||
1475 | - if (ret) | ||
1476 | + if (ret) { | ||
1477 | + kobject_put(&cpc_ptr->kobj); | ||
1478 | goto out_free; | ||
1479 | + } | ||
1480 | |||
1481 | kfree(output.pointer); | ||
1482 | return 0; | ||
1483 | diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c | ||
1484 | index 245bcdb44c64..442aac84ab88 100644 | ||
1485 | --- a/drivers/acpi/device_pm.c | ||
1486 | +++ b/drivers/acpi/device_pm.c | ||
1487 | @@ -171,7 +171,7 @@ int acpi_device_set_power(struct acpi_device *device, int state) | ||
1488 | * possibly drop references to the power resources in use. | ||
1489 | */ | ||
1490 | state = ACPI_STATE_D3_HOT; | ||
1491 | - /* If _PR3 is not available, use D3hot as the target state. */ | ||
1492 | + /* If D3cold is not supported, use D3hot as the target state. */ | ||
1493 | if (!device->power.states[ACPI_STATE_D3_COLD].flags.valid) | ||
1494 | target_state = state; | ||
1495 | } else if (!device->power.states[state].flags.valid) { | ||
1496 | diff --git a/drivers/acpi/evged.c b/drivers/acpi/evged.c | ||
1497 | index 46f060356a22..339e6d3dba7c 100644 | ||
1498 | --- a/drivers/acpi/evged.c | ||
1499 | +++ b/drivers/acpi/evged.c | ||
1500 | @@ -82,6 +82,8 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares, | ||
1501 | struct resource r; | ||
1502 | struct acpi_resource_irq *p = &ares->data.irq; | ||
1503 | struct acpi_resource_extended_irq *pext = &ares->data.extended_irq; | ||
1504 | + char ev_name[5]; | ||
1505 | + u8 trigger; | ||
1506 | |||
1507 | if (ares->type == ACPI_RESOURCE_TYPE_END_TAG) | ||
1508 | return AE_OK; | ||
1509 | @@ -90,14 +92,28 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares, | ||
1510 | dev_err(dev, "unable to parse IRQ resource\n"); | ||
1511 | return AE_ERROR; | ||
1512 | } | ||
1513 | - if (ares->type == ACPI_RESOURCE_TYPE_IRQ) | ||
1514 | + if (ares->type == ACPI_RESOURCE_TYPE_IRQ) { | ||
1515 | gsi = p->interrupts[0]; | ||
1516 | - else | ||
1517 | + trigger = p->triggering; | ||
1518 | + } else { | ||
1519 | gsi = pext->interrupts[0]; | ||
1520 | + trigger = pext->triggering; | ||
1521 | + } | ||
1522 | |||
1523 | irq = r.start; | ||
1524 | |||
1525 | - if (ACPI_FAILURE(acpi_get_handle(handle, "_EVT", &evt_handle))) { | ||
1526 | + switch (gsi) { | ||
1527 | + case 0 ... 255: | ||
1528 | + sprintf(ev_name, "_%c%02hhX", | ||
1529 | + trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi); | ||
1530 | + | ||
1531 | + if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle))) | ||
1532 | + break; | ||
1533 | + /* fall through */ | ||
1534 | + default: | ||
1535 | + if (ACPI_SUCCESS(acpi_get_handle(handle, "_EVT", &evt_handle))) | ||
1536 | + break; | ||
1537 | + | ||
1538 | dev_err(dev, "cannot locate _EVT method\n"); | ||
1539 | return AE_ERROR; | ||
1540 | } | ||
1541 | diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c | ||
1542 | index 0792ec5a9efc..9a7f017dda47 100644 | ||
1543 | --- a/drivers/acpi/scan.c | ||
1544 | +++ b/drivers/acpi/scan.c | ||
1545 | @@ -927,12 +927,9 @@ static void acpi_bus_init_power_state(struct acpi_device *device, int state) | ||
1546 | |||
1547 | if (buffer.length && package | ||
1548 | && package->type == ACPI_TYPE_PACKAGE | ||
1549 | - && package->package.count) { | ||
1550 | - int err = acpi_extract_power_resources(package, 0, | ||
1551 | - &ps->resources); | ||
1552 | - if (!err) | ||
1553 | - device->power.flags.power_resources = 1; | ||
1554 | - } | ||
1555 | + && package->package.count) | ||
1556 | + acpi_extract_power_resources(package, 0, &ps->resources); | ||
1557 | + | ||
1558 | ACPI_FREE(buffer.pointer); | ||
1559 | } | ||
1560 | |||
1561 | @@ -979,14 +976,27 @@ static void acpi_bus_get_power_flags(struct acpi_device *device) | ||
1562 | acpi_bus_init_power_state(device, i); | ||
1563 | |||
1564 | INIT_LIST_HEAD(&device->power.states[ACPI_STATE_D3_COLD].resources); | ||
1565 | - if (!list_empty(&device->power.states[ACPI_STATE_D3_HOT].resources)) | ||
1566 | - device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1; | ||
1567 | |||
1568 | - /* Set defaults for D0 and D3hot states (always valid) */ | ||
1569 | + /* Set the defaults for D0 and D3hot (always supported). */ | ||
1570 | device->power.states[ACPI_STATE_D0].flags.valid = 1; | ||
1571 | device->power.states[ACPI_STATE_D0].power = 100; | ||
1572 | device->power.states[ACPI_STATE_D3_HOT].flags.valid = 1; | ||
1573 | |||
1574 | + /* | ||
1575 | + * Use power resources only if the D0 list of them is populated, because | ||
1576 | + * some platforms may provide _PR3 only to indicate D3cold support and | ||
1577 | + * in those cases the power resources list returned by it may be bogus. | ||
1578 | + */ | ||
1579 | + if (!list_empty(&device->power.states[ACPI_STATE_D0].resources)) { | ||
1580 | + device->power.flags.power_resources = 1; | ||
1581 | + /* | ||
1582 | + * D3cold is supported if the D3hot list of power resources is | ||
1583 | + * not empty. | ||
1584 | + */ | ||
1585 | + if (!list_empty(&device->power.states[ACPI_STATE_D3_HOT].resources)) | ||
1586 | + device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1; | ||
1587 | + } | ||
1588 | + | ||
1589 | if (acpi_bus_init_power(device)) | ||
1590 | device->flags.power_manageable = 0; | ||
1591 | } | ||
1592 | diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c | ||
1593 | index a36d0739dbfe..7502441b1400 100644 | ||
1594 | --- a/drivers/acpi/sysfs.c | ||
1595 | +++ b/drivers/acpi/sysfs.c | ||
1596 | @@ -898,8 +898,10 @@ void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug, | ||
1597 | |||
1598 | error = kobject_init_and_add(&hotplug->kobj, | ||
1599 | &acpi_hotplug_profile_ktype, hotplug_kobj, "%s", name); | ||
1600 | - if (error) | ||
1601 | + if (error) { | ||
1602 | + kobject_put(&hotplug->kobj); | ||
1603 | goto err_out; | ||
1604 | + } | ||
1605 | |||
1606 | kobject_uevent(&hotplug->kobj, KOBJ_ADD); | ||
1607 | return; | ||
1608 | diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c | ||
1609 | index a7cc5b7be598..871e7f4994e8 100644 | ||
1610 | --- a/drivers/char/agp/intel-gtt.c | ||
1611 | +++ b/drivers/char/agp/intel-gtt.c | ||
1612 | @@ -845,6 +845,7 @@ void intel_gtt_insert_page(dma_addr_t addr, | ||
1613 | unsigned int flags) | ||
1614 | { | ||
1615 | intel_private.driver->write_entry(addr, pg, flags); | ||
1616 | + readl(intel_private.gtt + pg); | ||
1617 | if (intel_private.driver->chipset_flush) | ||
1618 | intel_private.driver->chipset_flush(); | ||
1619 | } | ||
1620 | @@ -870,7 +871,7 @@ void intel_gtt_insert_sg_entries(struct sg_table *st, | ||
1621 | j++; | ||
1622 | } | ||
1623 | } | ||
1624 | - wmb(); | ||
1625 | + readl(intel_private.gtt + j - 1); | ||
1626 | if (intel_private.driver->chipset_flush) | ||
1627 | intel_private.driver->chipset_flush(); | ||
1628 | } | ||
1629 | @@ -1104,6 +1105,7 @@ static void i9xx_cleanup(void) | ||
1630 | |||
1631 | static void i9xx_chipset_flush(void) | ||
1632 | { | ||
1633 | + wmb(); | ||
1634 | if (intel_private.i9xx_flush_page) | ||
1635 | writel(1, intel_private.i9xx_flush_page); | ||
1636 | } | ||
1637 | diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c | ||
1638 | index aee6c0d39a7c..024e6cc5025b 100644 | ||
1639 | --- a/drivers/clocksource/dw_apb_timer_of.c | ||
1640 | +++ b/drivers/clocksource/dw_apb_timer_of.c | ||
1641 | @@ -146,10 +146,6 @@ static int num_called; | ||
1642 | static int __init dw_apb_timer_init(struct device_node *timer) | ||
1643 | { | ||
1644 | switch (num_called) { | ||
1645 | - case 0: | ||
1646 | - pr_debug("%s: found clockevent timer\n", __func__); | ||
1647 | - add_clockevent(timer); | ||
1648 | - break; | ||
1649 | case 1: | ||
1650 | pr_debug("%s: found clocksource timer\n", __func__); | ||
1651 | add_clocksource(timer); | ||
1652 | @@ -160,6 +156,8 @@ static int __init dw_apb_timer_init(struct device_node *timer) | ||
1653 | #endif | ||
1654 | break; | ||
1655 | default: | ||
1656 | + pr_debug("%s: found clockevent timer\n", __func__); | ||
1657 | + add_clockevent(timer); | ||
1658 | break; | ||
1659 | } | ||
1660 | |||
1661 | diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c | ||
1662 | index 9e98a5fbbc1d..e7e92ed34f0c 100644 | ||
1663 | --- a/drivers/cpuidle/sysfs.c | ||
1664 | +++ b/drivers/cpuidle/sysfs.c | ||
1665 | @@ -412,7 +412,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device) | ||
1666 | ret = kobject_init_and_add(&kobj->kobj, &ktype_state_cpuidle, | ||
1667 | &kdev->kobj, "state%d", i); | ||
1668 | if (ret) { | ||
1669 | - kfree(kobj); | ||
1670 | + kobject_put(&kobj->kobj); | ||
1671 | goto error_state; | ||
1672 | } | ||
1673 | kobject_uevent(&kobj->kobj, KOBJ_ADD); | ||
1674 | @@ -542,7 +542,7 @@ static int cpuidle_add_driver_sysfs(struct cpuidle_device *dev) | ||
1675 | ret = kobject_init_and_add(&kdrv->kobj, &ktype_driver_cpuidle, | ||
1676 | &kdev->kobj, "driver"); | ||
1677 | if (ret) { | ||
1678 | - kfree(kdrv); | ||
1679 | + kobject_put(&kdrv->kobj); | ||
1680 | return ret; | ||
1681 | } | ||
1682 | |||
1683 | @@ -636,7 +636,7 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev) | ||
1684 | error = kobject_init_and_add(&kdev->kobj, &ktype_cpuidle, &cpu_dev->kobj, | ||
1685 | "cpuidle"); | ||
1686 | if (error) { | ||
1687 | - kfree(kdev); | ||
1688 | + kobject_put(&kdev->kobj); | ||
1689 | return error; | ||
1690 | } | ||
1691 | |||
1692 | diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c | ||
1693 | index 8b383d3d21c2..059c2d4ad18f 100644 | ||
1694 | --- a/drivers/crypto/talitos.c | ||
1695 | +++ b/drivers/crypto/talitos.c | ||
1696 | @@ -2636,7 +2636,6 @@ static struct talitos_alg_template driver_algs[] = { | ||
1697 | .cra_ablkcipher = { | ||
1698 | .min_keysize = AES_MIN_KEY_SIZE, | ||
1699 | .max_keysize = AES_MAX_KEY_SIZE, | ||
1700 | - .ivsize = AES_BLOCK_SIZE, | ||
1701 | } | ||
1702 | }, | ||
1703 | .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | | ||
1704 | @@ -2670,6 +2669,7 @@ static struct talitos_alg_template driver_algs[] = { | ||
1705 | .cra_ablkcipher = { | ||
1706 | .min_keysize = AES_MIN_KEY_SIZE, | ||
1707 | .max_keysize = AES_MAX_KEY_SIZE, | ||
1708 | + .ivsize = AES_BLOCK_SIZE, | ||
1709 | .setkey = ablkcipher_aes_setkey, | ||
1710 | } | ||
1711 | }, | ||
1712 | diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c | ||
1713 | index 1c65f5ac4368..6529addd1e82 100644 | ||
1714 | --- a/drivers/firmware/efi/efivars.c | ||
1715 | +++ b/drivers/firmware/efi/efivars.c | ||
1716 | @@ -586,8 +586,10 @@ efivar_create_sysfs_entry(struct efivar_entry *new_var) | ||
1717 | ret = kobject_init_and_add(&new_var->kobj, &efivar_ktype, | ||
1718 | NULL, "%s", short_name); | ||
1719 | kfree(short_name); | ||
1720 | - if (ret) | ||
1721 | + if (ret) { | ||
1722 | + kobject_put(&new_var->kobj); | ||
1723 | return ret; | ||
1724 | + } | ||
1725 | |||
1726 | kobject_uevent(&new_var->kobj, KOBJ_ADD); | ||
1727 | if (efivar_entry_add(new_var, &efivar_sysfs_list)) { | ||
1728 | diff --git a/drivers/macintosh/windfarm_pm112.c b/drivers/macintosh/windfarm_pm112.c | ||
1729 | index 96d16fca68b2..24e7152cd2bf 100644 | ||
1730 | --- a/drivers/macintosh/windfarm_pm112.c | ||
1731 | +++ b/drivers/macintosh/windfarm_pm112.c | ||
1732 | @@ -13,6 +13,7 @@ | ||
1733 | #include <linux/device.h> | ||
1734 | #include <linux/platform_device.h> | ||
1735 | #include <linux/reboot.h> | ||
1736 | +#include <linux/slab.h> | ||
1737 | #include <asm/prom.h> | ||
1738 | #include <asm/smu.h> | ||
1739 | |||
1740 | @@ -133,14 +134,6 @@ static int create_cpu_loop(int cpu) | ||
1741 | s32 tmax; | ||
1742 | int fmin; | ||
1743 | |||
1744 | - /* Get PID params from the appropriate SAT */ | ||
1745 | - hdr = smu_sat_get_sdb_partition(chip, 0xC8 + core, NULL); | ||
1746 | - if (hdr == NULL) { | ||
1747 | - printk(KERN_WARNING"windfarm: can't get CPU PID fan config\n"); | ||
1748 | - return -EINVAL; | ||
1749 | - } | ||
1750 | - piddata = (struct smu_sdbp_cpupiddata *)&hdr[1]; | ||
1751 | - | ||
1752 | /* Get FVT params to get Tmax; if not found, assume default */ | ||
1753 | hdr = smu_sat_get_sdb_partition(chip, 0xC4 + core, NULL); | ||
1754 | if (hdr) { | ||
1755 | @@ -153,6 +146,16 @@ static int create_cpu_loop(int cpu) | ||
1756 | if (tmax < cpu_all_tmax) | ||
1757 | cpu_all_tmax = tmax; | ||
1758 | |||
1759 | + kfree(hdr); | ||
1760 | + | ||
1761 | + /* Get PID params from the appropriate SAT */ | ||
1762 | + hdr = smu_sat_get_sdb_partition(chip, 0xC8 + core, NULL); | ||
1763 | + if (hdr == NULL) { | ||
1764 | + printk(KERN_WARNING"windfarm: can't get CPU PID fan config\n"); | ||
1765 | + return -EINVAL; | ||
1766 | + } | ||
1767 | + piddata = (struct smu_sdbp_cpupiddata *)&hdr[1]; | ||
1768 | + | ||
1769 | /* | ||
1770 | * Darwin has a minimum fan speed of 1000 rpm for the 4-way and | ||
1771 | * 515 for the 2-way. That appears to be overkill, so for now, | ||
1772 | @@ -175,6 +178,9 @@ static int create_cpu_loop(int cpu) | ||
1773 | pid.min = fmin; | ||
1774 | |||
1775 | wf_cpu_pid_init(&cpu_pid[cpu], &pid); | ||
1776 | + | ||
1777 | + kfree(hdr); | ||
1778 | + | ||
1779 | return 0; | ||
1780 | } | ||
1781 | |||
1782 | diff --git a/drivers/md/md.c b/drivers/md/md.c | ||
1783 | index da8708b65356..3485d2a79600 100644 | ||
1784 | --- a/drivers/md/md.c | ||
1785 | +++ b/drivers/md/md.c | ||
1786 | @@ -7101,7 +7101,8 @@ static int md_open(struct block_device *bdev, fmode_t mode) | ||
1787 | */ | ||
1788 | mddev_put(mddev); | ||
1789 | /* Wait until bdev->bd_disk is definitely gone */ | ||
1790 | - flush_workqueue(md_misc_wq); | ||
1791 | + if (work_pending(&mddev->del_work)) | ||
1792 | + flush_workqueue(md_misc_wq); | ||
1793 | /* Then retry the open from the top */ | ||
1794 | return -ERESTARTSYS; | ||
1795 | } | ||
1796 | diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c | ||
1797 | index 2f054db8807b..372057cabea4 100644 | ||
1798 | --- a/drivers/media/dvb-core/dvb_frontend.c | ||
1799 | +++ b/drivers/media/dvb-core/dvb_frontend.c | ||
1800 | @@ -629,7 +629,7 @@ static int dvb_frontend_thread(void *data) | ||
1801 | struct dvb_frontend *fe = data; | ||
1802 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
1803 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | ||
1804 | - enum fe_status s; | ||
1805 | + enum fe_status s = FE_NONE; | ||
1806 | enum dvbfe_algo algo; | ||
1807 | bool re_tune = false; | ||
1808 | bool semheld = false; | ||
1809 | diff --git a/drivers/media/platform/rcar-fcp.c b/drivers/media/platform/rcar-fcp.c | ||
1810 | index f3a3f31cdfa9..8e9c3bd36d03 100644 | ||
1811 | --- a/drivers/media/platform/rcar-fcp.c | ||
1812 | +++ b/drivers/media/platform/rcar-fcp.c | ||
1813 | @@ -12,6 +12,7 @@ | ||
1814 | */ | ||
1815 | |||
1816 | #include <linux/device.h> | ||
1817 | +#include <linux/dma-mapping.h> | ||
1818 | #include <linux/list.h> | ||
1819 | #include <linux/module.h> | ||
1820 | #include <linux/mutex.h> | ||
1821 | @@ -24,6 +25,7 @@ | ||
1822 | struct rcar_fcp_device { | ||
1823 | struct list_head list; | ||
1824 | struct device *dev; | ||
1825 | + struct device_dma_parameters dma_parms; | ||
1826 | }; | ||
1827 | |||
1828 | static LIST_HEAD(fcp_devices); | ||
1829 | @@ -140,6 +142,9 @@ static int rcar_fcp_probe(struct platform_device *pdev) | ||
1830 | |||
1831 | fcp->dev = &pdev->dev; | ||
1832 | |||
1833 | + fcp->dev->dma_parms = &fcp->dma_parms; | ||
1834 | + dma_set_max_seg_size(fcp->dev, DMA_BIT_MASK(32)); | ||
1835 | + | ||
1836 | pm_runtime_enable(&pdev->dev); | ||
1837 | |||
1838 | mutex_lock(&fcp_lock); | ||
1839 | diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c | ||
1840 | index 57b250847cd3..72a47da0db2a 100644 | ||
1841 | --- a/drivers/media/tuners/si2157.c | ||
1842 | +++ b/drivers/media/tuners/si2157.c | ||
1843 | @@ -84,24 +84,23 @@ static int si2157_init(struct dvb_frontend *fe) | ||
1844 | struct si2157_cmd cmd; | ||
1845 | const struct firmware *fw; | ||
1846 | const char *fw_name; | ||
1847 | - unsigned int uitmp, chip_id; | ||
1848 | + unsigned int chip_id, xtal_trim; | ||
1849 | |||
1850 | dev_dbg(&client->dev, "\n"); | ||
1851 | |||
1852 | - /* Returned IF frequency is garbage when firmware is not running */ | ||
1853 | - memcpy(cmd.args, "\x15\x00\x06\x07", 4); | ||
1854 | + /* Try to get Xtal trim property, to verify tuner still running */ | ||
1855 | + memcpy(cmd.args, "\x15\x00\x04\x02", 4); | ||
1856 | cmd.wlen = 4; | ||
1857 | cmd.rlen = 4; | ||
1858 | ret = si2157_cmd_execute(client, &cmd); | ||
1859 | - if (ret) | ||
1860 | - goto err; | ||
1861 | |||
1862 | - uitmp = cmd.args[2] << 0 | cmd.args[3] << 8; | ||
1863 | - dev_dbg(&client->dev, "if_frequency kHz=%u\n", uitmp); | ||
1864 | + xtal_trim = cmd.args[2] | (cmd.args[3] << 8); | ||
1865 | |||
1866 | - if (uitmp == dev->if_frequency / 1000) | ||
1867 | + if (ret == 0 && xtal_trim < 16) | ||
1868 | goto warm; | ||
1869 | |||
1870 | + dev->if_frequency = 0; /* we no longer know current tuner state */ | ||
1871 | + | ||
1872 | /* power up */ | ||
1873 | if (dev->chiptype == SI2157_CHIPTYPE_SI2146) { | ||
1874 | memcpy(cmd.args, "\xc0\x05\x01\x00\x00\x0b\x00\x00\x01", 9); | ||
1875 | diff --git a/drivers/media/usb/dvb-usb/dibusb-mb.c b/drivers/media/usb/dvb-usb/dibusb-mb.c | ||
1876 | index a0057641cc86..c55180912c3a 100644 | ||
1877 | --- a/drivers/media/usb/dvb-usb/dibusb-mb.c | ||
1878 | +++ b/drivers/media/usb/dvb-usb/dibusb-mb.c | ||
1879 | @@ -84,7 +84,7 @@ static int dibusb_tuner_probe_and_attach(struct dvb_usb_adapter *adap) | ||
1880 | |||
1881 | if (i2c_transfer(&adap->dev->i2c_adap, msg, 2) != 2) { | ||
1882 | err("tuner i2c write failed."); | ||
1883 | - ret = -EREMOTEIO; | ||
1884 | + return -EREMOTEIO; | ||
1885 | } | ||
1886 | |||
1887 | if (adap->fe_adap[0].fe->ops.i2c_gate_ctrl) | ||
1888 | diff --git a/drivers/media/usb/go7007/snd-go7007.c b/drivers/media/usb/go7007/snd-go7007.c | ||
1889 | index 070871fb1fc4..6e1a85ff3fff 100644 | ||
1890 | --- a/drivers/media/usb/go7007/snd-go7007.c | ||
1891 | +++ b/drivers/media/usb/go7007/snd-go7007.c | ||
1892 | @@ -243,22 +243,18 @@ int go7007_snd_init(struct go7007 *go) | ||
1893 | gosnd->capturing = 0; | ||
1894 | ret = snd_card_new(go->dev, index[dev], id[dev], THIS_MODULE, 0, | ||
1895 | &gosnd->card); | ||
1896 | - if (ret < 0) { | ||
1897 | - kfree(gosnd); | ||
1898 | - return ret; | ||
1899 | - } | ||
1900 | + if (ret < 0) | ||
1901 | + goto free_snd; | ||
1902 | + | ||
1903 | ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go, | ||
1904 | &go7007_snd_device_ops); | ||
1905 | - if (ret < 0) { | ||
1906 | - kfree(gosnd); | ||
1907 | - return ret; | ||
1908 | - } | ||
1909 | + if (ret < 0) | ||
1910 | + goto free_card; | ||
1911 | + | ||
1912 | ret = snd_pcm_new(gosnd->card, "go7007", 0, 0, 1, &gosnd->pcm); | ||
1913 | - if (ret < 0) { | ||
1914 | - snd_card_free(gosnd->card); | ||
1915 | - kfree(gosnd); | ||
1916 | - return ret; | ||
1917 | - } | ||
1918 | + if (ret < 0) | ||
1919 | + goto free_card; | ||
1920 | + | ||
1921 | strlcpy(gosnd->card->driver, "go7007", sizeof(gosnd->card->driver)); | ||
1922 | strlcpy(gosnd->card->shortname, go->name, sizeof(gosnd->card->driver)); | ||
1923 | strlcpy(gosnd->card->longname, gosnd->card->shortname, | ||
1924 | @@ -269,11 +265,8 @@ int go7007_snd_init(struct go7007 *go) | ||
1925 | &go7007_snd_capture_ops); | ||
1926 | |||
1927 | ret = snd_card_register(gosnd->card); | ||
1928 | - if (ret < 0) { | ||
1929 | - snd_card_free(gosnd->card); | ||
1930 | - kfree(gosnd); | ||
1931 | - return ret; | ||
1932 | - } | ||
1933 | + if (ret < 0) | ||
1934 | + goto free_card; | ||
1935 | |||
1936 | gosnd->substream = NULL; | ||
1937 | go->snd_context = gosnd; | ||
1938 | @@ -281,6 +274,12 @@ int go7007_snd_init(struct go7007 *go) | ||
1939 | ++dev; | ||
1940 | |||
1941 | return 0; | ||
1942 | + | ||
1943 | +free_card: | ||
1944 | + snd_card_free(gosnd->card); | ||
1945 | +free_snd: | ||
1946 | + kfree(gosnd); | ||
1947 | + return ret; | ||
1948 | } | ||
1949 | EXPORT_SYMBOL(go7007_snd_init); | ||
1950 | |||
1951 | diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c | ||
1952 | index 445fc47dc3e7..b4336534f628 100644 | ||
1953 | --- a/drivers/mmc/host/sdhci-esdhc-imx.c | ||
1954 | +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | ||
1955 | @@ -79,7 +79,7 @@ | ||
1956 | #define ESDHC_STD_TUNING_EN (1 << 24) | ||
1957 | /* NOTE: the minimum valid tuning start tap for mx6sl is 1 */ | ||
1958 | #define ESDHC_TUNING_START_TAP_DEFAULT 0x1 | ||
1959 | -#define ESDHC_TUNING_START_TAP_MASK 0xff | ||
1960 | +#define ESDHC_TUNING_START_TAP_MASK 0x7f | ||
1961 | #define ESDHC_TUNING_STEP_MASK 0x00070000 | ||
1962 | #define ESDHC_TUNING_STEP_SHIFT 16 | ||
1963 | |||
1964 | diff --git a/drivers/mtd/nand/brcmnand/brcmnand.c b/drivers/mtd/nand/brcmnand/brcmnand.c | ||
1965 | index ef9a6b22c9fa..1291492a1cef 100644 | ||
1966 | --- a/drivers/mtd/nand/brcmnand/brcmnand.c | ||
1967 | +++ b/drivers/mtd/nand/brcmnand/brcmnand.c | ||
1968 | @@ -911,11 +911,14 @@ static int brcmnand_hamming_ooblayout_free(struct mtd_info *mtd, int section, | ||
1969 | if (!section) { | ||
1970 | /* | ||
1971 | * Small-page NAND use byte 6 for BBI while large-page | ||
1972 | - * NAND use byte 0. | ||
1973 | + * NAND use bytes 0 and 1. | ||
1974 | */ | ||
1975 | - if (cfg->page_size > 512) | ||
1976 | - oobregion->offset++; | ||
1977 | - oobregion->length--; | ||
1978 | + if (cfg->page_size > 512) { | ||
1979 | + oobregion->offset += 2; | ||
1980 | + oobregion->length -= 2; | ||
1981 | + } else { | ||
1982 | + oobregion->length--; | ||
1983 | + } | ||
1984 | } | ||
1985 | } | ||
1986 | |||
1987 | diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c | ||
1988 | index 5de7591b0510..80c98eef44d9 100644 | ||
1989 | --- a/drivers/mtd/nand/pasemi_nand.c | ||
1990 | +++ b/drivers/mtd/nand/pasemi_nand.c | ||
1991 | @@ -164,7 +164,7 @@ static int pasemi_nand_probe(struct platform_device *ofdev) | ||
1992 | if (mtd_device_register(pasemi_nand_mtd, NULL, 0)) { | ||
1993 | dev_err(dev, "Unable to register MTD device\n"); | ||
1994 | err = -ENODEV; | ||
1995 | - goto out_lpc; | ||
1996 | + goto out_cleanup_nand; | ||
1997 | } | ||
1998 | |||
1999 | dev_info(dev, "PA Semi NAND flash at %pR, control at I/O %x\n", &res, | ||
2000 | @@ -172,6 +172,8 @@ static int pasemi_nand_probe(struct platform_device *ofdev) | ||
2001 | |||
2002 | return 0; | ||
2003 | |||
2004 | + out_cleanup_nand: | ||
2005 | + nand_cleanup(chip); | ||
2006 | out_lpc: | ||
2007 | release_region(lpcctl, 4); | ||
2008 | out_ior: | ||
2009 | diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c | ||
2010 | index 3a75352f632b..792a1afabf5d 100644 | ||
2011 | --- a/drivers/net/can/usb/kvaser_usb.c | ||
2012 | +++ b/drivers/net/can/usb/kvaser_usb.c | ||
2013 | @@ -791,7 +791,7 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv, | ||
2014 | if (!urb) | ||
2015 | return -ENOMEM; | ||
2016 | |||
2017 | - buf = kmalloc(sizeof(struct kvaser_msg), GFP_ATOMIC); | ||
2018 | + buf = kzalloc(sizeof(struct kvaser_msg), GFP_ATOMIC); | ||
2019 | if (!buf) { | ||
2020 | usb_free_urb(urb); | ||
2021 | return -ENOMEM; | ||
2022 | @@ -1459,7 +1459,7 @@ static int kvaser_usb_set_opt_mode(const struct kvaser_usb_net_priv *priv) | ||
2023 | struct kvaser_msg *msg; | ||
2024 | int rc; | ||
2025 | |||
2026 | - msg = kmalloc(sizeof(*msg), GFP_KERNEL); | ||
2027 | + msg = kzalloc(sizeof(*msg), GFP_KERNEL); | ||
2028 | if (!msg) | ||
2029 | return -ENOMEM; | ||
2030 | |||
2031 | @@ -1592,7 +1592,7 @@ static int kvaser_usb_flush_queue(struct kvaser_usb_net_priv *priv) | ||
2032 | struct kvaser_msg *msg; | ||
2033 | int rc; | ||
2034 | |||
2035 | - msg = kmalloc(sizeof(*msg), GFP_KERNEL); | ||
2036 | + msg = kzalloc(sizeof(*msg), GFP_KERNEL); | ||
2037 | if (!msg) | ||
2038 | return -ENOMEM; | ||
2039 | |||
2040 | diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c | ||
2041 | index 6ffdff68bfc4..672a8212c8d9 100644 | ||
2042 | --- a/drivers/net/ethernet/allwinner/sun4i-emac.c | ||
2043 | +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c | ||
2044 | @@ -412,7 +412,7 @@ static void emac_timeout(struct net_device *dev) | ||
2045 | /* Hardware start transmission. | ||
2046 | * Send a packet to media from the upper layer. | ||
2047 | */ | ||
2048 | -static int emac_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
2049 | +static netdev_tx_t emac_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
2050 | { | ||
2051 | struct emac_board_info *db = netdev_priv(dev); | ||
2052 | unsigned long channel; | ||
2053 | @@ -420,7 +420,7 @@ static int emac_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
2054 | |||
2055 | channel = db->tx_fifo_stat & 3; | ||
2056 | if (channel == 3) | ||
2057 | - return 1; | ||
2058 | + return NETDEV_TX_BUSY; | ||
2059 | |||
2060 | channel = (channel == 1 ? 1 : 0); | ||
2061 | |||
2062 | diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c | ||
2063 | index 905911f78693..e95f19e573a7 100644 | ||
2064 | --- a/drivers/net/ethernet/amazon/ena/ena_com.c | ||
2065 | +++ b/drivers/net/ethernet/amazon/ena/ena_com.c | ||
2066 | @@ -2096,6 +2096,9 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev, | ||
2067 | rss->hash_key; | ||
2068 | int rc; | ||
2069 | |||
2070 | + if (unlikely(!func)) | ||
2071 | + return -EINVAL; | ||
2072 | + | ||
2073 | rc = ena_com_get_feature_ex(ena_dev, &get_resp, | ||
2074 | ENA_ADMIN_RSS_HASH_FUNCTION, | ||
2075 | rss->hash_key_dma_addr, | ||
2076 | @@ -2108,8 +2111,7 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev, | ||
2077 | if (rss->hash_func) | ||
2078 | rss->hash_func--; | ||
2079 | |||
2080 | - if (func) | ||
2081 | - *func = rss->hash_func; | ||
2082 | + *func = rss->hash_func; | ||
2083 | |||
2084 | if (key) | ||
2085 | memcpy(key, hash_key->key, (size_t)(hash_key->keys_num) << 2); | ||
2086 | diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c | ||
2087 | index 897a87ae8655..20f7ab4aa2f1 100644 | ||
2088 | --- a/drivers/net/ethernet/ibm/ibmvnic.c | ||
2089 | +++ b/drivers/net/ethernet/ibm/ibmvnic.c | ||
2090 | @@ -3362,12 +3362,10 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq, | ||
2091 | dev_err(dev, "Error %ld in VERSION_EXCHG_RSP\n", rc); | ||
2092 | break; | ||
2093 | } | ||
2094 | - dev_info(dev, "Partner protocol version is %d\n", | ||
2095 | - crq->version_exchange_rsp.version); | ||
2096 | - if (be16_to_cpu(crq->version_exchange_rsp.version) < | ||
2097 | - ibmvnic_version) | ||
2098 | - ibmvnic_version = | ||
2099 | + ibmvnic_version = | ||
2100 | be16_to_cpu(crq->version_exchange_rsp.version); | ||
2101 | + dev_info(dev, "Partner protocol version is %d\n", | ||
2102 | + ibmvnic_version); | ||
2103 | send_cap_queries(adapter); | ||
2104 | break; | ||
2105 | case QUERY_CAPABILITY_RSP: | ||
2106 | diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c | ||
2107 | index 39a09e18c1b7..3b16ee0de246 100644 | ||
2108 | --- a/drivers/net/ethernet/intel/e1000/e1000_main.c | ||
2109 | +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | ||
2110 | @@ -3167,8 +3167,9 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | ||
2111 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | ||
2112 | if (skb->data_len && hdr_len == len) { | ||
2113 | switch (hw->mac_type) { | ||
2114 | + case e1000_82544: { | ||
2115 | unsigned int pull_size; | ||
2116 | - case e1000_82544: | ||
2117 | + | ||
2118 | /* Make sure we have room to chop off 4 bytes, | ||
2119 | * and that the end alignment will work out to | ||
2120 | * this hardware's requirements | ||
2121 | @@ -3189,6 +3190,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | ||
2122 | } | ||
2123 | len = skb_headlen(skb); | ||
2124 | break; | ||
2125 | + } | ||
2126 | default: | ||
2127 | /* do nothing */ | ||
2128 | break; | ||
2129 | diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h | ||
2130 | index 879cca47b021..62675938cb59 100644 | ||
2131 | --- a/drivers/net/ethernet/intel/e1000e/e1000.h | ||
2132 | +++ b/drivers/net/ethernet/intel/e1000e/e1000.h | ||
2133 | @@ -589,7 +589,6 @@ static inline u32 __er32(struct e1000_hw *hw, unsigned long reg) | ||
2134 | |||
2135 | #define er32(reg) __er32(hw, E1000_##reg) | ||
2136 | |||
2137 | -s32 __ew32_prepare(struct e1000_hw *hw); | ||
2138 | void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val); | ||
2139 | |||
2140 | #define ew32(reg, val) __ew32(hw, E1000_##reg, (val)) | ||
2141 | diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c | ||
2142 | index a0f97c5ab6ef..be324b4761eb 100644 | ||
2143 | --- a/drivers/net/ethernet/intel/e1000e/netdev.c | ||
2144 | +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | ||
2145 | @@ -136,14 +136,12 @@ static const struct e1000_reg_info e1000_reg_info_tbl[] = { | ||
2146 | * has bit 24 set while ME is accessing MAC CSR registers, wait if it is set | ||
2147 | * and try again a number of times. | ||
2148 | **/ | ||
2149 | -s32 __ew32_prepare(struct e1000_hw *hw) | ||
2150 | +static void __ew32_prepare(struct e1000_hw *hw) | ||
2151 | { | ||
2152 | s32 i = E1000_ICH_FWSM_PCIM2PCI_COUNT; | ||
2153 | |||
2154 | while ((er32(FWSM) & E1000_ICH_FWSM_PCIM2PCI) && --i) | ||
2155 | udelay(50); | ||
2156 | - | ||
2157 | - return i; | ||
2158 | } | ||
2159 | |||
2160 | void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val) | ||
2161 | @@ -624,11 +622,11 @@ static void e1000e_update_rdt_wa(struct e1000_ring *rx_ring, unsigned int i) | ||
2162 | { | ||
2163 | struct e1000_adapter *adapter = rx_ring->adapter; | ||
2164 | struct e1000_hw *hw = &adapter->hw; | ||
2165 | - s32 ret_val = __ew32_prepare(hw); | ||
2166 | |||
2167 | + __ew32_prepare(hw); | ||
2168 | writel(i, rx_ring->tail); | ||
2169 | |||
2170 | - if (unlikely(!ret_val && (i != readl(rx_ring->tail)))) { | ||
2171 | + if (unlikely(i != readl(rx_ring->tail))) { | ||
2172 | u32 rctl = er32(RCTL); | ||
2173 | |||
2174 | ew32(RCTL, rctl & ~E1000_RCTL_EN); | ||
2175 | @@ -641,11 +639,11 @@ static void e1000e_update_tdt_wa(struct e1000_ring *tx_ring, unsigned int i) | ||
2176 | { | ||
2177 | struct e1000_adapter *adapter = tx_ring->adapter; | ||
2178 | struct e1000_hw *hw = &adapter->hw; | ||
2179 | - s32 ret_val = __ew32_prepare(hw); | ||
2180 | |||
2181 | + __ew32_prepare(hw); | ||
2182 | writel(i, tx_ring->tail); | ||
2183 | |||
2184 | - if (unlikely(!ret_val && (i != readl(tx_ring->tail)))) { | ||
2185 | + if (unlikely(i != readl(tx_ring->tail))) { | ||
2186 | u32 tctl = er32(TCTL); | ||
2187 | |||
2188 | ew32(TCTL, tctl & ~E1000_TCTL_EN); | ||
2189 | diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c | ||
2190 | index 737b664d004c..b02e262ed76a 100644 | ||
2191 | --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c | ||
2192 | +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c | ||
2193 | @@ -153,7 +153,8 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | ||
2194 | u32 status; | ||
2195 | u32 speed; | ||
2196 | |||
2197 | - status = rd32(E1000_STATUS); | ||
2198 | + status = pm_runtime_suspended(&adapter->pdev->dev) ? | ||
2199 | + 0 : rd32(E1000_STATUS); | ||
2200 | if (hw->phy.media_type == e1000_media_type_copper) { | ||
2201 | |||
2202 | ecmd->supported = (SUPPORTED_10baseT_Half | | ||
2203 | diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | ||
2204 | index 0d2baec546e1..c17135b7fca7 100644 | ||
2205 | --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | ||
2206 | +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | ||
2207 | @@ -2219,7 +2219,7 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw) | ||
2208 | } | ||
2209 | |||
2210 | /* Configure pause time (2 TCs per register) */ | ||
2211 | - reg = hw->fc.pause_time * 0x00010001; | ||
2212 | + reg = hw->fc.pause_time * 0x00010001U; | ||
2213 | for (i = 0; i < (MAX_TRAFFIC_CLASS / 2); i++) | ||
2214 | IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg); | ||
2215 | |||
2216 | diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c | ||
2217 | index 9fcaf1910633..9b98ec3dcb82 100644 | ||
2218 | --- a/drivers/net/ethernet/nxp/lpc_eth.c | ||
2219 | +++ b/drivers/net/ethernet/nxp/lpc_eth.c | ||
2220 | @@ -845,7 +845,8 @@ static int lpc_mii_init(struct netdata_local *pldat) | ||
2221 | if (mdiobus_register(pldat->mii_bus)) | ||
2222 | goto err_out_unregister_bus; | ||
2223 | |||
2224 | - if (lpc_mii_probe(pldat->ndev) != 0) | ||
2225 | + err = lpc_mii_probe(pldat->ndev); | ||
2226 | + if (err) | ||
2227 | goto err_out_unregister_bus; | ||
2228 | |||
2229 | return 0; | ||
2230 | diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c | ||
2231 | index 4f582ce929f2..9dda2dc6b5e7 100644 | ||
2232 | --- a/drivers/net/macvlan.c | ||
2233 | +++ b/drivers/net/macvlan.c | ||
2234 | @@ -421,6 +421,10 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb) | ||
2235 | int ret; | ||
2236 | rx_handler_result_t handle_res; | ||
2237 | |||
2238 | + /* Packets from dev_loopback_xmit() do not have L2 header, bail out */ | ||
2239 | + if (unlikely(skb->pkt_type == PACKET_LOOPBACK)) | ||
2240 | + return RX_HANDLER_PASS; | ||
2241 | + | ||
2242 | port = macvlan_port_get_rcu(skb->dev); | ||
2243 | if (is_multicast_ether_addr(eth->h_dest)) { | ||
2244 | unsigned int hash; | ||
2245 | diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c | ||
2246 | index aabc6ef366b4..d63b83605748 100644 | ||
2247 | --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c | ||
2248 | +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c | ||
2249 | @@ -691,6 +691,8 @@ vmxnet3_get_rss(struct net_device *netdev, u32 *p, u8 *key, u8 *hfunc) | ||
2250 | *hfunc = ETH_RSS_HASH_TOP; | ||
2251 | if (!p) | ||
2252 | return 0; | ||
2253 | + if (n > UPT1_RSS_MAX_IND_TABLE_SIZE) | ||
2254 | + return 0; | ||
2255 | while (n--) | ||
2256 | p[n] = rssConf->indTable[n]; | ||
2257 | return 0; | ||
2258 | diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c | ||
2259 | index 58ddb6c90418..b1470d30d079 100644 | ||
2260 | --- a/drivers/net/vxlan.c | ||
2261 | +++ b/drivers/net/vxlan.c | ||
2262 | @@ -1521,6 +1521,10 @@ static struct sk_buff *vxlan_na_create(struct sk_buff *request, | ||
2263 | daddr = eth_hdr(request)->h_source; | ||
2264 | ns_olen = request->len - skb_transport_offset(request) - sizeof(*ns); | ||
2265 | for (i = 0; i < ns_olen-1; i += (ns->opt[i+1]<<3)) { | ||
2266 | + if (!ns->opt[i + 1]) { | ||
2267 | + kfree_skb(reply); | ||
2268 | + return NULL; | ||
2269 | + } | ||
2270 | if (ns->opt[i] == ND_OPT_SOURCE_LL_ADDR) { | ||
2271 | daddr = ns->opt + i + sizeof(struct nd_opt_hdr); | ||
2272 | break; | ||
2273 | diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c | ||
2274 | index b5e12be73f2b..e27acccc3678 100644 | ||
2275 | --- a/drivers/net/wireless/ath/ath9k/hif_usb.c | ||
2276 | +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | ||
2277 | @@ -610,6 +610,11 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, | ||
2278 | hif_dev->remain_skb = nskb; | ||
2279 | spin_unlock(&hif_dev->rx_lock); | ||
2280 | } else { | ||
2281 | + if (pool_index == MAX_PKT_NUM_IN_TRANSFER) { | ||
2282 | + dev_err(&hif_dev->udev->dev, | ||
2283 | + "ath9k_htc: over RX MAX_PKT_NUM\n"); | ||
2284 | + goto err; | ||
2285 | + } | ||
2286 | nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); | ||
2287 | if (!nskb) { | ||
2288 | dev_err(&hif_dev->udev->dev, | ||
2289 | @@ -636,9 +641,9 @@ err: | ||
2290 | |||
2291 | static void ath9k_hif_usb_rx_cb(struct urb *urb) | ||
2292 | { | ||
2293 | - struct sk_buff *skb = (struct sk_buff *) urb->context; | ||
2294 | - struct hif_device_usb *hif_dev = | ||
2295 | - usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); | ||
2296 | + struct rx_buf *rx_buf = (struct rx_buf *)urb->context; | ||
2297 | + struct hif_device_usb *hif_dev = rx_buf->hif_dev; | ||
2298 | + struct sk_buff *skb = rx_buf->skb; | ||
2299 | int ret; | ||
2300 | |||
2301 | if (!skb) | ||
2302 | @@ -678,14 +683,15 @@ resubmit: | ||
2303 | return; | ||
2304 | free: | ||
2305 | kfree_skb(skb); | ||
2306 | + kfree(rx_buf); | ||
2307 | } | ||
2308 | |||
2309 | static void ath9k_hif_usb_reg_in_cb(struct urb *urb) | ||
2310 | { | ||
2311 | - struct sk_buff *skb = (struct sk_buff *) urb->context; | ||
2312 | + struct rx_buf *rx_buf = (struct rx_buf *)urb->context; | ||
2313 | + struct hif_device_usb *hif_dev = rx_buf->hif_dev; | ||
2314 | + struct sk_buff *skb = rx_buf->skb; | ||
2315 | struct sk_buff *nskb; | ||
2316 | - struct hif_device_usb *hif_dev = | ||
2317 | - usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); | ||
2318 | int ret; | ||
2319 | |||
2320 | if (!skb) | ||
2321 | @@ -743,6 +749,7 @@ resubmit: | ||
2322 | return; | ||
2323 | free: | ||
2324 | kfree_skb(skb); | ||
2325 | + kfree(rx_buf); | ||
2326 | urb->context = NULL; | ||
2327 | } | ||
2328 | |||
2329 | @@ -788,7 +795,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev) | ||
2330 | init_usb_anchor(&hif_dev->mgmt_submitted); | ||
2331 | |||
2332 | for (i = 0; i < MAX_TX_URB_NUM; i++) { | ||
2333 | - tx_buf = kzalloc(sizeof(struct tx_buf), GFP_KERNEL); | ||
2334 | + tx_buf = kzalloc(sizeof(*tx_buf), GFP_KERNEL); | ||
2335 | if (!tx_buf) | ||
2336 | goto err; | ||
2337 | |||
2338 | @@ -825,8 +832,9 @@ static void ath9k_hif_usb_dealloc_rx_urbs(struct hif_device_usb *hif_dev) | ||
2339 | |||
2340 | static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) | ||
2341 | { | ||
2342 | - struct urb *urb = NULL; | ||
2343 | + struct rx_buf *rx_buf = NULL; | ||
2344 | struct sk_buff *skb = NULL; | ||
2345 | + struct urb *urb = NULL; | ||
2346 | int i, ret; | ||
2347 | |||
2348 | init_usb_anchor(&hif_dev->rx_submitted); | ||
2349 | @@ -834,6 +842,12 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) | ||
2350 | |||
2351 | for (i = 0; i < MAX_RX_URB_NUM; i++) { | ||
2352 | |||
2353 | + rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL); | ||
2354 | + if (!rx_buf) { | ||
2355 | + ret = -ENOMEM; | ||
2356 | + goto err_rxb; | ||
2357 | + } | ||
2358 | + | ||
2359 | /* Allocate URB */ | ||
2360 | urb = usb_alloc_urb(0, GFP_KERNEL); | ||
2361 | if (urb == NULL) { | ||
2362 | @@ -848,11 +862,14 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) | ||
2363 | goto err_skb; | ||
2364 | } | ||
2365 | |||
2366 | + rx_buf->hif_dev = hif_dev; | ||
2367 | + rx_buf->skb = skb; | ||
2368 | + | ||
2369 | usb_fill_bulk_urb(urb, hif_dev->udev, | ||
2370 | usb_rcvbulkpipe(hif_dev->udev, | ||
2371 | USB_WLAN_RX_PIPE), | ||
2372 | skb->data, MAX_RX_BUF_SIZE, | ||
2373 | - ath9k_hif_usb_rx_cb, skb); | ||
2374 | + ath9k_hif_usb_rx_cb, rx_buf); | ||
2375 | |||
2376 | /* Anchor URB */ | ||
2377 | usb_anchor_urb(urb, &hif_dev->rx_submitted); | ||
2378 | @@ -878,6 +895,8 @@ err_submit: | ||
2379 | err_skb: | ||
2380 | usb_free_urb(urb); | ||
2381 | err_urb: | ||
2382 | + kfree(rx_buf); | ||
2383 | +err_rxb: | ||
2384 | ath9k_hif_usb_dealloc_rx_urbs(hif_dev); | ||
2385 | return ret; | ||
2386 | } | ||
2387 | @@ -889,14 +908,21 @@ static void ath9k_hif_usb_dealloc_reg_in_urbs(struct hif_device_usb *hif_dev) | ||
2388 | |||
2389 | static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) | ||
2390 | { | ||
2391 | - struct urb *urb = NULL; | ||
2392 | + struct rx_buf *rx_buf = NULL; | ||
2393 | struct sk_buff *skb = NULL; | ||
2394 | + struct urb *urb = NULL; | ||
2395 | int i, ret; | ||
2396 | |||
2397 | init_usb_anchor(&hif_dev->reg_in_submitted); | ||
2398 | |||
2399 | for (i = 0; i < MAX_REG_IN_URB_NUM; i++) { | ||
2400 | |||
2401 | + rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL); | ||
2402 | + if (!rx_buf) { | ||
2403 | + ret = -ENOMEM; | ||
2404 | + goto err_rxb; | ||
2405 | + } | ||
2406 | + | ||
2407 | /* Allocate URB */ | ||
2408 | urb = usb_alloc_urb(0, GFP_KERNEL); | ||
2409 | if (urb == NULL) { | ||
2410 | @@ -911,11 +937,14 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) | ||
2411 | goto err_skb; | ||
2412 | } | ||
2413 | |||
2414 | + rx_buf->hif_dev = hif_dev; | ||
2415 | + rx_buf->skb = skb; | ||
2416 | + | ||
2417 | usb_fill_int_urb(urb, hif_dev->udev, | ||
2418 | usb_rcvintpipe(hif_dev->udev, | ||
2419 | USB_REG_IN_PIPE), | ||
2420 | skb->data, MAX_REG_IN_BUF_SIZE, | ||
2421 | - ath9k_hif_usb_reg_in_cb, skb, 1); | ||
2422 | + ath9k_hif_usb_reg_in_cb, rx_buf, 1); | ||
2423 | |||
2424 | /* Anchor URB */ | ||
2425 | usb_anchor_urb(urb, &hif_dev->reg_in_submitted); | ||
2426 | @@ -941,6 +970,8 @@ err_submit: | ||
2427 | err_skb: | ||
2428 | usb_free_urb(urb); | ||
2429 | err_urb: | ||
2430 | + kfree(rx_buf); | ||
2431 | +err_rxb: | ||
2432 | ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev); | ||
2433 | return ret; | ||
2434 | } | ||
2435 | @@ -971,7 +1002,7 @@ err: | ||
2436 | return -ENOMEM; | ||
2437 | } | ||
2438 | |||
2439 | -static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev) | ||
2440 | +void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev) | ||
2441 | { | ||
2442 | usb_kill_anchored_urbs(&hif_dev->regout_submitted); | ||
2443 | ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev); | ||
2444 | @@ -1338,8 +1369,9 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface) | ||
2445 | |||
2446 | if (hif_dev->flags & HIF_USB_READY) { | ||
2447 | ath9k_htc_hw_deinit(hif_dev->htc_handle, unplugged); | ||
2448 | - ath9k_htc_hw_free(hif_dev->htc_handle); | ||
2449 | ath9k_hif_usb_dev_deinit(hif_dev); | ||
2450 | + ath9k_destoy_wmi(hif_dev->htc_handle->drv_priv); | ||
2451 | + ath9k_htc_hw_free(hif_dev->htc_handle); | ||
2452 | } | ||
2453 | |||
2454 | usb_set_intfdata(interface, NULL); | ||
2455 | diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h | ||
2456 | index 7c2ef7ecd98b..835264c36595 100644 | ||
2457 | --- a/drivers/net/wireless/ath/ath9k/hif_usb.h | ||
2458 | +++ b/drivers/net/wireless/ath/ath9k/hif_usb.h | ||
2459 | @@ -84,6 +84,11 @@ struct tx_buf { | ||
2460 | struct list_head list; | ||
2461 | }; | ||
2462 | |||
2463 | +struct rx_buf { | ||
2464 | + struct sk_buff *skb; | ||
2465 | + struct hif_device_usb *hif_dev; | ||
2466 | +}; | ||
2467 | + | ||
2468 | #define HIF_USB_TX_STOP BIT(0) | ||
2469 | #define HIF_USB_TX_FLUSH BIT(1) | ||
2470 | |||
2471 | @@ -131,5 +136,6 @@ struct hif_device_usb { | ||
2472 | |||
2473 | int ath9k_hif_usb_init(void); | ||
2474 | void ath9k_hif_usb_exit(void); | ||
2475 | +void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev); | ||
2476 | |||
2477 | #endif /* HTC_USB_H */ | ||
2478 | diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | ||
2479 | index b65c1b661ade..15a0036dcc6e 100644 | ||
2480 | --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c | ||
2481 | +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | ||
2482 | @@ -931,8 +931,9 @@ err_init: | ||
2483 | int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, | ||
2484 | u16 devid, char *product, u32 drv_info) | ||
2485 | { | ||
2486 | - struct ieee80211_hw *hw; | ||
2487 | + struct hif_device_usb *hif_dev; | ||
2488 | struct ath9k_htc_priv *priv; | ||
2489 | + struct ieee80211_hw *hw; | ||
2490 | int ret; | ||
2491 | |||
2492 | hw = ieee80211_alloc_hw(sizeof(struct ath9k_htc_priv), &ath9k_htc_ops); | ||
2493 | @@ -967,7 +968,10 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, | ||
2494 | return 0; | ||
2495 | |||
2496 | err_init: | ||
2497 | - ath9k_deinit_wmi(priv); | ||
2498 | + ath9k_stop_wmi(priv); | ||
2499 | + hif_dev = (struct hif_device_usb *)htc_handle->hif_dev; | ||
2500 | + ath9k_hif_usb_dealloc_urbs(hif_dev); | ||
2501 | + ath9k_destoy_wmi(priv); | ||
2502 | err_free: | ||
2503 | ieee80211_free_hw(hw); | ||
2504 | return ret; | ||
2505 | @@ -982,7 +986,7 @@ void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug) | ||
2506 | htc_handle->drv_priv->ah->ah_flags |= AH_UNPLUGGED; | ||
2507 | |||
2508 | ath9k_deinit_device(htc_handle->drv_priv); | ||
2509 | - ath9k_deinit_wmi(htc_handle->drv_priv); | ||
2510 | + ath9k_stop_wmi(htc_handle->drv_priv); | ||
2511 | ieee80211_free_hw(htc_handle->drv_priv->hw); | ||
2512 | } | ||
2513 | } | ||
2514 | diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | ||
2515 | index 52b42ecee621..2eb169b204f8 100644 | ||
2516 | --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | ||
2517 | +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | ||
2518 | @@ -998,9 +998,9 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | ||
2519 | * which are not PHY_ERROR (short radar pulses have a length of 3) | ||
2520 | */ | ||
2521 | if (unlikely(!rs_datalen || (rs_datalen < 10 && !is_phyerr))) { | ||
2522 | - ath_warn(common, | ||
2523 | - "Short RX data len, dropping (dlen: %d)\n", | ||
2524 | - rs_datalen); | ||
2525 | + ath_dbg(common, ANY, | ||
2526 | + "Short RX data len, dropping (dlen: %d)\n", | ||
2527 | + rs_datalen); | ||
2528 | goto rx_next; | ||
2529 | } | ||
2530 | |||
2531 | diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c | ||
2532 | index fd85f996c554..257b6ee51e54 100644 | ||
2533 | --- a/drivers/net/wireless/ath/ath9k/htc_hst.c | ||
2534 | +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c | ||
2535 | @@ -114,6 +114,9 @@ static void htc_process_conn_rsp(struct htc_target *target, | ||
2536 | |||
2537 | if (svc_rspmsg->status == HTC_SERVICE_SUCCESS) { | ||
2538 | epid = svc_rspmsg->endpoint_id; | ||
2539 | + if (epid < 0 || epid >= ENDPOINT_MAX) | ||
2540 | + return; | ||
2541 | + | ||
2542 | service_id = be16_to_cpu(svc_rspmsg->service_id); | ||
2543 | max_msglen = be16_to_cpu(svc_rspmsg->max_msg_len); | ||
2544 | endpoint = &target->endpoint[epid]; | ||
2545 | diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c | ||
2546 | index 9c16e2a6d185..8f14897ae5a3 100644 | ||
2547 | --- a/drivers/net/wireless/ath/ath9k/wmi.c | ||
2548 | +++ b/drivers/net/wireless/ath/ath9k/wmi.c | ||
2549 | @@ -112,14 +112,17 @@ struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv) | ||
2550 | return wmi; | ||
2551 | } | ||
2552 | |||
2553 | -void ath9k_deinit_wmi(struct ath9k_htc_priv *priv) | ||
2554 | +void ath9k_stop_wmi(struct ath9k_htc_priv *priv) | ||
2555 | { | ||
2556 | struct wmi *wmi = priv->wmi; | ||
2557 | |||
2558 | mutex_lock(&wmi->op_mutex); | ||
2559 | wmi->stopped = true; | ||
2560 | mutex_unlock(&wmi->op_mutex); | ||
2561 | +} | ||
2562 | |||
2563 | +void ath9k_destoy_wmi(struct ath9k_htc_priv *priv) | ||
2564 | +{ | ||
2565 | kfree(priv->wmi); | ||
2566 | } | ||
2567 | |||
2568 | diff --git a/drivers/net/wireless/ath/ath9k/wmi.h b/drivers/net/wireless/ath/ath9k/wmi.h | ||
2569 | index 380175d5ecd7..d8b912206232 100644 | ||
2570 | --- a/drivers/net/wireless/ath/ath9k/wmi.h | ||
2571 | +++ b/drivers/net/wireless/ath/ath9k/wmi.h | ||
2572 | @@ -179,7 +179,6 @@ struct wmi { | ||
2573 | }; | ||
2574 | |||
2575 | struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv); | ||
2576 | -void ath9k_deinit_wmi(struct ath9k_htc_priv *priv); | ||
2577 | int ath9k_wmi_connect(struct htc_target *htc, struct wmi *wmi, | ||
2578 | enum htc_endpoint_id *wmi_ctrl_epid); | ||
2579 | int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, | ||
2580 | @@ -189,6 +188,8 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, | ||
2581 | void ath9k_wmi_event_tasklet(unsigned long data); | ||
2582 | void ath9k_fatal_work(struct work_struct *work); | ||
2583 | void ath9k_wmi_event_drain(struct ath9k_htc_priv *priv); | ||
2584 | +void ath9k_stop_wmi(struct ath9k_htc_priv *priv); | ||
2585 | +void ath9k_destoy_wmi(struct ath9k_htc_priv *priv); | ||
2586 | |||
2587 | #define WMI_CMD(_wmi_cmd) \ | ||
2588 | do { \ | ||
2589 | diff --git a/drivers/net/wireless/ath/carl9170/fw.c b/drivers/net/wireless/ath/carl9170/fw.c | ||
2590 | index 88045f93a76c..62ed0977f32c 100644 | ||
2591 | --- a/drivers/net/wireless/ath/carl9170/fw.c | ||
2592 | +++ b/drivers/net/wireless/ath/carl9170/fw.c | ||
2593 | @@ -351,9 +351,7 @@ static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len) | ||
2594 | ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); | ||
2595 | |||
2596 | if (SUPP(CARL9170FW_WLANTX_CAB)) { | ||
2597 | - if_comb_types |= | ||
2598 | - BIT(NL80211_IFTYPE_AP) | | ||
2599 | - BIT(NL80211_IFTYPE_P2P_GO); | ||
2600 | + if_comb_types |= BIT(NL80211_IFTYPE_AP); | ||
2601 | |||
2602 | #ifdef CONFIG_MAC80211_MESH | ||
2603 | if_comb_types |= | ||
2604 | diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c | ||
2605 | index ffb22a04beeb..202f421e0e37 100644 | ||
2606 | --- a/drivers/net/wireless/ath/carl9170/main.c | ||
2607 | +++ b/drivers/net/wireless/ath/carl9170/main.c | ||
2608 | @@ -582,11 +582,10 @@ static int carl9170_init_interface(struct ar9170 *ar, | ||
2609 | ar->disable_offload |= ((vif->type != NL80211_IFTYPE_STATION) && | ||
2610 | (vif->type != NL80211_IFTYPE_AP)); | ||
2611 | |||
2612 | - /* While the driver supports HW offload in a single | ||
2613 | - * P2P client configuration, it doesn't support HW | ||
2614 | - * offload in the favourit, concurrent P2P GO+CLIENT | ||
2615 | - * configuration. Hence, HW offload will always be | ||
2616 | - * disabled for P2P. | ||
2617 | + /* The driver used to have P2P GO+CLIENT support, | ||
2618 | + * but since this was dropped and we don't know if | ||
2619 | + * there are any gremlins lurking in the shadows, | ||
2620 | + * so best we keep HW offload disabled for P2P. | ||
2621 | */ | ||
2622 | ar->disable_offload |= vif->p2p; | ||
2623 | |||
2624 | @@ -639,18 +638,6 @@ static int carl9170_op_add_interface(struct ieee80211_hw *hw, | ||
2625 | if (vif->type == NL80211_IFTYPE_STATION) | ||
2626 | break; | ||
2627 | |||
2628 | - /* P2P GO [master] use-case | ||
2629 | - * Because the P2P GO station is selected dynamically | ||
2630 | - * by all participating peers of a WIFI Direct network, | ||
2631 | - * the driver has be able to change the main interface | ||
2632 | - * operating mode on the fly. | ||
2633 | - */ | ||
2634 | - if (main_vif->p2p && vif->p2p && | ||
2635 | - vif->type == NL80211_IFTYPE_AP) { | ||
2636 | - old_main = main_vif; | ||
2637 | - break; | ||
2638 | - } | ||
2639 | - | ||
2640 | err = -EBUSY; | ||
2641 | rcu_read_unlock(); | ||
2642 | |||
2643 | diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireless/broadcom/b43/main.c | ||
2644 | index a635fc6b1722..e57a50cc1d87 100644 | ||
2645 | --- a/drivers/net/wireless/broadcom/b43/main.c | ||
2646 | +++ b/drivers/net/wireless/broadcom/b43/main.c | ||
2647 | @@ -5596,7 +5596,7 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) | ||
2648 | /* fill hw info */ | ||
2649 | ieee80211_hw_set(hw, RX_INCLUDES_FCS); | ||
2650 | ieee80211_hw_set(hw, SIGNAL_DBM); | ||
2651 | - | ||
2652 | + ieee80211_hw_set(hw, MFP_CAPABLE); | ||
2653 | hw->wiphy->interface_modes = | ||
2654 | BIT(NL80211_IFTYPE_AP) | | ||
2655 | BIT(NL80211_IFTYPE_MESH_POINT) | | ||
2656 | diff --git a/drivers/net/wireless/broadcom/b43legacy/main.c b/drivers/net/wireless/broadcom/b43legacy/main.c | ||
2657 | index 9da8bd792702..fe658a9b53cb 100644 | ||
2658 | --- a/drivers/net/wireless/broadcom/b43legacy/main.c | ||
2659 | +++ b/drivers/net/wireless/broadcom/b43legacy/main.c | ||
2660 | @@ -3835,6 +3835,7 @@ static int b43legacy_wireless_init(struct ssb_device *dev) | ||
2661 | /* fill hw info */ | ||
2662 | ieee80211_hw_set(hw, RX_INCLUDES_FCS); | ||
2663 | ieee80211_hw_set(hw, SIGNAL_DBM); | ||
2664 | + ieee80211_hw_set(hw, MFP_CAPABLE); /* Allow WPA3 in software */ | ||
2665 | |||
2666 | hw->wiphy->interface_modes = | ||
2667 | BIT(NL80211_IFTYPE_AP) | | ||
2668 | diff --git a/drivers/net/wireless/broadcom/b43legacy/xmit.c b/drivers/net/wireless/broadcom/b43legacy/xmit.c | ||
2669 | index 35ccf400b02c..87045e30e585 100644 | ||
2670 | --- a/drivers/net/wireless/broadcom/b43legacy/xmit.c | ||
2671 | +++ b/drivers/net/wireless/broadcom/b43legacy/xmit.c | ||
2672 | @@ -571,6 +571,7 @@ void b43legacy_rx(struct b43legacy_wldev *dev, | ||
2673 | default: | ||
2674 | b43legacywarn(dev->wl, "Unexpected value for chanstat (0x%X)\n", | ||
2675 | chanstat); | ||
2676 | + goto drop; | ||
2677 | } | ||
2678 | |||
2679 | memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); | ||
2680 | diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c | ||
2681 | index 94901b0041ce..c597af69f48f 100644 | ||
2682 | --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c | ||
2683 | +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c | ||
2684 | @@ -1446,7 +1446,8 @@ mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev, | ||
2685 | int idx, u8 *mac, struct station_info *sinfo) | ||
2686 | { | ||
2687 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | ||
2688 | - static struct mwifiex_sta_node *node; | ||
2689 | + struct mwifiex_sta_node *node; | ||
2690 | + int i; | ||
2691 | |||
2692 | if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) && | ||
2693 | priv->media_connected && idx == 0) { | ||
2694 | @@ -1456,13 +1457,10 @@ mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev, | ||
2695 | mwifiex_send_cmd(priv, HOST_CMD_APCMD_STA_LIST, | ||
2696 | HostCmd_ACT_GEN_GET, 0, NULL, true); | ||
2697 | |||
2698 | - if (node && (&node->list == &priv->sta_list)) { | ||
2699 | - node = NULL; | ||
2700 | - return -ENOENT; | ||
2701 | - } | ||
2702 | - | ||
2703 | - node = list_prepare_entry(node, &priv->sta_list, list); | ||
2704 | - list_for_each_entry_continue(node, &priv->sta_list, list) { | ||
2705 | + i = 0; | ||
2706 | + list_for_each_entry(node, &priv->sta_list, list) { | ||
2707 | + if (i++ != idx) | ||
2708 | + continue; | ||
2709 | ether_addr_copy(mac, node->mac_addr); | ||
2710 | return mwifiex_dump_station_info(priv, node, sinfo); | ||
2711 | } | ||
2712 | diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c | ||
2713 | index 1f02461de261..93b22a5b6878 100644 | ||
2714 | --- a/drivers/net/wireless/realtek/rtlwifi/usb.c | ||
2715 | +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c | ||
2716 | @@ -927,10 +927,8 @@ static struct urb *_rtl_usb_tx_urb_setup(struct ieee80211_hw *hw, | ||
2717 | |||
2718 | WARN_ON(NULL == skb); | ||
2719 | _urb = usb_alloc_urb(0, GFP_ATOMIC); | ||
2720 | - if (!_urb) { | ||
2721 | - kfree_skb(skb); | ||
2722 | + if (!_urb) | ||
2723 | return NULL; | ||
2724 | - } | ||
2725 | _rtl_install_trx_info(rtlusb, skb, ep_num); | ||
2726 | usb_fill_bulk_urb(_urb, rtlusb->udev, usb_sndbulkpipe(rtlusb->udev, | ||
2727 | ep_num), skb->data, skb->len, _rtl_tx_complete, skb); | ||
2728 | @@ -945,7 +943,6 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb, | ||
2729 | struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); | ||
2730 | u32 ep_num; | ||
2731 | struct urb *_urb = NULL; | ||
2732 | - struct sk_buff *_skb = NULL; | ||
2733 | |||
2734 | WARN_ON(NULL == rtlusb->usb_tx_aggregate_hdl); | ||
2735 | if (unlikely(IS_USB_STOP(rtlusb))) { | ||
2736 | @@ -955,8 +952,7 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb, | ||
2737 | return; | ||
2738 | } | ||
2739 | ep_num = rtlusb->ep_map.ep_mapping[qnum]; | ||
2740 | - _skb = skb; | ||
2741 | - _urb = _rtl_usb_tx_urb_setup(hw, _skb, ep_num); | ||
2742 | + _urb = _rtl_usb_tx_urb_setup(hw, skb, ep_num); | ||
2743 | if (unlikely(!_urb)) { | ||
2744 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
2745 | "Can't allocate urb. Drop skb!\n"); | ||
2746 | diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c | ||
2747 | index 16611cf3aba4..19658873b4c1 100644 | ||
2748 | --- a/drivers/pci/probe.c | ||
2749 | +++ b/drivers/pci/probe.c | ||
2750 | @@ -1251,7 +1251,7 @@ int pci_setup_device(struct pci_dev *dev) | ||
2751 | /* device class may be changed after fixup */ | ||
2752 | class = dev->class >> 8; | ||
2753 | |||
2754 | - if (dev->non_compliant_bars) { | ||
2755 | + if (dev->non_compliant_bars && !dev->mmio_always_on) { | ||
2756 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
2757 | if (cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { | ||
2758 | dev_info(&dev->dev, "device has non-compliant BARs; disabling IO/MEM decoding\n"); | ||
2759 | @@ -1360,13 +1360,33 @@ static void pci_configure_mps(struct pci_dev *dev) | ||
2760 | struct pci_dev *bridge = pci_upstream_bridge(dev); | ||
2761 | int mps, p_mps, rc; | ||
2762 | |||
2763 | - if (!pci_is_pcie(dev) || !bridge || !pci_is_pcie(bridge)) | ||
2764 | + if (!pci_is_pcie(dev)) | ||
2765 | return; | ||
2766 | |||
2767 | /* MPS and MRRS fields are of type 'RsvdP' for VFs, short-circuit out */ | ||
2768 | if (dev->is_virtfn) | ||
2769 | return; | ||
2770 | |||
2771 | + /* | ||
2772 | + * For Root Complex Integrated Endpoints, program the maximum | ||
2773 | + * supported value unless limited by the PCIE_BUS_PEER2PEER case. | ||
2774 | + */ | ||
2775 | + if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_END) { | ||
2776 | + if (pcie_bus_config == PCIE_BUS_PEER2PEER) | ||
2777 | + mps = 128; | ||
2778 | + else | ||
2779 | + mps = 128 << dev->pcie_mpss; | ||
2780 | + rc = pcie_set_mps(dev, mps); | ||
2781 | + if (rc) { | ||
2782 | + pci_warn(dev, "can't set Max Payload Size to %d; if necessary, use \"pci=pcie_bus_safe\" and report a bug\n", | ||
2783 | + mps); | ||
2784 | + } | ||
2785 | + return; | ||
2786 | + } | ||
2787 | + | ||
2788 | + if (!bridge || !pci_is_pcie(bridge)) | ||
2789 | + return; | ||
2790 | + | ||
2791 | mps = pcie_get_mps(dev); | ||
2792 | p_mps = pcie_get_mps(bridge); | ||
2793 | |||
2794 | diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c | ||
2795 | index e8aee6d88a40..6a23136bc813 100644 | ||
2796 | --- a/drivers/pinctrl/samsung/pinctrl-exynos.c | ||
2797 | +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c | ||
2798 | @@ -289,6 +289,7 @@ struct exynos_eint_gpio_save { | ||
2799 | u32 eint_con; | ||
2800 | u32 eint_fltcon0; | ||
2801 | u32 eint_fltcon1; | ||
2802 | + u32 eint_mask; | ||
2803 | }; | ||
2804 | |||
2805 | /* | ||
2806 | @@ -585,10 +586,13 @@ static void exynos_pinctrl_suspend_bank( | ||
2807 | + 2 * bank->eint_offset); | ||
2808 | save->eint_fltcon1 = readl(regs + EXYNOS_GPIO_EFLTCON_OFFSET | ||
2809 | + 2 * bank->eint_offset + 4); | ||
2810 | + save->eint_mask = readl(regs + bank->irq_chip->eint_mask | ||
2811 | + + bank->eint_offset); | ||
2812 | |||
2813 | pr_debug("%s: save con %#010x\n", bank->name, save->eint_con); | ||
2814 | pr_debug("%s: save fltcon0 %#010x\n", bank->name, save->eint_fltcon0); | ||
2815 | pr_debug("%s: save fltcon1 %#010x\n", bank->name, save->eint_fltcon1); | ||
2816 | + pr_debug("%s: save mask %#010x\n", bank->name, save->eint_mask); | ||
2817 | } | ||
2818 | |||
2819 | static void exynos_pinctrl_suspend(struct samsung_pinctrl_drv_data *drvdata) | ||
2820 | @@ -617,6 +621,9 @@ static void exynos_pinctrl_resume_bank( | ||
2821 | pr_debug("%s: fltcon1 %#010x => %#010x\n", bank->name, | ||
2822 | readl(regs + EXYNOS_GPIO_EFLTCON_OFFSET | ||
2823 | + 2 * bank->eint_offset + 4), save->eint_fltcon1); | ||
2824 | + pr_debug("%s: mask %#010x => %#010x\n", bank->name, | ||
2825 | + readl(regs + bank->irq_chip->eint_mask | ||
2826 | + + bank->eint_offset), save->eint_mask); | ||
2827 | |||
2828 | writel(save->eint_con, regs + EXYNOS_GPIO_ECON_OFFSET | ||
2829 | + bank->eint_offset); | ||
2830 | @@ -624,6 +631,8 @@ static void exynos_pinctrl_resume_bank( | ||
2831 | + 2 * bank->eint_offset); | ||
2832 | writel(save->eint_fltcon1, regs + EXYNOS_GPIO_EFLTCON_OFFSET | ||
2833 | + 2 * bank->eint_offset + 4); | ||
2834 | + writel(save->eint_mask, regs + bank->irq_chip->eint_mask | ||
2835 | + + bank->eint_offset); | ||
2836 | } | ||
2837 | |||
2838 | static void exynos_pinctrl_resume(struct samsung_pinctrl_drv_data *drvdata) | ||
2839 | diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c | ||
2840 | index e9e749f87517..8fb43c4438e6 100644 | ||
2841 | --- a/drivers/power/reset/vexpress-poweroff.c | ||
2842 | +++ b/drivers/power/reset/vexpress-poweroff.c | ||
2843 | @@ -150,6 +150,7 @@ static struct platform_driver vexpress_reset_driver = { | ||
2844 | .driver = { | ||
2845 | .name = "vexpress-reset", | ||
2846 | .of_match_table = vexpress_reset_of_match, | ||
2847 | + .suppress_bind_attrs = true, | ||
2848 | }, | ||
2849 | }; | ||
2850 | |||
2851 | diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c | ||
2852 | index c7b770075caa..80341863caa5 100644 | ||
2853 | --- a/drivers/scsi/scsi_lib.c | ||
2854 | +++ b/drivers/scsi/scsi_lib.c | ||
2855 | @@ -1029,10 +1029,10 @@ int scsi_init_io(struct scsi_cmnd *cmd) | ||
2856 | struct scsi_device *sdev = cmd->device; | ||
2857 | struct request *rq = cmd->request; | ||
2858 | bool is_mq = (rq->mq_ctx != NULL); | ||
2859 | - int error; | ||
2860 | + int error = BLKPREP_KILL; | ||
2861 | |||
2862 | if (WARN_ON_ONCE(!rq->nr_phys_segments)) | ||
2863 | - return -EINVAL; | ||
2864 | + goto err_exit; | ||
2865 | |||
2866 | error = scsi_init_sgtable(rq, &cmd->sdb); | ||
2867 | if (error) | ||
2868 | diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c | ||
2869 | index 63231760facc..1906b2319e5b 100644 | ||
2870 | --- a/drivers/spi/spi-bcm-qspi.c | ||
2871 | +++ b/drivers/spi/spi-bcm-qspi.c | ||
2872 | @@ -698,7 +698,7 @@ static void read_from_hw(struct bcm_qspi *qspi, int slots) | ||
2873 | if (buf) | ||
2874 | buf[tp.byte] = read_rxram_slot_u8(qspi, slot); | ||
2875 | dev_dbg(&qspi->pdev->dev, "RD %02x\n", | ||
2876 | - buf ? buf[tp.byte] : 0xff); | ||
2877 | + buf ? buf[tp.byte] : 0x0); | ||
2878 | } else { | ||
2879 | u16 *buf = tp.trans->rx_buf; | ||
2880 | |||
2881 | @@ -706,7 +706,7 @@ static void read_from_hw(struct bcm_qspi *qspi, int slots) | ||
2882 | buf[tp.byte / 2] = read_rxram_slot_u16(qspi, | ||
2883 | slot); | ||
2884 | dev_dbg(&qspi->pdev->dev, "RD %04x\n", | ||
2885 | - buf ? buf[tp.byte] : 0xffff); | ||
2886 | + buf ? buf[tp.byte / 2] : 0x0); | ||
2887 | } | ||
2888 | |||
2889 | update_qspi_trans_byte_count(qspi, &tp, | ||
2890 | @@ -761,13 +761,13 @@ static int write_to_hw(struct bcm_qspi *qspi, struct spi_device *spi) | ||
2891 | while (!tstatus && slot < MSPI_NUM_CDRAM) { | ||
2892 | if (tp.trans->bits_per_word <= 8) { | ||
2893 | const u8 *buf = tp.trans->tx_buf; | ||
2894 | - u8 val = buf ? buf[tp.byte] : 0xff; | ||
2895 | + u8 val = buf ? buf[tp.byte] : 0x00; | ||
2896 | |||
2897 | write_txram_slot_u8(qspi, slot, val); | ||
2898 | dev_dbg(&qspi->pdev->dev, "WR %02x\n", val); | ||
2899 | } else { | ||
2900 | const u16 *buf = tp.trans->tx_buf; | ||
2901 | - u16 val = buf ? buf[tp.byte / 2] : 0xffff; | ||
2902 | + u16 val = buf ? buf[tp.byte / 2] : 0x0000; | ||
2903 | |||
2904 | write_txram_slot_u16(qspi, slot, val); | ||
2905 | dev_dbg(&qspi->pdev->dev, "WR %04x\n", val); | ||
2906 | diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c | ||
2907 | index eab27d41ba83..df6abc75bc16 100644 | ||
2908 | --- a/drivers/spi/spi-bcm2835.c | ||
2909 | +++ b/drivers/spi/spi-bcm2835.c | ||
2910 | @@ -793,7 +793,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev) | ||
2911 | goto out_clk_disable; | ||
2912 | } | ||
2913 | |||
2914 | - err = devm_spi_register_master(&pdev->dev, master); | ||
2915 | + err = spi_register_master(master); | ||
2916 | if (err) { | ||
2917 | dev_err(&pdev->dev, "could not register SPI master: %d\n", err); | ||
2918 | goto out_clk_disable; | ||
2919 | @@ -813,6 +813,8 @@ static int bcm2835_spi_remove(struct platform_device *pdev) | ||
2920 | struct spi_master *master = platform_get_drvdata(pdev); | ||
2921 | struct bcm2835_spi *bs = spi_master_get_devdata(master); | ||
2922 | |||
2923 | + spi_unregister_master(master); | ||
2924 | + | ||
2925 | /* Clear FIFOs, and disable the HW block */ | ||
2926 | bcm2835_wr(bs, BCM2835_SPI_CS, | ||
2927 | BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX); | ||
2928 | diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c | ||
2929 | index e075712c501e..b7f78e6d9bec 100644 | ||
2930 | --- a/drivers/spi/spi-bcm2835aux.c | ||
2931 | +++ b/drivers/spi/spi-bcm2835aux.c | ||
2932 | @@ -485,7 +485,7 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev) | ||
2933 | goto out_clk_disable; | ||
2934 | } | ||
2935 | |||
2936 | - err = devm_spi_register_master(&pdev->dev, master); | ||
2937 | + err = spi_register_master(master); | ||
2938 | if (err) { | ||
2939 | dev_err(&pdev->dev, "could not register SPI master: %d\n", err); | ||
2940 | goto out_clk_disable; | ||
2941 | @@ -505,6 +505,8 @@ static int bcm2835aux_spi_remove(struct platform_device *pdev) | ||
2942 | struct spi_master *master = platform_get_drvdata(pdev); | ||
2943 | struct bcm2835aux_spi *bs = spi_master_get_devdata(master); | ||
2944 | |||
2945 | + spi_unregister_master(master); | ||
2946 | + | ||
2947 | bcm2835aux_spi_reset_hw(bs); | ||
2948 | |||
2949 | /* disable the HW block by releasing the clock */ | ||
2950 | diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c | ||
2951 | index e31971f91475..c079ab36275f 100644 | ||
2952 | --- a/drivers/spi/spi-dw-mid.c | ||
2953 | +++ b/drivers/spi/spi-dw-mid.c | ||
2954 | @@ -155,6 +155,7 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_tx(struct dw_spi *dws, | ||
2955 | if (!xfer->tx_buf) | ||
2956 | return NULL; | ||
2957 | |||
2958 | + memset(&txconf, 0, sizeof(txconf)); | ||
2959 | txconf.direction = DMA_MEM_TO_DEV; | ||
2960 | txconf.dst_addr = dws->dma_addr; | ||
2961 | txconf.dst_maxburst = 16; | ||
2962 | @@ -201,6 +202,7 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws, | ||
2963 | if (!xfer->rx_buf) | ||
2964 | return NULL; | ||
2965 | |||
2966 | + memset(&rxconf, 0, sizeof(rxconf)); | ||
2967 | rxconf.direction = DMA_DEV_TO_MEM; | ||
2968 | rxconf.src_addr = dws->dma_addr; | ||
2969 | rxconf.src_maxburst = 16; | ||
2970 | @@ -226,19 +228,23 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws, | ||
2971 | |||
2972 | static int mid_spi_dma_setup(struct dw_spi *dws, struct spi_transfer *xfer) | ||
2973 | { | ||
2974 | - u16 dma_ctrl = 0; | ||
2975 | + u16 imr = 0, dma_ctrl = 0; | ||
2976 | |||
2977 | dw_writel(dws, DW_SPI_DMARDLR, 0xf); | ||
2978 | dw_writel(dws, DW_SPI_DMATDLR, 0x10); | ||
2979 | |||
2980 | - if (xfer->tx_buf) | ||
2981 | + if (xfer->tx_buf) { | ||
2982 | dma_ctrl |= SPI_DMA_TDMAE; | ||
2983 | - if (xfer->rx_buf) | ||
2984 | + imr |= SPI_INT_TXOI; | ||
2985 | + } | ||
2986 | + if (xfer->rx_buf) { | ||
2987 | dma_ctrl |= SPI_DMA_RDMAE; | ||
2988 | + imr |= SPI_INT_RXUI | SPI_INT_RXOI; | ||
2989 | + } | ||
2990 | dw_writel(dws, DW_SPI_DMACR, dma_ctrl); | ||
2991 | |||
2992 | /* Set the interrupt mask */ | ||
2993 | - spi_umask_intr(dws, SPI_INT_TXOI | SPI_INT_RXUI | SPI_INT_RXOI); | ||
2994 | + spi_umask_intr(dws, imr); | ||
2995 | |||
2996 | dws->transfer_handler = dma_transfer; | ||
2997 | |||
2998 | @@ -268,7 +274,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer) | ||
2999 | dma_async_issue_pending(dws->txchan); | ||
3000 | } | ||
3001 | |||
3002 | - return 0; | ||
3003 | + return 1; | ||
3004 | } | ||
3005 | |||
3006 | static void mid_spi_dma_stop(struct dw_spi *dws) | ||
3007 | diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c | ||
3008 | index babf0a337e96..91f44e3e1930 100644 | ||
3009 | --- a/drivers/spi/spi-dw.c | ||
3010 | +++ b/drivers/spi/spi-dw.c | ||
3011 | @@ -384,11 +384,8 @@ static int dw_spi_transfer_one(struct spi_master *master, | ||
3012 | |||
3013 | spi_enable_chip(dws, 1); | ||
3014 | |||
3015 | - if (dws->dma_mapped) { | ||
3016 | - ret = dws->dma_ops->dma_transfer(dws, transfer); | ||
3017 | - if (ret < 0) | ||
3018 | - return ret; | ||
3019 | - } | ||
3020 | + if (dws->dma_mapped) | ||
3021 | + return dws->dma_ops->dma_transfer(dws, transfer); | ||
3022 | |||
3023 | if (chip->poll_mode) | ||
3024 | return poll_transfer(dws); | ||
3025 | @@ -500,6 +497,8 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) | ||
3026 | snprintf(dws->name, sizeof(dws->name), "dw_spi%d", dws->bus_num); | ||
3027 | spin_lock_init(&dws->buf_lock); | ||
3028 | |||
3029 | + spi_master_set_devdata(master, dws); | ||
3030 | + | ||
3031 | ret = request_irq(dws->irq, dw_spi_irq, IRQF_SHARED, dws->name, master); | ||
3032 | if (ret < 0) { | ||
3033 | dev_err(dev, "can not get IRQ\n"); | ||
3034 | @@ -531,8 +530,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) | ||
3035 | } | ||
3036 | } | ||
3037 | |||
3038 | - spi_master_set_devdata(master, dws); | ||
3039 | - ret = devm_spi_register_master(dev, master); | ||
3040 | + ret = spi_register_master(master); | ||
3041 | if (ret) { | ||
3042 | dev_err(&master->dev, "problem registering spi master\n"); | ||
3043 | goto err_dma_exit; | ||
3044 | @@ -556,6 +554,8 @@ void dw_spi_remove_host(struct dw_spi *dws) | ||
3045 | { | ||
3046 | dw_spi_debugfs_remove(dws); | ||
3047 | |||
3048 | + spi_unregister_master(dws->master); | ||
3049 | + | ||
3050 | if (dws->dma_ops && dws->dma_ops->dma_exit) | ||
3051 | dws->dma_ops->dma_exit(dws); | ||
3052 | |||
3053 | diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c | ||
3054 | index 2f84d7653afd..da3834fe5e57 100644 | ||
3055 | --- a/drivers/spi/spi-pxa2xx.c | ||
3056 | +++ b/drivers/spi/spi-pxa2xx.c | ||
3057 | @@ -1774,7 +1774,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) | ||
3058 | |||
3059 | /* Register with the SPI framework */ | ||
3060 | platform_set_drvdata(pdev, drv_data); | ||
3061 | - status = devm_spi_register_master(&pdev->dev, master); | ||
3062 | + status = spi_register_master(master); | ||
3063 | if (status != 0) { | ||
3064 | dev_err(&pdev->dev, "problem registering spi master\n"); | ||
3065 | goto out_error_clock_enabled; | ||
3066 | @@ -1804,6 +1804,8 @@ static int pxa2xx_spi_remove(struct platform_device *pdev) | ||
3067 | |||
3068 | pm_runtime_get_sync(&pdev->dev); | ||
3069 | |||
3070 | + spi_unregister_master(drv_data->master); | ||
3071 | + | ||
3072 | /* Disable the SSP at the peripheral and SOC level */ | ||
3073 | pxa2xx_spi_write(drv_data, SSCR0, 0); | ||
3074 | clk_disable_unprepare(ssp->clk); | ||
3075 | diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c | ||
3076 | index d74d341f9890..3fadc564d781 100644 | ||
3077 | --- a/drivers/spi/spi.c | ||
3078 | +++ b/drivers/spi/spi.c | ||
3079 | @@ -2025,18 +2025,17 @@ static int __unregister(struct device *dev, void *null) | ||
3080 | */ | ||
3081 | void spi_unregister_master(struct spi_master *master) | ||
3082 | { | ||
3083 | - int dummy; | ||
3084 | - | ||
3085 | if (master->queued) { | ||
3086 | if (spi_destroy_queue(master)) | ||
3087 | dev_err(&master->dev, "queue remove failed\n"); | ||
3088 | } | ||
3089 | |||
3090 | + device_for_each_child(&master->dev, NULL, __unregister); | ||
3091 | + | ||
3092 | mutex_lock(&board_lock); | ||
3093 | list_del(&master->list); | ||
3094 | mutex_unlock(&board_lock); | ||
3095 | |||
3096 | - dummy = device_for_each_child(&master->dev, NULL, __unregister); | ||
3097 | device_unregister(&master->dev); | ||
3098 | } | ||
3099 | EXPORT_SYMBOL_GPL(spi_unregister_master); | ||
3100 | diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c | ||
3101 | index c2a7cb95725b..4fc5de13582d 100644 | ||
3102 | --- a/drivers/staging/android/ion/ion_heap.c | ||
3103 | +++ b/drivers/staging/android/ion/ion_heap.c | ||
3104 | @@ -105,12 +105,12 @@ int ion_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer, | ||
3105 | |||
3106 | static int ion_heap_clear_pages(struct page **pages, int num, pgprot_t pgprot) | ||
3107 | { | ||
3108 | - void *addr = vm_map_ram(pages, num, -1, pgprot); | ||
3109 | + void *addr = vmap(pages, num, VM_MAP, pgprot); | ||
3110 | |||
3111 | if (!addr) | ||
3112 | return -ENOMEM; | ||
3113 | memset(addr, 0, PAGE_SIZE * num); | ||
3114 | - vm_unmap_ram(addr, num); | ||
3115 | + vunmap(addr); | ||
3116 | |||
3117 | return 0; | ||
3118 | } | ||
3119 | diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c | ||
3120 | index 5649ef1e379d..82a1c2cf6687 100644 | ||
3121 | --- a/drivers/staging/greybus/sdio.c | ||
3122 | +++ b/drivers/staging/greybus/sdio.c | ||
3123 | @@ -413,6 +413,7 @@ static int gb_sdio_command(struct gb_sdio_host *host, struct mmc_command *cmd) | ||
3124 | struct gb_sdio_command_request request = {0}; | ||
3125 | struct gb_sdio_command_response response; | ||
3126 | struct mmc_data *data = host->mrq->data; | ||
3127 | + unsigned int timeout_ms; | ||
3128 | u8 cmd_flags; | ||
3129 | u8 cmd_type; | ||
3130 | int i; | ||
3131 | @@ -471,9 +472,12 @@ static int gb_sdio_command(struct gb_sdio_host *host, struct mmc_command *cmd) | ||
3132 | request.data_blksz = cpu_to_le16(data->blksz); | ||
3133 | } | ||
3134 | |||
3135 | - ret = gb_operation_sync(host->connection, GB_SDIO_TYPE_COMMAND, | ||
3136 | - &request, sizeof(request), &response, | ||
3137 | - sizeof(response)); | ||
3138 | + timeout_ms = cmd->busy_timeout ? cmd->busy_timeout : | ||
3139 | + GB_OPERATION_TIMEOUT_DEFAULT; | ||
3140 | + | ||
3141 | + ret = gb_operation_sync_timeout(host->connection, GB_SDIO_TYPE_COMMAND, | ||
3142 | + &request, sizeof(request), &response, | ||
3143 | + sizeof(response), timeout_ms); | ||
3144 | if (ret < 0) | ||
3145 | goto out; | ||
3146 | |||
3147 | diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c | ||
3148 | index 10951c82f6ed..7bd4c27cfb14 100644 | ||
3149 | --- a/drivers/video/fbdev/w100fb.c | ||
3150 | +++ b/drivers/video/fbdev/w100fb.c | ||
3151 | @@ -583,6 +583,7 @@ static void w100fb_restore_vidmem(struct w100fb_par *par) | ||
3152 | memsize=par->mach->mem->size; | ||
3153 | memcpy_toio(remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE), par->saved_extmem, memsize); | ||
3154 | vfree(par->saved_extmem); | ||
3155 | + par->saved_extmem = NULL; | ||
3156 | } | ||
3157 | if (par->saved_intmem) { | ||
3158 | memsize=MEM_INT_SIZE; | ||
3159 | @@ -591,6 +592,7 @@ static void w100fb_restore_vidmem(struct w100fb_par *par) | ||
3160 | else | ||
3161 | memcpy_toio(remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE), par->saved_intmem, memsize); | ||
3162 | vfree(par->saved_intmem); | ||
3163 | + par->saved_intmem = NULL; | ||
3164 | } | ||
3165 | } | ||
3166 | |||
3167 | diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c | ||
3168 | index 86637fec4eaa..6bc6823f81fa 100644 | ||
3169 | --- a/drivers/w1/masters/omap_hdq.c | ||
3170 | +++ b/drivers/w1/masters/omap_hdq.c | ||
3171 | @@ -204,7 +204,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status) | ||
3172 | /* check irqstatus */ | ||
3173 | if (!(*status & OMAP_HDQ_INT_STATUS_TXCOMPLETE)) { | ||
3174 | dev_dbg(hdq_data->dev, "timeout waiting for" | ||
3175 | - " TXCOMPLETE/RXCOMPLETE, %x", *status); | ||
3176 | + " TXCOMPLETE/RXCOMPLETE, %x\n", *status); | ||
3177 | ret = -ETIMEDOUT; | ||
3178 | goto out; | ||
3179 | } | ||
3180 | @@ -215,7 +215,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status) | ||
3181 | OMAP_HDQ_FLAG_CLEAR, &tmp_status); | ||
3182 | if (ret) { | ||
3183 | dev_dbg(hdq_data->dev, "timeout waiting GO bit" | ||
3184 | - " return to zero, %x", tmp_status); | ||
3185 | + " return to zero, %x\n", tmp_status); | ||
3186 | } | ||
3187 | |||
3188 | out: | ||
3189 | @@ -231,7 +231,7 @@ static irqreturn_t hdq_isr(int irq, void *_hdq) | ||
3190 | spin_lock_irqsave(&hdq_data->hdq_spinlock, irqflags); | ||
3191 | hdq_data->hdq_irqstatus = hdq_reg_in(hdq_data, OMAP_HDQ_INT_STATUS); | ||
3192 | spin_unlock_irqrestore(&hdq_data->hdq_spinlock, irqflags); | ||
3193 | - dev_dbg(hdq_data->dev, "hdq_isr: %x", hdq_data->hdq_irqstatus); | ||
3194 | + dev_dbg(hdq_data->dev, "hdq_isr: %x\n", hdq_data->hdq_irqstatus); | ||
3195 | |||
3196 | if (hdq_data->hdq_irqstatus & | ||
3197 | (OMAP_HDQ_INT_STATUS_TXCOMPLETE | OMAP_HDQ_INT_STATUS_RXCOMPLETE | ||
3198 | @@ -339,7 +339,7 @@ static int omap_hdq_break(struct hdq_data *hdq_data) | ||
3199 | tmp_status = hdq_data->hdq_irqstatus; | ||
3200 | /* check irqstatus */ | ||
3201 | if (!(tmp_status & OMAP_HDQ_INT_STATUS_TIMEOUT)) { | ||
3202 | - dev_dbg(hdq_data->dev, "timeout waiting for TIMEOUT, %x", | ||
3203 | + dev_dbg(hdq_data->dev, "timeout waiting for TIMEOUT, %x\n", | ||
3204 | tmp_status); | ||
3205 | ret = -ETIMEDOUT; | ||
3206 | goto out; | ||
3207 | @@ -366,7 +366,7 @@ static int omap_hdq_break(struct hdq_data *hdq_data) | ||
3208 | &tmp_status); | ||
3209 | if (ret) | ||
3210 | dev_dbg(hdq_data->dev, "timeout waiting INIT&GO bits" | ||
3211 | - " return to zero, %x", tmp_status); | ||
3212 | + " return to zero, %x\n", tmp_status); | ||
3213 | |||
3214 | out: | ||
3215 | mutex_unlock(&hdq_data->hdq_mutex); | ||
3216 | diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c | ||
3217 | index d0d571c47d33..4f919628137c 100644 | ||
3218 | --- a/fs/btrfs/file-item.c | ||
3219 | +++ b/fs/btrfs/file-item.c | ||
3220 | @@ -779,10 +779,12 @@ again: | ||
3221 | nritems = btrfs_header_nritems(path->nodes[0]); | ||
3222 | if (!nritems || (path->slots[0] >= nritems - 1)) { | ||
3223 | ret = btrfs_next_leaf(root, path); | ||
3224 | - if (ret == 1) | ||
3225 | + if (ret < 0) { | ||
3226 | + goto out; | ||
3227 | + } else if (ret > 0) { | ||
3228 | found_next = 1; | ||
3229 | - if (ret != 0) | ||
3230 | goto insert; | ||
3231 | + } | ||
3232 | slot = path->slots[0]; | ||
3233 | } | ||
3234 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot); | ||
3235 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c | ||
3236 | index 250c8403ec67..c425443c31fe 100644 | ||
3237 | --- a/fs/btrfs/inode.c | ||
3238 | +++ b/fs/btrfs/inode.c | ||
3239 | @@ -8494,7 +8494,6 @@ static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip, | ||
3240 | bio->bi_private = dip; | ||
3241 | bio->bi_end_io = btrfs_end_dio_bio; | ||
3242 | btrfs_io_bio(bio)->logical = file_offset; | ||
3243 | - atomic_inc(&dip->pending_bios); | ||
3244 | |||
3245 | while (bvec <= (orig_bio->bi_io_vec + orig_bio->bi_vcnt - 1)) { | ||
3246 | nr_sectors = BTRFS_BYTES_TO_BLKS(root->fs_info, bvec->bv_len); | ||
3247 | @@ -8560,7 +8559,8 @@ submit: | ||
3248 | if (!ret) | ||
3249 | return 0; | ||
3250 | |||
3251 | - bio_put(bio); | ||
3252 | + if (bio != orig_bio) | ||
3253 | + bio_put(bio); | ||
3254 | out_err: | ||
3255 | dip->errors = 1; | ||
3256 | /* | ||
3257 | @@ -8607,7 +8607,7 @@ static void btrfs_submit_direct(struct bio *dio_bio, struct inode *inode, | ||
3258 | io_bio->bi_private = dip; | ||
3259 | dip->orig_bio = io_bio; | ||
3260 | dip->dio_bio = dio_bio; | ||
3261 | - atomic_set(&dip->pending_bios, 0); | ||
3262 | + atomic_set(&dip->pending_bios, 1); | ||
3263 | btrfs_bio = btrfs_io_bio(io_bio); | ||
3264 | btrfs_bio->logical = file_offset; | ||
3265 | |||
3266 | diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c | ||
3267 | index edfc7ba38b33..080b12d65b0c 100644 | ||
3268 | --- a/fs/btrfs/send.c | ||
3269 | +++ b/fs/btrfs/send.c | ||
3270 | @@ -35,6 +35,7 @@ | ||
3271 | #include "btrfs_inode.h" | ||
3272 | #include "transaction.h" | ||
3273 | #include "compression.h" | ||
3274 | +#include "xattr.h" | ||
3275 | |||
3276 | /* | ||
3277 | * Maximum number of references an extent can have in order for us to attempt to | ||
3278 | @@ -4368,6 +4369,10 @@ static int __process_new_xattr(int num, struct btrfs_key *di_key, | ||
3279 | struct fs_path *p; | ||
3280 | struct posix_acl_xattr_header dummy_acl; | ||
3281 | |||
3282 | + /* Capabilities are emitted by finish_inode_if_needed */ | ||
3283 | + if (!strncmp(name, XATTR_NAME_CAPS, name_len)) | ||
3284 | + return 0; | ||
3285 | + | ||
3286 | p = fs_path_alloc(); | ||
3287 | if (!p) | ||
3288 | return -ENOMEM; | ||
3289 | @@ -4904,6 +4909,64 @@ static int send_extent_data(struct send_ctx *sctx, | ||
3290 | return 0; | ||
3291 | } | ||
3292 | |||
3293 | +/* | ||
3294 | + * Search for a capability xattr related to sctx->cur_ino. If the capability is | ||
3295 | + * found, call send_set_xattr function to emit it. | ||
3296 | + * | ||
3297 | + * Return 0 if there isn't a capability, or when the capability was emitted | ||
3298 | + * successfully, or < 0 if an error occurred. | ||
3299 | + */ | ||
3300 | +static int send_capabilities(struct send_ctx *sctx) | ||
3301 | +{ | ||
3302 | + struct fs_path *fspath = NULL; | ||
3303 | + struct btrfs_path *path; | ||
3304 | + struct btrfs_dir_item *di; | ||
3305 | + struct extent_buffer *leaf; | ||
3306 | + unsigned long data_ptr; | ||
3307 | + char *buf = NULL; | ||
3308 | + int buf_len; | ||
3309 | + int ret = 0; | ||
3310 | + | ||
3311 | + path = alloc_path_for_send(); | ||
3312 | + if (!path) | ||
3313 | + return -ENOMEM; | ||
3314 | + | ||
3315 | + di = btrfs_lookup_xattr(NULL, sctx->send_root, path, sctx->cur_ino, | ||
3316 | + XATTR_NAME_CAPS, strlen(XATTR_NAME_CAPS), 0); | ||
3317 | + if (!di) { | ||
3318 | + /* There is no xattr for this inode */ | ||
3319 | + goto out; | ||
3320 | + } else if (IS_ERR(di)) { | ||
3321 | + ret = PTR_ERR(di); | ||
3322 | + goto out; | ||
3323 | + } | ||
3324 | + | ||
3325 | + leaf = path->nodes[0]; | ||
3326 | + buf_len = btrfs_dir_data_len(leaf, di); | ||
3327 | + | ||
3328 | + fspath = fs_path_alloc(); | ||
3329 | + buf = kmalloc(buf_len, GFP_KERNEL); | ||
3330 | + if (!fspath || !buf) { | ||
3331 | + ret = -ENOMEM; | ||
3332 | + goto out; | ||
3333 | + } | ||
3334 | + | ||
3335 | + ret = get_cur_path(sctx, sctx->cur_ino, sctx->cur_inode_gen, fspath); | ||
3336 | + if (ret < 0) | ||
3337 | + goto out; | ||
3338 | + | ||
3339 | + data_ptr = (unsigned long)(di + 1) + btrfs_dir_name_len(leaf, di); | ||
3340 | + read_extent_buffer(leaf, buf, data_ptr, buf_len); | ||
3341 | + | ||
3342 | + ret = send_set_xattr(sctx, fspath, XATTR_NAME_CAPS, | ||
3343 | + strlen(XATTR_NAME_CAPS), buf, buf_len); | ||
3344 | +out: | ||
3345 | + kfree(buf); | ||
3346 | + fs_path_free(fspath); | ||
3347 | + btrfs_free_path(path); | ||
3348 | + return ret; | ||
3349 | +} | ||
3350 | + | ||
3351 | static int clone_range(struct send_ctx *sctx, | ||
3352 | struct clone_root *clone_root, | ||
3353 | const u64 disk_byte, | ||
3354 | @@ -5615,6 +5678,10 @@ static int finish_inode_if_needed(struct send_ctx *sctx, int at_end) | ||
3355 | goto out; | ||
3356 | } | ||
3357 | |||
3358 | + ret = send_capabilities(sctx); | ||
3359 | + if (ret < 0) | ||
3360 | + goto out; | ||
3361 | + | ||
3362 | /* | ||
3363 | * If other directory inodes depended on our current directory | ||
3364 | * inode's move/rename, now do their move/rename operations. | ||
3365 | diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h | ||
3366 | index a284fb28944b..63291c265aa0 100644 | ||
3367 | --- a/fs/ext4/ext4_extents.h | ||
3368 | +++ b/fs/ext4/ext4_extents.h | ||
3369 | @@ -169,10 +169,13 @@ struct ext4_ext_path { | ||
3370 | (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1) | ||
3371 | #define EXT_LAST_INDEX(__hdr__) \ | ||
3372 | (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1) | ||
3373 | -#define EXT_MAX_EXTENT(__hdr__) \ | ||
3374 | - (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1) | ||
3375 | +#define EXT_MAX_EXTENT(__hdr__) \ | ||
3376 | + ((le16_to_cpu((__hdr__)->eh_max)) ? \ | ||
3377 | + ((EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1)) \ | ||
3378 | + : 0) | ||
3379 | #define EXT_MAX_INDEX(__hdr__) \ | ||
3380 | - (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1) | ||
3381 | + ((le16_to_cpu((__hdr__)->eh_max)) ? \ | ||
3382 | + ((EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1)) : 0) | ||
3383 | |||
3384 | static inline struct ext4_extent_header *ext_inode_hdr(struct inode *inode) | ||
3385 | { | ||
3386 | diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c | ||
3387 | index 88effb1053c7..6dc0b89c7b55 100644 | ||
3388 | --- a/fs/ext4/fsync.c | ||
3389 | +++ b/fs/ext4/fsync.c | ||
3390 | @@ -43,30 +43,28 @@ | ||
3391 | */ | ||
3392 | static int ext4_sync_parent(struct inode *inode) | ||
3393 | { | ||
3394 | - struct dentry *dentry = NULL; | ||
3395 | - struct inode *next; | ||
3396 | + struct dentry *dentry, *next; | ||
3397 | int ret = 0; | ||
3398 | |||
3399 | if (!ext4_test_inode_state(inode, EXT4_STATE_NEWENTRY)) | ||
3400 | return 0; | ||
3401 | - inode = igrab(inode); | ||
3402 | + dentry = d_find_any_alias(inode); | ||
3403 | + if (!dentry) | ||
3404 | + return 0; | ||
3405 | while (ext4_test_inode_state(inode, EXT4_STATE_NEWENTRY)) { | ||
3406 | ext4_clear_inode_state(inode, EXT4_STATE_NEWENTRY); | ||
3407 | - dentry = d_find_any_alias(inode); | ||
3408 | - if (!dentry) | ||
3409 | - break; | ||
3410 | - next = igrab(d_inode(dentry->d_parent)); | ||
3411 | + | ||
3412 | + next = dget_parent(dentry); | ||
3413 | dput(dentry); | ||
3414 | - if (!next) | ||
3415 | - break; | ||
3416 | - iput(inode); | ||
3417 | - inode = next; | ||
3418 | + dentry = next; | ||
3419 | + inode = dentry->d_inode; | ||
3420 | + | ||
3421 | /* | ||
3422 | * The directory inode may have gone through rmdir by now. But | ||
3423 | * the inode itself and its blocks are still allocated (we hold | ||
3424 | - * a reference to the inode so it didn't go through | ||
3425 | - * ext4_evict_inode()) and so we are safe to flush metadata | ||
3426 | - * blocks and the inode. | ||
3427 | + * a reference to the inode via its dentry), so it didn't go | ||
3428 | + * through ext4_evict_inode()) and so we are safe to flush | ||
3429 | + * metadata blocks and the inode. | ||
3430 | */ | ||
3431 | ret = sync_mapping_buffers(inode->i_mapping); | ||
3432 | if (ret) | ||
3433 | @@ -75,7 +73,7 @@ static int ext4_sync_parent(struct inode *inode) | ||
3434 | if (ret) | ||
3435 | break; | ||
3436 | } | ||
3437 | - iput(inode); | ||
3438 | + dput(dentry); | ||
3439 | return ret; | ||
3440 | } | ||
3441 | |||
3442 | diff --git a/fs/fat/inode.c b/fs/fat/inode.c | ||
3443 | index f0387d040331..9af410142f78 100644 | ||
3444 | --- a/fs/fat/inode.c | ||
3445 | +++ b/fs/fat/inode.c | ||
3446 | @@ -1512,6 +1512,12 @@ static int fat_read_bpb(struct super_block *sb, struct fat_boot_sector *b, | ||
3447 | goto out; | ||
3448 | } | ||
3449 | |||
3450 | + if (bpb->fat_fat_length == 0 && bpb->fat32_length == 0) { | ||
3451 | + if (!silent) | ||
3452 | + fat_msg(sb, KERN_ERR, "bogus number of FAT sectors"); | ||
3453 | + goto out; | ||
3454 | + } | ||
3455 | + | ||
3456 | error = 0; | ||
3457 | |||
3458 | out: | ||
3459 | diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c | ||
3460 | index 882e9d6830df..5a1a6dbbc55f 100644 | ||
3461 | --- a/fs/fs-writeback.c | ||
3462 | +++ b/fs/fs-writeback.c | ||
3463 | @@ -269,6 +269,7 @@ void __inode_attach_wb(struct inode *inode, struct page *page) | ||
3464 | if (unlikely(cmpxchg(&inode->i_wb, NULL, wb))) | ||
3465 | wb_put(wb); | ||
3466 | } | ||
3467 | +EXPORT_SYMBOL_GPL(__inode_attach_wb); | ||
3468 | |||
3469 | /** | ||
3470 | * locked_inode_to_wb_and_lock_list - determine a locked inode's wb and lock it | ||
3471 | diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c | ||
3472 | index 36362d4bc344..a92af0ed0e28 100644 | ||
3473 | --- a/fs/nilfs2/segment.c | ||
3474 | +++ b/fs/nilfs2/segment.c | ||
3475 | @@ -2793,6 +2793,8 @@ int nilfs_attach_log_writer(struct super_block *sb, struct nilfs_root *root) | ||
3476 | if (!nilfs->ns_writer) | ||
3477 | return -ENOMEM; | ||
3478 | |||
3479 | + inode_attach_wb(nilfs->ns_bdev->bd_inode, NULL); | ||
3480 | + | ||
3481 | err = nilfs_segctor_start_thread(nilfs->ns_writer); | ||
3482 | if (err) { | ||
3483 | kfree(nilfs->ns_writer); | ||
3484 | diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c | ||
3485 | index 36795eed40b0..299dbf59f28f 100644 | ||
3486 | --- a/fs/overlayfs/copy_up.c | ||
3487 | +++ b/fs/overlayfs/copy_up.c | ||
3488 | @@ -56,7 +56,7 @@ int ovl_copy_xattr(struct dentry *old, struct dentry *new) | ||
3489 | { | ||
3490 | ssize_t list_size, size, value_size = 0; | ||
3491 | char *buf, *name, *value = NULL; | ||
3492 | - int uninitialized_var(error); | ||
3493 | + int error = 0; | ||
3494 | size_t slen; | ||
3495 | |||
3496 | if (!(old->d_inode->i_opflags & IOP_XATTR) || | ||
3497 | diff --git a/fs/proc/inode.c b/fs/proc/inode.c | ||
3498 | index c2afe39f0b9e..a28934912530 100644 | ||
3499 | --- a/fs/proc/inode.c | ||
3500 | +++ b/fs/proc/inode.c | ||
3501 | @@ -417,7 +417,7 @@ const struct inode_operations proc_link_inode_operations = { | ||
3502 | |||
3503 | struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) | ||
3504 | { | ||
3505 | - struct inode *inode = new_inode_pseudo(sb); | ||
3506 | + struct inode *inode = new_inode(sb); | ||
3507 | |||
3508 | if (inode) { | ||
3509 | inode->i_ino = de->low_ino; | ||
3510 | diff --git a/fs/proc/self.c b/fs/proc/self.c | ||
3511 | index 40245954c450..c8bbc1c84a39 100644 | ||
3512 | --- a/fs/proc/self.c | ||
3513 | +++ b/fs/proc/self.c | ||
3514 | @@ -53,7 +53,7 @@ int proc_setup_self(struct super_block *s) | ||
3515 | inode_lock(root_inode); | ||
3516 | self = d_alloc_name(s->s_root, "self"); | ||
3517 | if (self) { | ||
3518 | - struct inode *inode = new_inode_pseudo(s); | ||
3519 | + struct inode *inode = new_inode(s); | ||
3520 | if (inode) { | ||
3521 | inode->i_ino = self_inum; | ||
3522 | inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); | ||
3523 | diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c | ||
3524 | index 595b90a9766c..02d1db8e9723 100644 | ||
3525 | --- a/fs/proc/thread_self.c | ||
3526 | +++ b/fs/proc/thread_self.c | ||
3527 | @@ -55,7 +55,7 @@ int proc_setup_thread_self(struct super_block *s) | ||
3528 | inode_lock(root_inode); | ||
3529 | thread_self = d_alloc_name(s->s_root, "thread-self"); | ||
3530 | if (thread_self) { | ||
3531 | - struct inode *inode = new_inode_pseudo(s); | ||
3532 | + struct inode *inode = new_inode(s); | ||
3533 | if (inode) { | ||
3534 | inode->i_ino = thread_self_inum; | ||
3535 | inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); | ||
3536 | diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h | ||
3537 | index e465bb15912d..6be5545d3584 100644 | ||
3538 | --- a/include/linux/kgdb.h | ||
3539 | +++ b/include/linux/kgdb.h | ||
3540 | @@ -317,7 +317,7 @@ extern void gdbstub_exit(int status); | ||
3541 | extern int kgdb_single_step; | ||
3542 | extern atomic_t kgdb_active; | ||
3543 | #define in_dbg_master() \ | ||
3544 | - (raw_smp_processor_id() == atomic_read(&kgdb_active)) | ||
3545 | + (irqs_disabled() && (smp_processor_id() == atomic_read(&kgdb_active))) | ||
3546 | extern bool dbg_is_early; | ||
3547 | extern void __init dbg_late_init(void); | ||
3548 | #else /* ! CONFIG_KGDB */ | ||
3549 | diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h | ||
3550 | index 68ec78c1aa48..bd8480ae82e9 100644 | ||
3551 | --- a/include/linux/sunrpc/gss_api.h | ||
3552 | +++ b/include/linux/sunrpc/gss_api.h | ||
3553 | @@ -82,6 +82,7 @@ struct pf_desc { | ||
3554 | u32 service; | ||
3555 | char *name; | ||
3556 | char *auth_domain_name; | ||
3557 | + struct auth_domain *domain; | ||
3558 | bool datatouch; | ||
3559 | }; | ||
3560 | |||
3561 | diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h | ||
3562 | index 726aff1a5201..213fa12f56fc 100644 | ||
3563 | --- a/include/linux/sunrpc/svcauth_gss.h | ||
3564 | +++ b/include/linux/sunrpc/svcauth_gss.h | ||
3565 | @@ -20,7 +20,8 @@ int gss_svc_init(void); | ||
3566 | void gss_svc_shutdown(void); | ||
3567 | int gss_svc_init_net(struct net *net); | ||
3568 | void gss_svc_shutdown_net(struct net *net); | ||
3569 | -int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); | ||
3570 | +struct auth_domain *svcauth_gss_register_pseudoflavor(u32 pseudoflavor, | ||
3571 | + char *name); | ||
3572 | u32 svcauth_gss_flavor(struct auth_domain *dom); | ||
3573 | |||
3574 | #endif /* __KERNEL__ */ | ||
3575 | diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h | ||
3576 | index 00a20cd21ee2..afc3972b0879 100644 | ||
3577 | --- a/include/uapi/linux/dvb/frontend.h | ||
3578 | +++ b/include/uapi/linux/dvb/frontend.h | ||
3579 | @@ -127,6 +127,7 @@ enum fe_sec_mini_cmd { | ||
3580 | * to reset DiSEqC, tone and parameters | ||
3581 | */ | ||
3582 | enum fe_status { | ||
3583 | + FE_NONE = 0x00, | ||
3584 | FE_HAS_SIGNAL = 0x01, | ||
3585 | FE_HAS_CARRIER = 0x02, | ||
3586 | FE_HAS_VITERBI = 0x04, | ||
3587 | diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h | ||
3588 | index a0a365cbf3c9..0c02441d2cc9 100644 | ||
3589 | --- a/include/uapi/linux/kvm.h | ||
3590 | +++ b/include/uapi/linux/kvm.h | ||
3591 | @@ -159,9 +159,11 @@ struct kvm_hyperv_exit { | ||
3592 | #define KVM_EXIT_HYPERV_SYNIC 1 | ||
3593 | #define KVM_EXIT_HYPERV_HCALL 2 | ||
3594 | __u32 type; | ||
3595 | + __u32 pad1; | ||
3596 | union { | ||
3597 | struct { | ||
3598 | __u32 msr; | ||
3599 | + __u32 pad2; | ||
3600 | __u64 control; | ||
3601 | __u64 evt_page; | ||
3602 | __u64 msg_page; | ||
3603 | diff --git a/kernel/cpu_pm.c b/kernel/cpu_pm.c | ||
3604 | index 009cc9a17d95..f1042d639eee 100644 | ||
3605 | --- a/kernel/cpu_pm.c | ||
3606 | +++ b/kernel/cpu_pm.c | ||
3607 | @@ -97,7 +97,7 @@ EXPORT_SYMBOL_GPL(cpu_pm_unregister_notifier); | ||
3608 | */ | ||
3609 | int cpu_pm_enter(void) | ||
3610 | { | ||
3611 | - int nr_calls; | ||
3612 | + int nr_calls = 0; | ||
3613 | int ret = 0; | ||
3614 | |||
3615 | read_lock(&cpu_pm_notifier_lock); | ||
3616 | @@ -156,7 +156,7 @@ EXPORT_SYMBOL_GPL(cpu_pm_exit); | ||
3617 | */ | ||
3618 | int cpu_cluster_pm_enter(void) | ||
3619 | { | ||
3620 | - int nr_calls; | ||
3621 | + int nr_calls = 0; | ||
3622 | int ret = 0; | ||
3623 | |||
3624 | read_lock(&cpu_pm_notifier_lock); | ||
3625 | diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c | ||
3626 | index 79517e5549f1..9c939c6bf21c 100644 | ||
3627 | --- a/kernel/debug/debug_core.c | ||
3628 | +++ b/kernel/debug/debug_core.c | ||
3629 | @@ -443,6 +443,7 @@ static int kgdb_reenter_check(struct kgdb_state *ks) | ||
3630 | |||
3631 | if (exception_level > 1) { | ||
3632 | dump_stack(); | ||
3633 | + kgdb_io_module_registered = false; | ||
3634 | panic("Recursive entry to debugger"); | ||
3635 | } | ||
3636 | |||
3637 | diff --git a/kernel/events/core.c b/kernel/events/core.c | ||
3638 | index 1f27b73bd7d4..b562467d2d49 100644 | ||
3639 | --- a/kernel/events/core.c | ||
3640 | +++ b/kernel/events/core.c | ||
3641 | @@ -90,11 +90,11 @@ static void remote_function(void *data) | ||
3642 | * @info: the function call argument | ||
3643 | * | ||
3644 | * Calls the function @func when the task is currently running. This might | ||
3645 | - * be on the current CPU, which just calls the function directly | ||
3646 | + * be on the current CPU, which just calls the function directly. This will | ||
3647 | + * retry due to any failures in smp_call_function_single(), such as if the | ||
3648 | + * task_cpu() goes offline concurrently. | ||
3649 | * | ||
3650 | - * returns: @func return value, or | ||
3651 | - * -ESRCH - when the process isn't running | ||
3652 | - * -EAGAIN - when the process moved away | ||
3653 | + * returns @func return value or -ESRCH when the process isn't running | ||
3654 | */ | ||
3655 | static int | ||
3656 | task_function_call(struct task_struct *p, remote_function_f func, void *info) | ||
3657 | @@ -107,11 +107,16 @@ task_function_call(struct task_struct *p, remote_function_f func, void *info) | ||
3658 | }; | ||
3659 | int ret; | ||
3660 | |||
3661 | - do { | ||
3662 | - ret = smp_call_function_single(task_cpu(p), remote_function, &data, 1); | ||
3663 | - if (!ret) | ||
3664 | - ret = data.ret; | ||
3665 | - } while (ret == -EAGAIN); | ||
3666 | + for (;;) { | ||
3667 | + ret = smp_call_function_single(task_cpu(p), remote_function, | ||
3668 | + &data, 1); | ||
3669 | + ret = !ret ? data.ret : -EAGAIN; | ||
3670 | + | ||
3671 | + if (ret != -EAGAIN) | ||
3672 | + break; | ||
3673 | + | ||
3674 | + cond_resched(); | ||
3675 | + } | ||
3676 | |||
3677 | return ret; | ||
3678 | } | ||
3679 | diff --git a/kernel/exit.c b/kernel/exit.c | ||
3680 | index d9394fcd0e2c..27f4168eaeb1 100644 | ||
3681 | --- a/kernel/exit.c | ||
3682 | +++ b/kernel/exit.c | ||
3683 | @@ -739,8 +739,12 @@ void __noreturn do_exit(long code) | ||
3684 | int group_dead; | ||
3685 | TASKS_RCU(int tasks_rcu_i); | ||
3686 | |||
3687 | - profile_task_exit(tsk); | ||
3688 | - kcov_task_exit(tsk); | ||
3689 | + /* | ||
3690 | + * We can get here from a kernel oops, sometimes with preemption off. | ||
3691 | + * Start by checking for critical errors. | ||
3692 | + * Then fix up important state like USER_DS and preemption. | ||
3693 | + * Then do everything else. | ||
3694 | + */ | ||
3695 | |||
3696 | WARN_ON(blk_needs_flush_plug(tsk)); | ||
3697 | |||
3698 | @@ -758,6 +762,16 @@ void __noreturn do_exit(long code) | ||
3699 | */ | ||
3700 | set_fs(USER_DS); | ||
3701 | |||
3702 | + if (unlikely(in_atomic())) { | ||
3703 | + pr_info("note: %s[%d] exited with preempt_count %d\n", | ||
3704 | + current->comm, task_pid_nr(current), | ||
3705 | + preempt_count()); | ||
3706 | + preempt_count_set(PREEMPT_ENABLED); | ||
3707 | + } | ||
3708 | + | ||
3709 | + profile_task_exit(tsk); | ||
3710 | + kcov_task_exit(tsk); | ||
3711 | + | ||
3712 | ptrace_event(PTRACE_EVENT_EXIT, code); | ||
3713 | |||
3714 | validate_creds_for_do_exit(tsk); | ||
3715 | @@ -794,13 +808,6 @@ void __noreturn do_exit(long code) | ||
3716 | */ | ||
3717 | raw_spin_unlock_wait(&tsk->pi_lock); | ||
3718 | |||
3719 | - if (unlikely(in_atomic())) { | ||
3720 | - pr_info("note: %s[%d] exited with preempt_count %d\n", | ||
3721 | - current->comm, task_pid_nr(current), | ||
3722 | - preempt_count()); | ||
3723 | - preempt_count_set(PREEMPT_ENABLED); | ||
3724 | - } | ||
3725 | - | ||
3726 | /* sync mm's RSS info before statistics gathering */ | ||
3727 | if (tsk->mm) | ||
3728 | sync_mm_rss(tsk->mm); | ||
3729 | diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c | ||
3730 | index 5e65c7eea872..8233032a2f01 100644 | ||
3731 | --- a/kernel/sched/fair.c | ||
3732 | +++ b/kernel/sched/fair.c | ||
3733 | @@ -2542,7 +2542,7 @@ void task_tick_numa(struct rq *rq, struct task_struct *curr) | ||
3734 | /* | ||
3735 | * We don't care about NUMA placement if we don't have memory. | ||
3736 | */ | ||
3737 | - if (!curr->mm || (curr->flags & PF_EXITING) || work->next != work) | ||
3738 | + if ((curr->flags & (PF_EXITING | PF_KTHREAD)) || work->next != work) | ||
3739 | return; | ||
3740 | |||
3741 | /* | ||
3742 | diff --git a/lib/mpi/longlong.h b/lib/mpi/longlong.h | ||
3743 | index 8f383cca6bb1..623440d3d365 100644 | ||
3744 | --- a/lib/mpi/longlong.h | ||
3745 | +++ b/lib/mpi/longlong.h | ||
3746 | @@ -671,7 +671,7 @@ do { \ | ||
3747 | ************** MIPS/64 ************** | ||
3748 | ***************************************/ | ||
3749 | #if (defined(__mips) && __mips >= 3) && W_TYPE_SIZE == 64 | ||
3750 | -#if defined(__mips_isa_rev) && __mips_isa_rev >= 6 | ||
3751 | +#if defined(__mips_isa_rev) && __mips_isa_rev >= 6 && defined(CONFIG_CC_IS_GCC) | ||
3752 | /* | ||
3753 | * GCC ends up emitting a __multi3 intrinsic call for MIPS64r6 with the plain C | ||
3754 | * code below, so we special case MIPS64r6 until the compiler can do better. | ||
3755 | diff --git a/mm/huge_memory.c b/mm/huge_memory.c | ||
3756 | index 5fbd77d52602..cf4c0a61b370 100644 | ||
3757 | --- a/mm/huge_memory.c | ||
3758 | +++ b/mm/huge_memory.c | ||
3759 | @@ -1755,6 +1755,8 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, | ||
3760 | spinlock_t *ptl; | ||
3761 | struct mm_struct *mm = vma->vm_mm; | ||
3762 | unsigned long haddr = address & HPAGE_PMD_MASK; | ||
3763 | + bool was_locked = false; | ||
3764 | + pmd_t _pmd; | ||
3765 | |||
3766 | mmu_notifier_invalidate_range_start(mm, haddr, haddr + HPAGE_PMD_SIZE); | ||
3767 | ptl = pmd_lock(mm, pmd); | ||
3768 | @@ -1764,11 +1766,32 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, | ||
3769 | * pmd against. Otherwise we can end up replacing wrong page. | ||
3770 | */ | ||
3771 | VM_BUG_ON(freeze && !page); | ||
3772 | - if (page && page != pmd_page(*pmd)) | ||
3773 | - goto out; | ||
3774 | + if (page) { | ||
3775 | + VM_WARN_ON_ONCE(!PageLocked(page)); | ||
3776 | + was_locked = true; | ||
3777 | + if (page != pmd_page(*pmd)) | ||
3778 | + goto out; | ||
3779 | + } | ||
3780 | |||
3781 | +repeat: | ||
3782 | if (pmd_trans_huge(*pmd)) { | ||
3783 | - page = pmd_page(*pmd); | ||
3784 | + if (!page) { | ||
3785 | + page = pmd_page(*pmd); | ||
3786 | + if (unlikely(!trylock_page(page))) { | ||
3787 | + get_page(page); | ||
3788 | + _pmd = *pmd; | ||
3789 | + spin_unlock(ptl); | ||
3790 | + lock_page(page); | ||
3791 | + spin_lock(ptl); | ||
3792 | + if (unlikely(!pmd_same(*pmd, _pmd))) { | ||
3793 | + unlock_page(page); | ||
3794 | + put_page(page); | ||
3795 | + page = NULL; | ||
3796 | + goto repeat; | ||
3797 | + } | ||
3798 | + put_page(page); | ||
3799 | + } | ||
3800 | + } | ||
3801 | if (PageMlocked(page)) | ||
3802 | clear_page_mlock(page); | ||
3803 | } else if (!pmd_devmap(*pmd)) | ||
3804 | @@ -1776,6 +1799,8 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, | ||
3805 | __split_huge_pmd_locked(vma, pmd, haddr, freeze); | ||
3806 | out: | ||
3807 | spin_unlock(ptl); | ||
3808 | + if (!was_locked && page) | ||
3809 | + unlock_page(page); | ||
3810 | mmu_notifier_invalidate_range_end(mm, haddr, haddr + HPAGE_PMD_SIZE); | ||
3811 | } | ||
3812 | |||
3813 | diff --git a/mm/slub.c b/mm/slub.c | ||
3814 | index 9b44423f1cf0..3d45713187a4 100644 | ||
3815 | --- a/mm/slub.c | ||
3816 | +++ b/mm/slub.c | ||
3817 | @@ -5620,8 +5620,10 @@ static int sysfs_slab_add(struct kmem_cache *s) | ||
3818 | |||
3819 | s->kobj.kset = cache_kset(s); | ||
3820 | err = kobject_init_and_add(&s->kobj, &slab_ktype, NULL, "%s", name); | ||
3821 | - if (err) | ||
3822 | + if (err) { | ||
3823 | + kobject_put(&s->kobj); | ||
3824 | goto out; | ||
3825 | + } | ||
3826 | |||
3827 | err = sysfs_create_group(&s->kobj, &slab_attr_group); | ||
3828 | if (err) | ||
3829 | diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c | ||
3830 | index 6f78489fdb13..a8aa3f29f2d6 100644 | ||
3831 | --- a/net/bluetooth/hci_event.c | ||
3832 | +++ b/net/bluetooth/hci_event.c | ||
3833 | @@ -3775,6 +3775,7 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, | ||
3834 | case 0x11: /* Unsupported Feature or Parameter Value */ | ||
3835 | case 0x1c: /* SCO interval rejected */ | ||
3836 | case 0x1a: /* Unsupported Remote Feature */ | ||
3837 | + case 0x1e: /* Invalid LMP Parameters */ | ||
3838 | case 0x1f: /* Unspecified error */ | ||
3839 | case 0x20: /* Unsupported LMP Parameter value */ | ||
3840 | if (conn->out) { | ||
3841 | diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c | ||
3842 | index 455fa4a30353..2c770bba212c 100644 | ||
3843 | --- a/net/ipv6/ipv6_sockglue.c | ||
3844 | +++ b/net/ipv6/ipv6_sockglue.c | ||
3845 | @@ -184,14 +184,15 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, | ||
3846 | retv = -EBUSY; | ||
3847 | break; | ||
3848 | } | ||
3849 | - } | ||
3850 | - if (sk->sk_protocol == IPPROTO_TCP && | ||
3851 | - sk->sk_prot != &tcpv6_prot) { | ||
3852 | - retv = -EBUSY; | ||
3853 | + } else if (sk->sk_protocol == IPPROTO_TCP) { | ||
3854 | + if (sk->sk_prot != &tcpv6_prot) { | ||
3855 | + retv = -EBUSY; | ||
3856 | + break; | ||
3857 | + } | ||
3858 | + } else { | ||
3859 | break; | ||
3860 | } | ||
3861 | - if (sk->sk_protocol != IPPROTO_TCP) | ||
3862 | - break; | ||
3863 | + | ||
3864 | if (sk->sk_state != TCP_ESTABLISHED) { | ||
3865 | retv = -ENOTCONN; | ||
3866 | break; | ||
3867 | diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c | ||
3868 | index 4c48e9bb21e2..d2510e432c18 100644 | ||
3869 | --- a/net/netfilter/nft_nat.c | ||
3870 | +++ b/net/netfilter/nft_nat.c | ||
3871 | @@ -135,7 +135,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | ||
3872 | priv->type = NF_NAT_MANIP_DST; | ||
3873 | break; | ||
3874 | default: | ||
3875 | - return -EINVAL; | ||
3876 | + return -EOPNOTSUPP; | ||
3877 | } | ||
3878 | |||
3879 | err = nft_nat_validate(ctx, expr, NULL); | ||
3880 | @@ -206,7 +206,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | ||
3881 | if (tb[NFTA_NAT_FLAGS]) { | ||
3882 | priv->flags = ntohl(nla_get_be32(tb[NFTA_NAT_FLAGS])); | ||
3883 | if (priv->flags & ~NF_NAT_RANGE_MASK) | ||
3884 | - return -EINVAL; | ||
3885 | + return -EOPNOTSUPP; | ||
3886 | } | ||
3887 | |||
3888 | return 0; | ||
3889 | diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c | ||
3890 | index 5fec3abbe19b..c7d88f979c56 100644 | ||
3891 | --- a/net/sunrpc/auth_gss/gss_mech_switch.c | ||
3892 | +++ b/net/sunrpc/auth_gss/gss_mech_switch.c | ||
3893 | @@ -61,6 +61,8 @@ gss_mech_free(struct gss_api_mech *gm) | ||
3894 | |||
3895 | for (i = 0; i < gm->gm_pf_num; i++) { | ||
3896 | pf = &gm->gm_pfs[i]; | ||
3897 | + if (pf->domain) | ||
3898 | + auth_domain_put(pf->domain); | ||
3899 | kfree(pf->auth_domain_name); | ||
3900 | pf->auth_domain_name = NULL; | ||
3901 | } | ||
3902 | @@ -83,6 +85,7 @@ make_auth_domain_name(char *name) | ||
3903 | static int | ||
3904 | gss_mech_svc_setup(struct gss_api_mech *gm) | ||
3905 | { | ||
3906 | + struct auth_domain *dom; | ||
3907 | struct pf_desc *pf; | ||
3908 | int i, status; | ||
3909 | |||
3910 | @@ -92,10 +95,13 @@ gss_mech_svc_setup(struct gss_api_mech *gm) | ||
3911 | status = -ENOMEM; | ||
3912 | if (pf->auth_domain_name == NULL) | ||
3913 | goto out; | ||
3914 | - status = svcauth_gss_register_pseudoflavor(pf->pseudoflavor, | ||
3915 | - pf->auth_domain_name); | ||
3916 | - if (status) | ||
3917 | + dom = svcauth_gss_register_pseudoflavor( | ||
3918 | + pf->pseudoflavor, pf->auth_domain_name); | ||
3919 | + if (IS_ERR(dom)) { | ||
3920 | + status = PTR_ERR(dom); | ||
3921 | goto out; | ||
3922 | + } | ||
3923 | + pf->domain = dom; | ||
3924 | } | ||
3925 | return 0; | ||
3926 | out: | ||
3927 | diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c | ||
3928 | index d7775ca2fbb9..fd897d900d12 100644 | ||
3929 | --- a/net/sunrpc/auth_gss/svcauth_gss.c | ||
3930 | +++ b/net/sunrpc/auth_gss/svcauth_gss.c | ||
3931 | @@ -779,7 +779,7 @@ u32 svcauth_gss_flavor(struct auth_domain *dom) | ||
3932 | |||
3933 | EXPORT_SYMBOL_GPL(svcauth_gss_flavor); | ||
3934 | |||
3935 | -int | ||
3936 | +struct auth_domain * | ||
3937 | svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name) | ||
3938 | { | ||
3939 | struct gss_domain *new; | ||
3940 | @@ -796,21 +796,23 @@ svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name) | ||
3941 | new->h.flavour = &svcauthops_gss; | ||
3942 | new->pseudoflavor = pseudoflavor; | ||
3943 | |||
3944 | - stat = 0; | ||
3945 | test = auth_domain_lookup(name, &new->h); | ||
3946 | - if (test != &new->h) { /* Duplicate registration */ | ||
3947 | + if (test != &new->h) { | ||
3948 | + pr_warn("svc: duplicate registration of gss pseudo flavour %s.\n", | ||
3949 | + name); | ||
3950 | + stat = -EADDRINUSE; | ||
3951 | auth_domain_put(test); | ||
3952 | - kfree(new->h.name); | ||
3953 | - goto out_free_dom; | ||
3954 | + goto out_free_name; | ||
3955 | } | ||
3956 | - return 0; | ||
3957 | + return test; | ||
3958 | |||
3959 | +out_free_name: | ||
3960 | + kfree(new->h.name); | ||
3961 | out_free_dom: | ||
3962 | kfree(new); | ||
3963 | out: | ||
3964 | - return stat; | ||
3965 | + return ERR_PTR(stat); | ||
3966 | } | ||
3967 | - | ||
3968 | EXPORT_SYMBOL_GPL(svcauth_gss_register_pseudoflavor); | ||
3969 | |||
3970 | static inline int | ||
3971 | diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c | ||
3972 | index e034dc21421e..b0440cf34970 100644 | ||
3973 | --- a/security/integrity/evm/evm_crypto.c | ||
3974 | +++ b/security/integrity/evm/evm_crypto.c | ||
3975 | @@ -240,7 +240,7 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry, | ||
3976 | |||
3977 | /* Portable EVM signatures must include an IMA hash */ | ||
3978 | if (type == EVM_XATTR_PORTABLE_DIGSIG && !ima_present) | ||
3979 | - return -EPERM; | ||
3980 | + error = -EPERM; | ||
3981 | out: | ||
3982 | kfree(xattr_value); | ||
3983 | kfree(desc); | ||
3984 | diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h | ||
3985 | index df7834aa1b8f..5f2a0a07ceac 100644 | ||
3986 | --- a/security/integrity/ima/ima.h | ||
3987 | +++ b/security/integrity/ima/ima.h | ||
3988 | @@ -36,7 +36,7 @@ enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 = 8 }; | ||
3989 | #define IMA_DIGEST_SIZE SHA1_DIGEST_SIZE | ||
3990 | #define IMA_EVENT_NAME_LEN_MAX 255 | ||
3991 | |||
3992 | -#define IMA_HASH_BITS 9 | ||
3993 | +#define IMA_HASH_BITS 10 | ||
3994 | #define IMA_MEASURE_HTABLE_SIZE (1 << IMA_HASH_BITS) | ||
3995 | |||
3996 | #define IMA_TEMPLATE_FIELD_ID_MAX_LEN 16 | ||
3997 | @@ -136,9 +136,10 @@ struct ima_h_table { | ||
3998 | }; | ||
3999 | extern struct ima_h_table ima_htable; | ||
4000 | |||
4001 | -static inline unsigned long ima_hash_key(u8 *digest) | ||
4002 | +static inline unsigned int ima_hash_key(u8 *digest) | ||
4003 | { | ||
4004 | - return hash_long(*digest, IMA_HASH_BITS); | ||
4005 | + /* there is no point in taking a hash of part of a digest */ | ||
4006 | + return (digest[0] | digest[1] << 8) % IMA_MEASURE_HTABLE_SIZE; | ||
4007 | } | ||
4008 | |||
4009 | enum ima_hooks { | ||
4010 | diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c | ||
4011 | index aed47b777a57..4926a5a1bc94 100644 | ||
4012 | --- a/security/integrity/ima/ima_policy.c | ||
4013 | +++ b/security/integrity/ima/ima_policy.c | ||
4014 | @@ -150,7 +150,7 @@ static struct ima_rule_entry default_appraise_rules[] = { | ||
4015 | static LIST_HEAD(ima_default_rules); | ||
4016 | static LIST_HEAD(ima_policy_rules); | ||
4017 | static LIST_HEAD(ima_temp_rules); | ||
4018 | -static struct list_head *ima_rules; | ||
4019 | +static struct list_head *ima_rules = &ima_default_rules; | ||
4020 | |||
4021 | static int ima_policy __initdata; | ||
4022 | |||
4023 | @@ -429,7 +429,6 @@ void __init ima_init_policy(void) | ||
4024 | temp_ima_appraise |= IMA_APPRAISE_POLICY; | ||
4025 | } | ||
4026 | |||
4027 | - ima_rules = &ima_default_rules; | ||
4028 | ima_update_policy_flag(); | ||
4029 | } | ||
4030 | |||
4031 | diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c | ||
4032 | index 6492fe96cae4..3397b216bc6c 100644 | ||
4033 | --- a/security/smack/smackfs.c | ||
4034 | +++ b/security/smack/smackfs.c | ||
4035 | @@ -901,11 +901,21 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, | ||
4036 | else | ||
4037 | rule += strlen(skp->smk_known) + 1; | ||
4038 | |||
4039 | + if (rule > data + count) { | ||
4040 | + rc = -EOVERFLOW; | ||
4041 | + goto out; | ||
4042 | + } | ||
4043 | + | ||
4044 | ret = sscanf(rule, "%d", &maplevel); | ||
4045 | if (ret != 1 || maplevel > SMACK_CIPSO_MAXLEVEL) | ||
4046 | goto out; | ||
4047 | |||
4048 | rule += SMK_DIGITLEN; | ||
4049 | + if (rule > data + count) { | ||
4050 | + rc = -EOVERFLOW; | ||
4051 | + goto out; | ||
4052 | + } | ||
4053 | + | ||
4054 | ret = sscanf(rule, "%d", &catlen); | ||
4055 | if (ret != 1 || catlen > SMACK_CIPSO_MAXCATNUM) | ||
4056 | goto out; | ||
4057 | diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c | ||
4058 | index 23e17a58651b..5c07c5be3142 100644 | ||
4059 | --- a/sound/core/pcm_native.c | ||
4060 | +++ b/sound/core/pcm_native.c | ||
4061 | @@ -1836,6 +1836,11 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) | ||
4062 | } | ||
4063 | pcm_file = f.file->private_data; | ||
4064 | substream1 = pcm_file->substream; | ||
4065 | + if (substream == substream1) { | ||
4066 | + res = -EINVAL; | ||
4067 | + goto _badf; | ||
4068 | + } | ||
4069 | + | ||
4070 | group = kmalloc(sizeof(*group), GFP_KERNEL); | ||
4071 | if (!group) { | ||
4072 | res = -ENOMEM; | ||
4073 | diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c | ||
4074 | index 1901c2bb6c3b..a36e2121ef09 100644 | ||
4075 | --- a/sound/isa/es1688/es1688.c | ||
4076 | +++ b/sound/isa/es1688/es1688.c | ||
4077 | @@ -284,8 +284,10 @@ static int snd_es968_pnp_detect(struct pnp_card_link *pcard, | ||
4078 | return error; | ||
4079 | } | ||
4080 | error = snd_es1688_probe(card, dev); | ||
4081 | - if (error < 0) | ||
4082 | + if (error < 0) { | ||
4083 | + snd_card_free(card); | ||
4084 | return error; | ||
4085 | + } | ||
4086 | pnp_set_card_drvdata(pcard, card); | ||
4087 | snd_es968_pnp_is_probed = 1; | ||
4088 | return 0; | ||
4089 | diff --git a/sound/usb/card.c b/sound/usb/card.c | ||
4090 | index 549b9b061694..023a36a4922b 100644 | ||
4091 | --- a/sound/usb/card.c | ||
4092 | +++ b/sound/usb/card.c | ||
4093 | @@ -768,9 +768,6 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) | ||
4094 | if (chip == (void *)-1L) | ||
4095 | return 0; | ||
4096 | |||
4097 | - chip->autosuspended = !!PMSG_IS_AUTO(message); | ||
4098 | - if (!chip->autosuspended) | ||
4099 | - snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); | ||
4100 | if (!chip->num_suspended_intf++) { | ||
4101 | list_for_each_entry(as, &chip->pcm_list, list) { | ||
4102 | snd_pcm_suspend_all(as->pcm); | ||
4103 | @@ -783,6 +780,11 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) | ||
4104 | snd_usb_mixer_suspend(mixer); | ||
4105 | } | ||
4106 | |||
4107 | + if (!PMSG_IS_AUTO(message) && !chip->system_suspend) { | ||
4108 | + snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); | ||
4109 | + chip->system_suspend = chip->num_suspended_intf; | ||
4110 | + } | ||
4111 | + | ||
4112 | return 0; | ||
4113 | } | ||
4114 | |||
4115 | @@ -795,10 +797,11 @@ static int __usb_audio_resume(struct usb_interface *intf, bool reset_resume) | ||
4116 | |||
4117 | if (chip == (void *)-1L) | ||
4118 | return 0; | ||
4119 | - if (--chip->num_suspended_intf) | ||
4120 | - return 0; | ||
4121 | |||
4122 | atomic_inc(&chip->active); /* avoid autopm */ | ||
4123 | + if (chip->num_suspended_intf > 1) | ||
4124 | + goto out; | ||
4125 | + | ||
4126 | /* | ||
4127 | * ALSA leaves material resumption to user space | ||
4128 | * we just notify and restart the mixers | ||
4129 | @@ -813,9 +816,12 @@ static int __usb_audio_resume(struct usb_interface *intf, bool reset_resume) | ||
4130 | snd_usbmidi_resume(p); | ||
4131 | } | ||
4132 | |||
4133 | - if (!chip->autosuspended) | ||
4134 | + out: | ||
4135 | + if (chip->num_suspended_intf == chip->system_suspend) { | ||
4136 | snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0); | ||
4137 | - chip->autosuspended = 0; | ||
4138 | + chip->system_suspend = 0; | ||
4139 | + } | ||
4140 | + chip->num_suspended_intf--; | ||
4141 | |||
4142 | err_out: | ||
4143 | atomic_dec(&chip->active); /* allow autopm after this point */ | ||
4144 | diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h | ||
4145 | index 4d5c89a7ba2b..f4ee83c8e0b2 100644 | ||
4146 | --- a/sound/usb/usbaudio.h | ||
4147 | +++ b/sound/usb/usbaudio.h | ||
4148 | @@ -37,7 +37,7 @@ struct snd_usb_audio { | ||
4149 | struct usb_interface *pm_intf; | ||
4150 | u32 usb_id; | ||
4151 | struct mutex mutex; | ||
4152 | - unsigned int autosuspended:1; | ||
4153 | + unsigned int system_suspend; | ||
4154 | atomic_t active; | ||
4155 | atomic_t shutdown; | ||
4156 | atomic_t usage_count; | ||
4157 | diff --git a/tools/objtool/check.c b/tools/objtool/check.c | ||
4158 | index b0b8ba9b800c..c7399d7f4bc7 100644 | ||
4159 | --- a/tools/objtool/check.c | ||
4160 | +++ b/tools/objtool/check.c | ||
4161 | @@ -778,6 +778,12 @@ static int add_special_section_alts(struct objtool_file *file) | ||
4162 | } | ||
4163 | |||
4164 | if (special_alt->group) { | ||
4165 | + if (!special_alt->orig_len) { | ||
4166 | + WARN_FUNC("empty alternative entry", | ||
4167 | + orig_insn->sec, orig_insn->offset); | ||
4168 | + continue; | ||
4169 | + } | ||
4170 | + | ||
4171 | ret = handle_group_alt(file, special_alt, orig_insn, | ||
4172 | &new_insn); | ||
4173 | if (ret) | ||
4174 | diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c | ||
4175 | index 2b420e7a92c0..929f0d0ea9da 100644 | ||
4176 | --- a/tools/perf/builtin-probe.c | ||
4177 | +++ b/tools/perf/builtin-probe.c | ||
4178 | @@ -344,6 +344,9 @@ static int perf_add_probe_events(struct perf_probe_event *pevs, int npevs) | ||
4179 | |||
4180 | for (k = 0; k < pev->ntevs; k++) { | ||
4181 | struct probe_trace_event *tev = &pev->tevs[k]; | ||
4182 | + /* Skipped events have no event name */ | ||
4183 | + if (!tev->event) | ||
4184 | + continue; | ||
4185 | |||
4186 | /* We use tev's name for showing new events */ | ||
4187 | show_perf_probe_event(tev->group, tev->event, pev, | ||
4188 | diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c | ||
4189 | index 8bec05365aae..9be7c95bd1e1 100644 | ||
4190 | --- a/tools/perf/util/dso.c | ||
4191 | +++ b/tools/perf/util/dso.c | ||
4192 | @@ -19,6 +19,7 @@ char dso__symtab_origin(const struct dso *dso) | ||
4193 | [DSO_BINARY_TYPE__BUILD_ID_CACHE] = 'B', | ||
4194 | [DSO_BINARY_TYPE__FEDORA_DEBUGINFO] = 'f', | ||
4195 | [DSO_BINARY_TYPE__UBUNTU_DEBUGINFO] = 'u', | ||
4196 | + [DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO] = 'x', | ||
4197 | [DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO] = 'o', | ||
4198 | [DSO_BINARY_TYPE__BUILDID_DEBUGINFO] = 'b', | ||
4199 | [DSO_BINARY_TYPE__SYSTEM_PATH_DSO] = 'd', | ||
4200 | @@ -77,6 +78,21 @@ int dso__read_binary_type_filename(const struct dso *dso, | ||
4201 | snprintf(filename + len, size - len, "%s", dso->long_name); | ||
4202 | break; | ||
4203 | |||
4204 | + case DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO: | ||
4205 | + /* | ||
4206 | + * Ubuntu can mixup /usr/lib with /lib, putting debuginfo in | ||
4207 | + * /usr/lib/debug/lib when it is expected to be in | ||
4208 | + * /usr/lib/debug/usr/lib | ||
4209 | + */ | ||
4210 | + if (strlen(dso->long_name) < 9 || | ||
4211 | + strncmp(dso->long_name, "/usr/lib/", 9)) { | ||
4212 | + ret = -1; | ||
4213 | + break; | ||
4214 | + } | ||
4215 | + len = __symbol__join_symfs(filename, size, "/usr/lib/debug"); | ||
4216 | + snprintf(filename + len, size - len, "%s", dso->long_name + 4); | ||
4217 | + break; | ||
4218 | + | ||
4219 | case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO: | ||
4220 | { | ||
4221 | const char *last_slash; | ||
4222 | diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h | ||
4223 | index ecc4bbd3f82e..b886720ffea0 100644 | ||
4224 | --- a/tools/perf/util/dso.h | ||
4225 | +++ b/tools/perf/util/dso.h | ||
4226 | @@ -22,6 +22,7 @@ enum dso_binary_type { | ||
4227 | DSO_BINARY_TYPE__BUILD_ID_CACHE, | ||
4228 | DSO_BINARY_TYPE__FEDORA_DEBUGINFO, | ||
4229 | DSO_BINARY_TYPE__UBUNTU_DEBUGINFO, | ||
4230 | + DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO, | ||
4231 | DSO_BINARY_TYPE__BUILDID_DEBUGINFO, | ||
4232 | DSO_BINARY_TYPE__SYSTEM_PATH_DSO, | ||
4233 | DSO_BINARY_TYPE__GUEST_KMODULE, | ||
4234 | diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c | ||
4235 | index 82e4f158c88e..7d0d44b4f3d5 100644 | ||
4236 | --- a/tools/perf/util/probe-finder.c | ||
4237 | +++ b/tools/perf/util/probe-finder.c | ||
4238 | @@ -111,6 +111,7 @@ enum dso_binary_type distro_dwarf_types[] = { | ||
4239 | DSO_BINARY_TYPE__UBUNTU_DEBUGINFO, | ||
4240 | DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO, | ||
4241 | DSO_BINARY_TYPE__BUILDID_DEBUGINFO, | ||
4242 | + DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO, | ||
4243 | DSO_BINARY_TYPE__NOT_FOUND, | ||
4244 | }; | ||
4245 | |||
4246 | diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c | ||
4247 | index acde8e489352..4e27b868f774 100644 | ||
4248 | --- a/tools/perf/util/symbol.c | ||
4249 | +++ b/tools/perf/util/symbol.c | ||
4250 | @@ -58,6 +58,7 @@ static enum dso_binary_type binary_type_symtab[] = { | ||
4251 | DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE, | ||
4252 | DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP, | ||
4253 | DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO, | ||
4254 | + DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO, | ||
4255 | DSO_BINARY_TYPE__NOT_FOUND, | ||
4256 | }; | ||
4257 | |||
4258 | @@ -1361,6 +1362,7 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod, | ||
4259 | case DSO_BINARY_TYPE__SYSTEM_PATH_DSO: | ||
4260 | case DSO_BINARY_TYPE__FEDORA_DEBUGINFO: | ||
4261 | case DSO_BINARY_TYPE__UBUNTU_DEBUGINFO: | ||
4262 | + case DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO: | ||
4263 | case DSO_BINARY_TYPE__BUILDID_DEBUGINFO: | ||
4264 | case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO: | ||
4265 | return !kmod && dso->kernel == DSO_TYPE_USER; |