Annotation of /trunk/kernel-alx/patches-3.10/0121-3.10.22-all-fixes.patch
Parent Directory | Revision Log
Revision 2349 -
(hide annotations)
(download)
Mon Dec 16 10:05:17 2013 UTC (10 years, 9 months ago) by niro
File size: 250324 byte(s)
Mon Dec 16 10:05:17 2013 UTC (10 years, 9 months ago) by niro
File size: 250324 byte(s)
-linux-3.10.22
1 | niro | 2349 | diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt |
2 | index ccd42589..9b34b168 100644 | ||
3 | --- a/Documentation/sysctl/kernel.txt | ||
4 | +++ b/Documentation/sysctl/kernel.txt | ||
5 | @@ -289,13 +289,24 @@ Default value is "/sbin/hotplug". | ||
6 | kptr_restrict: | ||
7 | |||
8 | This toggle indicates whether restrictions are placed on | ||
9 | -exposing kernel addresses via /proc and other interfaces. When | ||
10 | -kptr_restrict is set to (0), there are no restrictions. When | ||
11 | -kptr_restrict is set to (1), the default, kernel pointers | ||
12 | -printed using the %pK format specifier will be replaced with 0's | ||
13 | -unless the user has CAP_SYSLOG. When kptr_restrict is set to | ||
14 | -(2), kernel pointers printed using %pK will be replaced with 0's | ||
15 | -regardless of privileges. | ||
16 | +exposing kernel addresses via /proc and other interfaces. | ||
17 | + | ||
18 | +When kptr_restrict is set to (0), the default, there are no restrictions. | ||
19 | + | ||
20 | +When kptr_restrict is set to (1), kernel pointers printed using the %pK | ||
21 | +format specifier will be replaced with 0's unless the user has CAP_SYSLOG | ||
22 | +and effective user and group ids are equal to the real ids. This is | ||
23 | +because %pK checks are done at read() time rather than open() time, so | ||
24 | +if permissions are elevated between the open() and the read() (e.g via | ||
25 | +a setuid binary) then %pK will not leak kernel pointers to unprivileged | ||
26 | +users. Note, this is a temporary solution only. The correct long-term | ||
27 | +solution is to do the permission checks at open() time. Consider removing | ||
28 | +world read permissions from files that use %pK, and using dmesg_restrict | ||
29 | +to protect against uses of %pK in dmesg(8) if leaking kernel pointer | ||
30 | +values to unprivileged users is a concern. | ||
31 | + | ||
32 | +When kptr_restrict is set to (2), kernel pointers printed using | ||
33 | +%pK will be replaced with 0's regardless of privileges. | ||
34 | |||
35 | ============================================================== | ||
36 | |||
37 | diff --git a/Makefile b/Makefile | ||
38 | index c0635fba..001188ce 100644 | ||
39 | --- a/Makefile | ||
40 | +++ b/Makefile | ||
41 | @@ -1,6 +1,6 @@ | ||
42 | VERSION = 3 | ||
43 | PATCHLEVEL = 10 | ||
44 | -SUBLEVEL = 21 | ||
45 | +SUBLEVEL = 22 | ||
46 | EXTRAVERSION = | ||
47 | NAME = TOSSUG Baby Fish | ||
48 | |||
49 | diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi | ||
50 | index 1e12aeff..aa537ed1 100644 | ||
51 | --- a/arch/arm/boot/dts/bcm2835.dtsi | ||
52 | +++ b/arch/arm/boot/dts/bcm2835.dtsi | ||
53 | @@ -85,6 +85,8 @@ | ||
54 | reg = <0x7e205000 0x1000>; | ||
55 | interrupts = <2 21>; | ||
56 | clocks = <&clk_i2c>; | ||
57 | + #address-cells = <1>; | ||
58 | + #size-cells = <0>; | ||
59 | status = "disabled"; | ||
60 | }; | ||
61 | |||
62 | @@ -93,6 +95,8 @@ | ||
63 | reg = <0x7e804000 0x1000>; | ||
64 | interrupts = <2 21>; | ||
65 | clocks = <&clk_i2c>; | ||
66 | + #address-cells = <1>; | ||
67 | + #size-cells = <0>; | ||
68 | status = "disabled"; | ||
69 | }; | ||
70 | |||
71 | diff --git a/arch/arm/boot/dts/cros5250-common.dtsi b/arch/arm/boot/dts/cros5250-common.dtsi | ||
72 | index 3f0239ec..49d8da27 100644 | ||
73 | --- a/arch/arm/boot/dts/cros5250-common.dtsi | ||
74 | +++ b/arch/arm/boot/dts/cros5250-common.dtsi | ||
75 | @@ -27,6 +27,13 @@ | ||
76 | i2c2_bus: i2c2-bus { | ||
77 | samsung,pin-pud = <0>; | ||
78 | }; | ||
79 | + | ||
80 | + max77686_irq: max77686-irq { | ||
81 | + samsung,pins = "gpx3-2"; | ||
82 | + samsung,pin-function = <0>; | ||
83 | + samsung,pin-pud = <0>; | ||
84 | + samsung,pin-drv = <0>; | ||
85 | + }; | ||
86 | }; | ||
87 | |||
88 | i2c@12C60000 { | ||
89 | @@ -35,6 +42,11 @@ | ||
90 | |||
91 | max77686@09 { | ||
92 | compatible = "maxim,max77686"; | ||
93 | + interrupt-parent = <&gpx3>; | ||
94 | + interrupts = <2 0>; | ||
95 | + pinctrl-names = "default"; | ||
96 | + pinctrl-0 = <&max77686_irq>; | ||
97 | + wakeup-source; | ||
98 | reg = <0x09>; | ||
99 | |||
100 | voltage-regulators { | ||
101 | diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S | ||
102 | index d43c7e54..32640ae7 100644 | ||
103 | --- a/arch/arm/kernel/entry-armv.S | ||
104 | +++ b/arch/arm/kernel/entry-armv.S | ||
105 | @@ -192,6 +192,7 @@ __dabt_svc: | ||
106 | svc_entry | ||
107 | mov r2, sp | ||
108 | dabt_helper | ||
109 | + THUMB( ldr r5, [sp, #S_PSR] ) @ potentially updated CPSR | ||
110 | svc_exit r5 @ return from exception | ||
111 | UNWIND(.fnend ) | ||
112 | ENDPROC(__dabt_svc) | ||
113 | diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile | ||
114 | index 788562dc..c336efdf 100644 | ||
115 | --- a/arch/arm/mach-at91/Makefile | ||
116 | +++ b/arch/arm/mach-at91/Makefile | ||
117 | @@ -2,7 +2,7 @@ | ||
118 | # Makefile for the linux kernel. | ||
119 | # | ||
120 | |||
121 | -obj-y := irq.o gpio.o setup.o | ||
122 | +obj-y := irq.o gpio.o setup.o sysirq_mask.o | ||
123 | obj-m := | ||
124 | obj-n := | ||
125 | obj- := | ||
126 | diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c | ||
127 | index a8ce2453..cdb1fb69 100644 | ||
128 | --- a/arch/arm/mach-at91/at91sam9260.c | ||
129 | +++ b/arch/arm/mach-at91/at91sam9260.c | ||
130 | @@ -351,6 +351,8 @@ static void __init at91sam9260_initialize(void) | ||
131 | at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1) | ||
132 | | (1 << AT91SAM9260_ID_IRQ2); | ||
133 | |||
134 | + at91_sysirq_mask_rtt(AT91SAM9260_BASE_RTT); | ||
135 | + | ||
136 | /* Register GPIO subsystem */ | ||
137 | at91_gpio_init(at91sam9260_gpio, 3); | ||
138 | } | ||
139 | diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c | ||
140 | index 25efb5ac..7c9d2ea5 100644 | ||
141 | --- a/arch/arm/mach-at91/at91sam9261.c | ||
142 | +++ b/arch/arm/mach-at91/at91sam9261.c | ||
143 | @@ -293,6 +293,8 @@ static void __init at91sam9261_initialize(void) | ||
144 | at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1) | ||
145 | | (1 << AT91SAM9261_ID_IRQ2); | ||
146 | |||
147 | + at91_sysirq_mask_rtt(AT91SAM9261_BASE_RTT); | ||
148 | + | ||
149 | /* Register GPIO subsystem */ | ||
150 | at91_gpio_init(at91sam9261_gpio, 3); | ||
151 | } | ||
152 | diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c | ||
153 | index f44ffd21..c6b2f477 100644 | ||
154 | --- a/arch/arm/mach-at91/at91sam9263.c | ||
155 | +++ b/arch/arm/mach-at91/at91sam9263.c | ||
156 | @@ -329,6 +329,9 @@ static void __init at91sam9263_initialize(void) | ||
157 | arm_pm_restart = at91sam9_alt_restart; | ||
158 | at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1); | ||
159 | |||
160 | + at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT0); | ||
161 | + at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT1); | ||
162 | + | ||
163 | /* Register GPIO subsystem */ | ||
164 | at91_gpio_init(at91sam9263_gpio, 5); | ||
165 | } | ||
166 | diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c | ||
167 | index 8b7fce06..e381fa12 100644 | ||
168 | --- a/arch/arm/mach-at91/at91sam9g45.c | ||
169 | +++ b/arch/arm/mach-at91/at91sam9g45.c | ||
170 | @@ -376,6 +376,9 @@ static void __init at91sam9g45_initialize(void) | ||
171 | arm_pm_restart = at91sam9g45_restart; | ||
172 | at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0); | ||
173 | |||
174 | + at91_sysirq_mask_rtc(AT91SAM9G45_BASE_RTC); | ||
175 | + at91_sysirq_mask_rtt(AT91SAM9G45_BASE_RTT); | ||
176 | + | ||
177 | /* Register GPIO subsystem */ | ||
178 | at91_gpio_init(at91sam9g45_gpio, 5); | ||
179 | } | ||
180 | diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c | ||
181 | index c7d670d1..4d6001c3 100644 | ||
182 | --- a/arch/arm/mach-at91/at91sam9n12.c | ||
183 | +++ b/arch/arm/mach-at91/at91sam9n12.c | ||
184 | @@ -223,7 +223,13 @@ static void __init at91sam9n12_map_io(void) | ||
185 | at91_init_sram(0, AT91SAM9N12_SRAM_BASE, AT91SAM9N12_SRAM_SIZE); | ||
186 | } | ||
187 | |||
188 | +static void __init at91sam9n12_initialize(void) | ||
189 | +{ | ||
190 | + at91_sysirq_mask_rtc(AT91SAM9N12_BASE_RTC); | ||
191 | +} | ||
192 | + | ||
193 | AT91_SOC_START(at91sam9n12) | ||
194 | .map_io = at91sam9n12_map_io, | ||
195 | .register_clocks = at91sam9n12_register_clocks, | ||
196 | + .init = at91sam9n12_initialize, | ||
197 | AT91_SOC_END | ||
198 | diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c | ||
199 | index f77fae55..5615d28a 100644 | ||
200 | --- a/arch/arm/mach-at91/at91sam9rl.c | ||
201 | +++ b/arch/arm/mach-at91/at91sam9rl.c | ||
202 | @@ -295,6 +295,9 @@ static void __init at91sam9rl_initialize(void) | ||
203 | arm_pm_restart = at91sam9_alt_restart; | ||
204 | at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0); | ||
205 | |||
206 | + at91_sysirq_mask_rtc(AT91SAM9RL_BASE_RTC); | ||
207 | + at91_sysirq_mask_rtt(AT91SAM9RL_BASE_RTT); | ||
208 | + | ||
209 | /* Register GPIO subsystem */ | ||
210 | at91_gpio_init(at91sam9rl_gpio, 4); | ||
211 | } | ||
212 | diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c | ||
213 | index e631fec0..7b4f8483 100644 | ||
214 | --- a/arch/arm/mach-at91/at91sam9x5.c | ||
215 | +++ b/arch/arm/mach-at91/at91sam9x5.c | ||
216 | @@ -318,6 +318,11 @@ static void __init at91sam9x5_map_io(void) | ||
217 | at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE); | ||
218 | } | ||
219 | |||
220 | +static void __init at91sam9x5_initialize(void) | ||
221 | +{ | ||
222 | + at91_sysirq_mask_rtc(AT91SAM9X5_BASE_RTC); | ||
223 | +} | ||
224 | + | ||
225 | /* -------------------------------------------------------------------- | ||
226 | * Interrupt initialization | ||
227 | * -------------------------------------------------------------------- */ | ||
228 | @@ -325,4 +330,5 @@ static void __init at91sam9x5_map_io(void) | ||
229 | AT91_SOC_START(at91sam9x5) | ||
230 | .map_io = at91sam9x5_map_io, | ||
231 | .register_clocks = at91sam9x5_register_clocks, | ||
232 | + .init = at91sam9x5_initialize, | ||
233 | AT91_SOC_END | ||
234 | diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h | ||
235 | index 78ab0654..d949ab4e 100644 | ||
236 | --- a/arch/arm/mach-at91/generic.h | ||
237 | +++ b/arch/arm/mach-at91/generic.h | ||
238 | @@ -33,6 +33,8 @@ extern int __init at91_aic_of_init(struct device_node *node, | ||
239 | struct device_node *parent); | ||
240 | extern int __init at91_aic5_of_init(struct device_node *node, | ||
241 | struct device_node *parent); | ||
242 | +extern void __init at91_sysirq_mask_rtc(u32 rtc_base); | ||
243 | +extern void __init at91_sysirq_mask_rtt(u32 rtt_base); | ||
244 | |||
245 | |||
246 | /* Timer */ | ||
247 | diff --git a/arch/arm/mach-at91/include/mach/at91sam9n12.h b/arch/arm/mach-at91/include/mach/at91sam9n12.h | ||
248 | index d374b87c..0151bcf6 100644 | ||
249 | --- a/arch/arm/mach-at91/include/mach/at91sam9n12.h | ||
250 | +++ b/arch/arm/mach-at91/include/mach/at91sam9n12.h | ||
251 | @@ -49,6 +49,11 @@ | ||
252 | #define AT91SAM9N12_BASE_USART3 0xf8028000 | ||
253 | |||
254 | /* | ||
255 | + * System Peripherals | ||
256 | + */ | ||
257 | +#define AT91SAM9N12_BASE_RTC 0xfffffeb0 | ||
258 | + | ||
259 | +/* | ||
260 | * Internal Memory. | ||
261 | */ | ||
262 | #define AT91SAM9N12_SRAM_BASE 0x00300000 /* Internal SRAM base address */ | ||
263 | diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5.h b/arch/arm/mach-at91/include/mach/at91sam9x5.h | ||
264 | index c75ee19b..2fc76c49 100644 | ||
265 | --- a/arch/arm/mach-at91/include/mach/at91sam9x5.h | ||
266 | +++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h | ||
267 | @@ -55,6 +55,11 @@ | ||
268 | #define AT91SAM9X5_BASE_USART2 0xf8024000 | ||
269 | |||
270 | /* | ||
271 | + * System Peripherals | ||
272 | + */ | ||
273 | +#define AT91SAM9X5_BASE_RTC 0xfffffeb0 | ||
274 | + | ||
275 | +/* | ||
276 | * Internal Memory. | ||
277 | */ | ||
278 | #define AT91SAM9X5_SRAM_BASE 0x00300000 /* Internal SRAM base address */ | ||
279 | diff --git a/arch/arm/mach-at91/include/mach/sama5d3.h b/arch/arm/mach-at91/include/mach/sama5d3.h | ||
280 | index 6dc81ee3..3abbc428 100644 | ||
281 | --- a/arch/arm/mach-at91/include/mach/sama5d3.h | ||
282 | +++ b/arch/arm/mach-at91/include/mach/sama5d3.h | ||
283 | @@ -65,6 +65,11 @@ | ||
284 | #define SAMA5D3_ID_IRQ0 47 /* Advanced Interrupt Controller (IRQ0) */ | ||
285 | |||
286 | /* | ||
287 | + * System Peripherals | ||
288 | + */ | ||
289 | +#define SAMA5D3_BASE_RTC 0xfffffeb0 | ||
290 | + | ||
291 | +/* | ||
292 | * Internal Memory | ||
293 | */ | ||
294 | #define SAMA5D3_SRAM_BASE 0x00300000 /* Internal SRAM base address */ | ||
295 | diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c | ||
296 | index 40127971..3ea86428 100644 | ||
297 | --- a/arch/arm/mach-at91/sama5d3.c | ||
298 | +++ b/arch/arm/mach-at91/sama5d3.c | ||
299 | @@ -371,7 +371,13 @@ static void __init sama5d3_map_io(void) | ||
300 | at91_init_sram(0, SAMA5D3_SRAM_BASE, SAMA5D3_SRAM_SIZE); | ||
301 | } | ||
302 | |||
303 | +static void __init sama5d3_initialize(void) | ||
304 | +{ | ||
305 | + at91_sysirq_mask_rtc(SAMA5D3_BASE_RTC); | ||
306 | +} | ||
307 | + | ||
308 | AT91_SOC_START(sama5d3) | ||
309 | .map_io = sama5d3_map_io, | ||
310 | .register_clocks = sama5d3_register_clocks, | ||
311 | + .init = sama5d3_initialize, | ||
312 | AT91_SOC_END | ||
313 | diff --git a/arch/arm/mach-at91/sysirq_mask.c b/arch/arm/mach-at91/sysirq_mask.c | ||
314 | new file mode 100644 | ||
315 | index 00000000..2ba694f9 | ||
316 | --- /dev/null | ||
317 | +++ b/arch/arm/mach-at91/sysirq_mask.c | ||
318 | @@ -0,0 +1,71 @@ | ||
319 | +/* | ||
320 | + * sysirq_mask.c - System-interrupt masking | ||
321 | + * | ||
322 | + * Copyright (C) 2013 Johan Hovold <jhovold@gmail.com> | ||
323 | + * | ||
324 | + * Functions to disable system interrupts from backup-powered peripherals. | ||
325 | + * | ||
326 | + * The RTC and RTT-peripherals are generally powered by backup power (VDDBU) | ||
327 | + * and are not reset on wake-up, user, watchdog or software reset. This means | ||
328 | + * that their interrupts may be enabled during early boot (e.g. after a user | ||
329 | + * reset). | ||
330 | + * | ||
331 | + * As the RTC and RTT share the system-interrupt line with the PIT, an | ||
332 | + * interrupt occurring before a handler has been installed would lead to the | ||
333 | + * system interrupt being disabled and prevent the system from booting. | ||
334 | + * | ||
335 | + * This program is free software; you can redistribute it and/or modify | ||
336 | + * it under the terms of the GNU General Public License as published by | ||
337 | + * the Free Software Foundation; either version 2 of the License, or | ||
338 | + * (at your option) any later version. | ||
339 | + */ | ||
340 | + | ||
341 | +#include <linux/io.h> | ||
342 | +#include <mach/at91_rtt.h> | ||
343 | + | ||
344 | +#include "generic.h" | ||
345 | + | ||
346 | +#define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ | ||
347 | +#define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */ | ||
348 | + | ||
349 | +void __init at91_sysirq_mask_rtc(u32 rtc_base) | ||
350 | +{ | ||
351 | + void __iomem *base; | ||
352 | + u32 mask; | ||
353 | + | ||
354 | + base = ioremap(rtc_base, 64); | ||
355 | + if (!base) | ||
356 | + return; | ||
357 | + | ||
358 | + mask = readl_relaxed(base + AT91_RTC_IMR); | ||
359 | + if (mask) { | ||
360 | + pr_info("AT91: Disabling rtc irq\n"); | ||
361 | + writel_relaxed(mask, base + AT91_RTC_IDR); | ||
362 | + (void)readl_relaxed(base + AT91_RTC_IMR); /* flush */ | ||
363 | + } | ||
364 | + | ||
365 | + iounmap(base); | ||
366 | +} | ||
367 | + | ||
368 | +void __init at91_sysirq_mask_rtt(u32 rtt_base) | ||
369 | +{ | ||
370 | + void __iomem *base; | ||
371 | + void __iomem *reg; | ||
372 | + u32 mode; | ||
373 | + | ||
374 | + base = ioremap(rtt_base, 16); | ||
375 | + if (!base) | ||
376 | + return; | ||
377 | + | ||
378 | + reg = base + AT91_RTT_MR; | ||
379 | + | ||
380 | + mode = readl_relaxed(reg); | ||
381 | + if (mode & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN)) { | ||
382 | + pr_info("AT91: Disabling rtt irq\n"); | ||
383 | + mode &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN); | ||
384 | + writel_relaxed(mode, reg); | ||
385 | + (void)readl_relaxed(reg); /* flush */ | ||
386 | + } | ||
387 | + | ||
388 | + iounmap(base); | ||
389 | +} | ||
390 | diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c | ||
391 | index 4e3148ce..0b9e4377 100644 | ||
392 | --- a/arch/arm/mach-imx/clk-imx6q.c | ||
393 | +++ b/arch/arm/mach-imx/clk-imx6q.c | ||
394 | @@ -424,7 +424,7 @@ int __init mx6q_clocks_init(void) | ||
395 | clk[asrc_podf] = imx_clk_divider("asrc_podf", "asrc_pred", base + 0x30, 9, 3); | ||
396 | clk[spdif_pred] = imx_clk_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3); | ||
397 | clk[spdif_podf] = imx_clk_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3); | ||
398 | - clk[can_root] = imx_clk_divider("can_root", "pll3_usb_otg", base + 0x20, 2, 6); | ||
399 | + clk[can_root] = imx_clk_divider("can_root", "pll3_60m", base + 0x20, 2, 6); | ||
400 | clk[ecspi_root] = imx_clk_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6); | ||
401 | clk[gpu2d_core_podf] = imx_clk_divider("gpu2d_core_podf", "gpu2d_core_sel", base + 0x18, 23, 3); | ||
402 | clk[gpu3d_core_podf] = imx_clk_divider("gpu3d_core_podf", "gpu3d_core_sel", base + 0x18, 26, 3); | ||
403 | diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c | ||
404 | index 8c60fcb0..2f4c9248 100644 | ||
405 | --- a/arch/arm/mach-integrator/integrator_cp.c | ||
406 | +++ b/arch/arm/mach-integrator/integrator_cp.c | ||
407 | @@ -199,7 +199,8 @@ static struct mmci_platform_data mmc_data = { | ||
408 | static void cp_clcd_enable(struct clcd_fb *fb) | ||
409 | { | ||
410 | struct fb_var_screeninfo *var = &fb->fb.var; | ||
411 | - u32 val = CM_CTRL_STATIC1 | CM_CTRL_STATIC2; | ||
412 | + u32 val = CM_CTRL_STATIC1 | CM_CTRL_STATIC2 | ||
413 | + | CM_CTRL_LCDEN0 | CM_CTRL_LCDEN1; | ||
414 | |||
415 | if (var->bits_per_pixel <= 8 || | ||
416 | (var->bits_per_pixel == 16 && var->green.length == 5)) | ||
417 | diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c | ||
418 | index 3926f370..e022a869 100644 | ||
419 | --- a/arch/arm/mach-omap2/irq.c | ||
420 | +++ b/arch/arm/mach-omap2/irq.c | ||
421 | @@ -233,7 +233,7 @@ static inline void omap_intc_handle_irq(void __iomem *base_addr, struct pt_regs | ||
422 | goto out; | ||
423 | |||
424 | irqnr = readl_relaxed(base_addr + 0xd8); | ||
425 | -#ifdef CONFIG_SOC_TI81XX | ||
426 | +#if IS_ENABLED(CONFIG_SOC_TI81XX) || IS_ENABLED(CONFIG_SOC_AM33XX) | ||
427 | if (irqnr) | ||
428 | goto out; | ||
429 | irqnr = readl_relaxed(base_addr + 0xf8); | ||
430 | diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c | ||
431 | index e838ba27..c9808c68 100644 | ||
432 | --- a/arch/arm/mach-sa1100/assabet.c | ||
433 | +++ b/arch/arm/mach-sa1100/assabet.c | ||
434 | @@ -512,6 +512,9 @@ static void __init assabet_map_io(void) | ||
435 | * Its called GPCLKR0 in my SA1110 manual. | ||
436 | */ | ||
437 | Ser1SDCR0 |= SDCR0_SUS; | ||
438 | + MSC1 = (MSC1 & ~0xffff) | | ||
439 | + MSC_NonBrst | MSC_32BitStMem | | ||
440 | + MSC_RdAcc(2) | MSC_WrAcc(2) | MSC_Rec(0); | ||
441 | |||
442 | if (!machine_has_neponset()) | ||
443 | sa1100_register_uart_fns(&assabet_port_fns); | ||
444 | diff --git a/arch/arm/mm/extable.c b/arch/arm/mm/extable.c | ||
445 | index 9d285626..312e15e6 100644 | ||
446 | --- a/arch/arm/mm/extable.c | ||
447 | +++ b/arch/arm/mm/extable.c | ||
448 | @@ -9,8 +9,13 @@ int fixup_exception(struct pt_regs *regs) | ||
449 | const struct exception_table_entry *fixup; | ||
450 | |||
451 | fixup = search_exception_tables(instruction_pointer(regs)); | ||
452 | - if (fixup) | ||
453 | + if (fixup) { | ||
454 | regs->ARM_pc = fixup->fixup; | ||
455 | +#ifdef CONFIG_THUMB2_KERNEL | ||
456 | + /* Clear the IT state to avoid nasty surprises in the fixup */ | ||
457 | + regs->ARM_cpsr &= ~PSR_IT_MASK; | ||
458 | +#endif | ||
459 | + } | ||
460 | |||
461 | return fixup != NULL; | ||
462 | } | ||
463 | diff --git a/arch/avr32/boot/u-boot/head.S b/arch/avr32/boot/u-boot/head.S | ||
464 | index 4488fa27..2ffc298f 100644 | ||
465 | --- a/arch/avr32/boot/u-boot/head.S | ||
466 | +++ b/arch/avr32/boot/u-boot/head.S | ||
467 | @@ -8,6 +8,8 @@ | ||
468 | * published by the Free Software Foundation. | ||
469 | */ | ||
470 | #include <asm/setup.h> | ||
471 | +#include <asm/thread_info.h> | ||
472 | +#include <asm/sysreg.h> | ||
473 | |||
474 | /* | ||
475 | * The kernel is loaded where we want it to be and all caches | ||
476 | @@ -20,11 +22,6 @@ | ||
477 | .section .init.text,"ax" | ||
478 | .global _start | ||
479 | _start: | ||
480 | - /* Check if the boot loader actually provided a tag table */ | ||
481 | - lddpc r0, magic_number | ||
482 | - cp.w r12, r0 | ||
483 | - brne no_tag_table | ||
484 | - | ||
485 | /* Initialize .bss */ | ||
486 | lddpc r2, bss_start_addr | ||
487 | lddpc r3, end_addr | ||
488 | @@ -34,6 +31,25 @@ _start: | ||
489 | cp r2, r3 | ||
490 | brlo 1b | ||
491 | |||
492 | + /* Initialize status register */ | ||
493 | + lddpc r0, init_sr | ||
494 | + mtsr SYSREG_SR, r0 | ||
495 | + | ||
496 | + /* Set initial stack pointer */ | ||
497 | + lddpc sp, stack_addr | ||
498 | + sub sp, -THREAD_SIZE | ||
499 | + | ||
500 | +#ifdef CONFIG_FRAME_POINTER | ||
501 | + /* Mark last stack frame */ | ||
502 | + mov lr, 0 | ||
503 | + mov r7, 0 | ||
504 | +#endif | ||
505 | + | ||
506 | + /* Check if the boot loader actually provided a tag table */ | ||
507 | + lddpc r0, magic_number | ||
508 | + cp.w r12, r0 | ||
509 | + brne no_tag_table | ||
510 | + | ||
511 | /* | ||
512 | * Save the tag table address for later use. This must be done | ||
513 | * _after_ .bss has been initialized... | ||
514 | @@ -53,8 +69,15 @@ bss_start_addr: | ||
515 | .long __bss_start | ||
516 | end_addr: | ||
517 | .long _end | ||
518 | +init_sr: | ||
519 | + .long 0x007f0000 /* Supervisor mode, everything masked */ | ||
520 | +stack_addr: | ||
521 | + .long init_thread_union | ||
522 | +panic_addr: | ||
523 | + .long panic | ||
524 | |||
525 | no_tag_table: | ||
526 | sub r12, pc, (. - 2f) | ||
527 | - bral panic | ||
528 | + /* branch to panic() which can be far away with that construct */ | ||
529 | + lddpc pc, panic_addr | ||
530 | 2: .asciz "Boot loader didn't provide correct magic number\n" | ||
531 | diff --git a/arch/avr32/kernel/entry-avr32b.S b/arch/avr32/kernel/entry-avr32b.S | ||
532 | index 9899d3cc..7301f480 100644 | ||
533 | --- a/arch/avr32/kernel/entry-avr32b.S | ||
534 | +++ b/arch/avr32/kernel/entry-avr32b.S | ||
535 | @@ -401,9 +401,10 @@ handle_critical: | ||
536 | /* We should never get here... */ | ||
537 | bad_return: | ||
538 | sub r12, pc, (. - 1f) | ||
539 | - bral panic | ||
540 | + lddpc pc, 2f | ||
541 | .align 2 | ||
542 | 1: .asciz "Return from critical exception!" | ||
543 | +2: .long panic | ||
544 | |||
545 | .align 1 | ||
546 | do_bus_error_write: | ||
547 | diff --git a/arch/avr32/kernel/head.S b/arch/avr32/kernel/head.S | ||
548 | index 6163bd0a..59eae6df 100644 | ||
549 | --- a/arch/avr32/kernel/head.S | ||
550 | +++ b/arch/avr32/kernel/head.S | ||
551 | @@ -10,33 +10,13 @@ | ||
552 | #include <linux/linkage.h> | ||
553 | |||
554 | #include <asm/page.h> | ||
555 | -#include <asm/thread_info.h> | ||
556 | -#include <asm/sysreg.h> | ||
557 | |||
558 | .section .init.text,"ax" | ||
559 | .global kernel_entry | ||
560 | kernel_entry: | ||
561 | - /* Initialize status register */ | ||
562 | - lddpc r0, init_sr | ||
563 | - mtsr SYSREG_SR, r0 | ||
564 | - | ||
565 | - /* Set initial stack pointer */ | ||
566 | - lddpc sp, stack_addr | ||
567 | - sub sp, -THREAD_SIZE | ||
568 | - | ||
569 | -#ifdef CONFIG_FRAME_POINTER | ||
570 | - /* Mark last stack frame */ | ||
571 | - mov lr, 0 | ||
572 | - mov r7, 0 | ||
573 | -#endif | ||
574 | - | ||
575 | /* Start the show */ | ||
576 | lddpc pc, kernel_start_addr | ||
577 | |||
578 | .align 2 | ||
579 | -init_sr: | ||
580 | - .long 0x007f0000 /* Supervisor mode, everything masked */ | ||
581 | -stack_addr: | ||
582 | - .long init_thread_union | ||
583 | kernel_start_addr: | ||
584 | .long start_kernel | ||
585 | diff --git a/arch/parisc/include/asm/socket.h b/arch/parisc/include/asm/socket.h | ||
586 | new file mode 100644 | ||
587 | index 00000000..748016cb | ||
588 | --- /dev/null | ||
589 | +++ b/arch/parisc/include/asm/socket.h | ||
590 | @@ -0,0 +1,11 @@ | ||
591 | +#ifndef _ASM_SOCKET_H | ||
592 | +#define _ASM_SOCKET_H | ||
593 | + | ||
594 | +#include <uapi/asm/socket.h> | ||
595 | + | ||
596 | +/* O_NONBLOCK clashes with the bits used for socket types. Therefore we | ||
597 | + * have to define SOCK_NONBLOCK to a different value here. | ||
598 | + */ | ||
599 | +#define SOCK_NONBLOCK 0x40000000 | ||
600 | + | ||
601 | +#endif /* _ASM_SOCKET_H */ | ||
602 | diff --git a/arch/parisc/include/uapi/asm/socket.h b/arch/parisc/include/uapi/asm/socket.h | ||
603 | index 70c512a3..4fecb262 100644 | ||
604 | --- a/arch/parisc/include/uapi/asm/socket.h | ||
605 | +++ b/arch/parisc/include/uapi/asm/socket.h | ||
606 | @@ -1,5 +1,5 @@ | ||
607 | -#ifndef _ASM_SOCKET_H | ||
608 | -#define _ASM_SOCKET_H | ||
609 | +#ifndef _UAPI_ASM_SOCKET_H | ||
610 | +#define _UAPI_ASM_SOCKET_H | ||
611 | |||
612 | #include <asm/sockios.h> | ||
613 | |||
614 | @@ -73,9 +73,4 @@ | ||
615 | |||
616 | #define SO_SELECT_ERR_QUEUE 0x4026 | ||
617 | |||
618 | -/* O_NONBLOCK clashes with the bits used for socket types. Therefore we | ||
619 | - * have to define SOCK_NONBLOCK to a different value here. | ||
620 | - */ | ||
621 | -#define SOCK_NONBLOCK 0x40000000 | ||
622 | - | ||
623 | -#endif /* _ASM_SOCKET_H */ | ||
624 | +#endif /* _UAPI_ASM_SOCKET_H */ | ||
625 | diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c | ||
626 | index 32330996..7e9dff80 100644 | ||
627 | --- a/arch/powerpc/kernel/signal_32.c | ||
628 | +++ b/arch/powerpc/kernel/signal_32.c | ||
629 | @@ -442,6 +442,12 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, | ||
630 | #endif /* CONFIG_ALTIVEC */ | ||
631 | if (copy_fpr_to_user(&frame->mc_fregs, current)) | ||
632 | return 1; | ||
633 | + | ||
634 | + /* | ||
635 | + * Clear the MSR VSX bit to indicate there is no valid state attached | ||
636 | + * to this context, except in the specific case below where we set it. | ||
637 | + */ | ||
638 | + msr &= ~MSR_VSX; | ||
639 | #ifdef CONFIG_VSX | ||
640 | /* | ||
641 | * Copy VSR 0-31 upper half from thread_struct to local | ||
642 | @@ -454,15 +460,7 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, | ||
643 | if (copy_vsx_to_user(&frame->mc_vsregs, current)) | ||
644 | return 1; | ||
645 | msr |= MSR_VSX; | ||
646 | - } else if (!ctx_has_vsx_region) | ||
647 | - /* | ||
648 | - * With a small context structure we can't hold the VSX | ||
649 | - * registers, hence clear the MSR value to indicate the state | ||
650 | - * was not saved. | ||
651 | - */ | ||
652 | - msr &= ~MSR_VSX; | ||
653 | - | ||
654 | - | ||
655 | + } | ||
656 | #endif /* CONFIG_VSX */ | ||
657 | #ifdef CONFIG_SPE | ||
658 | /* save spe registers */ | ||
659 | diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c | ||
660 | index 887e99d8..35c20a1f 100644 | ||
661 | --- a/arch/powerpc/kernel/signal_64.c | ||
662 | +++ b/arch/powerpc/kernel/signal_64.c | ||
663 | @@ -121,6 +121,12 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, | ||
664 | flush_fp_to_thread(current); | ||
665 | /* copy fpr regs and fpscr */ | ||
666 | err |= copy_fpr_to_user(&sc->fp_regs, current); | ||
667 | + | ||
668 | + /* | ||
669 | + * Clear the MSR VSX bit to indicate there is no valid state attached | ||
670 | + * to this context, except in the specific case below where we set it. | ||
671 | + */ | ||
672 | + msr &= ~MSR_VSX; | ||
673 | #ifdef CONFIG_VSX | ||
674 | /* | ||
675 | * Copy VSX low doubleword to local buffer for formatting, | ||
676 | diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c | ||
677 | index 50ea137a..1bf40ef5 100644 | ||
678 | --- a/arch/s390/lib/uaccess_pt.c | ||
679 | +++ b/arch/s390/lib/uaccess_pt.c | ||
680 | @@ -78,11 +78,14 @@ static size_t copy_in_kernel(size_t count, void __user *to, | ||
681 | * contains the (negative) exception code. | ||
682 | */ | ||
683 | #ifdef CONFIG_64BIT | ||
684 | + | ||
685 | static unsigned long follow_table(struct mm_struct *mm, | ||
686 | unsigned long address, int write) | ||
687 | { | ||
688 | unsigned long *table = (unsigned long *)__pa(mm->pgd); | ||
689 | |||
690 | + if (unlikely(address > mm->context.asce_limit - 1)) | ||
691 | + return -0x38UL; | ||
692 | switch (mm->context.asce_bits & _ASCE_TYPE_MASK) { | ||
693 | case _ASCE_TYPE_REGION1: | ||
694 | table = table + ((address >> 53) & 0x7ff); | ||
695 | diff --git a/block/blk-core.c b/block/blk-core.c | ||
696 | index 45f3a51f..acf3bf6a 100644 | ||
697 | --- a/block/blk-core.c | ||
698 | +++ b/block/blk-core.c | ||
699 | @@ -645,10 +645,12 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) | ||
700 | __set_bit(QUEUE_FLAG_BYPASS, &q->queue_flags); | ||
701 | |||
702 | if (blkcg_init_queue(q)) | ||
703 | - goto fail_id; | ||
704 | + goto fail_bdi; | ||
705 | |||
706 | return q; | ||
707 | |||
708 | +fail_bdi: | ||
709 | + bdi_destroy(&q->backing_dev_info); | ||
710 | fail_id: | ||
711 | ida_simple_remove(&blk_queue_ida, q->id); | ||
712 | fail_q: | ||
713 | diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c | ||
714 | index 06007f0e..52222a2f 100644 | ||
715 | --- a/crypto/asymmetric_keys/x509_public_key.c | ||
716 | +++ b/crypto/asymmetric_keys/x509_public_key.c | ||
717 | @@ -106,7 +106,6 @@ error_no_sig: | ||
718 | static int x509_key_preparse(struct key_preparsed_payload *prep) | ||
719 | { | ||
720 | struct x509_certificate *cert; | ||
721 | - struct tm now; | ||
722 | size_t srlen, sulen; | ||
723 | char *desc = NULL; | ||
724 | int ret; | ||
725 | @@ -137,43 +136,6 @@ static int x509_key_preparse(struct key_preparsed_payload *prep) | ||
726 | goto error_free_cert; | ||
727 | } | ||
728 | |||
729 | - time_to_tm(CURRENT_TIME.tv_sec, 0, &now); | ||
730 | - pr_devel("Now: %04ld-%02d-%02d %02d:%02d:%02d\n", | ||
731 | - now.tm_year + 1900, now.tm_mon + 1, now.tm_mday, | ||
732 | - now.tm_hour, now.tm_min, now.tm_sec); | ||
733 | - if (now.tm_year < cert->valid_from.tm_year || | ||
734 | - (now.tm_year == cert->valid_from.tm_year && | ||
735 | - (now.tm_mon < cert->valid_from.tm_mon || | ||
736 | - (now.tm_mon == cert->valid_from.tm_mon && | ||
737 | - (now.tm_mday < cert->valid_from.tm_mday || | ||
738 | - (now.tm_mday == cert->valid_from.tm_mday && | ||
739 | - (now.tm_hour < cert->valid_from.tm_hour || | ||
740 | - (now.tm_hour == cert->valid_from.tm_hour && | ||
741 | - (now.tm_min < cert->valid_from.tm_min || | ||
742 | - (now.tm_min == cert->valid_from.tm_min && | ||
743 | - (now.tm_sec < cert->valid_from.tm_sec | ||
744 | - ))))))))))) { | ||
745 | - pr_warn("Cert %s is not yet valid\n", cert->fingerprint); | ||
746 | - ret = -EKEYREJECTED; | ||
747 | - goto error_free_cert; | ||
748 | - } | ||
749 | - if (now.tm_year > cert->valid_to.tm_year || | ||
750 | - (now.tm_year == cert->valid_to.tm_year && | ||
751 | - (now.tm_mon > cert->valid_to.tm_mon || | ||
752 | - (now.tm_mon == cert->valid_to.tm_mon && | ||
753 | - (now.tm_mday > cert->valid_to.tm_mday || | ||
754 | - (now.tm_mday == cert->valid_to.tm_mday && | ||
755 | - (now.tm_hour > cert->valid_to.tm_hour || | ||
756 | - (now.tm_hour == cert->valid_to.tm_hour && | ||
757 | - (now.tm_min > cert->valid_to.tm_min || | ||
758 | - (now.tm_min == cert->valid_to.tm_min && | ||
759 | - (now.tm_sec > cert->valid_to.tm_sec | ||
760 | - ))))))))))) { | ||
761 | - pr_warn("Cert %s has expired\n", cert->fingerprint); | ||
762 | - ret = -EKEYEXPIRED; | ||
763 | - goto error_free_cert; | ||
764 | - } | ||
765 | - | ||
766 | cert->pub->algo = x509_public_key_algorithms[cert->pkey_algo]; | ||
767 | cert->pub->id_type = PKEY_ID_X509; | ||
768 | |||
769 | diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c | ||
770 | index e36842b9..a02a91cd 100644 | ||
771 | --- a/drivers/acpi/pci_root.c | ||
772 | +++ b/drivers/acpi/pci_root.c | ||
773 | @@ -63,6 +63,9 @@ static struct acpi_scan_handler pci_root_handler = { | ||
774 | .ids = root_device_ids, | ||
775 | .attach = acpi_pci_root_add, | ||
776 | .detach = acpi_pci_root_remove, | ||
777 | + .hotplug = { | ||
778 | + .ignore = true, | ||
779 | + }, | ||
780 | }; | ||
781 | |||
782 | /* Lock to protect both acpi_pci_roots lists */ | ||
783 | diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c | ||
784 | index 362f0c2a..cca761e8 100644 | ||
785 | --- a/drivers/acpi/scan.c | ||
786 | +++ b/drivers/acpi/scan.c | ||
787 | @@ -1790,7 +1790,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type) | ||
788 | */ | ||
789 | list_for_each_entry(hwid, &pnp.ids, list) { | ||
790 | handler = acpi_scan_match_handler(hwid->id, NULL); | ||
791 | - if (handler) { | ||
792 | + if (handler && !handler->hotplug.ignore) { | ||
793 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | ||
794 | acpi_hotplug_notify_cb, handler); | ||
795 | break; | ||
796 | diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c | ||
797 | index b1126254..3d67f764 100644 | ||
798 | --- a/drivers/ata/ahci.c | ||
799 | +++ b/drivers/ata/ahci.c | ||
800 | @@ -292,6 +292,10 @@ static const struct pci_device_id ahci_pci_tbl[] = { | ||
801 | { PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */ | ||
802 | { PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */ | ||
803 | { PCI_VDEVICE(INTEL, 0x23a3), board_ahci }, /* Coleto Creek AHCI */ | ||
804 | + { PCI_VDEVICE(INTEL, 0x9c83), board_ahci }, /* Wildcat Point-LP AHCI */ | ||
805 | + { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */ | ||
806 | + { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */ | ||
807 | + { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */ | ||
808 | |||
809 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | ||
810 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | ||
811 | @@ -431,6 +435,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | ||
812 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ | ||
813 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3), | ||
814 | .driver_data = board_ahci_yes_fbs }, | ||
815 | + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), | ||
816 | + .driver_data = board_ahci_yes_fbs }, | ||
817 | |||
818 | /* Promise */ | ||
819 | { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ | ||
820 | diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c | ||
821 | index 7b9bdd82..8905e03a 100644 | ||
822 | --- a/drivers/ata/libahci.c | ||
823 | +++ b/drivers/ata/libahci.c | ||
824 | @@ -1266,9 +1266,11 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, | ||
825 | { | ||
826 | struct ata_port *ap = link->ap; | ||
827 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
828 | + struct ahci_port_priv *pp = ap->private_data; | ||
829 | const char *reason = NULL; | ||
830 | unsigned long now, msecs; | ||
831 | struct ata_taskfile tf; | ||
832 | + bool fbs_disabled = false; | ||
833 | int rc; | ||
834 | |||
835 | DPRINTK("ENTER\n"); | ||
836 | @@ -1278,6 +1280,16 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, | ||
837 | if (rc && rc != -EOPNOTSUPP) | ||
838 | ata_link_warn(link, "failed to reset engine (errno=%d)\n", rc); | ||
839 | |||
840 | + /* | ||
841 | + * According to AHCI-1.2 9.3.9: if FBS is enable, software shall | ||
842 | + * clear PxFBS.EN to '0' prior to issuing software reset to devices | ||
843 | + * that is attached to port multiplier. | ||
844 | + */ | ||
845 | + if (!ata_is_host_link(link) && pp->fbs_enabled) { | ||
846 | + ahci_disable_fbs(ap); | ||
847 | + fbs_disabled = true; | ||
848 | + } | ||
849 | + | ||
850 | ata_tf_init(link->device, &tf); | ||
851 | |||
852 | /* issue the first D2H Register FIS */ | ||
853 | @@ -1318,6 +1330,10 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, | ||
854 | } else | ||
855 | *class = ahci_dev_classify(ap); | ||
856 | |||
857 | + /* re-enable FBS if disabled before */ | ||
858 | + if (fbs_disabled) | ||
859 | + ahci_enable_fbs(ap); | ||
860 | + | ||
861 | DPRINTK("EXIT, class=%u\n", *class); | ||
862 | return 0; | ||
863 | |||
864 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c | ||
865 | index adf002a3..cd6aa28a 100644 | ||
866 | --- a/drivers/ata/libata-core.c | ||
867 | +++ b/drivers/ata/libata-core.c | ||
868 | @@ -4110,6 +4110,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | ||
869 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, | ||
870 | { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA }, | ||
871 | { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, | ||
872 | + { "Slimtype DVD A DS8A9SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, | ||
873 | |||
874 | /* Devices we expect to fail diagnostics */ | ||
875 | |||
876 | diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c | ||
877 | index c04d393d..08e67285 100644 | ||
878 | --- a/drivers/ata/libata-transport.c | ||
879 | +++ b/drivers/ata/libata-transport.c | ||
880 | @@ -319,25 +319,25 @@ int ata_tport_add(struct device *parent, | ||
881 | /* | ||
882 | * ATA link attributes | ||
883 | */ | ||
884 | +static int noop(int x) { return x; } | ||
885 | |||
886 | - | ||
887 | -#define ata_link_show_linkspeed(field) \ | ||
888 | +#define ata_link_show_linkspeed(field, format) \ | ||
889 | static ssize_t \ | ||
890 | show_ata_link_##field(struct device *dev, \ | ||
891 | struct device_attribute *attr, char *buf) \ | ||
892 | { \ | ||
893 | struct ata_link *link = transport_class_to_link(dev); \ | ||
894 | \ | ||
895 | - return sprintf(buf,"%s\n", sata_spd_string(fls(link->field))); \ | ||
896 | + return sprintf(buf, "%s\n", sata_spd_string(format(link->field))); \ | ||
897 | } | ||
898 | |||
899 | -#define ata_link_linkspeed_attr(field) \ | ||
900 | - ata_link_show_linkspeed(field) \ | ||
901 | +#define ata_link_linkspeed_attr(field, format) \ | ||
902 | + ata_link_show_linkspeed(field, format) \ | ||
903 | static DEVICE_ATTR(field, S_IRUGO, show_ata_link_##field, NULL) | ||
904 | |||
905 | -ata_link_linkspeed_attr(hw_sata_spd_limit); | ||
906 | -ata_link_linkspeed_attr(sata_spd_limit); | ||
907 | -ata_link_linkspeed_attr(sata_spd); | ||
908 | +ata_link_linkspeed_attr(hw_sata_spd_limit, fls); | ||
909 | +ata_link_linkspeed_attr(sata_spd_limit, fls); | ||
910 | +ata_link_linkspeed_attr(sata_spd, noop); | ||
911 | |||
912 | |||
913 | static DECLARE_TRANSPORT_CLASS(ata_link_class, | ||
914 | diff --git a/drivers/base/dd.c b/drivers/base/dd.c | ||
915 | index 35fa3689..06051767 100644 | ||
916 | --- a/drivers/base/dd.c | ||
917 | +++ b/drivers/base/dd.c | ||
918 | @@ -499,7 +499,7 @@ static void __device_release_driver(struct device *dev) | ||
919 | BUS_NOTIFY_UNBIND_DRIVER, | ||
920 | dev); | ||
921 | |||
922 | - pm_runtime_put(dev); | ||
923 | + pm_runtime_put_sync(dev); | ||
924 | |||
925 | if (dev->bus && dev->bus->remove) | ||
926 | dev->bus->remove(dev); | ||
927 | diff --git a/drivers/block/loop.c b/drivers/block/loop.c | ||
928 | index 00559736..4a811654 100644 | ||
929 | --- a/drivers/block/loop.c | ||
930 | +++ b/drivers/block/loop.c | ||
931 | @@ -894,13 +894,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, | ||
932 | |||
933 | bio_list_init(&lo->lo_bio_list); | ||
934 | |||
935 | - /* | ||
936 | - * set queue make_request_fn, and add limits based on lower level | ||
937 | - * device | ||
938 | - */ | ||
939 | - blk_queue_make_request(lo->lo_queue, loop_make_request); | ||
940 | - lo->lo_queue->queuedata = lo; | ||
941 | - | ||
942 | if (!(lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync) | ||
943 | blk_queue_flush(lo->lo_queue, REQ_FLUSH); | ||
944 | |||
945 | @@ -1618,6 +1611,8 @@ static int loop_add(struct loop_device **l, int i) | ||
946 | if (!lo) | ||
947 | goto out; | ||
948 | |||
949 | + lo->lo_state = Lo_unbound; | ||
950 | + | ||
951 | /* allocate id, if @id >= 0, we're requesting that specific id */ | ||
952 | if (i >= 0) { | ||
953 | err = idr_alloc(&loop_index_idr, lo, i, i + 1, GFP_KERNEL); | ||
954 | @@ -1633,7 +1628,13 @@ static int loop_add(struct loop_device **l, int i) | ||
955 | err = -ENOMEM; | ||
956 | lo->lo_queue = blk_alloc_queue(GFP_KERNEL); | ||
957 | if (!lo->lo_queue) | ||
958 | - goto out_free_dev; | ||
959 | + goto out_free_idr; | ||
960 | + | ||
961 | + /* | ||
962 | + * set queue make_request_fn | ||
963 | + */ | ||
964 | + blk_queue_make_request(lo->lo_queue, loop_make_request); | ||
965 | + lo->lo_queue->queuedata = lo; | ||
966 | |||
967 | disk = lo->lo_disk = alloc_disk(1 << part_shift); | ||
968 | if (!disk) | ||
969 | @@ -1678,6 +1679,8 @@ static int loop_add(struct loop_device **l, int i) | ||
970 | |||
971 | out_free_queue: | ||
972 | blk_cleanup_queue(lo->lo_queue); | ||
973 | +out_free_idr: | ||
974 | + idr_remove(&loop_index_idr, i); | ||
975 | out_free_dev: | ||
976 | kfree(lo); | ||
977 | out: | ||
978 | diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c | ||
979 | index d81dfca7..03dd4aa6 100644 | ||
980 | --- a/drivers/block/xen-blkback/blkback.c | ||
981 | +++ b/drivers/block/xen-blkback/blkback.c | ||
982 | @@ -649,6 +649,8 @@ static int dispatch_discard_io(struct xen_blkif *blkif, | ||
983 | unsigned long secure; | ||
984 | struct phys_req preq; | ||
985 | |||
986 | + xen_blkif_get(blkif); | ||
987 | + | ||
988 | preq.sector_number = req->u.discard.sector_number; | ||
989 | preq.nr_sects = req->u.discard.nr_sectors; | ||
990 | |||
991 | @@ -661,7 +663,6 @@ static int dispatch_discard_io(struct xen_blkif *blkif, | ||
992 | } | ||
993 | blkif->st_ds_req++; | ||
994 | |||
995 | - xen_blkif_get(blkif); | ||
996 | secure = (blkif->vbd.discard_secure && | ||
997 | (req->u.discard.flag & BLKIF_DISCARD_SECURE)) ? | ||
998 | BLKDEV_DISCARD_SECURE : 0; | ||
999 | diff --git a/drivers/clk/mvebu/clk-core.c b/drivers/clk/mvebu/clk-core.c | ||
1000 | index 0a53edba..e5c477b4 100644 | ||
1001 | --- a/drivers/clk/mvebu/clk-core.c | ||
1002 | +++ b/drivers/clk/mvebu/clk-core.c | ||
1003 | @@ -126,8 +126,8 @@ static void __init mvebu_clk_core_setup(struct device_node *np, | ||
1004 | #define SARH_AXP_FAB_FREQ_OPT_SHIFT 4 | ||
1005 | |||
1006 | static const u32 __initconst armada_370_tclk_frequencies[] = { | ||
1007 | - 16600000, | ||
1008 | - 20000000, | ||
1009 | + 166000000, | ||
1010 | + 200000000, | ||
1011 | }; | ||
1012 | |||
1013 | static u32 __init armada_370_get_tclk_freq(void __iomem *sar) | ||
1014 | diff --git a/drivers/cpufreq/highbank-cpufreq.c b/drivers/cpufreq/highbank-cpufreq.c | ||
1015 | index b61b5a3f..8c4771da 100644 | ||
1016 | --- a/drivers/cpufreq/highbank-cpufreq.c | ||
1017 | +++ b/drivers/cpufreq/highbank-cpufreq.c | ||
1018 | @@ -66,7 +66,8 @@ static int hb_cpufreq_driver_init(void) | ||
1019 | struct device_node *np; | ||
1020 | int ret; | ||
1021 | |||
1022 | - if (!of_machine_is_compatible("calxeda,highbank")) | ||
1023 | + if ((!of_machine_is_compatible("calxeda,highbank")) && | ||
1024 | + (!of_machine_is_compatible("calxeda,ecx-2000"))) | ||
1025 | return -ENODEV; | ||
1026 | |||
1027 | for_each_child_of_node(of_find_node_by_path("/cpus"), np) | ||
1028 | diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c | ||
1029 | index ca6ea9b3..fa43a42c 100644 | ||
1030 | --- a/drivers/dma/ioat/dma_v3.c | ||
1031 | +++ b/drivers/dma/ioat/dma_v3.c | ||
1032 | @@ -87,13 +87,6 @@ static const u8 pq_idx_to_field[] = { 1, 4, 5, 0, 1, 2, 4, 5 }; | ||
1033 | static const u8 pq16_idx_to_field[] = { 1, 4, 1, 2, 3, 4, 5, 6, 7, | ||
1034 | 0, 1, 2, 3, 4, 5, 6 }; | ||
1035 | |||
1036 | -/* | ||
1037 | - * technically sources 1 and 2 do not require SED, but the op will have | ||
1038 | - * at least 9 descriptors so that's irrelevant. | ||
1039 | - */ | ||
1040 | -static const u8 pq16_idx_to_sed[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
1041 | - 1, 1, 1, 1, 1, 1, 1 }; | ||
1042 | - | ||
1043 | static void ioat3_eh(struct ioat2_dma_chan *ioat); | ||
1044 | |||
1045 | static dma_addr_t xor_get_src(struct ioat_raw_descriptor *descs[2], int idx) | ||
1046 | @@ -135,12 +128,6 @@ static void pq_set_src(struct ioat_raw_descriptor *descs[2], | ||
1047 | pq->coef[idx] = coef; | ||
1048 | } | ||
1049 | |||
1050 | -static int sed_get_pq16_pool_idx(int src_cnt) | ||
1051 | -{ | ||
1052 | - | ||
1053 | - return pq16_idx_to_sed[src_cnt]; | ||
1054 | -} | ||
1055 | - | ||
1056 | static bool is_jf_ioat(struct pci_dev *pdev) | ||
1057 | { | ||
1058 | switch (pdev->device) { | ||
1059 | @@ -1182,9 +1169,6 @@ __ioat3_prep_pq16_lock(struct dma_chan *c, enum sum_check_flags *result, | ||
1060 | u8 op; | ||
1061 | int i, s, idx, num_descs; | ||
1062 | |||
1063 | - /* this function only handles src_cnt 9 - 16 */ | ||
1064 | - BUG_ON(src_cnt < 9); | ||
1065 | - | ||
1066 | /* this function is only called with 9-16 sources */ | ||
1067 | op = result ? IOAT_OP_PQ_VAL_16S : IOAT_OP_PQ_16S; | ||
1068 | |||
1069 | @@ -1212,8 +1196,7 @@ __ioat3_prep_pq16_lock(struct dma_chan *c, enum sum_check_flags *result, | ||
1070 | |||
1071 | descs[0] = (struct ioat_raw_descriptor *) pq; | ||
1072 | |||
1073 | - desc->sed = ioat3_alloc_sed(device, | ||
1074 | - sed_get_pq16_pool_idx(src_cnt)); | ||
1075 | + desc->sed = ioat3_alloc_sed(device, (src_cnt-2) >> 3); | ||
1076 | if (!desc->sed) { | ||
1077 | dev_err(to_dev(chan), | ||
1078 | "%s: no free sed entries\n", __func__); | ||
1079 | @@ -1271,13 +1254,21 @@ __ioat3_prep_pq16_lock(struct dma_chan *c, enum sum_check_flags *result, | ||
1080 | return &desc->txd; | ||
1081 | } | ||
1082 | |||
1083 | +static int src_cnt_flags(unsigned int src_cnt, unsigned long flags) | ||
1084 | +{ | ||
1085 | + if (dmaf_p_disabled_continue(flags)) | ||
1086 | + return src_cnt + 1; | ||
1087 | + else if (dmaf_continue(flags)) | ||
1088 | + return src_cnt + 3; | ||
1089 | + else | ||
1090 | + return src_cnt; | ||
1091 | +} | ||
1092 | + | ||
1093 | static struct dma_async_tx_descriptor * | ||
1094 | ioat3_prep_pq(struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src, | ||
1095 | unsigned int src_cnt, const unsigned char *scf, size_t len, | ||
1096 | unsigned long flags) | ||
1097 | { | ||
1098 | - struct dma_device *dma = chan->device; | ||
1099 | - | ||
1100 | /* specify valid address for disabled result */ | ||
1101 | if (flags & DMA_PREP_PQ_DISABLE_P) | ||
1102 | dst[0] = dst[1]; | ||
1103 | @@ -1297,7 +1288,7 @@ ioat3_prep_pq(struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src, | ||
1104 | single_source_coef[0] = scf[0]; | ||
1105 | single_source_coef[1] = 0; | ||
1106 | |||
1107 | - return (src_cnt > 8) && (dma->max_pq > 8) ? | ||
1108 | + return src_cnt_flags(src_cnt, flags) > 8 ? | ||
1109 | __ioat3_prep_pq16_lock(chan, NULL, dst, single_source, | ||
1110 | 2, single_source_coef, len, | ||
1111 | flags) : | ||
1112 | @@ -1305,7 +1296,7 @@ ioat3_prep_pq(struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src, | ||
1113 | single_source_coef, len, flags); | ||
1114 | |||
1115 | } else { | ||
1116 | - return (src_cnt > 8) && (dma->max_pq > 8) ? | ||
1117 | + return src_cnt_flags(src_cnt, flags) > 8 ? | ||
1118 | __ioat3_prep_pq16_lock(chan, NULL, dst, src, src_cnt, | ||
1119 | scf, len, flags) : | ||
1120 | __ioat3_prep_pq_lock(chan, NULL, dst, src, src_cnt, | ||
1121 | @@ -1318,8 +1309,6 @@ ioat3_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src, | ||
1122 | unsigned int src_cnt, const unsigned char *scf, size_t len, | ||
1123 | enum sum_check_flags *pqres, unsigned long flags) | ||
1124 | { | ||
1125 | - struct dma_device *dma = chan->device; | ||
1126 | - | ||
1127 | /* specify valid address for disabled result */ | ||
1128 | if (flags & DMA_PREP_PQ_DISABLE_P) | ||
1129 | pq[0] = pq[1]; | ||
1130 | @@ -1331,7 +1320,7 @@ ioat3_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src, | ||
1131 | */ | ||
1132 | *pqres = 0; | ||
1133 | |||
1134 | - return (src_cnt > 8) && (dma->max_pq > 8) ? | ||
1135 | + return src_cnt_flags(src_cnt, flags) > 8 ? | ||
1136 | __ioat3_prep_pq16_lock(chan, pqres, pq, src, src_cnt, scf, len, | ||
1137 | flags) : | ||
1138 | __ioat3_prep_pq_lock(chan, pqres, pq, src, src_cnt, scf, len, | ||
1139 | @@ -1342,7 +1331,6 @@ static struct dma_async_tx_descriptor * | ||
1140 | ioat3_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src, | ||
1141 | unsigned int src_cnt, size_t len, unsigned long flags) | ||
1142 | { | ||
1143 | - struct dma_device *dma = chan->device; | ||
1144 | unsigned char scf[src_cnt]; | ||
1145 | dma_addr_t pq[2]; | ||
1146 | |||
1147 | @@ -1351,7 +1339,7 @@ ioat3_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src, | ||
1148 | flags |= DMA_PREP_PQ_DISABLE_Q; | ||
1149 | pq[1] = dst; /* specify valid address for disabled result */ | ||
1150 | |||
1151 | - return (src_cnt > 8) && (dma->max_pq > 8) ? | ||
1152 | + return src_cnt_flags(src_cnt, flags) > 8 ? | ||
1153 | __ioat3_prep_pq16_lock(chan, NULL, pq, src, src_cnt, scf, len, | ||
1154 | flags) : | ||
1155 | __ioat3_prep_pq_lock(chan, NULL, pq, src, src_cnt, scf, len, | ||
1156 | @@ -1363,7 +1351,6 @@ ioat3_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src, | ||
1157 | unsigned int src_cnt, size_t len, | ||
1158 | enum sum_check_flags *result, unsigned long flags) | ||
1159 | { | ||
1160 | - struct dma_device *dma = chan->device; | ||
1161 | unsigned char scf[src_cnt]; | ||
1162 | dma_addr_t pq[2]; | ||
1163 | |||
1164 | @@ -1377,8 +1364,7 @@ ioat3_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src, | ||
1165 | flags |= DMA_PREP_PQ_DISABLE_Q; | ||
1166 | pq[1] = pq[0]; /* specify valid address for disabled result */ | ||
1167 | |||
1168 | - | ||
1169 | - return (src_cnt > 8) && (dma->max_pq > 8) ? | ||
1170 | + return src_cnt_flags(src_cnt, flags) > 8 ? | ||
1171 | __ioat3_prep_pq16_lock(chan, result, pq, &src[1], src_cnt - 1, | ||
1172 | scf, len, flags) : | ||
1173 | __ioat3_prep_pq_lock(chan, result, pq, &src[1], src_cnt - 1, | ||
1174 | diff --git a/drivers/edac/highbank_l2_edac.c b/drivers/edac/highbank_l2_edac.c | ||
1175 | index c2bd8c6a..10d3d298 100644 | ||
1176 | --- a/drivers/edac/highbank_l2_edac.c | ||
1177 | +++ b/drivers/edac/highbank_l2_edac.c | ||
1178 | @@ -90,28 +90,30 @@ static int highbank_l2_err_probe(struct platform_device *pdev) | ||
1179 | goto err; | ||
1180 | } | ||
1181 | |||
1182 | + dci->mod_name = dev_name(&pdev->dev); | ||
1183 | + dci->dev_name = dev_name(&pdev->dev); | ||
1184 | + | ||
1185 | + if (edac_device_add_device(dci)) | ||
1186 | + goto err; | ||
1187 | + | ||
1188 | drvdata->db_irq = platform_get_irq(pdev, 0); | ||
1189 | res = devm_request_irq(&pdev->dev, drvdata->db_irq, | ||
1190 | highbank_l2_err_handler, | ||
1191 | 0, dev_name(&pdev->dev), dci); | ||
1192 | if (res < 0) | ||
1193 | - goto err; | ||
1194 | + goto err2; | ||
1195 | |||
1196 | drvdata->sb_irq = platform_get_irq(pdev, 1); | ||
1197 | res = devm_request_irq(&pdev->dev, drvdata->sb_irq, | ||
1198 | highbank_l2_err_handler, | ||
1199 | 0, dev_name(&pdev->dev), dci); | ||
1200 | if (res < 0) | ||
1201 | - goto err; | ||
1202 | - | ||
1203 | - dci->mod_name = dev_name(&pdev->dev); | ||
1204 | - dci->dev_name = dev_name(&pdev->dev); | ||
1205 | - | ||
1206 | - if (edac_device_add_device(dci)) | ||
1207 | - goto err; | ||
1208 | + goto err2; | ||
1209 | |||
1210 | devres_close_group(&pdev->dev, NULL); | ||
1211 | return 0; | ||
1212 | +err2: | ||
1213 | + edac_device_del_device(&pdev->dev); | ||
1214 | err: | ||
1215 | devres_release_group(&pdev->dev, NULL); | ||
1216 | edac_device_free_ctl_info(dci); | ||
1217 | diff --git a/drivers/edac/highbank_mc_edac.c b/drivers/edac/highbank_mc_edac.c | ||
1218 | index 4695dd2d..7a783075 100644 | ||
1219 | --- a/drivers/edac/highbank_mc_edac.c | ||
1220 | +++ b/drivers/edac/highbank_mc_edac.c | ||
1221 | @@ -189,14 +189,6 @@ static int highbank_mc_probe(struct platform_device *pdev) | ||
1222 | goto err; | ||
1223 | } | ||
1224 | |||
1225 | - irq = platform_get_irq(pdev, 0); | ||
1226 | - res = devm_request_irq(&pdev->dev, irq, highbank_mc_err_handler, | ||
1227 | - 0, dev_name(&pdev->dev), mci); | ||
1228 | - if (res < 0) { | ||
1229 | - dev_err(&pdev->dev, "Unable to request irq %d\n", irq); | ||
1230 | - goto err; | ||
1231 | - } | ||
1232 | - | ||
1233 | mci->mtype_cap = MEM_FLAG_DDR3; | ||
1234 | mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED; | ||
1235 | mci->edac_cap = EDAC_FLAG_SECDED; | ||
1236 | @@ -217,10 +209,20 @@ static int highbank_mc_probe(struct platform_device *pdev) | ||
1237 | if (res < 0) | ||
1238 | goto err; | ||
1239 | |||
1240 | + irq = platform_get_irq(pdev, 0); | ||
1241 | + res = devm_request_irq(&pdev->dev, irq, highbank_mc_err_handler, | ||
1242 | + 0, dev_name(&pdev->dev), mci); | ||
1243 | + if (res < 0) { | ||
1244 | + dev_err(&pdev->dev, "Unable to request irq %d\n", irq); | ||
1245 | + goto err2; | ||
1246 | + } | ||
1247 | + | ||
1248 | highbank_mc_create_debugfs_nodes(mci); | ||
1249 | |||
1250 | devres_close_group(&pdev->dev, NULL); | ||
1251 | return 0; | ||
1252 | +err2: | ||
1253 | + edac_mc_del_mc(&pdev->dev); | ||
1254 | err: | ||
1255 | devres_release_group(&pdev->dev, NULL); | ||
1256 | edac_mc_free(mci); | ||
1257 | diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c | ||
1258 | index 3a4816ad..5c27da6a 100644 | ||
1259 | --- a/drivers/gpio/gpio-mvebu.c | ||
1260 | +++ b/drivers/gpio/gpio-mvebu.c | ||
1261 | @@ -79,7 +79,7 @@ struct mvebu_gpio_chip { | ||
1262 | spinlock_t lock; | ||
1263 | void __iomem *membase; | ||
1264 | void __iomem *percpu_membase; | ||
1265 | - unsigned int irqbase; | ||
1266 | + int irqbase; | ||
1267 | struct irq_domain *domain; | ||
1268 | int soc_variant; | ||
1269 | }; | ||
1270 | diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c | ||
1271 | index 6a4bd0da..4fbe12d2 100644 | ||
1272 | --- a/drivers/gpio/gpio-pl061.c | ||
1273 | +++ b/drivers/gpio/gpio-pl061.c | ||
1274 | @@ -286,11 +286,6 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) | ||
1275 | if (!chip->base) | ||
1276 | return -ENOMEM; | ||
1277 | |||
1278 | - chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR, | ||
1279 | - irq_base, &pl061_domain_ops, chip); | ||
1280 | - if (!chip->domain) | ||
1281 | - return -ENODEV; | ||
1282 | - | ||
1283 | spin_lock_init(&chip->lock); | ||
1284 | |||
1285 | chip->gc.request = pl061_gpio_request; | ||
1286 | @@ -320,6 +315,11 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) | ||
1287 | irq_set_chained_handler(irq, pl061_irq_handler); | ||
1288 | irq_set_handler_data(irq, chip); | ||
1289 | |||
1290 | + chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR, | ||
1291 | + irq_base, &pl061_domain_ops, chip); | ||
1292 | + if (!chip->domain) | ||
1293 | + return -ENODEV; | ||
1294 | + | ||
1295 | for (i = 0; i < PL061_GPIO_NR; i++) { | ||
1296 | if (pdata) { | ||
1297 | if (pdata->directions & (1 << i)) | ||
1298 | diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c | ||
1299 | index b4ca4509..c45ad478 100644 | ||
1300 | --- a/drivers/gpio/gpio-rcar.c | ||
1301 | +++ b/drivers/gpio/gpio-rcar.c | ||
1302 | @@ -329,7 +329,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) | ||
1303 | if (!p->irq_domain) { | ||
1304 | ret = -ENXIO; | ||
1305 | dev_err(&pdev->dev, "cannot initialize irq domain\n"); | ||
1306 | - goto err1; | ||
1307 | + goto err0; | ||
1308 | } | ||
1309 | |||
1310 | if (devm_request_irq(&pdev->dev, irq->start, | ||
1311 | diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c | ||
1312 | index 4d330e36..ed1d10ae 100644 | ||
1313 | --- a/drivers/gpio/gpio-twl4030.c | ||
1314 | +++ b/drivers/gpio/gpio-twl4030.c | ||
1315 | @@ -354,17 +354,18 @@ static void twl_set(struct gpio_chip *chip, unsigned offset, int value) | ||
1316 | static int twl_direction_out(struct gpio_chip *chip, unsigned offset, int value) | ||
1317 | { | ||
1318 | struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip); | ||
1319 | + int ret = -EINVAL; | ||
1320 | |||
1321 | mutex_lock(&priv->mutex); | ||
1322 | if (offset < TWL4030_GPIO_MAX) | ||
1323 | - twl4030_set_gpio_dataout(offset, value); | ||
1324 | + ret = twl4030_set_gpio_direction(offset, 0); | ||
1325 | |||
1326 | priv->direction |= BIT(offset); | ||
1327 | mutex_unlock(&priv->mutex); | ||
1328 | |||
1329 | twl_set(chip, offset, value); | ||
1330 | |||
1331 | - return 0; | ||
1332 | + return ret; | ||
1333 | } | ||
1334 | |||
1335 | static int twl_to_irq(struct gpio_chip *chip, unsigned offset) | ||
1336 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c | ||
1337 | index ab952595..c714d4d5 100644 | ||
1338 | --- a/drivers/gpu/drm/i915/intel_display.c | ||
1339 | +++ b/drivers/gpu/drm/i915/intel_display.c | ||
1340 | @@ -6262,7 +6262,9 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base) | ||
1341 | intel_crtc->cursor_visible = visible; | ||
1342 | } | ||
1343 | /* and commit changes on next vblank */ | ||
1344 | + POSTING_READ(CURCNTR(pipe)); | ||
1345 | I915_WRITE(CURBASE(pipe), base); | ||
1346 | + POSTING_READ(CURBASE(pipe)); | ||
1347 | } | ||
1348 | |||
1349 | static void ivb_update_cursor(struct drm_crtc *crtc, u32 base) | ||
1350 | @@ -6289,7 +6291,9 @@ static void ivb_update_cursor(struct drm_crtc *crtc, u32 base) | ||
1351 | intel_crtc->cursor_visible = visible; | ||
1352 | } | ||
1353 | /* and commit changes on next vblank */ | ||
1354 | + POSTING_READ(CURCNTR_IVB(pipe)); | ||
1355 | I915_WRITE(CURBASE_IVB(pipe), base); | ||
1356 | + POSTING_READ(CURBASE_IVB(pipe)); | ||
1357 | } | ||
1358 | |||
1359 | /* If no-part of the cursor is visible on the framebuffer, then the GPU may hang... */ | ||
1360 | diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c | ||
1361 | index b4b4d0c1..5bccf31c 100644 | ||
1362 | --- a/drivers/gpu/drm/nouveau/nouveau_gem.c | ||
1363 | +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | ||
1364 | @@ -287,7 +287,8 @@ validate_fini_list(struct list_head *list, struct nouveau_fence *fence) | ||
1365 | list_for_each_safe(entry, tmp, list) { | ||
1366 | nvbo = list_entry(entry, struct nouveau_bo, entry); | ||
1367 | |||
1368 | - nouveau_bo_fence(nvbo, fence); | ||
1369 | + if (likely(fence)) | ||
1370 | + nouveau_bo_fence(nvbo, fence); | ||
1371 | |||
1372 | if (unlikely(nvbo->validate_mapped)) { | ||
1373 | ttm_bo_kunmap(&nvbo->kmap); | ||
1374 | diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c | ||
1375 | index b3c51275..7002de79 100644 | ||
1376 | --- a/drivers/gpu/drm/qxl/qxl_fb.c | ||
1377 | +++ b/drivers/gpu/drm/qxl/qxl_fb.c | ||
1378 | @@ -91,7 +91,7 @@ static void qxl_fb_dirty_flush(struct fb_info *info) | ||
1379 | u32 x1, x2, y1, y2; | ||
1380 | |||
1381 | /* TODO: hard coding 32 bpp */ | ||
1382 | - int stride = qfbdev->qfb.base.pitches[0] * 4; | ||
1383 | + int stride = qfbdev->qfb.base.pitches[0]; | ||
1384 | |||
1385 | x1 = qfbdev->dirty.x1; | ||
1386 | x2 = qfbdev->dirty.x2; | ||
1387 | diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c | ||
1388 | index d5df8fd1..22f06c8d 100644 | ||
1389 | --- a/drivers/gpu/drm/radeon/atombios_crtc.c | ||
1390 | +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | ||
1391 | @@ -1683,7 +1683,7 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | ||
1392 | if (pll != ATOM_PPLL_INVALID) | ||
1393 | return pll; | ||
1394 | } | ||
1395 | - } else { | ||
1396 | + } else if (!ASIC_IS_DCE41(rdev)) { /* Don't share PLLs on DCE4.1 chips */ | ||
1397 | /* use the same PPLL for all monitors with the same clock */ | ||
1398 | pll = radeon_get_shared_nondp_ppll(crtc); | ||
1399 | if (pll != ATOM_PPLL_INVALID) | ||
1400 | diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c | ||
1401 | index bb9ea364..067cc1fc 100644 | ||
1402 | --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c | ||
1403 | +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | ||
1404 | @@ -219,8 +219,7 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode | ||
1405 | /* fglrx clears sth in AFMT_AUDIO_PACKET_CONTROL2 here */ | ||
1406 | |||
1407 | WREG32(HDMI_ACR_PACKET_CONTROL + offset, | ||
1408 | - HDMI_ACR_AUTO_SEND | /* allow hw to sent ACR packets when required */ | ||
1409 | - HDMI_ACR_SOURCE); /* select SW CTS value */ | ||
1410 | + HDMI_ACR_AUTO_SEND); /* allow hw to sent ACR packets when required */ | ||
1411 | |||
1412 | evergreen_hdmi_update_ACR(encoder, mode->clock); | ||
1413 | |||
1414 | diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c | ||
1415 | index 0efe2a93..635e8f2e 100644 | ||
1416 | --- a/drivers/gpu/drm/radeon/r600_hdmi.c | ||
1417 | +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | ||
1418 | @@ -57,15 +57,15 @@ enum r600_hdmi_iec_status_bits { | ||
1419 | static const struct radeon_hdmi_acr r600_hdmi_predefined_acr[] = { | ||
1420 | /* 32kHz 44.1kHz 48kHz */ | ||
1421 | /* Clock N CTS N CTS N CTS */ | ||
1422 | - { 25174, 4576, 28125, 7007, 31250, 6864, 28125 }, /* 25,20/1.001 MHz */ | ||
1423 | + { 25175, 4576, 28125, 7007, 31250, 6864, 28125 }, /* 25,20/1.001 MHz */ | ||
1424 | { 25200, 4096, 25200, 6272, 28000, 6144, 25200 }, /* 25.20 MHz */ | ||
1425 | { 27000, 4096, 27000, 6272, 30000, 6144, 27000 }, /* 27.00 MHz */ | ||
1426 | { 27027, 4096, 27027, 6272, 30030, 6144, 27027 }, /* 27.00*1.001 MHz */ | ||
1427 | { 54000, 4096, 54000, 6272, 60000, 6144, 54000 }, /* 54.00 MHz */ | ||
1428 | { 54054, 4096, 54054, 6272, 60060, 6144, 54054 }, /* 54.00*1.001 MHz */ | ||
1429 | - { 74175, 11648, 210937, 17836, 234375, 11648, 140625 }, /* 74.25/1.001 MHz */ | ||
1430 | + { 74176, 11648, 210937, 17836, 234375, 11648, 140625 }, /* 74.25/1.001 MHz */ | ||
1431 | { 74250, 4096, 74250, 6272, 82500, 6144, 74250 }, /* 74.25 MHz */ | ||
1432 | - { 148351, 11648, 421875, 8918, 234375, 5824, 140625 }, /* 148.50/1.001 MHz */ | ||
1433 | + { 148352, 11648, 421875, 8918, 234375, 5824, 140625 }, /* 148.50/1.001 MHz */ | ||
1434 | { 148500, 4096, 148500, 6272, 165000, 6144, 148500 }, /* 148.50 MHz */ | ||
1435 | { 0, 4096, 0, 6272, 0, 6144, 0 } /* Other */ | ||
1436 | }; | ||
1437 | @@ -75,8 +75,15 @@ static const struct radeon_hdmi_acr r600_hdmi_predefined_acr[] = { | ||
1438 | */ | ||
1439 | static void r600_hdmi_calc_cts(uint32_t clock, int *CTS, int N, int freq) | ||
1440 | { | ||
1441 | - if (*CTS == 0) | ||
1442 | - *CTS = clock * N / (128 * freq) * 1000; | ||
1443 | + u64 n; | ||
1444 | + u32 d; | ||
1445 | + | ||
1446 | + if (*CTS == 0) { | ||
1447 | + n = (u64)clock * (u64)N * 1000ULL; | ||
1448 | + d = 128 * freq; | ||
1449 | + do_div(n, d); | ||
1450 | + *CTS = n; | ||
1451 | + } | ||
1452 | DRM_DEBUG("Using ACR timing N=%d CTS=%d for frequency %d\n", | ||
1453 | N, *CTS, freq); | ||
1454 | } | ||
1455 | @@ -313,8 +320,8 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod | ||
1456 | } | ||
1457 | |||
1458 | WREG32(HDMI0_ACR_PACKET_CONTROL + offset, | ||
1459 | - HDMI0_ACR_AUTO_SEND | /* allow hw to sent ACR packets when required */ | ||
1460 | - HDMI0_ACR_SOURCE); /* select SW CTS value */ | ||
1461 | + HDMI0_ACR_SOURCE | /* select SW CTS value - XXX verify that hw CTS works on all families */ | ||
1462 | + HDMI0_ACR_AUTO_SEND); /* allow hw to sent ACR packets when required */ | ||
1463 | |||
1464 | WREG32(HDMI0_VBI_PACKET_CONTROL + offset, | ||
1465 | HDMI0_NULL_SEND | /* send null packets when required */ | ||
1466 | diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c | ||
1467 | index 5ce190b8..2915a1c5 100644 | ||
1468 | --- a/drivers/gpu/drm/radeon/radeon_gart.c | ||
1469 | +++ b/drivers/gpu/drm/radeon/radeon_gart.c | ||
1470 | @@ -1157,6 +1157,8 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, | ||
1471 | return -ENOMEM; | ||
1472 | |||
1473 | r = radeon_ib_get(rdev, ridx, &ib, NULL, ndw * 4); | ||
1474 | + if (r) | ||
1475 | + return r; | ||
1476 | ib.length_dw = 0; | ||
1477 | |||
1478 | r = radeon_vm_update_pdes(rdev, vm, &ib, bo_va->soffset, bo_va->eoffset); | ||
1479 | diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | ||
1480 | index 7cb178a3..bc73021d 100644 | ||
1481 | --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | ||
1482 | +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | ||
1483 | @@ -422,6 +422,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, | ||
1484 | /* Pin framebuffer & get tilling informations */ | ||
1485 | obj = radeon_fb->obj; | ||
1486 | rbo = gem_to_radeon_bo(obj); | ||
1487 | +retry: | ||
1488 | r = radeon_bo_reserve(rbo, false); | ||
1489 | if (unlikely(r != 0)) | ||
1490 | return r; | ||
1491 | @@ -430,6 +431,33 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, | ||
1492 | &base); | ||
1493 | if (unlikely(r != 0)) { | ||
1494 | radeon_bo_unreserve(rbo); | ||
1495 | + | ||
1496 | + /* On old GPU like RN50 with little vram pining can fails because | ||
1497 | + * current fb is taking all space needed. So instead of unpining | ||
1498 | + * the old buffer after pining the new one, first unpin old one | ||
1499 | + * and then retry pining new one. | ||
1500 | + * | ||
1501 | + * As only master can set mode only master can pin and it is | ||
1502 | + * unlikely the master client will race with itself especialy | ||
1503 | + * on those old gpu with single crtc. | ||
1504 | + * | ||
1505 | + * We don't shutdown the display controller because new buffer | ||
1506 | + * will end up in same spot. | ||
1507 | + */ | ||
1508 | + if (!atomic && fb && fb != crtc->fb) { | ||
1509 | + struct radeon_bo *old_rbo; | ||
1510 | + unsigned long nsize, osize; | ||
1511 | + | ||
1512 | + old_rbo = gem_to_radeon_bo(to_radeon_framebuffer(fb)->obj); | ||
1513 | + osize = radeon_bo_size(old_rbo); | ||
1514 | + nsize = radeon_bo_size(rbo); | ||
1515 | + if (nsize <= osize && !radeon_bo_reserve(old_rbo, false)) { | ||
1516 | + radeon_bo_unpin(old_rbo); | ||
1517 | + radeon_bo_unreserve(old_rbo); | ||
1518 | + fb = NULL; | ||
1519 | + goto retry; | ||
1520 | + } | ||
1521 | + } | ||
1522 | return -EINVAL; | ||
1523 | } | ||
1524 | radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL); | ||
1525 | diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c | ||
1526 | index f3ccf6d4..a809b173 100644 | ||
1527 | --- a/drivers/gpu/drm/radeon/radeon_uvd.c | ||
1528 | +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | ||
1529 | @@ -242,6 +242,8 @@ void radeon_uvd_free_handles(struct radeon_device *rdev, struct drm_file *filp) | ||
1530 | if (handle != 0 && rdev->uvd.filp[i] == filp) { | ||
1531 | struct radeon_fence *fence; | ||
1532 | |||
1533 | + radeon_uvd_note_usage(rdev); | ||
1534 | + | ||
1535 | r = radeon_uvd_get_destroy_msg(rdev, | ||
1536 | R600_RING_TYPE_UVD_INDEX, handle, &fence); | ||
1537 | if (r) { | ||
1538 | diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h | ||
1539 | index 495f41f2..108c8d25 100644 | ||
1540 | --- a/drivers/gpu/drm/radeon/sid.h | ||
1541 | +++ b/drivers/gpu/drm/radeon/sid.h | ||
1542 | @@ -247,7 +247,7 @@ | ||
1543 | #define NOOFGROUPS_SHIFT 12 | ||
1544 | #define NOOFGROUPS_MASK 0x00001000 | ||
1545 | |||
1546 | -#define MC_SEQ_TRAIN_WAKEUP_CNTL 0x2808 | ||
1547 | +#define MC_SEQ_TRAIN_WAKEUP_CNTL 0x28e8 | ||
1548 | #define TRAIN_DONE_D0 (1 << 30) | ||
1549 | #define TRAIN_DONE_D1 (1 << 31) | ||
1550 | |||
1551 | diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c | ||
1552 | index 9b07b7d4..8697abd7 100644 | ||
1553 | --- a/drivers/gpu/drm/ttm/ttm_bo.c | ||
1554 | +++ b/drivers/gpu/drm/ttm/ttm_bo.c | ||
1555 | @@ -1153,24 +1153,32 @@ out_unlock: | ||
1556 | return ret; | ||
1557 | } | ||
1558 | |||
1559 | -static int ttm_bo_mem_compat(struct ttm_placement *placement, | ||
1560 | - struct ttm_mem_reg *mem) | ||
1561 | +static bool ttm_bo_mem_compat(struct ttm_placement *placement, | ||
1562 | + struct ttm_mem_reg *mem, | ||
1563 | + uint32_t *new_flags) | ||
1564 | { | ||
1565 | int i; | ||
1566 | |||
1567 | if (mem->mm_node && placement->lpfn != 0 && | ||
1568 | (mem->start < placement->fpfn || | ||
1569 | mem->start + mem->num_pages > placement->lpfn)) | ||
1570 | - return -1; | ||
1571 | + return false; | ||
1572 | |||
1573 | for (i = 0; i < placement->num_placement; i++) { | ||
1574 | - if ((placement->placement[i] & mem->placement & | ||
1575 | - TTM_PL_MASK_CACHING) && | ||
1576 | - (placement->placement[i] & mem->placement & | ||
1577 | - TTM_PL_MASK_MEM)) | ||
1578 | - return i; | ||
1579 | + *new_flags = placement->placement[i]; | ||
1580 | + if ((*new_flags & mem->placement & TTM_PL_MASK_CACHING) && | ||
1581 | + (*new_flags & mem->placement & TTM_PL_MASK_MEM)) | ||
1582 | + return true; | ||
1583 | + } | ||
1584 | + | ||
1585 | + for (i = 0; i < placement->num_busy_placement; i++) { | ||
1586 | + *new_flags = placement->busy_placement[i]; | ||
1587 | + if ((*new_flags & mem->placement & TTM_PL_MASK_CACHING) && | ||
1588 | + (*new_flags & mem->placement & TTM_PL_MASK_MEM)) | ||
1589 | + return true; | ||
1590 | } | ||
1591 | - return -1; | ||
1592 | + | ||
1593 | + return false; | ||
1594 | } | ||
1595 | |||
1596 | int ttm_bo_validate(struct ttm_buffer_object *bo, | ||
1597 | @@ -1179,6 +1187,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, | ||
1598 | bool no_wait_gpu) | ||
1599 | { | ||
1600 | int ret; | ||
1601 | + uint32_t new_flags; | ||
1602 | |||
1603 | BUG_ON(!ttm_bo_is_reserved(bo)); | ||
1604 | /* Check that range is valid */ | ||
1605 | @@ -1189,8 +1198,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, | ||
1606 | /* | ||
1607 | * Check whether we need to move buffer. | ||
1608 | */ | ||
1609 | - ret = ttm_bo_mem_compat(placement, &bo->mem); | ||
1610 | - if (ret < 0) { | ||
1611 | + if (!ttm_bo_mem_compat(placement, &bo->mem, &new_flags)) { | ||
1612 | ret = ttm_bo_move_buffer(bo, placement, interruptible, | ||
1613 | no_wait_gpu); | ||
1614 | if (ret) | ||
1615 | @@ -1200,7 +1208,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, | ||
1616 | * Use the access and other non-mapping-related flag bits from | ||
1617 | * the compatible memory placement flags to the active flags | ||
1618 | */ | ||
1619 | - ttm_flag_masked(&bo->mem.placement, placement->placement[ret], | ||
1620 | + ttm_flag_masked(&bo->mem.placement, new_flags, | ||
1621 | ~TTM_PL_MASK_MEMTYPE); | ||
1622 | } | ||
1623 | /* | ||
1624 | diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c | ||
1625 | index af894584..b7f75715 100644 | ||
1626 | --- a/drivers/gpu/drm/ttm/ttm_bo_util.c | ||
1627 | +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c | ||
1628 | @@ -342,19 +342,25 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, | ||
1629 | if (ret) | ||
1630 | goto out; | ||
1631 | |||
1632 | + /* | ||
1633 | + * Single TTM move. NOP. | ||
1634 | + */ | ||
1635 | if (old_iomap == NULL && new_iomap == NULL) | ||
1636 | goto out2; | ||
1637 | + | ||
1638 | + /* | ||
1639 | + * Move nonexistent data. NOP. | ||
1640 | + */ | ||
1641 | if (old_iomap == NULL && ttm == NULL) | ||
1642 | goto out2; | ||
1643 | |||
1644 | - if (ttm->state == tt_unpopulated) { | ||
1645 | + /* | ||
1646 | + * TTM might be null for moves within the same region. | ||
1647 | + */ | ||
1648 | + if (ttm && ttm->state == tt_unpopulated) { | ||
1649 | ret = ttm->bdev->driver->ttm_tt_populate(ttm); | ||
1650 | - if (ret) { | ||
1651 | - /* if we fail here don't nuke the mm node | ||
1652 | - * as the bo still owns it */ | ||
1653 | - old_copy.mm_node = NULL; | ||
1654 | + if (ret) | ||
1655 | goto out1; | ||
1656 | - } | ||
1657 | } | ||
1658 | |||
1659 | add = 0; | ||
1660 | @@ -380,11 +386,8 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, | ||
1661 | prot); | ||
1662 | } else | ||
1663 | ret = ttm_copy_io_page(new_iomap, old_iomap, page); | ||
1664 | - if (ret) { | ||
1665 | - /* failing here, means keep old copy as-is */ | ||
1666 | - old_copy.mm_node = NULL; | ||
1667 | + if (ret) | ||
1668 | goto out1; | ||
1669 | - } | ||
1670 | } | ||
1671 | mb(); | ||
1672 | out2: | ||
1673 | @@ -402,7 +405,12 @@ out1: | ||
1674 | ttm_mem_reg_iounmap(bdev, old_mem, new_iomap); | ||
1675 | out: | ||
1676 | ttm_mem_reg_iounmap(bdev, &old_copy, old_iomap); | ||
1677 | - ttm_bo_mem_put(bo, &old_copy); | ||
1678 | + | ||
1679 | + /* | ||
1680 | + * On error, keep the mm node! | ||
1681 | + */ | ||
1682 | + if (!ret) | ||
1683 | + ttm_bo_mem_put(bo, &old_copy); | ||
1684 | return ret; | ||
1685 | } | ||
1686 | EXPORT_SYMBOL(ttm_bo_move_memcpy); | ||
1687 | diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig | ||
1688 | index fb52f3f6..bee88ee8 100644 | ||
1689 | --- a/drivers/hid/Kconfig | ||
1690 | +++ b/drivers/hid/Kconfig | ||
1691 | @@ -352,12 +352,14 @@ config LOGITECH_FF | ||
1692 | force feedback. | ||
1693 | |||
1694 | config LOGIRUMBLEPAD2_FF | ||
1695 | - bool "Logitech RumblePad/Rumblepad 2 force feedback support" | ||
1696 | + bool "Logitech force feedback support (variant 2)" | ||
1697 | depends on HID_LOGITECH | ||
1698 | select INPUT_FF_MEMLESS | ||
1699 | help | ||
1700 | - Say Y here if you want to enable force feedback support for Logitech | ||
1701 | - RumblePad and Rumblepad 2 devices. | ||
1702 | + Say Y here if you want to enable force feedback support for: | ||
1703 | + - Logitech RumblePad | ||
1704 | + - Logitech Rumblepad 2 | ||
1705 | + - Logitech Formula Vibration Feedback Wheel | ||
1706 | |||
1707 | config LOGIG940_FF | ||
1708 | bool "Logitech Flight System G940 force feedback support" | ||
1709 | @@ -436,9 +438,11 @@ config HID_MULTITOUCH | ||
1710 | - Pixcir dual touch panels | ||
1711 | - Quanta panels | ||
1712 | - eGalax dual-touch panels, including the Joojoo and Wetab tablets | ||
1713 | + - SiS multitouch panels | ||
1714 | - Stantum multitouch panels | ||
1715 | - Touch International Panels | ||
1716 | - Unitec Panels | ||
1717 | + - Wistron optical touch panels | ||
1718 | - XAT optical touch panels | ||
1719 | - Xiroku optical touch panels | ||
1720 | - Zytronic touch panels | ||
1721 | diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c | ||
1722 | index c7710b5c..d54e1d0a 100644 | ||
1723 | --- a/drivers/hid/hid-apple.c | ||
1724 | +++ b/drivers/hid/hid-apple.c | ||
1725 | @@ -46,6 +46,12 @@ module_param(iso_layout, uint, 0644); | ||
1726 | MODULE_PARM_DESC(iso_layout, "Enable/Disable hardcoded ISO-layout of the keyboard. " | ||
1727 | "(0 = disabled, [1] = enabled)"); | ||
1728 | |||
1729 | +static unsigned int swap_opt_cmd = 0; | ||
1730 | +module_param(swap_opt_cmd, uint, 0644); | ||
1731 | +MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\") keys. " | ||
1732 | + "(For people who want to keep Windows PC keyboard muscle memory. " | ||
1733 | + "[0] = as-is, Mac layout. 1 = swapped, Windows layout.)"); | ||
1734 | + | ||
1735 | struct apple_sc { | ||
1736 | unsigned long quirks; | ||
1737 | unsigned int fn_on; | ||
1738 | @@ -150,6 +156,14 @@ static const struct apple_key_translation apple_iso_keyboard[] = { | ||
1739 | { } | ||
1740 | }; | ||
1741 | |||
1742 | +static const struct apple_key_translation swapped_option_cmd_keys[] = { | ||
1743 | + { KEY_LEFTALT, KEY_LEFTMETA }, | ||
1744 | + { KEY_LEFTMETA, KEY_LEFTALT }, | ||
1745 | + { KEY_RIGHTALT, KEY_RIGHTMETA }, | ||
1746 | + { KEY_RIGHTMETA,KEY_RIGHTALT }, | ||
1747 | + { } | ||
1748 | +}; | ||
1749 | + | ||
1750 | static const struct apple_key_translation *apple_find_translation( | ||
1751 | const struct apple_key_translation *table, u16 from) | ||
1752 | { | ||
1753 | @@ -242,6 +256,14 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | ||
1754 | } | ||
1755 | } | ||
1756 | |||
1757 | + if (swap_opt_cmd) { | ||
1758 | + trans = apple_find_translation(swapped_option_cmd_keys, usage->code); | ||
1759 | + if (trans) { | ||
1760 | + input_event(input, usage->type, trans->to, value); | ||
1761 | + return 1; | ||
1762 | + } | ||
1763 | + } | ||
1764 | + | ||
1765 | return 0; | ||
1766 | } | ||
1767 | |||
1768 | diff --git a/drivers/hid/hid-axff.c b/drivers/hid/hid-axff.c | ||
1769 | index 64ab94a5..a594e478 100644 | ||
1770 | --- a/drivers/hid/hid-axff.c | ||
1771 | +++ b/drivers/hid/hid-axff.c | ||
1772 | @@ -95,7 +95,7 @@ static int axff_init(struct hid_device *hid) | ||
1773 | } | ||
1774 | } | ||
1775 | |||
1776 | - if (field_count < 4) { | ||
1777 | + if (field_count < 4 && hid->product != 0xf705) { | ||
1778 | hid_err(hid, "not enough fields in the report: %d\n", | ||
1779 | field_count); | ||
1780 | return -ENODEV; | ||
1781 | @@ -180,6 +180,7 @@ static void ax_remove(struct hid_device *hdev) | ||
1782 | |||
1783 | static const struct hid_device_id ax_devices[] = { | ||
1784 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802), }, | ||
1785 | + { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0xf705), }, | ||
1786 | { } | ||
1787 | }; | ||
1788 | MODULE_DEVICE_TABLE(hid, ax_devices); | ||
1789 | diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c | ||
1790 | index e04bf0ef..c4e5cdfa 100644 | ||
1791 | --- a/drivers/hid/hid-core.c | ||
1792 | +++ b/drivers/hid/hid-core.c | ||
1793 | @@ -1562,6 +1562,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | ||
1794 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, | ||
1795 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, | ||
1796 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, | ||
1797 | + { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0xf705) }, | ||
1798 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, | ||
1799 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, | ||
1800 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, | ||
1801 | @@ -1703,6 +1704,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | ||
1802 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940) }, | ||
1803 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, | ||
1804 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, | ||
1805 | + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL) }, | ||
1806 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL) }, | ||
1807 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) }, | ||
1808 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, | ||
1809 | @@ -1750,12 +1752,14 @@ static const struct hid_device_id hid_have_special_driver[] = { | ||
1810 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, | ||
1811 | { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, | ||
1812 | #if IS_ENABLED(CONFIG_HID_ROCCAT) | ||
1813 | - { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, | ||
1814 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, | ||
1815 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, | ||
1816 | + { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKUFX) }, | ||
1817 | + { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, | ||
1818 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, | ||
1819 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE) }, | ||
1820 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE_OPTICAL) }, | ||
1821 | + { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEXTD) }, | ||
1822 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, | ||
1823 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_LUA) }, | ||
1824 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, | ||
1825 | @@ -1765,6 +1769,8 @@ static const struct hid_device_id hid_have_special_driver[] = { | ||
1826 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, | ||
1827 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, | ||
1828 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, | ||
1829 | + { HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH) }, | ||
1830 | + { HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS817_TOUCH) }, | ||
1831 | { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, | ||
1832 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_BDREMOTE) }, | ||
1833 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | ||
1834 | @@ -2317,15 +2323,6 @@ bool hid_ignore(struct hid_device *hdev) | ||
1835 | hdev->type == HID_TYPE_USBNONE) | ||
1836 | return true; | ||
1837 | break; | ||
1838 | - case USB_VENDOR_ID_DWAV: | ||
1839 | - /* These are handled by usbtouchscreen. hdev->type is probably | ||
1840 | - * HID_TYPE_USBNONE, but we say !HID_TYPE_USBMOUSE to match | ||
1841 | - * usbtouchscreen. */ | ||
1842 | - if ((hdev->product == USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER || | ||
1843 | - hdev->product == USB_DEVICE_ID_DWAV_TOUCHCONTROLLER) && | ||
1844 | - hdev->type != HID_TYPE_USBMOUSE) | ||
1845 | - return true; | ||
1846 | - break; | ||
1847 | case USB_VENDOR_ID_VELLEMAN: | ||
1848 | /* These are not HID devices. They are handled by comedi. */ | ||
1849 | if ((hdev->product >= USB_DEVICE_ID_VELLEMAN_K8055_FIRST && | ||
1850 | diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h | ||
1851 | index 114fd166..799dbec2 100644 | ||
1852 | --- a/drivers/hid/hid-ids.h | ||
1853 | +++ b/drivers/hid/hid-ids.h | ||
1854 | @@ -330,6 +330,11 @@ | ||
1855 | #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc | ||
1856 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS 0x0003 | ||
1857 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS 0x0100 | ||
1858 | +#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0101 0x0101 | ||
1859 | +#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0102 0x0102 | ||
1860 | +#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0106 0x0106 | ||
1861 | +#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A 0x010a | ||
1862 | +#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100 | ||
1863 | |||
1864 | #define USB_VENDOR_ID_GLAB 0x06c2 | ||
1865 | #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 | ||
1866 | @@ -557,6 +562,7 @@ | ||
1867 | #define USB_DEVICE_ID_DINOVO_EDGE 0xc714 | ||
1868 | #define USB_DEVICE_ID_DINOVO_MINI 0xc71f | ||
1869 | #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2 0xca03 | ||
1870 | +#define USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL 0xca04 | ||
1871 | |||
1872 | #define USB_VENDOR_ID_LUMIO 0x202e | ||
1873 | #define USB_DEVICE_ID_CRYSTALTOUCH 0x0006 | ||
1874 | @@ -730,6 +736,10 @@ | ||
1875 | #define USB_VENDOR_ID_SIGMATEL 0x066F | ||
1876 | #define USB_DEVICE_ID_SIGMATEL_STMP3780 0x3780 | ||
1877 | |||
1878 | +#define USB_VENDOR_ID_SIS2_TOUCH 0x0457 | ||
1879 | +#define USB_DEVICE_ID_SIS9200_TOUCH 0x9200 | ||
1880 | +#define USB_DEVICE_ID_SIS817_TOUCH 0x0817 | ||
1881 | + | ||
1882 | #define USB_VENDOR_ID_SKYCABLE 0x1223 | ||
1883 | #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07 | ||
1884 | |||
1885 | @@ -869,6 +879,9 @@ | ||
1886 | #define USB_DEVICE_ID_SUPER_DUAL_BOX_PRO 0x8802 | ||
1887 | #define USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO 0x8804 | ||
1888 | |||
1889 | +#define USB_VENDOR_ID_WISTRON 0x0fb8 | ||
1890 | +#define USB_DEVICE_ID_WISTRON_OPTICAL_TOUCH 0x1109 | ||
1891 | + | ||
1892 | #define USB_VENDOR_ID_X_TENSIONS 0x1ae7 | ||
1893 | #define USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE 0x9001 | ||
1894 | |||
1895 | diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c | ||
1896 | index 6f12ecd3..1bfd292c 100644 | ||
1897 | --- a/drivers/hid/hid-lg.c | ||
1898 | +++ b/drivers/hid/hid-lg.c | ||
1899 | @@ -45,6 +45,7 @@ | ||
1900 | /* Size of the original descriptors of the Driving Force (and Pro) wheels */ | ||
1901 | #define DF_RDESC_ORIG_SIZE 130 | ||
1902 | #define DFP_RDESC_ORIG_SIZE 97 | ||
1903 | +#define FV_RDESC_ORIG_SIZE 130 | ||
1904 | #define MOMO_RDESC_ORIG_SIZE 87 | ||
1905 | |||
1906 | /* Fixed report descriptors for Logitech Driving Force (and Pro) | ||
1907 | @@ -170,6 +171,73 @@ static __u8 dfp_rdesc_fixed[] = { | ||
1908 | 0xC0 /* End Collection */ | ||
1909 | }; | ||
1910 | |||
1911 | +static __u8 fv_rdesc_fixed[] = { | ||
1912 | +0x05, 0x01, /* Usage Page (Desktop), */ | ||
1913 | +0x09, 0x04, /* Usage (Joystik), */ | ||
1914 | +0xA1, 0x01, /* Collection (Application), */ | ||
1915 | +0xA1, 0x02, /* Collection (Logical), */ | ||
1916 | +0x95, 0x01, /* Report Count (1), */ | ||
1917 | +0x75, 0x0A, /* Report Size (10), */ | ||
1918 | +0x15, 0x00, /* Logical Minimum (0), */ | ||
1919 | +0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ | ||
1920 | +0x35, 0x00, /* Physical Minimum (0), */ | ||
1921 | +0x46, 0xFF, 0x03, /* Physical Maximum (1023), */ | ||
1922 | +0x09, 0x30, /* Usage (X), */ | ||
1923 | +0x81, 0x02, /* Input (Variable), */ | ||
1924 | +0x95, 0x0C, /* Report Count (12), */ | ||
1925 | +0x75, 0x01, /* Report Size (1), */ | ||
1926 | +0x25, 0x01, /* Logical Maximum (1), */ | ||
1927 | +0x45, 0x01, /* Physical Maximum (1), */ | ||
1928 | +0x05, 0x09, /* Usage Page (Button), */ | ||
1929 | +0x19, 0x01, /* Usage Minimum (01h), */ | ||
1930 | +0x29, 0x0C, /* Usage Maximum (0Ch), */ | ||
1931 | +0x81, 0x02, /* Input (Variable), */ | ||
1932 | +0x95, 0x02, /* Report Count (2), */ | ||
1933 | +0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ | ||
1934 | +0x09, 0x01, /* Usage (01h), */ | ||
1935 | +0x81, 0x02, /* Input (Variable), */ | ||
1936 | +0x09, 0x02, /* Usage (02h), */ | ||
1937 | +0x26, 0xFF, 0x00, /* Logical Maximum (255), */ | ||
1938 | +0x46, 0xFF, 0x00, /* Physical Maximum (255), */ | ||
1939 | +0x95, 0x01, /* Report Count (1), */ | ||
1940 | +0x75, 0x08, /* Report Size (8), */ | ||
1941 | +0x81, 0x02, /* Input (Variable), */ | ||
1942 | +0x05, 0x01, /* Usage Page (Desktop), */ | ||
1943 | +0x25, 0x07, /* Logical Maximum (7), */ | ||
1944 | +0x46, 0x3B, 0x01, /* Physical Maximum (315), */ | ||
1945 | +0x75, 0x04, /* Report Size (4), */ | ||
1946 | +0x65, 0x14, /* Unit (Degrees), */ | ||
1947 | +0x09, 0x39, /* Usage (Hat Switch), */ | ||
1948 | +0x81, 0x42, /* Input (Variable, Null State), */ | ||
1949 | +0x75, 0x01, /* Report Size (1), */ | ||
1950 | +0x95, 0x04, /* Report Count (4), */ | ||
1951 | +0x65, 0x00, /* Unit, */ | ||
1952 | +0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ | ||
1953 | +0x09, 0x01, /* Usage (01h), */ | ||
1954 | +0x25, 0x01, /* Logical Maximum (1), */ | ||
1955 | +0x45, 0x01, /* Physical Maximum (1), */ | ||
1956 | +0x81, 0x02, /* Input (Variable), */ | ||
1957 | +0x05, 0x01, /* Usage Page (Desktop), */ | ||
1958 | +0x95, 0x01, /* Report Count (1), */ | ||
1959 | +0x75, 0x08, /* Report Size (8), */ | ||
1960 | +0x26, 0xFF, 0x00, /* Logical Maximum (255), */ | ||
1961 | +0x46, 0xFF, 0x00, /* Physical Maximum (255), */ | ||
1962 | +0x09, 0x31, /* Usage (Y), */ | ||
1963 | +0x81, 0x02, /* Input (Variable), */ | ||
1964 | +0x09, 0x32, /* Usage (Z), */ | ||
1965 | +0x81, 0x02, /* Input (Variable), */ | ||
1966 | +0xC0, /* End Collection, */ | ||
1967 | +0xA1, 0x02, /* Collection (Logical), */ | ||
1968 | +0x26, 0xFF, 0x00, /* Logical Maximum (255), */ | ||
1969 | +0x46, 0xFF, 0x00, /* Physical Maximum (255), */ | ||
1970 | +0x95, 0x07, /* Report Count (7), */ | ||
1971 | +0x75, 0x08, /* Report Size (8), */ | ||
1972 | +0x09, 0x03, /* Usage (03h), */ | ||
1973 | +0x91, 0x02, /* Output (Variable), */ | ||
1974 | +0xC0, /* End Collection, */ | ||
1975 | +0xC0 /* End Collection */ | ||
1976 | +}; | ||
1977 | + | ||
1978 | static __u8 momo_rdesc_fixed[] = { | ||
1979 | 0x05, 0x01, /* Usage Page (Desktop), */ | ||
1980 | 0x09, 0x04, /* Usage (Joystik), */ | ||
1981 | @@ -275,6 +343,15 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
1982 | } | ||
1983 | break; | ||
1984 | |||
1985 | + case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL: | ||
1986 | + if (*rsize == FV_RDESC_ORIG_SIZE) { | ||
1987 | + hid_info(hdev, | ||
1988 | + "fixing up Logitech Formula Vibration report descriptor\n"); | ||
1989 | + rdesc = fv_rdesc_fixed; | ||
1990 | + *rsize = sizeof(fv_rdesc_fixed); | ||
1991 | + } | ||
1992 | + break; | ||
1993 | + | ||
1994 | case USB_DEVICE_ID_LOGITECH_DFP_WHEEL: | ||
1995 | if (*rsize == DFP_RDESC_ORIG_SIZE) { | ||
1996 | hid_info(hdev, | ||
1997 | @@ -492,6 +569,7 @@ static int lg_input_mapped(struct hid_device *hdev, struct hid_input *hi, | ||
1998 | case USB_DEVICE_ID_LOGITECH_G27_WHEEL: | ||
1999 | case USB_DEVICE_ID_LOGITECH_WII_WHEEL: | ||
2000 | case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2: | ||
2001 | + case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL: | ||
2002 | field->application = HID_GD_MULTIAXIS; | ||
2003 | break; | ||
2004 | default: | ||
2005 | @@ -639,6 +717,8 @@ static const struct hid_device_id lg_devices[] = { | ||
2006 | .driver_data = LG_NOGET | LG_FF4 }, | ||
2007 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2), | ||
2008 | .driver_data = LG_FF4 }, | ||
2009 | + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL), | ||
2010 | + .driver_data = LG_FF2 }, | ||
2011 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL), | ||
2012 | .driver_data = LG_FF4 }, | ||
2013 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL), | ||
2014 | diff --git a/drivers/hid/hid-lg2ff.c b/drivers/hid/hid-lg2ff.c | ||
2015 | index 1a42eaa6..0e3fb1a7 100644 | ||
2016 | --- a/drivers/hid/hid-lg2ff.c | ||
2017 | +++ b/drivers/hid/hid-lg2ff.c | ||
2018 | @@ -95,7 +95,7 @@ int lg2ff_init(struct hid_device *hid) | ||
2019 | |||
2020 | hid_hw_request(hid, report, HID_REQ_SET_REPORT); | ||
2021 | |||
2022 | - hid_info(hid, "Force feedback for Logitech RumblePad/Rumblepad 2 by Anssi Hannula <anssi.hannula@gmail.com>\n"); | ||
2023 | + hid_info(hid, "Force feedback for Logitech variant 2 rumble devices by Anssi Hannula <anssi.hannula@gmail.com>\n"); | ||
2024 | |||
2025 | return 0; | ||
2026 | } | ||
2027 | diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c | ||
2028 | index 8782fe1a..35180536 100644 | ||
2029 | --- a/drivers/hid/hid-lg4ff.c | ||
2030 | +++ b/drivers/hid/hid-lg4ff.c | ||
2031 | @@ -218,12 +218,46 @@ static void hid_lg4ff_set_autocenter_default(struct input_dev *dev, u16 magnitud | ||
2032 | struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; | ||
2033 | struct hid_report *report = list_entry(report_list->next, struct hid_report, list); | ||
2034 | __s32 *value = report->field[0]->value; | ||
2035 | + __u32 expand_a, expand_b; | ||
2036 | + | ||
2037 | + /* De-activate Auto-Center */ | ||
2038 | + if (magnitude == 0) { | ||
2039 | + value[0] = 0xf5; | ||
2040 | + value[1] = 0x00; | ||
2041 | + value[2] = 0x00; | ||
2042 | + value[3] = 0x00; | ||
2043 | + value[4] = 0x00; | ||
2044 | + value[5] = 0x00; | ||
2045 | + value[6] = 0x00; | ||
2046 | + | ||
2047 | + hid_hw_request(hid, report, HID_REQ_SET_REPORT); | ||
2048 | + return; | ||
2049 | + } | ||
2050 | + | ||
2051 | + if (magnitude <= 0xaaaa) { | ||
2052 | + expand_a = 0x0c * magnitude; | ||
2053 | + expand_b = 0x80 * magnitude; | ||
2054 | + } else { | ||
2055 | + expand_a = (0x0c * 0xaaaa) + 0x06 * (magnitude - 0xaaaa); | ||
2056 | + expand_b = (0x80 * 0xaaaa) + 0xff * (magnitude - 0xaaaa); | ||
2057 | + } | ||
2058 | |||
2059 | value[0] = 0xfe; | ||
2060 | value[1] = 0x0d; | ||
2061 | - value[2] = magnitude >> 13; | ||
2062 | - value[3] = magnitude >> 13; | ||
2063 | - value[4] = magnitude >> 8; | ||
2064 | + value[2] = expand_a / 0xaaaa; | ||
2065 | + value[3] = expand_a / 0xaaaa; | ||
2066 | + value[4] = expand_b / 0xaaaa; | ||
2067 | + value[5] = 0x00; | ||
2068 | + value[6] = 0x00; | ||
2069 | + | ||
2070 | + hid_hw_request(hid, report, HID_REQ_SET_REPORT); | ||
2071 | + | ||
2072 | + /* Activate Auto-Center */ | ||
2073 | + value[0] = 0x14; | ||
2074 | + value[1] = 0x00; | ||
2075 | + value[2] = 0x00; | ||
2076 | + value[3] = 0x00; | ||
2077 | + value[4] = 0x00; | ||
2078 | value[5] = 0x00; | ||
2079 | value[6] = 0x00; | ||
2080 | |||
2081 | @@ -540,17 +574,6 @@ int lg4ff_init(struct hid_device *hid) | ||
2082 | if (error) | ||
2083 | return error; | ||
2084 | |||
2085 | - /* Check if autocentering is available and | ||
2086 | - * set the centering force to zero by default */ | ||
2087 | - if (test_bit(FF_AUTOCENTER, dev->ffbit)) { | ||
2088 | - if (rev_maj == FFEX_REV_MAJ && rev_min == FFEX_REV_MIN) /* Formula Force EX expects different autocentering command */ | ||
2089 | - dev->ff->set_autocenter = hid_lg4ff_set_autocenter_ffex; | ||
2090 | - else | ||
2091 | - dev->ff->set_autocenter = hid_lg4ff_set_autocenter_default; | ||
2092 | - | ||
2093 | - dev->ff->set_autocenter(dev, 0); | ||
2094 | - } | ||
2095 | - | ||
2096 | /* Get private driver data */ | ||
2097 | drv_data = hid_get_drvdata(hid); | ||
2098 | if (!drv_data) { | ||
2099 | @@ -571,6 +594,17 @@ int lg4ff_init(struct hid_device *hid) | ||
2100 | entry->max_range = lg4ff_devices[i].max_range; | ||
2101 | entry->set_range = lg4ff_devices[i].set_range; | ||
2102 | |||
2103 | + /* Check if autocentering is available and | ||
2104 | + * set the centering force to zero by default */ | ||
2105 | + if (test_bit(FF_AUTOCENTER, dev->ffbit)) { | ||
2106 | + if (rev_maj == FFEX_REV_MAJ && rev_min == FFEX_REV_MIN) /* Formula Force EX expects different autocentering command */ | ||
2107 | + dev->ff->set_autocenter = hid_lg4ff_set_autocenter_ffex; | ||
2108 | + else | ||
2109 | + dev->ff->set_autocenter = hid_lg4ff_set_autocenter_default; | ||
2110 | + | ||
2111 | + dev->ff->set_autocenter(dev, 0); | ||
2112 | + } | ||
2113 | + | ||
2114 | /* Create sysfs interface */ | ||
2115 | error = device_create_file(&hid->dev, &dev_attr_range); | ||
2116 | if (error) | ||
2117 | diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c | ||
2118 | index b6701cec..3d8e58ac 100644 | ||
2119 | --- a/drivers/hid/hid-multitouch.c | ||
2120 | +++ b/drivers/hid/hid-multitouch.c | ||
2121 | @@ -244,12 +244,12 @@ static struct mt_class mt_classes[] = { | ||
2122 | { .name = MT_CLS_GENERALTOUCH_TWOFINGERS, | ||
2123 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | | ||
2124 | MT_QUIRK_VALID_IS_INRANGE | | ||
2125 | - MT_QUIRK_SLOT_IS_CONTACTNUMBER, | ||
2126 | + MT_QUIRK_SLOT_IS_CONTACTID, | ||
2127 | .maxcontacts = 2 | ||
2128 | }, | ||
2129 | { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, | ||
2130 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | | ||
2131 | - MT_QUIRK_SLOT_IS_CONTACTNUMBER | ||
2132 | + MT_QUIRK_SLOT_IS_CONTACTID | ||
2133 | }, | ||
2134 | |||
2135 | { .name = MT_CLS_FLATFROG, | ||
2136 | @@ -1191,6 +1191,21 @@ static const struct hid_device_id mt_devices[] = { | ||
2137 | { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, | ||
2138 | MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, | ||
2139 | USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS) }, | ||
2140 | + { .driver_data = MT_CLS_GENERALTOUCH_TWOFINGERS, | ||
2141 | + MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, | ||
2142 | + USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0101) }, | ||
2143 | + { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, | ||
2144 | + MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, | ||
2145 | + USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0102) }, | ||
2146 | + { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, | ||
2147 | + MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, | ||
2148 | + USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0106) }, | ||
2149 | + { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, | ||
2150 | + MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, | ||
2151 | + USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A) }, | ||
2152 | + { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, | ||
2153 | + MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, | ||
2154 | + USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100) }, | ||
2155 | |||
2156 | /* Gametel game controller */ | ||
2157 | { .driver_data = MT_CLS_NSMU, | ||
2158 | @@ -1302,6 +1317,14 @@ static const struct hid_device_id mt_devices[] = { | ||
2159 | MT_USB_DEVICE(USB_VENDOR_ID_QUANTA, | ||
2160 | USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) }, | ||
2161 | |||
2162 | + /* SiS panels */ | ||
2163 | + { .driver_data = MT_CLS_DEFAULT, | ||
2164 | + HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH, | ||
2165 | + USB_DEVICE_ID_SIS9200_TOUCH) }, | ||
2166 | + { .driver_data = MT_CLS_DEFAULT, | ||
2167 | + HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH, | ||
2168 | + USB_DEVICE_ID_SIS817_TOUCH) }, | ||
2169 | + | ||
2170 | /* Stantum panels */ | ||
2171 | { .driver_data = MT_CLS_CONFIDENCE, | ||
2172 | MT_USB_DEVICE(USB_VENDOR_ID_STANTUM, | ||
2173 | @@ -1330,6 +1353,12 @@ static const struct hid_device_id mt_devices[] = { | ||
2174 | { .driver_data = MT_CLS_NSMU, | ||
2175 | MT_USB_DEVICE(USB_VENDOR_ID_UNITEC, | ||
2176 | USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) }, | ||
2177 | + | ||
2178 | + /* Wistron panels */ | ||
2179 | + { .driver_data = MT_CLS_NSMU, | ||
2180 | + MT_USB_DEVICE(USB_VENDOR_ID_WISTRON, | ||
2181 | + USB_DEVICE_ID_WISTRON_OPTICAL_TOUCH) }, | ||
2182 | + | ||
2183 | /* XAT */ | ||
2184 | { .driver_data = MT_CLS_NSMU, | ||
2185 | MT_USB_DEVICE(USB_VENDOR_ID_XAT, | ||
2186 | diff --git a/drivers/hid/hid-roccat-common.c b/drivers/hid/hid-roccat-common.c | ||
2187 | index 74f70403..e8408999 100644 | ||
2188 | --- a/drivers/hid/hid-roccat-common.c | ||
2189 | +++ b/drivers/hid/hid-roccat-common.c | ||
2190 | @@ -65,10 +65,11 @@ int roccat_common2_send(struct usb_device *usb_dev, uint report_id, | ||
2191 | EXPORT_SYMBOL_GPL(roccat_common2_send); | ||
2192 | |||
2193 | enum roccat_common2_control_states { | ||
2194 | - ROCCAT_COMMON_CONTROL_STATUS_OVERLOAD = 0, | ||
2195 | + ROCCAT_COMMON_CONTROL_STATUS_CRITICAL = 0, | ||
2196 | ROCCAT_COMMON_CONTROL_STATUS_OK = 1, | ||
2197 | ROCCAT_COMMON_CONTROL_STATUS_INVALID = 2, | ||
2198 | - ROCCAT_COMMON_CONTROL_STATUS_WAIT = 3, | ||
2199 | + ROCCAT_COMMON_CONTROL_STATUS_BUSY = 3, | ||
2200 | + ROCCAT_COMMON_CONTROL_STATUS_CRITICAL_NEW = 4, | ||
2201 | }; | ||
2202 | |||
2203 | static int roccat_common2_receive_control_status(struct usb_device *usb_dev) | ||
2204 | @@ -88,13 +89,12 @@ static int roccat_common2_receive_control_status(struct usb_device *usb_dev) | ||
2205 | switch (control.value) { | ||
2206 | case ROCCAT_COMMON_CONTROL_STATUS_OK: | ||
2207 | return 0; | ||
2208 | - case ROCCAT_COMMON_CONTROL_STATUS_WAIT: | ||
2209 | + case ROCCAT_COMMON_CONTROL_STATUS_BUSY: | ||
2210 | msleep(500); | ||
2211 | continue; | ||
2212 | case ROCCAT_COMMON_CONTROL_STATUS_INVALID: | ||
2213 | - | ||
2214 | - case ROCCAT_COMMON_CONTROL_STATUS_OVERLOAD: | ||
2215 | - /* seems to be critical - replug necessary */ | ||
2216 | + case ROCCAT_COMMON_CONTROL_STATUS_CRITICAL: | ||
2217 | + case ROCCAT_COMMON_CONTROL_STATUS_CRITICAL_NEW: | ||
2218 | return -EINVAL; | ||
2219 | default: | ||
2220 | dev_err(&usb_dev->dev, | ||
2221 | diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c | ||
2222 | index b8b37789..2c571dad 100644 | ||
2223 | --- a/drivers/hid/hid-roccat-kovaplus.c | ||
2224 | +++ b/drivers/hid/hid-roccat-kovaplus.c | ||
2225 | @@ -577,9 +577,13 @@ static void kovaplus_keep_values_up_to_date(struct kovaplus_device *kovaplus, | ||
2226 | break; | ||
2227 | case KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI: | ||
2228 | kovaplus->actual_cpi = kovaplus_convert_event_cpi(button_report->data1); | ||
2229 | + break; | ||
2230 | case KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY: | ||
2231 | kovaplus->actual_x_sensitivity = button_report->data1; | ||
2232 | kovaplus->actual_y_sensitivity = button_report->data2; | ||
2233 | + break; | ||
2234 | + default: | ||
2235 | + break; | ||
2236 | } | ||
2237 | } | ||
2238 | |||
2239 | diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c | ||
2240 | index aa34755c..b189feb6 100644 | ||
2241 | --- a/drivers/hid/hid-sensor-hub.c | ||
2242 | +++ b/drivers/hid/hid-sensor-hub.c | ||
2243 | @@ -327,7 +327,8 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, | ||
2244 | field->logical == attr_usage_id) { | ||
2245 | sensor_hub_fill_attr_info(info, i, report->id, | ||
2246 | field->unit, field->unit_exponent, | ||
2247 | - field->report_size); | ||
2248 | + field->report_size * | ||
2249 | + field->report_count); | ||
2250 | ret = 0; | ||
2251 | } else { | ||
2252 | for (j = 0; j < field->maxusage; ++j) { | ||
2253 | @@ -339,7 +340,8 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, | ||
2254 | i, report->id, | ||
2255 | field->unit, | ||
2256 | field->unit_exponent, | ||
2257 | - field->report_size); | ||
2258 | + field->report_size * | ||
2259 | + field->report_count); | ||
2260 | ret = 0; | ||
2261 | break; | ||
2262 | } | ||
2263 | @@ -426,9 +428,10 @@ static int sensor_hub_raw_event(struct hid_device *hdev, | ||
2264 | hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n", | ||
2265 | i, report->field[i]->usage->collection_index, | ||
2266 | report->field[i]->usage->hid, | ||
2267 | - report->field[i]->report_size/8); | ||
2268 | - | ||
2269 | - sz = report->field[i]->report_size/8; | ||
2270 | + (report->field[i]->report_size * | ||
2271 | + report->field[i]->report_count)/8); | ||
2272 | + sz = (report->field[i]->report_size * | ||
2273 | + report->field[i]->report_count)/8; | ||
2274 | if (pdata->pending.status && pdata->pending.attr_usage_id == | ||
2275 | report->field[i]->usage->hid) { | ||
2276 | hid_dbg(hdev, "data was pending ...\n"); | ||
2277 | diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c | ||
2278 | index 145a4cb5..0bb3bb88 100644 | ||
2279 | --- a/drivers/hid/uhid.c | ||
2280 | +++ b/drivers/hid/uhid.c | ||
2281 | @@ -312,7 +312,7 @@ static int uhid_event_from_user(const char __user *buffer, size_t len, | ||
2282 | */ | ||
2283 | struct uhid_create_req_compat *compat; | ||
2284 | |||
2285 | - compat = kmalloc(sizeof(*compat), GFP_KERNEL); | ||
2286 | + compat = kzalloc(sizeof(*compat), GFP_KERNEL); | ||
2287 | if (!compat) | ||
2288 | return -ENOMEM; | ||
2289 | |||
2290 | diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c | ||
2291 | index 07345521..ae5c6347 100644 | ||
2292 | --- a/drivers/hid/usbhid/hid-quirks.c | ||
2293 | +++ b/drivers/hid/usbhid/hid-quirks.c | ||
2294 | @@ -84,6 +84,8 @@ static const struct hid_blacklist { | ||
2295 | { USB_VENDOR_ID_REALTEK, USB_DEVICE_ID_REALTEK_READER, HID_QUIRK_NO_INIT_REPORTS }, | ||
2296 | { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET }, | ||
2297 | { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET }, | ||
2298 | + { USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH, HID_QUIRK_NOGET }, | ||
2299 | + { USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS817_TOUCH, HID_QUIRK_NOGET }, | ||
2300 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, | ||
2301 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, | ||
2302 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, | ||
2303 | diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c | ||
2304 | index 5a0ce008..bb4f69f7 100644 | ||
2305 | --- a/drivers/i2c/muxes/i2c-mux-gpio.c | ||
2306 | +++ b/drivers/i2c/muxes/i2c-mux-gpio.c | ||
2307 | @@ -31,15 +31,15 @@ static void i2c_mux_gpio_set(const struct gpiomux *mux, unsigned val) | ||
2308 | int i; | ||
2309 | |||
2310 | for (i = 0; i < mux->data.n_gpios; i++) | ||
2311 | - gpio_set_value(mux->gpio_base + mux->data.gpios[i], | ||
2312 | - val & (1 << i)); | ||
2313 | + gpio_set_value_cansleep(mux->gpio_base + mux->data.gpios[i], | ||
2314 | + val & (1 << i)); | ||
2315 | } | ||
2316 | |||
2317 | static int i2c_mux_gpio_select(struct i2c_adapter *adap, void *data, u32 chan) | ||
2318 | { | ||
2319 | struct gpiomux *mux = data; | ||
2320 | |||
2321 | - i2c_mux_gpio_set(mux, mux->data.values[chan]); | ||
2322 | + i2c_mux_gpio_set(mux, chan); | ||
2323 | |||
2324 | return 0; | ||
2325 | } | ||
2326 | @@ -223,7 +223,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev) | ||
2327 | unsigned int class = mux->data.classes ? mux->data.classes[i] : 0; | ||
2328 | |||
2329 | mux->adap[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, nr, | ||
2330 | - i, class, | ||
2331 | + mux->data.values[i], class, | ||
2332 | i2c_mux_gpio_select, deselect); | ||
2333 | if (!mux->adap[i]) { | ||
2334 | ret = -ENODEV; | ||
2335 | diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c | ||
2336 | index 7229645b..7c9a1d97 100644 | ||
2337 | --- a/drivers/iio/accel/kxsd9.c | ||
2338 | +++ b/drivers/iio/accel/kxsd9.c | ||
2339 | @@ -112,9 +112,10 @@ static int kxsd9_read(struct iio_dev *indio_dev, u8 address) | ||
2340 | mutex_lock(&st->buf_lock); | ||
2341 | st->tx[0] = KXSD9_READ(address); | ||
2342 | ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers)); | ||
2343 | - if (ret) | ||
2344 | - return ret; | ||
2345 | - return (((u16)(st->rx[0])) << 8) | (st->rx[1] & 0xF0); | ||
2346 | + if (!ret) | ||
2347 | + ret = (((u16)(st->rx[0])) << 8) | (st->rx[1] & 0xF0); | ||
2348 | + mutex_unlock(&st->buf_lock); | ||
2349 | + return ret; | ||
2350 | } | ||
2351 | |||
2352 | static IIO_CONST_ATTR(accel_scale_available, | ||
2353 | diff --git a/drivers/infiniband/hw/ipath/ipath_user_sdma.c b/drivers/infiniband/hw/ipath/ipath_user_sdma.c | ||
2354 | index f5cb13b2..cc04b7ba 100644 | ||
2355 | --- a/drivers/infiniband/hw/ipath/ipath_user_sdma.c | ||
2356 | +++ b/drivers/infiniband/hw/ipath/ipath_user_sdma.c | ||
2357 | @@ -280,9 +280,7 @@ static int ipath_user_sdma_pin_pages(const struct ipath_devdata *dd, | ||
2358 | int j; | ||
2359 | int ret; | ||
2360 | |||
2361 | - ret = get_user_pages(current, current->mm, addr, | ||
2362 | - npages, 0, 1, pages, NULL); | ||
2363 | - | ||
2364 | + ret = get_user_pages_fast(addr, npages, 0, pages); | ||
2365 | if (ret != npages) { | ||
2366 | int i; | ||
2367 | |||
2368 | @@ -811,10 +809,7 @@ int ipath_user_sdma_writev(struct ipath_devdata *dd, | ||
2369 | while (dim) { | ||
2370 | const int mxp = 8; | ||
2371 | |||
2372 | - down_write(¤t->mm->mmap_sem); | ||
2373 | ret = ipath_user_sdma_queue_pkts(dd, pq, &list, iov, dim, mxp); | ||
2374 | - up_write(¤t->mm->mmap_sem); | ||
2375 | - | ||
2376 | if (ret <= 0) | ||
2377 | goto done_unlock; | ||
2378 | else { | ||
2379 | diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c | ||
2380 | index 3f6b21e9..bd8cb0f8 100644 | ||
2381 | --- a/drivers/infiniband/hw/qib/qib_iba7322.c | ||
2382 | +++ b/drivers/infiniband/hw/qib/qib_iba7322.c | ||
2383 | @@ -5853,21 +5853,20 @@ static int setup_txselect(const char *str, struct kernel_param *kp) | ||
2384 | { | ||
2385 | struct qib_devdata *dd; | ||
2386 | unsigned long val; | ||
2387 | - int ret; | ||
2388 | - | ||
2389 | + char *n; | ||
2390 | if (strlen(str) >= MAX_ATTEN_LEN) { | ||
2391 | pr_info("txselect_values string too long\n"); | ||
2392 | return -ENOSPC; | ||
2393 | } | ||
2394 | - ret = kstrtoul(str, 0, &val); | ||
2395 | - if (ret || val >= (TXDDS_TABLE_SZ + TXDDS_EXTRA_SZ + | ||
2396 | + val = simple_strtoul(str, &n, 0); | ||
2397 | + if (n == str || val >= (TXDDS_TABLE_SZ + TXDDS_EXTRA_SZ + | ||
2398 | TXDDS_MFG_SZ)) { | ||
2399 | pr_info("txselect_values must start with a number < %d\n", | ||
2400 | TXDDS_TABLE_SZ + TXDDS_EXTRA_SZ + TXDDS_MFG_SZ); | ||
2401 | - return ret ? ret : -EINVAL; | ||
2402 | + return -EINVAL; | ||
2403 | } | ||
2404 | - | ||
2405 | strcpy(txselect_list, str); | ||
2406 | + | ||
2407 | list_for_each_entry(dd, &qib_dev_list, list) | ||
2408 | if (dd->deviceid == PCI_DEVICE_ID_QLOGIC_IB_7322) | ||
2409 | set_no_qsfp_atten(dd, 1); | ||
2410 | diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c | ||
2411 | index 7ccf3284..793ac5dc 100644 | ||
2412 | --- a/drivers/infiniband/ulp/srp/ib_srp.c | ||
2413 | +++ b/drivers/infiniband/ulp/srp/ib_srp.c | ||
2414 | @@ -1300,14 +1300,13 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc) | ||
2415 | PFX "Recv failed with error code %d\n", res); | ||
2416 | } | ||
2417 | |||
2418 | -static void srp_handle_qp_err(enum ib_wc_status wc_status, | ||
2419 | - enum ib_wc_opcode wc_opcode, | ||
2420 | +static void srp_handle_qp_err(enum ib_wc_status wc_status, bool send_err, | ||
2421 | struct srp_target_port *target) | ||
2422 | { | ||
2423 | if (target->connected && !target->qp_in_error) { | ||
2424 | shost_printk(KERN_ERR, target->scsi_host, | ||
2425 | PFX "failed %s status %d\n", | ||
2426 | - wc_opcode & IB_WC_RECV ? "receive" : "send", | ||
2427 | + send_err ? "send" : "receive", | ||
2428 | wc_status); | ||
2429 | } | ||
2430 | target->qp_in_error = true; | ||
2431 | @@ -1323,7 +1322,7 @@ static void srp_recv_completion(struct ib_cq *cq, void *target_ptr) | ||
2432 | if (likely(wc.status == IB_WC_SUCCESS)) { | ||
2433 | srp_handle_recv(target, &wc); | ||
2434 | } else { | ||
2435 | - srp_handle_qp_err(wc.status, wc.opcode, target); | ||
2436 | + srp_handle_qp_err(wc.status, false, target); | ||
2437 | } | ||
2438 | } | ||
2439 | } | ||
2440 | @@ -1339,7 +1338,7 @@ static void srp_send_completion(struct ib_cq *cq, void *target_ptr) | ||
2441 | iu = (struct srp_iu *) (uintptr_t) wc.wr_id; | ||
2442 | list_add(&iu->list, &target->free_tx); | ||
2443 | } else { | ||
2444 | - srp_handle_qp_err(wc.status, wc.opcode, target); | ||
2445 | + srp_handle_qp_err(wc.status, true, target); | ||
2446 | } | ||
2447 | } | ||
2448 | } | ||
2449 | diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c | ||
2450 | index f0f8928b..c122dd2a 100644 | ||
2451 | --- a/drivers/input/evdev.c | ||
2452 | +++ b/drivers/input/evdev.c | ||
2453 | @@ -18,6 +18,8 @@ | ||
2454 | #include <linux/poll.h> | ||
2455 | #include <linux/sched.h> | ||
2456 | #include <linux/slab.h> | ||
2457 | +#include <linux/vmalloc.h> | ||
2458 | +#include <linux/mm.h> | ||
2459 | #include <linux/module.h> | ||
2460 | #include <linux/init.h> | ||
2461 | #include <linux/input/mt.h> | ||
2462 | @@ -289,7 +291,11 @@ static int evdev_release(struct inode *inode, struct file *file) | ||
2463 | mutex_unlock(&evdev->mutex); | ||
2464 | |||
2465 | evdev_detach_client(evdev, client); | ||
2466 | - kfree(client); | ||
2467 | + | ||
2468 | + if (is_vmalloc_addr(client)) | ||
2469 | + vfree(client); | ||
2470 | + else | ||
2471 | + kfree(client); | ||
2472 | |||
2473 | evdev_close_device(evdev); | ||
2474 | |||
2475 | @@ -309,12 +315,14 @@ static int evdev_open(struct inode *inode, struct file *file) | ||
2476 | { | ||
2477 | struct evdev *evdev = container_of(inode->i_cdev, struct evdev, cdev); | ||
2478 | unsigned int bufsize = evdev_compute_buffer_size(evdev->handle.dev); | ||
2479 | + unsigned int size = sizeof(struct evdev_client) + | ||
2480 | + bufsize * sizeof(struct input_event); | ||
2481 | struct evdev_client *client; | ||
2482 | int error; | ||
2483 | |||
2484 | - client = kzalloc(sizeof(struct evdev_client) + | ||
2485 | - bufsize * sizeof(struct input_event), | ||
2486 | - GFP_KERNEL); | ||
2487 | + client = kzalloc(size, GFP_KERNEL | __GFP_NOWARN); | ||
2488 | + if (!client) | ||
2489 | + client = vzalloc(size); | ||
2490 | if (!client) | ||
2491 | return -ENOMEM; | ||
2492 | |||
2493 | diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c | ||
2494 | index f51765ff..888a81a7 100644 | ||
2495 | --- a/drivers/input/mouse/cypress_ps2.c | ||
2496 | +++ b/drivers/input/mouse/cypress_ps2.c | ||
2497 | @@ -439,7 +439,7 @@ static int cypress_get_finger_count(unsigned char header_byte) | ||
2498 | case 2: return 5; | ||
2499 | default: | ||
2500 | /* Invalid contact (e.g. palm). Ignore it. */ | ||
2501 | - return -1; | ||
2502 | + return 0; | ||
2503 | } | ||
2504 | } | ||
2505 | |||
2506 | @@ -452,17 +452,10 @@ static int cypress_parse_packet(struct psmouse *psmouse, | ||
2507 | { | ||
2508 | unsigned char *packet = psmouse->packet; | ||
2509 | unsigned char header_byte = packet[0]; | ||
2510 | - int contact_cnt; | ||
2511 | |||
2512 | memset(report_data, 0, sizeof(struct cytp_report_data)); | ||
2513 | |||
2514 | - contact_cnt = cypress_get_finger_count(header_byte); | ||
2515 | - | ||
2516 | - if (contact_cnt < 0) /* e.g. palm detect */ | ||
2517 | - return -EINVAL; | ||
2518 | - | ||
2519 | - report_data->contact_cnt = contact_cnt; | ||
2520 | - | ||
2521 | + report_data->contact_cnt = cypress_get_finger_count(header_byte); | ||
2522 | report_data->tap = (header_byte & ABS_MULTIFINGER_TAP) ? 1 : 0; | ||
2523 | |||
2524 | if (report_data->contact_cnt == 1) { | ||
2525 | @@ -535,11 +528,9 @@ static void cypress_process_packet(struct psmouse *psmouse, bool zero_pkt) | ||
2526 | int slots[CYTP_MAX_MT_SLOTS]; | ||
2527 | int n; | ||
2528 | |||
2529 | - if (cypress_parse_packet(psmouse, cytp, &report_data)) | ||
2530 | - return; | ||
2531 | + cypress_parse_packet(psmouse, cytp, &report_data); | ||
2532 | |||
2533 | n = report_data.contact_cnt; | ||
2534 | - | ||
2535 | if (n > CYTP_MAX_MT_SLOTS) | ||
2536 | n = CYTP_MAX_MT_SLOTS; | ||
2537 | |||
2538 | @@ -605,10 +596,6 @@ static psmouse_ret_t cypress_validate_byte(struct psmouse *psmouse) | ||
2539 | return PSMOUSE_BAD_DATA; | ||
2540 | |||
2541 | contact_cnt = cypress_get_finger_count(packet[0]); | ||
2542 | - | ||
2543 | - if (contact_cnt < 0) | ||
2544 | - return PSMOUSE_BAD_DATA; | ||
2545 | - | ||
2546 | if (cytp->mode & CYTP_BIT_ABS_NO_PRESSURE) | ||
2547 | cypress_set_packet_size(psmouse, contact_cnt == 2 ? 7 : 4); | ||
2548 | else | ||
2549 | diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h | ||
2550 | index 5f306f79..0ec9abbe 100644 | ||
2551 | --- a/drivers/input/serio/i8042-x86ia64io.h | ||
2552 | +++ b/drivers/input/serio/i8042-x86ia64io.h | ||
2553 | @@ -765,6 +765,7 @@ static struct pnp_device_id pnp_kbd_devids[] = { | ||
2554 | { .id = "CPQA0D7", .driver_data = 0 }, | ||
2555 | { .id = "", }, | ||
2556 | }; | ||
2557 | +MODULE_DEVICE_TABLE(pnp, pnp_kbd_devids); | ||
2558 | |||
2559 | static struct pnp_driver i8042_pnp_kbd_driver = { | ||
2560 | .name = "i8042 kbd", | ||
2561 | @@ -786,6 +787,7 @@ static struct pnp_device_id pnp_aux_devids[] = { | ||
2562 | { .id = "SYN0801", .driver_data = 0 }, | ||
2563 | { .id = "", }, | ||
2564 | }; | ||
2565 | +MODULE_DEVICE_TABLE(pnp, pnp_aux_devids); | ||
2566 | |||
2567 | static struct pnp_driver i8042_pnp_aux_driver = { | ||
2568 | .name = "i8042 aux", | ||
2569 | diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c | ||
2570 | index 721fdb35..ae4b6b90 100644 | ||
2571 | --- a/drivers/input/touchscreen/usbtouchscreen.c | ||
2572 | +++ b/drivers/input/touchscreen/usbtouchscreen.c | ||
2573 | @@ -146,12 +146,10 @@ enum { | ||
2574 | |||
2575 | #define USB_DEVICE_HID_CLASS(vend, prod) \ | ||
2576 | .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \ | ||
2577 | - | USB_DEVICE_ID_MATCH_INT_PROTOCOL \ | ||
2578 | | USB_DEVICE_ID_MATCH_DEVICE, \ | ||
2579 | .idVendor = (vend), \ | ||
2580 | .idProduct = (prod), \ | ||
2581 | - .bInterfaceClass = USB_INTERFACE_CLASS_HID, \ | ||
2582 | - .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE | ||
2583 | + .bInterfaceClass = USB_INTERFACE_CLASS_HID | ||
2584 | |||
2585 | static const struct usb_device_id usbtouch_devices[] = { | ||
2586 | #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX | ||
2587 | diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c | ||
2588 | index df44b60e..516f9c92 100644 | ||
2589 | --- a/drivers/md/dm-cache-target.c | ||
2590 | +++ b/drivers/md/dm-cache-target.c | ||
2591 | @@ -151,6 +151,9 @@ struct cache { | ||
2592 | atomic_t nr_migrations; | ||
2593 | wait_queue_head_t migration_wait; | ||
2594 | |||
2595 | + wait_queue_head_t quiescing_wait; | ||
2596 | + atomic_t quiescing_ack; | ||
2597 | + | ||
2598 | /* | ||
2599 | * cache_size entries, dirty if set | ||
2600 | */ | ||
2601 | @@ -742,8 +745,9 @@ static void cell_defer(struct cache *cache, struct dm_bio_prison_cell *cell, | ||
2602 | |||
2603 | static void cleanup_migration(struct dm_cache_migration *mg) | ||
2604 | { | ||
2605 | - dec_nr_migrations(mg->cache); | ||
2606 | + struct cache *cache = mg->cache; | ||
2607 | free_migration(mg); | ||
2608 | + dec_nr_migrations(cache); | ||
2609 | } | ||
2610 | |||
2611 | static void migration_failure(struct dm_cache_migration *mg) | ||
2612 | @@ -1340,34 +1344,51 @@ static void writeback_some_dirty_blocks(struct cache *cache) | ||
2613 | /*---------------------------------------------------------------- | ||
2614 | * Main worker loop | ||
2615 | *--------------------------------------------------------------*/ | ||
2616 | -static void start_quiescing(struct cache *cache) | ||
2617 | +static bool is_quiescing(struct cache *cache) | ||
2618 | { | ||
2619 | + int r; | ||
2620 | unsigned long flags; | ||
2621 | |||
2622 | spin_lock_irqsave(&cache->lock, flags); | ||
2623 | - cache->quiescing = 1; | ||
2624 | + r = cache->quiescing; | ||
2625 | spin_unlock_irqrestore(&cache->lock, flags); | ||
2626 | + | ||
2627 | + return r; | ||
2628 | } | ||
2629 | |||
2630 | -static void stop_quiescing(struct cache *cache) | ||
2631 | +static void ack_quiescing(struct cache *cache) | ||
2632 | +{ | ||
2633 | + if (is_quiescing(cache)) { | ||
2634 | + atomic_inc(&cache->quiescing_ack); | ||
2635 | + wake_up(&cache->quiescing_wait); | ||
2636 | + } | ||
2637 | +} | ||
2638 | + | ||
2639 | +static void wait_for_quiescing_ack(struct cache *cache) | ||
2640 | +{ | ||
2641 | + wait_event(cache->quiescing_wait, atomic_read(&cache->quiescing_ack)); | ||
2642 | +} | ||
2643 | + | ||
2644 | +static void start_quiescing(struct cache *cache) | ||
2645 | { | ||
2646 | unsigned long flags; | ||
2647 | |||
2648 | spin_lock_irqsave(&cache->lock, flags); | ||
2649 | - cache->quiescing = 0; | ||
2650 | + cache->quiescing = true; | ||
2651 | spin_unlock_irqrestore(&cache->lock, flags); | ||
2652 | + | ||
2653 | + wait_for_quiescing_ack(cache); | ||
2654 | } | ||
2655 | |||
2656 | -static bool is_quiescing(struct cache *cache) | ||
2657 | +static void stop_quiescing(struct cache *cache) | ||
2658 | { | ||
2659 | - int r; | ||
2660 | unsigned long flags; | ||
2661 | |||
2662 | spin_lock_irqsave(&cache->lock, flags); | ||
2663 | - r = cache->quiescing; | ||
2664 | + cache->quiescing = false; | ||
2665 | spin_unlock_irqrestore(&cache->lock, flags); | ||
2666 | |||
2667 | - return r; | ||
2668 | + atomic_set(&cache->quiescing_ack, 0); | ||
2669 | } | ||
2670 | |||
2671 | static void wait_for_migrations(struct cache *cache) | ||
2672 | @@ -1414,16 +1435,15 @@ static void do_worker(struct work_struct *ws) | ||
2673 | struct cache *cache = container_of(ws, struct cache, worker); | ||
2674 | |||
2675 | do { | ||
2676 | - if (!is_quiescing(cache)) | ||
2677 | + if (!is_quiescing(cache)) { | ||
2678 | + writeback_some_dirty_blocks(cache); | ||
2679 | + process_deferred_writethrough_bios(cache); | ||
2680 | process_deferred_bios(cache); | ||
2681 | + } | ||
2682 | |||
2683 | process_migrations(cache, &cache->quiesced_migrations, issue_copy); | ||
2684 | process_migrations(cache, &cache->completed_migrations, complete_migration); | ||
2685 | |||
2686 | - writeback_some_dirty_blocks(cache); | ||
2687 | - | ||
2688 | - process_deferred_writethrough_bios(cache); | ||
2689 | - | ||
2690 | if (commit_if_needed(cache)) { | ||
2691 | process_deferred_flush_bios(cache, false); | ||
2692 | |||
2693 | @@ -1436,6 +1456,9 @@ static void do_worker(struct work_struct *ws) | ||
2694 | process_migrations(cache, &cache->need_commit_migrations, | ||
2695 | migration_success_post_commit); | ||
2696 | } | ||
2697 | + | ||
2698 | + ack_quiescing(cache); | ||
2699 | + | ||
2700 | } while (more_work(cache)); | ||
2701 | } | ||
2702 | |||
2703 | @@ -1998,6 +2021,9 @@ static int cache_create(struct cache_args *ca, struct cache **result) | ||
2704 | atomic_set(&cache->nr_migrations, 0); | ||
2705 | init_waitqueue_head(&cache->migration_wait); | ||
2706 | |||
2707 | + init_waitqueue_head(&cache->quiescing_wait); | ||
2708 | + atomic_set(&cache->quiescing_ack, 0); | ||
2709 | + | ||
2710 | r = -ENOMEM; | ||
2711 | cache->nr_dirty = 0; | ||
2712 | cache->dirty_bitset = alloc_bitset(from_cblock(cache->cache_size)); | ||
2713 | diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c | ||
2714 | index c5b7b3dd..eb7ddb20 100644 | ||
2715 | --- a/drivers/md/dm-mpath.c | ||
2716 | +++ b/drivers/md/dm-mpath.c | ||
2717 | @@ -86,6 +86,7 @@ struct multipath { | ||
2718 | unsigned queue_if_no_path:1; /* Queue I/O if last path fails? */ | ||
2719 | unsigned saved_queue_if_no_path:1; /* Saved state during suspension */ | ||
2720 | unsigned retain_attached_hw_handler:1; /* If there's already a hw_handler present, don't change it. */ | ||
2721 | + unsigned pg_init_disabled:1; /* pg_init is not currently allowed */ | ||
2722 | |||
2723 | unsigned pg_init_retries; /* Number of times to retry pg_init */ | ||
2724 | unsigned pg_init_count; /* Number of times pg_init called */ | ||
2725 | @@ -497,7 +498,8 @@ static void process_queued_ios(struct work_struct *work) | ||
2726 | (!pgpath && !m->queue_if_no_path)) | ||
2727 | must_queue = 0; | ||
2728 | |||
2729 | - if (m->pg_init_required && !m->pg_init_in_progress && pgpath) | ||
2730 | + if (m->pg_init_required && !m->pg_init_in_progress && pgpath && | ||
2731 | + !m->pg_init_disabled) | ||
2732 | __pg_init_all_paths(m); | ||
2733 | |||
2734 | spin_unlock_irqrestore(&m->lock, flags); | ||
2735 | @@ -942,10 +944,20 @@ static void multipath_wait_for_pg_init_completion(struct multipath *m) | ||
2736 | |||
2737 | static void flush_multipath_work(struct multipath *m) | ||
2738 | { | ||
2739 | + unsigned long flags; | ||
2740 | + | ||
2741 | + spin_lock_irqsave(&m->lock, flags); | ||
2742 | + m->pg_init_disabled = 1; | ||
2743 | + spin_unlock_irqrestore(&m->lock, flags); | ||
2744 | + | ||
2745 | flush_workqueue(kmpath_handlerd); | ||
2746 | multipath_wait_for_pg_init_completion(m); | ||
2747 | flush_workqueue(kmultipathd); | ||
2748 | flush_work(&m->trigger_event); | ||
2749 | + | ||
2750 | + spin_lock_irqsave(&m->lock, flags); | ||
2751 | + m->pg_init_disabled = 0; | ||
2752 | + spin_unlock_irqrestore(&m->lock, flags); | ||
2753 | } | ||
2754 | |||
2755 | static void multipath_dtr(struct dm_target *ti) | ||
2756 | @@ -1164,7 +1176,7 @@ static int pg_init_limit_reached(struct multipath *m, struct pgpath *pgpath) | ||
2757 | |||
2758 | spin_lock_irqsave(&m->lock, flags); | ||
2759 | |||
2760 | - if (m->pg_init_count <= m->pg_init_retries) | ||
2761 | + if (m->pg_init_count <= m->pg_init_retries && !m->pg_init_disabled) | ||
2762 | m->pg_init_required = 1; | ||
2763 | else | ||
2764 | limit_reached = 1; | ||
2765 | @@ -1699,7 +1711,7 @@ out: | ||
2766 | *---------------------------------------------------------------*/ | ||
2767 | static struct target_type multipath_target = { | ||
2768 | .name = "multipath", | ||
2769 | - .version = {1, 5, 1}, | ||
2770 | + .version = {1, 6, 0}, | ||
2771 | .module = THIS_MODULE, | ||
2772 | .ctr = multipath_ctr, | ||
2773 | .dtr = multipath_dtr, | ||
2774 | diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c | ||
2775 | index 1ff252ab..9e3a045e 100644 | ||
2776 | --- a/drivers/md/dm-table.c | ||
2777 | +++ b/drivers/md/dm-table.c | ||
2778 | @@ -580,14 +580,28 @@ static int adjoin(struct dm_table *table, struct dm_target *ti) | ||
2779 | |||
2780 | /* | ||
2781 | * Used to dynamically allocate the arg array. | ||
2782 | + * | ||
2783 | + * We do first allocation with GFP_NOIO because dm-mpath and dm-thin must | ||
2784 | + * process messages even if some device is suspended. These messages have a | ||
2785 | + * small fixed number of arguments. | ||
2786 | + * | ||
2787 | + * On the other hand, dm-switch needs to process bulk data using messages and | ||
2788 | + * excessive use of GFP_NOIO could cause trouble. | ||
2789 | */ | ||
2790 | static char **realloc_argv(unsigned *array_size, char **old_argv) | ||
2791 | { | ||
2792 | char **argv; | ||
2793 | unsigned new_size; | ||
2794 | + gfp_t gfp; | ||
2795 | |||
2796 | - new_size = *array_size ? *array_size * 2 : 64; | ||
2797 | - argv = kmalloc(new_size * sizeof(*argv), GFP_KERNEL); | ||
2798 | + if (*array_size) { | ||
2799 | + new_size = *array_size * 2; | ||
2800 | + gfp = GFP_KERNEL; | ||
2801 | + } else { | ||
2802 | + new_size = 8; | ||
2803 | + gfp = GFP_NOIO; | ||
2804 | + } | ||
2805 | + argv = kmalloc(new_size * sizeof(*argv), gfp); | ||
2806 | if (argv) { | ||
2807 | memcpy(argv, old_argv, *array_size * sizeof(*argv)); | ||
2808 | *array_size = new_size; | ||
2809 | diff --git a/drivers/md/md.c b/drivers/md/md.c | ||
2810 | index d78f1fff..2290b950 100644 | ||
2811 | --- a/drivers/md/md.c | ||
2812 | +++ b/drivers/md/md.c | ||
2813 | @@ -3619,6 +3619,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len) | ||
2814 | mddev->in_sync = 1; | ||
2815 | del_timer_sync(&mddev->safemode_timer); | ||
2816 | } | ||
2817 | + blk_set_stacking_limits(&mddev->queue->limits); | ||
2818 | pers->run(mddev); | ||
2819 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | ||
2820 | mddev_resume(mddev); | ||
2821 | diff --git a/drivers/md/persistent-data/dm-array.c b/drivers/md/persistent-data/dm-array.c | ||
2822 | index 172147eb..af96e24e 100644 | ||
2823 | --- a/drivers/md/persistent-data/dm-array.c | ||
2824 | +++ b/drivers/md/persistent-data/dm-array.c | ||
2825 | @@ -509,15 +509,18 @@ static int grow_add_tail_block(struct resize *resize) | ||
2826 | static int grow_needs_more_blocks(struct resize *resize) | ||
2827 | { | ||
2828 | int r; | ||
2829 | + unsigned old_nr_blocks = resize->old_nr_full_blocks; | ||
2830 | |||
2831 | if (resize->old_nr_entries_in_last_block > 0) { | ||
2832 | + old_nr_blocks++; | ||
2833 | + | ||
2834 | r = grow_extend_tail_block(resize, resize->max_entries); | ||
2835 | if (r) | ||
2836 | return r; | ||
2837 | } | ||
2838 | |||
2839 | r = insert_full_ablocks(resize->info, resize->size_of_block, | ||
2840 | - resize->old_nr_full_blocks, | ||
2841 | + old_nr_blocks, | ||
2842 | resize->new_nr_full_blocks, | ||
2843 | resize->max_entries, resize->value, | ||
2844 | &resize->root); | ||
2845 | diff --git a/drivers/media/dvb-frontends/af9013.c b/drivers/media/dvb-frontends/af9013.c | ||
2846 | index a204f282..fb504f1e 100644 | ||
2847 | --- a/drivers/media/dvb-frontends/af9013.c | ||
2848 | +++ b/drivers/media/dvb-frontends/af9013.c | ||
2849 | @@ -24,6 +24,9 @@ | ||
2850 | |||
2851 | #include "af9013_priv.h" | ||
2852 | |||
2853 | +/* Max transfer size done by I2C transfer functions */ | ||
2854 | +#define MAX_XFER_SIZE 64 | ||
2855 | + | ||
2856 | struct af9013_state { | ||
2857 | struct i2c_adapter *i2c; | ||
2858 | struct dvb_frontend fe; | ||
2859 | @@ -50,16 +53,23 @@ static int af9013_wr_regs_i2c(struct af9013_state *priv, u8 mbox, u16 reg, | ||
2860 | const u8 *val, int len) | ||
2861 | { | ||
2862 | int ret; | ||
2863 | - u8 buf[3+len]; | ||
2864 | + u8 buf[MAX_XFER_SIZE]; | ||
2865 | struct i2c_msg msg[1] = { | ||
2866 | { | ||
2867 | .addr = priv->config.i2c_addr, | ||
2868 | .flags = 0, | ||
2869 | - .len = sizeof(buf), | ||
2870 | + .len = 3 + len, | ||
2871 | .buf = buf, | ||
2872 | } | ||
2873 | }; | ||
2874 | |||
2875 | + if (3 + len > sizeof(buf)) { | ||
2876 | + dev_warn(&priv->i2c->dev, | ||
2877 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
2878 | + KBUILD_MODNAME, reg, len); | ||
2879 | + return -EINVAL; | ||
2880 | + } | ||
2881 | + | ||
2882 | buf[0] = (reg >> 8) & 0xff; | ||
2883 | buf[1] = (reg >> 0) & 0xff; | ||
2884 | buf[2] = mbox; | ||
2885 | diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c | ||
2886 | index a777b4b9..30ee5905 100644 | ||
2887 | --- a/drivers/media/dvb-frontends/af9033.c | ||
2888 | +++ b/drivers/media/dvb-frontends/af9033.c | ||
2889 | @@ -21,6 +21,9 @@ | ||
2890 | |||
2891 | #include "af9033_priv.h" | ||
2892 | |||
2893 | +/* Max transfer size done by I2C transfer functions */ | ||
2894 | +#define MAX_XFER_SIZE 64 | ||
2895 | + | ||
2896 | struct af9033_state { | ||
2897 | struct i2c_adapter *i2c; | ||
2898 | struct dvb_frontend fe; | ||
2899 | @@ -40,16 +43,23 @@ static int af9033_wr_regs(struct af9033_state *state, u32 reg, const u8 *val, | ||
2900 | int len) | ||
2901 | { | ||
2902 | int ret; | ||
2903 | - u8 buf[3 + len]; | ||
2904 | + u8 buf[MAX_XFER_SIZE]; | ||
2905 | struct i2c_msg msg[1] = { | ||
2906 | { | ||
2907 | .addr = state->cfg.i2c_addr, | ||
2908 | .flags = 0, | ||
2909 | - .len = sizeof(buf), | ||
2910 | + .len = 3 + len, | ||
2911 | .buf = buf, | ||
2912 | } | ||
2913 | }; | ||
2914 | |||
2915 | + if (3 + len > sizeof(buf)) { | ||
2916 | + dev_warn(&state->i2c->dev, | ||
2917 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
2918 | + KBUILD_MODNAME, reg, len); | ||
2919 | + return -EINVAL; | ||
2920 | + } | ||
2921 | + | ||
2922 | buf[0] = (reg >> 16) & 0xff; | ||
2923 | buf[1] = (reg >> 8) & 0xff; | ||
2924 | buf[2] = (reg >> 0) & 0xff; | ||
2925 | @@ -161,7 +171,14 @@ static int af9033_wr_reg_val_tab(struct af9033_state *state, | ||
2926 | const struct reg_val *tab, int tab_len) | ||
2927 | { | ||
2928 | int ret, i, j; | ||
2929 | - u8 buf[tab_len]; | ||
2930 | + u8 buf[MAX_XFER_SIZE]; | ||
2931 | + | ||
2932 | + if (tab_len > sizeof(buf)) { | ||
2933 | + dev_warn(&state->i2c->dev, | ||
2934 | + "%s: i2c wr len=%d is too big!\n", | ||
2935 | + KBUILD_MODNAME, tab_len); | ||
2936 | + return -EINVAL; | ||
2937 | + } | ||
2938 | |||
2939 | dev_dbg(&state->i2c->dev, "%s: tab_len=%d\n", __func__, tab_len); | ||
2940 | |||
2941 | diff --git a/drivers/media/dvb-frontends/bcm3510.c b/drivers/media/dvb-frontends/bcm3510.c | ||
2942 | index 1b77909c..39a29dd2 100644 | ||
2943 | --- a/drivers/media/dvb-frontends/bcm3510.c | ||
2944 | +++ b/drivers/media/dvb-frontends/bcm3510.c | ||
2945 | @@ -44,6 +44,9 @@ | ||
2946 | #include "bcm3510.h" | ||
2947 | #include "bcm3510_priv.h" | ||
2948 | |||
2949 | +/* Max transfer size done by bcm3510_do_hab_cmd() function */ | ||
2950 | +#define MAX_XFER_SIZE 128 | ||
2951 | + | ||
2952 | struct bcm3510_state { | ||
2953 | |||
2954 | struct i2c_adapter* i2c; | ||
2955 | @@ -201,9 +204,19 @@ static int bcm3510_hab_send_request(struct bcm3510_state *st, u8 *buf, int len) | ||
2956 | |||
2957 | static int bcm3510_do_hab_cmd(struct bcm3510_state *st, u8 cmd, u8 msgid, u8 *obuf, u8 olen, u8 *ibuf, u8 ilen) | ||
2958 | { | ||
2959 | - u8 ob[olen+2],ib[ilen+2]; | ||
2960 | + u8 ob[MAX_XFER_SIZE], ib[MAX_XFER_SIZE]; | ||
2961 | int ret = 0; | ||
2962 | |||
2963 | + if (ilen + 2 > sizeof(ib)) { | ||
2964 | + deb_hab("do_hab_cmd: ilen=%d is too big!\n", ilen); | ||
2965 | + return -EINVAL; | ||
2966 | + } | ||
2967 | + | ||
2968 | + if (olen + 2 > sizeof(ob)) { | ||
2969 | + deb_hab("do_hab_cmd: olen=%d is too big!\n", olen); | ||
2970 | + return -EINVAL; | ||
2971 | + } | ||
2972 | + | ||
2973 | ob[0] = cmd; | ||
2974 | ob[1] = msgid; | ||
2975 | memcpy(&ob[2],obuf,olen); | ||
2976 | diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c | ||
2977 | index 7ca5c69d..51447a04 100644 | ||
2978 | --- a/drivers/media/dvb-frontends/cxd2820r_core.c | ||
2979 | +++ b/drivers/media/dvb-frontends/cxd2820r_core.c | ||
2980 | @@ -21,12 +21,15 @@ | ||
2981 | |||
2982 | #include "cxd2820r_priv.h" | ||
2983 | |||
2984 | +/* Max transfer size done by I2C transfer functions */ | ||
2985 | +#define MAX_XFER_SIZE 64 | ||
2986 | + | ||
2987 | /* write multiple registers */ | ||
2988 | static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, | ||
2989 | u8 *val, int len) | ||
2990 | { | ||
2991 | int ret; | ||
2992 | - u8 buf[len+1]; | ||
2993 | + u8 buf[MAX_XFER_SIZE]; | ||
2994 | struct i2c_msg msg[1] = { | ||
2995 | { | ||
2996 | .addr = i2c, | ||
2997 | @@ -36,6 +39,13 @@ static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, | ||
2998 | } | ||
2999 | }; | ||
3000 | |||
3001 | + if (1 + len > sizeof(buf)) { | ||
3002 | + dev_warn(&priv->i2c->dev, | ||
3003 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3004 | + KBUILD_MODNAME, reg, len); | ||
3005 | + return -EINVAL; | ||
3006 | + } | ||
3007 | + | ||
3008 | buf[0] = reg; | ||
3009 | memcpy(&buf[1], val, len); | ||
3010 | |||
3011 | @@ -55,7 +65,7 @@ static int cxd2820r_rd_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, | ||
3012 | u8 *val, int len) | ||
3013 | { | ||
3014 | int ret; | ||
3015 | - u8 buf[len]; | ||
3016 | + u8 buf[MAX_XFER_SIZE]; | ||
3017 | struct i2c_msg msg[2] = { | ||
3018 | { | ||
3019 | .addr = i2c, | ||
3020 | @@ -70,6 +80,13 @@ static int cxd2820r_rd_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, | ||
3021 | } | ||
3022 | }; | ||
3023 | |||
3024 | + if (len > sizeof(buf)) { | ||
3025 | + dev_warn(&priv->i2c->dev, | ||
3026 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3027 | + KBUILD_MODNAME, reg, len); | ||
3028 | + return -EINVAL; | ||
3029 | + } | ||
3030 | + | ||
3031 | ret = i2c_transfer(priv->i2c, msg, 2); | ||
3032 | if (ret == 2) { | ||
3033 | memcpy(val, buf, len); | ||
3034 | diff --git a/drivers/media/dvb-frontends/itd1000.c b/drivers/media/dvb-frontends/itd1000.c | ||
3035 | index c1c3400b..cadcae4c 100644 | ||
3036 | --- a/drivers/media/dvb-frontends/itd1000.c | ||
3037 | +++ b/drivers/media/dvb-frontends/itd1000.c | ||
3038 | @@ -31,6 +31,9 @@ | ||
3039 | #include "itd1000.h" | ||
3040 | #include "itd1000_priv.h" | ||
3041 | |||
3042 | +/* Max transfer size done by I2C transfer functions */ | ||
3043 | +#define MAX_XFER_SIZE 64 | ||
3044 | + | ||
3045 | static int debug; | ||
3046 | module_param(debug, int, 0644); | ||
3047 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); | ||
3048 | @@ -52,10 +55,18 @@ MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); | ||
3049 | /* don't write more than one byte with flexcop behind */ | ||
3050 | static int itd1000_write_regs(struct itd1000_state *state, u8 reg, u8 v[], u8 len) | ||
3051 | { | ||
3052 | - u8 buf[1+len]; | ||
3053 | + u8 buf[MAX_XFER_SIZE]; | ||
3054 | struct i2c_msg msg = { | ||
3055 | .addr = state->cfg->i2c_address, .flags = 0, .buf = buf, .len = len+1 | ||
3056 | }; | ||
3057 | + | ||
3058 | + if (1 + len > sizeof(buf)) { | ||
3059 | + printk(KERN_WARNING | ||
3060 | + "itd1000: i2c wr reg=%04x: len=%d is too big!\n", | ||
3061 | + reg, len); | ||
3062 | + return -EINVAL; | ||
3063 | + } | ||
3064 | + | ||
3065 | buf[0] = reg; | ||
3066 | memcpy(&buf[1], v, len); | ||
3067 | |||
3068 | diff --git a/drivers/media/dvb-frontends/mt312.c b/drivers/media/dvb-frontends/mt312.c | ||
3069 | index ec388c1d..a74ac0dd 100644 | ||
3070 | --- a/drivers/media/dvb-frontends/mt312.c | ||
3071 | +++ b/drivers/media/dvb-frontends/mt312.c | ||
3072 | @@ -36,6 +36,8 @@ | ||
3073 | #include "mt312_priv.h" | ||
3074 | #include "mt312.h" | ||
3075 | |||
3076 | +/* Max transfer size done by I2C transfer functions */ | ||
3077 | +#define MAX_XFER_SIZE 64 | ||
3078 | |||
3079 | struct mt312_state { | ||
3080 | struct i2c_adapter *i2c; | ||
3081 | @@ -96,9 +98,15 @@ static int mt312_write(struct mt312_state *state, const enum mt312_reg_addr reg, | ||
3082 | const u8 *src, const size_t count) | ||
3083 | { | ||
3084 | int ret; | ||
3085 | - u8 buf[count + 1]; | ||
3086 | + u8 buf[MAX_XFER_SIZE]; | ||
3087 | struct i2c_msg msg; | ||
3088 | |||
3089 | + if (1 + count > sizeof(buf)) { | ||
3090 | + printk(KERN_WARNING | ||
3091 | + "mt312: write: len=%zd is too big!\n", count); | ||
3092 | + return -EINVAL; | ||
3093 | + } | ||
3094 | + | ||
3095 | if (debug) { | ||
3096 | int i; | ||
3097 | dprintk("W(%d):", reg & 0x7f); | ||
3098 | diff --git a/drivers/media/dvb-frontends/nxt200x.c b/drivers/media/dvb-frontends/nxt200x.c | ||
3099 | index 8e288940..fbca9856 100644 | ||
3100 | --- a/drivers/media/dvb-frontends/nxt200x.c | ||
3101 | +++ b/drivers/media/dvb-frontends/nxt200x.c | ||
3102 | @@ -39,6 +39,9 @@ | ||
3103 | */ | ||
3104 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
3105 | |||
3106 | +/* Max transfer size done by I2C transfer functions */ | ||
3107 | +#define MAX_XFER_SIZE 64 | ||
3108 | + | ||
3109 | #define NXT2002_DEFAULT_FIRMWARE "dvb-fe-nxt2002.fw" | ||
3110 | #define NXT2004_DEFAULT_FIRMWARE "dvb-fe-nxt2004.fw" | ||
3111 | #define CRC_CCIT_MASK 0x1021 | ||
3112 | @@ -95,10 +98,16 @@ static int i2c_readbytes(struct nxt200x_state *state, u8 addr, u8 *buf, u8 len) | ||
3113 | static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg, | ||
3114 | const u8 *buf, u8 len) | ||
3115 | { | ||
3116 | - u8 buf2 [len+1]; | ||
3117 | + u8 buf2[MAX_XFER_SIZE]; | ||
3118 | int err; | ||
3119 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf2, .len = len + 1 }; | ||
3120 | |||
3121 | + if (1 + len > sizeof(buf2)) { | ||
3122 | + pr_warn("%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3123 | + __func__, reg, len); | ||
3124 | + return -EINVAL; | ||
3125 | + } | ||
3126 | + | ||
3127 | buf2[0] = reg; | ||
3128 | memcpy(&buf2[1], buf, len); | ||
3129 | |||
3130 | diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c | ||
3131 | index 362d26d1..7efb796c 100644 | ||
3132 | --- a/drivers/media/dvb-frontends/rtl2830.c | ||
3133 | +++ b/drivers/media/dvb-frontends/rtl2830.c | ||
3134 | @@ -27,20 +27,30 @@ | ||
3135 | |||
3136 | #include "rtl2830_priv.h" | ||
3137 | |||
3138 | +/* Max transfer size done by I2C transfer functions */ | ||
3139 | +#define MAX_XFER_SIZE 64 | ||
3140 | + | ||
3141 | /* write multiple hardware registers */ | ||
3142 | static int rtl2830_wr(struct rtl2830_priv *priv, u8 reg, const u8 *val, int len) | ||
3143 | { | ||
3144 | int ret; | ||
3145 | - u8 buf[1+len]; | ||
3146 | + u8 buf[MAX_XFER_SIZE]; | ||
3147 | struct i2c_msg msg[1] = { | ||
3148 | { | ||
3149 | .addr = priv->cfg.i2c_addr, | ||
3150 | .flags = 0, | ||
3151 | - .len = 1+len, | ||
3152 | + .len = 1 + len, | ||
3153 | .buf = buf, | ||
3154 | } | ||
3155 | }; | ||
3156 | |||
3157 | + if (1 + len > sizeof(buf)) { | ||
3158 | + dev_warn(&priv->i2c->dev, | ||
3159 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3160 | + KBUILD_MODNAME, reg, len); | ||
3161 | + return -EINVAL; | ||
3162 | + } | ||
3163 | + | ||
3164 | buf[0] = reg; | ||
3165 | memcpy(&buf[1], val, len); | ||
3166 | |||
3167 | diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c | ||
3168 | index facb8484..b8dd0a13 100644 | ||
3169 | --- a/drivers/media/dvb-frontends/rtl2832.c | ||
3170 | +++ b/drivers/media/dvb-frontends/rtl2832.c | ||
3171 | @@ -22,6 +22,9 @@ | ||
3172 | #include "dvb_math.h" | ||
3173 | #include <linux/bitops.h> | ||
3174 | |||
3175 | +/* Max transfer size done by I2C transfer functions */ | ||
3176 | +#define MAX_XFER_SIZE 64 | ||
3177 | + | ||
3178 | int rtl2832_debug; | ||
3179 | module_param_named(debug, rtl2832_debug, int, 0644); | ||
3180 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); | ||
3181 | @@ -162,16 +165,23 @@ static const struct rtl2832_reg_entry registers[] = { | ||
3182 | static int rtl2832_wr(struct rtl2832_priv *priv, u8 reg, u8 *val, int len) | ||
3183 | { | ||
3184 | int ret; | ||
3185 | - u8 buf[1+len]; | ||
3186 | + u8 buf[MAX_XFER_SIZE]; | ||
3187 | struct i2c_msg msg[1] = { | ||
3188 | { | ||
3189 | .addr = priv->cfg.i2c_addr, | ||
3190 | .flags = 0, | ||
3191 | - .len = 1+len, | ||
3192 | + .len = 1 + len, | ||
3193 | .buf = buf, | ||
3194 | } | ||
3195 | }; | ||
3196 | |||
3197 | + if (1 + len > sizeof(buf)) { | ||
3198 | + dev_warn(&priv->i2c->dev, | ||
3199 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3200 | + KBUILD_MODNAME, reg, len); | ||
3201 | + return -EINVAL; | ||
3202 | + } | ||
3203 | + | ||
3204 | buf[0] = reg; | ||
3205 | memcpy(&buf[1], val, len); | ||
3206 | |||
3207 | diff --git a/drivers/media/dvb-frontends/s5h1420.c b/drivers/media/dvb-frontends/s5h1420.c | ||
3208 | index e2fec9eb..93eeaf71 100644 | ||
3209 | --- a/drivers/media/dvb-frontends/s5h1420.c | ||
3210 | +++ b/drivers/media/dvb-frontends/s5h1420.c | ||
3211 | @@ -836,9 +836,16 @@ static u32 s5h1420_tuner_i2c_func(struct i2c_adapter *adapter) | ||
3212 | static int s5h1420_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[], int num) | ||
3213 | { | ||
3214 | struct s5h1420_state *state = i2c_get_adapdata(i2c_adap); | ||
3215 | - struct i2c_msg m[1 + num]; | ||
3216 | + struct i2c_msg m[3]; | ||
3217 | u8 tx_open[2] = { CON_1, state->CON_1_val | 1 }; /* repeater stops once there was a stop condition */ | ||
3218 | |||
3219 | + if (1 + num > ARRAY_SIZE(m)) { | ||
3220 | + printk(KERN_WARNING | ||
3221 | + "%s: i2c xfer: num=%d is too big!\n", | ||
3222 | + KBUILD_MODNAME, num); | ||
3223 | + return -EOPNOTSUPP; | ||
3224 | + } | ||
3225 | + | ||
3226 | memset(m, 0, sizeof(struct i2c_msg) * (1 + num)); | ||
3227 | |||
3228 | m[0].addr = state->config->demod_address; | ||
3229 | @@ -847,7 +854,7 @@ static int s5h1420_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c | ||
3230 | |||
3231 | memcpy(&m[1], msg, sizeof(struct i2c_msg) * num); | ||
3232 | |||
3233 | - return i2c_transfer(state->i2c, m, 1+num) == 1 + num ? num : -EIO; | ||
3234 | + return i2c_transfer(state->i2c, m, 1 + num) == 1 + num ? num : -EIO; | ||
3235 | } | ||
3236 | |||
3237 | static struct i2c_algorithm s5h1420_tuner_i2c_algo = { | ||
3238 | diff --git a/drivers/media/dvb-frontends/stb0899_drv.c b/drivers/media/dvb-frontends/stb0899_drv.c | ||
3239 | index cc278b3d..2a979cfa 100644 | ||
3240 | --- a/drivers/media/dvb-frontends/stb0899_drv.c | ||
3241 | +++ b/drivers/media/dvb-frontends/stb0899_drv.c | ||
3242 | @@ -32,6 +32,9 @@ | ||
3243 | #include "stb0899_priv.h" | ||
3244 | #include "stb0899_reg.h" | ||
3245 | |||
3246 | +/* Max transfer size done by I2C transfer functions */ | ||
3247 | +#define MAX_XFER_SIZE 64 | ||
3248 | + | ||
3249 | static unsigned int verbose = 0;//1; | ||
3250 | module_param(verbose, int, 0644); | ||
3251 | |||
3252 | @@ -499,7 +502,7 @@ err: | ||
3253 | int stb0899_write_regs(struct stb0899_state *state, unsigned int reg, u8 *data, u32 count) | ||
3254 | { | ||
3255 | int ret; | ||
3256 | - u8 buf[2 + count]; | ||
3257 | + u8 buf[MAX_XFER_SIZE]; | ||
3258 | struct i2c_msg i2c_msg = { | ||
3259 | .addr = state->config->demod_address, | ||
3260 | .flags = 0, | ||
3261 | @@ -507,6 +510,13 @@ int stb0899_write_regs(struct stb0899_state *state, unsigned int reg, u8 *data, | ||
3262 | .len = 2 + count | ||
3263 | }; | ||
3264 | |||
3265 | + if (2 + count > sizeof(buf)) { | ||
3266 | + printk(KERN_WARNING | ||
3267 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3268 | + KBUILD_MODNAME, reg, count); | ||
3269 | + return -EINVAL; | ||
3270 | + } | ||
3271 | + | ||
3272 | buf[0] = reg >> 8; | ||
3273 | buf[1] = reg & 0xff; | ||
3274 | memcpy(&buf[2], data, count); | ||
3275 | diff --git a/drivers/media/dvb-frontends/stb6100.c b/drivers/media/dvb-frontends/stb6100.c | ||
3276 | index 45f9523f..cea175d1 100644 | ||
3277 | --- a/drivers/media/dvb-frontends/stb6100.c | ||
3278 | +++ b/drivers/media/dvb-frontends/stb6100.c | ||
3279 | @@ -31,6 +31,8 @@ | ||
3280 | static unsigned int verbose; | ||
3281 | module_param(verbose, int, 0644); | ||
3282 | |||
3283 | +/* Max transfer size done by I2C transfer functions */ | ||
3284 | +#define MAX_XFER_SIZE 64 | ||
3285 | |||
3286 | #define FE_ERROR 0 | ||
3287 | #define FE_NOTICE 1 | ||
3288 | @@ -183,7 +185,7 @@ static int stb6100_read_reg(struct stb6100_state *state, u8 reg) | ||
3289 | static int stb6100_write_reg_range(struct stb6100_state *state, u8 buf[], int start, int len) | ||
3290 | { | ||
3291 | int rc; | ||
3292 | - u8 cmdbuf[len + 1]; | ||
3293 | + u8 cmdbuf[MAX_XFER_SIZE]; | ||
3294 | struct i2c_msg msg = { | ||
3295 | .addr = state->config->tuner_address, | ||
3296 | .flags = 0, | ||
3297 | @@ -191,6 +193,13 @@ static int stb6100_write_reg_range(struct stb6100_state *state, u8 buf[], int st | ||
3298 | .len = len + 1 | ||
3299 | }; | ||
3300 | |||
3301 | + if (1 + len > sizeof(buf)) { | ||
3302 | + printk(KERN_WARNING | ||
3303 | + "%s: i2c wr: len=%d is too big!\n", | ||
3304 | + KBUILD_MODNAME, len); | ||
3305 | + return -EINVAL; | ||
3306 | + } | ||
3307 | + | ||
3308 | if (unlikely(start < 1 || start + len > STB6100_NUMREGS)) { | ||
3309 | dprintk(verbose, FE_ERROR, 1, "Invalid register range %d:%d", | ||
3310 | start, len); | ||
3311 | diff --git a/drivers/media/dvb-frontends/stv0367.c b/drivers/media/dvb-frontends/stv0367.c | ||
3312 | index 0c8e4594..f6c72779 100644 | ||
3313 | --- a/drivers/media/dvb-frontends/stv0367.c | ||
3314 | +++ b/drivers/media/dvb-frontends/stv0367.c | ||
3315 | @@ -33,6 +33,9 @@ | ||
3316 | #include "stv0367_regs.h" | ||
3317 | #include "stv0367_priv.h" | ||
3318 | |||
3319 | +/* Max transfer size done by I2C transfer functions */ | ||
3320 | +#define MAX_XFER_SIZE 64 | ||
3321 | + | ||
3322 | static int stvdebug; | ||
3323 | module_param_named(debug, stvdebug, int, 0644); | ||
3324 | |||
3325 | @@ -767,7 +770,7 @@ static struct st_register def0367cab[STV0367CAB_NBREGS] = { | ||
3326 | static | ||
3327 | int stv0367_writeregs(struct stv0367_state *state, u16 reg, u8 *data, int len) | ||
3328 | { | ||
3329 | - u8 buf[len + 2]; | ||
3330 | + u8 buf[MAX_XFER_SIZE]; | ||
3331 | struct i2c_msg msg = { | ||
3332 | .addr = state->config->demod_address, | ||
3333 | .flags = 0, | ||
3334 | @@ -776,6 +779,14 @@ int stv0367_writeregs(struct stv0367_state *state, u16 reg, u8 *data, int len) | ||
3335 | }; | ||
3336 | int ret; | ||
3337 | |||
3338 | + if (2 + len > sizeof(buf)) { | ||
3339 | + printk(KERN_WARNING | ||
3340 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3341 | + KBUILD_MODNAME, reg, len); | ||
3342 | + return -EINVAL; | ||
3343 | + } | ||
3344 | + | ||
3345 | + | ||
3346 | buf[0] = MSB(reg); | ||
3347 | buf[1] = LSB(reg); | ||
3348 | memcpy(buf + 2, data, len); | ||
3349 | diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c | ||
3350 | index 56d470ad..23e872f8 100644 | ||
3351 | --- a/drivers/media/dvb-frontends/stv090x.c | ||
3352 | +++ b/drivers/media/dvb-frontends/stv090x.c | ||
3353 | @@ -35,6 +35,9 @@ | ||
3354 | #include "stv090x.h" | ||
3355 | #include "stv090x_priv.h" | ||
3356 | |||
3357 | +/* Max transfer size done by I2C transfer functions */ | ||
3358 | +#define MAX_XFER_SIZE 64 | ||
3359 | + | ||
3360 | static unsigned int verbose; | ||
3361 | module_param(verbose, int, 0644); | ||
3362 | |||
3363 | @@ -722,9 +725,16 @@ static int stv090x_write_regs(struct stv090x_state *state, unsigned int reg, u8 | ||
3364 | { | ||
3365 | const struct stv090x_config *config = state->config; | ||
3366 | int ret; | ||
3367 | - u8 buf[2 + count]; | ||
3368 | + u8 buf[MAX_XFER_SIZE]; | ||
3369 | struct i2c_msg i2c_msg = { .addr = config->address, .flags = 0, .buf = buf, .len = 2 + count }; | ||
3370 | |||
3371 | + if (2 + count > sizeof(buf)) { | ||
3372 | + printk(KERN_WARNING | ||
3373 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3374 | + KBUILD_MODNAME, reg, count); | ||
3375 | + return -EINVAL; | ||
3376 | + } | ||
3377 | + | ||
3378 | buf[0] = reg >> 8; | ||
3379 | buf[1] = reg & 0xff; | ||
3380 | memcpy(&buf[2], data, count); | ||
3381 | diff --git a/drivers/media/dvb-frontends/stv6110.c b/drivers/media/dvb-frontends/stv6110.c | ||
3382 | index 20b5fa92..b1425830 100644 | ||
3383 | --- a/drivers/media/dvb-frontends/stv6110.c | ||
3384 | +++ b/drivers/media/dvb-frontends/stv6110.c | ||
3385 | @@ -30,6 +30,9 @@ | ||
3386 | |||
3387 | #include "stv6110.h" | ||
3388 | |||
3389 | +/* Max transfer size done by I2C transfer functions */ | ||
3390 | +#define MAX_XFER_SIZE 64 | ||
3391 | + | ||
3392 | static int debug; | ||
3393 | |||
3394 | struct stv6110_priv { | ||
3395 | @@ -68,7 +71,7 @@ static int stv6110_write_regs(struct dvb_frontend *fe, u8 buf[], | ||
3396 | { | ||
3397 | struct stv6110_priv *priv = fe->tuner_priv; | ||
3398 | int rc; | ||
3399 | - u8 cmdbuf[len + 1]; | ||
3400 | + u8 cmdbuf[MAX_XFER_SIZE]; | ||
3401 | struct i2c_msg msg = { | ||
3402 | .addr = priv->i2c_address, | ||
3403 | .flags = 0, | ||
3404 | @@ -78,6 +81,13 @@ static int stv6110_write_regs(struct dvb_frontend *fe, u8 buf[], | ||
3405 | |||
3406 | dprintk("%s\n", __func__); | ||
3407 | |||
3408 | + if (1 + len > sizeof(cmdbuf)) { | ||
3409 | + printk(KERN_WARNING | ||
3410 | + "%s: i2c wr: len=%d is too big!\n", | ||
3411 | + KBUILD_MODNAME, len); | ||
3412 | + return -EINVAL; | ||
3413 | + } | ||
3414 | + | ||
3415 | if (start + len > 8) | ||
3416 | return -EINVAL; | ||
3417 | |||
3418 | diff --git a/drivers/media/dvb-frontends/stv6110x.c b/drivers/media/dvb-frontends/stv6110x.c | ||
3419 | index f36cab12..e66154e5 100644 | ||
3420 | --- a/drivers/media/dvb-frontends/stv6110x.c | ||
3421 | +++ b/drivers/media/dvb-frontends/stv6110x.c | ||
3422 | @@ -32,6 +32,9 @@ | ||
3423 | #include "stv6110x.h" | ||
3424 | #include "stv6110x_priv.h" | ||
3425 | |||
3426 | +/* Max transfer size done by I2C transfer functions */ | ||
3427 | +#define MAX_XFER_SIZE 64 | ||
3428 | + | ||
3429 | static unsigned int verbose; | ||
3430 | module_param(verbose, int, 0644); | ||
3431 | MODULE_PARM_DESC(verbose, "Set Verbosity level"); | ||
3432 | @@ -61,7 +64,8 @@ static int stv6110x_write_regs(struct stv6110x_state *stv6110x, int start, u8 da | ||
3433 | { | ||
3434 | int ret; | ||
3435 | const struct stv6110x_config *config = stv6110x->config; | ||
3436 | - u8 buf[len + 1]; | ||
3437 | + u8 buf[MAX_XFER_SIZE]; | ||
3438 | + | ||
3439 | struct i2c_msg msg = { | ||
3440 | .addr = config->addr, | ||
3441 | .flags = 0, | ||
3442 | @@ -69,6 +73,13 @@ static int stv6110x_write_regs(struct stv6110x_state *stv6110x, int start, u8 da | ||
3443 | .len = len + 1 | ||
3444 | }; | ||
3445 | |||
3446 | + if (1 + len > sizeof(buf)) { | ||
3447 | + printk(KERN_WARNING | ||
3448 | + "%s: i2c wr: len=%d is too big!\n", | ||
3449 | + KBUILD_MODNAME, len); | ||
3450 | + return -EINVAL; | ||
3451 | + } | ||
3452 | + | ||
3453 | if (start + len > 8) | ||
3454 | return -EINVAL; | ||
3455 | |||
3456 | diff --git a/drivers/media/dvb-frontends/tda10071.c b/drivers/media/dvb-frontends/tda10071.c | ||
3457 | index 2521f7e2..36eb27d3 100644 | ||
3458 | --- a/drivers/media/dvb-frontends/tda10071.c | ||
3459 | +++ b/drivers/media/dvb-frontends/tda10071.c | ||
3460 | @@ -20,6 +20,9 @@ | ||
3461 | |||
3462 | #include "tda10071_priv.h" | ||
3463 | |||
3464 | +/* Max transfer size done by I2C transfer functions */ | ||
3465 | +#define MAX_XFER_SIZE 64 | ||
3466 | + | ||
3467 | static struct dvb_frontend_ops tda10071_ops; | ||
3468 | |||
3469 | /* write multiple registers */ | ||
3470 | @@ -27,16 +30,23 @@ static int tda10071_wr_regs(struct tda10071_priv *priv, u8 reg, u8 *val, | ||
3471 | int len) | ||
3472 | { | ||
3473 | int ret; | ||
3474 | - u8 buf[len+1]; | ||
3475 | + u8 buf[MAX_XFER_SIZE]; | ||
3476 | struct i2c_msg msg[1] = { | ||
3477 | { | ||
3478 | .addr = priv->cfg.demod_i2c_addr, | ||
3479 | .flags = 0, | ||
3480 | - .len = sizeof(buf), | ||
3481 | + .len = 1 + len, | ||
3482 | .buf = buf, | ||
3483 | } | ||
3484 | }; | ||
3485 | |||
3486 | + if (1 + len > sizeof(buf)) { | ||
3487 | + dev_warn(&priv->i2c->dev, | ||
3488 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3489 | + KBUILD_MODNAME, reg, len); | ||
3490 | + return -EINVAL; | ||
3491 | + } | ||
3492 | + | ||
3493 | buf[0] = reg; | ||
3494 | memcpy(&buf[1], val, len); | ||
3495 | |||
3496 | @@ -56,7 +66,7 @@ static int tda10071_rd_regs(struct tda10071_priv *priv, u8 reg, u8 *val, | ||
3497 | int len) | ||
3498 | { | ||
3499 | int ret; | ||
3500 | - u8 buf[len]; | ||
3501 | + u8 buf[MAX_XFER_SIZE]; | ||
3502 | struct i2c_msg msg[2] = { | ||
3503 | { | ||
3504 | .addr = priv->cfg.demod_i2c_addr, | ||
3505 | @@ -66,11 +76,18 @@ static int tda10071_rd_regs(struct tda10071_priv *priv, u8 reg, u8 *val, | ||
3506 | }, { | ||
3507 | .addr = priv->cfg.demod_i2c_addr, | ||
3508 | .flags = I2C_M_RD, | ||
3509 | - .len = sizeof(buf), | ||
3510 | + .len = len, | ||
3511 | .buf = buf, | ||
3512 | } | ||
3513 | }; | ||
3514 | |||
3515 | + if (len > sizeof(buf)) { | ||
3516 | + dev_warn(&priv->i2c->dev, | ||
3517 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3518 | + KBUILD_MODNAME, reg, len); | ||
3519 | + return -EINVAL; | ||
3520 | + } | ||
3521 | + | ||
3522 | ret = i2c_transfer(priv->i2c, msg, 2); | ||
3523 | if (ret == 2) { | ||
3524 | memcpy(val, buf, len); | ||
3525 | diff --git a/drivers/media/dvb-frontends/tda18271c2dd.c b/drivers/media/dvb-frontends/tda18271c2dd.c | ||
3526 | index d281f77d..2c54586a 100644 | ||
3527 | --- a/drivers/media/dvb-frontends/tda18271c2dd.c | ||
3528 | +++ b/drivers/media/dvb-frontends/tda18271c2dd.c | ||
3529 | @@ -34,6 +34,9 @@ | ||
3530 | #include "dvb_frontend.h" | ||
3531 | #include "tda18271c2dd.h" | ||
3532 | |||
3533 | +/* Max transfer size done by I2C transfer functions */ | ||
3534 | +#define MAX_XFER_SIZE 64 | ||
3535 | + | ||
3536 | struct SStandardParam { | ||
3537 | s32 m_IFFrequency; | ||
3538 | u32 m_BandWidth; | ||
3539 | @@ -139,11 +142,18 @@ static int i2c_write(struct i2c_adapter *adap, u8 adr, u8 *data, int len) | ||
3540 | static int WriteRegs(struct tda_state *state, | ||
3541 | u8 SubAddr, u8 *Regs, u16 nRegs) | ||
3542 | { | ||
3543 | - u8 data[nRegs+1]; | ||
3544 | + u8 data[MAX_XFER_SIZE]; | ||
3545 | + | ||
3546 | + if (1 + nRegs > sizeof(data)) { | ||
3547 | + printk(KERN_WARNING | ||
3548 | + "%s: i2c wr: len=%d is too big!\n", | ||
3549 | + KBUILD_MODNAME, nRegs); | ||
3550 | + return -EINVAL; | ||
3551 | + } | ||
3552 | |||
3553 | data[0] = SubAddr; | ||
3554 | memcpy(data + 1, Regs, nRegs); | ||
3555 | - return i2c_write(state->i2c, state->adr, data, nRegs+1); | ||
3556 | + return i2c_write(state->i2c, state->adr, data, nRegs + 1); | ||
3557 | } | ||
3558 | |||
3559 | static int WriteReg(struct tda_state *state, u8 SubAddr, u8 Reg) | ||
3560 | diff --git a/drivers/media/dvb-frontends/zl10039.c b/drivers/media/dvb-frontends/zl10039.c | ||
3561 | index eff9c5fd..91b6b2e9 100644 | ||
3562 | --- a/drivers/media/dvb-frontends/zl10039.c | ||
3563 | +++ b/drivers/media/dvb-frontends/zl10039.c | ||
3564 | @@ -30,6 +30,9 @@ | ||
3565 | |||
3566 | static int debug; | ||
3567 | |||
3568 | +/* Max transfer size done by I2C transfer functions */ | ||
3569 | +#define MAX_XFER_SIZE 64 | ||
3570 | + | ||
3571 | #define dprintk(args...) \ | ||
3572 | do { \ | ||
3573 | if (debug) \ | ||
3574 | @@ -98,7 +101,7 @@ static int zl10039_write(struct zl10039_state *state, | ||
3575 | const enum zl10039_reg_addr reg, const u8 *src, | ||
3576 | const size_t count) | ||
3577 | { | ||
3578 | - u8 buf[count + 1]; | ||
3579 | + u8 buf[MAX_XFER_SIZE]; | ||
3580 | struct i2c_msg msg = { | ||
3581 | .addr = state->i2c_addr, | ||
3582 | .flags = 0, | ||
3583 | @@ -106,6 +109,13 @@ static int zl10039_write(struct zl10039_state *state, | ||
3584 | .len = count + 1, | ||
3585 | }; | ||
3586 | |||
3587 | + if (1 + count > sizeof(buf)) { | ||
3588 | + printk(KERN_WARNING | ||
3589 | + "%s: i2c wr reg=%04x: len=%zd is too big!\n", | ||
3590 | + KBUILD_MODNAME, reg, count); | ||
3591 | + return -EINVAL; | ||
3592 | + } | ||
3593 | + | ||
3594 | dprintk("%s\n", __func__); | ||
3595 | /* Write register address and data in one go */ | ||
3596 | buf[0] = reg; | ||
3597 | diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c | ||
3598 | index 67b61cf3..13c9718a 100644 | ||
3599 | --- a/drivers/media/pci/cx18/cx18-driver.c | ||
3600 | +++ b/drivers/media/pci/cx18/cx18-driver.c | ||
3601 | @@ -324,23 +324,24 @@ static void cx18_eeprom_dump(struct cx18 *cx, unsigned char *eedata, int len) | ||
3602 | /* Hauppauge card? get values from tveeprom */ | ||
3603 | void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) | ||
3604 | { | ||
3605 | - struct i2c_client c; | ||
3606 | + struct i2c_client *c; | ||
3607 | u8 eedata[256]; | ||
3608 | |||
3609 | - memset(&c, 0, sizeof(c)); | ||
3610 | - strlcpy(c.name, "cx18 tveeprom tmp", sizeof(c.name)); | ||
3611 | - c.adapter = &cx->i2c_adap[0]; | ||
3612 | - c.addr = 0xA0 >> 1; | ||
3613 | + c = kzalloc(sizeof(*c), GFP_KERNEL); | ||
3614 | + | ||
3615 | + strlcpy(c->name, "cx18 tveeprom tmp", sizeof(c->name)); | ||
3616 | + c->adapter = &cx->i2c_adap[0]; | ||
3617 | + c->addr = 0xa0 >> 1; | ||
3618 | |||
3619 | memset(tv, 0, sizeof(*tv)); | ||
3620 | - if (tveeprom_read(&c, eedata, sizeof(eedata))) | ||
3621 | - return; | ||
3622 | + if (tveeprom_read(c, eedata, sizeof(eedata))) | ||
3623 | + goto ret; | ||
3624 | |||
3625 | switch (cx->card->type) { | ||
3626 | case CX18_CARD_HVR_1600_ESMT: | ||
3627 | case CX18_CARD_HVR_1600_SAMSUNG: | ||
3628 | case CX18_CARD_HVR_1600_S5H1411: | ||
3629 | - tveeprom_hauppauge_analog(&c, tv, eedata); | ||
3630 | + tveeprom_hauppauge_analog(c, tv, eedata); | ||
3631 | break; | ||
3632 | case CX18_CARD_YUAN_MPC718: | ||
3633 | case CX18_CARD_GOTVIEW_PCI_DVD3: | ||
3634 | @@ -354,6 +355,9 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) | ||
3635 | cx18_eeprom_dump(cx, eedata, sizeof(eedata)); | ||
3636 | break; | ||
3637 | } | ||
3638 | + | ||
3639 | +ret: | ||
3640 | + kfree(c); | ||
3641 | } | ||
3642 | |||
3643 | static void cx18_process_eeprom(struct cx18 *cx) | ||
3644 | diff --git a/drivers/media/pci/cx23885/cimax2.c b/drivers/media/pci/cx23885/cimax2.c | ||
3645 | index 73448491..16fa7ea4 100644 | ||
3646 | --- a/drivers/media/pci/cx23885/cimax2.c | ||
3647 | +++ b/drivers/media/pci/cx23885/cimax2.c | ||
3648 | @@ -26,6 +26,10 @@ | ||
3649 | #include "cx23885.h" | ||
3650 | #include "cimax2.h" | ||
3651 | #include "dvb_ca_en50221.h" | ||
3652 | + | ||
3653 | +/* Max transfer size done by I2C transfer functions */ | ||
3654 | +#define MAX_XFER_SIZE 64 | ||
3655 | + | ||
3656 | /**** Bit definitions for MC417_RWD and MC417_OEN registers *** | ||
3657 | bits 31-16 | ||
3658 | +-----------+ | ||
3659 | @@ -125,7 +129,7 @@ static int netup_write_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, | ||
3660 | u8 *buf, int len) | ||
3661 | { | ||
3662 | int ret; | ||
3663 | - u8 buffer[len + 1]; | ||
3664 | + u8 buffer[MAX_XFER_SIZE]; | ||
3665 | |||
3666 | struct i2c_msg msg = { | ||
3667 | .addr = addr, | ||
3668 | @@ -134,6 +138,13 @@ static int netup_write_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, | ||
3669 | .len = len + 1 | ||
3670 | }; | ||
3671 | |||
3672 | + if (1 + len > sizeof(buffer)) { | ||
3673 | + printk(KERN_WARNING | ||
3674 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3675 | + KBUILD_MODNAME, reg, len); | ||
3676 | + return -EINVAL; | ||
3677 | + } | ||
3678 | + | ||
3679 | buffer[0] = reg; | ||
3680 | memcpy(&buffer[1], buf, len); | ||
3681 | |||
3682 | diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c | ||
3683 | index 9c5ed10b..bb291c66 100644 | ||
3684 | --- a/drivers/media/pci/cx23885/cx23885-dvb.c | ||
3685 | +++ b/drivers/media/pci/cx23885/cx23885-dvb.c | ||
3686 | @@ -1249,6 +1249,10 @@ static int dvb_register(struct cx23885_tsport *port) | ||
3687 | fe0->dvb.frontend = dvb_attach(ds3000_attach, | ||
3688 | &tevii_ds3000_config, | ||
3689 | &i2c_bus->i2c_adap); | ||
3690 | + if (fe0->dvb.frontend != NULL) { | ||
3691 | + dvb_attach(ts2020_attach, fe0->dvb.frontend, | ||
3692 | + &tevii_ts2020_config, &i2c_bus->i2c_adap); | ||
3693 | + } | ||
3694 | break; | ||
3695 | case CX23885_BOARD_PROF_8000: | ||
3696 | i2c_bus = &dev->i2c_bus[0]; | ||
3697 | diff --git a/drivers/media/pci/ttpci/av7110_hw.c b/drivers/media/pci/ttpci/av7110_hw.c | ||
3698 | index f1cbfe52..6299d5da 100644 | ||
3699 | --- a/drivers/media/pci/ttpci/av7110_hw.c | ||
3700 | +++ b/drivers/media/pci/ttpci/av7110_hw.c | ||
3701 | @@ -22,7 +22,7 @@ | ||
3702 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
3703 | * Or, point your browser to http://www.gnu.org/copyleft/gpl.html | ||
3704 | * | ||
3705 | - * the project's page is at http://www.linuxtv.org/ | ||
3706 | + * the project's page is at http://www.linuxtv.org/ | ||
3707 | */ | ||
3708 | |||
3709 | /* for debugging ARM communication: */ | ||
3710 | @@ -40,6 +40,14 @@ | ||
3711 | |||
3712 | #define _NOHANDSHAKE | ||
3713 | |||
3714 | +/* | ||
3715 | + * Max transfer size done by av7110_fw_cmd() | ||
3716 | + * | ||
3717 | + * The maximum size passed to this function is 6 bytes. The buffer also | ||
3718 | + * uses two additional ones for type and size. So, 8 bytes is enough. | ||
3719 | + */ | ||
3720 | +#define MAX_XFER_SIZE 8 | ||
3721 | + | ||
3722 | /**************************************************************************** | ||
3723 | * DEBI functions | ||
3724 | ****************************************************************************/ | ||
3725 | @@ -488,11 +496,18 @@ static int av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | ||
3726 | int av7110_fw_cmd(struct av7110 *av7110, int type, int com, int num, ...) | ||
3727 | { | ||
3728 | va_list args; | ||
3729 | - u16 buf[num + 2]; | ||
3730 | + u16 buf[MAX_XFER_SIZE]; | ||
3731 | int i, ret; | ||
3732 | |||
3733 | // dprintk(4, "%p\n", av7110); | ||
3734 | |||
3735 | + if (2 + num > sizeof(buf)) { | ||
3736 | + printk(KERN_WARNING | ||
3737 | + "%s: %s len=%d is too big!\n", | ||
3738 | + KBUILD_MODNAME, __func__, num); | ||
3739 | + return -EINVAL; | ||
3740 | + } | ||
3741 | + | ||
3742 | buf[0] = ((type << 8) | com); | ||
3743 | buf[1] = num; | ||
3744 | |||
3745 | diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c | ||
3746 | index 1b33ed36..c4ce4500 100644 | ||
3747 | --- a/drivers/media/tuners/e4000.c | ||
3748 | +++ b/drivers/media/tuners/e4000.c | ||
3749 | @@ -20,20 +20,30 @@ | ||
3750 | |||
3751 | #include "e4000_priv.h" | ||
3752 | |||
3753 | +/* Max transfer size done by I2C transfer functions */ | ||
3754 | +#define MAX_XFER_SIZE 64 | ||
3755 | + | ||
3756 | /* write multiple registers */ | ||
3757 | static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) | ||
3758 | { | ||
3759 | int ret; | ||
3760 | - u8 buf[1 + len]; | ||
3761 | + u8 buf[MAX_XFER_SIZE]; | ||
3762 | struct i2c_msg msg[1] = { | ||
3763 | { | ||
3764 | .addr = priv->cfg->i2c_addr, | ||
3765 | .flags = 0, | ||
3766 | - .len = sizeof(buf), | ||
3767 | + .len = 1 + len, | ||
3768 | .buf = buf, | ||
3769 | } | ||
3770 | }; | ||
3771 | |||
3772 | + if (1 + len > sizeof(buf)) { | ||
3773 | + dev_warn(&priv->i2c->dev, | ||
3774 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3775 | + KBUILD_MODNAME, reg, len); | ||
3776 | + return -EINVAL; | ||
3777 | + } | ||
3778 | + | ||
3779 | buf[0] = reg; | ||
3780 | memcpy(&buf[1], val, len); | ||
3781 | |||
3782 | @@ -52,7 +62,7 @@ static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) | ||
3783 | static int e4000_rd_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) | ||
3784 | { | ||
3785 | int ret; | ||
3786 | - u8 buf[len]; | ||
3787 | + u8 buf[MAX_XFER_SIZE]; | ||
3788 | struct i2c_msg msg[2] = { | ||
3789 | { | ||
3790 | .addr = priv->cfg->i2c_addr, | ||
3791 | @@ -62,11 +72,18 @@ static int e4000_rd_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) | ||
3792 | }, { | ||
3793 | .addr = priv->cfg->i2c_addr, | ||
3794 | .flags = I2C_M_RD, | ||
3795 | - .len = sizeof(buf), | ||
3796 | + .len = len, | ||
3797 | .buf = buf, | ||
3798 | } | ||
3799 | }; | ||
3800 | |||
3801 | + if (len > sizeof(buf)) { | ||
3802 | + dev_warn(&priv->i2c->dev, | ||
3803 | + "%s: i2c rd reg=%04x: len=%d is too big!\n", | ||
3804 | + KBUILD_MODNAME, reg, len); | ||
3805 | + return -EINVAL; | ||
3806 | + } | ||
3807 | + | ||
3808 | ret = i2c_transfer(priv->i2c, msg, 2); | ||
3809 | if (ret == 2) { | ||
3810 | memcpy(val, buf, len); | ||
3811 | diff --git a/drivers/media/tuners/fc2580.c b/drivers/media/tuners/fc2580.c | ||
3812 | index 81f38aae..3aecaf46 100644 | ||
3813 | --- a/drivers/media/tuners/fc2580.c | ||
3814 | +++ b/drivers/media/tuners/fc2580.c | ||
3815 | @@ -20,6 +20,9 @@ | ||
3816 | |||
3817 | #include "fc2580_priv.h" | ||
3818 | |||
3819 | +/* Max transfer size done by I2C transfer functions */ | ||
3820 | +#define MAX_XFER_SIZE 64 | ||
3821 | + | ||
3822 | /* | ||
3823 | * TODO: | ||
3824 | * I2C write and read works only for one single register. Multiple registers | ||
3825 | @@ -41,16 +44,23 @@ | ||
3826 | static int fc2580_wr_regs(struct fc2580_priv *priv, u8 reg, u8 *val, int len) | ||
3827 | { | ||
3828 | int ret; | ||
3829 | - u8 buf[1 + len]; | ||
3830 | + u8 buf[MAX_XFER_SIZE]; | ||
3831 | struct i2c_msg msg[1] = { | ||
3832 | { | ||
3833 | .addr = priv->cfg->i2c_addr, | ||
3834 | .flags = 0, | ||
3835 | - .len = sizeof(buf), | ||
3836 | + .len = 1 + len, | ||
3837 | .buf = buf, | ||
3838 | } | ||
3839 | }; | ||
3840 | |||
3841 | + if (1 + len > sizeof(buf)) { | ||
3842 | + dev_warn(&priv->i2c->dev, | ||
3843 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3844 | + KBUILD_MODNAME, reg, len); | ||
3845 | + return -EINVAL; | ||
3846 | + } | ||
3847 | + | ||
3848 | buf[0] = reg; | ||
3849 | memcpy(&buf[1], val, len); | ||
3850 | |||
3851 | @@ -69,7 +79,7 @@ static int fc2580_wr_regs(struct fc2580_priv *priv, u8 reg, u8 *val, int len) | ||
3852 | static int fc2580_rd_regs(struct fc2580_priv *priv, u8 reg, u8 *val, int len) | ||
3853 | { | ||
3854 | int ret; | ||
3855 | - u8 buf[len]; | ||
3856 | + u8 buf[MAX_XFER_SIZE]; | ||
3857 | struct i2c_msg msg[2] = { | ||
3858 | { | ||
3859 | .addr = priv->cfg->i2c_addr, | ||
3860 | @@ -79,11 +89,18 @@ static int fc2580_rd_regs(struct fc2580_priv *priv, u8 reg, u8 *val, int len) | ||
3861 | }, { | ||
3862 | .addr = priv->cfg->i2c_addr, | ||
3863 | .flags = I2C_M_RD, | ||
3864 | - .len = sizeof(buf), | ||
3865 | + .len = len, | ||
3866 | .buf = buf, | ||
3867 | } | ||
3868 | }; | ||
3869 | |||
3870 | + if (len > sizeof(buf)) { | ||
3871 | + dev_warn(&priv->i2c->dev, | ||
3872 | + "%s: i2c rd reg=%04x: len=%d is too big!\n", | ||
3873 | + KBUILD_MODNAME, reg, len); | ||
3874 | + return -EINVAL; | ||
3875 | + } | ||
3876 | + | ||
3877 | ret = i2c_transfer(priv->i2c, msg, 2); | ||
3878 | if (ret == 2) { | ||
3879 | memcpy(val, buf, len); | ||
3880 | diff --git a/drivers/media/tuners/tda18212.c b/drivers/media/tuners/tda18212.c | ||
3881 | index e4a84ee2..abe256e1 100644 | ||
3882 | --- a/drivers/media/tuners/tda18212.c | ||
3883 | +++ b/drivers/media/tuners/tda18212.c | ||
3884 | @@ -20,6 +20,9 @@ | ||
3885 | |||
3886 | #include "tda18212.h" | ||
3887 | |||
3888 | +/* Max transfer size done by I2C transfer functions */ | ||
3889 | +#define MAX_XFER_SIZE 64 | ||
3890 | + | ||
3891 | struct tda18212_priv { | ||
3892 | struct tda18212_config *cfg; | ||
3893 | struct i2c_adapter *i2c; | ||
3894 | @@ -32,16 +35,23 @@ static int tda18212_wr_regs(struct tda18212_priv *priv, u8 reg, u8 *val, | ||
3895 | int len) | ||
3896 | { | ||
3897 | int ret; | ||
3898 | - u8 buf[len+1]; | ||
3899 | + u8 buf[MAX_XFER_SIZE]; | ||
3900 | struct i2c_msg msg[1] = { | ||
3901 | { | ||
3902 | .addr = priv->cfg->i2c_address, | ||
3903 | .flags = 0, | ||
3904 | - .len = sizeof(buf), | ||
3905 | + .len = 1 + len, | ||
3906 | .buf = buf, | ||
3907 | } | ||
3908 | }; | ||
3909 | |||
3910 | + if (1 + len > sizeof(buf)) { | ||
3911 | + dev_warn(&priv->i2c->dev, | ||
3912 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3913 | + KBUILD_MODNAME, reg, len); | ||
3914 | + return -EINVAL; | ||
3915 | + } | ||
3916 | + | ||
3917 | buf[0] = reg; | ||
3918 | memcpy(&buf[1], val, len); | ||
3919 | |||
3920 | @@ -61,7 +71,7 @@ static int tda18212_rd_regs(struct tda18212_priv *priv, u8 reg, u8 *val, | ||
3921 | int len) | ||
3922 | { | ||
3923 | int ret; | ||
3924 | - u8 buf[len]; | ||
3925 | + u8 buf[MAX_XFER_SIZE]; | ||
3926 | struct i2c_msg msg[2] = { | ||
3927 | { | ||
3928 | .addr = priv->cfg->i2c_address, | ||
3929 | @@ -71,11 +81,18 @@ static int tda18212_rd_regs(struct tda18212_priv *priv, u8 reg, u8 *val, | ||
3930 | }, { | ||
3931 | .addr = priv->cfg->i2c_address, | ||
3932 | .flags = I2C_M_RD, | ||
3933 | - .len = sizeof(buf), | ||
3934 | + .len = len, | ||
3935 | .buf = buf, | ||
3936 | } | ||
3937 | }; | ||
3938 | |||
3939 | + if (len > sizeof(buf)) { | ||
3940 | + dev_warn(&priv->i2c->dev, | ||
3941 | + "%s: i2c rd reg=%04x: len=%d is too big!\n", | ||
3942 | + KBUILD_MODNAME, reg, len); | ||
3943 | + return -EINVAL; | ||
3944 | + } | ||
3945 | + | ||
3946 | ret = i2c_transfer(priv->i2c, msg, 2); | ||
3947 | if (ret == 2) { | ||
3948 | memcpy(val, buf, len); | ||
3949 | diff --git a/drivers/media/tuners/tda18218.c b/drivers/media/tuners/tda18218.c | ||
3950 | index 2d31aeb6..9300e936 100644 | ||
3951 | --- a/drivers/media/tuners/tda18218.c | ||
3952 | +++ b/drivers/media/tuners/tda18218.c | ||
3953 | @@ -20,11 +20,14 @@ | ||
3954 | |||
3955 | #include "tda18218_priv.h" | ||
3956 | |||
3957 | +/* Max transfer size done by I2C transfer functions */ | ||
3958 | +#define MAX_XFER_SIZE 64 | ||
3959 | + | ||
3960 | /* write multiple registers */ | ||
3961 | static int tda18218_wr_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) | ||
3962 | { | ||
3963 | int ret = 0, len2, remaining; | ||
3964 | - u8 buf[1 + len]; | ||
3965 | + u8 buf[MAX_XFER_SIZE]; | ||
3966 | struct i2c_msg msg[1] = { | ||
3967 | { | ||
3968 | .addr = priv->cfg->i2c_address, | ||
3969 | @@ -33,6 +36,13 @@ static int tda18218_wr_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) | ||
3970 | } | ||
3971 | }; | ||
3972 | |||
3973 | + if (1 + len > sizeof(buf)) { | ||
3974 | + dev_warn(&priv->i2c->dev, | ||
3975 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
3976 | + KBUILD_MODNAME, reg, len); | ||
3977 | + return -EINVAL; | ||
3978 | + } | ||
3979 | + | ||
3980 | for (remaining = len; remaining > 0; | ||
3981 | remaining -= (priv->cfg->i2c_wr_max - 1)) { | ||
3982 | len2 = remaining; | ||
3983 | @@ -63,7 +73,7 @@ static int tda18218_wr_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) | ||
3984 | static int tda18218_rd_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) | ||
3985 | { | ||
3986 | int ret; | ||
3987 | - u8 buf[reg+len]; /* we must start read always from reg 0x00 */ | ||
3988 | + u8 buf[MAX_XFER_SIZE]; /* we must start read always from reg 0x00 */ | ||
3989 | struct i2c_msg msg[2] = { | ||
3990 | { | ||
3991 | .addr = priv->cfg->i2c_address, | ||
3992 | @@ -73,11 +83,18 @@ static int tda18218_rd_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) | ||
3993 | }, { | ||
3994 | .addr = priv->cfg->i2c_address, | ||
3995 | .flags = I2C_M_RD, | ||
3996 | - .len = sizeof(buf), | ||
3997 | + .len = reg + len, | ||
3998 | .buf = buf, | ||
3999 | } | ||
4000 | }; | ||
4001 | |||
4002 | + if (reg + len > sizeof(buf)) { | ||
4003 | + dev_warn(&priv->i2c->dev, | ||
4004 | + "%s: i2c wr reg=%04x: len=%d is too big!\n", | ||
4005 | + KBUILD_MODNAME, reg, len); | ||
4006 | + return -EINVAL; | ||
4007 | + } | ||
4008 | + | ||
4009 | ret = i2c_transfer(priv->i2c, msg, 2); | ||
4010 | if (ret == 2) { | ||
4011 | memcpy(val, &buf[reg], len); | ||
4012 | diff --git a/drivers/media/tuners/tuner-xc2028.c b/drivers/media/tuners/tuner-xc2028.c | ||
4013 | index 878d2c4d..9771cd83 100644 | ||
4014 | --- a/drivers/media/tuners/tuner-xc2028.c | ||
4015 | +++ b/drivers/media/tuners/tuner-xc2028.c | ||
4016 | @@ -24,6 +24,9 @@ | ||
4017 | #include <linux/dvb/frontend.h> | ||
4018 | #include "dvb_frontend.h" | ||
4019 | |||
4020 | +/* Max transfer size done by I2C transfer functions */ | ||
4021 | +#define MAX_XFER_SIZE 80 | ||
4022 | + | ||
4023 | /* Registers (Write-only) */ | ||
4024 | #define XREG_INIT 0x00 | ||
4025 | #define XREG_RF_FREQ 0x02 | ||
4026 | @@ -547,7 +550,10 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, | ||
4027 | { | ||
4028 | struct xc2028_data *priv = fe->tuner_priv; | ||
4029 | int pos, rc; | ||
4030 | - unsigned char *p, *endp, buf[priv->ctrl.max_len]; | ||
4031 | + unsigned char *p, *endp, buf[MAX_XFER_SIZE]; | ||
4032 | + | ||
4033 | + if (priv->ctrl.max_len > sizeof(buf)) | ||
4034 | + priv->ctrl.max_len = sizeof(buf); | ||
4035 | |||
4036 | tuner_dbg("%s called\n", __func__); | ||
4037 | |||
4038 | diff --git a/drivers/media/usb/dvb-usb-v2/af9015.c b/drivers/media/usb/dvb-usb-v2/af9015.c | ||
4039 | index d556042c..da47d239 100644 | ||
4040 | --- a/drivers/media/usb/dvb-usb-v2/af9015.c | ||
4041 | +++ b/drivers/media/usb/dvb-usb-v2/af9015.c | ||
4042 | @@ -397,12 +397,13 @@ error: | ||
4043 | return ret; | ||
4044 | } | ||
4045 | |||
4046 | +#define AF9015_EEPROM_SIZE 256 | ||
4047 | + | ||
4048 | /* hash (and dump) eeprom */ | ||
4049 | static int af9015_eeprom_hash(struct dvb_usb_device *d) | ||
4050 | { | ||
4051 | struct af9015_state *state = d_to_priv(d); | ||
4052 | int ret, i; | ||
4053 | - static const unsigned int AF9015_EEPROM_SIZE = 256; | ||
4054 | u8 buf[AF9015_EEPROM_SIZE]; | ||
4055 | struct req_t req = {READ_I2C, AF9015_I2C_EEPROM, 0, 0, 1, 1, NULL}; | ||
4056 | |||
4057 | diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c | ||
4058 | index b638fc1c..3968bff3 100644 | ||
4059 | --- a/drivers/media/usb/dvb-usb-v2/af9035.c | ||
4060 | +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | ||
4061 | @@ -21,6 +21,9 @@ | ||
4062 | |||
4063 | #include "af9035.h" | ||
4064 | |||
4065 | +/* Max transfer size done by I2C transfer functions */ | ||
4066 | +#define MAX_XFER_SIZE 64 | ||
4067 | + | ||
4068 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
4069 | |||
4070 | static u16 af9035_checksum(const u8 *buf, size_t len) | ||
4071 | @@ -125,10 +128,16 @@ exit: | ||
4072 | /* write multiple registers */ | ||
4073 | static int af9035_wr_regs(struct dvb_usb_device *d, u32 reg, u8 *val, int len) | ||
4074 | { | ||
4075 | - u8 wbuf[6 + len]; | ||
4076 | + u8 wbuf[MAX_XFER_SIZE]; | ||
4077 | u8 mbox = (reg >> 16) & 0xff; | ||
4078 | struct usb_req req = { CMD_MEM_WR, mbox, sizeof(wbuf), wbuf, 0, NULL }; | ||
4079 | |||
4080 | + if (6 + len > sizeof(wbuf)) { | ||
4081 | + dev_warn(&d->udev->dev, "%s: i2c wr: len=%d is too big!\n", | ||
4082 | + KBUILD_MODNAME, len); | ||
4083 | + return -EOPNOTSUPP; | ||
4084 | + } | ||
4085 | + | ||
4086 | wbuf[0] = len; | ||
4087 | wbuf[1] = 2; | ||
4088 | wbuf[2] = 0; | ||
4089 | @@ -227,9 +236,16 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, | ||
4090 | msg[1].len); | ||
4091 | } else { | ||
4092 | /* I2C */ | ||
4093 | - u8 buf[5 + msg[0].len]; | ||
4094 | + u8 buf[MAX_XFER_SIZE]; | ||
4095 | struct usb_req req = { CMD_I2C_RD, 0, sizeof(buf), | ||
4096 | buf, msg[1].len, msg[1].buf }; | ||
4097 | + | ||
4098 | + if (5 + msg[0].len > sizeof(buf)) { | ||
4099 | + dev_warn(&d->udev->dev, | ||
4100 | + "%s: i2c xfer: len=%d is too big!\n", | ||
4101 | + KBUILD_MODNAME, msg[0].len); | ||
4102 | + return -EOPNOTSUPP; | ||
4103 | + } | ||
4104 | req.mbox |= ((msg[0].addr & 0x80) >> 3); | ||
4105 | buf[0] = msg[1].len; | ||
4106 | buf[1] = msg[0].addr << 1; | ||
4107 | @@ -256,9 +272,16 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, | ||
4108 | msg[0].len - 3); | ||
4109 | } else { | ||
4110 | /* I2C */ | ||
4111 | - u8 buf[5 + msg[0].len]; | ||
4112 | + u8 buf[MAX_XFER_SIZE]; | ||
4113 | struct usb_req req = { CMD_I2C_WR, 0, sizeof(buf), buf, | ||
4114 | 0, NULL }; | ||
4115 | + | ||
4116 | + if (5 + msg[0].len > sizeof(buf)) { | ||
4117 | + dev_warn(&d->udev->dev, | ||
4118 | + "%s: i2c xfer: len=%d is too big!\n", | ||
4119 | + KBUILD_MODNAME, msg[0].len); | ||
4120 | + return -EOPNOTSUPP; | ||
4121 | + } | ||
4122 | req.mbox |= ((msg[0].addr & 0x80) >> 3); | ||
4123 | buf[0] = msg[0].len; | ||
4124 | buf[1] = msg[0].addr << 1; | ||
4125 | diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf.c b/drivers/media/usb/dvb-usb-v2/mxl111sf.c | ||
4126 | index efdcb153..419a7c7e 100644 | ||
4127 | --- a/drivers/media/usb/dvb-usb-v2/mxl111sf.c | ||
4128 | +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf.c | ||
4129 | @@ -23,6 +23,9 @@ | ||
4130 | #include "lgdt3305.h" | ||
4131 | #include "lg2160.h" | ||
4132 | |||
4133 | +/* Max transfer size done by I2C transfer functions */ | ||
4134 | +#define MAX_XFER_SIZE 64 | ||
4135 | + | ||
4136 | int dvb_usb_mxl111sf_debug; | ||
4137 | module_param_named(debug, dvb_usb_mxl111sf_debug, int, 0644); | ||
4138 | MODULE_PARM_DESC(debug, "set debugging level " | ||
4139 | @@ -63,7 +66,12 @@ int mxl111sf_ctrl_msg(struct dvb_usb_device *d, | ||
4140 | { | ||
4141 | int wo = (rbuf == NULL || rlen == 0); /* write-only */ | ||
4142 | int ret; | ||
4143 | - u8 sndbuf[1+wlen]; | ||
4144 | + u8 sndbuf[MAX_XFER_SIZE]; | ||
4145 | + | ||
4146 | + if (1 + wlen > sizeof(sndbuf)) { | ||
4147 | + pr_warn("%s: len=%d is too big!\n", __func__, wlen); | ||
4148 | + return -EOPNOTSUPP; | ||
4149 | + } | ||
4150 | |||
4151 | deb_adv("%s(wlen = %d, rlen = %d)\n", __func__, wlen, rlen); | ||
4152 | |||
4153 | diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c | ||
4154 | index 3940bb0f..20e345d9 100644 | ||
4155 | --- a/drivers/media/usb/dvb-usb/cxusb.c | ||
4156 | +++ b/drivers/media/usb/dvb-usb/cxusb.c | ||
4157 | @@ -43,6 +43,9 @@ | ||
4158 | #include "lgs8gxx.h" | ||
4159 | #include "atbm8830.h" | ||
4160 | |||
4161 | +/* Max transfer size done by I2C transfer functions */ | ||
4162 | +#define MAX_XFER_SIZE 64 | ||
4163 | + | ||
4164 | /* debug */ | ||
4165 | static int dvb_usb_cxusb_debug; | ||
4166 | module_param_named(debug, dvb_usb_cxusb_debug, int, 0644); | ||
4167 | @@ -57,7 +60,14 @@ static int cxusb_ctrl_msg(struct dvb_usb_device *d, | ||
4168 | u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) | ||
4169 | { | ||
4170 | int wo = (rbuf == NULL || rlen == 0); /* write-only */ | ||
4171 | - u8 sndbuf[1+wlen]; | ||
4172 | + u8 sndbuf[MAX_XFER_SIZE]; | ||
4173 | + | ||
4174 | + if (1 + wlen > sizeof(sndbuf)) { | ||
4175 | + warn("i2c wr: len=%d is too big!\n", | ||
4176 | + wlen); | ||
4177 | + return -EOPNOTSUPP; | ||
4178 | + } | ||
4179 | + | ||
4180 | memset(sndbuf, 0, 1+wlen); | ||
4181 | |||
4182 | sndbuf[0] = cmd; | ||
4183 | @@ -158,7 +168,13 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], | ||
4184 | |||
4185 | if (msg[i].flags & I2C_M_RD) { | ||
4186 | /* read only */ | ||
4187 | - u8 obuf[3], ibuf[1+msg[i].len]; | ||
4188 | + u8 obuf[3], ibuf[MAX_XFER_SIZE]; | ||
4189 | + | ||
4190 | + if (1 + msg[i].len > sizeof(ibuf)) { | ||
4191 | + warn("i2c rd: len=%d is too big!\n", | ||
4192 | + msg[i].len); | ||
4193 | + return -EOPNOTSUPP; | ||
4194 | + } | ||
4195 | obuf[0] = 0; | ||
4196 | obuf[1] = msg[i].len; | ||
4197 | obuf[2] = msg[i].addr; | ||
4198 | @@ -172,7 +188,18 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], | ||
4199 | } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) && | ||
4200 | msg[i].addr == msg[i+1].addr) { | ||
4201 | /* write to then read from same address */ | ||
4202 | - u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len]; | ||
4203 | + u8 obuf[MAX_XFER_SIZE], ibuf[MAX_XFER_SIZE]; | ||
4204 | + | ||
4205 | + if (3 + msg[i].len > sizeof(obuf)) { | ||
4206 | + warn("i2c wr: len=%d is too big!\n", | ||
4207 | + msg[i].len); | ||
4208 | + return -EOPNOTSUPP; | ||
4209 | + } | ||
4210 | + if (1 + msg[i + 1].len > sizeof(ibuf)) { | ||
4211 | + warn("i2c rd: len=%d is too big!\n", | ||
4212 | + msg[i + 1].len); | ||
4213 | + return -EOPNOTSUPP; | ||
4214 | + } | ||
4215 | obuf[0] = msg[i].len; | ||
4216 | obuf[1] = msg[i+1].len; | ||
4217 | obuf[2] = msg[i].addr; | ||
4218 | @@ -191,7 +218,13 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], | ||
4219 | i++; | ||
4220 | } else { | ||
4221 | /* write only */ | ||
4222 | - u8 obuf[2+msg[i].len], ibuf; | ||
4223 | + u8 obuf[MAX_XFER_SIZE], ibuf; | ||
4224 | + | ||
4225 | + if (2 + msg[i].len > sizeof(obuf)) { | ||
4226 | + warn("i2c wr: len=%d is too big!\n", | ||
4227 | + msg[i].len); | ||
4228 | + return -EOPNOTSUPP; | ||
4229 | + } | ||
4230 | obuf[0] = msg[i].addr; | ||
4231 | obuf[1] = msg[i].len; | ||
4232 | memcpy(&obuf[2], msg[i].buf, msg[i].len); | ||
4233 | diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c | ||
4234 | index c2dded92..6d68af0c 100644 | ||
4235 | --- a/drivers/media/usb/dvb-usb/dibusb-common.c | ||
4236 | +++ b/drivers/media/usb/dvb-usb/dibusb-common.c | ||
4237 | @@ -12,6 +12,9 @@ | ||
4238 | #include <linux/kconfig.h> | ||
4239 | #include "dibusb.h" | ||
4240 | |||
4241 | +/* Max transfer size done by I2C transfer functions */ | ||
4242 | +#define MAX_XFER_SIZE 64 | ||
4243 | + | ||
4244 | static int debug; | ||
4245 | module_param(debug, int, 0644); | ||
4246 | MODULE_PARM_DESC(debug, "set debugging level (1=info (|-able))." DVB_USB_DEBUG_STATUS); | ||
4247 | @@ -105,11 +108,16 @@ EXPORT_SYMBOL(dibusb2_0_power_ctrl); | ||
4248 | static int dibusb_i2c_msg(struct dvb_usb_device *d, u8 addr, | ||
4249 | u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) | ||
4250 | { | ||
4251 | - u8 sndbuf[wlen+4]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */ | ||
4252 | + u8 sndbuf[MAX_XFER_SIZE]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */ | ||
4253 | /* write only ? */ | ||
4254 | int wo = (rbuf == NULL || rlen == 0), | ||
4255 | len = 2 + wlen + (wo ? 0 : 2); | ||
4256 | |||
4257 | + if (4 + wlen > sizeof(sndbuf)) { | ||
4258 | + warn("i2c wr: len=%d is too big!\n", wlen); | ||
4259 | + return -EOPNOTSUPP; | ||
4260 | + } | ||
4261 | + | ||
4262 | sndbuf[0] = wo ? DIBUSB_REQ_I2C_WRITE : DIBUSB_REQ_I2C_READ; | ||
4263 | sndbuf[1] = (addr << 1) | (wo ? 0 : 1); | ||
4264 | |||
4265 | diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c | ||
4266 | index 6e237b6d..71b22f5a 100644 | ||
4267 | --- a/drivers/media/usb/dvb-usb/dw2102.c | ||
4268 | +++ b/drivers/media/usb/dvb-usb/dw2102.c | ||
4269 | @@ -30,6 +30,9 @@ | ||
4270 | #include "stb6100_proc.h" | ||
4271 | #include "m88rs2000.h" | ||
4272 | |||
4273 | +/* Max transfer size done by I2C transfer functions */ | ||
4274 | +#define MAX_XFER_SIZE 64 | ||
4275 | + | ||
4276 | #ifndef USB_PID_DW2102 | ||
4277 | #define USB_PID_DW2102 0x2102 | ||
4278 | #endif | ||
4279 | @@ -308,7 +311,14 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg ms | ||
4280 | case 2: { | ||
4281 | /* read */ | ||
4282 | /* first write first register number */ | ||
4283 | - u8 ibuf[msg[1].len + 2], obuf[3]; | ||
4284 | + u8 ibuf[MAX_XFER_SIZE], obuf[3]; | ||
4285 | + | ||
4286 | + if (2 + msg[1].len > sizeof(ibuf)) { | ||
4287 | + warn("i2c rd: len=%d is too big!\n", | ||
4288 | + msg[1].len); | ||
4289 | + return -EOPNOTSUPP; | ||
4290 | + } | ||
4291 | + | ||
4292 | obuf[0] = msg[0].addr << 1; | ||
4293 | obuf[1] = msg[0].len; | ||
4294 | obuf[2] = msg[0].buf[0]; | ||
4295 | @@ -325,7 +335,14 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg ms | ||
4296 | switch (msg[0].addr) { | ||
4297 | case 0x68: { | ||
4298 | /* write to register */ | ||
4299 | - u8 obuf[msg[0].len + 2]; | ||
4300 | + u8 obuf[MAX_XFER_SIZE]; | ||
4301 | + | ||
4302 | + if (2 + msg[0].len > sizeof(obuf)) { | ||
4303 | + warn("i2c wr: len=%d is too big!\n", | ||
4304 | + msg[1].len); | ||
4305 | + return -EOPNOTSUPP; | ||
4306 | + } | ||
4307 | + | ||
4308 | obuf[0] = msg[0].addr << 1; | ||
4309 | obuf[1] = msg[0].len; | ||
4310 | memcpy(obuf + 2, msg[0].buf, msg[0].len); | ||
4311 | @@ -335,7 +352,14 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg ms | ||
4312 | } | ||
4313 | case 0x61: { | ||
4314 | /* write to tuner */ | ||
4315 | - u8 obuf[msg[0].len + 2]; | ||
4316 | + u8 obuf[MAX_XFER_SIZE]; | ||
4317 | + | ||
4318 | + if (2 + msg[0].len > sizeof(obuf)) { | ||
4319 | + warn("i2c wr: len=%d is too big!\n", | ||
4320 | + msg[1].len); | ||
4321 | + return -EOPNOTSUPP; | ||
4322 | + } | ||
4323 | + | ||
4324 | obuf[0] = msg[0].addr << 1; | ||
4325 | obuf[1] = msg[0].len; | ||
4326 | memcpy(obuf + 2, msg[0].buf, msg[0].len); | ||
4327 | @@ -401,7 +425,14 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], i | ||
4328 | default: { | ||
4329 | if (msg[j].flags == I2C_M_RD) { | ||
4330 | /* read registers */ | ||
4331 | - u8 ibuf[msg[j].len + 2]; | ||
4332 | + u8 ibuf[MAX_XFER_SIZE]; | ||
4333 | + | ||
4334 | + if (2 + msg[j].len > sizeof(ibuf)) { | ||
4335 | + warn("i2c rd: len=%d is too big!\n", | ||
4336 | + msg[j].len); | ||
4337 | + return -EOPNOTSUPP; | ||
4338 | + } | ||
4339 | + | ||
4340 | dw210x_op_rw(d->udev, 0xc3, | ||
4341 | (msg[j].addr << 1) + 1, 0, | ||
4342 | ibuf, msg[j].len + 2, | ||
4343 | @@ -430,7 +461,14 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], i | ||
4344 | } while (len > 0); | ||
4345 | } else { | ||
4346 | /* write registers */ | ||
4347 | - u8 obuf[msg[j].len + 2]; | ||
4348 | + u8 obuf[MAX_XFER_SIZE]; | ||
4349 | + | ||
4350 | + if (2 + msg[j].len > sizeof(obuf)) { | ||
4351 | + warn("i2c wr: len=%d is too big!\n", | ||
4352 | + msg[j].len); | ||
4353 | + return -EOPNOTSUPP; | ||
4354 | + } | ||
4355 | + | ||
4356 | obuf[0] = msg[j].addr << 1; | ||
4357 | obuf[1] = msg[j].len; | ||
4358 | memcpy(obuf + 2, msg[j].buf, msg[j].len); | ||
4359 | @@ -463,7 +501,13 @@ static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | ||
4360 | case 2: { | ||
4361 | /* read */ | ||
4362 | /* first write first register number */ | ||
4363 | - u8 ibuf[msg[1].len + 2], obuf[3]; | ||
4364 | + u8 ibuf[MAX_XFER_SIZE], obuf[3]; | ||
4365 | + | ||
4366 | + if (2 + msg[1].len > sizeof(ibuf)) { | ||
4367 | + warn("i2c rd: len=%d is too big!\n", | ||
4368 | + msg[1].len); | ||
4369 | + return -EOPNOTSUPP; | ||
4370 | + } | ||
4371 | obuf[0] = msg[0].addr << 1; | ||
4372 | obuf[1] = msg[0].len; | ||
4373 | obuf[2] = msg[0].buf[0]; | ||
4374 | @@ -481,7 +525,13 @@ static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | ||
4375 | case 0x60: | ||
4376 | case 0x0c: { | ||
4377 | /* write to register */ | ||
4378 | - u8 obuf[msg[0].len + 2]; | ||
4379 | + u8 obuf[MAX_XFER_SIZE]; | ||
4380 | + | ||
4381 | + if (2 + msg[0].len > sizeof(obuf)) { | ||
4382 | + warn("i2c wr: len=%d is too big!\n", | ||
4383 | + msg[0].len); | ||
4384 | + return -EOPNOTSUPP; | ||
4385 | + } | ||
4386 | obuf[0] = msg[0].addr << 1; | ||
4387 | obuf[1] = msg[0].len; | ||
4388 | memcpy(obuf + 2, msg[0].buf, msg[0].len); | ||
4389 | @@ -563,7 +613,14 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | ||
4390 | default: { | ||
4391 | if (msg[j].flags == I2C_M_RD) { | ||
4392 | /* read registers */ | ||
4393 | - u8 ibuf[msg[j].len]; | ||
4394 | + u8 ibuf[MAX_XFER_SIZE]; | ||
4395 | + | ||
4396 | + if (msg[j].len > sizeof(ibuf)) { | ||
4397 | + warn("i2c rd: len=%d is too big!\n", | ||
4398 | + msg[j].len); | ||
4399 | + return -EOPNOTSUPP; | ||
4400 | + } | ||
4401 | + | ||
4402 | dw210x_op_rw(d->udev, 0x91, 0, 0, | ||
4403 | ibuf, msg[j].len, | ||
4404 | DW210X_READ_MSG); | ||
4405 | @@ -590,7 +647,14 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | ||
4406 | } while (len > 0); | ||
4407 | } else if (j < (num - 1)) { | ||
4408 | /* write register addr before read */ | ||
4409 | - u8 obuf[msg[j].len + 2]; | ||
4410 | + u8 obuf[MAX_XFER_SIZE]; | ||
4411 | + | ||
4412 | + if (2 + msg[j].len > sizeof(obuf)) { | ||
4413 | + warn("i2c wr: len=%d is too big!\n", | ||
4414 | + msg[j].len); | ||
4415 | + return -EOPNOTSUPP; | ||
4416 | + } | ||
4417 | + | ||
4418 | obuf[0] = msg[j + 1].len; | ||
4419 | obuf[1] = (msg[j].addr << 1); | ||
4420 | memcpy(obuf + 2, msg[j].buf, msg[j].len); | ||
4421 | @@ -602,7 +666,13 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | ||
4422 | break; | ||
4423 | } else { | ||
4424 | /* write registers */ | ||
4425 | - u8 obuf[msg[j].len + 2]; | ||
4426 | + u8 obuf[MAX_XFER_SIZE]; | ||
4427 | + | ||
4428 | + if (2 + msg[j].len > sizeof(obuf)) { | ||
4429 | + warn("i2c wr: len=%d is too big!\n", | ||
4430 | + msg[j].len); | ||
4431 | + return -EOPNOTSUPP; | ||
4432 | + } | ||
4433 | obuf[0] = msg[j].len + 1; | ||
4434 | obuf[1] = (msg[j].addr << 1); | ||
4435 | memcpy(obuf + 2, msg[j].buf, msg[j].len); | ||
4436 | diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c | ||
4437 | index aca59d93..b5c95043 100644 | ||
4438 | --- a/drivers/mmc/host/atmel-mci.c | ||
4439 | +++ b/drivers/mmc/host/atmel-mci.c | ||
4440 | @@ -584,6 +584,13 @@ static void atmci_timeout_timer(unsigned long data) | ||
4441 | if (host->mrq->cmd->data) { | ||
4442 | host->mrq->cmd->data->error = -ETIMEDOUT; | ||
4443 | host->data = NULL; | ||
4444 | + /* | ||
4445 | + * With some SDIO modules, sometimes DMA transfer hangs. If | ||
4446 | + * stop_transfer() is not called then the DMA request is not | ||
4447 | + * removed, following ones are queued and never computed. | ||
4448 | + */ | ||
4449 | + if (host->state == STATE_DATA_XFER) | ||
4450 | + host->stop_transfer(host); | ||
4451 | } else { | ||
4452 | host->mrq->cmd->error = -ETIMEDOUT; | ||
4453 | host->cmd = NULL; | ||
4454 | @@ -1787,12 +1794,14 @@ static void atmci_tasklet_func(unsigned long priv) | ||
4455 | if (unlikely(status)) { | ||
4456 | host->stop_transfer(host); | ||
4457 | host->data = NULL; | ||
4458 | - if (status & ATMCI_DTOE) { | ||
4459 | - data->error = -ETIMEDOUT; | ||
4460 | - } else if (status & ATMCI_DCRCE) { | ||
4461 | - data->error = -EILSEQ; | ||
4462 | - } else { | ||
4463 | - data->error = -EIO; | ||
4464 | + if (data) { | ||
4465 | + if (status & ATMCI_DTOE) { | ||
4466 | + data->error = -ETIMEDOUT; | ||
4467 | + } else if (status & ATMCI_DCRCE) { | ||
4468 | + data->error = -EILSEQ; | ||
4469 | + } else { | ||
4470 | + data->error = -EIO; | ||
4471 | + } | ||
4472 | } | ||
4473 | } | ||
4474 | |||
4475 | diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | ||
4476 | index 25ecfa18..ab6581f1 100644 | ||
4477 | --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | ||
4478 | +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | ||
4479 | @@ -264,8 +264,6 @@ static void dma_irq_callback(void *param) | ||
4480 | struct gpmi_nand_data *this = param; | ||
4481 | struct completion *dma_c = &this->dma_done; | ||
4482 | |||
4483 | - complete(dma_c); | ||
4484 | - | ||
4485 | switch (this->dma_type) { | ||
4486 | case DMA_FOR_COMMAND: | ||
4487 | dma_unmap_sg(this->dev, &this->cmd_sgl, 1, DMA_TO_DEVICE); | ||
4488 | @@ -290,6 +288,8 @@ static void dma_irq_callback(void *param) | ||
4489 | default: | ||
4490 | pr_err("in wrong DMA operation.\n"); | ||
4491 | } | ||
4492 | + | ||
4493 | + complete(dma_c); | ||
4494 | } | ||
4495 | |||
4496 | int start_dma_without_bch_irq(struct gpmi_nand_data *this, | ||
4497 | diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c | ||
4498 | index fb8c4dea..633db883 100644 | ||
4499 | --- a/drivers/mtd/nand/nand_base.c | ||
4500 | +++ b/drivers/mtd/nand/nand_base.c | ||
4501 | @@ -2904,10 +2904,21 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, | ||
4502 | sanitize_string(p->model, sizeof(p->model)); | ||
4503 | if (!mtd->name) | ||
4504 | mtd->name = p->model; | ||
4505 | + | ||
4506 | mtd->writesize = le32_to_cpu(p->byte_per_page); | ||
4507 | - mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize; | ||
4508 | + | ||
4509 | + /* | ||
4510 | + * pages_per_block and blocks_per_lun may not be a power-of-2 size | ||
4511 | + * (don't ask me who thought of this...). MTD assumes that these | ||
4512 | + * dimensions will be power-of-2, so just truncate the remaining area. | ||
4513 | + */ | ||
4514 | + mtd->erasesize = 1 << (fls(le32_to_cpu(p->pages_per_block)) - 1); | ||
4515 | + mtd->erasesize *= mtd->writesize; | ||
4516 | + | ||
4517 | mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page); | ||
4518 | - chip->chipsize = le32_to_cpu(p->blocks_per_lun); | ||
4519 | + | ||
4520 | + /* See erasesize comment */ | ||
4521 | + chip->chipsize = 1 << (fls(le32_to_cpu(p->blocks_per_lun)) - 1); | ||
4522 | chip->chipsize *= (uint64_t)mtd->erasesize * p->lun_count; | ||
4523 | *busw = 0; | ||
4524 | if (le16_to_cpu(p->features) & 1) | ||
4525 | diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c | ||
4526 | index a8f33a52..f63169d6 100644 | ||
4527 | --- a/drivers/net/can/flexcan.c | ||
4528 | +++ b/drivers/net/can/flexcan.c | ||
4529 | @@ -711,7 +711,6 @@ static int flexcan_chip_start(struct net_device *dev) | ||
4530 | { | ||
4531 | struct flexcan_priv *priv = netdev_priv(dev); | ||
4532 | struct flexcan_regs __iomem *regs = priv->base; | ||
4533 | - unsigned int i; | ||
4534 | int err; | ||
4535 | u32 reg_mcr, reg_ctrl; | ||
4536 | |||
4537 | @@ -783,17 +782,6 @@ static int flexcan_chip_start(struct net_device *dev) | ||
4538 | netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); | ||
4539 | flexcan_write(reg_ctrl, ®s->ctrl); | ||
4540 | |||
4541 | - for (i = 0; i < ARRAY_SIZE(regs->cantxfg); i++) { | ||
4542 | - flexcan_write(0, ®s->cantxfg[i].can_ctrl); | ||
4543 | - flexcan_write(0, ®s->cantxfg[i].can_id); | ||
4544 | - flexcan_write(0, ®s->cantxfg[i].data[0]); | ||
4545 | - flexcan_write(0, ®s->cantxfg[i].data[1]); | ||
4546 | - | ||
4547 | - /* put MB into rx queue */ | ||
4548 | - flexcan_write(FLEXCAN_MB_CNT_CODE(0x4), | ||
4549 | - ®s->cantxfg[i].can_ctrl); | ||
4550 | - } | ||
4551 | - | ||
4552 | /* Abort any pending TX, mark Mailbox as INACTIVE */ | ||
4553 | flexcan_write(FLEXCAN_MB_CNT_CODE(0x4), | ||
4554 | ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); | ||
4555 | diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c | ||
4556 | index dc1e6da9..9a5f36e5 100644 | ||
4557 | --- a/drivers/net/wireless/iwlegacy/3945.c | ||
4558 | +++ b/drivers/net/wireless/iwlegacy/3945.c | ||
4559 | @@ -462,6 +462,8 @@ il3945_is_network_packet(struct il_priv *il, struct ieee80211_hdr *header) | ||
4560 | } | ||
4561 | } | ||
4562 | |||
4563 | +#define SMALL_PACKET_SIZE 256 | ||
4564 | + | ||
4565 | static void | ||
4566 | il3945_pass_packet_to_mac80211(struct il_priv *il, struct il_rx_buf *rxb, | ||
4567 | struct ieee80211_rx_status *stats) | ||
4568 | @@ -470,14 +472,13 @@ il3945_pass_packet_to_mac80211(struct il_priv *il, struct il_rx_buf *rxb, | ||
4569 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IL_RX_DATA(pkt); | ||
4570 | struct il3945_rx_frame_hdr *rx_hdr = IL_RX_HDR(pkt); | ||
4571 | struct il3945_rx_frame_end *rx_end = IL_RX_END(pkt); | ||
4572 | - u16 len = le16_to_cpu(rx_hdr->len); | ||
4573 | + u32 len = le16_to_cpu(rx_hdr->len); | ||
4574 | struct sk_buff *skb; | ||
4575 | __le16 fc = hdr->frame_control; | ||
4576 | + u32 fraglen = PAGE_SIZE << il->hw_params.rx_page_order; | ||
4577 | |||
4578 | /* We received data from the HW, so stop the watchdog */ | ||
4579 | - if (unlikely | ||
4580 | - (len + IL39_RX_FRAME_SIZE > | ||
4581 | - PAGE_SIZE << il->hw_params.rx_page_order)) { | ||
4582 | + if (unlikely(len + IL39_RX_FRAME_SIZE > fraglen)) { | ||
4583 | D_DROP("Corruption detected!\n"); | ||
4584 | return; | ||
4585 | } | ||
4586 | @@ -488,26 +489,32 @@ il3945_pass_packet_to_mac80211(struct il_priv *il, struct il_rx_buf *rxb, | ||
4587 | return; | ||
4588 | } | ||
4589 | |||
4590 | - skb = dev_alloc_skb(128); | ||
4591 | + skb = dev_alloc_skb(SMALL_PACKET_SIZE); | ||
4592 | if (!skb) { | ||
4593 | IL_ERR("dev_alloc_skb failed\n"); | ||
4594 | return; | ||
4595 | } | ||
4596 | |||
4597 | if (!il3945_mod_params.sw_crypto) | ||
4598 | - il_set_decrypted_flag(il, (struct ieee80211_hdr *)rxb_addr(rxb), | ||
4599 | + il_set_decrypted_flag(il, (struct ieee80211_hdr *)pkt, | ||
4600 | le32_to_cpu(rx_end->status), stats); | ||
4601 | |||
4602 | - skb_add_rx_frag(skb, 0, rxb->page, | ||
4603 | - (void *)rx_hdr->payload - (void *)pkt, len, | ||
4604 | - len); | ||
4605 | - | ||
4606 | + /* If frame is small enough to fit into skb->head, copy it | ||
4607 | + * and do not consume a full page | ||
4608 | + */ | ||
4609 | + if (len <= SMALL_PACKET_SIZE) { | ||
4610 | + memcpy(skb_put(skb, len), rx_hdr->payload, len); | ||
4611 | + } else { | ||
4612 | + skb_add_rx_frag(skb, 0, rxb->page, | ||
4613 | + (void *)rx_hdr->payload - (void *)pkt, len, | ||
4614 | + fraglen); | ||
4615 | + il->alloc_rxb_page--; | ||
4616 | + rxb->page = NULL; | ||
4617 | + } | ||
4618 | il_update_stats(il, false, fc, len); | ||
4619 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); | ||
4620 | |||
4621 | ieee80211_rx(il->hw, skb); | ||
4622 | - il->alloc_rxb_page--; | ||
4623 | - rxb->page = NULL; | ||
4624 | } | ||
4625 | |||
4626 | #define IL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) | ||
4627 | diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c | ||
4628 | index a8eff95e..d2586f09 100644 | ||
4629 | --- a/drivers/net/wireless/iwlegacy/4965-mac.c | ||
4630 | +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | ||
4631 | @@ -574,9 +574,11 @@ il4965_translate_rx_status(struct il_priv *il, u32 decrypt_in) | ||
4632 | return decrypt_out; | ||
4633 | } | ||
4634 | |||
4635 | +#define SMALL_PACKET_SIZE 256 | ||
4636 | + | ||
4637 | static void | ||
4638 | il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr, | ||
4639 | - u16 len, u32 ampdu_status, struct il_rx_buf *rxb, | ||
4640 | + u32 len, u32 ampdu_status, struct il_rx_buf *rxb, | ||
4641 | struct ieee80211_rx_status *stats) | ||
4642 | { | ||
4643 | struct sk_buff *skb; | ||
4644 | @@ -593,21 +595,25 @@ il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr, | ||
4645 | il_set_decrypted_flag(il, hdr, ampdu_status, stats)) | ||
4646 | return; | ||
4647 | |||
4648 | - skb = dev_alloc_skb(128); | ||
4649 | + skb = dev_alloc_skb(SMALL_PACKET_SIZE); | ||
4650 | if (!skb) { | ||
4651 | IL_ERR("dev_alloc_skb failed\n"); | ||
4652 | return; | ||
4653 | } | ||
4654 | |||
4655 | - skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len, | ||
4656 | - len); | ||
4657 | + if (len <= SMALL_PACKET_SIZE) { | ||
4658 | + memcpy(skb_put(skb, len), hdr, len); | ||
4659 | + } else { | ||
4660 | + skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), | ||
4661 | + len, PAGE_SIZE << il->hw_params.rx_page_order); | ||
4662 | + il->alloc_rxb_page--; | ||
4663 | + rxb->page = NULL; | ||
4664 | + } | ||
4665 | |||
4666 | il_update_stats(il, false, fc, len); | ||
4667 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); | ||
4668 | |||
4669 | ieee80211_rx(il->hw, skb); | ||
4670 | - il->alloc_rxb_page--; | ||
4671 | - rxb->page = NULL; | ||
4672 | } | ||
4673 | |||
4674 | /* Called for N_RX (legacy ABG frames), or | ||
4675 | diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h | ||
4676 | index 7a13790b..72d2ecce 100644 | ||
4677 | --- a/drivers/net/wireless/iwlwifi/iwl-trans.h | ||
4678 | +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | ||
4679 | @@ -605,8 +605,10 @@ static inline int iwl_trans_send_cmd(struct iwl_trans *trans, | ||
4680 | { | ||
4681 | int ret; | ||
4682 | |||
4683 | - WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE, | ||
4684 | - "%s bad state = %d", __func__, trans->state); | ||
4685 | + if (trans->state != IWL_TRANS_FW_ALIVE) { | ||
4686 | + IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); | ||
4687 | + return -EIO; | ||
4688 | + } | ||
4689 | |||
4690 | if (!(cmd->flags & CMD_ASYNC)) | ||
4691 | lock_map_acquire_read(&trans->sync_cmd_lockdep_map); | ||
4692 | diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c | ||
4693 | index 139c9581..047a6f34 100644 | ||
4694 | --- a/drivers/net/wireless/mwifiex/sdio.c | ||
4695 | +++ b/drivers/net/wireless/mwifiex/sdio.c | ||
4696 | @@ -930,7 +930,10 @@ static int mwifiex_decode_rx_packet(struct mwifiex_adapter *adapter, | ||
4697 | struct sk_buff *skb, u32 upld_typ) | ||
4698 | { | ||
4699 | u8 *cmd_buf; | ||
4700 | + __le16 *curr_ptr = (__le16 *)skb->data; | ||
4701 | + u16 pkt_len = le16_to_cpu(*curr_ptr); | ||
4702 | |||
4703 | + skb_trim(skb, pkt_len); | ||
4704 | skb_pull(skb, INTF_HEADER_LEN); | ||
4705 | |||
4706 | switch (upld_typ) { | ||
4707 | diff --git a/drivers/net/wireless/mwifiex/uap_txrx.c b/drivers/net/wireless/mwifiex/uap_txrx.c | ||
4708 | index a018e42d..48e67247 100644 | ||
4709 | --- a/drivers/net/wireless/mwifiex/uap_txrx.c | ||
4710 | +++ b/drivers/net/wireless/mwifiex/uap_txrx.c | ||
4711 | @@ -34,6 +34,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv, | ||
4712 | struct mwifiex_txinfo *tx_info; | ||
4713 | int hdr_chop; | ||
4714 | struct timeval tv; | ||
4715 | + struct ethhdr *p_ethhdr; | ||
4716 | u8 rfc1042_eth_hdr[ETH_ALEN] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; | ||
4717 | |||
4718 | uap_rx_pd = (struct uap_rxpd *)(skb->data); | ||
4719 | @@ -48,14 +49,36 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv, | ||
4720 | } | ||
4721 | |||
4722 | if (!memcmp(&rx_pkt_hdr->rfc1042_hdr, | ||
4723 | - rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) | ||
4724 | + rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) { | ||
4725 | + /* Replace the 803 header and rfc1042 header (llc/snap) with | ||
4726 | + * an Ethernet II header, keep the src/dst and snap_type | ||
4727 | + * (ethertype). | ||
4728 | + * | ||
4729 | + * The firmware only passes up SNAP frames converting all RX | ||
4730 | + * data from 802.11 to 802.2/LLC/SNAP frames. | ||
4731 | + * | ||
4732 | + * To create the Ethernet II, just move the src, dst address | ||
4733 | + * right before the snap_type. | ||
4734 | + */ | ||
4735 | + p_ethhdr = (struct ethhdr *) | ||
4736 | + ((u8 *)(&rx_pkt_hdr->eth803_hdr) | ||
4737 | + + sizeof(rx_pkt_hdr->eth803_hdr) | ||
4738 | + + sizeof(rx_pkt_hdr->rfc1042_hdr) | ||
4739 | + - sizeof(rx_pkt_hdr->eth803_hdr.h_dest) | ||
4740 | + - sizeof(rx_pkt_hdr->eth803_hdr.h_source) | ||
4741 | + - sizeof(rx_pkt_hdr->rfc1042_hdr.snap_type)); | ||
4742 | + memcpy(p_ethhdr->h_source, rx_pkt_hdr->eth803_hdr.h_source, | ||
4743 | + sizeof(p_ethhdr->h_source)); | ||
4744 | + memcpy(p_ethhdr->h_dest, rx_pkt_hdr->eth803_hdr.h_dest, | ||
4745 | + sizeof(p_ethhdr->h_dest)); | ||
4746 | /* Chop off the rxpd + the excess memory from | ||
4747 | * 802.2/llc/snap header that was removed. | ||
4748 | */ | ||
4749 | - hdr_chop = (u8 *)eth_hdr - (u8 *)uap_rx_pd; | ||
4750 | - else | ||
4751 | + hdr_chop = (u8 *)p_ethhdr - (u8 *)uap_rx_pd; | ||
4752 | + } else { | ||
4753 | /* Chop off the rxpd */ | ||
4754 | hdr_chop = (u8 *)&rx_pkt_hdr->eth803_hdr - (u8 *)uap_rx_pd; | ||
4755 | + } | ||
4756 | |||
4757 | /* Chop off the leading header bytes so the it points | ||
4758 | * to the start of either the reconstructed EthII frame | ||
4759 | diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c | ||
4760 | index 5970ff6f..d498b02f 100644 | ||
4761 | --- a/drivers/net/wireless/prism54/islpci_dev.c | ||
4762 | +++ b/drivers/net/wireless/prism54/islpci_dev.c | ||
4763 | @@ -811,6 +811,10 @@ static const struct net_device_ops islpci_netdev_ops = { | ||
4764 | .ndo_validate_addr = eth_validate_addr, | ||
4765 | }; | ||
4766 | |||
4767 | +static struct device_type wlan_type = { | ||
4768 | + .name = "wlan", | ||
4769 | +}; | ||
4770 | + | ||
4771 | struct net_device * | ||
4772 | islpci_setup(struct pci_dev *pdev) | ||
4773 | { | ||
4774 | @@ -821,9 +825,8 @@ islpci_setup(struct pci_dev *pdev) | ||
4775 | return ndev; | ||
4776 | |||
4777 | pci_set_drvdata(pdev, ndev); | ||
4778 | -#if defined(SET_NETDEV_DEV) | ||
4779 | SET_NETDEV_DEV(ndev, &pdev->dev); | ||
4780 | -#endif | ||
4781 | + SET_NETDEV_DEVTYPE(ndev, &wlan_type); | ||
4782 | |||
4783 | /* setup the structure members */ | ||
4784 | ndev->base_addr = pci_resource_start(pdev, 0); | ||
4785 | diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c | ||
4786 | index f7143733..a3a2dcd2 100644 | ||
4787 | --- a/drivers/net/wireless/rt2x00/rt2400pci.c | ||
4788 | +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | ||
4789 | @@ -1261,7 +1261,7 @@ static void rt2400pci_fill_rxdone(struct queue_entry *entry, | ||
4790 | */ | ||
4791 | rxdesc->timestamp = ((u64)rx_high << 32) | rx_low; | ||
4792 | rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL) & ~0x08; | ||
4793 | - rxdesc->rssi = rt2x00_get_field32(word2, RXD_W3_RSSI) - | ||
4794 | + rxdesc->rssi = rt2x00_get_field32(word3, RXD_W3_RSSI) - | ||
4795 | entry->queue->rt2x00dev->rssi_offset; | ||
4796 | rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); | ||
4797 | |||
4798 | diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c | ||
4799 | index af59dd57..3698028c 100644 | ||
4800 | --- a/drivers/net/wireless/rtlwifi/base.c | ||
4801 | +++ b/drivers/net/wireless/rtlwifi/base.c | ||
4802 | @@ -37,6 +37,7 @@ | ||
4803 | |||
4804 | #include <linux/ip.h> | ||
4805 | #include <linux/module.h> | ||
4806 | +#include <linux/udp.h> | ||
4807 | |||
4808 | /* | ||
4809 | *NOTICE!!!: This file will be very big, we should | ||
4810 | @@ -1066,64 +1067,52 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) | ||
4811 | if (!ieee80211_is_data(fc)) | ||
4812 | return false; | ||
4813 | |||
4814 | + ip = (const struct iphdr *)(skb->data + mac_hdr_len + | ||
4815 | + SNAP_SIZE + PROTOC_TYPE_SIZE); | ||
4816 | + ether_type = be16_to_cpup((__be16 *) | ||
4817 | + (skb->data + mac_hdr_len + SNAP_SIZE)); | ||
4818 | |||
4819 | - ip = (struct iphdr *)((u8 *) skb->data + mac_hdr_len + | ||
4820 | - SNAP_SIZE + PROTOC_TYPE_SIZE); | ||
4821 | - ether_type = *(u16 *) ((u8 *) skb->data + mac_hdr_len + SNAP_SIZE); | ||
4822 | - /* ether_type = ntohs(ether_type); */ | ||
4823 | - | ||
4824 | - if (ETH_P_IP == ether_type) { | ||
4825 | - if (IPPROTO_UDP == ip->protocol) { | ||
4826 | - struct udphdr *udp = (struct udphdr *)((u8 *) ip + | ||
4827 | - (ip->ihl << 2)); | ||
4828 | - if (((((u8 *) udp)[1] == 68) && | ||
4829 | - (((u8 *) udp)[3] == 67)) || | ||
4830 | - ((((u8 *) udp)[1] == 67) && | ||
4831 | - (((u8 *) udp)[3] == 68))) { | ||
4832 | - /* | ||
4833 | - * 68 : UDP BOOTP client | ||
4834 | - * 67 : UDP BOOTP server | ||
4835 | - */ | ||
4836 | - RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), | ||
4837 | - DBG_DMESG, "dhcp %s !!\n", | ||
4838 | - is_tx ? "Tx" : "Rx"); | ||
4839 | - | ||
4840 | - if (is_tx) { | ||
4841 | - rtlpriv->enter_ps = false; | ||
4842 | - schedule_work(&rtlpriv-> | ||
4843 | - works.lps_change_work); | ||
4844 | - ppsc->last_delaylps_stamp_jiffies = | ||
4845 | - jiffies; | ||
4846 | - } | ||
4847 | + switch (ether_type) { | ||
4848 | + case ETH_P_IP: { | ||
4849 | + struct udphdr *udp; | ||
4850 | + u16 src; | ||
4851 | + u16 dst; | ||
4852 | |||
4853 | - return true; | ||
4854 | - } | ||
4855 | - } | ||
4856 | - } else if (ETH_P_ARP == ether_type) { | ||
4857 | - if (is_tx) { | ||
4858 | - rtlpriv->enter_ps = false; | ||
4859 | - schedule_work(&rtlpriv->works.lps_change_work); | ||
4860 | - ppsc->last_delaylps_stamp_jiffies = jiffies; | ||
4861 | - } | ||
4862 | + if (ip->protocol != IPPROTO_UDP) | ||
4863 | + return false; | ||
4864 | + udp = (struct udphdr *)((u8 *)ip + (ip->ihl << 2)); | ||
4865 | + src = be16_to_cpu(udp->source); | ||
4866 | + dst = be16_to_cpu(udp->dest); | ||
4867 | |||
4868 | - return true; | ||
4869 | - } else if (ETH_P_PAE == ether_type) { | ||
4870 | + /* If this case involves port 68 (UDP BOOTP client) connecting | ||
4871 | + * with port 67 (UDP BOOTP server), then return true so that | ||
4872 | + * the lowest speed is used. | ||
4873 | + */ | ||
4874 | + if (!((src == 68 && dst == 67) || (src == 67 && dst == 68))) | ||
4875 | + return false; | ||
4876 | + | ||
4877 | + RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, | ||
4878 | + "dhcp %s !!\n", is_tx ? "Tx" : "Rx"); | ||
4879 | + break; | ||
4880 | + } | ||
4881 | + case ETH_P_ARP: | ||
4882 | + break; | ||
4883 | + case ETH_P_PAE: | ||
4884 | RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, | ||
4885 | "802.1X %s EAPOL pkt!!\n", is_tx ? "Tx" : "Rx"); | ||
4886 | - | ||
4887 | - if (is_tx) { | ||
4888 | - rtlpriv->enter_ps = false; | ||
4889 | - schedule_work(&rtlpriv->works.lps_change_work); | ||
4890 | - ppsc->last_delaylps_stamp_jiffies = jiffies; | ||
4891 | - } | ||
4892 | - | ||
4893 | - return true; | ||
4894 | - } else if (ETH_P_IPV6 == ether_type) { | ||
4895 | - /* IPv6 */ | ||
4896 | - return true; | ||
4897 | + break; | ||
4898 | + case ETH_P_IPV6: | ||
4899 | + /* TODO: Is this right? */ | ||
4900 | + return false; | ||
4901 | + default: | ||
4902 | + return false; | ||
4903 | } | ||
4904 | - | ||
4905 | - return false; | ||
4906 | + if (is_tx) { | ||
4907 | + rtlpriv->enter_ps = false; | ||
4908 | + schedule_work(&rtlpriv->works.lps_change_work); | ||
4909 | + ppsc->last_delaylps_stamp_jiffies = jiffies; | ||
4910 | + } | ||
4911 | + return true; | ||
4912 | } | ||
4913 | |||
4914 | /********************************************************* | ||
4915 | diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | ||
4916 | index b68cae30..e06971be 100644 | ||
4917 | --- a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | ||
4918 | +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | ||
4919 | @@ -143,6 +143,7 @@ static void _rtl88ee_set_fw_clock_on(struct ieee80211_hw *hw, | ||
4920 | } else { | ||
4921 | rtlhal->fw_clk_change_in_progress = false; | ||
4922 | spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); | ||
4923 | + break; | ||
4924 | } | ||
4925 | } | ||
4926 | |||
4927 | diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c | ||
4928 | index da4f5871..2c68c138 100644 | ||
4929 | --- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c | ||
4930 | +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c | ||
4931 | @@ -778,7 +778,7 @@ static long _rtl92c_signal_scale_mapping(struct ieee80211_hw *hw, | ||
4932 | |||
4933 | static void _rtl92c_query_rxphystatus(struct ieee80211_hw *hw, | ||
4934 | struct rtl_stats *pstats, | ||
4935 | - struct rx_desc_92c *pdesc, | ||
4936 | + struct rx_desc_92c *p_desc, | ||
4937 | struct rx_fwinfo_92c *p_drvinfo, | ||
4938 | bool packet_match_bssid, | ||
4939 | bool packet_toself, | ||
4940 | @@ -793,11 +793,11 @@ static void _rtl92c_query_rxphystatus(struct ieee80211_hw *hw, | ||
4941 | u32 rssi, total_rssi = 0; | ||
4942 | bool in_powersavemode = false; | ||
4943 | bool is_cck_rate; | ||
4944 | + u8 *pdesc = (u8 *)p_desc; | ||
4945 | |||
4946 | - is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc); | ||
4947 | + is_cck_rate = RX_HAL_IS_CCK_RATE(p_desc); | ||
4948 | pstats->packet_matchbssid = packet_match_bssid; | ||
4949 | pstats->packet_toself = packet_toself; | ||
4950 | - pstats->is_cck = is_cck_rate; | ||
4951 | pstats->packet_beacon = packet_beacon; | ||
4952 | pstats->is_cck = is_cck_rate; | ||
4953 | pstats->RX_SIGQ[0] = -1; | ||
4954 | diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | ||
4955 | index 5a060e53..5c52a8ac 100644 | ||
4956 | --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | ||
4957 | +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | ||
4958 | @@ -303,10 +303,10 @@ out: | ||
4959 | bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw, | ||
4960 | struct rtl_stats *stats, | ||
4961 | struct ieee80211_rx_status *rx_status, | ||
4962 | - u8 *p_desc, struct sk_buff *skb) | ||
4963 | + u8 *pdesc, struct sk_buff *skb) | ||
4964 | { | ||
4965 | struct rx_fwinfo_92c *p_drvinfo; | ||
4966 | - struct rx_desc_92c *pdesc = (struct rx_desc_92c *)p_desc; | ||
4967 | + struct rx_desc_92c *p_desc = (struct rx_desc_92c *)pdesc; | ||
4968 | u32 phystatus = GET_RX_DESC_PHY_STATUS(pdesc); | ||
4969 | |||
4970 | stats->length = (u16) GET_RX_DESC_PKT_LEN(pdesc); | ||
4971 | @@ -345,11 +345,11 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw, | ||
4972 | if (phystatus) { | ||
4973 | p_drvinfo = (struct rx_fwinfo_92c *)(skb->data + | ||
4974 | stats->rx_bufshift); | ||
4975 | - rtl92c_translate_rx_signal_stuff(hw, skb, stats, pdesc, | ||
4976 | + rtl92c_translate_rx_signal_stuff(hw, skb, stats, p_desc, | ||
4977 | p_drvinfo); | ||
4978 | } | ||
4979 | /*rx_status->qual = stats->signal; */ | ||
4980 | - rx_status->signal = stats->rssi + 10; | ||
4981 | + rx_status->signal = stats->recvsignalpower + 10; | ||
4982 | /*rx_status->noise = -stats->noise; */ | ||
4983 | return true; | ||
4984 | } | ||
4985 | diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c | ||
4986 | index b8ec718a..542394c8 100644 | ||
4987 | --- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c | ||
4988 | +++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c | ||
4989 | @@ -525,7 +525,7 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, | ||
4990 | p_drvinfo); | ||
4991 | } | ||
4992 | /*rx_status->qual = stats->signal; */ | ||
4993 | - rx_status->signal = stats->rssi + 10; | ||
4994 | + rx_status->signal = stats->recvsignalpower + 10; | ||
4995 | /*rx_status->noise = -stats->noise; */ | ||
4996 | return true; | ||
4997 | } | ||
4998 | diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c | ||
4999 | index 5061f1db..92d38ab3 100644 | ||
5000 | --- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c | ||
5001 | +++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c | ||
5002 | @@ -265,7 +265,7 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw, | ||
5003 | rtlefuse->pwrgroup_ht40 | ||
5004 | [RF90_PATH_A][chnl - 1]) { | ||
5005 | pwrdiff_limit[i] = | ||
5006 | - rtlefuse->pwrgroup_ht20 | ||
5007 | + rtlefuse->pwrgroup_ht40 | ||
5008 | [RF90_PATH_A][chnl - 1]; | ||
5009 | } | ||
5010 | } else { | ||
5011 | diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c | ||
5012 | index c7095118..7d0f2e20 100644 | ||
5013 | --- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c | ||
5014 | +++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c | ||
5015 | @@ -329,7 +329,7 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, | ||
5016 | } | ||
5017 | |||
5018 | /*rx_status->qual = stats->signal; */ | ||
5019 | - rx_status->signal = stats->rssi + 10; | ||
5020 | + rx_status->signal = stats->recvsignalpower + 10; | ||
5021 | /*rx_status->noise = -stats->noise; */ | ||
5022 | |||
5023 | return true; | ||
5024 | diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h | ||
5025 | index 70325874..ad9c37a4 100644 | ||
5026 | --- a/drivers/net/wireless/rtlwifi/wifi.h | ||
5027 | +++ b/drivers/net/wireless/rtlwifi/wifi.h | ||
5028 | @@ -77,11 +77,7 @@ | ||
5029 | #define RTL_SLOT_TIME_9 9 | ||
5030 | #define RTL_SLOT_TIME_20 20 | ||
5031 | |||
5032 | -/*related with tcp/ip. */ | ||
5033 | -/*if_ehther.h*/ | ||
5034 | -#define ETH_P_PAE 0x888E /*Port Access Entity (IEEE 802.1X) */ | ||
5035 | -#define ETH_P_IP 0x0800 /*Internet Protocol packet */ | ||
5036 | -#define ETH_P_ARP 0x0806 /*Address Resolution packet */ | ||
5037 | +/*related to tcp/ip. */ | ||
5038 | #define SNAP_SIZE 6 | ||
5039 | #define PROTOC_TYPE_SIZE 2 | ||
5040 | |||
5041 | diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c | ||
5042 | index c4a2eb2c..540a7965 100644 | ||
5043 | --- a/drivers/net/xen-netback/interface.c | ||
5044 | +++ b/drivers/net/xen-netback/interface.c | ||
5045 | @@ -365,17 +365,19 @@ void xenvif_disconnect(struct xenvif *vif) | ||
5046 | if (netif_carrier_ok(vif->dev)) | ||
5047 | xenvif_carrier_off(vif); | ||
5048 | |||
5049 | - atomic_dec(&vif->refcnt); | ||
5050 | - wait_event(vif->waiting_to_free, atomic_read(&vif->refcnt) == 0); | ||
5051 | - | ||
5052 | - if (vif->irq) | ||
5053 | + if (vif->irq) { | ||
5054 | unbind_from_irqhandler(vif->irq, vif); | ||
5055 | + vif->irq = 0; | ||
5056 | + } | ||
5057 | |||
5058 | xen_netbk_unmap_frontend_rings(vif); | ||
5059 | } | ||
5060 | |||
5061 | void xenvif_free(struct xenvif *vif) | ||
5062 | { | ||
5063 | + atomic_dec(&vif->refcnt); | ||
5064 | + wait_event(vif->waiting_to_free, atomic_read(&vif->refcnt) == 0); | ||
5065 | + | ||
5066 | unregister_netdev(vif->dev); | ||
5067 | |||
5068 | free_netdev(vif->dev); | ||
5069 | diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c | ||
5070 | index 696caed5..ce8acc71 100644 | ||
5071 | --- a/drivers/pci/pcie/portdrv_pci.c | ||
5072 | +++ b/drivers/pci/pcie/portdrv_pci.c | ||
5073 | @@ -223,7 +223,6 @@ static int pcie_portdrv_probe(struct pci_dev *dev, | ||
5074 | static void pcie_portdrv_remove(struct pci_dev *dev) | ||
5075 | { | ||
5076 | pcie_port_device_remove(dev); | ||
5077 | - pci_disable_device(dev); | ||
5078 | } | ||
5079 | |||
5080 | static int error_detected_iter(struct device *device, void *data) | ||
5081 | diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c | ||
5082 | index 428ea96a..e29e6d83 100644 | ||
5083 | --- a/drivers/pinctrl/mvebu/pinctrl-dove.c | ||
5084 | +++ b/drivers/pinctrl/mvebu/pinctrl-dove.c | ||
5085 | @@ -323,7 +323,7 @@ static int dove_twsi_ctrl_set(struct mvebu_mpp_ctrl *ctrl, | ||
5086 | unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); | ||
5087 | |||
5088 | gcfg1 &= ~DOVE_TWSI_ENABLE_OPTION1; | ||
5089 | - gcfg2 &= ~(DOVE_TWSI_ENABLE_OPTION2 | DOVE_TWSI_ENABLE_OPTION2); | ||
5090 | + gcfg2 &= ~(DOVE_TWSI_ENABLE_OPTION2 | DOVE_TWSI_ENABLE_OPTION3); | ||
5091 | |||
5092 | switch (config) { | ||
5093 | case 1: | ||
5094 | diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c | ||
5095 | index 6cd0fc1b..e06cb8f8 100644 | ||
5096 | --- a/drivers/s390/net/qeth_core_main.c | ||
5097 | +++ b/drivers/s390/net/qeth_core_main.c | ||
5098 | @@ -4448,7 +4448,7 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata) | ||
5099 | struct qeth_cmd_buffer *iob; | ||
5100 | struct qeth_ipa_cmd *cmd; | ||
5101 | struct qeth_snmp_ureq *ureq; | ||
5102 | - int req_len; | ||
5103 | + unsigned int req_len; | ||
5104 | struct qeth_arp_query_info qinfo = {0, }; | ||
5105 | int rc = 0; | ||
5106 | |||
5107 | @@ -4464,6 +4464,10 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata) | ||
5108 | /* skip 4 bytes (data_len struct member) to get req_len */ | ||
5109 | if (copy_from_user(&req_len, udata + sizeof(int), sizeof(int))) | ||
5110 | return -EFAULT; | ||
5111 | + if (req_len > (QETH_BUFSIZE - IPA_PDU_HEADER_SIZE - | ||
5112 | + sizeof(struct qeth_ipacmd_hdr) - | ||
5113 | + sizeof(struct qeth_ipacmd_setadpparms_hdr))) | ||
5114 | + return -EINVAL; | ||
5115 | ureq = memdup_user(udata, req_len + sizeof(struct qeth_snmp_ureq_hdr)); | ||
5116 | if (IS_ERR(ureq)) { | ||
5117 | QETH_CARD_TEXT(card, 2, "snmpnome"); | ||
5118 | diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c | ||
5119 | index 11d5338b..0feeaadf 100644 | ||
5120 | --- a/drivers/staging/media/lirc/lirc_zilog.c | ||
5121 | +++ b/drivers/staging/media/lirc/lirc_zilog.c | ||
5122 | @@ -61,6 +61,9 @@ | ||
5123 | #include <media/lirc_dev.h> | ||
5124 | #include <media/lirc.h> | ||
5125 | |||
5126 | +/* Max transfer size done by I2C transfer functions */ | ||
5127 | +#define MAX_XFER_SIZE 64 | ||
5128 | + | ||
5129 | struct IR; | ||
5130 | |||
5131 | struct IR_rx { | ||
5132 | @@ -941,7 +944,14 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos) | ||
5133 | schedule(); | ||
5134 | set_current_state(TASK_INTERRUPTIBLE); | ||
5135 | } else { | ||
5136 | - unsigned char buf[rbuf->chunk_size]; | ||
5137 | + unsigned char buf[MAX_XFER_SIZE]; | ||
5138 | + | ||
5139 | + if (rbuf->chunk_size > sizeof(buf)) { | ||
5140 | + zilog_error("chunk_size is too big (%d)!\n", | ||
5141 | + rbuf->chunk_size); | ||
5142 | + ret = -EINVAL; | ||
5143 | + break; | ||
5144 | + } | ||
5145 | m = lirc_buffer_read(rbuf, buf); | ||
5146 | if (m == rbuf->chunk_size) { | ||
5147 | ret = copy_to_user((void *)outbuf+written, buf, | ||
5148 | diff --git a/drivers/staging/tidspbridge/Kconfig b/drivers/staging/tidspbridge/Kconfig | ||
5149 | index 60848f19..f7deabcf 100644 | ||
5150 | --- a/drivers/staging/tidspbridge/Kconfig | ||
5151 | +++ b/drivers/staging/tidspbridge/Kconfig | ||
5152 | @@ -4,7 +4,7 @@ | ||
5153 | |||
5154 | menuconfig TIDSPBRIDGE | ||
5155 | tristate "DSP Bridge driver" | ||
5156 | - depends on ARCH_OMAP3 && !ARCH_MULTIPLATFORM | ||
5157 | + depends on ARCH_OMAP3 && !ARCH_MULTIPLATFORM && BROKEN | ||
5158 | select OMAP_MBOX_FWK | ||
5159 | help | ||
5160 | DSP/BIOS Bridge is designed for platforms that contain a GPP and | ||
5161 | diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c | ||
5162 | index 33fa7675..3ff1126c 100644 | ||
5163 | --- a/drivers/staging/vt6656/baseband.c | ||
5164 | +++ b/drivers/staging/vt6656/baseband.c | ||
5165 | @@ -941,6 +941,7 @@ int BBbVT3184Init(struct vnt_private *pDevice) | ||
5166 | u8 * pbyAgc; | ||
5167 | u16 wLengthAgc; | ||
5168 | u8 abyArray[256]; | ||
5169 | + u8 data; | ||
5170 | |||
5171 | ntStatus = CONTROLnsRequestIn(pDevice, | ||
5172 | MESSAGE_TYPE_READ, | ||
5173 | @@ -1106,6 +1107,16 @@ else { | ||
5174 | ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01); | ||
5175 | |||
5176 | RFbRFTableDownload(pDevice); | ||
5177 | + | ||
5178 | + /* Fix for TX USB resets from vendors driver */ | ||
5179 | + CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, USB_REG4, | ||
5180 | + MESSAGE_REQUEST_MEM, sizeof(data), &data); | ||
5181 | + | ||
5182 | + data |= 0x2; | ||
5183 | + | ||
5184 | + CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, USB_REG4, | ||
5185 | + MESSAGE_REQUEST_MEM, sizeof(data), &data); | ||
5186 | + | ||
5187 | return true;//ntStatus; | ||
5188 | } | ||
5189 | |||
5190 | diff --git a/drivers/staging/vt6656/rndis.h b/drivers/staging/vt6656/rndis.h | ||
5191 | index 5e073062..5cf5e732 100644 | ||
5192 | --- a/drivers/staging/vt6656/rndis.h | ||
5193 | +++ b/drivers/staging/vt6656/rndis.h | ||
5194 | @@ -66,6 +66,8 @@ | ||
5195 | |||
5196 | #define VIAUSB20_PACKET_HEADER 0x04 | ||
5197 | |||
5198 | +#define USB_REG4 0x604 | ||
5199 | + | ||
5200 | typedef struct _CMD_MESSAGE | ||
5201 | { | ||
5202 | u8 byData[256]; | ||
5203 | diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c | ||
5204 | index f82f7e69..288f5825 100644 | ||
5205 | --- a/drivers/staging/zsmalloc/zsmalloc-main.c | ||
5206 | +++ b/drivers/staging/zsmalloc/zsmalloc-main.c | ||
5207 | @@ -430,7 +430,12 @@ static struct page *get_next_page(struct page *page) | ||
5208 | return next; | ||
5209 | } | ||
5210 | |||
5211 | -/* Encode <page, obj_idx> as a single handle value */ | ||
5212 | +/* | ||
5213 | + * Encode <page, obj_idx> as a single handle value. | ||
5214 | + * On hardware platforms with physical memory starting at 0x0 the pfn | ||
5215 | + * could be 0 so we ensure that the handle will never be 0 by adjusting the | ||
5216 | + * encoded obj_idx value before encoding. | ||
5217 | + */ | ||
5218 | static void *obj_location_to_handle(struct page *page, unsigned long obj_idx) | ||
5219 | { | ||
5220 | unsigned long handle; | ||
5221 | @@ -441,17 +446,21 @@ static void *obj_location_to_handle(struct page *page, unsigned long obj_idx) | ||
5222 | } | ||
5223 | |||
5224 | handle = page_to_pfn(page) << OBJ_INDEX_BITS; | ||
5225 | - handle |= (obj_idx & OBJ_INDEX_MASK); | ||
5226 | + handle |= ((obj_idx + 1) & OBJ_INDEX_MASK); | ||
5227 | |||
5228 | return (void *)handle; | ||
5229 | } | ||
5230 | |||
5231 | -/* Decode <page, obj_idx> pair from the given object handle */ | ||
5232 | +/* | ||
5233 | + * Decode <page, obj_idx> pair from the given object handle. We adjust the | ||
5234 | + * decoded obj_idx back to its original value since it was adjusted in | ||
5235 | + * obj_location_to_handle(). | ||
5236 | + */ | ||
5237 | static void obj_handle_to_location(unsigned long handle, struct page **page, | ||
5238 | unsigned long *obj_idx) | ||
5239 | { | ||
5240 | *page = pfn_to_page(handle >> OBJ_INDEX_BITS); | ||
5241 | - *obj_idx = handle & OBJ_INDEX_MASK; | ||
5242 | + *obj_idx = (handle & OBJ_INDEX_MASK) - 1; | ||
5243 | } | ||
5244 | |||
5245 | static unsigned long obj_idx_to_offset(struct page *page, | ||
5246 | diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c | ||
5247 | index cee17543..130a1e4f 100644 | ||
5248 | --- a/drivers/target/iscsi/iscsi_target_auth.c | ||
5249 | +++ b/drivers/target/iscsi/iscsi_target_auth.c | ||
5250 | @@ -148,6 +148,7 @@ static int chap_server_compute_md5( | ||
5251 | unsigned char client_digest[MD5_SIGNATURE_SIZE]; | ||
5252 | unsigned char server_digest[MD5_SIGNATURE_SIZE]; | ||
5253 | unsigned char chap_n[MAX_CHAP_N_SIZE], chap_r[MAX_RESPONSE_LENGTH]; | ||
5254 | + size_t compare_len; | ||
5255 | struct iscsi_chap *chap = conn->auth_protocol; | ||
5256 | struct crypto_hash *tfm; | ||
5257 | struct hash_desc desc; | ||
5258 | @@ -186,7 +187,9 @@ static int chap_server_compute_md5( | ||
5259 | goto out; | ||
5260 | } | ||
5261 | |||
5262 | - if (memcmp(chap_n, auth->userid, strlen(auth->userid)) != 0) { | ||
5263 | + /* Include the terminating NULL in the compare */ | ||
5264 | + compare_len = strlen(auth->userid) + 1; | ||
5265 | + if (strncmp(chap_n, auth->userid, compare_len) != 0) { | ||
5266 | pr_err("CHAP_N values do not match!\n"); | ||
5267 | goto out; | ||
5268 | } | ||
5269 | diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c | ||
5270 | index 421344da..c45b3365 100644 | ||
5271 | --- a/drivers/target/iscsi/iscsi_target_configfs.c | ||
5272 | +++ b/drivers/target/iscsi/iscsi_target_configfs.c | ||
5273 | @@ -1650,6 +1650,11 @@ static int lio_queue_status(struct se_cmd *se_cmd) | ||
5274 | struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); | ||
5275 | |||
5276 | cmd->i_state = ISTATE_SEND_STATUS; | ||
5277 | + | ||
5278 | + if (cmd->se_cmd.scsi_status || cmd->sense_reason) { | ||
5279 | + iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state); | ||
5280 | + return 0; | ||
5281 | + } | ||
5282 | cmd->conn->conn_transport->iscsit_queue_status(cmd->conn, cmd); | ||
5283 | |||
5284 | return 0; | ||
5285 | diff --git a/drivers/target/iscsi/iscsi_target_device.c b/drivers/target/iscsi/iscsi_target_device.c | ||
5286 | index 1b740335..4edcc47c 100644 | ||
5287 | --- a/drivers/target/iscsi/iscsi_target_device.c | ||
5288 | +++ b/drivers/target/iscsi/iscsi_target_device.c | ||
5289 | @@ -60,11 +60,7 @@ void iscsit_increment_maxcmdsn(struct iscsi_cmd *cmd, struct iscsi_session *sess | ||
5290 | |||
5291 | cmd->maxcmdsn_inc = 1; | ||
5292 | |||
5293 | - if (!mutex_trylock(&sess->cmdsn_mutex)) { | ||
5294 | - sess->max_cmd_sn += 1; | ||
5295 | - pr_debug("Updated MaxCmdSN to 0x%08x\n", sess->max_cmd_sn); | ||
5296 | - return; | ||
5297 | - } | ||
5298 | + mutex_lock(&sess->cmdsn_mutex); | ||
5299 | sess->max_cmd_sn += 1; | ||
5300 | pr_debug("Updated MaxCmdSN to 0x%08x\n", sess->max_cmd_sn); | ||
5301 | mutex_unlock(&sess->cmdsn_mutex); | ||
5302 | diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c | ||
5303 | index cd5018ff..72d9dec9 100644 | ||
5304 | --- a/drivers/target/iscsi/iscsi_target_nego.c | ||
5305 | +++ b/drivers/target/iscsi/iscsi_target_nego.c | ||
5306 | @@ -90,7 +90,7 @@ int extract_param( | ||
5307 | if (len < 0) | ||
5308 | return -1; | ||
5309 | |||
5310 | - if (len > max_length) { | ||
5311 | + if (len >= max_length) { | ||
5312 | pr_err("Length of input: %d exceeds max_length:" | ||
5313 | " %d\n", len, max_length); | ||
5314 | return -1; | ||
5315 | diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c | ||
5316 | index 30e4ed52..27a14a05 100644 | ||
5317 | --- a/drivers/video/backlight/atmel-pwm-bl.c | ||
5318 | +++ b/drivers/video/backlight/atmel-pwm-bl.c | ||
5319 | @@ -70,7 +70,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) | ||
5320 | static int atmel_pwm_bl_get_intensity(struct backlight_device *bd) | ||
5321 | { | ||
5322 | struct atmel_pwm_bl *pwmbl = bl_get_data(bd); | ||
5323 | - u8 intensity; | ||
5324 | + u32 intensity; | ||
5325 | |||
5326 | if (pwmbl->pdata->pwm_active_low) { | ||
5327 | intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) - | ||
5328 | @@ -80,7 +80,7 @@ static int atmel_pwm_bl_get_intensity(struct backlight_device *bd) | ||
5329 | pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY); | ||
5330 | } | ||
5331 | |||
5332 | - return intensity; | ||
5333 | + return intensity & 0xffff; | ||
5334 | } | ||
5335 | |||
5336 | static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl) | ||
5337 | @@ -207,8 +207,10 @@ static int atmel_pwm_bl_remove(struct platform_device *pdev) | ||
5338 | { | ||
5339 | struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev); | ||
5340 | |||
5341 | - if (pwmbl->gpio_on != -1) | ||
5342 | - gpio_set_value(pwmbl->gpio_on, 0); | ||
5343 | + if (pwmbl->gpio_on != -1) { | ||
5344 | + gpio_set_value(pwmbl->gpio_on, | ||
5345 | + 0 ^ pwmbl->pdata->on_active_low); | ||
5346 | + } | ||
5347 | pwm_channel_disable(&pwmbl->pwmc); | ||
5348 | pwm_channel_free(&pwmbl->pwmc); | ||
5349 | backlight_device_unregister(pwmbl->bldev); | ||
5350 | diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c | ||
5351 | index 35687fd5..4ad24f2c 100644 | ||
5352 | --- a/drivers/video/console/sticore.c | ||
5353 | +++ b/drivers/video/console/sticore.c | ||
5354 | @@ -3,7 +3,7 @@ | ||
5355 | * core code for console driver using HP's STI firmware | ||
5356 | * | ||
5357 | * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> | ||
5358 | - * Copyright (C) 2001-2003 Helge Deller <deller@gmx.de> | ||
5359 | + * Copyright (C) 2001-2013 Helge Deller <deller@gmx.de> | ||
5360 | * Copyright (C) 2001-2002 Thomas Bogendoerfer <tsbogend@alpha.franken.de> | ||
5361 | * | ||
5362 | * TODO: | ||
5363 | @@ -30,7 +30,7 @@ | ||
5364 | |||
5365 | #include "../sticore.h" | ||
5366 | |||
5367 | -#define STI_DRIVERVERSION "Version 0.9a" | ||
5368 | +#define STI_DRIVERVERSION "Version 0.9b" | ||
5369 | |||
5370 | static struct sti_struct *default_sti __read_mostly; | ||
5371 | |||
5372 | @@ -73,28 +73,34 @@ static const struct sti_init_flags default_init_flags = { | ||
5373 | |||
5374 | static int sti_init_graph(struct sti_struct *sti) | ||
5375 | { | ||
5376 | - struct sti_init_inptr_ext inptr_ext = { 0, }; | ||
5377 | - struct sti_init_inptr inptr = { | ||
5378 | - .text_planes = 3, /* # of text planes (max 3 for STI) */ | ||
5379 | - .ext_ptr = STI_PTR(&inptr_ext) | ||
5380 | - }; | ||
5381 | - struct sti_init_outptr outptr = { 0, }; | ||
5382 | + struct sti_init_inptr *inptr = &sti->sti_data->init_inptr; | ||
5383 | + struct sti_init_inptr_ext *inptr_ext = &sti->sti_data->init_inptr_ext; | ||
5384 | + struct sti_init_outptr *outptr = &sti->sti_data->init_outptr; | ||
5385 | unsigned long flags; | ||
5386 | - int ret; | ||
5387 | + int ret, err; | ||
5388 | |||
5389 | spin_lock_irqsave(&sti->lock, flags); | ||
5390 | |||
5391 | - ret = STI_CALL(sti->init_graph, &default_init_flags, &inptr, | ||
5392 | - &outptr, sti->glob_cfg); | ||
5393 | + memset(inptr, 0, sizeof(*inptr)); | ||
5394 | + inptr->text_planes = 3; /* # of text planes (max 3 for STI) */ | ||
5395 | + memset(inptr_ext, 0, sizeof(*inptr_ext)); | ||
5396 | + inptr->ext_ptr = STI_PTR(inptr_ext); | ||
5397 | + outptr->errno = 0; | ||
5398 | + | ||
5399 | + ret = sti_call(sti, sti->init_graph, &default_init_flags, inptr, | ||
5400 | + outptr, sti->glob_cfg); | ||
5401 | + | ||
5402 | + if (ret >= 0) | ||
5403 | + sti->text_planes = outptr->text_planes; | ||
5404 | + err = outptr->errno; | ||
5405 | |||
5406 | spin_unlock_irqrestore(&sti->lock, flags); | ||
5407 | |||
5408 | if (ret < 0) { | ||
5409 | - printk(KERN_ERR "STI init_graph failed (ret %d, errno %d)\n",ret,outptr.errno); | ||
5410 | + pr_err("STI init_graph failed (ret %d, errno %d)\n", ret, err); | ||
5411 | return -1; | ||
5412 | } | ||
5413 | |||
5414 | - sti->text_planes = outptr.text_planes; | ||
5415 | return 0; | ||
5416 | } | ||
5417 | |||
5418 | @@ -104,16 +110,18 @@ static const struct sti_conf_flags default_conf_flags = { | ||
5419 | |||
5420 | static void sti_inq_conf(struct sti_struct *sti) | ||
5421 | { | ||
5422 | - struct sti_conf_inptr inptr = { 0, }; | ||
5423 | + struct sti_conf_inptr *inptr = &sti->sti_data->inq_inptr; | ||
5424 | + struct sti_conf_outptr *outptr = &sti->sti_data->inq_outptr; | ||
5425 | unsigned long flags; | ||
5426 | s32 ret; | ||
5427 | |||
5428 | - sti->outptr.ext_ptr = STI_PTR(&sti->outptr_ext); | ||
5429 | + outptr->ext_ptr = STI_PTR(&sti->sti_data->inq_outptr_ext); | ||
5430 | |||
5431 | do { | ||
5432 | spin_lock_irqsave(&sti->lock, flags); | ||
5433 | - ret = STI_CALL(sti->inq_conf, &default_conf_flags, | ||
5434 | - &inptr, &sti->outptr, sti->glob_cfg); | ||
5435 | + memset(inptr, 0, sizeof(*inptr)); | ||
5436 | + ret = sti_call(sti, sti->inq_conf, &default_conf_flags, | ||
5437 | + inptr, outptr, sti->glob_cfg); | ||
5438 | spin_unlock_irqrestore(&sti->lock, flags); | ||
5439 | } while (ret == 1); | ||
5440 | } | ||
5441 | @@ -126,7 +134,8 @@ static const struct sti_font_flags default_font_flags = { | ||
5442 | void | ||
5443 | sti_putc(struct sti_struct *sti, int c, int y, int x) | ||
5444 | { | ||
5445 | - struct sti_font_inptr inptr = { | ||
5446 | + struct sti_font_inptr *inptr = &sti->sti_data->font_inptr; | ||
5447 | + struct sti_font_inptr inptr_default = { | ||
5448 | .font_start_addr= STI_PTR(sti->font->raw), | ||
5449 | .index = c_index(sti, c), | ||
5450 | .fg_color = c_fg(sti, c), | ||
5451 | @@ -134,14 +143,15 @@ sti_putc(struct sti_struct *sti, int c, int y, int x) | ||
5452 | .dest_x = x * sti->font_width, | ||
5453 | .dest_y = y * sti->font_height, | ||
5454 | }; | ||
5455 | - struct sti_font_outptr outptr = { 0, }; | ||
5456 | + struct sti_font_outptr *outptr = &sti->sti_data->font_outptr; | ||
5457 | s32 ret; | ||
5458 | unsigned long flags; | ||
5459 | |||
5460 | do { | ||
5461 | spin_lock_irqsave(&sti->lock, flags); | ||
5462 | - ret = STI_CALL(sti->font_unpmv, &default_font_flags, | ||
5463 | - &inptr, &outptr, sti->glob_cfg); | ||
5464 | + *inptr = inptr_default; | ||
5465 | + ret = sti_call(sti, sti->font_unpmv, &default_font_flags, | ||
5466 | + inptr, outptr, sti->glob_cfg); | ||
5467 | spin_unlock_irqrestore(&sti->lock, flags); | ||
5468 | } while (ret == 1); | ||
5469 | } | ||
5470 | @@ -156,7 +166,8 @@ void | ||
5471 | sti_set(struct sti_struct *sti, int src_y, int src_x, | ||
5472 | int height, int width, u8 color) | ||
5473 | { | ||
5474 | - struct sti_blkmv_inptr inptr = { | ||
5475 | + struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; | ||
5476 | + struct sti_blkmv_inptr inptr_default = { | ||
5477 | .fg_color = color, | ||
5478 | .bg_color = color, | ||
5479 | .src_x = src_x, | ||
5480 | @@ -166,14 +177,15 @@ sti_set(struct sti_struct *sti, int src_y, int src_x, | ||
5481 | .width = width, | ||
5482 | .height = height, | ||
5483 | }; | ||
5484 | - struct sti_blkmv_outptr outptr = { 0, }; | ||
5485 | + struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; | ||
5486 | s32 ret; | ||
5487 | unsigned long flags; | ||
5488 | |||
5489 | do { | ||
5490 | spin_lock_irqsave(&sti->lock, flags); | ||
5491 | - ret = STI_CALL(sti->block_move, &clear_blkmv_flags, | ||
5492 | - &inptr, &outptr, sti->glob_cfg); | ||
5493 | + *inptr = inptr_default; | ||
5494 | + ret = sti_call(sti, sti->block_move, &clear_blkmv_flags, | ||
5495 | + inptr, outptr, sti->glob_cfg); | ||
5496 | spin_unlock_irqrestore(&sti->lock, flags); | ||
5497 | } while (ret == 1); | ||
5498 | } | ||
5499 | @@ -182,7 +194,8 @@ void | ||
5500 | sti_clear(struct sti_struct *sti, int src_y, int src_x, | ||
5501 | int height, int width, int c) | ||
5502 | { | ||
5503 | - struct sti_blkmv_inptr inptr = { | ||
5504 | + struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; | ||
5505 | + struct sti_blkmv_inptr inptr_default = { | ||
5506 | .fg_color = c_fg(sti, c), | ||
5507 | .bg_color = c_bg(sti, c), | ||
5508 | .src_x = src_x * sti->font_width, | ||
5509 | @@ -192,14 +205,15 @@ sti_clear(struct sti_struct *sti, int src_y, int src_x, | ||
5510 | .width = width * sti->font_width, | ||
5511 | .height = height* sti->font_height, | ||
5512 | }; | ||
5513 | - struct sti_blkmv_outptr outptr = { 0, }; | ||
5514 | + struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; | ||
5515 | s32 ret; | ||
5516 | unsigned long flags; | ||
5517 | |||
5518 | do { | ||
5519 | spin_lock_irqsave(&sti->lock, flags); | ||
5520 | - ret = STI_CALL(sti->block_move, &clear_blkmv_flags, | ||
5521 | - &inptr, &outptr, sti->glob_cfg); | ||
5522 | + *inptr = inptr_default; | ||
5523 | + ret = sti_call(sti, sti->block_move, &clear_blkmv_flags, | ||
5524 | + inptr, outptr, sti->glob_cfg); | ||
5525 | spin_unlock_irqrestore(&sti->lock, flags); | ||
5526 | } while (ret == 1); | ||
5527 | } | ||
5528 | @@ -212,7 +226,8 @@ void | ||
5529 | sti_bmove(struct sti_struct *sti, int src_y, int src_x, | ||
5530 | int dst_y, int dst_x, int height, int width) | ||
5531 | { | ||
5532 | - struct sti_blkmv_inptr inptr = { | ||
5533 | + struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; | ||
5534 | + struct sti_blkmv_inptr inptr_default = { | ||
5535 | .src_x = src_x * sti->font_width, | ||
5536 | .src_y = src_y * sti->font_height, | ||
5537 | .dest_x = dst_x * sti->font_width, | ||
5538 | @@ -220,14 +235,15 @@ sti_bmove(struct sti_struct *sti, int src_y, int src_x, | ||
5539 | .width = width * sti->font_width, | ||
5540 | .height = height* sti->font_height, | ||
5541 | }; | ||
5542 | - struct sti_blkmv_outptr outptr = { 0, }; | ||
5543 | + struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; | ||
5544 | s32 ret; | ||
5545 | unsigned long flags; | ||
5546 | |||
5547 | do { | ||
5548 | spin_lock_irqsave(&sti->lock, flags); | ||
5549 | - ret = STI_CALL(sti->block_move, &default_blkmv_flags, | ||
5550 | - &inptr, &outptr, sti->glob_cfg); | ||
5551 | + *inptr = inptr_default; | ||
5552 | + ret = sti_call(sti, sti->block_move, &default_blkmv_flags, | ||
5553 | + inptr, outptr, sti->glob_cfg); | ||
5554 | spin_unlock_irqrestore(&sti->lock, flags); | ||
5555 | } while (ret == 1); | ||
5556 | } | ||
5557 | @@ -284,7 +300,7 @@ __setup("sti=", sti_setup); | ||
5558 | |||
5559 | |||
5560 | |||
5561 | -static char *font_name[MAX_STI_ROMS] = { "VGA8x16", }; | ||
5562 | +static char *font_name[MAX_STI_ROMS]; | ||
5563 | static int font_index[MAX_STI_ROMS], | ||
5564 | font_height[MAX_STI_ROMS], | ||
5565 | font_width[MAX_STI_ROMS]; | ||
5566 | @@ -389,10 +405,10 @@ static void sti_dump_outptr(struct sti_struct *sti) | ||
5567 | "%d used bits\n" | ||
5568 | "%d planes\n" | ||
5569 | "attributes %08x\n", | ||
5570 | - sti->outptr.bits_per_pixel, | ||
5571 | - sti->outptr.bits_used, | ||
5572 | - sti->outptr.planes, | ||
5573 | - sti->outptr.attributes)); | ||
5574 | + sti->sti_data->inq_outptr.bits_per_pixel, | ||
5575 | + sti->sti_data->inq_outptr.bits_used, | ||
5576 | + sti->sti_data->inq_outptr.planes, | ||
5577 | + sti->sti_data->inq_outptr.attributes)); | ||
5578 | } | ||
5579 | |||
5580 | static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, | ||
5581 | @@ -402,24 +418,21 @@ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, | ||
5582 | struct sti_glob_cfg_ext *glob_cfg_ext; | ||
5583 | void *save_addr; | ||
5584 | void *sti_mem_addr; | ||
5585 | - const int save_addr_size = 1024; /* XXX */ | ||
5586 | - int i; | ||
5587 | + int i, size; | ||
5588 | |||
5589 | - if (!sti->sti_mem_request) | ||
5590 | + if (sti->sti_mem_request < 256) | ||
5591 | sti->sti_mem_request = 256; /* STI default */ | ||
5592 | |||
5593 | - glob_cfg = kzalloc(sizeof(*sti->glob_cfg), GFP_KERNEL); | ||
5594 | - glob_cfg_ext = kzalloc(sizeof(*glob_cfg_ext), GFP_KERNEL); | ||
5595 | - save_addr = kzalloc(save_addr_size, GFP_KERNEL); | ||
5596 | - sti_mem_addr = kzalloc(sti->sti_mem_request, GFP_KERNEL); | ||
5597 | + size = sizeof(struct sti_all_data) + sti->sti_mem_request - 256; | ||
5598 | |||
5599 | - if (!(glob_cfg && glob_cfg_ext && save_addr && sti_mem_addr)) { | ||
5600 | - kfree(glob_cfg); | ||
5601 | - kfree(glob_cfg_ext); | ||
5602 | - kfree(save_addr); | ||
5603 | - kfree(sti_mem_addr); | ||
5604 | + sti->sti_data = kzalloc(size, STI_LOWMEM); | ||
5605 | + if (!sti->sti_data) | ||
5606 | return -ENOMEM; | ||
5607 | - } | ||
5608 | + | ||
5609 | + glob_cfg = &sti->sti_data->glob_cfg; | ||
5610 | + glob_cfg_ext = &sti->sti_data->glob_cfg_ext; | ||
5611 | + save_addr = &sti->sti_data->save_addr; | ||
5612 | + sti_mem_addr = &sti->sti_data->sti_mem_addr; | ||
5613 | |||
5614 | glob_cfg->ext_ptr = STI_PTR(glob_cfg_ext); | ||
5615 | glob_cfg->save_addr = STI_PTR(save_addr); | ||
5616 | @@ -475,32 +488,31 @@ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, | ||
5617 | return 0; | ||
5618 | } | ||
5619 | |||
5620 | -#ifdef CONFIG_FB | ||
5621 | +#ifdef CONFIG_FONTS | ||
5622 | static struct sti_cooked_font * | ||
5623 | sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) | ||
5624 | { | ||
5625 | - const struct font_desc *fbfont; | ||
5626 | + const struct font_desc *fbfont = NULL; | ||
5627 | unsigned int size, bpc; | ||
5628 | void *dest; | ||
5629 | struct sti_rom_font *nf; | ||
5630 | struct sti_cooked_font *cooked_font; | ||
5631 | |||
5632 | - if (!fbfont_name || !strlen(fbfont_name)) | ||
5633 | - return NULL; | ||
5634 | - fbfont = find_font(fbfont_name); | ||
5635 | + if (fbfont_name && strlen(fbfont_name)) | ||
5636 | + fbfont = find_font(fbfont_name); | ||
5637 | if (!fbfont) | ||
5638 | fbfont = get_default_font(1024,768, ~(u32)0, ~(u32)0); | ||
5639 | if (!fbfont) | ||
5640 | return NULL; | ||
5641 | |||
5642 | - DPRINTK((KERN_DEBUG "selected %dx%d fb-font %s\n", | ||
5643 | - fbfont->width, fbfont->height, fbfont->name)); | ||
5644 | + pr_info("STI selected %dx%d framebuffer font %s for sticon\n", | ||
5645 | + fbfont->width, fbfont->height, fbfont->name); | ||
5646 | |||
5647 | bpc = ((fbfont->width+7)/8) * fbfont->height; | ||
5648 | size = bpc * 256; | ||
5649 | size += sizeof(struct sti_rom_font); | ||
5650 | |||
5651 | - nf = kzalloc(size, GFP_KERNEL); | ||
5652 | + nf = kzalloc(size, STI_LOWMEM); | ||
5653 | if (!nf) | ||
5654 | return NULL; | ||
5655 | |||
5656 | @@ -637,7 +649,7 @@ static void *sti_bmode_font_raw(struct sti_cooked_font *f) | ||
5657 | unsigned char *n, *p, *q; | ||
5658 | int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font); | ||
5659 | |||
5660 | - n = kzalloc (4*size, GFP_KERNEL); | ||
5661 | + n = kzalloc(4*size, STI_LOWMEM); | ||
5662 | if (!n) | ||
5663 | return NULL; | ||
5664 | p = n + 3; | ||
5665 | @@ -673,7 +685,7 @@ static struct sti_rom *sti_get_bmode_rom (unsigned long address) | ||
5666 | sti_bmode_rom_copy(address + BMODE_LAST_ADDR_OFFS, sizeof(size), &size); | ||
5667 | |||
5668 | size = (size+3) / 4; | ||
5669 | - raw = kmalloc(size, GFP_KERNEL); | ||
5670 | + raw = kmalloc(size, STI_LOWMEM); | ||
5671 | if (raw) { | ||
5672 | sti_bmode_rom_copy(address, size, raw); | ||
5673 | memmove (&raw->res004, &raw->type[0], 0x3c); | ||
5674 | @@ -707,7 +719,7 @@ static struct sti_rom *sti_get_wmode_rom(unsigned long address) | ||
5675 | /* read the ROM size directly from the struct in ROM */ | ||
5676 | size = gsc_readl(address + offsetof(struct sti_rom,last_addr)); | ||
5677 | |||
5678 | - raw = kmalloc(size, GFP_KERNEL); | ||
5679 | + raw = kmalloc(size, STI_LOWMEM); | ||
5680 | if (raw) | ||
5681 | sti_rom_copy(address, size, raw); | ||
5682 | |||
5683 | @@ -743,6 +755,10 @@ static int sti_read_rom(int wordmode, struct sti_struct *sti, | ||
5684 | |||
5685 | address = (unsigned long) STI_PTR(raw); | ||
5686 | |||
5687 | + pr_info("STI ROM supports 32 %sbit firmware functions.\n", | ||
5688 | + raw->alt_code_type == ALT_CODE_TYPE_PA_RISC_64 | ||
5689 | + ? "and 64 " : ""); | ||
5690 | + | ||
5691 | sti->font_unpmv = address + (raw->font_unpmv & 0x03ffffff); | ||
5692 | sti->block_move = address + (raw->block_move & 0x03ffffff); | ||
5693 | sti->init_graph = address + (raw->init_graph & 0x03ffffff); | ||
5694 | @@ -901,7 +917,8 @@ test_rom: | ||
5695 | sti_dump_globcfg(sti->glob_cfg, sti->sti_mem_request); | ||
5696 | sti_dump_outptr(sti); | ||
5697 | |||
5698 | - printk(KERN_INFO " graphics card name: %s\n", sti->outptr.dev_name ); | ||
5699 | + pr_info(" graphics card name: %s\n", | ||
5700 | + sti->sti_data->inq_outptr.dev_name); | ||
5701 | |||
5702 | sti_roms[num_sti_roms] = sti; | ||
5703 | num_sti_roms++; | ||
5704 | @@ -1073,6 +1090,29 @@ struct sti_struct * sti_get_rom(unsigned int index) | ||
5705 | } | ||
5706 | EXPORT_SYMBOL(sti_get_rom); | ||
5707 | |||
5708 | + | ||
5709 | +int sti_call(const struct sti_struct *sti, unsigned long func, | ||
5710 | + const void *flags, void *inptr, void *outptr, | ||
5711 | + struct sti_glob_cfg *glob_cfg) | ||
5712 | +{ | ||
5713 | + unsigned long _flags = STI_PTR(flags); | ||
5714 | + unsigned long _inptr = STI_PTR(inptr); | ||
5715 | + unsigned long _outptr = STI_PTR(outptr); | ||
5716 | + unsigned long _glob_cfg = STI_PTR(glob_cfg); | ||
5717 | + int ret; | ||
5718 | + | ||
5719 | +#ifdef CONFIG_64BIT | ||
5720 | + /* Check for overflow when using 32bit STI on 64bit kernel. */ | ||
5721 | + if (WARN_ONCE(_flags>>32 || _inptr>>32 || _outptr>>32 || _glob_cfg>>32, | ||
5722 | + "Out of 32bit-range pointers!")) | ||
5723 | + return -1; | ||
5724 | +#endif | ||
5725 | + | ||
5726 | + ret = pdc_sti_call(func, _flags, _inptr, _outptr, _glob_cfg); | ||
5727 | + | ||
5728 | + return ret; | ||
5729 | +} | ||
5730 | + | ||
5731 | MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer"); | ||
5732 | MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines"); | ||
5733 | MODULE_LICENSE("GPL v2"); | ||
5734 | diff --git a/drivers/video/sticore.h b/drivers/video/sticore.h | ||
5735 | index addf7b61..af161953 100644 | ||
5736 | --- a/drivers/video/sticore.h | ||
5737 | +++ b/drivers/video/sticore.h | ||
5738 | @@ -18,6 +18,9 @@ | ||
5739 | #define STI_FONT_HPROMAN8 1 | ||
5740 | #define STI_FONT_KANA8 2 | ||
5741 | |||
5742 | +#define ALT_CODE_TYPE_UNKNOWN 0x00 /* alt code type values */ | ||
5743 | +#define ALT_CODE_TYPE_PA_RISC_64 0x01 | ||
5744 | + | ||
5745 | /* The latency of the STI functions cannot really be reduced by setting | ||
5746 | * this to 0; STI doesn't seem to be designed to allow calling a different | ||
5747 | * function (or the same function with different arguments) after a | ||
5748 | @@ -40,14 +43,6 @@ | ||
5749 | |||
5750 | #define STI_PTR(p) ( virt_to_phys(p) ) | ||
5751 | #define PTR_STI(p) ( phys_to_virt((unsigned long)p) ) | ||
5752 | -#define STI_CALL(func, flags, inptr, outptr, glob_cfg) \ | ||
5753 | - ({ \ | ||
5754 | - pdc_sti_call( func, STI_PTR(flags), \ | ||
5755 | - STI_PTR(inptr), \ | ||
5756 | - STI_PTR(outptr), \ | ||
5757 | - STI_PTR(glob_cfg)); \ | ||
5758 | - }) | ||
5759 | - | ||
5760 | |||
5761 | #define sti_onscreen_x(sti) (sti->glob_cfg->onscreen_x) | ||
5762 | #define sti_onscreen_y(sti) (sti->glob_cfg->onscreen_y) | ||
5763 | @@ -56,6 +51,12 @@ | ||
5764 | #define sti_font_x(sti) (PTR_STI(sti->font)->width) | ||
5765 | #define sti_font_y(sti) (PTR_STI(sti->font)->height) | ||
5766 | |||
5767 | +#ifdef CONFIG_64BIT | ||
5768 | +#define STI_LOWMEM (GFP_KERNEL | GFP_DMA) | ||
5769 | +#else | ||
5770 | +#define STI_LOWMEM (GFP_KERNEL) | ||
5771 | +#endif | ||
5772 | + | ||
5773 | |||
5774 | /* STI function configuration structs */ | ||
5775 | |||
5776 | @@ -306,6 +307,34 @@ struct sti_blkmv_outptr { | ||
5777 | }; | ||
5778 | |||
5779 | |||
5780 | +/* sti_all_data is an internal struct which needs to be allocated in | ||
5781 | + * low memory (< 4GB) if STI is used with 32bit STI on a 64bit kernel */ | ||
5782 | + | ||
5783 | +struct sti_all_data { | ||
5784 | + struct sti_glob_cfg glob_cfg; | ||
5785 | + struct sti_glob_cfg_ext glob_cfg_ext; | ||
5786 | + | ||
5787 | + struct sti_conf_inptr inq_inptr; | ||
5788 | + struct sti_conf_outptr inq_outptr; /* configuration */ | ||
5789 | + struct sti_conf_outptr_ext inq_outptr_ext; | ||
5790 | + | ||
5791 | + struct sti_init_inptr_ext init_inptr_ext; | ||
5792 | + struct sti_init_inptr init_inptr; | ||
5793 | + struct sti_init_outptr init_outptr; | ||
5794 | + | ||
5795 | + struct sti_blkmv_inptr blkmv_inptr; | ||
5796 | + struct sti_blkmv_outptr blkmv_outptr; | ||
5797 | + | ||
5798 | + struct sti_font_inptr font_inptr; | ||
5799 | + struct sti_font_outptr font_outptr; | ||
5800 | + | ||
5801 | + /* leave as last entries */ | ||
5802 | + unsigned long save_addr[1024 / sizeof(unsigned long)]; | ||
5803 | + /* min 256 bytes which is STI default, max sti->sti_mem_request */ | ||
5804 | + unsigned long sti_mem_addr[256 / sizeof(unsigned long)]; | ||
5805 | + /* do not add something below here ! */ | ||
5806 | +}; | ||
5807 | + | ||
5808 | /* internal generic STI struct */ | ||
5809 | |||
5810 | struct sti_struct { | ||
5811 | @@ -330,11 +359,9 @@ struct sti_struct { | ||
5812 | region_t regions[STI_REGION_MAX]; | ||
5813 | unsigned long regions_phys[STI_REGION_MAX]; | ||
5814 | |||
5815 | - struct sti_glob_cfg *glob_cfg; | ||
5816 | - struct sti_cooked_font *font; /* ptr to selected font (cooked) */ | ||
5817 | + struct sti_glob_cfg *glob_cfg; /* points into sti_all_data */ | ||
5818 | |||
5819 | - struct sti_conf_outptr outptr; /* configuration */ | ||
5820 | - struct sti_conf_outptr_ext outptr_ext; | ||
5821 | + struct sti_cooked_font *font; /* ptr to selected font (cooked) */ | ||
5822 | |||
5823 | struct pci_dev *pd; | ||
5824 | |||
5825 | @@ -343,6 +370,9 @@ struct sti_struct { | ||
5826 | |||
5827 | /* pointer to the fb_info where this STI device is used */ | ||
5828 | struct fb_info *info; | ||
5829 | + | ||
5830 | + /* pointer to all internal data */ | ||
5831 | + struct sti_all_data *sti_data; | ||
5832 | }; | ||
5833 | |||
5834 | |||
5835 | @@ -350,6 +380,14 @@ struct sti_struct { | ||
5836 | |||
5837 | struct sti_struct *sti_get_rom(unsigned int index); /* 0: default sti */ | ||
5838 | |||
5839 | + | ||
5840 | +/* sticore main function to call STI firmware */ | ||
5841 | + | ||
5842 | +int sti_call(const struct sti_struct *sti, unsigned long func, | ||
5843 | + const void *flags, void *inptr, void *outptr, | ||
5844 | + struct sti_glob_cfg *glob_cfg); | ||
5845 | + | ||
5846 | + | ||
5847 | /* functions to call the STI ROM directly */ | ||
5848 | |||
5849 | void sti_putc(struct sti_struct *sti, int c, int y, int x); | ||
5850 | diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c | ||
5851 | index 876648e1..019a1fee 100644 | ||
5852 | --- a/drivers/video/stifb.c | ||
5853 | +++ b/drivers/video/stifb.c | ||
5854 | @@ -1101,6 +1101,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) | ||
5855 | var = &info->var; | ||
5856 | |||
5857 | fb->sti = sti; | ||
5858 | + dev_name = sti->sti_data->inq_outptr.dev_name; | ||
5859 | /* store upper 32bits of the graphics id */ | ||
5860 | fb->id = fb->sti->graphics_id[0]; | ||
5861 | |||
5862 | @@ -1114,11 +1115,11 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) | ||
5863 | Since this driver only supports standard mode, we check | ||
5864 | if the device name contains the string "DX" and tell the | ||
5865 | user how to reconfigure the card. */ | ||
5866 | - if (strstr(sti->outptr.dev_name, "DX")) { | ||
5867 | + if (strstr(dev_name, "DX")) { | ||
5868 | printk(KERN_WARNING | ||
5869 | "WARNING: stifb framebuffer driver does not support '%s' in double-buffer mode.\n" | ||
5870 | "WARNING: Please disable the double-buffer mode in IPL menu (the PARISC-BIOS).\n", | ||
5871 | - sti->outptr.dev_name); | ||
5872 | + dev_name); | ||
5873 | goto out_err0; | ||
5874 | } | ||
5875 | /* fall though */ | ||
5876 | @@ -1130,7 +1131,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) | ||
5877 | break; | ||
5878 | default: | ||
5879 | printk(KERN_WARNING "stifb: '%s' (id: 0x%08x) not supported.\n", | ||
5880 | - sti->outptr.dev_name, fb->id); | ||
5881 | + dev_name, fb->id); | ||
5882 | goto out_err0; | ||
5883 | } | ||
5884 | |||
5885 | @@ -1154,7 +1155,6 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) | ||
5886 | fb->id = S9000_ID_A1659A; | ||
5887 | break; | ||
5888 | case S9000_ID_TIMBER: /* HP9000/710 Any (may be a grayscale device) */ | ||
5889 | - dev_name = fb->sti->outptr.dev_name; | ||
5890 | if (strstr(dev_name, "GRAYSCALE") || | ||
5891 | strstr(dev_name, "Grayscale") || | ||
5892 | strstr(dev_name, "grayscale")) | ||
5893 | @@ -1290,7 +1290,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) | ||
5894 | var->xres, | ||
5895 | var->yres, | ||
5896 | var->bits_per_pixel, | ||
5897 | - sti->outptr.dev_name, | ||
5898 | + dev_name, | ||
5899 | fb->id, | ||
5900 | fix->mmio_start); | ||
5901 | |||
5902 | diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c | ||
5903 | index a58dc77c..d17c5d72 100644 | ||
5904 | --- a/fs/cifs/cifssmb.c | ||
5905 | +++ b/fs/cifs/cifssmb.c | ||
5906 | @@ -3306,11 +3306,13 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, | ||
5907 | return 0; | ||
5908 | } | ||
5909 | cifs_acl->version = cpu_to_le16(1); | ||
5910 | - if (acl_type == ACL_TYPE_ACCESS) | ||
5911 | + if (acl_type == ACL_TYPE_ACCESS) { | ||
5912 | cifs_acl->access_entry_count = cpu_to_le16(count); | ||
5913 | - else if (acl_type == ACL_TYPE_DEFAULT) | ||
5914 | + cifs_acl->default_entry_count = __constant_cpu_to_le16(0xFFFF); | ||
5915 | + } else if (acl_type == ACL_TYPE_DEFAULT) { | ||
5916 | cifs_acl->default_entry_count = cpu_to_le16(count); | ||
5917 | - else { | ||
5918 | + cifs_acl->access_entry_count = __constant_cpu_to_le16(0xFFFF); | ||
5919 | + } else { | ||
5920 | cifs_dbg(FYI, "unknown ACL type %d\n", acl_type); | ||
5921 | return 0; | ||
5922 | } | ||
5923 | diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c | ||
5924 | index 073d30b9..a726b9f2 100644 | ||
5925 | --- a/fs/devpts/inode.c | ||
5926 | +++ b/fs/devpts/inode.c | ||
5927 | @@ -498,6 +498,7 @@ static void devpts_kill_sb(struct super_block *sb) | ||
5928 | { | ||
5929 | struct pts_fs_info *fsi = DEVPTS_SB(sb); | ||
5930 | |||
5931 | + ida_destroy(&fsi->allocated_ptys); | ||
5932 | kfree(fsi); | ||
5933 | kill_litter_super(sb); | ||
5934 | } | ||
5935 | diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c | ||
5936 | index 03e9bebb..1423c481 100644 | ||
5937 | --- a/fs/ext4/xattr.c | ||
5938 | +++ b/fs/ext4/xattr.c | ||
5939 | @@ -1352,6 +1352,7 @@ retry: | ||
5940 | new_extra_isize = s_min_extra_isize; | ||
5941 | kfree(is); is = NULL; | ||
5942 | kfree(bs); bs = NULL; | ||
5943 | + brelse(bh); | ||
5944 | goto retry; | ||
5945 | } | ||
5946 | error = -1; | ||
5947 | diff --git a/fs/namei.c b/fs/namei.c | ||
5948 | index 9ed93612..cccaf77e 100644 | ||
5949 | --- a/fs/namei.c | ||
5950 | +++ b/fs/namei.c | ||
5951 | @@ -2263,6 +2263,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir) | ||
5952 | */ | ||
5953 | static inline int may_create(struct inode *dir, struct dentry *child) | ||
5954 | { | ||
5955 | + audit_inode_child(dir, child, AUDIT_TYPE_CHILD_CREATE); | ||
5956 | if (child->d_inode) | ||
5957 | return -EEXIST; | ||
5958 | if (IS_DEADDIR(dir)) | ||
5959 | diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h | ||
5960 | index f45b2a78..6b66efdc 100644 | ||
5961 | --- a/include/acpi/acpi_bus.h | ||
5962 | +++ b/include/acpi/acpi_bus.h | ||
5963 | @@ -97,6 +97,7 @@ enum acpi_hotplug_mode { | ||
5964 | struct acpi_hotplug_profile { | ||
5965 | struct kobject kobj; | ||
5966 | bool enabled:1; | ||
5967 | + bool ignore:1; | ||
5968 | enum acpi_hotplug_mode mode; | ||
5969 | }; | ||
5970 | |||
5971 | diff --git a/include/linux/audit.h b/include/linux/audit.h | ||
5972 | index b20b0385..729a4d16 100644 | ||
5973 | --- a/include/linux/audit.h | ||
5974 | +++ b/include/linux/audit.h | ||
5975 | @@ -103,8 +103,11 @@ extern void __audit_syscall_exit(int ret_success, long ret_value); | ||
5976 | extern struct filename *__audit_reusename(const __user char *uptr); | ||
5977 | extern void __audit_getname(struct filename *name); | ||
5978 | extern void audit_putname(struct filename *name); | ||
5979 | + | ||
5980 | +#define AUDIT_INODE_PARENT 1 /* dentry represents the parent */ | ||
5981 | +#define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */ | ||
5982 | extern void __audit_inode(struct filename *name, const struct dentry *dentry, | ||
5983 | - unsigned int parent); | ||
5984 | + unsigned int flags); | ||
5985 | extern void __audit_inode_child(const struct inode *parent, | ||
5986 | const struct dentry *dentry, | ||
5987 | const unsigned char type); | ||
5988 | @@ -148,10 +151,22 @@ static inline void audit_getname(struct filename *name) | ||
5989 | if (unlikely(!audit_dummy_context())) | ||
5990 | __audit_getname(name); | ||
5991 | } | ||
5992 | -static inline void audit_inode(struct filename *name, const struct dentry *dentry, | ||
5993 | +static inline void audit_inode(struct filename *name, | ||
5994 | + const struct dentry *dentry, | ||
5995 | unsigned int parent) { | ||
5996 | + if (unlikely(!audit_dummy_context())) { | ||
5997 | + unsigned int flags = 0; | ||
5998 | + if (parent) | ||
5999 | + flags |= AUDIT_INODE_PARENT; | ||
6000 | + __audit_inode(name, dentry, flags); | ||
6001 | + } | ||
6002 | +} | ||
6003 | +static inline void audit_inode_parent_hidden(struct filename *name, | ||
6004 | + const struct dentry *dentry) | ||
6005 | +{ | ||
6006 | if (unlikely(!audit_dummy_context())) | ||
6007 | - __audit_inode(name, dentry, parent); | ||
6008 | + __audit_inode(name, dentry, | ||
6009 | + AUDIT_INODE_PARENT | AUDIT_INODE_HIDDEN); | ||
6010 | } | ||
6011 | static inline void audit_inode_child(const struct inode *parent, | ||
6012 | const struct dentry *dentry, | ||
6013 | @@ -311,7 +326,7 @@ static inline void audit_putname(struct filename *name) | ||
6014 | { } | ||
6015 | static inline void __audit_inode(struct filename *name, | ||
6016 | const struct dentry *dentry, | ||
6017 | - unsigned int parent) | ||
6018 | + unsigned int flags) | ||
6019 | { } | ||
6020 | static inline void __audit_inode_child(const struct inode *parent, | ||
6021 | const struct dentry *dentry, | ||
6022 | @@ -321,6 +336,9 @@ static inline void audit_inode(struct filename *name, | ||
6023 | const struct dentry *dentry, | ||
6024 | unsigned int parent) | ||
6025 | { } | ||
6026 | +static inline void audit_inode_parent_hidden(struct filename *name, | ||
6027 | + const struct dentry *dentry) | ||
6028 | +{ } | ||
6029 | static inline void audit_inode_child(const struct inode *parent, | ||
6030 | const struct dentry *dentry, | ||
6031 | const unsigned char type) | ||
6032 | diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h | ||
6033 | index 19c19a5e..f6c82de1 100644 | ||
6034 | --- a/include/linux/ipc_namespace.h | ||
6035 | +++ b/include/linux/ipc_namespace.h | ||
6036 | @@ -34,9 +34,9 @@ struct ipc_namespace { | ||
6037 | int sem_ctls[4]; | ||
6038 | int used_sems; | ||
6039 | |||
6040 | - int msg_ctlmax; | ||
6041 | - int msg_ctlmnb; | ||
6042 | - int msg_ctlmni; | ||
6043 | + unsigned int msg_ctlmax; | ||
6044 | + unsigned int msg_ctlmnb; | ||
6045 | + unsigned int msg_ctlmni; | ||
6046 | atomic_t msg_bytes; | ||
6047 | atomic_t msg_hdrs; | ||
6048 | int auto_msgmni; | ||
6049 | diff --git a/include/linux/msg.h b/include/linux/msg.h | ||
6050 | index 391af8d1..e21f9d44 100644 | ||
6051 | --- a/include/linux/msg.h | ||
6052 | +++ b/include/linux/msg.h | ||
6053 | @@ -6,9 +6,9 @@ | ||
6054 | |||
6055 | /* one msg_msg structure for each message */ | ||
6056 | struct msg_msg { | ||
6057 | - struct list_head m_list; | ||
6058 | - long m_type; | ||
6059 | - int m_ts; /* message text size */ | ||
6060 | + struct list_head m_list; | ||
6061 | + long m_type; | ||
6062 | + size_t m_ts; /* message text size */ | ||
6063 | struct msg_msgseg* next; | ||
6064 | void *security; | ||
6065 | /* the actual message follows immediately */ | ||
6066 | diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h | ||
6067 | index 4b02512e..5f487d77 100644 | ||
6068 | --- a/include/linux/mtd/map.h | ||
6069 | +++ b/include/linux/mtd/map.h | ||
6070 | @@ -365,7 +365,7 @@ static inline map_word map_word_load_partial(struct map_info *map, map_word orig | ||
6071 | bitpos = (map_bankwidth(map)-1-i)*8; | ||
6072 | #endif | ||
6073 | orig.x[0] &= ~(0xff << bitpos); | ||
6074 | - orig.x[0] |= buf[i-start] << bitpos; | ||
6075 | + orig.x[0] |= (unsigned long)buf[i-start] << bitpos; | ||
6076 | } | ||
6077 | } | ||
6078 | return orig; | ||
6079 | @@ -384,7 +384,7 @@ static inline map_word map_word_ff(struct map_info *map) | ||
6080 | |||
6081 | if (map_bankwidth(map) < MAP_FF_LIMIT) { | ||
6082 | int bw = 8 * map_bankwidth(map); | ||
6083 | - r.x[0] = (1 << bw) - 1; | ||
6084 | + r.x[0] = (1UL << bw) - 1; | ||
6085 | } else { | ||
6086 | for (i=0; i<map_words(map); i++) | ||
6087 | r.x[i] = ~0UL; | ||
6088 | diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h | ||
6089 | index 977bc8a4..33131085 100644 | ||
6090 | --- a/include/net/netfilter/nf_conntrack_extend.h | ||
6091 | +++ b/include/net/netfilter/nf_conntrack_extend.h | ||
6092 | @@ -80,7 +80,7 @@ static inline void nf_ct_ext_destroy(struct nf_conn *ct) | ||
6093 | static inline void nf_ct_ext_free(struct nf_conn *ct) | ||
6094 | { | ||
6095 | if (ct->ext) | ||
6096 | - kfree(ct->ext); | ||
6097 | + kfree_rcu(ct->ext, rcu); | ||
6098 | } | ||
6099 | |||
6100 | /* Add this type, returns pointer to data or NULL. */ | ||
6101 | diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h | ||
6102 | index 19edd7fa..66dba421 100644 | ||
6103 | --- a/include/trace/ftrace.h | ||
6104 | +++ b/include/trace/ftrace.h | ||
6105 | @@ -368,7 +368,8 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ | ||
6106 | __data_size += (len) * sizeof(type); | ||
6107 | |||
6108 | #undef __string | ||
6109 | -#define __string(item, src) __dynamic_array(char, item, strlen(src) + 1) | ||
6110 | +#define __string(item, src) __dynamic_array(char, item, \ | ||
6111 | + strlen((src) ? (const char *)(src) : "(null)") + 1) | ||
6112 | |||
6113 | #undef DECLARE_EVENT_CLASS | ||
6114 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ | ||
6115 | @@ -498,7 +499,7 @@ static inline notrace int ftrace_get_offsets_##call( \ | ||
6116 | |||
6117 | #undef __assign_str | ||
6118 | #define __assign_str(dst, src) \ | ||
6119 | - strcpy(__get_str(dst), src); | ||
6120 | + strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)"); | ||
6121 | |||
6122 | #undef TP_fast_assign | ||
6123 | #define TP_fast_assign(args...) args | ||
6124 | diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c | ||
6125 | index 130dfece..b0e99deb 100644 | ||
6126 | --- a/ipc/ipc_sysctl.c | ||
6127 | +++ b/ipc/ipc_sysctl.c | ||
6128 | @@ -62,7 +62,7 @@ static int proc_ipc_dointvec_minmax_orphans(ctl_table *table, int write, | ||
6129 | return err; | ||
6130 | } | ||
6131 | |||
6132 | -static int proc_ipc_callback_dointvec(ctl_table *table, int write, | ||
6133 | +static int proc_ipc_callback_dointvec_minmax(ctl_table *table, int write, | ||
6134 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
6135 | { | ||
6136 | struct ctl_table ipc_table; | ||
6137 | @@ -72,7 +72,7 @@ static int proc_ipc_callback_dointvec(ctl_table *table, int write, | ||
6138 | memcpy(&ipc_table, table, sizeof(ipc_table)); | ||
6139 | ipc_table.data = get_ipc(table); | ||
6140 | |||
6141 | - rc = proc_dointvec(&ipc_table, write, buffer, lenp, ppos); | ||
6142 | + rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos); | ||
6143 | |||
6144 | if (write && !rc && lenp_bef == *lenp) | ||
6145 | /* | ||
6146 | @@ -152,15 +152,13 @@ static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write, | ||
6147 | #define proc_ipc_dointvec NULL | ||
6148 | #define proc_ipc_dointvec_minmax NULL | ||
6149 | #define proc_ipc_dointvec_minmax_orphans NULL | ||
6150 | -#define proc_ipc_callback_dointvec NULL | ||
6151 | +#define proc_ipc_callback_dointvec_minmax NULL | ||
6152 | #define proc_ipcauto_dointvec_minmax NULL | ||
6153 | #endif | ||
6154 | |||
6155 | static int zero; | ||
6156 | static int one = 1; | ||
6157 | -#ifdef CONFIG_CHECKPOINT_RESTORE | ||
6158 | static int int_max = INT_MAX; | ||
6159 | -#endif | ||
6160 | |||
6161 | static struct ctl_table ipc_kern_table[] = { | ||
6162 | { | ||
6163 | @@ -198,21 +196,27 @@ static struct ctl_table ipc_kern_table[] = { | ||
6164 | .data = &init_ipc_ns.msg_ctlmax, | ||
6165 | .maxlen = sizeof (init_ipc_ns.msg_ctlmax), | ||
6166 | .mode = 0644, | ||
6167 | - .proc_handler = proc_ipc_dointvec, | ||
6168 | + .proc_handler = proc_ipc_dointvec_minmax, | ||
6169 | + .extra1 = &zero, | ||
6170 | + .extra2 = &int_max, | ||
6171 | }, | ||
6172 | { | ||
6173 | .procname = "msgmni", | ||
6174 | .data = &init_ipc_ns.msg_ctlmni, | ||
6175 | .maxlen = sizeof (init_ipc_ns.msg_ctlmni), | ||
6176 | .mode = 0644, | ||
6177 | - .proc_handler = proc_ipc_callback_dointvec, | ||
6178 | + .proc_handler = proc_ipc_callback_dointvec_minmax, | ||
6179 | + .extra1 = &zero, | ||
6180 | + .extra2 = &int_max, | ||
6181 | }, | ||
6182 | { | ||
6183 | .procname = "msgmnb", | ||
6184 | .data = &init_ipc_ns.msg_ctlmnb, | ||
6185 | .maxlen = sizeof (init_ipc_ns.msg_ctlmnb), | ||
6186 | .mode = 0644, | ||
6187 | - .proc_handler = proc_ipc_dointvec, | ||
6188 | + .proc_handler = proc_ipc_dointvec_minmax, | ||
6189 | + .extra1 = &zero, | ||
6190 | + .extra2 = &int_max, | ||
6191 | }, | ||
6192 | { | ||
6193 | .procname = "sem", | ||
6194 | diff --git a/ipc/mqueue.c b/ipc/mqueue.c | ||
6195 | index e4e47f64..ae1996d3 100644 | ||
6196 | --- a/ipc/mqueue.c | ||
6197 | +++ b/ipc/mqueue.c | ||
6198 | @@ -823,6 +823,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, | ||
6199 | error = ro; | ||
6200 | goto out; | ||
6201 | } | ||
6202 | + audit_inode_parent_hidden(name, root); | ||
6203 | filp = do_create(ipc_ns, root->d_inode, | ||
6204 | &path, oflag, mode, | ||
6205 | u_attr ? &attr : NULL); | ||
6206 | @@ -868,6 +869,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name) | ||
6207 | if (IS_ERR(name)) | ||
6208 | return PTR_ERR(name); | ||
6209 | |||
6210 | + audit_inode_parent_hidden(name, mnt->mnt_root); | ||
6211 | err = mnt_want_write(mnt); | ||
6212 | if (err) | ||
6213 | goto out_name; | ||
6214 | diff --git a/ipc/msgutil.c b/ipc/msgutil.c | ||
6215 | index 491e71f2..7e709597 100644 | ||
6216 | --- a/ipc/msgutil.c | ||
6217 | +++ b/ipc/msgutil.c | ||
6218 | @@ -41,15 +41,15 @@ struct msg_msgseg { | ||
6219 | /* the next part of the message follows immediately */ | ||
6220 | }; | ||
6221 | |||
6222 | -#define DATALEN_MSG (int)(PAGE_SIZE-sizeof(struct msg_msg)) | ||
6223 | -#define DATALEN_SEG (int)(PAGE_SIZE-sizeof(struct msg_msgseg)) | ||
6224 | +#define DATALEN_MSG ((size_t)PAGE_SIZE-sizeof(struct msg_msg)) | ||
6225 | +#define DATALEN_SEG ((size_t)PAGE_SIZE-sizeof(struct msg_msgseg)) | ||
6226 | |||
6227 | |||
6228 | -static struct msg_msg *alloc_msg(int len) | ||
6229 | +static struct msg_msg *alloc_msg(size_t len) | ||
6230 | { | ||
6231 | struct msg_msg *msg; | ||
6232 | struct msg_msgseg **pseg; | ||
6233 | - int alen; | ||
6234 | + size_t alen; | ||
6235 | |||
6236 | alen = min(len, DATALEN_MSG); | ||
6237 | msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL); | ||
6238 | @@ -80,12 +80,12 @@ out_err: | ||
6239 | return NULL; | ||
6240 | } | ||
6241 | |||
6242 | -struct msg_msg *load_msg(const void __user *src, int len) | ||
6243 | +struct msg_msg *load_msg(const void __user *src, size_t len) | ||
6244 | { | ||
6245 | struct msg_msg *msg; | ||
6246 | struct msg_msgseg *seg; | ||
6247 | int err = -EFAULT; | ||
6248 | - int alen; | ||
6249 | + size_t alen; | ||
6250 | |||
6251 | msg = alloc_msg(len); | ||
6252 | if (msg == NULL) | ||
6253 | @@ -117,8 +117,8 @@ out_err: | ||
6254 | struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst) | ||
6255 | { | ||
6256 | struct msg_msgseg *dst_pseg, *src_pseg; | ||
6257 | - int len = src->m_ts; | ||
6258 | - int alen; | ||
6259 | + size_t len = src->m_ts; | ||
6260 | + size_t alen; | ||
6261 | |||
6262 | BUG_ON(dst == NULL); | ||
6263 | if (src->m_ts > dst->m_ts) | ||
6264 | @@ -147,9 +147,9 @@ struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst) | ||
6265 | return ERR_PTR(-ENOSYS); | ||
6266 | } | ||
6267 | #endif | ||
6268 | -int store_msg(void __user *dest, struct msg_msg *msg, int len) | ||
6269 | +int store_msg(void __user *dest, struct msg_msg *msg, size_t len) | ||
6270 | { | ||
6271 | - int alen; | ||
6272 | + size_t alen; | ||
6273 | struct msg_msgseg *seg; | ||
6274 | |||
6275 | alen = min(len, DATALEN_MSG); | ||
6276 | diff --git a/ipc/sem.c b/ipc/sem.c | ||
6277 | index 8c4f59b0..db9d241a 100644 | ||
6278 | --- a/ipc/sem.c | ||
6279 | +++ b/ipc/sem.c | ||
6280 | @@ -1282,6 +1282,12 @@ static int semctl_setval(struct ipc_namespace *ns, int semid, int semnum, | ||
6281 | |||
6282 | sem_lock(sma, NULL, -1); | ||
6283 | |||
6284 | + if (sma->sem_perm.deleted) { | ||
6285 | + sem_unlock(sma, -1); | ||
6286 | + rcu_read_unlock(); | ||
6287 | + return -EIDRM; | ||
6288 | + } | ||
6289 | + | ||
6290 | curr = &sma->sem_base[semnum]; | ||
6291 | |||
6292 | ipc_assert_locked_object(&sma->sem_perm); | ||
6293 | @@ -1336,12 +1342,14 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, | ||
6294 | int i; | ||
6295 | |||
6296 | sem_lock(sma, NULL, -1); | ||
6297 | + if (sma->sem_perm.deleted) { | ||
6298 | + err = -EIDRM; | ||
6299 | + goto out_unlock; | ||
6300 | + } | ||
6301 | if(nsems > SEMMSL_FAST) { | ||
6302 | if (!ipc_rcu_getref(sma)) { | ||
6303 | - sem_unlock(sma, -1); | ||
6304 | - rcu_read_unlock(); | ||
6305 | err = -EIDRM; | ||
6306 | - goto out_free; | ||
6307 | + goto out_unlock; | ||
6308 | } | ||
6309 | sem_unlock(sma, -1); | ||
6310 | rcu_read_unlock(); | ||
6311 | @@ -1354,10 +1362,8 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, | ||
6312 | rcu_read_lock(); | ||
6313 | sem_lock_and_putref(sma); | ||
6314 | if (sma->sem_perm.deleted) { | ||
6315 | - sem_unlock(sma, -1); | ||
6316 | - rcu_read_unlock(); | ||
6317 | err = -EIDRM; | ||
6318 | - goto out_free; | ||
6319 | + goto out_unlock; | ||
6320 | } | ||
6321 | } | ||
6322 | for (i = 0; i < sma->sem_nsems; i++) | ||
6323 | @@ -1375,8 +1381,8 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, | ||
6324 | struct sem_undo *un; | ||
6325 | |||
6326 | if (!ipc_rcu_getref(sma)) { | ||
6327 | - rcu_read_unlock(); | ||
6328 | - return -EIDRM; | ||
6329 | + err = -EIDRM; | ||
6330 | + goto out_rcu_wakeup; | ||
6331 | } | ||
6332 | rcu_read_unlock(); | ||
6333 | |||
6334 | @@ -1404,10 +1410,8 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, | ||
6335 | rcu_read_lock(); | ||
6336 | sem_lock_and_putref(sma); | ||
6337 | if (sma->sem_perm.deleted) { | ||
6338 | - sem_unlock(sma, -1); | ||
6339 | - rcu_read_unlock(); | ||
6340 | err = -EIDRM; | ||
6341 | - goto out_free; | ||
6342 | + goto out_unlock; | ||
6343 | } | ||
6344 | |||
6345 | for (i = 0; i < nsems; i++) | ||
6346 | @@ -1431,6 +1435,10 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, | ||
6347 | goto out_rcu_wakeup; | ||
6348 | |||
6349 | sem_lock(sma, NULL, -1); | ||
6350 | + if (sma->sem_perm.deleted) { | ||
6351 | + err = -EIDRM; | ||
6352 | + goto out_unlock; | ||
6353 | + } | ||
6354 | curr = &sma->sem_base[semnum]; | ||
6355 | |||
6356 | switch (cmd) { | ||
6357 | @@ -1836,6 +1844,10 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, | ||
6358 | if (error) | ||
6359 | goto out_rcu_wakeup; | ||
6360 | |||
6361 | + error = -EIDRM; | ||
6362 | + locknum = sem_lock(sma, sops, nsops); | ||
6363 | + if (sma->sem_perm.deleted) | ||
6364 | + goto out_unlock_free; | ||
6365 | /* | ||
6366 | * semid identifiers are not unique - find_alloc_undo may have | ||
6367 | * allocated an undo structure, it was invalidated by an RMID | ||
6368 | @@ -1843,8 +1855,6 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, | ||
6369 | * This case can be detected checking un->semid. The existence of | ||
6370 | * "un" itself is guaranteed by rcu. | ||
6371 | */ | ||
6372 | - error = -EIDRM; | ||
6373 | - locknum = sem_lock(sma, sops, nsops); | ||
6374 | if (un && un->semid == -1) | ||
6375 | goto out_unlock_free; | ||
6376 | |||
6377 | @@ -2057,6 +2067,12 @@ void exit_sem(struct task_struct *tsk) | ||
6378 | } | ||
6379 | |||
6380 | sem_lock(sma, NULL, -1); | ||
6381 | + /* exit_sem raced with IPC_RMID, nothing to do */ | ||
6382 | + if (sma->sem_perm.deleted) { | ||
6383 | + sem_unlock(sma, -1); | ||
6384 | + rcu_read_unlock(); | ||
6385 | + continue; | ||
6386 | + } | ||
6387 | un = __lookup_undo(ulp, semid); | ||
6388 | if (un == NULL) { | ||
6389 | /* exit_sem raced with IPC_RMID+semget() that created | ||
6390 | diff --git a/ipc/util.c b/ipc/util.c | ||
6391 | index fdb8ae74..7684f41b 100644 | ||
6392 | --- a/ipc/util.c | ||
6393 | +++ b/ipc/util.c | ||
6394 | @@ -17,12 +17,27 @@ | ||
6395 | * Pavel Emelianov <xemul@openvz.org> | ||
6396 | * | ||
6397 | * General sysv ipc locking scheme: | ||
6398 | - * when doing ipc id lookups, take the ids->rwsem | ||
6399 | - * rcu_read_lock() | ||
6400 | - * obtain the ipc object (kern_ipc_perm) | ||
6401 | - * perform security, capabilities, auditing and permission checks, etc. | ||
6402 | - * acquire the ipc lock (kern_ipc_perm.lock) throught ipc_lock_object() | ||
6403 | - * perform data updates (ie: SET, RMID, LOCK/UNLOCK commands) | ||
6404 | + * rcu_read_lock() | ||
6405 | + * obtain the ipc object (kern_ipc_perm) by looking up the id in an idr | ||
6406 | + * tree. | ||
6407 | + * - perform initial checks (capabilities, auditing and permission, | ||
6408 | + * etc). | ||
6409 | + * - perform read-only operations, such as STAT, INFO commands. | ||
6410 | + * acquire the ipc lock (kern_ipc_perm.lock) through | ||
6411 | + * ipc_lock_object() | ||
6412 | + * - perform data updates, such as SET, RMID commands and | ||
6413 | + * mechanism-specific operations (semop/semtimedop, | ||
6414 | + * msgsnd/msgrcv, shmat/shmdt). | ||
6415 | + * drop the ipc lock, through ipc_unlock_object(). | ||
6416 | + * rcu_read_unlock() | ||
6417 | + * | ||
6418 | + * The ids->rwsem must be taken when: | ||
6419 | + * - creating, removing and iterating the existing entries in ipc | ||
6420 | + * identifier sets. | ||
6421 | + * - iterating through files under /proc/sysvipc/ | ||
6422 | + * | ||
6423 | + * Note that sems have a special fast path that avoids kern_ipc_perm.lock - | ||
6424 | + * see sem_lock(). | ||
6425 | */ | ||
6426 | |||
6427 | #include <linux/mm.h> | ||
6428 | diff --git a/ipc/util.h b/ipc/util.h | ||
6429 | index f2f5036f..59d78aa9 100644 | ||
6430 | --- a/ipc/util.h | ||
6431 | +++ b/ipc/util.h | ||
6432 | @@ -148,9 +148,9 @@ int ipc_parse_version (int *cmd); | ||
6433 | #endif | ||
6434 | |||
6435 | extern void free_msg(struct msg_msg *msg); | ||
6436 | -extern struct msg_msg *load_msg(const void __user *src, int len); | ||
6437 | +extern struct msg_msg *load_msg(const void __user *src, size_t len); | ||
6438 | extern struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst); | ||
6439 | -extern int store_msg(void __user *dest, struct msg_msg *msg, int len); | ||
6440 | +extern int store_msg(void __user *dest, struct msg_msg *msg, size_t len); | ||
6441 | |||
6442 | extern void recompute_msgmni(struct ipc_namespace *); | ||
6443 | |||
6444 | diff --git a/kernel/audit.c b/kernel/audit.c | ||
6445 | index 7b0e23a7..7ddfd8a0 100644 | ||
6446 | --- a/kernel/audit.c | ||
6447 | +++ b/kernel/audit.c | ||
6448 | @@ -613,7 +613,7 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type) | ||
6449 | int rc = 0; | ||
6450 | uid_t uid = from_kuid(&init_user_ns, current_uid()); | ||
6451 | |||
6452 | - if (!audit_enabled) { | ||
6453 | + if (!audit_enabled && msg_type != AUDIT_USER_AVC) { | ||
6454 | *ab = NULL; | ||
6455 | return rc; | ||
6456 | } | ||
6457 | @@ -659,6 +659,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | ||
6458 | |||
6459 | switch (msg_type) { | ||
6460 | case AUDIT_GET: | ||
6461 | + status_set.mask = 0; | ||
6462 | status_set.enabled = audit_enabled; | ||
6463 | status_set.failure = audit_failure; | ||
6464 | status_set.pid = audit_pid; | ||
6465 | @@ -670,7 +671,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | ||
6466 | &status_set, sizeof(status_set)); | ||
6467 | break; | ||
6468 | case AUDIT_SET: | ||
6469 | - if (nlh->nlmsg_len < sizeof(struct audit_status)) | ||
6470 | + if (nlmsg_len(nlh) < sizeof(struct audit_status)) | ||
6471 | return -EINVAL; | ||
6472 | status_get = (struct audit_status *)data; | ||
6473 | if (status_get->mask & AUDIT_STATUS_ENABLED) { | ||
6474 | @@ -832,7 +833,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | ||
6475 | |||
6476 | memset(&s, 0, sizeof(s)); | ||
6477 | /* guard against past and future API changes */ | ||
6478 | - memcpy(&s, data, min(sizeof(s), (size_t)nlh->nlmsg_len)); | ||
6479 | + memcpy(&s, data, min_t(size_t, sizeof(s), nlmsg_len(nlh))); | ||
6480 | if ((s.enabled != 0 && s.enabled != 1) || | ||
6481 | (s.log_passwd != 0 && s.log_passwd != 1)) | ||
6482 | return -EINVAL; | ||
6483 | @@ -1536,6 +1537,26 @@ void audit_log_name(struct audit_context *context, struct audit_names *n, | ||
6484 | } | ||
6485 | } | ||
6486 | |||
6487 | + /* log the audit_names record type */ | ||
6488 | + audit_log_format(ab, " nametype="); | ||
6489 | + switch(n->type) { | ||
6490 | + case AUDIT_TYPE_NORMAL: | ||
6491 | + audit_log_format(ab, "NORMAL"); | ||
6492 | + break; | ||
6493 | + case AUDIT_TYPE_PARENT: | ||
6494 | + audit_log_format(ab, "PARENT"); | ||
6495 | + break; | ||
6496 | + case AUDIT_TYPE_CHILD_DELETE: | ||
6497 | + audit_log_format(ab, "DELETE"); | ||
6498 | + break; | ||
6499 | + case AUDIT_TYPE_CHILD_CREATE: | ||
6500 | + audit_log_format(ab, "CREATE"); | ||
6501 | + break; | ||
6502 | + default: | ||
6503 | + audit_log_format(ab, "UNKNOWN"); | ||
6504 | + break; | ||
6505 | + } | ||
6506 | + | ||
6507 | audit_log_fcaps(ab, n); | ||
6508 | audit_log_end(ab); | ||
6509 | } | ||
6510 | diff --git a/kernel/audit.h b/kernel/audit.h | ||
6511 | index 1c95131e..123c9b7c 100644 | ||
6512 | --- a/kernel/audit.h | ||
6513 | +++ b/kernel/audit.h | ||
6514 | @@ -85,6 +85,7 @@ struct audit_names { | ||
6515 | |||
6516 | struct filename *name; | ||
6517 | int name_len; /* number of chars to log */ | ||
6518 | + bool hidden; /* don't log this record */ | ||
6519 | bool name_put; /* call __putname()? */ | ||
6520 | |||
6521 | unsigned long ino; | ||
6522 | diff --git a/kernel/auditsc.c b/kernel/auditsc.c | ||
6523 | index 3c8a6013..9845cb32 100644 | ||
6524 | --- a/kernel/auditsc.c | ||
6525 | +++ b/kernel/auditsc.c | ||
6526 | @@ -1399,8 +1399,11 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts | ||
6527 | } | ||
6528 | |||
6529 | i = 0; | ||
6530 | - list_for_each_entry(n, &context->names_list, list) | ||
6531 | + list_for_each_entry(n, &context->names_list, list) { | ||
6532 | + if (n->hidden) | ||
6533 | + continue; | ||
6534 | audit_log_name(context, n, NULL, i++, &call_panic); | ||
6535 | + } | ||
6536 | |||
6537 | /* Send end of event record to help user space know we are finished */ | ||
6538 | ab = audit_log_start(context, GFP_KERNEL, AUDIT_EOE); | ||
6539 | @@ -1769,14 +1772,15 @@ void audit_putname(struct filename *name) | ||
6540 | * __audit_inode - store the inode and device from a lookup | ||
6541 | * @name: name being audited | ||
6542 | * @dentry: dentry being audited | ||
6543 | - * @parent: does this dentry represent the parent? | ||
6544 | + * @flags: attributes for this particular entry | ||
6545 | */ | ||
6546 | void __audit_inode(struct filename *name, const struct dentry *dentry, | ||
6547 | - unsigned int parent) | ||
6548 | + unsigned int flags) | ||
6549 | { | ||
6550 | struct audit_context *context = current->audit_context; | ||
6551 | const struct inode *inode = dentry->d_inode; | ||
6552 | struct audit_names *n; | ||
6553 | + bool parent = flags & AUDIT_INODE_PARENT; | ||
6554 | |||
6555 | if (!context->in_syscall) | ||
6556 | return; | ||
6557 | @@ -1831,6 +1835,8 @@ out: | ||
6558 | if (parent) { | ||
6559 | n->name_len = n->name ? parent_len(n->name->name) : AUDIT_NAME_FULL; | ||
6560 | n->type = AUDIT_TYPE_PARENT; | ||
6561 | + if (flags & AUDIT_INODE_HIDDEN) | ||
6562 | + n->hidden = true; | ||
6563 | } else { | ||
6564 | n->name_len = AUDIT_NAME_FULL; | ||
6565 | n->type = AUDIT_TYPE_NORMAL; | ||
6566 | diff --git a/kernel/cgroup.c b/kernel/cgroup.c | ||
6567 | index b6b26faf..d0def7fc 100644 | ||
6568 | --- a/kernel/cgroup.c | ||
6569 | +++ b/kernel/cgroup.c | ||
6570 | @@ -92,6 +92,14 @@ static DEFINE_MUTEX(cgroup_mutex); | ||
6571 | static DEFINE_MUTEX(cgroup_root_mutex); | ||
6572 | |||
6573 | /* | ||
6574 | + * cgroup destruction makes heavy use of work items and there can be a lot | ||
6575 | + * of concurrent destructions. Use a separate workqueue so that cgroup | ||
6576 | + * destruction work items don't end up filling up max_active of system_wq | ||
6577 | + * which may lead to deadlock. | ||
6578 | + */ | ||
6579 | +static struct workqueue_struct *cgroup_destroy_wq; | ||
6580 | + | ||
6581 | +/* | ||
6582 | * Generate an array of cgroup subsystem pointers. At boot time, this is | ||
6583 | * populated with the built in subsystems, and modular subsystems are | ||
6584 | * registered after that. The mutable section of this array is protected by | ||
6585 | @@ -873,7 +881,7 @@ static void cgroup_free_rcu(struct rcu_head *head) | ||
6586 | { | ||
6587 | struct cgroup *cgrp = container_of(head, struct cgroup, rcu_head); | ||
6588 | |||
6589 | - schedule_work(&cgrp->free_work); | ||
6590 | + queue_work(cgroup_destroy_wq, &cgrp->free_work); | ||
6591 | } | ||
6592 | |||
6593 | static void cgroup_diput(struct dentry *dentry, struct inode *inode) | ||
6594 | @@ -4686,6 +4694,22 @@ out: | ||
6595 | return err; | ||
6596 | } | ||
6597 | |||
6598 | +static int __init cgroup_wq_init(void) | ||
6599 | +{ | ||
6600 | + /* | ||
6601 | + * There isn't much point in executing destruction path in | ||
6602 | + * parallel. Good chunk is serialized with cgroup_mutex anyway. | ||
6603 | + * Use 1 for @max_active. | ||
6604 | + * | ||
6605 | + * We would prefer to do this in cgroup_init() above, but that | ||
6606 | + * is called before init_workqueues(): so leave this until after. | ||
6607 | + */ | ||
6608 | + cgroup_destroy_wq = alloc_workqueue("cgroup_destroy", 0, 1); | ||
6609 | + BUG_ON(!cgroup_destroy_wq); | ||
6610 | + return 0; | ||
6611 | +} | ||
6612 | +core_initcall(cgroup_wq_init); | ||
6613 | + | ||
6614 | /* | ||
6615 | * proc_cgroup_show() | ||
6616 | * - Print task's cgroup paths into seq_file, one line for each hierarchy | ||
6617 | @@ -4996,7 +5020,7 @@ void __css_put(struct cgroup_subsys_state *css) | ||
6618 | |||
6619 | v = css_unbias_refcnt(atomic_dec_return(&css->refcnt)); | ||
6620 | if (v == 0) | ||
6621 | - schedule_work(&css->dput_work); | ||
6622 | + queue_work(cgroup_destroy_wq, &css->dput_work); | ||
6623 | } | ||
6624 | EXPORT_SYMBOL_GPL(__css_put); | ||
6625 | |||
6626 | diff --git a/kernel/cpuset.c b/kernel/cpuset.c | ||
6627 | index 6948e947..d313870d 100644 | ||
6628 | --- a/kernel/cpuset.c | ||
6629 | +++ b/kernel/cpuset.c | ||
6630 | @@ -984,8 +984,10 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk, | ||
6631 | need_loop = task_has_mempolicy(tsk) || | ||
6632 | !nodes_intersects(*newmems, tsk->mems_allowed); | ||
6633 | |||
6634 | - if (need_loop) | ||
6635 | + if (need_loop) { | ||
6636 | + local_irq_disable(); | ||
6637 | write_seqcount_begin(&tsk->mems_allowed_seq); | ||
6638 | + } | ||
6639 | |||
6640 | nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems); | ||
6641 | mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP1); | ||
6642 | @@ -993,8 +995,10 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk, | ||
6643 | mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP2); | ||
6644 | tsk->mems_allowed = *newmems; | ||
6645 | |||
6646 | - if (need_loop) | ||
6647 | + if (need_loop) { | ||
6648 | write_seqcount_end(&tsk->mems_allowed_seq); | ||
6649 | + local_irq_enable(); | ||
6650 | + } | ||
6651 | |||
6652 | task_unlock(tsk); | ||
6653 | } | ||
6654 | diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c | ||
6655 | index 0de28576..91c04f16 100644 | ||
6656 | --- a/kernel/power/snapshot.c | ||
6657 | +++ b/kernel/power/snapshot.c | ||
6658 | @@ -1398,7 +1398,11 @@ int hibernate_preallocate_memory(void) | ||
6659 | * highmem and non-highmem zones separately. | ||
6660 | */ | ||
6661 | pages_highmem = preallocate_image_highmem(highmem / 2); | ||
6662 | - alloc = (count - max_size) - pages_highmem; | ||
6663 | + alloc = count - max_size; | ||
6664 | + if (alloc > pages_highmem) | ||
6665 | + alloc -= pages_highmem; | ||
6666 | + else | ||
6667 | + alloc = 0; | ||
6668 | pages = preallocate_image_memory(alloc, avail_normal); | ||
6669 | if (pages < alloc) { | ||
6670 | /* We have exhausted non-highmem pages, try highmem. */ | ||
6671 | diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c | ||
6672 | index f11d83b1..a8f5084d 100644 | ||
6673 | --- a/kernel/time/alarmtimer.c | ||
6674 | +++ b/kernel/time/alarmtimer.c | ||
6675 | @@ -445,7 +445,7 @@ static int alarm_clock_getres(const clockid_t which_clock, struct timespec *tp) | ||
6676 | clockid_t baseid = alarm_bases[clock2alarm(which_clock)].base_clockid; | ||
6677 | |||
6678 | if (!alarmtimer_get_rtcdev()) | ||
6679 | - return -ENOTSUPP; | ||
6680 | + return -EINVAL; | ||
6681 | |||
6682 | return hrtimer_get_res(baseid, tp); | ||
6683 | } | ||
6684 | @@ -462,7 +462,7 @@ static int alarm_clock_get(clockid_t which_clock, struct timespec *tp) | ||
6685 | struct alarm_base *base = &alarm_bases[clock2alarm(which_clock)]; | ||
6686 | |||
6687 | if (!alarmtimer_get_rtcdev()) | ||
6688 | - return -ENOTSUPP; | ||
6689 | + return -EINVAL; | ||
6690 | |||
6691 | *tp = ktime_to_timespec(base->gettime()); | ||
6692 | return 0; | ||
6693 | diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c | ||
6694 | index f23449d0..331c1021 100644 | ||
6695 | --- a/kernel/trace/ftrace.c | ||
6696 | +++ b/kernel/trace/ftrace.c | ||
6697 | @@ -367,9 +367,6 @@ static int remove_ftrace_list_ops(struct ftrace_ops **list, | ||
6698 | |||
6699 | static int __register_ftrace_function(struct ftrace_ops *ops) | ||
6700 | { | ||
6701 | - if (unlikely(ftrace_disabled)) | ||
6702 | - return -ENODEV; | ||
6703 | - | ||
6704 | if (FTRACE_WARN_ON(ops == &global_ops)) | ||
6705 | return -EINVAL; | ||
6706 | |||
6707 | @@ -417,9 +414,6 @@ static int __unregister_ftrace_function(struct ftrace_ops *ops) | ||
6708 | { | ||
6709 | int ret; | ||
6710 | |||
6711 | - if (ftrace_disabled) | ||
6712 | - return -ENODEV; | ||
6713 | - | ||
6714 | if (WARN_ON(!(ops->flags & FTRACE_OPS_FL_ENABLED))) | ||
6715 | return -EBUSY; | ||
6716 | |||
6717 | @@ -2048,10 +2042,15 @@ static void ftrace_startup_enable(int command) | ||
6718 | static int ftrace_startup(struct ftrace_ops *ops, int command) | ||
6719 | { | ||
6720 | bool hash_enable = true; | ||
6721 | + int ret; | ||
6722 | |||
6723 | if (unlikely(ftrace_disabled)) | ||
6724 | return -ENODEV; | ||
6725 | |||
6726 | + ret = __register_ftrace_function(ops); | ||
6727 | + if (ret) | ||
6728 | + return ret; | ||
6729 | + | ||
6730 | ftrace_start_up++; | ||
6731 | command |= FTRACE_UPDATE_CALLS; | ||
6732 | |||
6733 | @@ -2073,12 +2072,17 @@ static int ftrace_startup(struct ftrace_ops *ops, int command) | ||
6734 | return 0; | ||
6735 | } | ||
6736 | |||
6737 | -static void ftrace_shutdown(struct ftrace_ops *ops, int command) | ||
6738 | +static int ftrace_shutdown(struct ftrace_ops *ops, int command) | ||
6739 | { | ||
6740 | bool hash_disable = true; | ||
6741 | + int ret; | ||
6742 | |||
6743 | if (unlikely(ftrace_disabled)) | ||
6744 | - return; | ||
6745 | + return -ENODEV; | ||
6746 | + | ||
6747 | + ret = __unregister_ftrace_function(ops); | ||
6748 | + if (ret) | ||
6749 | + return ret; | ||
6750 | |||
6751 | ftrace_start_up--; | ||
6752 | /* | ||
6753 | @@ -2113,9 +2117,10 @@ static void ftrace_shutdown(struct ftrace_ops *ops, int command) | ||
6754 | } | ||
6755 | |||
6756 | if (!command || !ftrace_enabled) | ||
6757 | - return; | ||
6758 | + return 0; | ||
6759 | |||
6760 | ftrace_run_update_code(command); | ||
6761 | + return 0; | ||
6762 | } | ||
6763 | |||
6764 | static void ftrace_startup_sysctl(void) | ||
6765 | @@ -3020,16 +3025,13 @@ static void __enable_ftrace_function_probe(void) | ||
6766 | if (i == FTRACE_FUNC_HASHSIZE) | ||
6767 | return; | ||
6768 | |||
6769 | - ret = __register_ftrace_function(&trace_probe_ops); | ||
6770 | - if (!ret) | ||
6771 | - ret = ftrace_startup(&trace_probe_ops, 0); | ||
6772 | + ret = ftrace_startup(&trace_probe_ops, 0); | ||
6773 | |||
6774 | ftrace_probe_registered = 1; | ||
6775 | } | ||
6776 | |||
6777 | static void __disable_ftrace_function_probe(void) | ||
6778 | { | ||
6779 | - int ret; | ||
6780 | int i; | ||
6781 | |||
6782 | if (!ftrace_probe_registered) | ||
6783 | @@ -3042,9 +3044,7 @@ static void __disable_ftrace_function_probe(void) | ||
6784 | } | ||
6785 | |||
6786 | /* no more funcs left */ | ||
6787 | - ret = __unregister_ftrace_function(&trace_probe_ops); | ||
6788 | - if (!ret) | ||
6789 | - ftrace_shutdown(&trace_probe_ops, 0); | ||
6790 | + ftrace_shutdown(&trace_probe_ops, 0); | ||
6791 | |||
6792 | ftrace_probe_registered = 0; | ||
6793 | } | ||
6794 | @@ -4241,12 +4241,15 @@ core_initcall(ftrace_nodyn_init); | ||
6795 | static inline int ftrace_init_dyn_debugfs(struct dentry *d_tracer) { return 0; } | ||
6796 | static inline void ftrace_startup_enable(int command) { } | ||
6797 | /* Keep as macros so we do not need to define the commands */ | ||
6798 | -# define ftrace_startup(ops, command) \ | ||
6799 | - ({ \ | ||
6800 | - (ops)->flags |= FTRACE_OPS_FL_ENABLED; \ | ||
6801 | - 0; \ | ||
6802 | +# define ftrace_startup(ops, command) \ | ||
6803 | + ({ \ | ||
6804 | + int ___ret = __register_ftrace_function(ops); \ | ||
6805 | + if (!___ret) \ | ||
6806 | + (ops)->flags |= FTRACE_OPS_FL_ENABLED; \ | ||
6807 | + ___ret; \ | ||
6808 | }) | ||
6809 | -# define ftrace_shutdown(ops, command) do { } while (0) | ||
6810 | +# define ftrace_shutdown(ops, command) __unregister_ftrace_function(ops) | ||
6811 | + | ||
6812 | # define ftrace_startup_sysctl() do { } while (0) | ||
6813 | # define ftrace_shutdown_sysctl() do { } while (0) | ||
6814 | |||
6815 | @@ -4646,9 +4649,7 @@ int register_ftrace_function(struct ftrace_ops *ops) | ||
6816 | |||
6817 | mutex_lock(&ftrace_lock); | ||
6818 | |||
6819 | - ret = __register_ftrace_function(ops); | ||
6820 | - if (!ret) | ||
6821 | - ret = ftrace_startup(ops, 0); | ||
6822 | + ret = ftrace_startup(ops, 0); | ||
6823 | |||
6824 | mutex_unlock(&ftrace_lock); | ||
6825 | |||
6826 | @@ -4667,9 +4668,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops) | ||
6827 | int ret; | ||
6828 | |||
6829 | mutex_lock(&ftrace_lock); | ||
6830 | - ret = __unregister_ftrace_function(ops); | ||
6831 | - if (!ret) | ||
6832 | - ftrace_shutdown(ops, 0); | ||
6833 | + ret = ftrace_shutdown(ops, 0); | ||
6834 | mutex_unlock(&ftrace_lock); | ||
6835 | |||
6836 | return ret; | ||
6837 | @@ -4863,6 +4862,13 @@ ftrace_suspend_notifier_call(struct notifier_block *bl, unsigned long state, | ||
6838 | return NOTIFY_DONE; | ||
6839 | } | ||
6840 | |||
6841 | +/* Just a place holder for function graph */ | ||
6842 | +static struct ftrace_ops fgraph_ops __read_mostly = { | ||
6843 | + .func = ftrace_stub, | ||
6844 | + .flags = FTRACE_OPS_FL_STUB | FTRACE_OPS_FL_GLOBAL | | ||
6845 | + FTRACE_OPS_FL_RECURSION_SAFE, | ||
6846 | +}; | ||
6847 | + | ||
6848 | int register_ftrace_graph(trace_func_graph_ret_t retfunc, | ||
6849 | trace_func_graph_ent_t entryfunc) | ||
6850 | { | ||
6851 | @@ -4889,7 +4895,7 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc, | ||
6852 | ftrace_graph_return = retfunc; | ||
6853 | ftrace_graph_entry = entryfunc; | ||
6854 | |||
6855 | - ret = ftrace_startup(&global_ops, FTRACE_START_FUNC_RET); | ||
6856 | + ret = ftrace_startup(&fgraph_ops, FTRACE_START_FUNC_RET); | ||
6857 | |||
6858 | out: | ||
6859 | mutex_unlock(&ftrace_lock); | ||
6860 | @@ -4906,7 +4912,7 @@ void unregister_ftrace_graph(void) | ||
6861 | ftrace_graph_active--; | ||
6862 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; | ||
6863 | ftrace_graph_entry = ftrace_graph_entry_stub; | ||
6864 | - ftrace_shutdown(&global_ops, FTRACE_STOP_FUNC_RET); | ||
6865 | + ftrace_shutdown(&fgraph_ops, FTRACE_STOP_FUNC_RET); | ||
6866 | unregister_pm_notifier(&ftrace_suspend_notifier); | ||
6867 | unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL); | ||
6868 | |||
6869 | diff --git a/kernel/workqueue.c b/kernel/workqueue.c | ||
6870 | index e52d002d..68086a34 100644 | ||
6871 | --- a/kernel/workqueue.c | ||
6872 | +++ b/kernel/workqueue.c | ||
6873 | @@ -295,6 +295,9 @@ static DEFINE_HASHTABLE(unbound_pool_hash, UNBOUND_POOL_HASH_ORDER); | ||
6874 | /* I: attributes used when instantiating standard unbound pools on demand */ | ||
6875 | static struct workqueue_attrs *unbound_std_wq_attrs[NR_STD_WORKER_POOLS]; | ||
6876 | |||
6877 | +/* I: attributes used when instantiating ordered pools on demand */ | ||
6878 | +static struct workqueue_attrs *ordered_wq_attrs[NR_STD_WORKER_POOLS]; | ||
6879 | + | ||
6880 | struct workqueue_struct *system_wq __read_mostly; | ||
6881 | EXPORT_SYMBOL(system_wq); | ||
6882 | struct workqueue_struct *system_highpri_wq __read_mostly; | ||
6883 | @@ -4059,7 +4062,7 @@ out_unlock: | ||
6884 | static int alloc_and_link_pwqs(struct workqueue_struct *wq) | ||
6885 | { | ||
6886 | bool highpri = wq->flags & WQ_HIGHPRI; | ||
6887 | - int cpu; | ||
6888 | + int cpu, ret; | ||
6889 | |||
6890 | if (!(wq->flags & WQ_UNBOUND)) { | ||
6891 | wq->cpu_pwqs = alloc_percpu(struct pool_workqueue); | ||
6892 | @@ -4079,6 +4082,13 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq) | ||
6893 | mutex_unlock(&wq->mutex); | ||
6894 | } | ||
6895 | return 0; | ||
6896 | + } else if (wq->flags & __WQ_ORDERED) { | ||
6897 | + ret = apply_workqueue_attrs(wq, ordered_wq_attrs[highpri]); | ||
6898 | + /* there should only be single pwq for ordering guarantee */ | ||
6899 | + WARN(!ret && (wq->pwqs.next != &wq->dfl_pwq->pwqs_node || | ||
6900 | + wq->pwqs.prev != &wq->dfl_pwq->pwqs_node), | ||
6901 | + "ordering guarantee broken for workqueue %s\n", wq->name); | ||
6902 | + return ret; | ||
6903 | } else { | ||
6904 | return apply_workqueue_attrs(wq, unbound_std_wq_attrs[highpri]); | ||
6905 | } | ||
6906 | @@ -4990,13 +5000,23 @@ static int __init init_workqueues(void) | ||
6907 | } | ||
6908 | } | ||
6909 | |||
6910 | - /* create default unbound wq attrs */ | ||
6911 | + /* create default unbound and ordered wq attrs */ | ||
6912 | for (i = 0; i < NR_STD_WORKER_POOLS; i++) { | ||
6913 | struct workqueue_attrs *attrs; | ||
6914 | |||
6915 | BUG_ON(!(attrs = alloc_workqueue_attrs(GFP_KERNEL))); | ||
6916 | attrs->nice = std_nice[i]; | ||
6917 | unbound_std_wq_attrs[i] = attrs; | ||
6918 | + | ||
6919 | + /* | ||
6920 | + * An ordered wq should have only one pwq as ordering is | ||
6921 | + * guaranteed by max_active which is enforced by pwqs. | ||
6922 | + * Turn off NUMA so that dfl_pwq is used for all nodes. | ||
6923 | + */ | ||
6924 | + BUG_ON(!(attrs = alloc_workqueue_attrs(GFP_KERNEL))); | ||
6925 | + attrs->nice = std_nice[i]; | ||
6926 | + attrs->no_numa = true; | ||
6927 | + ordered_wq_attrs[i] = attrs; | ||
6928 | } | ||
6929 | |||
6930 | system_wq = alloc_workqueue("events", 0, 0); | ||
6931 | diff --git a/lib/vsprintf.c b/lib/vsprintf.c | ||
6932 | index e149c641..620fae4c 100644 | ||
6933 | --- a/lib/vsprintf.c | ||
6934 | +++ b/lib/vsprintf.c | ||
6935 | @@ -26,6 +26,7 @@ | ||
6936 | #include <linux/math64.h> | ||
6937 | #include <linux/uaccess.h> | ||
6938 | #include <linux/ioport.h> | ||
6939 | +#include <linux/cred.h> | ||
6940 | #include <net/addrconf.h> | ||
6941 | |||
6942 | #include <asm/page.h> /* for PAGE_SIZE */ | ||
6943 | @@ -1118,11 +1119,37 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, | ||
6944 | spec.field_width = default_width; | ||
6945 | return string(buf, end, "pK-error", spec); | ||
6946 | } | ||
6947 | - if (!((kptr_restrict == 0) || | ||
6948 | - (kptr_restrict == 1 && | ||
6949 | - has_capability_noaudit(current, CAP_SYSLOG)))) | ||
6950 | + | ||
6951 | + switch (kptr_restrict) { | ||
6952 | + case 0: | ||
6953 | + /* Always print %pK values */ | ||
6954 | + break; | ||
6955 | + case 1: { | ||
6956 | + /* | ||
6957 | + * Only print the real pointer value if the current | ||
6958 | + * process has CAP_SYSLOG and is running with the | ||
6959 | + * same credentials it started with. This is because | ||
6960 | + * access to files is checked at open() time, but %pK | ||
6961 | + * checks permission at read() time. We don't want to | ||
6962 | + * leak pointer values if a binary opens a file using | ||
6963 | + * %pK and then elevates privileges before reading it. | ||
6964 | + */ | ||
6965 | + const struct cred *cred = current_cred(); | ||
6966 | + | ||
6967 | + if (!has_capability_noaudit(current, CAP_SYSLOG) || | ||
6968 | + !uid_eq(cred->euid, cred->uid) || | ||
6969 | + !gid_eq(cred->egid, cred->gid)) | ||
6970 | + ptr = NULL; | ||
6971 | + break; | ||
6972 | + } | ||
6973 | + case 2: | ||
6974 | + default: | ||
6975 | + /* Always print 0's for %pK */ | ||
6976 | ptr = NULL; | ||
6977 | + break; | ||
6978 | + } | ||
6979 | break; | ||
6980 | + | ||
6981 | case 'N': | ||
6982 | switch (fmt[1]) { | ||
6983 | case 'F': | ||
6984 | diff --git a/mm/mmap.c b/mm/mmap.c | ||
6985 | index 8d25fdc6..8f87b14c 100644 | ||
6986 | --- a/mm/mmap.c | ||
6987 | +++ b/mm/mmap.c | ||
6988 | @@ -1853,7 +1853,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, | ||
6989 | struct vm_area_struct *vma; | ||
6990 | struct vm_unmapped_area_info info; | ||
6991 | |||
6992 | - if (len > TASK_SIZE) | ||
6993 | + if (len > TASK_SIZE - mmap_min_addr) | ||
6994 | return -ENOMEM; | ||
6995 | |||
6996 | if (flags & MAP_FIXED) | ||
6997 | @@ -1862,7 +1862,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, | ||
6998 | if (addr) { | ||
6999 | addr = PAGE_ALIGN(addr); | ||
7000 | vma = find_vma(mm, addr); | ||
7001 | - if (TASK_SIZE - len >= addr && | ||
7002 | + if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && | ||
7003 | (!vma || addr + len <= vma->vm_start)) | ||
7004 | return addr; | ||
7005 | } | ||
7006 | @@ -1901,7 +1901,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, | ||
7007 | struct vm_unmapped_area_info info; | ||
7008 | |||
7009 | /* requested length too big for entire address space */ | ||
7010 | - if (len > TASK_SIZE) | ||
7011 | + if (len > TASK_SIZE - mmap_min_addr) | ||
7012 | return -ENOMEM; | ||
7013 | |||
7014 | if (flags & MAP_FIXED) | ||
7015 | @@ -1911,14 +1911,14 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, | ||
7016 | if (addr) { | ||
7017 | addr = PAGE_ALIGN(addr); | ||
7018 | vma = find_vma(mm, addr); | ||
7019 | - if (TASK_SIZE - len >= addr && | ||
7020 | + if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && | ||
7021 | (!vma || addr + len <= vma->vm_start)) | ||
7022 | return addr; | ||
7023 | } | ||
7024 | |||
7025 | info.flags = VM_UNMAPPED_AREA_TOPDOWN; | ||
7026 | info.length = len; | ||
7027 | - info.low_limit = PAGE_SIZE; | ||
7028 | + info.low_limit = max(PAGE_SIZE, mmap_min_addr); | ||
7029 | info.high_limit = mm->mmap_base; | ||
7030 | info.align_mask = 0; | ||
7031 | addr = vm_unmapped_area(&info); | ||
7032 | diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c | ||
7033 | index e1c26b10..990afab2 100644 | ||
7034 | --- a/net/9p/trans_virtio.c | ||
7035 | +++ b/net/9p/trans_virtio.c | ||
7036 | @@ -577,6 +577,10 @@ static int p9_virtio_probe(struct virtio_device *vdev) | ||
7037 | mutex_lock(&virtio_9p_lock); | ||
7038 | list_add_tail(&chan->chan_list, &virtio_chan_list); | ||
7039 | mutex_unlock(&virtio_9p_lock); | ||
7040 | + | ||
7041 | + /* Let udev rules use the new mount_tag attribute. */ | ||
7042 | + kobject_uevent(&(vdev->dev.kobj), KOBJ_CHANGE); | ||
7043 | + | ||
7044 | return 0; | ||
7045 | |||
7046 | out_free_tag: | ||
7047 | @@ -654,6 +658,7 @@ static void p9_virtio_remove(struct virtio_device *vdev) | ||
7048 | list_del(&chan->chan_list); | ||
7049 | mutex_unlock(&virtio_9p_lock); | ||
7050 | sysfs_remove_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr); | ||
7051 | + kobject_uevent(&(vdev->dev.kobj), KOBJ_CHANGE); | ||
7052 | kfree(chan->tag); | ||
7053 | kfree(chan->vc_wq); | ||
7054 | kfree(chan); | ||
7055 | diff --git a/net/wireless/scan.c b/net/wireless/scan.c | ||
7056 | index fd99ea49..81019ee3 100644 | ||
7057 | --- a/net/wireless/scan.c | ||
7058 | +++ b/net/wireless/scan.c | ||
7059 | @@ -253,10 +253,10 @@ void __cfg80211_sched_scan_results(struct work_struct *wk) | ||
7060 | rdev = container_of(wk, struct cfg80211_registered_device, | ||
7061 | sched_scan_results_wk); | ||
7062 | |||
7063 | - request = rdev->sched_scan_req; | ||
7064 | - | ||
7065 | mutex_lock(&rdev->sched_scan_mtx); | ||
7066 | |||
7067 | + request = rdev->sched_scan_req; | ||
7068 | + | ||
7069 | /* we don't have sched_scan_req anymore if the scan is stopping */ | ||
7070 | if (request) { | ||
7071 | if (request->flags & NL80211_SCAN_FLAG_FLUSH) { | ||
7072 | diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c | ||
7073 | index da4b8b23..6235d052 100644 | ||
7074 | --- a/security/selinux/netlabel.c | ||
7075 | +++ b/security/selinux/netlabel.c | ||
7076 | @@ -442,8 +442,7 @@ int selinux_netlbl_socket_connect(struct sock *sk, struct sockaddr *addr) | ||
7077 | sksec->nlbl_state != NLBL_CONNLABELED) | ||
7078 | return 0; | ||
7079 | |||
7080 | - local_bh_disable(); | ||
7081 | - bh_lock_sock_nested(sk); | ||
7082 | + lock_sock(sk); | ||
7083 | |||
7084 | /* connected sockets are allowed to disconnect when the address family | ||
7085 | * is set to AF_UNSPEC, if that is what is happening we want to reset | ||
7086 | @@ -464,7 +463,6 @@ int selinux_netlbl_socket_connect(struct sock *sk, struct sockaddr *addr) | ||
7087 | sksec->nlbl_state = NLBL_CONNLABELED; | ||
7088 | |||
7089 | socket_connect_return: | ||
7090 | - bh_unlock_sock(sk); | ||
7091 | - local_bh_enable(); | ||
7092 | + release_sock(sk); | ||
7093 | return rc; | ||
7094 | } | ||
7095 | diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c | ||
7096 | index 26ed56f0..79750313 100644 | ||
7097 | --- a/sound/pci/hda/hda_generic.c | ||
7098 | +++ b/sound/pci/hda/hda_generic.c | ||
7099 | @@ -2445,12 +2445,8 @@ static int create_out_jack_modes(struct hda_codec *codec, int num_pins, | ||
7100 | |||
7101 | for (i = 0; i < num_pins; i++) { | ||
7102 | hda_nid_t pin = pins[i]; | ||
7103 | - if (pin == spec->hp_mic_pin) { | ||
7104 | - int ret = create_hp_mic_jack_mode(codec, pin); | ||
7105 | - if (ret < 0) | ||
7106 | - return ret; | ||
7107 | + if (pin == spec->hp_mic_pin) | ||
7108 | continue; | ||
7109 | - } | ||
7110 | if (get_out_jack_num_items(codec, pin) > 1) { | ||
7111 | struct snd_kcontrol_new *knew; | ||
7112 | char name[44]; | ||
7113 | @@ -2703,7 +2699,7 @@ static int hp_mic_jack_mode_put(struct snd_kcontrol *kcontrol, | ||
7114 | val &= ~(AC_PINCTL_VREFEN | PIN_HP); | ||
7115 | val |= get_vref_idx(vref_caps, idx) | PIN_IN; | ||
7116 | } else | ||
7117 | - val = snd_hda_get_default_vref(codec, nid); | ||
7118 | + val = snd_hda_get_default_vref(codec, nid) | PIN_IN; | ||
7119 | } | ||
7120 | snd_hda_set_pin_ctl_cache(codec, nid, val); | ||
7121 | call_hp_automute(codec, NULL); | ||
7122 | @@ -2723,9 +2719,6 @@ static int create_hp_mic_jack_mode(struct hda_codec *codec, hda_nid_t pin) | ||
7123 | struct hda_gen_spec *spec = codec->spec; | ||
7124 | struct snd_kcontrol_new *knew; | ||
7125 | |||
7126 | - if (get_out_jack_num_items(codec, pin) <= 1 && | ||
7127 | - get_in_jack_num_items(codec, pin) <= 1) | ||
7128 | - return 0; /* no need */ | ||
7129 | knew = snd_hda_gen_add_kctl(spec, "Headphone Mic Jack Mode", | ||
7130 | &hp_mic_jack_mode_enum); | ||
7131 | if (!knew) | ||
7132 | @@ -2754,6 +2747,42 @@ static int add_loopback_list(struct hda_gen_spec *spec, hda_nid_t mix, int idx) | ||
7133 | return 0; | ||
7134 | } | ||
7135 | |||
7136 | +/* return true if either a volume or a mute amp is found for the given | ||
7137 | + * aamix path; the amp has to be either in the mixer node or its direct leaf | ||
7138 | + */ | ||
7139 | +static bool look_for_mix_leaf_ctls(struct hda_codec *codec, hda_nid_t mix_nid, | ||
7140 | + hda_nid_t pin, unsigned int *mix_val, | ||
7141 | + unsigned int *mute_val) | ||
7142 | +{ | ||
7143 | + int idx, num_conns; | ||
7144 | + const hda_nid_t *list; | ||
7145 | + hda_nid_t nid; | ||
7146 | + | ||
7147 | + idx = snd_hda_get_conn_index(codec, mix_nid, pin, true); | ||
7148 | + if (idx < 0) | ||
7149 | + return false; | ||
7150 | + | ||
7151 | + *mix_val = *mute_val = 0; | ||
7152 | + if (nid_has_volume(codec, mix_nid, HDA_INPUT)) | ||
7153 | + *mix_val = HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT); | ||
7154 | + if (nid_has_mute(codec, mix_nid, HDA_INPUT)) | ||
7155 | + *mute_val = HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT); | ||
7156 | + if (*mix_val && *mute_val) | ||
7157 | + return true; | ||
7158 | + | ||
7159 | + /* check leaf node */ | ||
7160 | + num_conns = snd_hda_get_conn_list(codec, mix_nid, &list); | ||
7161 | + if (num_conns < idx) | ||
7162 | + return false; | ||
7163 | + nid = list[idx]; | ||
7164 | + if (!*mix_val && nid_has_volume(codec, nid, HDA_OUTPUT)) | ||
7165 | + *mix_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | ||
7166 | + if (!*mute_val && nid_has_mute(codec, nid, HDA_OUTPUT)) | ||
7167 | + *mute_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | ||
7168 | + | ||
7169 | + return *mix_val || *mute_val; | ||
7170 | +} | ||
7171 | + | ||
7172 | /* create input playback/capture controls for the given pin */ | ||
7173 | static int new_analog_input(struct hda_codec *codec, int input_idx, | ||
7174 | hda_nid_t pin, const char *ctlname, int ctlidx, | ||
7175 | @@ -2761,12 +2790,11 @@ static int new_analog_input(struct hda_codec *codec, int input_idx, | ||
7176 | { | ||
7177 | struct hda_gen_spec *spec = codec->spec; | ||
7178 | struct nid_path *path; | ||
7179 | - unsigned int val; | ||
7180 | + unsigned int mix_val, mute_val; | ||
7181 | int err, idx; | ||
7182 | |||
7183 | - if (!nid_has_volume(codec, mix_nid, HDA_INPUT) && | ||
7184 | - !nid_has_mute(codec, mix_nid, HDA_INPUT)) | ||
7185 | - return 0; /* no need for analog loopback */ | ||
7186 | + if (!look_for_mix_leaf_ctls(codec, mix_nid, pin, &mix_val, &mute_val)) | ||
7187 | + return 0; | ||
7188 | |||
7189 | path = snd_hda_add_new_path(codec, pin, mix_nid, 0); | ||
7190 | if (!path) | ||
7191 | @@ -2775,20 +2803,18 @@ static int new_analog_input(struct hda_codec *codec, int input_idx, | ||
7192 | spec->loopback_paths[input_idx] = snd_hda_get_path_idx(codec, path); | ||
7193 | |||
7194 | idx = path->idx[path->depth - 1]; | ||
7195 | - if (nid_has_volume(codec, mix_nid, HDA_INPUT)) { | ||
7196 | - val = HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT); | ||
7197 | - err = __add_pb_vol_ctrl(spec, HDA_CTL_WIDGET_VOL, ctlname, ctlidx, val); | ||
7198 | + if (mix_val) { | ||
7199 | + err = __add_pb_vol_ctrl(spec, HDA_CTL_WIDGET_VOL, ctlname, ctlidx, mix_val); | ||
7200 | if (err < 0) | ||
7201 | return err; | ||
7202 | - path->ctls[NID_PATH_VOL_CTL] = val; | ||
7203 | + path->ctls[NID_PATH_VOL_CTL] = mix_val; | ||
7204 | } | ||
7205 | |||
7206 | - if (nid_has_mute(codec, mix_nid, HDA_INPUT)) { | ||
7207 | - val = HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT); | ||
7208 | - err = __add_pb_sw_ctrl(spec, HDA_CTL_WIDGET_MUTE, ctlname, ctlidx, val); | ||
7209 | + if (mute_val) { | ||
7210 | + err = __add_pb_sw_ctrl(spec, HDA_CTL_WIDGET_MUTE, ctlname, ctlidx, mute_val); | ||
7211 | if (err < 0) | ||
7212 | return err; | ||
7213 | - path->ctls[NID_PATH_MUTE_CTL] = val; | ||
7214 | + path->ctls[NID_PATH_MUTE_CTL] = mute_val; | ||
7215 | } | ||
7216 | |||
7217 | path->active = true; | ||
7218 | @@ -4287,6 +4313,17 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec, | ||
7219 | if (err < 0) | ||
7220 | return err; | ||
7221 | |||
7222 | + /* create "Headphone Mic Jack Mode" if no input selection is | ||
7223 | + * available (or user specifies add_jack_modes hint) | ||
7224 | + */ | ||
7225 | + if (spec->hp_mic_pin && | ||
7226 | + (spec->auto_mic || spec->input_mux.num_items == 1 || | ||
7227 | + spec->add_jack_modes)) { | ||
7228 | + err = create_hp_mic_jack_mode(codec, spec->hp_mic_pin); | ||
7229 | + if (err < 0) | ||
7230 | + return err; | ||
7231 | + } | ||
7232 | + | ||
7233 | if (spec->add_jack_modes) { | ||
7234 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { | ||
7235 | err = create_out_jack_modes(codec, cfg->line_outs, | ||
7236 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c | ||
7237 | index 8bce0445..661afe7d 100644 | ||
7238 | --- a/sound/pci/hda/patch_realtek.c | ||
7239 | +++ b/sound/pci/hda/patch_realtek.c | ||
7240 | @@ -1765,6 +1765,7 @@ enum { | ||
7241 | ALC889_FIXUP_IMAC91_VREF, | ||
7242 | ALC882_FIXUP_INV_DMIC, | ||
7243 | ALC882_FIXUP_NO_PRIMARY_HP, | ||
7244 | + ALC887_FIXUP_ASUS_BASS, | ||
7245 | }; | ||
7246 | |||
7247 | static void alc889_fixup_coef(struct hda_codec *codec, | ||
7248 | @@ -2086,6 +2087,13 @@ static const struct hda_fixup alc882_fixups[] = { | ||
7249 | .type = HDA_FIXUP_FUNC, | ||
7250 | .v.func = alc882_fixup_no_primary_hp, | ||
7251 | }, | ||
7252 | + [ALC887_FIXUP_ASUS_BASS] = { | ||
7253 | + .type = HDA_FIXUP_PINS, | ||
7254 | + .v.pins = (const struct hda_pintbl[]) { | ||
7255 | + {0x16, 0x99130130}, /* bass speaker */ | ||
7256 | + {} | ||
7257 | + }, | ||
7258 | + }, | ||
7259 | }; | ||
7260 | |||
7261 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { | ||
7262 | @@ -2119,6 +2127,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { | ||
7263 | SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), | ||
7264 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), | ||
7265 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), | ||
7266 | + SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), | ||
7267 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), | ||
7268 | SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), | ||
7269 | SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), | ||
7270 | @@ -4494,6 +4503,7 @@ static int patch_alc662(struct hda_codec *codec) | ||
7271 | case 0x10ec0272: | ||
7272 | case 0x10ec0663: | ||
7273 | case 0x10ec0665: | ||
7274 | + case 0x10ec0668: | ||
7275 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | ||
7276 | break; | ||
7277 | case 0x10ec0273: | ||
7278 | @@ -4551,6 +4561,7 @@ static int patch_alc680(struct hda_codec *codec) | ||
7279 | */ | ||
7280 | static const struct hda_codec_preset snd_hda_preset_realtek[] = { | ||
7281 | { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 }, | ||
7282 | + { .id = 0x10ec0231, .name = "ALC231", .patch = patch_alc269 }, | ||
7283 | { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 }, | ||
7284 | { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 }, | ||
7285 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, | ||
7286 | diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c | ||
7287 | index dd0c2a4f..e0869aaa 100644 | ||
7288 | --- a/sound/soc/blackfin/bf5xx-i2s.c | ||
7289 | +++ b/sound/soc/blackfin/bf5xx-i2s.c | ||
7290 | @@ -111,6 +111,7 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream, | ||
7291 | bf5xx_i2s->tcr2 |= 7; | ||
7292 | bf5xx_i2s->rcr2 |= 7; | ||
7293 | sport_handle->wdsize = 1; | ||
7294 | + break; | ||
7295 | case SNDRV_PCM_FORMAT_S16_LE: | ||
7296 | bf5xx_i2s->tcr2 |= 15; | ||
7297 | bf5xx_i2s->rcr2 |= 15; | ||
7298 | diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c | ||
7299 | index 2d037870..687565d0 100644 | ||
7300 | --- a/sound/soc/codecs/ak4642.c | ||
7301 | +++ b/sound/soc/codecs/ak4642.c | ||
7302 | @@ -257,7 +257,7 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, | ||
7303 | * This operation came from example code of | ||
7304 | * "ASAHI KASEI AK4642" (japanese) manual p94. | ||
7305 | */ | ||
7306 | - snd_soc_write(codec, SG_SL1, PMMP | MGAIN0); | ||
7307 | + snd_soc_update_bits(codec, SG_SL1, PMMP | MGAIN0, PMMP | MGAIN0); | ||
7308 | snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3)); | ||
7309 | snd_soc_write(codec, ALC_CTL1, ALC | LMTH0); | ||
7310 | snd_soc_update_bits(codec, PW_MGMT1, PMADL, PMADL); | ||
7311 | diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c | ||
7312 | index 389f2325..663a2a74 100644 | ||
7313 | --- a/sound/soc/codecs/arizona.c | ||
7314 | +++ b/sound/soc/codecs/arizona.c | ||
7315 | @@ -1455,6 +1455,8 @@ static void arizona_enable_fll(struct arizona_fll *fll, | ||
7316 | try_wait_for_completion(&fll->ok); | ||
7317 | |||
7318 | regmap_update_bits(arizona->regmap, fll->base + 1, | ||
7319 | + ARIZONA_FLL1_FREERUN, 0); | ||
7320 | + regmap_update_bits(arizona->regmap, fll->base + 1, | ||
7321 | ARIZONA_FLL1_ENA, ARIZONA_FLL1_ENA); | ||
7322 | if (fll->ref_src >= 0 && fll->sync_src >= 0 && | ||
7323 | fll->ref_src != fll->sync_src) | ||
7324 | @@ -1473,6 +1475,8 @@ static void arizona_disable_fll(struct arizona_fll *fll) | ||
7325 | struct arizona *arizona = fll->arizona; | ||
7326 | bool change; | ||
7327 | |||
7328 | + regmap_update_bits(arizona->regmap, fll->base + 1, | ||
7329 | + ARIZONA_FLL1_FREERUN, ARIZONA_FLL1_FREERUN); | ||
7330 | regmap_update_bits_check(arizona->regmap, fll->base + 1, | ||
7331 | ARIZONA_FLL1_ENA, 0, &change); | ||
7332 | regmap_update_bits(arizona->regmap, fll->base + 0x11, | ||
7333 | diff --git a/sound/soc/codecs/cs42l52.h b/sound/soc/codecs/cs42l52.h | ||
7334 | index 4277012c..a935d738 100644 | ||
7335 | --- a/sound/soc/codecs/cs42l52.h | ||
7336 | +++ b/sound/soc/codecs/cs42l52.h | ||
7337 | @@ -179,7 +179,7 @@ | ||
7338 | #define CS42L52_MICB_CTL 0x11 | ||
7339 | #define CS42L52_MIC_CTL_MIC_SEL_MASK 0xBF | ||
7340 | #define CS42L52_MIC_CTL_MIC_SEL_SHIFT 6 | ||
7341 | -#define CS42L52_MIC_CTL_TYPE_MASK 0xDF | ||
7342 | +#define CS42L52_MIC_CTL_TYPE_MASK 0x20 | ||
7343 | #define CS42L52_MIC_CTL_TYPE_SHIFT 5 | ||
7344 | |||
7345 | |||
7346 | diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c | ||
7347 | index 88ad7db5..cd6ed884 100644 | ||
7348 | --- a/sound/soc/codecs/wm5110.c | ||
7349 | +++ b/sound/soc/codecs/wm5110.c | ||
7350 | @@ -37,6 +37,47 @@ struct wm5110_priv { | ||
7351 | struct arizona_fll fll[2]; | ||
7352 | }; | ||
7353 | |||
7354 | +static const struct reg_default wm5110_sysclk_revd_patch[] = { | ||
7355 | + { 0x3093, 0x1001 }, | ||
7356 | + { 0x30E3, 0x1301 }, | ||
7357 | + { 0x3133, 0x1201 }, | ||
7358 | + { 0x3183, 0x1501 }, | ||
7359 | + { 0x31D3, 0x1401 }, | ||
7360 | +}; | ||
7361 | + | ||
7362 | +static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w, | ||
7363 | + struct snd_kcontrol *kcontrol, int event) | ||
7364 | +{ | ||
7365 | + struct snd_soc_codec *codec = w->codec; | ||
7366 | + struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | ||
7367 | + struct regmap *regmap = codec->control_data; | ||
7368 | + const struct reg_default *patch = NULL; | ||
7369 | + int i, patch_size; | ||
7370 | + | ||
7371 | + switch (arizona->rev) { | ||
7372 | + case 3: | ||
7373 | + patch = wm5110_sysclk_revd_patch; | ||
7374 | + patch_size = ARRAY_SIZE(wm5110_sysclk_revd_patch); | ||
7375 | + break; | ||
7376 | + default: | ||
7377 | + return 0; | ||
7378 | + } | ||
7379 | + | ||
7380 | + switch (event) { | ||
7381 | + case SND_SOC_DAPM_POST_PMU: | ||
7382 | + if (patch) | ||
7383 | + for (i = 0; i < patch_size; i++) | ||
7384 | + regmap_write(regmap, patch[i].reg, | ||
7385 | + patch[i].def); | ||
7386 | + break; | ||
7387 | + | ||
7388 | + default: | ||
7389 | + break; | ||
7390 | + } | ||
7391 | + | ||
7392 | + return 0; | ||
7393 | +} | ||
7394 | + | ||
7395 | static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); | ||
7396 | static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); | ||
7397 | static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); | ||
7398 | @@ -386,7 +427,7 @@ static const struct snd_kcontrol_new wm5110_aec_loopback_mux = | ||
7399 | |||
7400 | static const struct snd_soc_dapm_widget wm5110_dapm_widgets[] = { | ||
7401 | SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT, | ||
7402 | - 0, NULL, 0), | ||
7403 | + 0, wm5110_sysclk_ev, SND_SOC_DAPM_POST_PMU), | ||
7404 | SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1, | ||
7405 | ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0), | ||
7406 | SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK, | ||
7407 | diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c | ||
7408 | index 730dd0c0..e3cd8651 100644 | ||
7409 | --- a/sound/soc/codecs/wm8962.c | ||
7410 | +++ b/sound/soc/codecs/wm8962.c | ||
7411 | @@ -3686,6 +3686,8 @@ static int wm8962_i2c_probe(struct i2c_client *i2c, | ||
7412 | if (ret < 0) | ||
7413 | goto err_enable; | ||
7414 | |||
7415 | + regcache_cache_only(wm8962->regmap, true); | ||
7416 | + | ||
7417 | /* The drivers should power up as needed */ | ||
7418 | regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); | ||
7419 | |||
7420 | diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c | ||
7421 | index 670b96b0..dcfd0fae 100644 | ||
7422 | --- a/sound/soc/fsl/imx-pcm-fiq.c | ||
7423 | +++ b/sound/soc/fsl/imx-pcm-fiq.c | ||
7424 | @@ -42,7 +42,8 @@ struct imx_pcm_runtime_data { | ||
7425 | struct hrtimer hrt; | ||
7426 | int poll_time_ns; | ||
7427 | struct snd_pcm_substream *substream; | ||
7428 | - atomic_t running; | ||
7429 | + atomic_t playing; | ||
7430 | + atomic_t capturing; | ||
7431 | }; | ||
7432 | |||
7433 | static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) | ||
7434 | @@ -54,7 +55,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) | ||
7435 | struct pt_regs regs; | ||
7436 | unsigned long delta; | ||
7437 | |||
7438 | - if (!atomic_read(&iprtd->running)) | ||
7439 | + if (!atomic_read(&iprtd->playing) && !atomic_read(&iprtd->capturing)) | ||
7440 | return HRTIMER_NORESTART; | ||
7441 | |||
7442 | get_fiq_regs(®s); | ||
7443 | @@ -122,7 +123,6 @@ static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) | ||
7444 | return 0; | ||
7445 | } | ||
7446 | |||
7447 | -static int fiq_enable; | ||
7448 | static int imx_pcm_fiq; | ||
7449 | |||
7450 | static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | ||
7451 | @@ -134,23 +134,27 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | ||
7452 | case SNDRV_PCM_TRIGGER_START: | ||
7453 | case SNDRV_PCM_TRIGGER_RESUME: | ||
7454 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
7455 | - atomic_set(&iprtd->running, 1); | ||
7456 | + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
7457 | + atomic_set(&iprtd->playing, 1); | ||
7458 | + else | ||
7459 | + atomic_set(&iprtd->capturing, 1); | ||
7460 | hrtimer_start(&iprtd->hrt, ns_to_ktime(iprtd->poll_time_ns), | ||
7461 | HRTIMER_MODE_REL); | ||
7462 | - if (++fiq_enable == 1) | ||
7463 | - enable_fiq(imx_pcm_fiq); | ||
7464 | - | ||
7465 | + enable_fiq(imx_pcm_fiq); | ||
7466 | break; | ||
7467 | |||
7468 | case SNDRV_PCM_TRIGGER_STOP: | ||
7469 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
7470 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
7471 | - atomic_set(&iprtd->running, 0); | ||
7472 | - | ||
7473 | - if (--fiq_enable == 0) | ||
7474 | + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
7475 | + atomic_set(&iprtd->playing, 0); | ||
7476 | + else | ||
7477 | + atomic_set(&iprtd->capturing, 0); | ||
7478 | + if (!atomic_read(&iprtd->playing) && | ||
7479 | + !atomic_read(&iprtd->capturing)) | ||
7480 | disable_fiq(imx_pcm_fiq); | ||
7481 | - | ||
7482 | break; | ||
7483 | + | ||
7484 | default: | ||
7485 | return -EINVAL; | ||
7486 | } | ||
7487 | @@ -198,7 +202,8 @@ static int snd_imx_open(struct snd_pcm_substream *substream) | ||
7488 | |||
7489 | iprtd->substream = substream; | ||
7490 | |||
7491 | - atomic_set(&iprtd->running, 0); | ||
7492 | + atomic_set(&iprtd->playing, 0); | ||
7493 | + atomic_set(&iprtd->capturing, 0); | ||
7494 | hrtimer_init(&iprtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
7495 | iprtd->hrt.function = snd_hrtimer_callback; | ||
7496 | |||
7497 | diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c | ||
7498 | index 4bf91b09..794bb1a1 100644 | ||
7499 | --- a/tools/perf/ui/hist.c | ||
7500 | +++ b/tools/perf/ui/hist.c | ||
7501 | @@ -113,7 +113,7 @@ static u64 he_get_##_field(struct hist_entry *he) \ | ||
7502 | static int hpp__color_##_type(struct perf_hpp *hpp, struct hist_entry *he) \ | ||
7503 | { \ | ||
7504 | return __hpp__fmt(hpp, he, he_get_##_field, " %6.2f%%", \ | ||
7505 | - (hpp_snprint_fn)percent_color_snprintf, true); \ | ||
7506 | + percent_color_snprintf, true); \ | ||
7507 | } | ||
7508 | |||
7509 | #define __HPP_ENTRY_PERCENT_FN(_type, _field) \ | ||
7510 | diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c | ||
7511 | index 11e46da1..66e44a50 100644 | ||
7512 | --- a/tools/perf/util/color.c | ||
7513 | +++ b/tools/perf/util/color.c | ||
7514 | @@ -318,8 +318,15 @@ int percent_color_fprintf(FILE *fp, const char *fmt, double percent) | ||
7515 | return r; | ||
7516 | } | ||
7517 | |||
7518 | -int percent_color_snprintf(char *bf, size_t size, const char *fmt, double percent) | ||
7519 | +int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...) | ||
7520 | { | ||
7521 | - const char *color = get_percent_color(percent); | ||
7522 | + va_list args; | ||
7523 | + double percent; | ||
7524 | + const char *color; | ||
7525 | + | ||
7526 | + va_start(args, fmt); | ||
7527 | + percent = va_arg(args, double); | ||
7528 | + va_end(args); | ||
7529 | + color = get_percent_color(percent); | ||
7530 | return color_snprintf(bf, size, color, fmt, percent); | ||
7531 | } | ||
7532 | diff --git a/tools/perf/util/color.h b/tools/perf/util/color.h | ||
7533 | index dea082b7..fced3840 100644 | ||
7534 | --- a/tools/perf/util/color.h | ||
7535 | +++ b/tools/perf/util/color.h | ||
7536 | @@ -39,7 +39,7 @@ int color_fprintf(FILE *fp, const char *color, const char *fmt, ...); | ||
7537 | int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...); | ||
7538 | int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...); | ||
7539 | int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf); | ||
7540 | -int percent_color_snprintf(char *bf, size_t size, const char *fmt, double percent); | ||
7541 | +int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...); | ||
7542 | int percent_color_fprintf(FILE *fp, const char *fmt, double percent); | ||
7543 | const char *get_percent_color(double percent); | ||
7544 |