Annotation of /trunk/kernel-magellan/patches-3.8/0102-3.8.3-all-fixes.patch
Parent Directory | Revision Log
Revision 2118 -
(hide annotations)
(download)
Mon Mar 18 12:59:42 2013 UTC (11 years, 6 months ago) by niro
File size: 152651 byte(s)
Mon Mar 18 12:59:42 2013 UTC (11 years, 6 months ago) by niro
File size: 152651 byte(s)
-linux-3.8.3
1 | niro | 2118 | diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts |
2 | index 5bb0bf3..c9c44b2 100644 | ||
3 | --- a/arch/arm/boot/dts/kirkwood-dns320.dts | ||
4 | +++ b/arch/arm/boot/dts/kirkwood-dns320.dts | ||
5 | @@ -42,12 +42,10 @@ | ||
6 | |||
7 | ocp@f1000000 { | ||
8 | serial@12000 { | ||
9 | - clock-frequency = <166666667>; | ||
10 | status = "okay"; | ||
11 | }; | ||
12 | |||
13 | serial@12100 { | ||
14 | - clock-frequency = <166666667>; | ||
15 | status = "okay"; | ||
16 | }; | ||
17 | }; | ||
18 | diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts | ||
19 | index d430713..e4e4930 100644 | ||
20 | --- a/arch/arm/boot/dts/kirkwood-dns325.dts | ||
21 | +++ b/arch/arm/boot/dts/kirkwood-dns325.dts | ||
22 | @@ -50,7 +50,6 @@ | ||
23 | }; | ||
24 | }; | ||
25 | serial@12000 { | ||
26 | - clock-frequency = <200000000>; | ||
27 | status = "okay"; | ||
28 | }; | ||
29 | }; | ||
30 | diff --git a/arch/arm/boot/dts/kirkwood-dockstar.dts b/arch/arm/boot/dts/kirkwood-dockstar.dts | ||
31 | index 2e3dd34..0196cf6 100644 | ||
32 | --- a/arch/arm/boot/dts/kirkwood-dockstar.dts | ||
33 | +++ b/arch/arm/boot/dts/kirkwood-dockstar.dts | ||
34 | @@ -37,7 +37,6 @@ | ||
35 | }; | ||
36 | }; | ||
37 | serial@12000 { | ||
38 | - clock-frequency = <200000000>; | ||
39 | status = "ok"; | ||
40 | }; | ||
41 | |||
42 | diff --git a/arch/arm/boot/dts/kirkwood-dreamplug.dts b/arch/arm/boot/dts/kirkwood-dreamplug.dts | ||
43 | index f2d386c..e21ae48 100644 | ||
44 | --- a/arch/arm/boot/dts/kirkwood-dreamplug.dts | ||
45 | +++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts | ||
46 | @@ -38,7 +38,6 @@ | ||
47 | }; | ||
48 | }; | ||
49 | serial@12000 { | ||
50 | - clock-frequency = <200000000>; | ||
51 | status = "ok"; | ||
52 | }; | ||
53 | |||
54 | diff --git a/arch/arm/boot/dts/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts | ||
55 | index 1b133e0..bd83b8f 100644 | ||
56 | --- a/arch/arm/boot/dts/kirkwood-goflexnet.dts | ||
57 | +++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts | ||
58 | @@ -73,7 +73,6 @@ | ||
59 | }; | ||
60 | }; | ||
61 | serial@12000 { | ||
62 | - clock-frequency = <200000000>; | ||
63 | status = "ok"; | ||
64 | }; | ||
65 | |||
66 | diff --git a/arch/arm/boot/dts/kirkwood-ib62x0.dts b/arch/arm/boot/dts/kirkwood-ib62x0.dts | ||
67 | index 71902da..5335b1a 100644 | ||
68 | --- a/arch/arm/boot/dts/kirkwood-ib62x0.dts | ||
69 | +++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts | ||
70 | @@ -51,7 +51,6 @@ | ||
71 | }; | ||
72 | }; | ||
73 | serial@12000 { | ||
74 | - clock-frequency = <200000000>; | ||
75 | status = "okay"; | ||
76 | }; | ||
77 | |||
78 | diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts | ||
79 | index 504f16b..12ccf74 100644 | ||
80 | --- a/arch/arm/boot/dts/kirkwood-iconnect.dts | ||
81 | +++ b/arch/arm/boot/dts/kirkwood-iconnect.dts | ||
82 | @@ -78,7 +78,6 @@ | ||
83 | }; | ||
84 | }; | ||
85 | serial@12000 { | ||
86 | - clock-frequency = <200000000>; | ||
87 | status = "ok"; | ||
88 | }; | ||
89 | |||
90 | diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts | ||
91 | index 6cae459..93c3afb 100644 | ||
92 | --- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts | ||
93 | +++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts | ||
94 | @@ -115,7 +115,6 @@ | ||
95 | }; | ||
96 | |||
97 | serial@12000 { | ||
98 | - clock-frequency = <200000000>; | ||
99 | status = "ok"; | ||
100 | }; | ||
101 | |||
102 | diff --git a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts | ||
103 | index 8db3123..5bbd054 100644 | ||
104 | --- a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts | ||
105 | +++ b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts | ||
106 | @@ -34,7 +34,6 @@ | ||
107 | }; | ||
108 | |||
109 | serial@12000 { | ||
110 | - clock-frequency = <200000000>; | ||
111 | status = "ok"; | ||
112 | }; | ||
113 | |||
114 | diff --git a/arch/arm/boot/dts/kirkwood-lschlv2.dts b/arch/arm/boot/dts/kirkwood-lschlv2.dts | ||
115 | index 9510c9e..9f55d95 100644 | ||
116 | --- a/arch/arm/boot/dts/kirkwood-lschlv2.dts | ||
117 | +++ b/arch/arm/boot/dts/kirkwood-lschlv2.dts | ||
118 | @@ -13,7 +13,6 @@ | ||
119 | |||
120 | ocp@f1000000 { | ||
121 | serial@12000 { | ||
122 | - clock-frequency = <166666667>; | ||
123 | status = "okay"; | ||
124 | }; | ||
125 | }; | ||
126 | diff --git a/arch/arm/boot/dts/kirkwood-lsxhl.dts b/arch/arm/boot/dts/kirkwood-lsxhl.dts | ||
127 | index 739019c..5c84c11 100644 | ||
128 | --- a/arch/arm/boot/dts/kirkwood-lsxhl.dts | ||
129 | +++ b/arch/arm/boot/dts/kirkwood-lsxhl.dts | ||
130 | @@ -13,7 +13,6 @@ | ||
131 | |||
132 | ocp@f1000000 { | ||
133 | serial@12000 { | ||
134 | - clock-frequency = <200000000>; | ||
135 | status = "okay"; | ||
136 | }; | ||
137 | }; | ||
138 | diff --git a/arch/arm/boot/dts/kirkwood-mplcec4.dts b/arch/arm/boot/dts/kirkwood-mplcec4.dts | ||
139 | index 262c654..07be213 100644 | ||
140 | --- a/arch/arm/boot/dts/kirkwood-mplcec4.dts | ||
141 | +++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts | ||
142 | @@ -91,7 +91,6 @@ | ||
143 | }; | ||
144 | |||
145 | serial@12000 { | ||
146 | - clock-frequency = <200000000>; | ||
147 | status = "ok"; | ||
148 | }; | ||
149 | |||
150 | diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi | ||
151 | index 77d21ab..f0245c1 100644 | ||
152 | --- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi | ||
153 | +++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi | ||
154 | @@ -23,7 +23,6 @@ | ||
155 | }; | ||
156 | |||
157 | serial@12000 { | ||
158 | - clock-frequency = <166666667>; | ||
159 | status = "okay"; | ||
160 | }; | ||
161 | |||
162 | diff --git a/arch/arm/boot/dts/kirkwood-nsa310.dts b/arch/arm/boot/dts/kirkwood-nsa310.dts | ||
163 | index 5509f96..28d05e4 100644 | ||
164 | --- a/arch/arm/boot/dts/kirkwood-nsa310.dts | ||
165 | +++ b/arch/arm/boot/dts/kirkwood-nsa310.dts | ||
166 | @@ -18,7 +18,6 @@ | ||
167 | ocp@f1000000 { | ||
168 | |||
169 | serial@12000 { | ||
170 | - clock-frequency = <200000000>; | ||
171 | status = "ok"; | ||
172 | }; | ||
173 | |||
174 | diff --git a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts | ||
175 | index 49d3d74..f3cc7c4 100644 | ||
176 | --- a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts | ||
177 | +++ b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts | ||
178 | @@ -18,12 +18,10 @@ | ||
179 | |||
180 | ocp@f1000000 { | ||
181 | serial@12000 { | ||
182 | - clock-frequency = <200000000>; | ||
183 | status = "ok"; | ||
184 | }; | ||
185 | |||
186 | serial@12100 { | ||
187 | - clock-frequency = <200000000>; | ||
188 | status = "ok"; | ||
189 | }; | ||
190 | |||
191 | diff --git a/arch/arm/boot/dts/kirkwood-topkick.dts b/arch/arm/boot/dts/kirkwood-topkick.dts | ||
192 | index cd15452..7dd19ff 100644 | ||
193 | --- a/arch/arm/boot/dts/kirkwood-topkick.dts | ||
194 | +++ b/arch/arm/boot/dts/kirkwood-topkick.dts | ||
195 | @@ -17,7 +17,6 @@ | ||
196 | |||
197 | ocp@f1000000 { | ||
198 | serial@12000 { | ||
199 | - clock-frequency = <200000000>; | ||
200 | status = "ok"; | ||
201 | }; | ||
202 | |||
203 | diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi | ||
204 | index d6ab442..ad26d92 100644 | ||
205 | --- a/arch/arm/boot/dts/kirkwood.dtsi | ||
206 | +++ b/arch/arm/boot/dts/kirkwood.dtsi | ||
207 | @@ -38,6 +38,7 @@ | ||
208 | interrupt-controller; | ||
209 | #interrupt-cells = <2>; | ||
210 | interrupts = <35>, <36>, <37>, <38>; | ||
211 | + clocks = <&gate_clk 7>; | ||
212 | }; | ||
213 | |||
214 | gpio1: gpio@10140 { | ||
215 | @@ -49,6 +50,7 @@ | ||
216 | interrupt-controller; | ||
217 | #interrupt-cells = <2>; | ||
218 | interrupts = <39>, <40>, <41>; | ||
219 | + clocks = <&gate_clk 7>; | ||
220 | }; | ||
221 | |||
222 | serial@12000 { | ||
223 | @@ -57,7 +59,6 @@ | ||
224 | reg-shift = <2>; | ||
225 | interrupts = <33>; | ||
226 | clocks = <&gate_clk 7>; | ||
227 | - /* set clock-frequency in board dts */ | ||
228 | status = "disabled"; | ||
229 | }; | ||
230 | |||
231 | @@ -67,7 +68,6 @@ | ||
232 | reg-shift = <2>; | ||
233 | interrupts = <34>; | ||
234 | clocks = <&gate_clk 7>; | ||
235 | - /* set clock-frequency in board dts */ | ||
236 | status = "disabled"; | ||
237 | }; | ||
238 | |||
239 | @@ -75,6 +75,7 @@ | ||
240 | compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc"; | ||
241 | reg = <0x10300 0x20>; | ||
242 | interrupts = <53>; | ||
243 | + clocks = <&gate_clk 7>; | ||
244 | }; | ||
245 | |||
246 | spi@10600 { | ||
247 | diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig | ||
248 | index 7bf5351..a55b206 100644 | ||
249 | --- a/arch/arm/configs/mxs_defconfig | ||
250 | +++ b/arch/arm/configs/mxs_defconfig | ||
251 | @@ -118,6 +118,7 @@ CONFIG_FRAMEBUFFER_CONSOLE=y | ||
252 | CONFIG_FONTS=y | ||
253 | CONFIG_LOGO=y | ||
254 | CONFIG_USB=y | ||
255 | +CONFIG_USB_EHCI_HCD=y | ||
256 | CONFIG_USB_CHIPIDEA=y | ||
257 | CONFIG_USB_CHIPIDEA_HOST=y | ||
258 | CONFIG_USB_STORAGE=y | ||
259 | diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h | ||
260 | index ab98fdd..720799f 100644 | ||
261 | --- a/arch/arm/include/asm/delay.h | ||
262 | +++ b/arch/arm/include/asm/delay.h | ||
263 | @@ -24,6 +24,7 @@ extern struct arm_delay_ops { | ||
264 | void (*delay)(unsigned long); | ||
265 | void (*const_udelay)(unsigned long); | ||
266 | void (*udelay)(unsigned long); | ||
267 | + bool const_clock; | ||
268 | } arm_delay_ops; | ||
269 | |||
270 | #define __delay(n) arm_delay_ops.delay(n) | ||
271 | diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h | ||
272 | index 9f77e78..e3d5554 100644 | ||
273 | --- a/arch/arm/include/asm/mmu.h | ||
274 | +++ b/arch/arm/include/asm/mmu.h | ||
275 | @@ -5,15 +5,15 @@ | ||
276 | |||
277 | typedef struct { | ||
278 | #ifdef CONFIG_CPU_HAS_ASID | ||
279 | - u64 id; | ||
280 | + atomic64_t id; | ||
281 | #endif | ||
282 | - unsigned int vmalloc_seq; | ||
283 | + unsigned int vmalloc_seq; | ||
284 | } mm_context_t; | ||
285 | |||
286 | #ifdef CONFIG_CPU_HAS_ASID | ||
287 | #define ASID_BITS 8 | ||
288 | #define ASID_MASK ((~0ULL) << ASID_BITS) | ||
289 | -#define ASID(mm) ((mm)->context.id & ~ASID_MASK) | ||
290 | +#define ASID(mm) ((mm)->context.id.counter & ~ASID_MASK) | ||
291 | #else | ||
292 | #define ASID(mm) (0) | ||
293 | #endif | ||
294 | @@ -26,7 +26,7 @@ typedef struct { | ||
295 | * modified for 2.6 by Hyok S. Choi <hyok.choi@samsung.com> | ||
296 | */ | ||
297 | typedef struct { | ||
298 | - unsigned long end_brk; | ||
299 | + unsigned long end_brk; | ||
300 | } mm_context_t; | ||
301 | |||
302 | #endif | ||
303 | diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h | ||
304 | index e1f644b..863a661 100644 | ||
305 | --- a/arch/arm/include/asm/mmu_context.h | ||
306 | +++ b/arch/arm/include/asm/mmu_context.h | ||
307 | @@ -25,7 +25,7 @@ void __check_vmalloc_seq(struct mm_struct *mm); | ||
308 | #ifdef CONFIG_CPU_HAS_ASID | ||
309 | |||
310 | void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk); | ||
311 | -#define init_new_context(tsk,mm) ({ mm->context.id = 0; }) | ||
312 | +#define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; }) | ||
313 | |||
314 | #else /* !CONFIG_CPU_HAS_ASID */ | ||
315 | |||
316 | diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h | ||
317 | index 9c82f988..c094749 100644 | ||
318 | --- a/arch/arm/include/asm/pgtable.h | ||
319 | +++ b/arch/arm/include/asm/pgtable.h | ||
320 | @@ -240,7 +240,8 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; } | ||
321 | |||
322 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
323 | { | ||
324 | - const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER | L_PTE_NONE; | ||
325 | + const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER | | ||
326 | + L_PTE_NONE | L_PTE_VALID; | ||
327 | pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); | ||
328 | return pte; | ||
329 | } | ||
330 | diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c | ||
331 | index c985b48..cf10d18 100644 | ||
332 | --- a/arch/arm/kernel/asm-offsets.c | ||
333 | +++ b/arch/arm/kernel/asm-offsets.c | ||
334 | @@ -107,7 +107,7 @@ int main(void) | ||
335 | BLANK(); | ||
336 | #endif | ||
337 | #ifdef CONFIG_CPU_HAS_ASID | ||
338 | - DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id)); | ||
339 | + DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id.counter)); | ||
340 | BLANK(); | ||
341 | #endif | ||
342 | DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm)); | ||
343 | diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S | ||
344 | index 486a15a..e0eb9a1 100644 | ||
345 | --- a/arch/arm/kernel/head.S | ||
346 | +++ b/arch/arm/kernel/head.S | ||
347 | @@ -184,13 +184,22 @@ __create_page_tables: | ||
348 | orr r3, r3, #3 @ PGD block type | ||
349 | mov r6, #4 @ PTRS_PER_PGD | ||
350 | mov r7, #1 << (55 - 32) @ L_PGD_SWAPPER | ||
351 | -1: str r3, [r0], #4 @ set bottom PGD entry bits | ||
352 | +1: | ||
353 | +#ifdef CONFIG_CPU_ENDIAN_BE8 | ||
354 | str r7, [r0], #4 @ set top PGD entry bits | ||
355 | + str r3, [r0], #4 @ set bottom PGD entry bits | ||
356 | +#else | ||
357 | + str r3, [r0], #4 @ set bottom PGD entry bits | ||
358 | + str r7, [r0], #4 @ set top PGD entry bits | ||
359 | +#endif | ||
360 | add r3, r3, #0x1000 @ next PMD table | ||
361 | subs r6, r6, #1 | ||
362 | bne 1b | ||
363 | |||
364 | add r4, r4, #0x1000 @ point to the PMD tables | ||
365 | +#ifdef CONFIG_CPU_ENDIAN_BE8 | ||
366 | + add r4, r4, #4 @ we only write the bottom word | ||
367 | +#endif | ||
368 | #endif | ||
369 | |||
370 | ldr r7, [r10, #PROCINFO_MM_MMUFLAGS] @ mm_mmuflags | ||
371 | @@ -258,6 +267,11 @@ __create_page_tables: | ||
372 | addne r6, r6, #1 << SECTION_SHIFT | ||
373 | strne r6, [r3] | ||
374 | |||
375 | +#if defined(CONFIG_LPAE) && defined(CONFIG_CPU_ENDIAN_BE8) | ||
376 | + sub r4, r4, #4 @ Fixup page table pointer | ||
377 | + @ for 64-bit descriptors | ||
378 | +#endif | ||
379 | + | ||
380 | #ifdef CONFIG_DEBUG_LL | ||
381 | #if !defined(CONFIG_DEBUG_ICEDCC) && !defined(CONFIG_DEBUG_SEMIHOSTING) | ||
382 | /* | ||
383 | @@ -276,13 +290,17 @@ __create_page_tables: | ||
384 | orr r3, r7, r3, lsl #SECTION_SHIFT | ||
385 | #ifdef CONFIG_ARM_LPAE | ||
386 | mov r7, #1 << (54 - 32) @ XN | ||
387 | +#ifdef CONFIG_CPU_ENDIAN_BE8 | ||
388 | + str r7, [r0], #4 | ||
389 | + str r3, [r0], #4 | ||
390 | #else | ||
391 | - orr r3, r3, #PMD_SECT_XN | ||
392 | -#endif | ||
393 | str r3, [r0], #4 | ||
394 | -#ifdef CONFIG_ARM_LPAE | ||
395 | str r7, [r0], #4 | ||
396 | #endif | ||
397 | +#else | ||
398 | + orr r3, r3, #PMD_SECT_XN | ||
399 | + str r3, [r0], #4 | ||
400 | +#endif | ||
401 | |||
402 | #else /* CONFIG_DEBUG_ICEDCC || CONFIG_DEBUG_SEMIHOSTING */ | ||
403 | /* we don't need any serial debugging mappings */ | ||
404 | diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c | ||
405 | index 4fbc757..89ede24 100644 | ||
406 | --- a/arch/arm/kernel/perf_event_v7.c | ||
407 | +++ b/arch/arm/kernel/perf_event_v7.c | ||
408 | @@ -774,7 +774,7 @@ static const unsigned armv7_a7_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] | ||
409 | /* | ||
410 | * PMXEVTYPER: Event selection reg | ||
411 | */ | ||
412 | -#define ARMV7_EVTYPE_MASK 0xc00000ff /* Mask for writable bits */ | ||
413 | +#define ARMV7_EVTYPE_MASK 0xc80000ff /* Mask for writable bits */ | ||
414 | #define ARMV7_EVTYPE_EVENT 0xff /* Mask for EVENT bits */ | ||
415 | |||
416 | /* | ||
417 | diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c | ||
418 | index 84f4cbf..58af91c 100644 | ||
419 | --- a/arch/arm/kernel/smp.c | ||
420 | +++ b/arch/arm/kernel/smp.c | ||
421 | @@ -693,6 +693,9 @@ static int cpufreq_callback(struct notifier_block *nb, | ||
422 | if (freq->flags & CPUFREQ_CONST_LOOPS) | ||
423 | return NOTIFY_OK; | ||
424 | |||
425 | + if (arm_delay_ops.const_clock) | ||
426 | + return NOTIFY_OK; | ||
427 | + | ||
428 | if (!per_cpu(l_p_j_ref, cpu)) { | ||
429 | per_cpu(l_p_j_ref, cpu) = | ||
430 | per_cpu(cpu_data, cpu).loops_per_jiffy; | ||
431 | diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c | ||
432 | index 0dc5385..6b93f6a 100644 | ||
433 | --- a/arch/arm/lib/delay.c | ||
434 | +++ b/arch/arm/lib/delay.c | ||
435 | @@ -77,6 +77,7 @@ void __init register_current_timer_delay(const struct delay_timer *timer) | ||
436 | arm_delay_ops.delay = __timer_delay; | ||
437 | arm_delay_ops.const_udelay = __timer_const_udelay; | ||
438 | arm_delay_ops.udelay = __timer_udelay; | ||
439 | + arm_delay_ops.const_clock = true; | ||
440 | delay_calibrated = true; | ||
441 | } else { | ||
442 | pr_info("Ignoring duplicate/late registration of read_current_timer delay\n"); | ||
443 | diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c | ||
444 | index b820eda..db26e2e 100644 | ||
445 | --- a/arch/arm/mm/alignment.c | ||
446 | +++ b/arch/arm/mm/alignment.c | ||
447 | @@ -749,7 +749,6 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | ||
448 | unsigned long instr = 0, instrptr; | ||
449 | int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs); | ||
450 | unsigned int type; | ||
451 | - mm_segment_t fs; | ||
452 | unsigned int fault; | ||
453 | u16 tinstr = 0; | ||
454 | int isize = 4; | ||
455 | @@ -760,16 +759,15 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | ||
456 | |||
457 | instrptr = instruction_pointer(regs); | ||
458 | |||
459 | - fs = get_fs(); | ||
460 | - set_fs(KERNEL_DS); | ||
461 | if (thumb_mode(regs)) { | ||
462 | - fault = __get_user(tinstr, (u16 *)(instrptr & ~1)); | ||
463 | + u16 *ptr = (u16 *)(instrptr & ~1); | ||
464 | + fault = probe_kernel_address(ptr, tinstr); | ||
465 | if (!fault) { | ||
466 | if (cpu_architecture() >= CPU_ARCH_ARMv7 && | ||
467 | IS_T32(tinstr)) { | ||
468 | /* Thumb-2 32-bit */ | ||
469 | u16 tinst2 = 0; | ||
470 | - fault = __get_user(tinst2, (u16 *)(instrptr+2)); | ||
471 | + fault = probe_kernel_address(ptr + 1, tinst2); | ||
472 | instr = (tinstr << 16) | tinst2; | ||
473 | thumb2_32b = 1; | ||
474 | } else { | ||
475 | @@ -778,8 +776,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | ||
476 | } | ||
477 | } | ||
478 | } else | ||
479 | - fault = __get_user(instr, (u32 *)instrptr); | ||
480 | - set_fs(fs); | ||
481 | + fault = probe_kernel_address(instrptr, instr); | ||
482 | |||
483 | if (fault) { | ||
484 | type = TYPE_FAULT; | ||
485 | diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c | ||
486 | index bc4a5e9..d07df17 100644 | ||
487 | --- a/arch/arm/mm/context.c | ||
488 | +++ b/arch/arm/mm/context.c | ||
489 | @@ -149,9 +149,9 @@ static int is_reserved_asid(u64 asid) | ||
490 | return 0; | ||
491 | } | ||
492 | |||
493 | -static void new_context(struct mm_struct *mm, unsigned int cpu) | ||
494 | +static u64 new_context(struct mm_struct *mm, unsigned int cpu) | ||
495 | { | ||
496 | - u64 asid = mm->context.id; | ||
497 | + u64 asid = atomic64_read(&mm->context.id); | ||
498 | u64 generation = atomic64_read(&asid_generation); | ||
499 | |||
500 | if (asid != 0 && is_reserved_asid(asid)) { | ||
501 | @@ -178,13 +178,14 @@ static void new_context(struct mm_struct *mm, unsigned int cpu) | ||
502 | cpumask_clear(mm_cpumask(mm)); | ||
503 | } | ||
504 | |||
505 | - mm->context.id = asid; | ||
506 | + return asid; | ||
507 | } | ||
508 | |||
509 | void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) | ||
510 | { | ||
511 | unsigned long flags; | ||
512 | unsigned int cpu = smp_processor_id(); | ||
513 | + u64 asid; | ||
514 | |||
515 | if (unlikely(mm->context.vmalloc_seq != init_mm.context.vmalloc_seq)) | ||
516 | __check_vmalloc_seq(mm); | ||
517 | @@ -195,20 +196,24 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) | ||
518 | */ | ||
519 | cpu_set_reserved_ttbr0(); | ||
520 | |||
521 | - if (!((mm->context.id ^ atomic64_read(&asid_generation)) >> ASID_BITS) | ||
522 | - && atomic64_xchg(&per_cpu(active_asids, cpu), mm->context.id)) | ||
523 | + asid = atomic64_read(&mm->context.id); | ||
524 | + if (!((asid ^ atomic64_read(&asid_generation)) >> ASID_BITS) | ||
525 | + && atomic64_xchg(&per_cpu(active_asids, cpu), asid)) | ||
526 | goto switch_mm_fastpath; | ||
527 | |||
528 | raw_spin_lock_irqsave(&cpu_asid_lock, flags); | ||
529 | /* Check that our ASID belongs to the current generation. */ | ||
530 | - if ((mm->context.id ^ atomic64_read(&asid_generation)) >> ASID_BITS) | ||
531 | - new_context(mm, cpu); | ||
532 | - | ||
533 | - atomic64_set(&per_cpu(active_asids, cpu), mm->context.id); | ||
534 | - cpumask_set_cpu(cpu, mm_cpumask(mm)); | ||
535 | + asid = atomic64_read(&mm->context.id); | ||
536 | + if ((asid ^ atomic64_read(&asid_generation)) >> ASID_BITS) { | ||
537 | + asid = new_context(mm, cpu); | ||
538 | + atomic64_set(&mm->context.id, asid); | ||
539 | + } | ||
540 | |||
541 | if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) | ||
542 | local_flush_tlb_all(); | ||
543 | + | ||
544 | + atomic64_set(&per_cpu(active_asids, cpu), asid); | ||
545 | + cpumask_set_cpu(cpu, mm_cpumask(mm)); | ||
546 | raw_spin_unlock_irqrestore(&cpu_asid_lock, flags); | ||
547 | |||
548 | switch_mm_fastpath: | ||
549 | diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c | ||
550 | index 3b44e0d..5dfbb0b 100644 | ||
551 | --- a/arch/arm/vfp/vfpmodule.c | ||
552 | +++ b/arch/arm/vfp/vfpmodule.c | ||
553 | @@ -413,7 +413,7 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs) | ||
554 | * If there isn't a second FP instruction, exit now. Note that | ||
555 | * the FPEXC.FP2V bit is valid only if FPEXC.EX is 1. | ||
556 | */ | ||
557 | - if (fpexc ^ (FPEXC_EX | FPEXC_FP2V)) | ||
558 | + if ((fpexc & (FPEXC_EX | FPEXC_FP2V)) != (FPEXC_EX | FPEXC_FP2V)) | ||
559 | goto exit; | ||
560 | |||
561 | /* | ||
562 | diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c | ||
563 | index 6da881b..8d97eb4 100644 | ||
564 | --- a/arch/powerpc/kernel/setup_64.c | ||
565 | +++ b/arch/powerpc/kernel/setup_64.c | ||
566 | @@ -156,6 +156,15 @@ early_param("smt-enabled", early_smt_enabled); | ||
567 | #define check_smt_enabled() | ||
568 | #endif /* CONFIG_SMP */ | ||
569 | |||
570 | +/** Fix up paca fields required for the boot cpu */ | ||
571 | +static void fixup_boot_paca(void) | ||
572 | +{ | ||
573 | + /* The boot cpu is started */ | ||
574 | + get_paca()->cpu_start = 1; | ||
575 | + /* Allow percpu accesses to work until we setup percpu data */ | ||
576 | + get_paca()->data_offset = 0; | ||
577 | +} | ||
578 | + | ||
579 | /* | ||
580 | * Early initialization entry point. This is called by head.S | ||
581 | * with MMU translation disabled. We rely on the "feature" of | ||
582 | @@ -185,6 +194,7 @@ void __init early_setup(unsigned long dt_ptr) | ||
583 | /* Assume we're on cpu 0 for now. Don't write to the paca yet! */ | ||
584 | initialise_paca(&boot_paca, 0); | ||
585 | setup_paca(&boot_paca); | ||
586 | + fixup_boot_paca(); | ||
587 | |||
588 | /* Initialize lockdep early or else spinlocks will blow */ | ||
589 | lockdep_init(); | ||
590 | @@ -205,11 +215,7 @@ void __init early_setup(unsigned long dt_ptr) | ||
591 | |||
592 | /* Now we know the logical id of our boot cpu, setup the paca. */ | ||
593 | setup_paca(&paca[boot_cpuid]); | ||
594 | - | ||
595 | - /* Fix up paca fields required for the boot cpu */ | ||
596 | - get_paca()->cpu_start = 1; | ||
597 | - /* Allow percpu accesses to "work" until we setup percpu data */ | ||
598 | - get_paca()->data_offset = 0; | ||
599 | + fixup_boot_paca(); | ||
600 | |||
601 | /* Probe the machine type */ | ||
602 | probe_machine(); | ||
603 | diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h | ||
604 | index 88f3c22..59e3574 100644 | ||
605 | --- a/arch/tile/include/asm/compat.h | ||
606 | +++ b/arch/tile/include/asm/compat.h | ||
607 | @@ -296,6 +296,9 @@ long compat_sys_sync_file_range2(int fd, unsigned int flags, | ||
608 | long compat_sys_fallocate(int fd, int mode, | ||
609 | u32 offset_lo, u32 offset_hi, | ||
610 | u32 len_lo, u32 len_hi); | ||
611 | +long compat_sys_llseek(unsigned int fd, unsigned int offset_high, | ||
612 | + unsigned int offset_low, loff_t __user * result, | ||
613 | + unsigned int origin); | ||
614 | |||
615 | /* Assembly trampoline to avoid clobbering r0. */ | ||
616 | long _compat_sys_rt_sigreturn(void); | ||
617 | diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c | ||
618 | index 7f72401..d8e3b7e 100644 | ||
619 | --- a/arch/tile/kernel/compat.c | ||
620 | +++ b/arch/tile/kernel/compat.c | ||
621 | @@ -76,6 +76,18 @@ long compat_sys_fallocate(int fd, int mode, | ||
622 | ((loff_t)len_hi << 32) | len_lo); | ||
623 | } | ||
624 | |||
625 | +/* | ||
626 | + * Avoid bug in generic sys_llseek() that specifies offset_high and | ||
627 | + * offset_low as "unsigned long", thus making it possible to pass | ||
628 | + * a sign-extended high 32 bits in offset_low. | ||
629 | + */ | ||
630 | +long compat_sys_llseek(unsigned int fd, unsigned int offset_high, | ||
631 | + unsigned int offset_low, loff_t __user * result, | ||
632 | + unsigned int origin) | ||
633 | +{ | ||
634 | + return sys_llseek(fd, offset_high, offset_low, result, origin); | ||
635 | +} | ||
636 | + | ||
637 | /* Provide the compat syscall number to call mapping. */ | ||
638 | #undef __SYSCALL | ||
639 | #define __SYSCALL(nr, call) [nr] = (call), | ||
640 | @@ -83,6 +95,7 @@ long compat_sys_fallocate(int fd, int mode, | ||
641 | /* See comments in sys.c */ | ||
642 | #define compat_sys_fadvise64_64 sys32_fadvise64_64 | ||
643 | #define compat_sys_readahead sys32_readahead | ||
644 | +#define sys_llseek compat_sys_llseek | ||
645 | |||
646 | /* Call the assembly trampolines where necessary. */ | ||
647 | #define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn | ||
648 | diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c | ||
649 | index 220a360..5bedbdd 100644 | ||
650 | --- a/arch/x86/kernel/kvmclock.c | ||
651 | +++ b/arch/x86/kernel/kvmclock.c | ||
652 | @@ -218,6 +218,9 @@ static void kvm_shutdown(void) | ||
653 | void __init kvmclock_init(void) | ||
654 | { | ||
655 | unsigned long mem; | ||
656 | + int size; | ||
657 | + | ||
658 | + size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS); | ||
659 | |||
660 | if (!kvm_para_available()) | ||
661 | return; | ||
662 | @@ -231,16 +234,14 @@ void __init kvmclock_init(void) | ||
663 | printk(KERN_INFO "kvm-clock: Using msrs %x and %x", | ||
664 | msr_kvm_system_time, msr_kvm_wall_clock); | ||
665 | |||
666 | - mem = memblock_alloc(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS, | ||
667 | - PAGE_SIZE); | ||
668 | + mem = memblock_alloc(size, PAGE_SIZE); | ||
669 | if (!mem) | ||
670 | return; | ||
671 | hv_clock = __va(mem); | ||
672 | |||
673 | if (kvm_register_clock("boot clock")) { | ||
674 | hv_clock = NULL; | ||
675 | - memblock_free(mem, | ||
676 | - sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS); | ||
677 | + memblock_free(mem, size); | ||
678 | return; | ||
679 | } | ||
680 | pv_time_ops.sched_clock = kvm_clock_read; | ||
681 | @@ -275,7 +276,7 @@ int __init kvm_setup_vsyscall_timeinfo(void) | ||
682 | struct pvclock_vcpu_time_info *vcpu_time; | ||
683 | unsigned int size; | ||
684 | |||
685 | - size = sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS; | ||
686 | + size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS); | ||
687 | |||
688 | preempt_disable(); | ||
689 | cpu = smp_processor_id(); | ||
690 | diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c | ||
691 | index 85c3959..2cb9470 100644 | ||
692 | --- a/arch/x86/kernel/pvclock.c | ||
693 | +++ b/arch/x86/kernel/pvclock.c | ||
694 | @@ -185,7 +185,7 @@ int __init pvclock_init_vsyscall(struct pvclock_vsyscall_time_info *i, | ||
695 | |||
696 | for (idx = 0; idx <= (PVCLOCK_FIXMAP_END-PVCLOCK_FIXMAP_BEGIN); idx++) { | ||
697 | __set_fixmap(PVCLOCK_FIXMAP_BEGIN + idx, | ||
698 | - __pa_symbol(i) + (idx*PAGE_SIZE), | ||
699 | + __pa(i) + (idx*PAGE_SIZE), | ||
700 | PAGE_KERNEL_VVAR); | ||
701 | } | ||
702 | |||
703 | diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c | ||
704 | index 56ab749..94e7662 100644 | ||
705 | --- a/arch/x86/pci/xen.c | ||
706 | +++ b/arch/x86/pci/xen.c | ||
707 | @@ -162,6 +162,9 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | ||
708 | struct msi_desc *msidesc; | ||
709 | int *v; | ||
710 | |||
711 | + if (type == PCI_CAP_ID_MSI && nvec > 1) | ||
712 | + return 1; | ||
713 | + | ||
714 | v = kzalloc(sizeof(int) * max(1, nvec), GFP_KERNEL); | ||
715 | if (!v) | ||
716 | return -ENOMEM; | ||
717 | @@ -220,6 +223,9 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | ||
718 | struct msi_desc *msidesc; | ||
719 | struct msi_msg msg; | ||
720 | |||
721 | + if (type == PCI_CAP_ID_MSI && nvec > 1) | ||
722 | + return 1; | ||
723 | + | ||
724 | list_for_each_entry(msidesc, &dev->msi_list, list) { | ||
725 | __read_msi_msg(msidesc, &msg); | ||
726 | pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) | | ||
727 | @@ -263,6 +269,9 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | ||
728 | int ret = 0; | ||
729 | struct msi_desc *msidesc; | ||
730 | |||
731 | + if (type == PCI_CAP_ID_MSI && nvec > 1) | ||
732 | + return 1; | ||
733 | + | ||
734 | list_for_each_entry(msidesc, &dev->msi_list, list) { | ||
735 | struct physdev_map_pirq map_irq; | ||
736 | domid_t domid; | ||
737 | diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c | ||
738 | index e014092..2262003 100644 | ||
739 | --- a/arch/x86/xen/enlighten.c | ||
740 | +++ b/arch/x86/xen/enlighten.c | ||
741 | @@ -67,6 +67,7 @@ | ||
742 | #include <asm/hypervisor.h> | ||
743 | #include <asm/mwait.h> | ||
744 | #include <asm/pci_x86.h> | ||
745 | +#include <asm/pat.h> | ||
746 | |||
747 | #ifdef CONFIG_ACPI | ||
748 | #include <linux/acpi.h> | ||
749 | @@ -1417,7 +1418,14 @@ asmlinkage void __init xen_start_kernel(void) | ||
750 | */ | ||
751 | acpi_numa = -1; | ||
752 | #endif | ||
753 | - | ||
754 | +#ifdef CONFIG_X86_PAT | ||
755 | + /* | ||
756 | + * For right now disable the PAT. We should remove this once | ||
757 | + * git commit 8eaffa67b43e99ae581622c5133e20b0f48bcef1 | ||
758 | + * (xen/pat: Disable PAT support for now) is reverted. | ||
759 | + */ | ||
760 | + pat_enabled = 0; | ||
761 | +#endif | ||
762 | /* Don't do the full vcpu_info placement stuff until we have a | ||
763 | possible map and a non-dummy shared_info. */ | ||
764 | per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; | ||
765 | diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c | ||
766 | index 533de95..7d4a8d2 100644 | ||
767 | --- a/crypto/ablkcipher.c | ||
768 | +++ b/crypto/ablkcipher.c | ||
769 | @@ -388,9 +388,9 @@ static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
770 | { | ||
771 | struct crypto_report_blkcipher rblkcipher; | ||
772 | |||
773 | - snprintf(rblkcipher.type, CRYPTO_MAX_ALG_NAME, "%s", "ablkcipher"); | ||
774 | - snprintf(rblkcipher.geniv, CRYPTO_MAX_ALG_NAME, "%s", | ||
775 | - alg->cra_ablkcipher.geniv ?: "<default>"); | ||
776 | + strncpy(rblkcipher.type, "ablkcipher", sizeof(rblkcipher.type)); | ||
777 | + strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<default>", | ||
778 | + sizeof(rblkcipher.geniv)); | ||
779 | |||
780 | rblkcipher.blocksize = alg->cra_blocksize; | ||
781 | rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize; | ||
782 | @@ -469,9 +469,9 @@ static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
783 | { | ||
784 | struct crypto_report_blkcipher rblkcipher; | ||
785 | |||
786 | - snprintf(rblkcipher.type, CRYPTO_MAX_ALG_NAME, "%s", "givcipher"); | ||
787 | - snprintf(rblkcipher.geniv, CRYPTO_MAX_ALG_NAME, "%s", | ||
788 | - alg->cra_ablkcipher.geniv ?: "<built-in>"); | ||
789 | + strncpy(rblkcipher.type, "givcipher", sizeof(rblkcipher.type)); | ||
790 | + strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<built-in>", | ||
791 | + sizeof(rblkcipher.geniv)); | ||
792 | |||
793 | rblkcipher.blocksize = alg->cra_blocksize; | ||
794 | rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize; | ||
795 | diff --git a/crypto/aead.c b/crypto/aead.c | ||
796 | index 0b8121e..27bc487 100644 | ||
797 | --- a/crypto/aead.c | ||
798 | +++ b/crypto/aead.c | ||
799 | @@ -117,9 +117,8 @@ static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
800 | struct crypto_report_aead raead; | ||
801 | struct aead_alg *aead = &alg->cra_aead; | ||
802 | |||
803 | - snprintf(raead.type, CRYPTO_MAX_ALG_NAME, "%s", "aead"); | ||
804 | - snprintf(raead.geniv, CRYPTO_MAX_ALG_NAME, "%s", | ||
805 | - aead->geniv ?: "<built-in>"); | ||
806 | + strncpy(raead.type, "aead", sizeof(raead.type)); | ||
807 | + strncpy(raead.geniv, aead->geniv ?: "<built-in>", sizeof(raead.geniv)); | ||
808 | |||
809 | raead.blocksize = alg->cra_blocksize; | ||
810 | raead.maxauthsize = aead->maxauthsize; | ||
811 | @@ -203,8 +202,8 @@ static int crypto_nivaead_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
812 | struct crypto_report_aead raead; | ||
813 | struct aead_alg *aead = &alg->cra_aead; | ||
814 | |||
815 | - snprintf(raead.type, CRYPTO_MAX_ALG_NAME, "%s", "nivaead"); | ||
816 | - snprintf(raead.geniv, CRYPTO_MAX_ALG_NAME, "%s", aead->geniv); | ||
817 | + strncpy(raead.type, "nivaead", sizeof(raead.type)); | ||
818 | + strncpy(raead.geniv, aead->geniv, sizeof(raead.geniv)); | ||
819 | |||
820 | raead.blocksize = alg->cra_blocksize; | ||
821 | raead.maxauthsize = aead->maxauthsize; | ||
822 | diff --git a/crypto/ahash.c b/crypto/ahash.c | ||
823 | index 3887856..793a27f 100644 | ||
824 | --- a/crypto/ahash.c | ||
825 | +++ b/crypto/ahash.c | ||
826 | @@ -404,7 +404,7 @@ static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
827 | { | ||
828 | struct crypto_report_hash rhash; | ||
829 | |||
830 | - snprintf(rhash.type, CRYPTO_MAX_ALG_NAME, "%s", "ahash"); | ||
831 | + strncpy(rhash.type, "ahash", sizeof(rhash.type)); | ||
832 | |||
833 | rhash.blocksize = alg->cra_blocksize; | ||
834 | rhash.digestsize = __crypto_hash_alg_common(alg)->digestsize; | ||
835 | diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c | ||
836 | index a8d85a1..c44e014 100644 | ||
837 | --- a/crypto/blkcipher.c | ||
838 | +++ b/crypto/blkcipher.c | ||
839 | @@ -499,9 +499,9 @@ static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
840 | { | ||
841 | struct crypto_report_blkcipher rblkcipher; | ||
842 | |||
843 | - snprintf(rblkcipher.type, CRYPTO_MAX_ALG_NAME, "%s", "blkcipher"); | ||
844 | - snprintf(rblkcipher.geniv, CRYPTO_MAX_ALG_NAME, "%s", | ||
845 | - alg->cra_blkcipher.geniv ?: "<default>"); | ||
846 | + strncpy(rblkcipher.type, "blkcipher", sizeof(rblkcipher.type)); | ||
847 | + strncpy(rblkcipher.geniv, alg->cra_blkcipher.geniv ?: "<default>", | ||
848 | + sizeof(rblkcipher.geniv)); | ||
849 | |||
850 | rblkcipher.blocksize = alg->cra_blocksize; | ||
851 | rblkcipher.min_keysize = alg->cra_blkcipher.min_keysize; | ||
852 | diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c | ||
853 | index 35d700a..f6d9baf 100644 | ||
854 | --- a/crypto/crypto_user.c | ||
855 | +++ b/crypto/crypto_user.c | ||
856 | @@ -75,7 +75,7 @@ static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg) | ||
857 | { | ||
858 | struct crypto_report_cipher rcipher; | ||
859 | |||
860 | - snprintf(rcipher.type, CRYPTO_MAX_ALG_NAME, "%s", "cipher"); | ||
861 | + strncpy(rcipher.type, "cipher", sizeof(rcipher.type)); | ||
862 | |||
863 | rcipher.blocksize = alg->cra_blocksize; | ||
864 | rcipher.min_keysize = alg->cra_cipher.cia_min_keysize; | ||
865 | @@ -94,8 +94,7 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg) | ||
866 | { | ||
867 | struct crypto_report_comp rcomp; | ||
868 | |||
869 | - snprintf(rcomp.type, CRYPTO_MAX_ALG_NAME, "%s", "compression"); | ||
870 | - | ||
871 | + strncpy(rcomp.type, "compression", sizeof(rcomp.type)); | ||
872 | if (nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS, | ||
873 | sizeof(struct crypto_report_comp), &rcomp)) | ||
874 | goto nla_put_failure; | ||
875 | @@ -108,12 +107,14 @@ nla_put_failure: | ||
876 | static int crypto_report_one(struct crypto_alg *alg, | ||
877 | struct crypto_user_alg *ualg, struct sk_buff *skb) | ||
878 | { | ||
879 | - memcpy(&ualg->cru_name, &alg->cra_name, sizeof(ualg->cru_name)); | ||
880 | - memcpy(&ualg->cru_driver_name, &alg->cra_driver_name, | ||
881 | - sizeof(ualg->cru_driver_name)); | ||
882 | - memcpy(&ualg->cru_module_name, module_name(alg->cra_module), | ||
883 | - CRYPTO_MAX_ALG_NAME); | ||
884 | - | ||
885 | + strncpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name)); | ||
886 | + strncpy(ualg->cru_driver_name, alg->cra_driver_name, | ||
887 | + sizeof(ualg->cru_driver_name)); | ||
888 | + strncpy(ualg->cru_module_name, module_name(alg->cra_module), | ||
889 | + sizeof(ualg->cru_module_name)); | ||
890 | + | ||
891 | + ualg->cru_type = 0; | ||
892 | + ualg->cru_mask = 0; | ||
893 | ualg->cru_flags = alg->cra_flags; | ||
894 | ualg->cru_refcnt = atomic_read(&alg->cra_refcnt); | ||
895 | |||
896 | @@ -122,8 +123,7 @@ static int crypto_report_one(struct crypto_alg *alg, | ||
897 | if (alg->cra_flags & CRYPTO_ALG_LARVAL) { | ||
898 | struct crypto_report_larval rl; | ||
899 | |||
900 | - snprintf(rl.type, CRYPTO_MAX_ALG_NAME, "%s", "larval"); | ||
901 | - | ||
902 | + strncpy(rl.type, "larval", sizeof(rl.type)); | ||
903 | if (nla_put(skb, CRYPTOCFGA_REPORT_LARVAL, | ||
904 | sizeof(struct crypto_report_larval), &rl)) | ||
905 | goto nla_put_failure; | ||
906 | diff --git a/crypto/pcompress.c b/crypto/pcompress.c | ||
907 | index 04e083f..7140fe7 100644 | ||
908 | --- a/crypto/pcompress.c | ||
909 | +++ b/crypto/pcompress.c | ||
910 | @@ -53,8 +53,7 @@ static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
911 | { | ||
912 | struct crypto_report_comp rpcomp; | ||
913 | |||
914 | - snprintf(rpcomp.type, CRYPTO_MAX_ALG_NAME, "%s", "pcomp"); | ||
915 | - | ||
916 | + strncpy(rpcomp.type, "pcomp", sizeof(rpcomp.type)); | ||
917 | if (nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS, | ||
918 | sizeof(struct crypto_report_comp), &rpcomp)) | ||
919 | goto nla_put_failure; | ||
920 | diff --git a/crypto/rng.c b/crypto/rng.c | ||
921 | index f3b7894..e0a25c2 100644 | ||
922 | --- a/crypto/rng.c | ||
923 | +++ b/crypto/rng.c | ||
924 | @@ -65,7 +65,7 @@ static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
925 | { | ||
926 | struct crypto_report_rng rrng; | ||
927 | |||
928 | - snprintf(rrng.type, CRYPTO_MAX_ALG_NAME, "%s", "rng"); | ||
929 | + strncpy(rrng.type, "rng", sizeof(rrng.type)); | ||
930 | |||
931 | rrng.seedsize = alg->cra_rng.seedsize; | ||
932 | |||
933 | diff --git a/crypto/shash.c b/crypto/shash.c | ||
934 | index f426330f..929058a 100644 | ||
935 | --- a/crypto/shash.c | ||
936 | +++ b/crypto/shash.c | ||
937 | @@ -530,7 +530,8 @@ static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg) | ||
938 | struct crypto_report_hash rhash; | ||
939 | struct shash_alg *salg = __crypto_shash_alg(alg); | ||
940 | |||
941 | - snprintf(rhash.type, CRYPTO_MAX_ALG_NAME, "%s", "shash"); | ||
942 | + strncpy(rhash.type, "shash", sizeof(rhash.type)); | ||
943 | + | ||
944 | rhash.blocksize = alg->cra_blocksize; | ||
945 | rhash.digestsize = salg->digestsize; | ||
946 | |||
947 | diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c | ||
948 | index de1f319..e34a7b4 100644 | ||
949 | --- a/drivers/block/xen-blkback/blkback.c | ||
950 | +++ b/drivers/block/xen-blkback/blkback.c | ||
951 | @@ -881,6 +881,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | ||
952 | goto fail_response; | ||
953 | } | ||
954 | |||
955 | + preq.dev = req->u.rw.handle; | ||
956 | preq.sector_number = req->u.rw.sector_number; | ||
957 | preq.nr_sects = 0; | ||
958 | |||
959 | diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c | ||
960 | index 1bafb40..69ae597 100644 | ||
961 | --- a/drivers/char/hw_random/core.c | ||
962 | +++ b/drivers/char/hw_random/core.c | ||
963 | @@ -40,6 +40,7 @@ | ||
964 | #include <linux/init.h> | ||
965 | #include <linux/miscdevice.h> | ||
966 | #include <linux/delay.h> | ||
967 | +#include <linux/slab.h> | ||
968 | #include <asm/uaccess.h> | ||
969 | |||
970 | |||
971 | @@ -52,8 +53,12 @@ static struct hwrng *current_rng; | ||
972 | static LIST_HEAD(rng_list); | ||
973 | static DEFINE_MUTEX(rng_mutex); | ||
974 | static int data_avail; | ||
975 | -static u8 rng_buffer[SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES] | ||
976 | - __cacheline_aligned; | ||
977 | +static u8 *rng_buffer; | ||
978 | + | ||
979 | +static size_t rng_buffer_size(void) | ||
980 | +{ | ||
981 | + return SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES; | ||
982 | +} | ||
983 | |||
984 | static inline int hwrng_init(struct hwrng *rng) | ||
985 | { | ||
986 | @@ -116,7 +121,7 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf, | ||
987 | |||
988 | if (!data_avail) { | ||
989 | bytes_read = rng_get_data(current_rng, rng_buffer, | ||
990 | - sizeof(rng_buffer), | ||
991 | + rng_buffer_size(), | ||
992 | !(filp->f_flags & O_NONBLOCK)); | ||
993 | if (bytes_read < 0) { | ||
994 | err = bytes_read; | ||
995 | @@ -307,6 +312,14 @@ int hwrng_register(struct hwrng *rng) | ||
996 | |||
997 | mutex_lock(&rng_mutex); | ||
998 | |||
999 | + /* kmalloc makes this safe for virt_to_page() in virtio_rng.c */ | ||
1000 | + err = -ENOMEM; | ||
1001 | + if (!rng_buffer) { | ||
1002 | + rng_buffer = kmalloc(rng_buffer_size(), GFP_KERNEL); | ||
1003 | + if (!rng_buffer) | ||
1004 | + goto out_unlock; | ||
1005 | + } | ||
1006 | + | ||
1007 | /* Must not register two RNGs with the same name. */ | ||
1008 | err = -EEXIST; | ||
1009 | list_for_each_entry(tmp, &rng_list, list) { | ||
1010 | diff --git a/drivers/char/random.c b/drivers/char/random.c | ||
1011 | index 85e81ec..57d4b15 100644 | ||
1012 | --- a/drivers/char/random.c | ||
1013 | +++ b/drivers/char/random.c | ||
1014 | @@ -852,6 +852,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, | ||
1015 | int reserved) | ||
1016 | { | ||
1017 | unsigned long flags; | ||
1018 | + int wakeup_write = 0; | ||
1019 | |||
1020 | /* Hold lock while accounting */ | ||
1021 | spin_lock_irqsave(&r->lock, flags); | ||
1022 | @@ -873,10 +874,8 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, | ||
1023 | else | ||
1024 | r->entropy_count = reserved; | ||
1025 | |||
1026 | - if (r->entropy_count < random_write_wakeup_thresh) { | ||
1027 | - wake_up_interruptible(&random_write_wait); | ||
1028 | - kill_fasync(&fasync, SIGIO, POLL_OUT); | ||
1029 | - } | ||
1030 | + if (r->entropy_count < random_write_wakeup_thresh) | ||
1031 | + wakeup_write = 1; | ||
1032 | } | ||
1033 | |||
1034 | DEBUG_ENT("debiting %zu entropy credits from %s%s\n", | ||
1035 | @@ -884,6 +883,11 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, | ||
1036 | |||
1037 | spin_unlock_irqrestore(&r->lock, flags); | ||
1038 | |||
1039 | + if (wakeup_write) { | ||
1040 | + wake_up_interruptible(&random_write_wait); | ||
1041 | + kill_fasync(&fasync, SIGIO, POLL_OUT); | ||
1042 | + } | ||
1043 | + | ||
1044 | return nbytes; | ||
1045 | } | ||
1046 | |||
1047 | diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c | ||
1048 | index fce2000..1110478 100644 | ||
1049 | --- a/drivers/connector/cn_proc.c | ||
1050 | +++ b/drivers/connector/cn_proc.c | ||
1051 | @@ -313,6 +313,12 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg, | ||
1052 | (task_active_pid_ns(current) != &init_pid_ns)) | ||
1053 | return; | ||
1054 | |||
1055 | + /* Can only change if privileged. */ | ||
1056 | + if (!capable(CAP_NET_ADMIN)) { | ||
1057 | + err = EPERM; | ||
1058 | + goto out; | ||
1059 | + } | ||
1060 | + | ||
1061 | mc_op = (enum proc_cn_mcast_op *)msg->data; | ||
1062 | switch (*mc_op) { | ||
1063 | case PROC_CN_MCAST_LISTEN: | ||
1064 | @@ -325,6 +331,8 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg, | ||
1065 | err = EINVAL; | ||
1066 | break; | ||
1067 | } | ||
1068 | + | ||
1069 | +out: | ||
1070 | cn_proc_ack(err, msg->seq, msg->ack); | ||
1071 | } | ||
1072 | |||
1073 | diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c | ||
1074 | index 982f1f5..4cd392d 100644 | ||
1075 | --- a/drivers/firmware/dmi_scan.c | ||
1076 | +++ b/drivers/firmware/dmi_scan.c | ||
1077 | @@ -442,7 +442,6 @@ static int __init dmi_present(const char __iomem *p) | ||
1078 | static int __init smbios_present(const char __iomem *p) | ||
1079 | { | ||
1080 | u8 buf[32]; | ||
1081 | - int offset = 0; | ||
1082 | |||
1083 | memcpy_fromio(buf, p, 32); | ||
1084 | if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) { | ||
1085 | @@ -461,9 +460,9 @@ static int __init smbios_present(const char __iomem *p) | ||
1086 | dmi_ver = 0x0206; | ||
1087 | break; | ||
1088 | } | ||
1089 | - offset = 16; | ||
1090 | + return memcmp(p + 16, "_DMI_", 5) || dmi_present(p + 16); | ||
1091 | } | ||
1092 | - return dmi_present(buf + offset); | ||
1093 | + return 1; | ||
1094 | } | ||
1095 | |||
1096 | void __init dmi_scan_machine(void) | ||
1097 | diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c | ||
1098 | index bcb201c..2a2e145 100644 | ||
1099 | --- a/drivers/firmware/efivars.c | ||
1100 | +++ b/drivers/firmware/efivars.c | ||
1101 | @@ -406,10 +406,11 @@ static efi_status_t | ||
1102 | get_var_data(struct efivars *efivars, struct efi_variable *var) | ||
1103 | { | ||
1104 | efi_status_t status; | ||
1105 | + unsigned long flags; | ||
1106 | |||
1107 | - spin_lock(&efivars->lock); | ||
1108 | + spin_lock_irqsave(&efivars->lock, flags); | ||
1109 | status = get_var_data_locked(efivars, var); | ||
1110 | - spin_unlock(&efivars->lock); | ||
1111 | + spin_unlock_irqrestore(&efivars->lock, flags); | ||
1112 | |||
1113 | if (status != EFI_SUCCESS) { | ||
1114 | printk(KERN_WARNING "efivars: get_variable() failed 0x%lx!\n", | ||
1115 | @@ -418,6 +419,44 @@ get_var_data(struct efivars *efivars, struct efi_variable *var) | ||
1116 | return status; | ||
1117 | } | ||
1118 | |||
1119 | +static efi_status_t | ||
1120 | +check_var_size_locked(struct efivars *efivars, u32 attributes, | ||
1121 | + unsigned long size) | ||
1122 | +{ | ||
1123 | + u64 storage_size, remaining_size, max_size; | ||
1124 | + efi_status_t status; | ||
1125 | + const struct efivar_operations *fops = efivars->ops; | ||
1126 | + | ||
1127 | + if (!efivars->ops->query_variable_info) | ||
1128 | + return EFI_UNSUPPORTED; | ||
1129 | + | ||
1130 | + status = fops->query_variable_info(attributes, &storage_size, | ||
1131 | + &remaining_size, &max_size); | ||
1132 | + | ||
1133 | + if (status != EFI_SUCCESS) | ||
1134 | + return status; | ||
1135 | + | ||
1136 | + if (!storage_size || size > remaining_size || size > max_size || | ||
1137 | + (remaining_size - size) < (storage_size / 2)) | ||
1138 | + return EFI_OUT_OF_RESOURCES; | ||
1139 | + | ||
1140 | + return status; | ||
1141 | +} | ||
1142 | + | ||
1143 | + | ||
1144 | +static efi_status_t | ||
1145 | +check_var_size(struct efivars *efivars, u32 attributes, unsigned long size) | ||
1146 | +{ | ||
1147 | + efi_status_t status; | ||
1148 | + unsigned long flags; | ||
1149 | + | ||
1150 | + spin_lock_irqsave(&efivars->lock, flags); | ||
1151 | + status = check_var_size_locked(efivars, attributes, size); | ||
1152 | + spin_unlock_irqrestore(&efivars->lock, flags); | ||
1153 | + | ||
1154 | + return status; | ||
1155 | +} | ||
1156 | + | ||
1157 | static ssize_t | ||
1158 | efivar_guid_read(struct efivar_entry *entry, char *buf) | ||
1159 | { | ||
1160 | @@ -538,14 +577,19 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count) | ||
1161 | return -EINVAL; | ||
1162 | } | ||
1163 | |||
1164 | - spin_lock(&efivars->lock); | ||
1165 | - status = efivars->ops->set_variable(new_var->VariableName, | ||
1166 | - &new_var->VendorGuid, | ||
1167 | - new_var->Attributes, | ||
1168 | - new_var->DataSize, | ||
1169 | - new_var->Data); | ||
1170 | + spin_lock_irq(&efivars->lock); | ||
1171 | + | ||
1172 | + status = check_var_size_locked(efivars, new_var->Attributes, | ||
1173 | + new_var->DataSize + utf16_strsize(new_var->VariableName, 1024)); | ||
1174 | |||
1175 | - spin_unlock(&efivars->lock); | ||
1176 | + if (status == EFI_SUCCESS || status == EFI_UNSUPPORTED) | ||
1177 | + status = efivars->ops->set_variable(new_var->VariableName, | ||
1178 | + &new_var->VendorGuid, | ||
1179 | + new_var->Attributes, | ||
1180 | + new_var->DataSize, | ||
1181 | + new_var->Data); | ||
1182 | + | ||
1183 | + spin_unlock_irq(&efivars->lock); | ||
1184 | |||
1185 | if (status != EFI_SUCCESS) { | ||
1186 | printk(KERN_WARNING "efivars: set_variable() failed: status=%lx\n", | ||
1187 | @@ -694,8 +738,7 @@ static ssize_t efivarfs_file_write(struct file *file, | ||
1188 | u32 attributes; | ||
1189 | struct inode *inode = file->f_mapping->host; | ||
1190 | unsigned long datasize = count - sizeof(attributes); | ||
1191 | - unsigned long newdatasize; | ||
1192 | - u64 storage_size, remaining_size, max_size; | ||
1193 | + unsigned long newdatasize, varsize; | ||
1194 | ssize_t bytes = 0; | ||
1195 | |||
1196 | if (count < sizeof(attributes)) | ||
1197 | @@ -714,28 +757,18 @@ static ssize_t efivarfs_file_write(struct file *file, | ||
1198 | * amounts of memory. Pick a default size of 64K if | ||
1199 | * QueryVariableInfo() isn't supported by the firmware. | ||
1200 | */ | ||
1201 | - spin_lock(&efivars->lock); | ||
1202 | |||
1203 | - if (!efivars->ops->query_variable_info) | ||
1204 | - status = EFI_UNSUPPORTED; | ||
1205 | - else { | ||
1206 | - const struct efivar_operations *fops = efivars->ops; | ||
1207 | - status = fops->query_variable_info(attributes, &storage_size, | ||
1208 | - &remaining_size, &max_size); | ||
1209 | - } | ||
1210 | - | ||
1211 | - spin_unlock(&efivars->lock); | ||
1212 | + varsize = datasize + utf16_strsize(var->var.VariableName, 1024); | ||
1213 | + status = check_var_size(efivars, attributes, varsize); | ||
1214 | |||
1215 | if (status != EFI_SUCCESS) { | ||
1216 | if (status != EFI_UNSUPPORTED) | ||
1217 | return efi_status_to_err(status); | ||
1218 | |||
1219 | - remaining_size = 65536; | ||
1220 | + if (datasize > 65536) | ||
1221 | + return -ENOSPC; | ||
1222 | } | ||
1223 | |||
1224 | - if (datasize > remaining_size) | ||
1225 | - return -ENOSPC; | ||
1226 | - | ||
1227 | data = kmalloc(datasize, GFP_KERNEL); | ||
1228 | if (!data) | ||
1229 | return -ENOMEM; | ||
1230 | @@ -755,7 +788,20 @@ static ssize_t efivarfs_file_write(struct file *file, | ||
1231 | * set_variable call, and removal of the variable from the efivars | ||
1232 | * list (in the case of an authenticated delete). | ||
1233 | */ | ||
1234 | - spin_lock(&efivars->lock); | ||
1235 | + spin_lock_irq(&efivars->lock); | ||
1236 | + | ||
1237 | + /* | ||
1238 | + * Ensure that the available space hasn't shrunk below the safe level | ||
1239 | + */ | ||
1240 | + | ||
1241 | + status = check_var_size_locked(efivars, attributes, varsize); | ||
1242 | + | ||
1243 | + if (status != EFI_SUCCESS && status != EFI_UNSUPPORTED) { | ||
1244 | + spin_unlock_irq(&efivars->lock); | ||
1245 | + kfree(data); | ||
1246 | + | ||
1247 | + return efi_status_to_err(status); | ||
1248 | + } | ||
1249 | |||
1250 | status = efivars->ops->set_variable(var->var.VariableName, | ||
1251 | &var->var.VendorGuid, | ||
1252 | @@ -763,7 +809,7 @@ static ssize_t efivarfs_file_write(struct file *file, | ||
1253 | data); | ||
1254 | |||
1255 | if (status != EFI_SUCCESS) { | ||
1256 | - spin_unlock(&efivars->lock); | ||
1257 | + spin_unlock_irq(&efivars->lock); | ||
1258 | kfree(data); | ||
1259 | |||
1260 | return efi_status_to_err(status); | ||
1261 | @@ -784,21 +830,21 @@ static ssize_t efivarfs_file_write(struct file *file, | ||
1262 | NULL); | ||
1263 | |||
1264 | if (status == EFI_BUFFER_TOO_SMALL) { | ||
1265 | - spin_unlock(&efivars->lock); | ||
1266 | + spin_unlock_irq(&efivars->lock); | ||
1267 | mutex_lock(&inode->i_mutex); | ||
1268 | i_size_write(inode, newdatasize + sizeof(attributes)); | ||
1269 | mutex_unlock(&inode->i_mutex); | ||
1270 | |||
1271 | } else if (status == EFI_NOT_FOUND) { | ||
1272 | list_del(&var->list); | ||
1273 | - spin_unlock(&efivars->lock); | ||
1274 | + spin_unlock_irq(&efivars->lock); | ||
1275 | efivar_unregister(var); | ||
1276 | drop_nlink(inode); | ||
1277 | d_delete(file->f_dentry); | ||
1278 | dput(file->f_dentry); | ||
1279 | |||
1280 | } else { | ||
1281 | - spin_unlock(&efivars->lock); | ||
1282 | + spin_unlock_irq(&efivars->lock); | ||
1283 | pr_warn("efivarfs: inconsistent EFI variable implementation? " | ||
1284 | "status = %lx\n", status); | ||
1285 | } | ||
1286 | @@ -820,11 +866,11 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf, | ||
1287 | void *data; | ||
1288 | ssize_t size = 0; | ||
1289 | |||
1290 | - spin_lock(&efivars->lock); | ||
1291 | + spin_lock_irq(&efivars->lock); | ||
1292 | status = efivars->ops->get_variable(var->var.VariableName, | ||
1293 | &var->var.VendorGuid, | ||
1294 | &attributes, &datasize, NULL); | ||
1295 | - spin_unlock(&efivars->lock); | ||
1296 | + spin_unlock_irq(&efivars->lock); | ||
1297 | |||
1298 | if (status != EFI_BUFFER_TOO_SMALL) | ||
1299 | return efi_status_to_err(status); | ||
1300 | @@ -834,12 +880,12 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf, | ||
1301 | if (!data) | ||
1302 | return -ENOMEM; | ||
1303 | |||
1304 | - spin_lock(&efivars->lock); | ||
1305 | + spin_lock_irq(&efivars->lock); | ||
1306 | status = efivars->ops->get_variable(var->var.VariableName, | ||
1307 | &var->var.VendorGuid, | ||
1308 | &attributes, &datasize, | ||
1309 | (data + sizeof(attributes))); | ||
1310 | - spin_unlock(&efivars->lock); | ||
1311 | + spin_unlock_irq(&efivars->lock); | ||
1312 | |||
1313 | if (status != EFI_SUCCESS) { | ||
1314 | size = efi_status_to_err(status); | ||
1315 | @@ -921,8 +967,8 @@ static bool efivarfs_valid_name(const char *str, int len) | ||
1316 | if (len < GUID_LEN + 2) | ||
1317 | return false; | ||
1318 | |||
1319 | - /* GUID should be right after the first '-' */ | ||
1320 | - if (s - 1 != strchr(str, '-')) | ||
1321 | + /* GUID must be preceded by a '-' */ | ||
1322 | + if (*(s - 1) != '-') | ||
1323 | return false; | ||
1324 | |||
1325 | /* | ||
1326 | @@ -1005,9 +1051,9 @@ static int efivarfs_create(struct inode *dir, struct dentry *dentry, | ||
1327 | goto out; | ||
1328 | |||
1329 | kobject_uevent(&var->kobj, KOBJ_ADD); | ||
1330 | - spin_lock(&efivars->lock); | ||
1331 | + spin_lock_irq(&efivars->lock); | ||
1332 | list_add(&var->list, &efivars->list); | ||
1333 | - spin_unlock(&efivars->lock); | ||
1334 | + spin_unlock_irq(&efivars->lock); | ||
1335 | d_instantiate(dentry, inode); | ||
1336 | dget(dentry); | ||
1337 | out: | ||
1338 | @@ -1024,7 +1070,7 @@ static int efivarfs_unlink(struct inode *dir, struct dentry *dentry) | ||
1339 | struct efivars *efivars = var->efivars; | ||
1340 | efi_status_t status; | ||
1341 | |||
1342 | - spin_lock(&efivars->lock); | ||
1343 | + spin_lock_irq(&efivars->lock); | ||
1344 | |||
1345 | status = efivars->ops->set_variable(var->var.VariableName, | ||
1346 | &var->var.VendorGuid, | ||
1347 | @@ -1032,14 +1078,14 @@ static int efivarfs_unlink(struct inode *dir, struct dentry *dentry) | ||
1348 | |||
1349 | if (status == EFI_SUCCESS || status == EFI_NOT_FOUND) { | ||
1350 | list_del(&var->list); | ||
1351 | - spin_unlock(&efivars->lock); | ||
1352 | + spin_unlock_irq(&efivars->lock); | ||
1353 | efivar_unregister(var); | ||
1354 | drop_nlink(dentry->d_inode); | ||
1355 | dput(dentry); | ||
1356 | return 0; | ||
1357 | } | ||
1358 | |||
1359 | - spin_unlock(&efivars->lock); | ||
1360 | + spin_unlock_irq(&efivars->lock); | ||
1361 | return -EINVAL; | ||
1362 | }; | ||
1363 | |||
1364 | @@ -1110,15 +1156,22 @@ static struct dentry_operations efivarfs_d_ops = { | ||
1365 | |||
1366 | static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) | ||
1367 | { | ||
1368 | + struct dentry *d; | ||
1369 | struct qstr q; | ||
1370 | + int err; | ||
1371 | |||
1372 | q.name = name; | ||
1373 | q.len = strlen(name); | ||
1374 | |||
1375 | - if (efivarfs_d_hash(NULL, NULL, &q)) | ||
1376 | - return NULL; | ||
1377 | + err = efivarfs_d_hash(NULL, NULL, &q); | ||
1378 | + if (err) | ||
1379 | + return ERR_PTR(err); | ||
1380 | |||
1381 | - return d_alloc(parent, &q); | ||
1382 | + d = d_alloc(parent, &q); | ||
1383 | + if (d) | ||
1384 | + return d; | ||
1385 | + | ||
1386 | + return ERR_PTR(-ENOMEM); | ||
1387 | } | ||
1388 | |||
1389 | static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) | ||
1390 | @@ -1128,6 +1181,7 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) | ||
1391 | struct efivar_entry *entry, *n; | ||
1392 | struct efivars *efivars = &__efivars; | ||
1393 | char *name; | ||
1394 | + int err = -ENOMEM; | ||
1395 | |||
1396 | efivarfs_sb = sb; | ||
1397 | |||
1398 | @@ -1178,19 +1232,21 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) | ||
1399 | goto fail_name; | ||
1400 | |||
1401 | dentry = efivarfs_alloc_dentry(root, name); | ||
1402 | - if (!dentry) | ||
1403 | + if (IS_ERR(dentry)) { | ||
1404 | + err = PTR_ERR(dentry); | ||
1405 | goto fail_inode; | ||
1406 | + } | ||
1407 | |||
1408 | /* copied by the above to local storage in the dentry. */ | ||
1409 | kfree(name); | ||
1410 | |||
1411 | - spin_lock(&efivars->lock); | ||
1412 | + spin_lock_irq(&efivars->lock); | ||
1413 | efivars->ops->get_variable(entry->var.VariableName, | ||
1414 | &entry->var.VendorGuid, | ||
1415 | &entry->var.Attributes, | ||
1416 | &size, | ||
1417 | NULL); | ||
1418 | - spin_unlock(&efivars->lock); | ||
1419 | + spin_unlock_irq(&efivars->lock); | ||
1420 | |||
1421 | mutex_lock(&inode->i_mutex); | ||
1422 | inode->i_private = entry; | ||
1423 | @@ -1206,7 +1262,7 @@ fail_inode: | ||
1424 | fail_name: | ||
1425 | kfree(name); | ||
1426 | fail: | ||
1427 | - return -ENOMEM; | ||
1428 | + return err; | ||
1429 | } | ||
1430 | |||
1431 | static struct dentry *efivarfs_mount(struct file_system_type *fs_type, | ||
1432 | @@ -1253,7 +1309,7 @@ static int efi_pstore_open(struct pstore_info *psi) | ||
1433 | { | ||
1434 | struct efivars *efivars = psi->data; | ||
1435 | |||
1436 | - spin_lock(&efivars->lock); | ||
1437 | + spin_lock_irq(&efivars->lock); | ||
1438 | efivars->walk_entry = list_first_entry(&efivars->list, | ||
1439 | struct efivar_entry, list); | ||
1440 | return 0; | ||
1441 | @@ -1263,7 +1319,7 @@ static int efi_pstore_close(struct pstore_info *psi) | ||
1442 | { | ||
1443 | struct efivars *efivars = psi->data; | ||
1444 | |||
1445 | - spin_unlock(&efivars->lock); | ||
1446 | + spin_unlock_irq(&efivars->lock); | ||
1447 | return 0; | ||
1448 | } | ||
1449 | |||
1450 | @@ -1337,22 +1393,22 @@ static int efi_pstore_write(enum pstore_type_id type, | ||
1451 | efi_guid_t vendor = LINUX_EFI_CRASH_GUID; | ||
1452 | struct efivars *efivars = psi->data; | ||
1453 | int i, ret = 0; | ||
1454 | - u64 storage_space, remaining_space, max_variable_size; | ||
1455 | efi_status_t status = EFI_NOT_FOUND; | ||
1456 | + unsigned long flags; | ||
1457 | |||
1458 | - spin_lock(&efivars->lock); | ||
1459 | + spin_lock_irqsave(&efivars->lock, flags); | ||
1460 | |||
1461 | /* | ||
1462 | * Check if there is a space enough to log. | ||
1463 | * size: a size of logging data | ||
1464 | * DUMP_NAME_LEN * 2: a maximum size of variable name | ||
1465 | */ | ||
1466 | - status = efivars->ops->query_variable_info(PSTORE_EFI_ATTRIBUTES, | ||
1467 | - &storage_space, | ||
1468 | - &remaining_space, | ||
1469 | - &max_variable_size); | ||
1470 | - if (status || remaining_space < size + DUMP_NAME_LEN * 2) { | ||
1471 | - spin_unlock(&efivars->lock); | ||
1472 | + | ||
1473 | + status = check_var_size_locked(efivars, PSTORE_EFI_ATTRIBUTES, | ||
1474 | + size + DUMP_NAME_LEN * 2); | ||
1475 | + | ||
1476 | + if (status) { | ||
1477 | + spin_unlock_irqrestore(&efivars->lock, flags); | ||
1478 | *id = part; | ||
1479 | return -ENOSPC; | ||
1480 | } | ||
1481 | @@ -1366,7 +1422,7 @@ static int efi_pstore_write(enum pstore_type_id type, | ||
1482 | efivars->ops->set_variable(efi_name, &vendor, PSTORE_EFI_ATTRIBUTES, | ||
1483 | size, psi->buf); | ||
1484 | |||
1485 | - spin_unlock(&efivars->lock); | ||
1486 | + spin_unlock_irqrestore(&efivars->lock, flags); | ||
1487 | |||
1488 | if (size) | ||
1489 | ret = efivar_create_sysfs_entry(efivars, | ||
1490 | @@ -1393,7 +1449,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | ||
1491 | sprintf(name, "dump-type%u-%u-%d-%lu", type, (unsigned int)id, count, | ||
1492 | time.tv_sec); | ||
1493 | |||
1494 | - spin_lock(&efivars->lock); | ||
1495 | + spin_lock_irq(&efivars->lock); | ||
1496 | |||
1497 | for (i = 0; i < DUMP_NAME_LEN; i++) | ||
1498 | efi_name[i] = name[i]; | ||
1499 | @@ -1437,7 +1493,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | ||
1500 | if (found) | ||
1501 | list_del(&found->list); | ||
1502 | |||
1503 | - spin_unlock(&efivars->lock); | ||
1504 | + spin_unlock_irq(&efivars->lock); | ||
1505 | |||
1506 | if (found) | ||
1507 | efivar_unregister(found); | ||
1508 | @@ -1507,7 +1563,7 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | ||
1509 | return -EINVAL; | ||
1510 | } | ||
1511 | |||
1512 | - spin_lock(&efivars->lock); | ||
1513 | + spin_lock_irq(&efivars->lock); | ||
1514 | |||
1515 | /* | ||
1516 | * Does this variable already exist? | ||
1517 | @@ -1525,10 +1581,18 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | ||
1518 | } | ||
1519 | } | ||
1520 | if (found) { | ||
1521 | - spin_unlock(&efivars->lock); | ||
1522 | + spin_unlock_irq(&efivars->lock); | ||
1523 | return -EINVAL; | ||
1524 | } | ||
1525 | |||
1526 | + status = check_var_size_locked(efivars, new_var->Attributes, | ||
1527 | + new_var->DataSize + utf16_strsize(new_var->VariableName, 1024)); | ||
1528 | + | ||
1529 | + if (status && status != EFI_UNSUPPORTED) { | ||
1530 | + spin_unlock_irq(&efivars->lock); | ||
1531 | + return efi_status_to_err(status); | ||
1532 | + } | ||
1533 | + | ||
1534 | /* now *really* create the variable via EFI */ | ||
1535 | status = efivars->ops->set_variable(new_var->VariableName, | ||
1536 | &new_var->VendorGuid, | ||
1537 | @@ -1539,10 +1603,10 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | ||
1538 | if (status != EFI_SUCCESS) { | ||
1539 | printk(KERN_WARNING "efivars: set_variable() failed: status=%lx\n", | ||
1540 | status); | ||
1541 | - spin_unlock(&efivars->lock); | ||
1542 | + spin_unlock_irq(&efivars->lock); | ||
1543 | return -EIO; | ||
1544 | } | ||
1545 | - spin_unlock(&efivars->lock); | ||
1546 | + spin_unlock_irq(&efivars->lock); | ||
1547 | |||
1548 | /* Create the entry in sysfs. Locking is not required here */ | ||
1549 | status = efivar_create_sysfs_entry(efivars, | ||
1550 | @@ -1570,7 +1634,7 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj, | ||
1551 | if (!capable(CAP_SYS_ADMIN)) | ||
1552 | return -EACCES; | ||
1553 | |||
1554 | - spin_lock(&efivars->lock); | ||
1555 | + spin_lock_irq(&efivars->lock); | ||
1556 | |||
1557 | /* | ||
1558 | * Does this variable already exist? | ||
1559 | @@ -1588,7 +1652,7 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj, | ||
1560 | } | ||
1561 | } | ||
1562 | if (!found) { | ||
1563 | - spin_unlock(&efivars->lock); | ||
1564 | + spin_unlock_irq(&efivars->lock); | ||
1565 | return -EINVAL; | ||
1566 | } | ||
1567 | /* force the Attributes/DataSize to 0 to ensure deletion */ | ||
1568 | @@ -1604,12 +1668,12 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj, | ||
1569 | if (status != EFI_SUCCESS) { | ||
1570 | printk(KERN_WARNING "efivars: set_variable() failed: status=%lx\n", | ||
1571 | status); | ||
1572 | - spin_unlock(&efivars->lock); | ||
1573 | + spin_unlock_irq(&efivars->lock); | ||
1574 | return -EIO; | ||
1575 | } | ||
1576 | list_del(&search_efivar->list); | ||
1577 | /* We need to release this lock before unregistering. */ | ||
1578 | - spin_unlock(&efivars->lock); | ||
1579 | + spin_unlock_irq(&efivars->lock); | ||
1580 | efivar_unregister(search_efivar); | ||
1581 | |||
1582 | /* It's dead Jim.... */ | ||
1583 | @@ -1724,9 +1788,9 @@ efivar_create_sysfs_entry(struct efivars *efivars, | ||
1584 | kfree(short_name); | ||
1585 | short_name = NULL; | ||
1586 | |||
1587 | - spin_lock(&efivars->lock); | ||
1588 | + spin_lock_irq(&efivars->lock); | ||
1589 | list_add(&new_efivar->list, &efivars->list); | ||
1590 | - spin_unlock(&efivars->lock); | ||
1591 | + spin_unlock_irq(&efivars->lock); | ||
1592 | |||
1593 | return 0; | ||
1594 | } | ||
1595 | @@ -1795,9 +1859,9 @@ void unregister_efivars(struct efivars *efivars) | ||
1596 | struct efivar_entry *entry, *n; | ||
1597 | |||
1598 | list_for_each_entry_safe(entry, n, &efivars->list, list) { | ||
1599 | - spin_lock(&efivars->lock); | ||
1600 | + spin_lock_irq(&efivars->lock); | ||
1601 | list_del(&entry->list); | ||
1602 | - spin_unlock(&efivars->lock); | ||
1603 | + spin_unlock_irq(&efivars->lock); | ||
1604 | efivar_unregister(entry); | ||
1605 | } | ||
1606 | if (efivars->new_var) | ||
1607 | diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c | ||
1608 | index 6819d63..456663c 100644 | ||
1609 | --- a/drivers/gpio/gpio-mvebu.c | ||
1610 | +++ b/drivers/gpio/gpio-mvebu.c | ||
1611 | @@ -41,6 +41,7 @@ | ||
1612 | #include <linux/io.h> | ||
1613 | #include <linux/of_irq.h> | ||
1614 | #include <linux/of_device.h> | ||
1615 | +#include <linux/clk.h> | ||
1616 | #include <linux/pinctrl/consumer.h> | ||
1617 | |||
1618 | /* | ||
1619 | @@ -495,6 +496,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) | ||
1620 | struct resource *res; | ||
1621 | struct irq_chip_generic *gc; | ||
1622 | struct irq_chip_type *ct; | ||
1623 | + struct clk *clk; | ||
1624 | unsigned int ngpios; | ||
1625 | int soc_variant; | ||
1626 | int i, cpu, id; | ||
1627 | @@ -528,6 +530,11 @@ static int mvebu_gpio_probe(struct platform_device *pdev) | ||
1628 | return id; | ||
1629 | } | ||
1630 | |||
1631 | + clk = devm_clk_get(&pdev->dev, NULL); | ||
1632 | + /* Not all SoCs require a clock.*/ | ||
1633 | + if (!IS_ERR(clk)) | ||
1634 | + clk_prepare_enable(clk); | ||
1635 | + | ||
1636 | mvchip->soc_variant = soc_variant; | ||
1637 | mvchip->chip.label = dev_name(&pdev->dev); | ||
1638 | mvchip->chip.dev = &pdev->dev; | ||
1639 | diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c | ||
1640 | index 99daa89..5206f24 100644 | ||
1641 | --- a/drivers/gpu/drm/i915/i915_dma.c | ||
1642 | +++ b/drivers/gpu/drm/i915/i915_dma.c | ||
1643 | @@ -1297,19 +1297,21 @@ static int i915_load_modeset_init(struct drm_device *dev) | ||
1644 | if (ret) | ||
1645 | goto cleanup_vga_switcheroo; | ||
1646 | |||
1647 | + ret = drm_irq_install(dev); | ||
1648 | + if (ret) | ||
1649 | + goto cleanup_gem_stolen; | ||
1650 | + | ||
1651 | + /* Important: The output setup functions called by modeset_init need | ||
1652 | + * working irqs for e.g. gmbus and dp aux transfers. */ | ||
1653 | intel_modeset_init(dev); | ||
1654 | |||
1655 | ret = i915_gem_init(dev); | ||
1656 | if (ret) | ||
1657 | - goto cleanup_gem_stolen; | ||
1658 | - | ||
1659 | - intel_modeset_gem_init(dev); | ||
1660 | + goto cleanup_irq; | ||
1661 | |||
1662 | INIT_WORK(&dev_priv->console_resume_work, intel_console_resume); | ||
1663 | |||
1664 | - ret = drm_irq_install(dev); | ||
1665 | - if (ret) | ||
1666 | - goto cleanup_gem; | ||
1667 | + intel_modeset_gem_init(dev); | ||
1668 | |||
1669 | /* Always safe in the mode setting case. */ | ||
1670 | /* FIXME: do pre/post-mode set stuff in core KMS code */ | ||
1671 | @@ -1317,7 +1319,10 @@ static int i915_load_modeset_init(struct drm_device *dev) | ||
1672 | |||
1673 | ret = intel_fbdev_init(dev); | ||
1674 | if (ret) | ||
1675 | - goto cleanup_irq; | ||
1676 | + goto cleanup_gem; | ||
1677 | + | ||
1678 | + /* Only enable hotplug handling once the fbdev is fully set up. */ | ||
1679 | + dev_priv->enable_hotplug_processing = true; | ||
1680 | |||
1681 | drm_kms_helper_poll_init(dev); | ||
1682 | |||
1683 | @@ -1326,13 +1331,13 @@ static int i915_load_modeset_init(struct drm_device *dev) | ||
1684 | |||
1685 | return 0; | ||
1686 | |||
1687 | -cleanup_irq: | ||
1688 | - drm_irq_uninstall(dev); | ||
1689 | cleanup_gem: | ||
1690 | mutex_lock(&dev->struct_mutex); | ||
1691 | i915_gem_cleanup_ringbuffer(dev); | ||
1692 | mutex_unlock(&dev->struct_mutex); | ||
1693 | i915_gem_cleanup_aliasing_ppgtt(dev); | ||
1694 | +cleanup_irq: | ||
1695 | + drm_irq_uninstall(dev); | ||
1696 | cleanup_gem_stolen: | ||
1697 | i915_gem_cleanup_stolen(dev); | ||
1698 | cleanup_vga_switcheroo: | ||
1699 | diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c | ||
1700 | index 1172658..fb6454c 100644 | ||
1701 | --- a/drivers/gpu/drm/i915/i915_drv.c | ||
1702 | +++ b/drivers/gpu/drm/i915/i915_drv.c | ||
1703 | @@ -377,15 +377,15 @@ static const struct pci_device_id pciidlist[] = { /* aka */ | ||
1704 | INTEL_VGA_DEVICE(0x0A06, &intel_haswell_m_info), /* ULT GT1 mobile */ | ||
1705 | INTEL_VGA_DEVICE(0x0A16, &intel_haswell_m_info), /* ULT GT2 mobile */ | ||
1706 | INTEL_VGA_DEVICE(0x0A26, &intel_haswell_m_info), /* ULT GT2 mobile */ | ||
1707 | - INTEL_VGA_DEVICE(0x0D12, &intel_haswell_d_info), /* CRW GT1 desktop */ | ||
1708 | + INTEL_VGA_DEVICE(0x0D02, &intel_haswell_d_info), /* CRW GT1 desktop */ | ||
1709 | + INTEL_VGA_DEVICE(0x0D12, &intel_haswell_d_info), /* CRW GT2 desktop */ | ||
1710 | INTEL_VGA_DEVICE(0x0D22, &intel_haswell_d_info), /* CRW GT2 desktop */ | ||
1711 | - INTEL_VGA_DEVICE(0x0D32, &intel_haswell_d_info), /* CRW GT2 desktop */ | ||
1712 | - INTEL_VGA_DEVICE(0x0D1A, &intel_haswell_d_info), /* CRW GT1 server */ | ||
1713 | + INTEL_VGA_DEVICE(0x0D0A, &intel_haswell_d_info), /* CRW GT1 server */ | ||
1714 | + INTEL_VGA_DEVICE(0x0D1A, &intel_haswell_d_info), /* CRW GT2 server */ | ||
1715 | INTEL_VGA_DEVICE(0x0D2A, &intel_haswell_d_info), /* CRW GT2 server */ | ||
1716 | - INTEL_VGA_DEVICE(0x0D3A, &intel_haswell_d_info), /* CRW GT2 server */ | ||
1717 | - INTEL_VGA_DEVICE(0x0D16, &intel_haswell_m_info), /* CRW GT1 mobile */ | ||
1718 | + INTEL_VGA_DEVICE(0x0D06, &intel_haswell_m_info), /* CRW GT1 mobile */ | ||
1719 | + INTEL_VGA_DEVICE(0x0D16, &intel_haswell_m_info), /* CRW GT2 mobile */ | ||
1720 | INTEL_VGA_DEVICE(0x0D26, &intel_haswell_m_info), /* CRW GT2 mobile */ | ||
1721 | - INTEL_VGA_DEVICE(0x0D36, &intel_haswell_m_info), /* CRW GT2 mobile */ | ||
1722 | INTEL_VGA_DEVICE(0x0f30, &intel_valleyview_m_info), | ||
1723 | INTEL_VGA_DEVICE(0x0157, &intel_valleyview_m_info), | ||
1724 | INTEL_VGA_DEVICE(0x0155, &intel_valleyview_d_info), | ||
1725 | @@ -486,6 +486,7 @@ static int i915_drm_freeze(struct drm_device *dev) | ||
1726 | intel_modeset_disable(dev); | ||
1727 | |||
1728 | drm_irq_uninstall(dev); | ||
1729 | + dev_priv->enable_hotplug_processing = false; | ||
1730 | } | ||
1731 | |||
1732 | i915_save_state(dev); | ||
1733 | @@ -562,9 +563,19 @@ static int __i915_drm_thaw(struct drm_device *dev) | ||
1734 | error = i915_gem_init_hw(dev); | ||
1735 | mutex_unlock(&dev->struct_mutex); | ||
1736 | |||
1737 | + /* We need working interrupts for modeset enabling ... */ | ||
1738 | + drm_irq_install(dev); | ||
1739 | + | ||
1740 | intel_modeset_init_hw(dev); | ||
1741 | intel_modeset_setup_hw_state(dev, false); | ||
1742 | - drm_irq_install(dev); | ||
1743 | + | ||
1744 | + /* | ||
1745 | + * ... but also need to make sure that hotplug processing | ||
1746 | + * doesn't cause havoc. Like in the driver load code we don't | ||
1747 | + * bother with the tiny race here where we might loose hotplug | ||
1748 | + * notifications. | ||
1749 | + * */ | ||
1750 | + dev_priv->enable_hotplug_processing = true; | ||
1751 | } | ||
1752 | |||
1753 | intel_opregion_init(dev); | ||
1754 | diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h | ||
1755 | index 7339a4b..66ad64f 100644 | ||
1756 | --- a/drivers/gpu/drm/i915/i915_drv.h | ||
1757 | +++ b/drivers/gpu/drm/i915/i915_drv.h | ||
1758 | @@ -672,6 +672,7 @@ typedef struct drm_i915_private { | ||
1759 | |||
1760 | u32 hotplug_supported_mask; | ||
1761 | struct work_struct hotplug_work; | ||
1762 | + bool enable_hotplug_processing; | ||
1763 | |||
1764 | int num_pipe; | ||
1765 | int num_pch_pll; | ||
1766 | diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c | ||
1767 | index fe84338..3c00403 100644 | ||
1768 | --- a/drivers/gpu/drm/i915/i915_irq.c | ||
1769 | +++ b/drivers/gpu/drm/i915/i915_irq.c | ||
1770 | @@ -287,6 +287,10 @@ static void i915_hotplug_work_func(struct work_struct *work) | ||
1771 | struct drm_mode_config *mode_config = &dev->mode_config; | ||
1772 | struct intel_encoder *encoder; | ||
1773 | |||
1774 | + /* HPD irq before everything is fully set up. */ | ||
1775 | + if (!dev_priv->enable_hotplug_processing) | ||
1776 | + return; | ||
1777 | + | ||
1778 | mutex_lock(&mode_config->mutex); | ||
1779 | DRM_DEBUG_KMS("running encoder hotplug functions\n"); | ||
1780 | |||
1781 | diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c | ||
1782 | index 06b1786..b52ed09 100644 | ||
1783 | --- a/drivers/gpu/drm/i915/intel_crt.c | ||
1784 | +++ b/drivers/gpu/drm/i915/intel_crt.c | ||
1785 | @@ -88,7 +88,7 @@ static void intel_disable_crt(struct intel_encoder *encoder) | ||
1786 | u32 temp; | ||
1787 | |||
1788 | temp = I915_READ(crt->adpa_reg); | ||
1789 | - temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE); | ||
1790 | + temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE; | ||
1791 | temp &= ~ADPA_DAC_ENABLE; | ||
1792 | I915_WRITE(crt->adpa_reg, temp); | ||
1793 | } | ||
1794 | diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c | ||
1795 | index 3280cff..dde0ded 100644 | ||
1796 | --- a/drivers/gpu/drm/i915/intel_pm.c | ||
1797 | +++ b/drivers/gpu/drm/i915/intel_pm.c | ||
1798 | @@ -2572,7 +2572,7 @@ static void gen6_enable_rps(struct drm_device *dev) | ||
1799 | I915_WRITE(GEN6_RC_SLEEP, 0); | ||
1800 | I915_WRITE(GEN6_RC1e_THRESHOLD, 1000); | ||
1801 | I915_WRITE(GEN6_RC6_THRESHOLD, 50000); | ||
1802 | - I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); | ||
1803 | + I915_WRITE(GEN6_RC6p_THRESHOLD, 150000); | ||
1804 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ | ||
1805 | |||
1806 | /* Check if we are enabling RC6 */ | ||
1807 | diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c | ||
1808 | index 3e403bd..78edadc 100644 | ||
1809 | --- a/drivers/gpu/drm/radeon/radeon_combios.c | ||
1810 | +++ b/drivers/gpu/drm/radeon/radeon_combios.c | ||
1811 | @@ -970,6 +970,15 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct | ||
1812 | found = 1; | ||
1813 | } | ||
1814 | |||
1815 | + /* quirks */ | ||
1816 | + /* Radeon 9100 (R200) */ | ||
1817 | + if ((dev->pdev->device == 0x514D) && | ||
1818 | + (dev->pdev->subsystem_vendor == 0x174B) && | ||
1819 | + (dev->pdev->subsystem_device == 0x7149)) { | ||
1820 | + /* vbios value is bad, use the default */ | ||
1821 | + found = 0; | ||
1822 | + } | ||
1823 | + | ||
1824 | if (!found) /* fallback to defaults */ | ||
1825 | radeon_legacy_get_primary_dac_info_from_table(rdev, p_dac); | ||
1826 | |||
1827 | diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c | ||
1828 | index 90374dd..48f80cd 100644 | ||
1829 | --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c | ||
1830 | +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | ||
1831 | @@ -400,6 +400,9 @@ void radeon_irq_kms_enable_afmt(struct radeon_device *rdev, int block) | ||
1832 | { | ||
1833 | unsigned long irqflags; | ||
1834 | |||
1835 | + if (!rdev->ddev->irq_enabled) | ||
1836 | + return; | ||
1837 | + | ||
1838 | spin_lock_irqsave(&rdev->irq.lock, irqflags); | ||
1839 | rdev->irq.afmt[block] = true; | ||
1840 | radeon_irq_set(rdev); | ||
1841 | @@ -419,6 +422,9 @@ void radeon_irq_kms_disable_afmt(struct radeon_device *rdev, int block) | ||
1842 | { | ||
1843 | unsigned long irqflags; | ||
1844 | |||
1845 | + if (!rdev->ddev->irq_enabled) | ||
1846 | + return; | ||
1847 | + | ||
1848 | spin_lock_irqsave(&rdev->irq.lock, irqflags); | ||
1849 | rdev->irq.afmt[block] = false; | ||
1850 | radeon_irq_set(rdev); | ||
1851 | @@ -438,6 +444,9 @@ void radeon_irq_kms_enable_hpd(struct radeon_device *rdev, unsigned hpd_mask) | ||
1852 | unsigned long irqflags; | ||
1853 | int i; | ||
1854 | |||
1855 | + if (!rdev->ddev->irq_enabled) | ||
1856 | + return; | ||
1857 | + | ||
1858 | spin_lock_irqsave(&rdev->irq.lock, irqflags); | ||
1859 | for (i = 0; i < RADEON_MAX_HPD_PINS; ++i) | ||
1860 | rdev->irq.hpd[i] |= !!(hpd_mask & (1 << i)); | ||
1861 | @@ -458,6 +467,9 @@ void radeon_irq_kms_disable_hpd(struct radeon_device *rdev, unsigned hpd_mask) | ||
1862 | unsigned long irqflags; | ||
1863 | int i; | ||
1864 | |||
1865 | + if (!rdev->ddev->irq_enabled) | ||
1866 | + return; | ||
1867 | + | ||
1868 | spin_lock_irqsave(&rdev->irq.lock, irqflags); | ||
1869 | for (i = 0; i < RADEON_MAX_HPD_PINS; ++i) | ||
1870 | rdev->irq.hpd[i] &= !(hpd_mask & (1 << i)); | ||
1871 | diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c | ||
1872 | index 9500f2f..8758f38c 100644 | ||
1873 | --- a/drivers/hid/hid-logitech-dj.c | ||
1874 | +++ b/drivers/hid/hid-logitech-dj.c | ||
1875 | @@ -459,19 +459,25 @@ static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev, | ||
1876 | struct dj_report *dj_report) | ||
1877 | { | ||
1878 | struct hid_device *hdev = djrcv_dev->hdev; | ||
1879 | - int sent_bytes; | ||
1880 | + struct hid_report *report; | ||
1881 | + struct hid_report_enum *output_report_enum; | ||
1882 | + u8 *data = (u8 *)(&dj_report->device_index); | ||
1883 | + int i; | ||
1884 | |||
1885 | - if (!hdev->hid_output_raw_report) { | ||
1886 | - dev_err(&hdev->dev, "%s:" | ||
1887 | - "hid_output_raw_report is null\n", __func__); | ||
1888 | + output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT]; | ||
1889 | + report = output_report_enum->report_id_hash[REPORT_ID_DJ_SHORT]; | ||
1890 | + | ||
1891 | + if (!report) { | ||
1892 | + dev_err(&hdev->dev, "%s: unable to find dj report\n", __func__); | ||
1893 | return -ENODEV; | ||
1894 | } | ||
1895 | |||
1896 | - sent_bytes = hdev->hid_output_raw_report(hdev, (u8 *) dj_report, | ||
1897 | - sizeof(struct dj_report), | ||
1898 | - HID_OUTPUT_REPORT); | ||
1899 | + for (i = 0; i < report->field[0]->report_count; i++) | ||
1900 | + report->field[0]->value[i] = data[i]; | ||
1901 | + | ||
1902 | + usbhid_submit_report(hdev, report, USB_DIR_OUT); | ||
1903 | |||
1904 | - return (sent_bytes < 0) ? sent_bytes : 0; | ||
1905 | + return 0; | ||
1906 | } | ||
1907 | |||
1908 | static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) | ||
1909 | diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c | ||
1910 | index 9652a2c..a58de38 100644 | ||
1911 | --- a/drivers/hwmon/pmbus/ltc2978.c | ||
1912 | +++ b/drivers/hwmon/pmbus/ltc2978.c | ||
1913 | @@ -62,7 +62,7 @@ struct ltc2978_data { | ||
1914 | int temp_min, temp_max; | ||
1915 | int vout_min[8], vout_max[8]; | ||
1916 | int iout_max[2]; | ||
1917 | - int temp2_max[2]; | ||
1918 | + int temp2_max; | ||
1919 | struct pmbus_driver_info info; | ||
1920 | }; | ||
1921 | |||
1922 | @@ -204,10 +204,9 @@ static int ltc3880_read_word_data(struct i2c_client *client, int page, int reg) | ||
1923 | ret = pmbus_read_word_data(client, page, | ||
1924 | LTC3880_MFR_TEMPERATURE2_PEAK); | ||
1925 | if (ret >= 0) { | ||
1926 | - if (lin11_to_val(ret) | ||
1927 | - > lin11_to_val(data->temp2_max[page])) | ||
1928 | - data->temp2_max[page] = ret; | ||
1929 | - ret = data->temp2_max[page]; | ||
1930 | + if (lin11_to_val(ret) > lin11_to_val(data->temp2_max)) | ||
1931 | + data->temp2_max = ret; | ||
1932 | + ret = data->temp2_max; | ||
1933 | } | ||
1934 | break; | ||
1935 | case PMBUS_VIRT_READ_VIN_MIN: | ||
1936 | @@ -248,11 +247,11 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page, | ||
1937 | |||
1938 | switch (reg) { | ||
1939 | case PMBUS_VIRT_RESET_IOUT_HISTORY: | ||
1940 | - data->iout_max[page] = 0x7fff; | ||
1941 | + data->iout_max[page] = 0x7c00; | ||
1942 | ret = ltc2978_clear_peaks(client, page, data->id); | ||
1943 | break; | ||
1944 | case PMBUS_VIRT_RESET_TEMP2_HISTORY: | ||
1945 | - data->temp2_max[page] = 0x7fff; | ||
1946 | + data->temp2_max = 0x7c00; | ||
1947 | ret = ltc2978_clear_peaks(client, page, data->id); | ||
1948 | break; | ||
1949 | case PMBUS_VIRT_RESET_VOUT_HISTORY: | ||
1950 | @@ -262,12 +261,12 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page, | ||
1951 | break; | ||
1952 | case PMBUS_VIRT_RESET_VIN_HISTORY: | ||
1953 | data->vin_min = 0x7bff; | ||
1954 | - data->vin_max = 0; | ||
1955 | + data->vin_max = 0x7c00; | ||
1956 | ret = ltc2978_clear_peaks(client, page, data->id); | ||
1957 | break; | ||
1958 | case PMBUS_VIRT_RESET_TEMP_HISTORY: | ||
1959 | data->temp_min = 0x7bff; | ||
1960 | - data->temp_max = 0x7fff; | ||
1961 | + data->temp_max = 0x7c00; | ||
1962 | ret = ltc2978_clear_peaks(client, page, data->id); | ||
1963 | break; | ||
1964 | default: | ||
1965 | @@ -321,12 +320,13 @@ static int ltc2978_probe(struct i2c_client *client, | ||
1966 | info = &data->info; | ||
1967 | info->write_word_data = ltc2978_write_word_data; | ||
1968 | |||
1969 | - data->vout_min[0] = 0xffff; | ||
1970 | data->vin_min = 0x7bff; | ||
1971 | + data->vin_max = 0x7c00; | ||
1972 | data->temp_min = 0x7bff; | ||
1973 | - data->temp_max = 0x7fff; | ||
1974 | + data->temp_max = 0x7c00; | ||
1975 | + data->temp2_max = 0x7c00; | ||
1976 | |||
1977 | - switch (id->driver_data) { | ||
1978 | + switch (data->id) { | ||
1979 | case ltc2978: | ||
1980 | info->read_word_data = ltc2978_read_word_data; | ||
1981 | info->pages = 8; | ||
1982 | @@ -336,7 +336,6 @@ static int ltc2978_probe(struct i2c_client *client, | ||
1983 | for (i = 1; i < 8; i++) { | ||
1984 | info->func[i] = PMBUS_HAVE_VOUT | ||
1985 | | PMBUS_HAVE_STATUS_VOUT; | ||
1986 | - data->vout_min[i] = 0xffff; | ||
1987 | } | ||
1988 | break; | ||
1989 | case ltc3880: | ||
1990 | @@ -352,11 +351,14 @@ static int ltc2978_probe(struct i2c_client *client, | ||
1991 | | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | ||
1992 | | PMBUS_HAVE_POUT | ||
1993 | | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; | ||
1994 | - data->vout_min[1] = 0xffff; | ||
1995 | + data->iout_max[0] = 0x7c00; | ||
1996 | + data->iout_max[1] = 0x7c00; | ||
1997 | break; | ||
1998 | default: | ||
1999 | return -ENODEV; | ||
2000 | } | ||
2001 | + for (i = 0; i < info->pages; i++) | ||
2002 | + data->vout_min[i] = 0xffff; | ||
2003 | |||
2004 | return pmbus_do_probe(client, id, info); | ||
2005 | } | ||
2006 | diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c | ||
2007 | index 1c85d39..8047fed 100644 | ||
2008 | --- a/drivers/hwmon/sht15.c | ||
2009 | +++ b/drivers/hwmon/sht15.c | ||
2010 | @@ -926,7 +926,13 @@ static int sht15_probe(struct platform_device *pdev) | ||
2011 | if (voltage) | ||
2012 | data->supply_uV = voltage; | ||
2013 | |||
2014 | - regulator_enable(data->reg); | ||
2015 | + ret = regulator_enable(data->reg); | ||
2016 | + if (ret != 0) { | ||
2017 | + dev_err(&pdev->dev, | ||
2018 | + "failed to enable regulator: %d\n", ret); | ||
2019 | + return ret; | ||
2020 | + } | ||
2021 | + | ||
2022 | /* | ||
2023 | * Setup a notifier block to update this if another device | ||
2024 | * causes the voltage to change | ||
2025 | diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c | ||
2026 | index f7369f9..2ae151e 100644 | ||
2027 | --- a/drivers/md/dm-crypt.c | ||
2028 | +++ b/drivers/md/dm-crypt.c | ||
2029 | @@ -1234,20 +1234,6 @@ static int crypt_decode_key(u8 *key, char *hex, unsigned int size) | ||
2030 | return 0; | ||
2031 | } | ||
2032 | |||
2033 | -/* | ||
2034 | - * Encode key into its hex representation | ||
2035 | - */ | ||
2036 | -static void crypt_encode_key(char *hex, u8 *key, unsigned int size) | ||
2037 | -{ | ||
2038 | - unsigned int i; | ||
2039 | - | ||
2040 | - for (i = 0; i < size; i++) { | ||
2041 | - sprintf(hex, "%02x", *key); | ||
2042 | - hex += 2; | ||
2043 | - key++; | ||
2044 | - } | ||
2045 | -} | ||
2046 | - | ||
2047 | static void crypt_free_tfms(struct crypt_config *cc) | ||
2048 | { | ||
2049 | unsigned i; | ||
2050 | @@ -1717,11 +1703,11 @@ static int crypt_map(struct dm_target *ti, struct bio *bio) | ||
2051 | return DM_MAPIO_SUBMITTED; | ||
2052 | } | ||
2053 | |||
2054 | -static int crypt_status(struct dm_target *ti, status_type_t type, | ||
2055 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2056 | +static void crypt_status(struct dm_target *ti, status_type_t type, | ||
2057 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2058 | { | ||
2059 | struct crypt_config *cc = ti->private; | ||
2060 | - unsigned int sz = 0; | ||
2061 | + unsigned i, sz = 0; | ||
2062 | |||
2063 | switch (type) { | ||
2064 | case STATUSTYPE_INFO: | ||
2065 | @@ -1731,17 +1717,11 @@ static int crypt_status(struct dm_target *ti, status_type_t type, | ||
2066 | case STATUSTYPE_TABLE: | ||
2067 | DMEMIT("%s ", cc->cipher_string); | ||
2068 | |||
2069 | - if (cc->key_size > 0) { | ||
2070 | - if ((maxlen - sz) < ((cc->key_size << 1) + 1)) | ||
2071 | - return -ENOMEM; | ||
2072 | - | ||
2073 | - crypt_encode_key(result + sz, cc->key, cc->key_size); | ||
2074 | - sz += cc->key_size << 1; | ||
2075 | - } else { | ||
2076 | - if (sz >= maxlen) | ||
2077 | - return -ENOMEM; | ||
2078 | - result[sz++] = '-'; | ||
2079 | - } | ||
2080 | + if (cc->key_size > 0) | ||
2081 | + for (i = 0; i < cc->key_size; i++) | ||
2082 | + DMEMIT("%02x", cc->key[i]); | ||
2083 | + else | ||
2084 | + DMEMIT("-"); | ||
2085 | |||
2086 | DMEMIT(" %llu %s %llu", (unsigned long long)cc->iv_offset, | ||
2087 | cc->dev->name, (unsigned long long)cc->start); | ||
2088 | @@ -1751,7 +1731,6 @@ static int crypt_status(struct dm_target *ti, status_type_t type, | ||
2089 | |||
2090 | break; | ||
2091 | } | ||
2092 | - return 0; | ||
2093 | } | ||
2094 | |||
2095 | static void crypt_postsuspend(struct dm_target *ti) | ||
2096 | @@ -1845,7 +1824,7 @@ static int crypt_iterate_devices(struct dm_target *ti, | ||
2097 | |||
2098 | static struct target_type crypt_target = { | ||
2099 | .name = "crypt", | ||
2100 | - .version = {1, 12, 0}, | ||
2101 | + .version = {1, 12, 1}, | ||
2102 | .module = THIS_MODULE, | ||
2103 | .ctr = crypt_ctr, | ||
2104 | .dtr = crypt_dtr, | ||
2105 | diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c | ||
2106 | index cc1bd04..c0d03b0 100644 | ||
2107 | --- a/drivers/md/dm-delay.c | ||
2108 | +++ b/drivers/md/dm-delay.c | ||
2109 | @@ -293,8 +293,8 @@ static int delay_map(struct dm_target *ti, struct bio *bio) | ||
2110 | return delay_bio(dc, dc->read_delay, bio); | ||
2111 | } | ||
2112 | |||
2113 | -static int delay_status(struct dm_target *ti, status_type_t type, | ||
2114 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2115 | +static void delay_status(struct dm_target *ti, status_type_t type, | ||
2116 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2117 | { | ||
2118 | struct delay_c *dc = ti->private; | ||
2119 | int sz = 0; | ||
2120 | @@ -314,8 +314,6 @@ static int delay_status(struct dm_target *ti, status_type_t type, | ||
2121 | dc->write_delay); | ||
2122 | break; | ||
2123 | } | ||
2124 | - | ||
2125 | - return 0; | ||
2126 | } | ||
2127 | |||
2128 | static int delay_iterate_devices(struct dm_target *ti, | ||
2129 | @@ -337,7 +335,7 @@ out: | ||
2130 | |||
2131 | static struct target_type delay_target = { | ||
2132 | .name = "delay", | ||
2133 | - .version = {1, 2, 0}, | ||
2134 | + .version = {1, 2, 1}, | ||
2135 | .module = THIS_MODULE, | ||
2136 | .ctr = delay_ctr, | ||
2137 | .dtr = delay_dtr, | ||
2138 | diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c | ||
2139 | index 9721f2f..5d6c04c 100644 | ||
2140 | --- a/drivers/md/dm-flakey.c | ||
2141 | +++ b/drivers/md/dm-flakey.c | ||
2142 | @@ -337,8 +337,8 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error) | ||
2143 | return error; | ||
2144 | } | ||
2145 | |||
2146 | -static int flakey_status(struct dm_target *ti, status_type_t type, | ||
2147 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2148 | +static void flakey_status(struct dm_target *ti, status_type_t type, | ||
2149 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2150 | { | ||
2151 | unsigned sz = 0; | ||
2152 | struct flakey_c *fc = ti->private; | ||
2153 | @@ -368,7 +368,6 @@ static int flakey_status(struct dm_target *ti, status_type_t type, | ||
2154 | |||
2155 | break; | ||
2156 | } | ||
2157 | - return 0; | ||
2158 | } | ||
2159 | |||
2160 | static int flakey_ioctl(struct dm_target *ti, unsigned int cmd, unsigned long arg) | ||
2161 | @@ -411,7 +410,7 @@ static int flakey_iterate_devices(struct dm_target *ti, iterate_devices_callout_ | ||
2162 | |||
2163 | static struct target_type flakey_target = { | ||
2164 | .name = "flakey", | ||
2165 | - .version = {1, 3, 0}, | ||
2166 | + .version = {1, 3, 1}, | ||
2167 | .module = THIS_MODULE, | ||
2168 | .ctr = flakey_ctr, | ||
2169 | .dtr = flakey_dtr, | ||
2170 | diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c | ||
2171 | index 0666b5d..eee353d 100644 | ||
2172 | --- a/drivers/md/dm-ioctl.c | ||
2173 | +++ b/drivers/md/dm-ioctl.c | ||
2174 | @@ -1067,6 +1067,7 @@ static void retrieve_status(struct dm_table *table, | ||
2175 | num_targets = dm_table_get_num_targets(table); | ||
2176 | for (i = 0; i < num_targets; i++) { | ||
2177 | struct dm_target *ti = dm_table_get_target(table, i); | ||
2178 | + size_t l; | ||
2179 | |||
2180 | remaining = len - (outptr - outbuf); | ||
2181 | if (remaining <= sizeof(struct dm_target_spec)) { | ||
2182 | @@ -1093,14 +1094,17 @@ static void retrieve_status(struct dm_table *table, | ||
2183 | if (ti->type->status) { | ||
2184 | if (param->flags & DM_NOFLUSH_FLAG) | ||
2185 | status_flags |= DM_STATUS_NOFLUSH_FLAG; | ||
2186 | - if (ti->type->status(ti, type, status_flags, outptr, remaining)) { | ||
2187 | - param->flags |= DM_BUFFER_FULL_FLAG; | ||
2188 | - break; | ||
2189 | - } | ||
2190 | + ti->type->status(ti, type, status_flags, outptr, remaining); | ||
2191 | } else | ||
2192 | outptr[0] = '\0'; | ||
2193 | |||
2194 | - outptr += strlen(outptr) + 1; | ||
2195 | + l = strlen(outptr) + 1; | ||
2196 | + if (l == remaining) { | ||
2197 | + param->flags |= DM_BUFFER_FULL_FLAG; | ||
2198 | + break; | ||
2199 | + } | ||
2200 | + | ||
2201 | + outptr += l; | ||
2202 | used = param->data_start + (outptr - outbuf); | ||
2203 | |||
2204 | outptr = align_ptr(outptr); | ||
2205 | diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c | ||
2206 | index 328cad5..5be301c 100644 | ||
2207 | --- a/drivers/md/dm-linear.c | ||
2208 | +++ b/drivers/md/dm-linear.c | ||
2209 | @@ -95,8 +95,8 @@ static int linear_map(struct dm_target *ti, struct bio *bio) | ||
2210 | return DM_MAPIO_REMAPPED; | ||
2211 | } | ||
2212 | |||
2213 | -static int linear_status(struct dm_target *ti, status_type_t type, | ||
2214 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2215 | +static void linear_status(struct dm_target *ti, status_type_t type, | ||
2216 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2217 | { | ||
2218 | struct linear_c *lc = (struct linear_c *) ti->private; | ||
2219 | |||
2220 | @@ -110,7 +110,6 @@ static int linear_status(struct dm_target *ti, status_type_t type, | ||
2221 | (unsigned long long)lc->start); | ||
2222 | break; | ||
2223 | } | ||
2224 | - return 0; | ||
2225 | } | ||
2226 | |||
2227 | static int linear_ioctl(struct dm_target *ti, unsigned int cmd, | ||
2228 | @@ -155,7 +154,7 @@ static int linear_iterate_devices(struct dm_target *ti, | ||
2229 | |||
2230 | static struct target_type linear_target = { | ||
2231 | .name = "linear", | ||
2232 | - .version = {1, 2, 0}, | ||
2233 | + .version = {1, 2, 1}, | ||
2234 | .module = THIS_MODULE, | ||
2235 | .ctr = linear_ctr, | ||
2236 | .dtr = linear_dtr, | ||
2237 | diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c | ||
2238 | index 573bd04..d267bb5 100644 | ||
2239 | --- a/drivers/md/dm-mpath.c | ||
2240 | +++ b/drivers/md/dm-mpath.c | ||
2241 | @@ -1378,8 +1378,8 @@ static void multipath_resume(struct dm_target *ti) | ||
2242 | * [priority selector-name num_ps_args [ps_args]* | ||
2243 | * num_paths num_selector_args [path_dev [selector_args]* ]+ ]+ | ||
2244 | */ | ||
2245 | -static int multipath_status(struct dm_target *ti, status_type_t type, | ||
2246 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2247 | +static void multipath_status(struct dm_target *ti, status_type_t type, | ||
2248 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2249 | { | ||
2250 | int sz = 0; | ||
2251 | unsigned long flags; | ||
2252 | @@ -1485,8 +1485,6 @@ static int multipath_status(struct dm_target *ti, status_type_t type, | ||
2253 | } | ||
2254 | |||
2255 | spin_unlock_irqrestore(&m->lock, flags); | ||
2256 | - | ||
2257 | - return 0; | ||
2258 | } | ||
2259 | |||
2260 | static int multipath_message(struct dm_target *ti, unsigned argc, char **argv) | ||
2261 | @@ -1695,7 +1693,7 @@ out: | ||
2262 | *---------------------------------------------------------------*/ | ||
2263 | static struct target_type multipath_target = { | ||
2264 | .name = "multipath", | ||
2265 | - .version = {1, 5, 0}, | ||
2266 | + .version = {1, 5, 1}, | ||
2267 | .module = THIS_MODULE, | ||
2268 | .ctr = multipath_ctr, | ||
2269 | .dtr = multipath_dtr, | ||
2270 | diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c | ||
2271 | index 9e58dbd..5a578d8 100644 | ||
2272 | --- a/drivers/md/dm-raid.c | ||
2273 | +++ b/drivers/md/dm-raid.c | ||
2274 | @@ -1201,8 +1201,8 @@ static int raid_map(struct dm_target *ti, struct bio *bio) | ||
2275 | return DM_MAPIO_SUBMITTED; | ||
2276 | } | ||
2277 | |||
2278 | -static int raid_status(struct dm_target *ti, status_type_t type, | ||
2279 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2280 | +static void raid_status(struct dm_target *ti, status_type_t type, | ||
2281 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2282 | { | ||
2283 | struct raid_set *rs = ti->private; | ||
2284 | unsigned raid_param_cnt = 1; /* at least 1 for chunksize */ | ||
2285 | @@ -1344,8 +1344,6 @@ static int raid_status(struct dm_target *ti, status_type_t type, | ||
2286 | DMEMIT(" -"); | ||
2287 | } | ||
2288 | } | ||
2289 | - | ||
2290 | - return 0; | ||
2291 | } | ||
2292 | |||
2293 | static int raid_iterate_devices(struct dm_target *ti, iterate_devices_callout_fn fn, void *data) | ||
2294 | @@ -1405,7 +1403,7 @@ static void raid_resume(struct dm_target *ti) | ||
2295 | |||
2296 | static struct target_type raid_target = { | ||
2297 | .name = "raid", | ||
2298 | - .version = {1, 4, 1}, | ||
2299 | + .version = {1, 4, 2}, | ||
2300 | .module = THIS_MODULE, | ||
2301 | .ctr = raid_ctr, | ||
2302 | .dtr = raid_dtr, | ||
2303 | diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c | ||
2304 | index fa51918..7f24190 100644 | ||
2305 | --- a/drivers/md/dm-raid1.c | ||
2306 | +++ b/drivers/md/dm-raid1.c | ||
2307 | @@ -1347,8 +1347,8 @@ static char device_status_char(struct mirror *m) | ||
2308 | } | ||
2309 | |||
2310 | |||
2311 | -static int mirror_status(struct dm_target *ti, status_type_t type, | ||
2312 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2313 | +static void mirror_status(struct dm_target *ti, status_type_t type, | ||
2314 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2315 | { | ||
2316 | unsigned int m, sz = 0; | ||
2317 | struct mirror_set *ms = (struct mirror_set *) ti->private; | ||
2318 | @@ -1383,8 +1383,6 @@ static int mirror_status(struct dm_target *ti, status_type_t type, | ||
2319 | if (ms->features & DM_RAID1_HANDLE_ERRORS) | ||
2320 | DMEMIT(" 1 handle_errors"); | ||
2321 | } | ||
2322 | - | ||
2323 | - return 0; | ||
2324 | } | ||
2325 | |||
2326 | static int mirror_iterate_devices(struct dm_target *ti, | ||
2327 | @@ -1403,7 +1401,7 @@ static int mirror_iterate_devices(struct dm_target *ti, | ||
2328 | |||
2329 | static struct target_type mirror_target = { | ||
2330 | .name = "mirror", | ||
2331 | - .version = {1, 13, 1}, | ||
2332 | + .version = {1, 13, 2}, | ||
2333 | .module = THIS_MODULE, | ||
2334 | .ctr = mirror_ctr, | ||
2335 | .dtr = mirror_dtr, | ||
2336 | diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c | ||
2337 | index 59fc18a..df74f9f 100644 | ||
2338 | --- a/drivers/md/dm-snap.c | ||
2339 | +++ b/drivers/md/dm-snap.c | ||
2340 | @@ -1837,8 +1837,8 @@ static void snapshot_merge_resume(struct dm_target *ti) | ||
2341 | start_merge(s); | ||
2342 | } | ||
2343 | |||
2344 | -static int snapshot_status(struct dm_target *ti, status_type_t type, | ||
2345 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2346 | +static void snapshot_status(struct dm_target *ti, status_type_t type, | ||
2347 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2348 | { | ||
2349 | unsigned sz = 0; | ||
2350 | struct dm_snapshot *snap = ti->private; | ||
2351 | @@ -1884,8 +1884,6 @@ static int snapshot_status(struct dm_target *ti, status_type_t type, | ||
2352 | maxlen - sz); | ||
2353 | break; | ||
2354 | } | ||
2355 | - | ||
2356 | - return 0; | ||
2357 | } | ||
2358 | |||
2359 | static int snapshot_iterate_devices(struct dm_target *ti, | ||
2360 | @@ -2139,8 +2137,8 @@ static void origin_resume(struct dm_target *ti) | ||
2361 | ti->max_io_len = get_origin_minimum_chunksize(dev->bdev); | ||
2362 | } | ||
2363 | |||
2364 | -static int origin_status(struct dm_target *ti, status_type_t type, | ||
2365 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2366 | +static void origin_status(struct dm_target *ti, status_type_t type, | ||
2367 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2368 | { | ||
2369 | struct dm_dev *dev = ti->private; | ||
2370 | |||
2371 | @@ -2153,8 +2151,6 @@ static int origin_status(struct dm_target *ti, status_type_t type, | ||
2372 | snprintf(result, maxlen, "%s", dev->name); | ||
2373 | break; | ||
2374 | } | ||
2375 | - | ||
2376 | - return 0; | ||
2377 | } | ||
2378 | |||
2379 | static int origin_merge(struct dm_target *ti, struct bvec_merge_data *bvm, | ||
2380 | @@ -2181,7 +2177,7 @@ static int origin_iterate_devices(struct dm_target *ti, | ||
2381 | |||
2382 | static struct target_type origin_target = { | ||
2383 | .name = "snapshot-origin", | ||
2384 | - .version = {1, 8, 0}, | ||
2385 | + .version = {1, 8, 1}, | ||
2386 | .module = THIS_MODULE, | ||
2387 | .ctr = origin_ctr, | ||
2388 | .dtr = origin_dtr, | ||
2389 | @@ -2194,7 +2190,7 @@ static struct target_type origin_target = { | ||
2390 | |||
2391 | static struct target_type snapshot_target = { | ||
2392 | .name = "snapshot", | ||
2393 | - .version = {1, 11, 0}, | ||
2394 | + .version = {1, 11, 1}, | ||
2395 | .module = THIS_MODULE, | ||
2396 | .ctr = snapshot_ctr, | ||
2397 | .dtr = snapshot_dtr, | ||
2398 | @@ -2307,3 +2303,5 @@ module_exit(dm_snapshot_exit); | ||
2399 | MODULE_DESCRIPTION(DM_NAME " snapshot target"); | ||
2400 | MODULE_AUTHOR("Joe Thornber"); | ||
2401 | MODULE_LICENSE("GPL"); | ||
2402 | +MODULE_ALIAS("dm-snapshot-origin"); | ||
2403 | +MODULE_ALIAS("dm-snapshot-merge"); | ||
2404 | diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c | ||
2405 | index c89cde8..aaecefa 100644 | ||
2406 | --- a/drivers/md/dm-stripe.c | ||
2407 | +++ b/drivers/md/dm-stripe.c | ||
2408 | @@ -312,8 +312,8 @@ static int stripe_map(struct dm_target *ti, struct bio *bio) | ||
2409 | * | ||
2410 | */ | ||
2411 | |||
2412 | -static int stripe_status(struct dm_target *ti, status_type_t type, | ||
2413 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2414 | +static void stripe_status(struct dm_target *ti, status_type_t type, | ||
2415 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2416 | { | ||
2417 | struct stripe_c *sc = (struct stripe_c *) ti->private; | ||
2418 | char buffer[sc->stripes + 1]; | ||
2419 | @@ -340,7 +340,6 @@ static int stripe_status(struct dm_target *ti, status_type_t type, | ||
2420 | (unsigned long long)sc->stripe[i].physical_start); | ||
2421 | break; | ||
2422 | } | ||
2423 | - return 0; | ||
2424 | } | ||
2425 | |||
2426 | static int stripe_end_io(struct dm_target *ti, struct bio *bio, int error) | ||
2427 | @@ -428,7 +427,7 @@ static int stripe_merge(struct dm_target *ti, struct bvec_merge_data *bvm, | ||
2428 | |||
2429 | static struct target_type stripe_target = { | ||
2430 | .name = "striped", | ||
2431 | - .version = {1, 5, 0}, | ||
2432 | + .version = {1, 5, 1}, | ||
2433 | .module = THIS_MODULE, | ||
2434 | .ctr = stripe_ctr, | ||
2435 | .dtr = stripe_dtr, | ||
2436 | diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c | ||
2437 | index 5409607..7a66d73 100644 | ||
2438 | --- a/drivers/md/dm-thin.c | ||
2439 | +++ b/drivers/md/dm-thin.c | ||
2440 | @@ -2299,8 +2299,8 @@ static void emit_flags(struct pool_features *pf, char *result, | ||
2441 | * <transaction id> <used metadata sectors>/<total metadata sectors> | ||
2442 | * <used data sectors>/<total data sectors> <held metadata root> | ||
2443 | */ | ||
2444 | -static int pool_status(struct dm_target *ti, status_type_t type, | ||
2445 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2446 | +static void pool_status(struct dm_target *ti, status_type_t type, | ||
2447 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2448 | { | ||
2449 | int r; | ||
2450 | unsigned sz = 0; | ||
2451 | @@ -2326,32 +2326,41 @@ static int pool_status(struct dm_target *ti, status_type_t type, | ||
2452 | if (!(status_flags & DM_STATUS_NOFLUSH_FLAG) && !dm_suspended(ti)) | ||
2453 | (void) commit_or_fallback(pool); | ||
2454 | |||
2455 | - r = dm_pool_get_metadata_transaction_id(pool->pmd, | ||
2456 | - &transaction_id); | ||
2457 | - if (r) | ||
2458 | - return r; | ||
2459 | + r = dm_pool_get_metadata_transaction_id(pool->pmd, &transaction_id); | ||
2460 | + if (r) { | ||
2461 | + DMERR("dm_pool_get_metadata_transaction_id returned %d", r); | ||
2462 | + goto err; | ||
2463 | + } | ||
2464 | |||
2465 | - r = dm_pool_get_free_metadata_block_count(pool->pmd, | ||
2466 | - &nr_free_blocks_metadata); | ||
2467 | - if (r) | ||
2468 | - return r; | ||
2469 | + r = dm_pool_get_free_metadata_block_count(pool->pmd, &nr_free_blocks_metadata); | ||
2470 | + if (r) { | ||
2471 | + DMERR("dm_pool_get_free_metadata_block_count returned %d", r); | ||
2472 | + goto err; | ||
2473 | + } | ||
2474 | |||
2475 | r = dm_pool_get_metadata_dev_size(pool->pmd, &nr_blocks_metadata); | ||
2476 | - if (r) | ||
2477 | - return r; | ||
2478 | + if (r) { | ||
2479 | + DMERR("dm_pool_get_metadata_dev_size returned %d", r); | ||
2480 | + goto err; | ||
2481 | + } | ||
2482 | |||
2483 | - r = dm_pool_get_free_block_count(pool->pmd, | ||
2484 | - &nr_free_blocks_data); | ||
2485 | - if (r) | ||
2486 | - return r; | ||
2487 | + r = dm_pool_get_free_block_count(pool->pmd, &nr_free_blocks_data); | ||
2488 | + if (r) { | ||
2489 | + DMERR("dm_pool_get_free_block_count returned %d", r); | ||
2490 | + goto err; | ||
2491 | + } | ||
2492 | |||
2493 | r = dm_pool_get_data_dev_size(pool->pmd, &nr_blocks_data); | ||
2494 | - if (r) | ||
2495 | - return r; | ||
2496 | + if (r) { | ||
2497 | + DMERR("dm_pool_get_data_dev_size returned %d", r); | ||
2498 | + goto err; | ||
2499 | + } | ||
2500 | |||
2501 | r = dm_pool_get_metadata_snap(pool->pmd, &held_root); | ||
2502 | - if (r) | ||
2503 | - return r; | ||
2504 | + if (r) { | ||
2505 | + DMERR("dm_pool_get_metadata_snap returned %d", r); | ||
2506 | + goto err; | ||
2507 | + } | ||
2508 | |||
2509 | DMEMIT("%llu %llu/%llu %llu/%llu ", | ||
2510 | (unsigned long long)transaction_id, | ||
2511 | @@ -2388,8 +2397,10 @@ static int pool_status(struct dm_target *ti, status_type_t type, | ||
2512 | emit_flags(&pt->requested_pf, result, sz, maxlen); | ||
2513 | break; | ||
2514 | } | ||
2515 | + return; | ||
2516 | |||
2517 | - return 0; | ||
2518 | +err: | ||
2519 | + DMEMIT("Error"); | ||
2520 | } | ||
2521 | |||
2522 | static int pool_iterate_devices(struct dm_target *ti, | ||
2523 | @@ -2468,7 +2479,7 @@ static struct target_type pool_target = { | ||
2524 | .name = "thin-pool", | ||
2525 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | | ||
2526 | DM_TARGET_IMMUTABLE, | ||
2527 | - .version = {1, 6, 0}, | ||
2528 | + .version = {1, 6, 1}, | ||
2529 | .module = THIS_MODULE, | ||
2530 | .ctr = pool_ctr, | ||
2531 | .dtr = pool_dtr, | ||
2532 | @@ -2676,8 +2687,8 @@ static void thin_postsuspend(struct dm_target *ti) | ||
2533 | /* | ||
2534 | * <nr mapped sectors> <highest mapped sector> | ||
2535 | */ | ||
2536 | -static int thin_status(struct dm_target *ti, status_type_t type, | ||
2537 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2538 | +static void thin_status(struct dm_target *ti, status_type_t type, | ||
2539 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2540 | { | ||
2541 | int r; | ||
2542 | ssize_t sz = 0; | ||
2543 | @@ -2687,7 +2698,7 @@ static int thin_status(struct dm_target *ti, status_type_t type, | ||
2544 | |||
2545 | if (get_pool_mode(tc->pool) == PM_FAIL) { | ||
2546 | DMEMIT("Fail"); | ||
2547 | - return 0; | ||
2548 | + return; | ||
2549 | } | ||
2550 | |||
2551 | if (!tc->td) | ||
2552 | @@ -2696,12 +2707,16 @@ static int thin_status(struct dm_target *ti, status_type_t type, | ||
2553 | switch (type) { | ||
2554 | case STATUSTYPE_INFO: | ||
2555 | r = dm_thin_get_mapped_count(tc->td, &mapped); | ||
2556 | - if (r) | ||
2557 | - return r; | ||
2558 | + if (r) { | ||
2559 | + DMERR("dm_thin_get_mapped_count returned %d", r); | ||
2560 | + goto err; | ||
2561 | + } | ||
2562 | |||
2563 | r = dm_thin_get_highest_mapped_block(tc->td, &highest); | ||
2564 | - if (r < 0) | ||
2565 | - return r; | ||
2566 | + if (r < 0) { | ||
2567 | + DMERR("dm_thin_get_highest_mapped_block returned %d", r); | ||
2568 | + goto err; | ||
2569 | + } | ||
2570 | |||
2571 | DMEMIT("%llu ", mapped * tc->pool->sectors_per_block); | ||
2572 | if (r) | ||
2573 | @@ -2721,7 +2736,10 @@ static int thin_status(struct dm_target *ti, status_type_t type, | ||
2574 | } | ||
2575 | } | ||
2576 | |||
2577 | - return 0; | ||
2578 | + return; | ||
2579 | + | ||
2580 | +err: | ||
2581 | + DMEMIT("Error"); | ||
2582 | } | ||
2583 | |||
2584 | static int thin_iterate_devices(struct dm_target *ti, | ||
2585 | @@ -2748,7 +2766,7 @@ static int thin_iterate_devices(struct dm_target *ti, | ||
2586 | |||
2587 | static struct target_type thin_target = { | ||
2588 | .name = "thin", | ||
2589 | - .version = {1, 7, 0}, | ||
2590 | + .version = {1, 7, 1}, | ||
2591 | .module = THIS_MODULE, | ||
2592 | .ctr = thin_ctr, | ||
2593 | .dtr = thin_dtr, | ||
2594 | diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c | ||
2595 | index 52cde98..6ad5383 100644 | ||
2596 | --- a/drivers/md/dm-verity.c | ||
2597 | +++ b/drivers/md/dm-verity.c | ||
2598 | @@ -508,8 +508,8 @@ static int verity_map(struct dm_target *ti, struct bio *bio) | ||
2599 | /* | ||
2600 | * Status: V (valid) or C (corruption found) | ||
2601 | */ | ||
2602 | -static int verity_status(struct dm_target *ti, status_type_t type, | ||
2603 | - unsigned status_flags, char *result, unsigned maxlen) | ||
2604 | +static void verity_status(struct dm_target *ti, status_type_t type, | ||
2605 | + unsigned status_flags, char *result, unsigned maxlen) | ||
2606 | { | ||
2607 | struct dm_verity *v = ti->private; | ||
2608 | unsigned sz = 0; | ||
2609 | @@ -540,8 +540,6 @@ static int verity_status(struct dm_target *ti, status_type_t type, | ||
2610 | DMEMIT("%02x", v->salt[x]); | ||
2611 | break; | ||
2612 | } | ||
2613 | - | ||
2614 | - return 0; | ||
2615 | } | ||
2616 | |||
2617 | static int verity_ioctl(struct dm_target *ti, unsigned cmd, | ||
2618 | @@ -860,7 +858,7 @@ bad: | ||
2619 | |||
2620 | static struct target_type verity_target = { | ||
2621 | .name = "verity", | ||
2622 | - .version = {1, 1, 0}, | ||
2623 | + .version = {1, 1, 1}, | ||
2624 | .module = THIS_MODULE, | ||
2625 | .ctr = verity_ctr, | ||
2626 | .dtr = verity_dtr, | ||
2627 | diff --git a/drivers/md/dm.c b/drivers/md/dm.c | ||
2628 | index 314a0e2..0d8f086 100644 | ||
2629 | --- a/drivers/md/dm.c | ||
2630 | +++ b/drivers/md/dm.c | ||
2631 | @@ -1973,15 +1973,27 @@ static void __bind_mempools(struct mapped_device *md, struct dm_table *t) | ||
2632 | { | ||
2633 | struct dm_md_mempools *p = dm_table_get_md_mempools(t); | ||
2634 | |||
2635 | - if (md->io_pool && (md->tio_pool || dm_table_get_type(t) == DM_TYPE_BIO_BASED) && md->bs) { | ||
2636 | - /* | ||
2637 | - * The md already has necessary mempools. Reload just the | ||
2638 | - * bioset because front_pad may have changed because | ||
2639 | - * a different table was loaded. | ||
2640 | - */ | ||
2641 | - bioset_free(md->bs); | ||
2642 | - md->bs = p->bs; | ||
2643 | - p->bs = NULL; | ||
2644 | + if (md->io_pool && md->bs) { | ||
2645 | + /* The md already has necessary mempools. */ | ||
2646 | + if (dm_table_get_type(t) == DM_TYPE_BIO_BASED) { | ||
2647 | + /* | ||
2648 | + * Reload bioset because front_pad may have changed | ||
2649 | + * because a different table was loaded. | ||
2650 | + */ | ||
2651 | + bioset_free(md->bs); | ||
2652 | + md->bs = p->bs; | ||
2653 | + p->bs = NULL; | ||
2654 | + } else if (dm_table_get_type(t) == DM_TYPE_REQUEST_BASED) { | ||
2655 | + BUG_ON(!md->tio_pool); | ||
2656 | + /* | ||
2657 | + * There's no need to reload with request-based dm | ||
2658 | + * because the size of front_pad doesn't change. | ||
2659 | + * Note for future: If you are to reload bioset, | ||
2660 | + * prep-ed requests in the queue may refer | ||
2661 | + * to bio from the old bioset, so you must walk | ||
2662 | + * through the queue to unprep. | ||
2663 | + */ | ||
2664 | + } | ||
2665 | goto out; | ||
2666 | } | ||
2667 | |||
2668 | @@ -2421,7 +2433,7 @@ static void dm_queue_flush(struct mapped_device *md) | ||
2669 | */ | ||
2670 | struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table) | ||
2671 | { | ||
2672 | - struct dm_table *live_map, *map = ERR_PTR(-EINVAL); | ||
2673 | + struct dm_table *live_map = NULL, *map = ERR_PTR(-EINVAL); | ||
2674 | struct queue_limits limits; | ||
2675 | int r; | ||
2676 | |||
2677 | @@ -2444,10 +2456,12 @@ struct dm_table *dm_swap_table(struct mapped_device *md, struct dm_table *table) | ||
2678 | dm_table_put(live_map); | ||
2679 | } | ||
2680 | |||
2681 | - r = dm_calculate_queue_limits(table, &limits); | ||
2682 | - if (r) { | ||
2683 | - map = ERR_PTR(r); | ||
2684 | - goto out; | ||
2685 | + if (!live_map) { | ||
2686 | + r = dm_calculate_queue_limits(table, &limits); | ||
2687 | + if (r) { | ||
2688 | + map = ERR_PTR(r); | ||
2689 | + goto out; | ||
2690 | + } | ||
2691 | } | ||
2692 | |||
2693 | map = __bind(md, table, &limits); | ||
2694 | diff --git a/drivers/md/md.c b/drivers/md/md.c | ||
2695 | index 3db3d1b..f363135 100644 | ||
2696 | --- a/drivers/md/md.c | ||
2697 | +++ b/drivers/md/md.c | ||
2698 | @@ -307,6 +307,10 @@ static void md_make_request(struct request_queue *q, struct bio *bio) | ||
2699 | bio_io_error(bio); | ||
2700 | return; | ||
2701 | } | ||
2702 | + if (mddev->ro == 1 && unlikely(rw == WRITE)) { | ||
2703 | + bio_endio(bio, bio_sectors(bio) == 0 ? 0 : -EROFS); | ||
2704 | + return; | ||
2705 | + } | ||
2706 | smp_rmb(); /* Ensure implications of 'active' are visible */ | ||
2707 | rcu_read_lock(); | ||
2708 | if (mddev->suspended) { | ||
2709 | @@ -2994,6 +2998,9 @@ rdev_size_store(struct md_rdev *rdev, const char *buf, size_t len) | ||
2710 | } else if (!sectors) | ||
2711 | sectors = (i_size_read(rdev->bdev->bd_inode) >> 9) - | ||
2712 | rdev->data_offset; | ||
2713 | + if (!my_mddev->pers->resize) | ||
2714 | + /* Cannot change size for RAID0 or Linear etc */ | ||
2715 | + return -EINVAL; | ||
2716 | } | ||
2717 | if (sectors < my_mddev->dev_sectors) | ||
2718 | return -EINVAL; /* component must fit device */ | ||
2719 | diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c | ||
2720 | index 24b3597..d9babda 100644 | ||
2721 | --- a/drivers/md/raid0.c | ||
2722 | +++ b/drivers/md/raid0.c | ||
2723 | @@ -289,7 +289,7 @@ abort: | ||
2724 | kfree(conf->strip_zone); | ||
2725 | kfree(conf->devlist); | ||
2726 | kfree(conf); | ||
2727 | - *private_conf = NULL; | ||
2728 | + *private_conf = ERR_PTR(err); | ||
2729 | return err; | ||
2730 | } | ||
2731 | |||
2732 | @@ -411,7 +411,8 @@ static sector_t raid0_size(struct mddev *mddev, sector_t sectors, int raid_disks | ||
2733 | "%s does not support generic reshape\n", __func__); | ||
2734 | |||
2735 | rdev_for_each(rdev, mddev) | ||
2736 | - array_sectors += rdev->sectors; | ||
2737 | + array_sectors += (rdev->sectors & | ||
2738 | + ~(sector_t)(mddev->chunk_sectors-1)); | ||
2739 | |||
2740 | return array_sectors; | ||
2741 | } | ||
2742 | diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c | ||
2743 | index d5bddfc..75b1f89 100644 | ||
2744 | --- a/drivers/md/raid1.c | ||
2745 | +++ b/drivers/md/raid1.c | ||
2746 | @@ -967,6 +967,7 @@ static void raid1_unplug(struct blk_plug_cb *cb, bool from_schedule) | ||
2747 | bio_list_merge(&conf->pending_bio_list, &plug->pending); | ||
2748 | conf->pending_count += plug->pending_cnt; | ||
2749 | spin_unlock_irq(&conf->device_lock); | ||
2750 | + wake_up(&conf->wait_barrier); | ||
2751 | md_wakeup_thread(mddev->thread); | ||
2752 | kfree(plug); | ||
2753 | return; | ||
2754 | diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c | ||
2755 | index 64d4824..8d925dc 100644 | ||
2756 | --- a/drivers/md/raid10.c | ||
2757 | +++ b/drivers/md/raid10.c | ||
2758 | @@ -1073,6 +1073,7 @@ static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule) | ||
2759 | bio_list_merge(&conf->pending_bio_list, &plug->pending); | ||
2760 | conf->pending_count += plug->pending_cnt; | ||
2761 | spin_unlock_irq(&conf->device_lock); | ||
2762 | + wake_up(&conf->wait_barrier); | ||
2763 | md_wakeup_thread(mddev->thread); | ||
2764 | kfree(plug); | ||
2765 | return; | ||
2766 | diff --git a/drivers/memstick/host/rtsx_pci_ms.c b/drivers/memstick/host/rtsx_pci_ms.c | ||
2767 | index f5ddb82..64a779c 100644 | ||
2768 | --- a/drivers/memstick/host/rtsx_pci_ms.c | ||
2769 | +++ b/drivers/memstick/host/rtsx_pci_ms.c | ||
2770 | @@ -426,6 +426,9 @@ static void rtsx_pci_ms_request(struct memstick_host *msh) | ||
2771 | |||
2772 | dev_dbg(ms_dev(host), "--> %s\n", __func__); | ||
2773 | |||
2774 | + if (rtsx_pci_card_exclusive_check(host->pcr, RTSX_MS_CARD)) | ||
2775 | + return; | ||
2776 | + | ||
2777 | schedule_work(&host->handle_req); | ||
2778 | } | ||
2779 | |||
2780 | @@ -441,6 +444,10 @@ static int rtsx_pci_ms_set_param(struct memstick_host *msh, | ||
2781 | dev_dbg(ms_dev(host), "%s: param = %d, value = %d\n", | ||
2782 | __func__, param, value); | ||
2783 | |||
2784 | + err = rtsx_pci_card_exclusive_check(host->pcr, RTSX_MS_CARD); | ||
2785 | + if (err) | ||
2786 | + return err; | ||
2787 | + | ||
2788 | switch (param) { | ||
2789 | case MEMSTICK_POWER: | ||
2790 | if (value == MEMSTICK_POWER_ON) | ||
2791 | diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c | ||
2792 | index 9fc5700..1e2d120 100644 | ||
2793 | --- a/drivers/mfd/rtsx_pcr.c | ||
2794 | +++ b/drivers/mfd/rtsx_pcr.c | ||
2795 | @@ -713,6 +713,25 @@ int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card) | ||
2796 | } | ||
2797 | EXPORT_SYMBOL_GPL(rtsx_pci_card_power_off); | ||
2798 | |||
2799 | +int rtsx_pci_card_exclusive_check(struct rtsx_pcr *pcr, int card) | ||
2800 | +{ | ||
2801 | + unsigned int cd_mask[] = { | ||
2802 | + [RTSX_SD_CARD] = SD_EXIST, | ||
2803 | + [RTSX_MS_CARD] = MS_EXIST | ||
2804 | + }; | ||
2805 | + | ||
2806 | + if (!pcr->ms_pmos) { | ||
2807 | + /* When using single PMOS, accessing card is not permitted | ||
2808 | + * if the existing card is not the designated one. | ||
2809 | + */ | ||
2810 | + if (pcr->card_exist & (~cd_mask[card])) | ||
2811 | + return -EIO; | ||
2812 | + } | ||
2813 | + | ||
2814 | + return 0; | ||
2815 | +} | ||
2816 | +EXPORT_SYMBOL_GPL(rtsx_pci_card_exclusive_check); | ||
2817 | + | ||
2818 | int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) | ||
2819 | { | ||
2820 | if (pcr->ops->switch_output_voltage) | ||
2821 | @@ -758,7 +777,7 @@ static void rtsx_pci_card_detect(struct work_struct *work) | ||
2822 | struct delayed_work *dwork; | ||
2823 | struct rtsx_pcr *pcr; | ||
2824 | unsigned long flags; | ||
2825 | - unsigned int card_detect = 0; | ||
2826 | + unsigned int card_detect = 0, card_inserted, card_removed; | ||
2827 | u32 irq_status; | ||
2828 | |||
2829 | dwork = to_delayed_work(work); | ||
2830 | @@ -766,25 +785,35 @@ static void rtsx_pci_card_detect(struct work_struct *work) | ||
2831 | |||
2832 | dev_dbg(&(pcr->pci->dev), "--> %s\n", __func__); | ||
2833 | |||
2834 | + mutex_lock(&pcr->pcr_mutex); | ||
2835 | spin_lock_irqsave(&pcr->lock, flags); | ||
2836 | |||
2837 | irq_status = rtsx_pci_readl(pcr, RTSX_BIPR); | ||
2838 | dev_dbg(&(pcr->pci->dev), "irq_status: 0x%08x\n", irq_status); | ||
2839 | |||
2840 | - if (pcr->card_inserted || pcr->card_removed) { | ||
2841 | + irq_status &= CARD_EXIST; | ||
2842 | + card_inserted = pcr->card_inserted & irq_status; | ||
2843 | + card_removed = pcr->card_removed; | ||
2844 | + pcr->card_inserted = 0; | ||
2845 | + pcr->card_removed = 0; | ||
2846 | + | ||
2847 | + spin_unlock_irqrestore(&pcr->lock, flags); | ||
2848 | + | ||
2849 | + if (card_inserted || card_removed) { | ||
2850 | dev_dbg(&(pcr->pci->dev), | ||
2851 | "card_inserted: 0x%x, card_removed: 0x%x\n", | ||
2852 | - pcr->card_inserted, pcr->card_removed); | ||
2853 | + card_inserted, card_removed); | ||
2854 | |||
2855 | if (pcr->ops->cd_deglitch) | ||
2856 | - pcr->card_inserted = pcr->ops->cd_deglitch(pcr); | ||
2857 | + card_inserted = pcr->ops->cd_deglitch(pcr); | ||
2858 | + | ||
2859 | + card_detect = card_inserted | card_removed; | ||
2860 | |||
2861 | - card_detect = pcr->card_inserted | pcr->card_removed; | ||
2862 | - pcr->card_inserted = 0; | ||
2863 | - pcr->card_removed = 0; | ||
2864 | + pcr->card_exist |= card_inserted; | ||
2865 | + pcr->card_exist &= ~card_removed; | ||
2866 | } | ||
2867 | |||
2868 | - spin_unlock_irqrestore(&pcr->lock, flags); | ||
2869 | + mutex_unlock(&pcr->pcr_mutex); | ||
2870 | |||
2871 | if ((card_detect & SD_EXIST) && pcr->slots[RTSX_SD_CARD].card_event) | ||
2872 | pcr->slots[RTSX_SD_CARD].card_event( | ||
2873 | @@ -836,10 +865,6 @@ static irqreturn_t rtsx_pci_isr(int irq, void *dev_id) | ||
2874 | } | ||
2875 | } | ||
2876 | |||
2877 | - if (pcr->card_inserted || pcr->card_removed) | ||
2878 | - schedule_delayed_work(&pcr->carddet_work, | ||
2879 | - msecs_to_jiffies(200)); | ||
2880 | - | ||
2881 | if (int_reg & (NEED_COMPLETE_INT | DELINK_INT)) { | ||
2882 | if (int_reg & (TRANS_FAIL_INT | DELINK_INT)) { | ||
2883 | pcr->trans_result = TRANS_RESULT_FAIL; | ||
2884 | @@ -852,6 +877,10 @@ static irqreturn_t rtsx_pci_isr(int irq, void *dev_id) | ||
2885 | } | ||
2886 | } | ||
2887 | |||
2888 | + if (pcr->card_inserted || pcr->card_removed) | ||
2889 | + schedule_delayed_work(&pcr->carddet_work, | ||
2890 | + msecs_to_jiffies(200)); | ||
2891 | + | ||
2892 | spin_unlock(&pcr->lock); | ||
2893 | return IRQ_HANDLED; | ||
2894 | } | ||
2895 | @@ -974,6 +1003,14 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) | ||
2896 | return err; | ||
2897 | } | ||
2898 | |||
2899 | + /* No CD interrupt if probing driver with card inserted. | ||
2900 | + * So we need to initialize pcr->card_exist here. | ||
2901 | + */ | ||
2902 | + if (pcr->ops->cd_deglitch) | ||
2903 | + pcr->card_exist = pcr->ops->cd_deglitch(pcr); | ||
2904 | + else | ||
2905 | + pcr->card_exist = rtsx_pci_readl(pcr, RTSX_BIPR) & CARD_EXIST; | ||
2906 | + | ||
2907 | return 0; | ||
2908 | } | ||
2909 | |||
2910 | diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c | ||
2911 | index f74b5ad..468c923 100644 | ||
2912 | --- a/drivers/mmc/host/rtsx_pci_sdmmc.c | ||
2913 | +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c | ||
2914 | @@ -678,12 +678,19 @@ static void sdmmc_request(struct mmc_host *mmc, struct mmc_request *mrq) | ||
2915 | struct mmc_command *cmd = mrq->cmd; | ||
2916 | struct mmc_data *data = mrq->data; | ||
2917 | unsigned int data_size = 0; | ||
2918 | + int err; | ||
2919 | |||
2920 | if (host->eject) { | ||
2921 | cmd->error = -ENOMEDIUM; | ||
2922 | goto finish; | ||
2923 | } | ||
2924 | |||
2925 | + err = rtsx_pci_card_exclusive_check(host->pcr, RTSX_SD_CARD); | ||
2926 | + if (err) { | ||
2927 | + cmd->error = err; | ||
2928 | + goto finish; | ||
2929 | + } | ||
2930 | + | ||
2931 | mutex_lock(&pcr->pcr_mutex); | ||
2932 | |||
2933 | rtsx_pci_start_run(pcr); | ||
2934 | @@ -901,6 +908,9 @@ static void sdmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | ||
2935 | if (host->eject) | ||
2936 | return; | ||
2937 | |||
2938 | + if (rtsx_pci_card_exclusive_check(host->pcr, RTSX_SD_CARD)) | ||
2939 | + return; | ||
2940 | + | ||
2941 | mutex_lock(&pcr->pcr_mutex); | ||
2942 | |||
2943 | rtsx_pci_start_run(pcr); | ||
2944 | @@ -1073,6 +1083,10 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) | ||
2945 | if (host->eject) | ||
2946 | return -ENOMEDIUM; | ||
2947 | |||
2948 | + err = rtsx_pci_card_exclusive_check(host->pcr, RTSX_SD_CARD); | ||
2949 | + if (err) | ||
2950 | + return err; | ||
2951 | + | ||
2952 | mutex_lock(&pcr->pcr_mutex); | ||
2953 | |||
2954 | rtsx_pci_start_run(pcr); | ||
2955 | @@ -1122,6 +1136,10 @@ static int sdmmc_execute_tuning(struct mmc_host *mmc, u32 opcode) | ||
2956 | if (host->eject) | ||
2957 | return -ENOMEDIUM; | ||
2958 | |||
2959 | + err = rtsx_pci_card_exclusive_check(host->pcr, RTSX_SD_CARD); | ||
2960 | + if (err) | ||
2961 | + return err; | ||
2962 | + | ||
2963 | mutex_lock(&pcr->pcr_mutex); | ||
2964 | |||
2965 | rtsx_pci_start_run(pcr); | ||
2966 | diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c | ||
2967 | index bdb0869..f0b38fa 100644 | ||
2968 | --- a/drivers/net/ethernet/broadcom/tg3.c | ||
2969 | +++ b/drivers/net/ethernet/broadcom/tg3.c | ||
2970 | @@ -1843,6 +1843,8 @@ static void tg3_link_report(struct tg3 *tp) | ||
2971 | |||
2972 | tg3_ump_link_report(tp); | ||
2973 | } | ||
2974 | + | ||
2975 | + tp->link_up = netif_carrier_ok(tp->dev); | ||
2976 | } | ||
2977 | |||
2978 | static u16 tg3_advert_flowctrl_1000X(u8 flow_ctrl) | ||
2979 | @@ -2496,12 +2498,6 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp) | ||
2980 | return err; | ||
2981 | } | ||
2982 | |||
2983 | -static void tg3_carrier_on(struct tg3 *tp) | ||
2984 | -{ | ||
2985 | - netif_carrier_on(tp->dev); | ||
2986 | - tp->link_up = true; | ||
2987 | -} | ||
2988 | - | ||
2989 | static void tg3_carrier_off(struct tg3 *tp) | ||
2990 | { | ||
2991 | netif_carrier_off(tp->dev); | ||
2992 | @@ -2527,7 +2523,7 @@ static int tg3_phy_reset(struct tg3 *tp) | ||
2993 | return -EBUSY; | ||
2994 | |||
2995 | if (netif_running(tp->dev) && tp->link_up) { | ||
2996 | - tg3_carrier_off(tp); | ||
2997 | + netif_carrier_off(tp->dev); | ||
2998 | tg3_link_report(tp); | ||
2999 | } | ||
3000 | |||
3001 | @@ -4225,9 +4221,9 @@ static bool tg3_test_and_report_link_chg(struct tg3 *tp, int curr_link_up) | ||
3002 | { | ||
3003 | if (curr_link_up != tp->link_up) { | ||
3004 | if (curr_link_up) { | ||
3005 | - tg3_carrier_on(tp); | ||
3006 | + netif_carrier_on(tp->dev); | ||
3007 | } else { | ||
3008 | - tg3_carrier_off(tp); | ||
3009 | + netif_carrier_off(tp->dev); | ||
3010 | if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) | ||
3011 | tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT; | ||
3012 | } | ||
3013 | diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c | ||
3014 | index 643c883..1f93880 100644 | ||
3015 | --- a/drivers/net/ethernet/intel/e1000e/netdev.c | ||
3016 | +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | ||
3017 | @@ -5549,7 +5549,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake, | ||
3018 | */ | ||
3019 | e1000e_release_hw_control(adapter); | ||
3020 | |||
3021 | - pci_disable_device(pdev); | ||
3022 | + pci_clear_master(pdev); | ||
3023 | |||
3024 | return 0; | ||
3025 | } | ||
3026 | diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c | ||
3027 | index 9b73670..6214181 100644 | ||
3028 | --- a/drivers/net/usb/smsc95xx.c | ||
3029 | +++ b/drivers/net/usb/smsc95xx.c | ||
3030 | @@ -1340,6 +1340,8 @@ static int smsc95xx_enter_suspend0(struct usbnet *dev) | ||
3031 | ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val); | ||
3032 | if (ret < 0) | ||
3033 | netdev_warn(dev->net, "Error reading PM_CTRL\n"); | ||
3034 | + else | ||
3035 | + ret = 0; | ||
3036 | |||
3037 | return ret; | ||
3038 | } | ||
3039 | @@ -1392,6 +1394,8 @@ static int smsc95xx_enter_suspend1(struct usbnet *dev) | ||
3040 | ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val); | ||
3041 | if (ret < 0) | ||
3042 | netdev_warn(dev->net, "Error writing PM_CTRL\n"); | ||
3043 | + else | ||
3044 | + ret = 0; | ||
3045 | |||
3046 | return ret; | ||
3047 | } | ||
3048 | @@ -1413,6 +1417,8 @@ static int smsc95xx_enter_suspend2(struct usbnet *dev) | ||
3049 | ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val); | ||
3050 | if (ret < 0) | ||
3051 | netdev_warn(dev->net, "Error writing PM_CTRL\n"); | ||
3052 | + else | ||
3053 | + ret = 0; | ||
3054 | |||
3055 | return ret; | ||
3056 | } | ||
3057 | diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h | ||
3058 | index 5f845be..050ca4a 100644 | ||
3059 | --- a/drivers/net/wireless/ath/ath9k/common.h | ||
3060 | +++ b/drivers/net/wireless/ath/ath9k/common.h | ||
3061 | @@ -27,7 +27,7 @@ | ||
3062 | #define WME_MAX_BA WME_BA_BMP_SIZE | ||
3063 | #define ATH_TID_MAX_BUFS (2 * WME_MAX_BA) | ||
3064 | |||
3065 | -#define ATH_RSSI_DUMMY_MARKER 0x127 | ||
3066 | +#define ATH_RSSI_DUMMY_MARKER 127 | ||
3067 | #define ATH_RSSI_LPF_LEN 10 | ||
3068 | #define RSSI_LPF_THRESHOLD -20 | ||
3069 | #define ATH_RSSI_EP_MULTIPLIER (1<<7) | ||
3070 | diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h | ||
3071 | index 96bfb18..d3b099d 100644 | ||
3072 | --- a/drivers/net/wireless/ath/ath9k/htc.h | ||
3073 | +++ b/drivers/net/wireless/ath/ath9k/htc.h | ||
3074 | @@ -22,6 +22,7 @@ | ||
3075 | #include <linux/firmware.h> | ||
3076 | #include <linux/skbuff.h> | ||
3077 | #include <linux/netdevice.h> | ||
3078 | +#include <linux/etherdevice.h> | ||
3079 | #include <linux/leds.h> | ||
3080 | #include <linux/slab.h> | ||
3081 | #include <net/mac80211.h> | ||
3082 | diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | ||
3083 | index b6a5a08..8788621 100644 | ||
3084 | --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | ||
3085 | +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | ||
3086 | @@ -1067,15 +1067,19 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | ||
3087 | |||
3088 | last_rssi = priv->rx.last_rssi; | ||
3089 | |||
3090 | - if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) | ||
3091 | - rxbuf->rxstatus.rs_rssi = ATH_EP_RND(last_rssi, | ||
3092 | - ATH_RSSI_EP_MULTIPLIER); | ||
3093 | + if (ieee80211_is_beacon(hdr->frame_control) && | ||
3094 | + !is_zero_ether_addr(common->curbssid) && | ||
3095 | + ether_addr_equal(hdr->addr3, common->curbssid)) { | ||
3096 | + s8 rssi = rxbuf->rxstatus.rs_rssi; | ||
3097 | |||
3098 | - if (rxbuf->rxstatus.rs_rssi < 0) | ||
3099 | - rxbuf->rxstatus.rs_rssi = 0; | ||
3100 | + if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) | ||
3101 | + rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER); | ||
3102 | |||
3103 | - if (ieee80211_is_beacon(fc)) | ||
3104 | - priv->ah->stats.avgbrssi = rxbuf->rxstatus.rs_rssi; | ||
3105 | + if (rssi < 0) | ||
3106 | + rssi = 0; | ||
3107 | + | ||
3108 | + priv->ah->stats.avgbrssi = rssi; | ||
3109 | + } | ||
3110 | |||
3111 | rx_status->mactime = be64_to_cpu(rxbuf->rxstatus.rs_tstamp); | ||
3112 | rx_status->band = hw->conf.channel->band; | ||
3113 | diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c | ||
3114 | index 7cb7870..e26f92d 100644 | ||
3115 | --- a/drivers/net/wireless/ath/ath9k/hw.c | ||
3116 | +++ b/drivers/net/wireless/ath/ath9k/hw.c | ||
3117 | @@ -1480,7 +1480,9 @@ static bool ath9k_hw_chip_reset(struct ath_hw *ah, | ||
3118 | reset_type = ATH9K_RESET_POWER_ON; | ||
3119 | else | ||
3120 | reset_type = ATH9K_RESET_COLD; | ||
3121 | - } | ||
3122 | + } else if (ah->chip_fullsleep || REG_READ(ah, AR_Q_TXE) || | ||
3123 | + (REG_READ(ah, AR_CR) & AR_CR_RXE)) | ||
3124 | + reset_type = ATH9K_RESET_COLD; | ||
3125 | |||
3126 | if (!ath9k_hw_set_reset_reg(ah, reset_type)) | ||
3127 | return false; | ||
3128 | diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h | ||
3129 | index dc7e26b..c85eb37 100644 | ||
3130 | --- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h | ||
3131 | +++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h | ||
3132 | @@ -349,25 +349,23 @@ TRACE_EVENT(iwlwifi_dev_rx_data, | ||
3133 | TRACE_EVENT(iwlwifi_dev_hcmd, | ||
3134 | TP_PROTO(const struct device *dev, | ||
3135 | struct iwl_host_cmd *cmd, u16 total_size, | ||
3136 | - const void *hdr, size_t hdr_len), | ||
3137 | - TP_ARGS(dev, cmd, total_size, hdr, hdr_len), | ||
3138 | + struct iwl_cmd_header *hdr), | ||
3139 | + TP_ARGS(dev, cmd, total_size, hdr), | ||
3140 | TP_STRUCT__entry( | ||
3141 | DEV_ENTRY | ||
3142 | __dynamic_array(u8, hcmd, total_size) | ||
3143 | __field(u32, flags) | ||
3144 | ), | ||
3145 | TP_fast_assign( | ||
3146 | - int i, offset = hdr_len; | ||
3147 | + int i, offset = sizeof(*hdr); | ||
3148 | |||
3149 | DEV_ASSIGN; | ||
3150 | __entry->flags = cmd->flags; | ||
3151 | - memcpy(__get_dynamic_array(hcmd), hdr, hdr_len); | ||
3152 | + memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr)); | ||
3153 | |||
3154 | for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { | ||
3155 | if (!cmd->len[i]) | ||
3156 | continue; | ||
3157 | - if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)) | ||
3158 | - continue; | ||
3159 | memcpy((u8 *)__get_dynamic_array(hcmd) + offset, | ||
3160 | cmd->data[i], cmd->len[i]); | ||
3161 | offset += cmd->len[i]; | ||
3162 | diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h | ||
3163 | index d91d2e8..bc5e9ec 100644 | ||
3164 | --- a/drivers/net/wireless/iwlwifi/pcie/internal.h | ||
3165 | +++ b/drivers/net/wireless/iwlwifi/pcie/internal.h | ||
3166 | @@ -182,6 +182,15 @@ struct iwl_queue { | ||
3167 | #define TFD_TX_CMD_SLOTS 256 | ||
3168 | #define TFD_CMD_SLOTS 32 | ||
3169 | |||
3170 | +/* | ||
3171 | + * The FH will write back to the first TB only, so we need | ||
3172 | + * to copy some data into the buffer regardless of whether | ||
3173 | + * it should be mapped or not. This indicates how much to | ||
3174 | + * copy, even for HCMDs it must be big enough to fit the | ||
3175 | + * DRAM scratch from the TX cmd, at least 16 bytes. | ||
3176 | + */ | ||
3177 | +#define IWL_HCMD_MIN_COPY_SIZE 16 | ||
3178 | + | ||
3179 | struct iwl_pcie_txq_entry { | ||
3180 | struct iwl_device_cmd *cmd; | ||
3181 | struct iwl_device_cmd *copy_cmd; | ||
3182 | diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c | ||
3183 | index 6c5b867..c6cd922 100644 | ||
3184 | --- a/drivers/net/wireless/iwlwifi/pcie/tx.c | ||
3185 | +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | ||
3186 | @@ -1131,10 +1131,12 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | ||
3187 | void *dup_buf = NULL; | ||
3188 | dma_addr_t phys_addr; | ||
3189 | int idx; | ||
3190 | - u16 copy_size, cmd_size; | ||
3191 | + u16 copy_size, cmd_size, dma_size; | ||
3192 | bool had_nocopy = false; | ||
3193 | int i; | ||
3194 | u32 cmd_pos; | ||
3195 | + const u8 *cmddata[IWL_MAX_CMD_TFDS]; | ||
3196 | + u16 cmdlen[IWL_MAX_CMD_TFDS]; | ||
3197 | |||
3198 | copy_size = sizeof(out_cmd->hdr); | ||
3199 | cmd_size = sizeof(out_cmd->hdr); | ||
3200 | @@ -1143,8 +1145,23 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | ||
3201 | BUILD_BUG_ON(IWL_MAX_CMD_TFDS > IWL_NUM_OF_TBS - 1); | ||
3202 | |||
3203 | for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { | ||
3204 | + cmddata[i] = cmd->data[i]; | ||
3205 | + cmdlen[i] = cmd->len[i]; | ||
3206 | + | ||
3207 | if (!cmd->len[i]) | ||
3208 | continue; | ||
3209 | + | ||
3210 | + /* need at least IWL_HCMD_MIN_COPY_SIZE copied */ | ||
3211 | + if (copy_size < IWL_HCMD_MIN_COPY_SIZE) { | ||
3212 | + int copy = IWL_HCMD_MIN_COPY_SIZE - copy_size; | ||
3213 | + | ||
3214 | + if (copy > cmdlen[i]) | ||
3215 | + copy = cmdlen[i]; | ||
3216 | + cmdlen[i] -= copy; | ||
3217 | + cmddata[i] += copy; | ||
3218 | + copy_size += copy; | ||
3219 | + } | ||
3220 | + | ||
3221 | if (cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY) { | ||
3222 | had_nocopy = true; | ||
3223 | if (WARN_ON(cmd->dataflags[i] & IWL_HCMD_DFL_DUP)) { | ||
3224 | @@ -1164,7 +1181,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | ||
3225 | goto free_dup_buf; | ||
3226 | } | ||
3227 | |||
3228 | - dup_buf = kmemdup(cmd->data[i], cmd->len[i], | ||
3229 | + dup_buf = kmemdup(cmddata[i], cmdlen[i], | ||
3230 | GFP_ATOMIC); | ||
3231 | if (!dup_buf) | ||
3232 | return -ENOMEM; | ||
3233 | @@ -1174,7 +1191,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | ||
3234 | idx = -EINVAL; | ||
3235 | goto free_dup_buf; | ||
3236 | } | ||
3237 | - copy_size += cmd->len[i]; | ||
3238 | + copy_size += cmdlen[i]; | ||
3239 | } | ||
3240 | cmd_size += cmd->len[i]; | ||
3241 | } | ||
3242 | @@ -1221,14 +1238,31 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | ||
3243 | |||
3244 | /* and copy the data that needs to be copied */ | ||
3245 | cmd_pos = offsetof(struct iwl_device_cmd, payload); | ||
3246 | + copy_size = sizeof(out_cmd->hdr); | ||
3247 | for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { | ||
3248 | - if (!cmd->len[i]) | ||
3249 | + int copy = 0; | ||
3250 | + | ||
3251 | + if (!cmd->len) | ||
3252 | continue; | ||
3253 | - if (cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | | ||
3254 | - IWL_HCMD_DFL_DUP)) | ||
3255 | - break; | ||
3256 | - memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], cmd->len[i]); | ||
3257 | - cmd_pos += cmd->len[i]; | ||
3258 | + | ||
3259 | + /* need at least IWL_HCMD_MIN_COPY_SIZE copied */ | ||
3260 | + if (copy_size < IWL_HCMD_MIN_COPY_SIZE) { | ||
3261 | + copy = IWL_HCMD_MIN_COPY_SIZE - copy_size; | ||
3262 | + | ||
3263 | + if (copy > cmd->len[i]) | ||
3264 | + copy = cmd->len[i]; | ||
3265 | + } | ||
3266 | + | ||
3267 | + /* copy everything if not nocopy/dup */ | ||
3268 | + if (!(cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | | ||
3269 | + IWL_HCMD_DFL_DUP))) | ||
3270 | + copy = cmd->len[i]; | ||
3271 | + | ||
3272 | + if (copy) { | ||
3273 | + memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); | ||
3274 | + cmd_pos += copy; | ||
3275 | + copy_size += copy; | ||
3276 | + } | ||
3277 | } | ||
3278 | |||
3279 | WARN_ON_ONCE(txq->entries[idx].copy_cmd); | ||
3280 | @@ -1254,7 +1288,14 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | ||
3281 | out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), | ||
3282 | cmd_size, q->write_ptr, idx, trans_pcie->cmd_queue); | ||
3283 | |||
3284 | - phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size, | ||
3285 | + /* | ||
3286 | + * If the entire command is smaller than IWL_HCMD_MIN_COPY_SIZE, we must | ||
3287 | + * still map at least that many bytes for the hardware to write back to. | ||
3288 | + * We have enough space, so that's not a problem. | ||
3289 | + */ | ||
3290 | + dma_size = max_t(u16, copy_size, IWL_HCMD_MIN_COPY_SIZE); | ||
3291 | + | ||
3292 | + phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, dma_size, | ||
3293 | DMA_BIDIRECTIONAL); | ||
3294 | if (unlikely(dma_mapping_error(trans->dev, phys_addr))) { | ||
3295 | idx = -ENOMEM; | ||
3296 | @@ -1262,14 +1303,15 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | ||
3297 | } | ||
3298 | |||
3299 | dma_unmap_addr_set(out_meta, mapping, phys_addr); | ||
3300 | - dma_unmap_len_set(out_meta, len, copy_size); | ||
3301 | + dma_unmap_len_set(out_meta, len, dma_size); | ||
3302 | |||
3303 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, copy_size, 1); | ||
3304 | |||
3305 | + /* map the remaining (adjusted) nocopy/dup fragments */ | ||
3306 | for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { | ||
3307 | - const void *data = cmd->data[i]; | ||
3308 | + const void *data = cmddata[i]; | ||
3309 | |||
3310 | - if (!cmd->len[i]) | ||
3311 | + if (!cmdlen[i]) | ||
3312 | continue; | ||
3313 | if (!(cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | | ||
3314 | IWL_HCMD_DFL_DUP))) | ||
3315 | @@ -1277,7 +1319,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | ||
3316 | if (cmd->dataflags[i] & IWL_HCMD_DFL_DUP) | ||
3317 | data = dup_buf; | ||
3318 | phys_addr = dma_map_single(trans->dev, (void *)data, | ||
3319 | - cmd->len[i], DMA_BIDIRECTIONAL); | ||
3320 | + cmdlen[i], DMA_BIDIRECTIONAL); | ||
3321 | if (dma_mapping_error(trans->dev, phys_addr)) { | ||
3322 | iwl_pcie_tfd_unmap(trans, out_meta, | ||
3323 | &txq->tfds[q->write_ptr], | ||
3324 | @@ -1286,7 +1328,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | ||
3325 | goto out; | ||
3326 | } | ||
3327 | |||
3328 | - iwl_pcie_txq_build_tfd(trans, txq, phys_addr, cmd->len[i], 0); | ||
3329 | + iwl_pcie_txq_build_tfd(trans, txq, phys_addr, cmdlen[i], 0); | ||
3330 | } | ||
3331 | |||
3332 | out_meta->flags = cmd->flags; | ||
3333 | @@ -1296,8 +1338,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | ||
3334 | |||
3335 | txq->need_update = 1; | ||
3336 | |||
3337 | - trace_iwlwifi_dev_hcmd(trans->dev, cmd, cmd_size, | ||
3338 | - &out_cmd->hdr, copy_size); | ||
3339 | + trace_iwlwifi_dev_hcmd(trans->dev, cmd, cmd_size, &out_cmd->hdr); | ||
3340 | |||
3341 | /* start timer if queue currently empty */ | ||
3342 | if (q->read_ptr == q->write_ptr && trans_pcie->wd_timeout) | ||
3343 | diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c | ||
3344 | index 739309e..4557833 100644 | ||
3345 | --- a/drivers/net/wireless/libertas/if_sdio.c | ||
3346 | +++ b/drivers/net/wireless/libertas/if_sdio.c | ||
3347 | @@ -825,6 +825,11 @@ static void if_sdio_finish_power_on(struct if_sdio_card *card) | ||
3348 | |||
3349 | sdio_release_host(func); | ||
3350 | |||
3351 | + /* Set fw_ready before queuing any commands so that | ||
3352 | + * lbs_thread won't block from sending them to firmware. | ||
3353 | + */ | ||
3354 | + priv->fw_ready = 1; | ||
3355 | + | ||
3356 | /* | ||
3357 | * FUNC_INIT is required for SD8688 WLAN/BT multiple functions | ||
3358 | */ | ||
3359 | @@ -839,7 +844,6 @@ static void if_sdio_finish_power_on(struct if_sdio_card *card) | ||
3360 | netdev_alert(priv->dev, "CMD_FUNC_INIT cmd failed\n"); | ||
3361 | } | ||
3362 | |||
3363 | - priv->fw_ready = 1; | ||
3364 | wake_up(&card->pwron_waitq); | ||
3365 | |||
3366 | if (!card->started) { | ||
3367 | diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c | ||
3368 | index b879e13..0bbea88 100644 | ||
3369 | --- a/drivers/net/wireless/mwifiex/pcie.c | ||
3370 | +++ b/drivers/net/wireless/mwifiex/pcie.c | ||
3371 | @@ -291,7 +291,7 @@ static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter) | ||
3372 | i++; | ||
3373 | usleep_range(10, 20); | ||
3374 | /* 50ms max wait */ | ||
3375 | - if (i == 50000) | ||
3376 | + if (i == 5000) | ||
3377 | break; | ||
3378 | } | ||
3379 | |||
3380 | diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c | ||
3381 | index afed701..684ce75 100644 | ||
3382 | --- a/drivers/platform/x86/acer-wmi.c | ||
3383 | +++ b/drivers/platform/x86/acer-wmi.c | ||
3384 | @@ -1204,6 +1204,9 @@ static acpi_status WMID_set_capabilities(void) | ||
3385 | devices = *((u32 *) obj->buffer.pointer); | ||
3386 | } else if (obj->type == ACPI_TYPE_INTEGER) { | ||
3387 | devices = (u32) obj->integer.value; | ||
3388 | + } else { | ||
3389 | + kfree(out.pointer); | ||
3390 | + return AE_ERROR; | ||
3391 | } | ||
3392 | } else { | ||
3393 | kfree(out.pointer); | ||
3394 | diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c | ||
3395 | index b8ad71f..0fe987f 100644 | ||
3396 | --- a/drivers/platform/x86/sony-laptop.c | ||
3397 | +++ b/drivers/platform/x86/sony-laptop.c | ||
3398 | @@ -1534,7 +1534,7 @@ static int sony_nc_rfkill_set(void *data, bool blocked) | ||
3399 | int argument = sony_rfkill_address[(long) data] + 0x100; | ||
3400 | |||
3401 | if (!blocked) | ||
3402 | - argument |= 0x030000; | ||
3403 | + argument |= 0x070000; | ||
3404 | |||
3405 | return sony_call_snc_handle(sony_rfkill_handle, argument, &result); | ||
3406 | } | ||
3407 | diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c | ||
3408 | index 57233c8..8f87fec 100644 | ||
3409 | --- a/drivers/rtc/rtc-mv.c | ||
3410 | +++ b/drivers/rtc/rtc-mv.c | ||
3411 | @@ -14,6 +14,7 @@ | ||
3412 | #include <linux/platform_device.h> | ||
3413 | #include <linux/of.h> | ||
3414 | #include <linux/delay.h> | ||
3415 | +#include <linux/clk.h> | ||
3416 | #include <linux/gfp.h> | ||
3417 | #include <linux/module.h> | ||
3418 | |||
3419 | @@ -41,6 +42,7 @@ struct rtc_plat_data { | ||
3420 | struct rtc_device *rtc; | ||
3421 | void __iomem *ioaddr; | ||
3422 | int irq; | ||
3423 | + struct clk *clk; | ||
3424 | }; | ||
3425 | |||
3426 | static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm) | ||
3427 | @@ -221,6 +223,7 @@ static int mv_rtc_probe(struct platform_device *pdev) | ||
3428 | struct rtc_plat_data *pdata; | ||
3429 | resource_size_t size; | ||
3430 | u32 rtc_time; | ||
3431 | + int ret = 0; | ||
3432 | |||
3433 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
3434 | if (!res) | ||
3435 | @@ -239,11 +242,17 @@ static int mv_rtc_probe(struct platform_device *pdev) | ||
3436 | if (!pdata->ioaddr) | ||
3437 | return -ENOMEM; | ||
3438 | |||
3439 | + pdata->clk = devm_clk_get(&pdev->dev, NULL); | ||
3440 | + /* Not all SoCs require a clock.*/ | ||
3441 | + if (!IS_ERR(pdata->clk)) | ||
3442 | + clk_prepare_enable(pdata->clk); | ||
3443 | + | ||
3444 | /* make sure the 24 hours mode is enabled */ | ||
3445 | rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS); | ||
3446 | if (rtc_time & RTC_HOURS_12H_MODE) { | ||
3447 | dev_err(&pdev->dev, "24 Hours mode not supported.\n"); | ||
3448 | - return -EINVAL; | ||
3449 | + ret = -EINVAL; | ||
3450 | + goto out; | ||
3451 | } | ||
3452 | |||
3453 | /* make sure it is actually functional */ | ||
3454 | @@ -252,7 +261,8 @@ static int mv_rtc_probe(struct platform_device *pdev) | ||
3455 | rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS); | ||
3456 | if (rtc_time == 0x01000000) { | ||
3457 | dev_err(&pdev->dev, "internal RTC not ticking\n"); | ||
3458 | - return -ENODEV; | ||
3459 | + ret = -ENODEV; | ||
3460 | + goto out; | ||
3461 | } | ||
3462 | } | ||
3463 | |||
3464 | @@ -268,8 +278,10 @@ static int mv_rtc_probe(struct platform_device *pdev) | ||
3465 | } else | ||
3466 | pdata->rtc = rtc_device_register(pdev->name, &pdev->dev, | ||
3467 | &mv_rtc_ops, THIS_MODULE); | ||
3468 | - if (IS_ERR(pdata->rtc)) | ||
3469 | - return PTR_ERR(pdata->rtc); | ||
3470 | + if (IS_ERR(pdata->rtc)) { | ||
3471 | + ret = PTR_ERR(pdata->rtc); | ||
3472 | + goto out; | ||
3473 | + } | ||
3474 | |||
3475 | if (pdata->irq >= 0) { | ||
3476 | writel(0, pdata->ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); | ||
3477 | @@ -282,6 +294,11 @@ static int mv_rtc_probe(struct platform_device *pdev) | ||
3478 | } | ||
3479 | |||
3480 | return 0; | ||
3481 | +out: | ||
3482 | + if (!IS_ERR(pdata->clk)) | ||
3483 | + clk_disable_unprepare(pdata->clk); | ||
3484 | + | ||
3485 | + return ret; | ||
3486 | } | ||
3487 | |||
3488 | static int __exit mv_rtc_remove(struct platform_device *pdev) | ||
3489 | @@ -292,6 +309,9 @@ static int __exit mv_rtc_remove(struct platform_device *pdev) | ||
3490 | device_init_wakeup(&pdev->dev, 0); | ||
3491 | |||
3492 | rtc_device_unregister(pdata->rtc); | ||
3493 | + if (!IS_ERR(pdata->clk)) | ||
3494 | + clk_disable_unprepare(pdata->clk); | ||
3495 | + | ||
3496 | return 0; | ||
3497 | } | ||
3498 | |||
3499 | diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c | ||
3500 | index 865c64f..fed486bf 100644 | ||
3501 | --- a/drivers/scsi/dc395x.c | ||
3502 | +++ b/drivers/scsi/dc395x.c | ||
3503 | @@ -3747,13 +3747,13 @@ static struct DeviceCtlBlk *device_alloc(struct AdapterCtlBlk *acb, | ||
3504 | dcb->max_command = 1; | ||
3505 | dcb->target_id = target; | ||
3506 | dcb->target_lun = lun; | ||
3507 | + dcb->dev_mode = eeprom->target[target].cfg0; | ||
3508 | #ifndef DC395x_NO_DISCONNECT | ||
3509 | dcb->identify_msg = | ||
3510 | IDENTIFY(dcb->dev_mode & NTC_DO_DISCONNECT, lun); | ||
3511 | #else | ||
3512 | dcb->identify_msg = IDENTIFY(0, lun); | ||
3513 | #endif | ||
3514 | - dcb->dev_mode = eeprom->target[target].cfg0; | ||
3515 | dcb->inquiry7 = 0; | ||
3516 | dcb->sync_mode = 0; | ||
3517 | dcb->min_nego_period = clock_period[period_index]; | ||
3518 | diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c | ||
3519 | index 0144078..9f4e560 100644 | ||
3520 | --- a/drivers/scsi/storvsc_drv.c | ||
3521 | +++ b/drivers/scsi/storvsc_drv.c | ||
3522 | @@ -467,6 +467,7 @@ static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl, | ||
3523 | if (!bounce_sgl) | ||
3524 | return NULL; | ||
3525 | |||
3526 | + sg_init_table(bounce_sgl, num_pages); | ||
3527 | for (i = 0; i < num_pages; i++) { | ||
3528 | page_buf = alloc_page(GFP_ATOMIC); | ||
3529 | if (!page_buf) | ||
3530 | diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c | ||
3531 | index 339f97f..42a2bf7 100644 | ||
3532 | --- a/drivers/target/iscsi/iscsi_target.c | ||
3533 | +++ b/drivers/target/iscsi/iscsi_target.c | ||
3534 | @@ -3570,6 +3570,10 @@ check_rsp_state: | ||
3535 | spin_lock_bh(&cmd->istate_lock); | ||
3536 | cmd->i_state = ISTATE_SENT_STATUS; | ||
3537 | spin_unlock_bh(&cmd->istate_lock); | ||
3538 | + | ||
3539 | + if (atomic_read(&conn->check_immediate_queue)) | ||
3540 | + return 1; | ||
3541 | + | ||
3542 | continue; | ||
3543 | } else if (ret == 2) { | ||
3544 | /* Still must send status, | ||
3545 | @@ -3659,7 +3663,7 @@ check_rsp_state: | ||
3546 | } | ||
3547 | |||
3548 | if (atomic_read(&conn->check_immediate_queue)) | ||
3549 | - break; | ||
3550 | + return 1; | ||
3551 | } | ||
3552 | |||
3553 | return 0; | ||
3554 | @@ -3703,12 +3707,15 @@ restart: | ||
3555 | signal_pending(current)) | ||
3556 | goto transport_err; | ||
3557 | |||
3558 | +get_immediate: | ||
3559 | ret = handle_immediate_queue(conn); | ||
3560 | if (ret < 0) | ||
3561 | goto transport_err; | ||
3562 | |||
3563 | ret = handle_response_queue(conn); | ||
3564 | - if (ret == -EAGAIN) | ||
3565 | + if (ret == 1) | ||
3566 | + goto get_immediate; | ||
3567 | + else if (ret == -EAGAIN) | ||
3568 | goto restart; | ||
3569 | else if (ret < 0) | ||
3570 | goto transport_err; | ||
3571 | diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c | ||
3572 | index 2bcfd79..55b9530 100644 | ||
3573 | --- a/drivers/target/target_core_pscsi.c | ||
3574 | +++ b/drivers/target/target_core_pscsi.c | ||
3575 | @@ -940,7 +940,6 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | ||
3576 | bio = NULL; | ||
3577 | } | ||
3578 | |||
3579 | - page++; | ||
3580 | len -= bytes; | ||
3581 | data_len -= bytes; | ||
3582 | off = 0; | ||
3583 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c | ||
3584 | index cbf7168..2a89588 100644 | ||
3585 | --- a/drivers/usb/core/hub.c | ||
3586 | +++ b/drivers/usb/core/hub.c | ||
3587 | @@ -2538,70 +2538,35 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, | ||
3588 | if ((portstatus & USB_PORT_STAT_RESET)) | ||
3589 | goto delay; | ||
3590 | |||
3591 | - /* | ||
3592 | - * Some buggy devices require a warm reset to be issued even | ||
3593 | - * when the port appears not to be connected. | ||
3594 | + if (hub_port_warm_reset_required(hub, portstatus)) | ||
3595 | + return -ENOTCONN; | ||
3596 | + | ||
3597 | + /* Device went away? */ | ||
3598 | + if (!(portstatus & USB_PORT_STAT_CONNECTION)) | ||
3599 | + return -ENOTCONN; | ||
3600 | + | ||
3601 | + /* bomb out completely if the connection bounced. A USB 3.0 | ||
3602 | + * connection may bounce if multiple warm resets were issued, | ||
3603 | + * but the device may have successfully re-connected. Ignore it. | ||
3604 | */ | ||
3605 | - if (!warm) { | ||
3606 | - /* | ||
3607 | - * Some buggy devices can cause an NEC host controller | ||
3608 | - * to transition to the "Error" state after a hot port | ||
3609 | - * reset. This will show up as the port state in | ||
3610 | - * "Inactive", and the port may also report a | ||
3611 | - * disconnect. Forcing a warm port reset seems to make | ||
3612 | - * the device work. | ||
3613 | - * | ||
3614 | - * See https://bugzilla.kernel.org/show_bug.cgi?id=41752 | ||
3615 | - */ | ||
3616 | - if (hub_port_warm_reset_required(hub, portstatus)) { | ||
3617 | - int ret; | ||
3618 | - | ||
3619 | - if ((portchange & USB_PORT_STAT_C_CONNECTION)) | ||
3620 | - clear_port_feature(hub->hdev, port1, | ||
3621 | - USB_PORT_FEAT_C_CONNECTION); | ||
3622 | - if (portchange & USB_PORT_STAT_C_LINK_STATE) | ||
3623 | - clear_port_feature(hub->hdev, port1, | ||
3624 | - USB_PORT_FEAT_C_PORT_LINK_STATE); | ||
3625 | - if (portchange & USB_PORT_STAT_C_RESET) | ||
3626 | - clear_port_feature(hub->hdev, port1, | ||
3627 | - USB_PORT_FEAT_C_RESET); | ||
3628 | - dev_dbg(hub->intfdev, "hot reset failed, warm reset port %d\n", | ||
3629 | - port1); | ||
3630 | - ret = hub_port_reset(hub, port1, | ||
3631 | - udev, HUB_BH_RESET_TIME, | ||
3632 | - true); | ||
3633 | - if ((portchange & USB_PORT_STAT_C_CONNECTION)) | ||
3634 | - clear_port_feature(hub->hdev, port1, | ||
3635 | - USB_PORT_FEAT_C_CONNECTION); | ||
3636 | - return ret; | ||
3637 | - } | ||
3638 | - /* Device went away? */ | ||
3639 | - if (!(portstatus & USB_PORT_STAT_CONNECTION)) | ||
3640 | - return -ENOTCONN; | ||
3641 | - | ||
3642 | - /* bomb out completely if the connection bounced */ | ||
3643 | - if ((portchange & USB_PORT_STAT_C_CONNECTION)) | ||
3644 | - return -ENOTCONN; | ||
3645 | - | ||
3646 | - if ((portstatus & USB_PORT_STAT_ENABLE)) { | ||
3647 | - if (hub_is_wusb(hub)) | ||
3648 | - udev->speed = USB_SPEED_WIRELESS; | ||
3649 | - else if (hub_is_superspeed(hub->hdev)) | ||
3650 | - udev->speed = USB_SPEED_SUPER; | ||
3651 | - else if (portstatus & USB_PORT_STAT_HIGH_SPEED) | ||
3652 | - udev->speed = USB_SPEED_HIGH; | ||
3653 | - else if (portstatus & USB_PORT_STAT_LOW_SPEED) | ||
3654 | - udev->speed = USB_SPEED_LOW; | ||
3655 | - else | ||
3656 | - udev->speed = USB_SPEED_FULL; | ||
3657 | + if (!hub_is_superspeed(hub->hdev) && | ||
3658 | + (portchange & USB_PORT_STAT_C_CONNECTION)) | ||
3659 | + return -ENOTCONN; | ||
3660 | + | ||
3661 | + if ((portstatus & USB_PORT_STAT_ENABLE)) { | ||
3662 | + if (!udev) | ||
3663 | return 0; | ||
3664 | - } | ||
3665 | - } else { | ||
3666 | - if (!(portstatus & USB_PORT_STAT_CONNECTION) || | ||
3667 | - hub_port_warm_reset_required(hub, | ||
3668 | - portstatus)) | ||
3669 | - return -ENOTCONN; | ||
3670 | |||
3671 | + if (hub_is_wusb(hub)) | ||
3672 | + udev->speed = USB_SPEED_WIRELESS; | ||
3673 | + else if (hub_is_superspeed(hub->hdev)) | ||
3674 | + udev->speed = USB_SPEED_SUPER; | ||
3675 | + else if (portstatus & USB_PORT_STAT_HIGH_SPEED) | ||
3676 | + udev->speed = USB_SPEED_HIGH; | ||
3677 | + else if (portstatus & USB_PORT_STAT_LOW_SPEED) | ||
3678 | + udev->speed = USB_SPEED_LOW; | ||
3679 | + else | ||
3680 | + udev->speed = USB_SPEED_FULL; | ||
3681 | return 0; | ||
3682 | } | ||
3683 | |||
3684 | @@ -2619,16 +2584,16 @@ delay: | ||
3685 | } | ||
3686 | |||
3687 | static void hub_port_finish_reset(struct usb_hub *hub, int port1, | ||
3688 | - struct usb_device *udev, int *status, bool warm) | ||
3689 | + struct usb_device *udev, int *status) | ||
3690 | { | ||
3691 | switch (*status) { | ||
3692 | case 0: | ||
3693 | - if (!warm) { | ||
3694 | - struct usb_hcd *hcd; | ||
3695 | - /* TRSTRCY = 10 ms; plus some extra */ | ||
3696 | - msleep(10 + 40); | ||
3697 | + /* TRSTRCY = 10 ms; plus some extra */ | ||
3698 | + msleep(10 + 40); | ||
3699 | + if (udev) { | ||
3700 | + struct usb_hcd *hcd = bus_to_hcd(udev->bus); | ||
3701 | + | ||
3702 | update_devnum(udev, 0); | ||
3703 | - hcd = bus_to_hcd(udev->bus); | ||
3704 | /* The xHC may think the device is already reset, | ||
3705 | * so ignore the status. | ||
3706 | */ | ||
3707 | @@ -2640,14 +2605,15 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1, | ||
3708 | case -ENODEV: | ||
3709 | clear_port_feature(hub->hdev, | ||
3710 | port1, USB_PORT_FEAT_C_RESET); | ||
3711 | - /* FIXME need disconnect() for NOTATTACHED device */ | ||
3712 | if (hub_is_superspeed(hub->hdev)) { | ||
3713 | clear_port_feature(hub->hdev, port1, | ||
3714 | USB_PORT_FEAT_C_BH_PORT_RESET); | ||
3715 | clear_port_feature(hub->hdev, port1, | ||
3716 | USB_PORT_FEAT_C_PORT_LINK_STATE); | ||
3717 | + clear_port_feature(hub->hdev, port1, | ||
3718 | + USB_PORT_FEAT_C_CONNECTION); | ||
3719 | } | ||
3720 | - if (!warm) | ||
3721 | + if (udev) | ||
3722 | usb_set_device_state(udev, *status | ||
3723 | ? USB_STATE_NOTATTACHED | ||
3724 | : USB_STATE_DEFAULT); | ||
3725 | @@ -2660,18 +2626,30 @@ static int hub_port_reset(struct usb_hub *hub, int port1, | ||
3726 | struct usb_device *udev, unsigned int delay, bool warm) | ||
3727 | { | ||
3728 | int i, status; | ||
3729 | + u16 portchange, portstatus; | ||
3730 | |||
3731 | - if (!warm) { | ||
3732 | - /* Block EHCI CF initialization during the port reset. | ||
3733 | - * Some companion controllers don't like it when they mix. | ||
3734 | - */ | ||
3735 | - down_read(&ehci_cf_port_reset_rwsem); | ||
3736 | - } else { | ||
3737 | - if (!hub_is_superspeed(hub->hdev)) { | ||
3738 | + if (!hub_is_superspeed(hub->hdev)) { | ||
3739 | + if (warm) { | ||
3740 | dev_err(hub->intfdev, "only USB3 hub support " | ||
3741 | "warm reset\n"); | ||
3742 | return -EINVAL; | ||
3743 | } | ||
3744 | + /* Block EHCI CF initialization during the port reset. | ||
3745 | + * Some companion controllers don't like it when they mix. | ||
3746 | + */ | ||
3747 | + down_read(&ehci_cf_port_reset_rwsem); | ||
3748 | + } else if (!warm) { | ||
3749 | + /* | ||
3750 | + * If the caller hasn't explicitly requested a warm reset, | ||
3751 | + * double check and see if one is needed. | ||
3752 | + */ | ||
3753 | + status = hub_port_status(hub, port1, | ||
3754 | + &portstatus, &portchange); | ||
3755 | + if (status < 0) | ||
3756 | + goto done; | ||
3757 | + | ||
3758 | + if (hub_port_warm_reset_required(hub, portstatus)) | ||
3759 | + warm = true; | ||
3760 | } | ||
3761 | |||
3762 | /* Reset the port */ | ||
3763 | @@ -2692,10 +2670,33 @@ static int hub_port_reset(struct usb_hub *hub, int port1, | ||
3764 | status); | ||
3765 | } | ||
3766 | |||
3767 | - /* return on disconnect or reset */ | ||
3768 | + /* Check for disconnect or reset */ | ||
3769 | if (status == 0 || status == -ENOTCONN || status == -ENODEV) { | ||
3770 | - hub_port_finish_reset(hub, port1, udev, &status, warm); | ||
3771 | - goto done; | ||
3772 | + hub_port_finish_reset(hub, port1, udev, &status); | ||
3773 | + | ||
3774 | + if (!hub_is_superspeed(hub->hdev)) | ||
3775 | + goto done; | ||
3776 | + | ||
3777 | + /* | ||
3778 | + * If a USB 3.0 device migrates from reset to an error | ||
3779 | + * state, re-issue the warm reset. | ||
3780 | + */ | ||
3781 | + if (hub_port_status(hub, port1, | ||
3782 | + &portstatus, &portchange) < 0) | ||
3783 | + goto done; | ||
3784 | + | ||
3785 | + if (!hub_port_warm_reset_required(hub, portstatus)) | ||
3786 | + goto done; | ||
3787 | + | ||
3788 | + /* | ||
3789 | + * If the port is in SS.Inactive or Compliance Mode, the | ||
3790 | + * hot or warm reset failed. Try another warm reset. | ||
3791 | + */ | ||
3792 | + if (!warm) { | ||
3793 | + dev_dbg(hub->intfdev, "hot reset failed, warm reset port %d\n", | ||
3794 | + port1); | ||
3795 | + warm = true; | ||
3796 | + } | ||
3797 | } | ||
3798 | |||
3799 | dev_dbg (hub->intfdev, | ||
3800 | @@ -2709,7 +2710,7 @@ static int hub_port_reset(struct usb_hub *hub, int port1, | ||
3801 | port1); | ||
3802 | |||
3803 | done: | ||
3804 | - if (!warm) | ||
3805 | + if (!hub_is_superspeed(hub->hdev)) | ||
3806 | up_read(&ehci_cf_port_reset_rwsem); | ||
3807 | |||
3808 | return status; | ||
3809 | @@ -4740,12 +4741,21 @@ static void hub_events(void) | ||
3810 | */ | ||
3811 | if (hub_port_warm_reset_required(hub, portstatus)) { | ||
3812 | int status; | ||
3813 | + struct usb_device *udev = | ||
3814 | + hub->ports[i - 1]->child; | ||
3815 | |||
3816 | dev_dbg(hub_dev, "warm reset port %d\n", i); | ||
3817 | - status = hub_port_reset(hub, i, NULL, | ||
3818 | - HUB_BH_RESET_TIME, true); | ||
3819 | - if (status < 0) | ||
3820 | - hub_port_disable(hub, i, 1); | ||
3821 | + if (!udev) { | ||
3822 | + status = hub_port_reset(hub, i, | ||
3823 | + NULL, HUB_BH_RESET_TIME, | ||
3824 | + true); | ||
3825 | + if (status < 0) | ||
3826 | + hub_port_disable(hub, i, 1); | ||
3827 | + } else { | ||
3828 | + usb_lock_device(udev); | ||
3829 | + status = usb_reset_device(udev); | ||
3830 | + usb_unlock_device(udev); | ||
3831 | + } | ||
3832 | connect_change = 0; | ||
3833 | } | ||
3834 | |||
3835 | diff --git a/drivers/usb/host/ehci-timer.c b/drivers/usb/host/ehci-timer.c | ||
3836 | index f904071..20dbdcb 100644 | ||
3837 | --- a/drivers/usb/host/ehci-timer.c | ||
3838 | +++ b/drivers/usb/host/ehci-timer.c | ||
3839 | @@ -113,15 +113,14 @@ static void ehci_poll_ASS(struct ehci_hcd *ehci) | ||
3840 | |||
3841 | if (want != actual) { | ||
3842 | |||
3843 | - /* Poll again later */ | ||
3844 | - ehci_enable_event(ehci, EHCI_HRTIMER_POLL_ASS, true); | ||
3845 | - ++ehci->ASS_poll_count; | ||
3846 | - return; | ||
3847 | + /* Poll again later, but give up after about 20 ms */ | ||
3848 | + if (ehci->ASS_poll_count++ < 20) { | ||
3849 | + ehci_enable_event(ehci, EHCI_HRTIMER_POLL_ASS, true); | ||
3850 | + return; | ||
3851 | + } | ||
3852 | + ehci_dbg(ehci, "Waited too long for the async schedule status (%x/%x), giving up\n", | ||
3853 | + want, actual); | ||
3854 | } | ||
3855 | - | ||
3856 | - if (ehci->ASS_poll_count > 20) | ||
3857 | - ehci_dbg(ehci, "ASS poll count reached %d\n", | ||
3858 | - ehci->ASS_poll_count); | ||
3859 | ehci->ASS_poll_count = 0; | ||
3860 | |||
3861 | /* The status is up-to-date; restart or stop the schedule as needed */ | ||
3862 | @@ -160,14 +159,14 @@ static void ehci_poll_PSS(struct ehci_hcd *ehci) | ||
3863 | |||
3864 | if (want != actual) { | ||
3865 | |||
3866 | - /* Poll again later */ | ||
3867 | - ehci_enable_event(ehci, EHCI_HRTIMER_POLL_PSS, true); | ||
3868 | - return; | ||
3869 | + /* Poll again later, but give up after about 20 ms */ | ||
3870 | + if (ehci->PSS_poll_count++ < 20) { | ||
3871 | + ehci_enable_event(ehci, EHCI_HRTIMER_POLL_PSS, true); | ||
3872 | + return; | ||
3873 | + } | ||
3874 | + ehci_dbg(ehci, "Waited too long for the periodic schedule status (%x/%x), giving up\n", | ||
3875 | + want, actual); | ||
3876 | } | ||
3877 | - | ||
3878 | - if (ehci->PSS_poll_count > 20) | ||
3879 | - ehci_dbg(ehci, "PSS poll count reached %d\n", | ||
3880 | - ehci->PSS_poll_count); | ||
3881 | ehci->PSS_poll_count = 0; | ||
3882 | |||
3883 | /* The status is up-to-date; restart or stop the schedule as needed */ | ||
3884 | diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c | ||
3885 | index 85b363a..d39dfa4 100644 | ||
3886 | --- a/drivers/w1/masters/w1-gpio.c | ||
3887 | +++ b/drivers/w1/masters/w1-gpio.c | ||
3888 | @@ -72,7 +72,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) | ||
3889 | return 0; | ||
3890 | } | ||
3891 | |||
3892 | -static int __init w1_gpio_probe(struct platform_device *pdev) | ||
3893 | +static int w1_gpio_probe(struct platform_device *pdev) | ||
3894 | { | ||
3895 | struct w1_bus_master *master; | ||
3896 | struct w1_gpio_platform_data *pdata; | ||
3897 | diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig | ||
3898 | index 7f809fd..19fa73a 100644 | ||
3899 | --- a/drivers/watchdog/Kconfig | ||
3900 | +++ b/drivers/watchdog/Kconfig | ||
3901 | @@ -79,6 +79,7 @@ config DA9052_WATCHDOG | ||
3902 | config DA9055_WATCHDOG | ||
3903 | tristate "Dialog Semiconductor DA9055 Watchdog" | ||
3904 | depends on MFD_DA9055 | ||
3905 | + select WATCHDOG_CORE | ||
3906 | help | ||
3907 | If you say yes here you get support for watchdog on the Dialog | ||
3908 | Semiconductor DA9055 PMIC. | ||
3909 | diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c | ||
3910 | index 2b0e000..e3b8f75 100644 | ||
3911 | --- a/drivers/watchdog/sp5100_tco.c | ||
3912 | +++ b/drivers/watchdog/sp5100_tco.c | ||
3913 | @@ -361,7 +361,7 @@ static unsigned char sp5100_tco_setupdevice(void) | ||
3914 | { | ||
3915 | struct pci_dev *dev = NULL; | ||
3916 | const char *dev_name = NULL; | ||
3917 | - u32 val; | ||
3918 | + u32 val, tmp_val; | ||
3919 | u32 index_reg, data_reg, base_addr; | ||
3920 | |||
3921 | /* Match the PCI device */ | ||
3922 | @@ -497,30 +497,19 @@ static unsigned char sp5100_tco_setupdevice(void) | ||
3923 | pr_debug("Got 0x%04x from resource tree\n", val); | ||
3924 | } | ||
3925 | |||
3926 | - /* Restore to the low three bits, if chipset is SB8x0(or later) */ | ||
3927 | - if (sp5100_tco_pci->revision >= 0x40) { | ||
3928 | - u8 reserved_bit; | ||
3929 | - reserved_bit = inb(base_addr) & 0x7; | ||
3930 | - val |= (u32)reserved_bit; | ||
3931 | - } | ||
3932 | + /* Restore to the low three bits */ | ||
3933 | + outb(base_addr+0, index_reg); | ||
3934 | + tmp_val = val | (inb(data_reg) & 0x7); | ||
3935 | |||
3936 | /* Re-programming the watchdog timer base address */ | ||
3937 | outb(base_addr+0, index_reg); | ||
3938 | - /* Low three bits of BASE are reserved */ | ||
3939 | - outb((val >> 0) & 0xf8, data_reg); | ||
3940 | + outb((tmp_val >> 0) & 0xff, data_reg); | ||
3941 | outb(base_addr+1, index_reg); | ||
3942 | - outb((val >> 8) & 0xff, data_reg); | ||
3943 | + outb((tmp_val >> 8) & 0xff, data_reg); | ||
3944 | outb(base_addr+2, index_reg); | ||
3945 | - outb((val >> 16) & 0xff, data_reg); | ||
3946 | + outb((tmp_val >> 16) & 0xff, data_reg); | ||
3947 | outb(base_addr+3, index_reg); | ||
3948 | - outb((val >> 24) & 0xff, data_reg); | ||
3949 | - | ||
3950 | - /* | ||
3951 | - * Clear unnecessary the low three bits, | ||
3952 | - * if chipset is SB8x0(or later) | ||
3953 | - */ | ||
3954 | - if (sp5100_tco_pci->revision >= 0x40) | ||
3955 | - val &= ~0x7; | ||
3956 | + outb((tmp_val >> 24) & 0xff, data_reg); | ||
3957 | |||
3958 | if (!request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE, | ||
3959 | dev_name)) { | ||
3960 | diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c | ||
3961 | index bcf3ba4..61786be 100644 | ||
3962 | --- a/drivers/xen/xenbus/xenbus_client.c | ||
3963 | +++ b/drivers/xen/xenbus/xenbus_client.c | ||
3964 | @@ -30,6 +30,7 @@ | ||
3965 | * IN THE SOFTWARE. | ||
3966 | */ | ||
3967 | |||
3968 | +#include <linux/mm.h> | ||
3969 | #include <linux/slab.h> | ||
3970 | #include <linux/types.h> | ||
3971 | #include <linux/spinlock.h> | ||
3972 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c | ||
3973 | index cc93b23..659ea81 100644 | ||
3974 | --- a/fs/btrfs/inode.c | ||
3975 | +++ b/fs/btrfs/inode.c | ||
3976 | @@ -265,6 +265,7 @@ static noinline int cow_file_range_inline(struct btrfs_trans_handle *trans, | ||
3977 | return 1; | ||
3978 | } | ||
3979 | |||
3980 | + set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &BTRFS_I(inode)->runtime_flags); | ||
3981 | btrfs_delalloc_release_metadata(inode, end + 1 - start); | ||
3982 | btrfs_drop_extent_cache(inode, start, aligned_end - 1, 0); | ||
3983 | return 0; | ||
3984 | @@ -2469,6 +2470,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) | ||
3985 | */ | ||
3986 | set_bit(BTRFS_INODE_HAS_ORPHAN_ITEM, | ||
3987 | &BTRFS_I(inode)->runtime_flags); | ||
3988 | + atomic_inc(&root->orphan_inodes); | ||
3989 | |||
3990 | /* if we have links, this was a truncate, lets do that */ | ||
3991 | if (inode->i_nlink) { | ||
3992 | @@ -2491,6 +2493,8 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) | ||
3993 | goto out; | ||
3994 | |||
3995 | ret = btrfs_truncate(inode); | ||
3996 | + if (ret) | ||
3997 | + btrfs_orphan_del(NULL, inode); | ||
3998 | } else { | ||
3999 | nr_unlink++; | ||
4000 | } | ||
4001 | diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c | ||
4002 | index 9027bb1..b6818ee 100644 | ||
4003 | --- a/fs/btrfs/tree-log.c | ||
4004 | +++ b/fs/btrfs/tree-log.c | ||
4005 | @@ -3281,6 +3281,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans, | ||
4006 | int ret; | ||
4007 | bool skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; | ||
4008 | |||
4009 | +insert: | ||
4010 | INIT_LIST_HEAD(&ordered_sums); | ||
4011 | btrfs_init_map_token(&token); | ||
4012 | key.objectid = btrfs_ino(inode); | ||
4013 | @@ -3296,6 +3297,23 @@ static int log_one_extent(struct btrfs_trans_handle *trans, | ||
4014 | leaf = path->nodes[0]; | ||
4015 | fi = btrfs_item_ptr(leaf, path->slots[0], | ||
4016 | struct btrfs_file_extent_item); | ||
4017 | + | ||
4018 | + /* | ||
4019 | + * If we are overwriting an inline extent with a real one then we need | ||
4020 | + * to just delete the inline extent as it may not be large enough to | ||
4021 | + * have the entire file_extent_item. | ||
4022 | + */ | ||
4023 | + if (ret && btrfs_token_file_extent_type(leaf, fi, &token) == | ||
4024 | + BTRFS_FILE_EXTENT_INLINE) { | ||
4025 | + ret = btrfs_del_item(trans, log, path); | ||
4026 | + btrfs_release_path(path); | ||
4027 | + if (ret) { | ||
4028 | + path->really_keep_locks = 0; | ||
4029 | + return ret; | ||
4030 | + } | ||
4031 | + goto insert; | ||
4032 | + } | ||
4033 | + | ||
4034 | btrfs_set_token_file_extent_generation(leaf, fi, em->generation, | ||
4035 | &token); | ||
4036 | if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) { | ||
4037 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c | ||
4038 | index 5cbb7f4..ac8ff8d 100644 | ||
4039 | --- a/fs/btrfs/volumes.c | ||
4040 | +++ b/fs/btrfs/volumes.c | ||
4041 | @@ -647,6 +647,7 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices) | ||
4042 | new_device->writeable = 0; | ||
4043 | new_device->in_fs_metadata = 0; | ||
4044 | new_device->can_discard = 0; | ||
4045 | + spin_lock_init(&new_device->io_lock); | ||
4046 | list_replace_rcu(&device->dev_list, &new_device->dev_list); | ||
4047 | |||
4048 | call_rcu(&device->rcu, free_device); | ||
4049 | diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c | ||
4050 | index de7f916..e328339 100644 | ||
4051 | --- a/fs/cifs/cifsfs.c | ||
4052 | +++ b/fs/cifs/cifsfs.c | ||
4053 | @@ -558,6 +558,11 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb) | ||
4054 | dentry = ERR_PTR(-ENOENT); | ||
4055 | break; | ||
4056 | } | ||
4057 | + if (!S_ISDIR(dir->i_mode)) { | ||
4058 | + dput(dentry); | ||
4059 | + dentry = ERR_PTR(-ENOTDIR); | ||
4060 | + break; | ||
4061 | + } | ||
4062 | |||
4063 | /* skip separators */ | ||
4064 | while (*s == sep) | ||
4065 | diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c | ||
4066 | index c9c7aa7..bceffe7 100644 | ||
4067 | --- a/fs/cifs/smb2ops.c | ||
4068 | +++ b/fs/cifs/smb2ops.c | ||
4069 | @@ -744,4 +744,5 @@ struct smb_version_values smb30_values = { | ||
4070 | .cap_unix = 0, | ||
4071 | .cap_nt_find = SMB2_NT_FIND, | ||
4072 | .cap_large_files = SMB2_LARGE_FILES, | ||
4073 | + .oplock_read = SMB2_OPLOCK_LEVEL_II, | ||
4074 | }; | ||
4075 | diff --git a/fs/compat.c b/fs/compat.c | ||
4076 | index 015e1e1..a06dcbc 100644 | ||
4077 | --- a/fs/compat.c | ||
4078 | +++ b/fs/compat.c | ||
4079 | @@ -558,6 +558,10 @@ ssize_t compat_rw_copy_check_uvector(int type, | ||
4080 | } | ||
4081 | *ret_pointer = iov; | ||
4082 | |||
4083 | + ret = -EFAULT; | ||
4084 | + if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector))) | ||
4085 | + goto out; | ||
4086 | + | ||
4087 | /* | ||
4088 | * Single unix specification: | ||
4089 | * We should -EINVAL if an element length is not >= 0 and fitting an | ||
4090 | @@ -1080,17 +1084,12 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, | ||
4091 | if (!file->f_op) | ||
4092 | goto out; | ||
4093 | |||
4094 | - ret = -EFAULT; | ||
4095 | - if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector))) | ||
4096 | - goto out; | ||
4097 | - | ||
4098 | - tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs, | ||
4099 | + ret = compat_rw_copy_check_uvector(type, uvector, nr_segs, | ||
4100 | UIO_FASTIOV, iovstack, &iov); | ||
4101 | - if (tot_len == 0) { | ||
4102 | - ret = 0; | ||
4103 | + if (ret <= 0) | ||
4104 | goto out; | ||
4105 | - } | ||
4106 | |||
4107 | + tot_len = ret; | ||
4108 | ret = rw_verify_area(type, file, pos, tot_len); | ||
4109 | if (ret < 0) | ||
4110 | goto out; | ||
4111 | diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c | ||
4112 | index 2f2e0da..92e68b3 100644 | ||
4113 | --- a/fs/ext4/balloc.c | ||
4114 | +++ b/fs/ext4/balloc.c | ||
4115 | @@ -635,7 +635,7 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb) | ||
4116 | brelse(bitmap_bh); | ||
4117 | printk(KERN_DEBUG "ext4_count_free_clusters: stored = %llu" | ||
4118 | ", computed = %llu, %llu\n", | ||
4119 | - EXT4_B2C(EXT4_SB(sb), ext4_free_blocks_count(es)), | ||
4120 | + EXT4_NUM_B2C(EXT4_SB(sb), ext4_free_blocks_count(es)), | ||
4121 | desc_count, bitmap_count); | ||
4122 | return bitmap_count; | ||
4123 | #else | ||
4124 | diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c | ||
4125 | index 061727a..28bbf9b 100644 | ||
4126 | --- a/fs/ext4/mballoc.c | ||
4127 | +++ b/fs/ext4/mballoc.c | ||
4128 | @@ -3444,7 +3444,7 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) | ||
4129 | win = offs; | ||
4130 | |||
4131 | ac->ac_b_ex.fe_logical = ac->ac_o_ex.fe_logical - | ||
4132 | - EXT4_B2C(sbi, win); | ||
4133 | + EXT4_NUM_B2C(sbi, win); | ||
4134 | BUG_ON(ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical); | ||
4135 | BUG_ON(ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len); | ||
4136 | } | ||
4137 | @@ -4590,7 +4590,7 @@ do_more: | ||
4138 | EXT4_BLOCKS_PER_GROUP(sb); | ||
4139 | count -= overflow; | ||
4140 | } | ||
4141 | - count_clusters = EXT4_B2C(sbi, count); | ||
4142 | + count_clusters = EXT4_NUM_B2C(sbi, count); | ||
4143 | bitmap_bh = ext4_read_block_bitmap(sb, block_group); | ||
4144 | if (!bitmap_bh) { | ||
4145 | err = -EIO; | ||
4146 | @@ -4832,11 +4832,11 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb, | ||
4147 | ext4_group_desc_csum_set(sb, block_group, desc); | ||
4148 | ext4_unlock_group(sb, block_group); | ||
4149 | percpu_counter_add(&sbi->s_freeclusters_counter, | ||
4150 | - EXT4_B2C(sbi, blocks_freed)); | ||
4151 | + EXT4_NUM_B2C(sbi, blocks_freed)); | ||
4152 | |||
4153 | if (sbi->s_log_groups_per_flex) { | ||
4154 | ext4_group_t flex_group = ext4_flex_group(sbi, block_group); | ||
4155 | - atomic_add(EXT4_B2C(sbi, blocks_freed), | ||
4156 | + atomic_add(EXT4_NUM_B2C(sbi, blocks_freed), | ||
4157 | &sbi->s_flex_groups[flex_group].free_clusters); | ||
4158 | } | ||
4159 | |||
4160 | diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c | ||
4161 | index 02824dc..1aab70d 100644 | ||
4162 | --- a/fs/ext4/resize.c | ||
4163 | +++ b/fs/ext4/resize.c | ||
4164 | @@ -1247,7 +1247,7 @@ static int ext4_setup_new_descs(handle_t *handle, struct super_block *sb, | ||
4165 | |||
4166 | ext4_inode_table_set(sb, gdp, group_data->inode_table); | ||
4167 | ext4_free_group_clusters_set(sb, gdp, | ||
4168 | - EXT4_B2C(sbi, group_data->free_blocks_count)); | ||
4169 | + EXT4_NUM_B2C(sbi, group_data->free_blocks_count)); | ||
4170 | ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb)); | ||
4171 | if (ext4_has_group_desc_csum(sb)) | ||
4172 | ext4_itable_unused_set(sb, gdp, | ||
4173 | @@ -1349,7 +1349,7 @@ static void ext4_update_super(struct super_block *sb, | ||
4174 | |||
4175 | /* Update the free space counts */ | ||
4176 | percpu_counter_add(&sbi->s_freeclusters_counter, | ||
4177 | - EXT4_B2C(sbi, free_blocks)); | ||
4178 | + EXT4_NUM_B2C(sbi, free_blocks)); | ||
4179 | percpu_counter_add(&sbi->s_freeinodes_counter, | ||
4180 | EXT4_INODES_PER_GROUP(sb) * flex_gd->count); | ||
4181 | |||
4182 | @@ -1360,7 +1360,7 @@ static void ext4_update_super(struct super_block *sb, | ||
4183 | sbi->s_log_groups_per_flex) { | ||
4184 | ext4_group_t flex_group; | ||
4185 | flex_group = ext4_flex_group(sbi, group_data[0].group); | ||
4186 | - atomic_add(EXT4_B2C(sbi, free_blocks), | ||
4187 | + atomic_add(EXT4_NUM_B2C(sbi, free_blocks), | ||
4188 | &sbi->s_flex_groups[flex_group].free_clusters); | ||
4189 | atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count, | ||
4190 | &sbi->s_flex_groups[flex_group].free_inodes); | ||
4191 | diff --git a/fs/ext4/super.c b/fs/ext4/super.c | ||
4192 | index 0465f36..5fa223d 100644 | ||
4193 | --- a/fs/ext4/super.c | ||
4194 | +++ b/fs/ext4/super.c | ||
4195 | @@ -3235,7 +3235,7 @@ int ext4_calculate_overhead(struct super_block *sb) | ||
4196 | } | ||
4197 | /* Add the journal blocks as well */ | ||
4198 | if (sbi->s_journal) | ||
4199 | - overhead += EXT4_B2C(sbi, sbi->s_journal->j_maxlen); | ||
4200 | + overhead += EXT4_NUM_B2C(sbi, sbi->s_journal->j_maxlen); | ||
4201 | |||
4202 | sbi->s_overhead = overhead; | ||
4203 | smp_wmb(); | ||
4204 | diff --git a/fs/namei.c b/fs/namei.c | ||
4205 | index 43a97ee..ec97aef 100644 | ||
4206 | --- a/fs/namei.c | ||
4207 | +++ b/fs/namei.c | ||
4208 | @@ -693,8 +693,6 @@ void nd_jump_link(struct nameidata *nd, struct path *path) | ||
4209 | nd->path = *path; | ||
4210 | nd->inode = nd->path.dentry->d_inode; | ||
4211 | nd->flags |= LOOKUP_JUMPED; | ||
4212 | - | ||
4213 | - BUG_ON(nd->inode->i_op->follow_link); | ||
4214 | } | ||
4215 | |||
4216 | static inline void put_link(struct nameidata *nd, struct path *link, void *cookie) | ||
4217 | diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c | ||
4218 | index 194c484..49eeb04 100644 | ||
4219 | --- a/fs/nfs/nfs4filelayout.c | ||
4220 | +++ b/fs/nfs/nfs4filelayout.c | ||
4221 | @@ -99,7 +99,8 @@ static void filelayout_reset_write(struct nfs_write_data *data) | ||
4222 | |||
4223 | task->tk_status = pnfs_write_done_resend_to_mds(hdr->inode, | ||
4224 | &hdr->pages, | ||
4225 | - hdr->completion_ops); | ||
4226 | + hdr->completion_ops, | ||
4227 | + hdr->dreq); | ||
4228 | } | ||
4229 | } | ||
4230 | |||
4231 | @@ -119,7 +120,8 @@ static void filelayout_reset_read(struct nfs_read_data *data) | ||
4232 | |||
4233 | task->tk_status = pnfs_read_done_resend_to_mds(hdr->inode, | ||
4234 | &hdr->pages, | ||
4235 | - hdr->completion_ops); | ||
4236 | + hdr->completion_ops, | ||
4237 | + hdr->dreq); | ||
4238 | } | ||
4239 | } | ||
4240 | |||
4241 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c | ||
4242 | index efda60d..3cb5e77 100644 | ||
4243 | --- a/fs/nfs/nfs4proc.c | ||
4244 | +++ b/fs/nfs/nfs4proc.c | ||
4245 | @@ -6087,11 +6087,13 @@ static struct page **nfs4_alloc_pages(size_t size, gfp_t gfp_flags) | ||
4246 | static void nfs4_layoutget_release(void *calldata) | ||
4247 | { | ||
4248 | struct nfs4_layoutget *lgp = calldata; | ||
4249 | - struct nfs_server *server = NFS_SERVER(lgp->args.inode); | ||
4250 | + struct inode *inode = lgp->args.inode; | ||
4251 | + struct nfs_server *server = NFS_SERVER(inode); | ||
4252 | size_t max_pages = max_response_pages(server); | ||
4253 | |||
4254 | dprintk("--> %s\n", __func__); | ||
4255 | nfs4_free_pages(lgp->args.layout.pages, max_pages); | ||
4256 | + pnfs_put_layout_hdr(NFS_I(inode)->layout); | ||
4257 | put_nfs_open_context(lgp->args.ctx); | ||
4258 | kfree(calldata); | ||
4259 | dprintk("<-- %s\n", __func__); | ||
4260 | @@ -6106,7 +6108,8 @@ static const struct rpc_call_ops nfs4_layoutget_call_ops = { | ||
4261 | struct pnfs_layout_segment * | ||
4262 | nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) | ||
4263 | { | ||
4264 | - struct nfs_server *server = NFS_SERVER(lgp->args.inode); | ||
4265 | + struct inode *inode = lgp->args.inode; | ||
4266 | + struct nfs_server *server = NFS_SERVER(inode); | ||
4267 | size_t max_pages = max_response_pages(server); | ||
4268 | struct rpc_task *task; | ||
4269 | struct rpc_message msg = { | ||
4270 | @@ -6136,6 +6139,10 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) | ||
4271 | lgp->res.layoutp = &lgp->args.layout; | ||
4272 | lgp->res.seq_res.sr_slot = NULL; | ||
4273 | nfs41_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0); | ||
4274 | + | ||
4275 | + /* nfs4_layoutget_release calls pnfs_put_layout_hdr */ | ||
4276 | + pnfs_get_layout_hdr(NFS_I(inode)->layout); | ||
4277 | + | ||
4278 | task = rpc_run_task(&task_setup_data); | ||
4279 | if (IS_ERR(task)) | ||
4280 | return ERR_CAST(task); | ||
4281 | diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c | ||
4282 | index 6be70f6..97767c8 100644 | ||
4283 | --- a/fs/nfs/pnfs.c | ||
4284 | +++ b/fs/nfs/pnfs.c | ||
4285 | @@ -1422,13 +1422,15 @@ EXPORT_SYMBOL_GPL(pnfs_generic_pg_test); | ||
4286 | |||
4287 | int pnfs_write_done_resend_to_mds(struct inode *inode, | ||
4288 | struct list_head *head, | ||
4289 | - const struct nfs_pgio_completion_ops *compl_ops) | ||
4290 | + const struct nfs_pgio_completion_ops *compl_ops, | ||
4291 | + struct nfs_direct_req *dreq) | ||
4292 | { | ||
4293 | struct nfs_pageio_descriptor pgio; | ||
4294 | LIST_HEAD(failed); | ||
4295 | |||
4296 | /* Resend all requests through the MDS */ | ||
4297 | nfs_pageio_init_write(&pgio, inode, FLUSH_STABLE, compl_ops); | ||
4298 | + pgio.pg_dreq = dreq; | ||
4299 | while (!list_empty(head)) { | ||
4300 | struct nfs_page *req = nfs_list_entry(head->next); | ||
4301 | |||
4302 | @@ -1463,7 +1465,8 @@ static void pnfs_ld_handle_write_error(struct nfs_write_data *data) | ||
4303 | if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) | ||
4304 | data->task.tk_status = pnfs_write_done_resend_to_mds(hdr->inode, | ||
4305 | &hdr->pages, | ||
4306 | - hdr->completion_ops); | ||
4307 | + hdr->completion_ops, | ||
4308 | + hdr->dreq); | ||
4309 | } | ||
4310 | |||
4311 | /* | ||
4312 | @@ -1578,13 +1581,15 @@ EXPORT_SYMBOL_GPL(pnfs_generic_pg_writepages); | ||
4313 | |||
4314 | int pnfs_read_done_resend_to_mds(struct inode *inode, | ||
4315 | struct list_head *head, | ||
4316 | - const struct nfs_pgio_completion_ops *compl_ops) | ||
4317 | + const struct nfs_pgio_completion_ops *compl_ops, | ||
4318 | + struct nfs_direct_req *dreq) | ||
4319 | { | ||
4320 | struct nfs_pageio_descriptor pgio; | ||
4321 | LIST_HEAD(failed); | ||
4322 | |||
4323 | /* Resend all requests through the MDS */ | ||
4324 | nfs_pageio_init_read(&pgio, inode, compl_ops); | ||
4325 | + pgio.pg_dreq = dreq; | ||
4326 | while (!list_empty(head)) { | ||
4327 | struct nfs_page *req = nfs_list_entry(head->next); | ||
4328 | |||
4329 | @@ -1615,7 +1620,8 @@ static void pnfs_ld_handle_read_error(struct nfs_read_data *data) | ||
4330 | if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) | ||
4331 | data->task.tk_status = pnfs_read_done_resend_to_mds(hdr->inode, | ||
4332 | &hdr->pages, | ||
4333 | - hdr->completion_ops); | ||
4334 | + hdr->completion_ops, | ||
4335 | + hdr->dreq); | ||
4336 | } | ||
4337 | |||
4338 | /* | ||
4339 | diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h | ||
4340 | index 97cb358..94ba804 100644 | ||
4341 | --- a/fs/nfs/pnfs.h | ||
4342 | +++ b/fs/nfs/pnfs.h | ||
4343 | @@ -230,9 +230,11 @@ struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino, | ||
4344 | |||
4345 | void nfs4_deviceid_mark_client_invalid(struct nfs_client *clp); | ||
4346 | int pnfs_read_done_resend_to_mds(struct inode *inode, struct list_head *head, | ||
4347 | - const struct nfs_pgio_completion_ops *compl_ops); | ||
4348 | + const struct nfs_pgio_completion_ops *compl_ops, | ||
4349 | + struct nfs_direct_req *dreq); | ||
4350 | int pnfs_write_done_resend_to_mds(struct inode *inode, struct list_head *head, | ||
4351 | - const struct nfs_pgio_completion_ops *compl_ops); | ||
4352 | + const struct nfs_pgio_completion_ops *compl_ops, | ||
4353 | + struct nfs_direct_req *dreq); | ||
4354 | struct nfs4_threshold *pnfs_mdsthreshold_alloc(void); | ||
4355 | |||
4356 | /* nfs4_deviceid_flags */ | ||
4357 | diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c | ||
4358 | index 3f79c77..6edc807 100644 | ||
4359 | --- a/fs/nfs/unlink.c | ||
4360 | +++ b/fs/nfs/unlink.c | ||
4361 | @@ -336,20 +336,14 @@ static void nfs_async_rename_done(struct rpc_task *task, void *calldata) | ||
4362 | struct inode *old_dir = data->old_dir; | ||
4363 | struct inode *new_dir = data->new_dir; | ||
4364 | struct dentry *old_dentry = data->old_dentry; | ||
4365 | - struct dentry *new_dentry = data->new_dentry; | ||
4366 | |||
4367 | if (!NFS_PROTO(old_dir)->rename_done(task, old_dir, new_dir)) { | ||
4368 | rpc_restart_call_prepare(task); | ||
4369 | return; | ||
4370 | } | ||
4371 | |||
4372 | - if (task->tk_status != 0) { | ||
4373 | + if (task->tk_status != 0) | ||
4374 | nfs_cancel_async_unlink(old_dentry); | ||
4375 | - return; | ||
4376 | - } | ||
4377 | - | ||
4378 | - d_drop(old_dentry); | ||
4379 | - d_drop(new_dentry); | ||
4380 | } | ||
4381 | |||
4382 | /** | ||
4383 | @@ -550,6 +544,18 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry) | ||
4384 | error = rpc_wait_for_completion_task(task); | ||
4385 | if (error == 0) | ||
4386 | error = task->tk_status; | ||
4387 | + switch (error) { | ||
4388 | + case 0: | ||
4389 | + /* The rename succeeded */ | ||
4390 | + nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | ||
4391 | + d_move(dentry, sdentry); | ||
4392 | + break; | ||
4393 | + case -ERESTARTSYS: | ||
4394 | + /* The result of the rename is unknown. Play it safe by | ||
4395 | + * forcing a new lookup */ | ||
4396 | + d_drop(dentry); | ||
4397 | + d_drop(sdentry); | ||
4398 | + } | ||
4399 | rpc_put_task(task); | ||
4400 | out_dput: | ||
4401 | dput(sdentry); | ||
4402 | diff --git a/fs/pipe.c b/fs/pipe.c | ||
4403 | index bd3479d..8e2e73f 100644 | ||
4404 | --- a/fs/pipe.c | ||
4405 | +++ b/fs/pipe.c | ||
4406 | @@ -863,6 +863,9 @@ pipe_rdwr_open(struct inode *inode, struct file *filp) | ||
4407 | { | ||
4408 | int ret = -ENOENT; | ||
4409 | |||
4410 | + if (!(filp->f_mode & (FMODE_READ|FMODE_WRITE))) | ||
4411 | + return -EINVAL; | ||
4412 | + | ||
4413 | mutex_lock(&inode->i_mutex); | ||
4414 | |||
4415 | if (inode->i_pipe) { | ||
4416 | diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c | ||
4417 | index b7a4719..66b51c0 100644 | ||
4418 | --- a/fs/proc/namespaces.c | ||
4419 | +++ b/fs/proc/namespaces.c | ||
4420 | @@ -118,7 +118,7 @@ static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd) | ||
4421 | struct super_block *sb = inode->i_sb; | ||
4422 | struct proc_inode *ei = PROC_I(inode); | ||
4423 | struct task_struct *task; | ||
4424 | - struct dentry *ns_dentry; | ||
4425 | + struct path ns_path; | ||
4426 | void *error = ERR_PTR(-EACCES); | ||
4427 | |||
4428 | task = get_proc_task(inode); | ||
4429 | @@ -128,14 +128,14 @@ static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd) | ||
4430 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) | ||
4431 | goto out_put_task; | ||
4432 | |||
4433 | - ns_dentry = proc_ns_get_dentry(sb, task, ei->ns_ops); | ||
4434 | - if (IS_ERR(ns_dentry)) { | ||
4435 | - error = ERR_CAST(ns_dentry); | ||
4436 | + ns_path.dentry = proc_ns_get_dentry(sb, task, ei->ns_ops); | ||
4437 | + if (IS_ERR(ns_path.dentry)) { | ||
4438 | + error = ERR_CAST(ns_path.dentry); | ||
4439 | goto out_put_task; | ||
4440 | } | ||
4441 | |||
4442 | - dput(nd->path.dentry); | ||
4443 | - nd->path.dentry = ns_dentry; | ||
4444 | + ns_path.mnt = mntget(nd->path.mnt); | ||
4445 | + nd_jump_link(nd, &ns_path); | ||
4446 | error = NULL; | ||
4447 | |||
4448 | out_put_task: | ||
4449 | diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h | ||
4450 | index bf6afa2..a5cda3e 100644 | ||
4451 | --- a/include/linux/device-mapper.h | ||
4452 | +++ b/include/linux/device-mapper.h | ||
4453 | @@ -68,8 +68,8 @@ typedef void (*dm_postsuspend_fn) (struct dm_target *ti); | ||
4454 | typedef int (*dm_preresume_fn) (struct dm_target *ti); | ||
4455 | typedef void (*dm_resume_fn) (struct dm_target *ti); | ||
4456 | |||
4457 | -typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, | ||
4458 | - unsigned status_flags, char *result, unsigned maxlen); | ||
4459 | +typedef void (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, | ||
4460 | + unsigned status_flags, char *result, unsigned maxlen); | ||
4461 | |||
4462 | typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); | ||
4463 | |||
4464 | diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h | ||
4465 | index 4b117a3..acf4d31 100644 | ||
4466 | --- a/include/linux/mfd/rtsx_pci.h | ||
4467 | +++ b/include/linux/mfd/rtsx_pci.h | ||
4468 | @@ -735,6 +735,7 @@ struct rtsx_pcr { | ||
4469 | |||
4470 | unsigned int card_inserted; | ||
4471 | unsigned int card_removed; | ||
4472 | + unsigned int card_exist; | ||
4473 | |||
4474 | struct delayed_work carddet_work; | ||
4475 | struct delayed_work idle_work; | ||
4476 | @@ -799,6 +800,7 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock, | ||
4477 | u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk); | ||
4478 | int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card); | ||
4479 | int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card); | ||
4480 | +int rtsx_pci_card_exclusive_check(struct rtsx_pcr *pcr, int card); | ||
4481 | int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage); | ||
4482 | unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr); | ||
4483 | void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr); | ||
4484 | diff --git a/ipc/msg.c b/ipc/msg.c | ||
4485 | index 950572f..31cd1bf 100644 | ||
4486 | --- a/ipc/msg.c | ||
4487 | +++ b/ipc/msg.c | ||
4488 | @@ -820,15 +820,17 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, | ||
4489 | struct msg_msg *copy = NULL; | ||
4490 | unsigned long copy_number = 0; | ||
4491 | |||
4492 | + ns = current->nsproxy->ipc_ns; | ||
4493 | + | ||
4494 | if (msqid < 0 || (long) bufsz < 0) | ||
4495 | return -EINVAL; | ||
4496 | if (msgflg & MSG_COPY) { | ||
4497 | - copy = prepare_copy(buf, bufsz, msgflg, &msgtyp, ©_number); | ||
4498 | + copy = prepare_copy(buf, min_t(size_t, bufsz, ns->msg_ctlmax), | ||
4499 | + msgflg, &msgtyp, ©_number); | ||
4500 | if (IS_ERR(copy)) | ||
4501 | return PTR_ERR(copy); | ||
4502 | } | ||
4503 | mode = convert_mode(&msgtyp, msgflg); | ||
4504 | - ns = current->nsproxy->ipc_ns; | ||
4505 | |||
4506 | msq = msg_lock_check(ns, msqid); | ||
4507 | if (IS_ERR(msq)) { | ||
4508 | diff --git a/ipc/msgutil.c b/ipc/msgutil.c | ||
4509 | index ebfcbfa..5df8e4b 100644 | ||
4510 | --- a/ipc/msgutil.c | ||
4511 | +++ b/ipc/msgutil.c | ||
4512 | @@ -117,9 +117,6 @@ struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst) | ||
4513 | if (alen > DATALEN_MSG) | ||
4514 | alen = DATALEN_MSG; | ||
4515 | |||
4516 | - dst->next = NULL; | ||
4517 | - dst->security = NULL; | ||
4518 | - | ||
4519 | memcpy(dst + 1, src + 1, alen); | ||
4520 | |||
4521 | len -= alen; | ||
4522 | diff --git a/kernel/fork.c b/kernel/fork.c | ||
4523 | index c535f33..5630e52 100644 | ||
4524 | --- a/kernel/fork.c | ||
4525 | +++ b/kernel/fork.c | ||
4526 | @@ -1141,6 +1141,9 @@ static struct task_struct *copy_process(unsigned long clone_flags, | ||
4527 | if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS)) | ||
4528 | return ERR_PTR(-EINVAL); | ||
4529 | |||
4530 | + if ((clone_flags & (CLONE_NEWUSER|CLONE_FS)) == (CLONE_NEWUSER|CLONE_FS)) | ||
4531 | + return ERR_PTR(-EINVAL); | ||
4532 | + | ||
4533 | /* | ||
4534 | * Thread groups must share signals as well, and detached threads | ||
4535 | * can only be started up within the thread group. | ||
4536 | @@ -1801,7 +1804,7 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags) | ||
4537 | * If unsharing a user namespace must also unshare the thread. | ||
4538 | */ | ||
4539 | if (unshare_flags & CLONE_NEWUSER) | ||
4540 | - unshare_flags |= CLONE_THREAD; | ||
4541 | + unshare_flags |= CLONE_THREAD | CLONE_FS; | ||
4542 | /* | ||
4543 | * If unsharing a pid namespace must also unshare the thread. | ||
4544 | */ | ||
4545 | diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c | ||
4546 | index d58e552..e78feff 100644 | ||
4547 | --- a/kernel/time/tick-sched.c | ||
4548 | +++ b/kernel/time/tick-sched.c | ||
4549 | @@ -564,14 +564,19 @@ void tick_nohz_idle_enter(void) | ||
4550 | */ | ||
4551 | void tick_nohz_irq_exit(void) | ||
4552 | { | ||
4553 | + unsigned long flags; | ||
4554 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | ||
4555 | |||
4556 | if (!ts->inidle) | ||
4557 | return; | ||
4558 | |||
4559 | - /* Cancel the timer because CPU already waken up from the C-states*/ | ||
4560 | + local_irq_save(flags); | ||
4561 | + | ||
4562 | + /* Cancel the timer because CPU already waken up from the C-states */ | ||
4563 | menu_hrtimer_cancel(); | ||
4564 | __tick_nohz_idle_enter(ts); | ||
4565 | + | ||
4566 | + local_irq_restore(flags); | ||
4567 | } | ||
4568 | |||
4569 | /** | ||
4570 | diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig | ||
4571 | index 5d89335..2747967 100644 | ||
4572 | --- a/kernel/trace/Kconfig | ||
4573 | +++ b/kernel/trace/Kconfig | ||
4574 | @@ -416,24 +416,28 @@ config PROBE_EVENTS | ||
4575 | def_bool n | ||
4576 | |||
4577 | config DYNAMIC_FTRACE | ||
4578 | - bool "enable/disable ftrace tracepoints dynamically" | ||
4579 | + bool "enable/disable function tracing dynamically" | ||
4580 | depends on FUNCTION_TRACER | ||
4581 | depends on HAVE_DYNAMIC_FTRACE | ||
4582 | default y | ||
4583 | help | ||
4584 | - This option will modify all the calls to ftrace dynamically | ||
4585 | - (will patch them out of the binary image and replace them | ||
4586 | - with a No-Op instruction) as they are called. A table is | ||
4587 | - created to dynamically enable them again. | ||
4588 | + This option will modify all the calls to function tracing | ||
4589 | + dynamically (will patch them out of the binary image and | ||
4590 | + replace them with a No-Op instruction) on boot up. During | ||
4591 | + compile time, a table is made of all the locations that ftrace | ||
4592 | + can function trace, and this table is linked into the kernel | ||
4593 | + image. When this is enabled, functions can be individually | ||
4594 | + enabled, and the functions not enabled will not affect | ||
4595 | + performance of the system. | ||
4596 | + | ||
4597 | + See the files in /sys/kernel/debug/tracing: | ||
4598 | + available_filter_functions | ||
4599 | + set_ftrace_filter | ||
4600 | + set_ftrace_notrace | ||
4601 | |||
4602 | This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but | ||
4603 | otherwise has native performance as long as no tracing is active. | ||
4604 | |||
4605 | - The changes to the code are done by a kernel thread that | ||
4606 | - wakes up once a second and checks to see if any ftrace calls | ||
4607 | - were made. If so, it runs stop_machine (stops all CPUS) | ||
4608 | - and modifies the code to jump over the call to ftrace. | ||
4609 | - | ||
4610 | config FUNCTION_PROFILER | ||
4611 | bool "Kernel function profiler" | ||
4612 | depends on FUNCTION_TRACER | ||
4613 | diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c | ||
4614 | index 2b042c4..dbfe36a7 100644 | ||
4615 | --- a/kernel/user_namespace.c | ||
4616 | +++ b/kernel/user_namespace.c | ||
4617 | @@ -21,6 +21,7 @@ | ||
4618 | #include <linux/uaccess.h> | ||
4619 | #include <linux/ctype.h> | ||
4620 | #include <linux/projid.h> | ||
4621 | +#include <linux/fs_struct.h> | ||
4622 | |||
4623 | static struct kmem_cache *user_ns_cachep __read_mostly; | ||
4624 | |||
4625 | @@ -803,6 +804,9 @@ static int userns_install(struct nsproxy *nsproxy, void *ns) | ||
4626 | if (atomic_read(¤t->mm->mm_users) > 1) | ||
4627 | return -EINVAL; | ||
4628 | |||
4629 | + if (current->fs->users != 1) | ||
4630 | + return -EINVAL; | ||
4631 | + | ||
4632 | if (!ns_capable(user_ns, CAP_SYS_ADMIN)) | ||
4633 | return -EPERM; | ||
4634 | |||
4635 | diff --git a/mm/mempolicy.c b/mm/mempolicy.c | ||
4636 | index e2df1c1..3df6d12 100644 | ||
4637 | --- a/mm/mempolicy.c | ||
4638 | +++ b/mm/mempolicy.c | ||
4639 | @@ -2386,8 +2386,8 @@ restart: | ||
4640 | *mpol_new = *n->policy; | ||
4641 | atomic_set(&mpol_new->refcnt, 1); | ||
4642 | sp_node_init(n_new, n->end, end, mpol_new); | ||
4643 | - sp_insert(sp, n_new); | ||
4644 | n->end = start; | ||
4645 | + sp_insert(sp, n_new); | ||
4646 | n_new = NULL; | ||
4647 | mpol_new = NULL; | ||
4648 | break; | ||
4649 | diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c | ||
4650 | index 926b466..fd26d04 100644 | ||
4651 | --- a/mm/process_vm_access.c | ||
4652 | +++ b/mm/process_vm_access.c | ||
4653 | @@ -429,12 +429,6 @@ compat_process_vm_rw(compat_pid_t pid, | ||
4654 | if (flags != 0) | ||
4655 | return -EINVAL; | ||
4656 | |||
4657 | - if (!access_ok(VERIFY_READ, lvec, liovcnt * sizeof(*lvec))) | ||
4658 | - goto out; | ||
4659 | - | ||
4660 | - if (!access_ok(VERIFY_READ, rvec, riovcnt * sizeof(*rvec))) | ||
4661 | - goto out; | ||
4662 | - | ||
4663 | if (vm_write) | ||
4664 | rc = compat_rw_copy_check_uvector(WRITE, lvec, liovcnt, | ||
4665 | UIO_FASTIOV, iovstack_l, | ||
4666 | @@ -459,8 +453,6 @@ free_iovecs: | ||
4667 | kfree(iov_r); | ||
4668 | if (iov_l != iovstack_l) | ||
4669 | kfree(iov_l); | ||
4670 | - | ||
4671 | -out: | ||
4672 | return rc; | ||
4673 | } | ||
4674 | |||
4675 | diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c | ||
4676 | index f651da6..76c3d0a 100644 | ||
4677 | --- a/net/ieee802154/6lowpan.c | ||
4678 | +++ b/net/ieee802154/6lowpan.c | ||
4679 | @@ -1234,7 +1234,7 @@ static inline int __init lowpan_netlink_init(void) | ||
4680 | return rtnl_link_register(&lowpan_link_ops); | ||
4681 | } | ||
4682 | |||
4683 | -static inline void __init lowpan_netlink_fini(void) | ||
4684 | +static inline void lowpan_netlink_fini(void) | ||
4685 | { | ||
4686 | rtnl_link_unregister(&lowpan_link_ops); | ||
4687 | } | ||
4688 | diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c | ||
4689 | index f75ba1a..9979bf8 100644 | ||
4690 | --- a/net/mac80211/mlme.c | ||
4691 | +++ b/net/mac80211/mlme.c | ||
4692 | @@ -4072,6 +4072,17 @@ void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata) | ||
4693 | { | ||
4694 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | ||
4695 | |||
4696 | + /* | ||
4697 | + * Make sure some work items will not run after this, | ||
4698 | + * they will not do anything but might not have been | ||
4699 | + * cancelled when disconnecting. | ||
4700 | + */ | ||
4701 | + cancel_work_sync(&ifmgd->monitor_work); | ||
4702 | + cancel_work_sync(&ifmgd->beacon_connection_loss_work); | ||
4703 | + cancel_work_sync(&ifmgd->request_smps_work); | ||
4704 | + cancel_work_sync(&ifmgd->csa_connection_drop_work); | ||
4705 | + cancel_work_sync(&ifmgd->chswitch_work); | ||
4706 | + | ||
4707 | mutex_lock(&ifmgd->mtx); | ||
4708 | if (ifmgd->assoc_data) | ||
4709 | ieee80211_destroy_assoc_data(sdata, false); | ||
4710 | diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c | ||
4711 | index 33811db..ab02588 100644 | ||
4712 | --- a/net/sunrpc/xprt.c | ||
4713 | +++ b/net/sunrpc/xprt.c | ||
4714 | @@ -485,13 +485,17 @@ EXPORT_SYMBOL_GPL(xprt_wake_pending_tasks); | ||
4715 | * xprt_wait_for_buffer_space - wait for transport output buffer to clear | ||
4716 | * @task: task to be put to sleep | ||
4717 | * @action: function pointer to be executed after wait | ||
4718 | + * | ||
4719 | + * Note that we only set the timer for the case of RPC_IS_SOFT(), since | ||
4720 | + * we don't in general want to force a socket disconnection due to | ||
4721 | + * an incomplete RPC call transmission. | ||
4722 | */ | ||
4723 | void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action) | ||
4724 | { | ||
4725 | struct rpc_rqst *req = task->tk_rqstp; | ||
4726 | struct rpc_xprt *xprt = req->rq_xprt; | ||
4727 | |||
4728 | - task->tk_timeout = req->rq_timeout; | ||
4729 | + task->tk_timeout = RPC_IS_SOFT(task) ? req->rq_timeout : 0; | ||
4730 | rpc_sleep_on(&xprt->pending, task, action); | ||
4731 | } | ||
4732 | EXPORT_SYMBOL_GPL(xprt_wait_for_buffer_space); | ||
4733 | diff --git a/security/keys/compat.c b/security/keys/compat.c | ||
4734 | index 1c26176..d65fa7f 100644 | ||
4735 | --- a/security/keys/compat.c | ||
4736 | +++ b/security/keys/compat.c | ||
4737 | @@ -40,12 +40,12 @@ static long compat_keyctl_instantiate_key_iov( | ||
4738 | ARRAY_SIZE(iovstack), | ||
4739 | iovstack, &iov); | ||
4740 | if (ret < 0) | ||
4741 | - return ret; | ||
4742 | + goto err; | ||
4743 | if (ret == 0) | ||
4744 | goto no_payload_free; | ||
4745 | |||
4746 | ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid); | ||
4747 | - | ||
4748 | +err: | ||
4749 | if (iov != iovstack) | ||
4750 | kfree(iov); | ||
4751 | return ret; | ||
4752 | diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c | ||
4753 | index 58dfe08..42defae 100644 | ||
4754 | --- a/security/keys/process_keys.c | ||
4755 | +++ b/security/keys/process_keys.c | ||
4756 | @@ -57,7 +57,7 @@ int install_user_keyrings(void) | ||
4757 | |||
4758 | kenter("%p{%u}", user, uid); | ||
4759 | |||
4760 | - if (user->uid_keyring) { | ||
4761 | + if (user->uid_keyring && user->session_keyring) { | ||
4762 | kleave(" = 0 [exist]"); | ||
4763 | return 0; | ||
4764 | } | ||
4765 | @@ -839,7 +839,7 @@ void key_change_session_keyring(struct callback_head *twork) | ||
4766 | new-> sgid = old-> sgid; | ||
4767 | new->fsgid = old->fsgid; | ||
4768 | new->user = get_uid(old->user); | ||
4769 | - new->user_ns = get_user_ns(new->user_ns); | ||
4770 | + new->user_ns = get_user_ns(old->user_ns); | ||
4771 | new->group_info = get_group_info(old->group_info); | ||
4772 | |||
4773 | new->securebits = old->securebits; | ||
4774 | diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c | ||
4775 | index 8575861..0097f36 100644 | ||
4776 | --- a/sound/core/vmaster.c | ||
4777 | +++ b/sound/core/vmaster.c | ||
4778 | @@ -213,7 +213,10 @@ static int slave_put(struct snd_kcontrol *kcontrol, | ||
4779 | } | ||
4780 | if (!changed) | ||
4781 | return 0; | ||
4782 | - return slave_put_val(slave, ucontrol); | ||
4783 | + err = slave_put_val(slave, ucontrol); | ||
4784 | + if (err < 0) | ||
4785 | + return err; | ||
4786 | + return 1; | ||
4787 | } | ||
4788 | |||
4789 | static int slave_tlv_cmd(struct snd_kcontrol *kcontrol, | ||
4790 | diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c | ||
4791 | index 2ffdc35..806407a 100644 | ||
4792 | --- a/sound/pci/ice1712/ice1712.c | ||
4793 | +++ b/sound/pci/ice1712/ice1712.c | ||
4794 | @@ -2594,6 +2594,8 @@ static int snd_ice1712_create(struct snd_card *card, | ||
4795 | snd_ice1712_proc_init(ice); | ||
4796 | synchronize_irq(pci->irq); | ||
4797 | |||
4798 | + card->private_data = ice; | ||
4799 | + | ||
4800 | err = pci_request_regions(pci, "ICE1712"); | ||
4801 | if (err < 0) { | ||
4802 | kfree(ice); |