Contents of /trunk/kernel-alx/patches-3.18/0120-3.18.21-all-fixes.patch
Parent Directory | Revision Log
Revision 2696 -
(show annotations)
(download)
Mon Sep 21 09:06:56 2015 UTC (9 years ago) by niro
File size: 137401 byte(s)
Mon Sep 21 09:06:56 2015 UTC (9 years ago) by niro
File size: 137401 byte(s)
-linux-3.18.21
1 | diff --git a/Documentation/ABI/testing/ima_policy b/Documentation/ABI/testing/ima_policy |
2 | index d0d0c578324c..724cd429eac6 100644 |
3 | --- a/Documentation/ABI/testing/ima_policy |
4 | +++ b/Documentation/ABI/testing/ima_policy |
5 | @@ -20,17 +20,19 @@ Description: |
6 | action: measure | dont_measure | appraise | dont_appraise | audit |
7 | condition:= base | lsm [option] |
8 | base: [[func=] [mask=] [fsmagic=] [fsuuid=] [uid=] |
9 | - [fowner]] |
10 | + [euid=] [fowner=]] |
11 | lsm: [[subj_user=] [subj_role=] [subj_type=] |
12 | [obj_user=] [obj_role=] [obj_type=]] |
13 | option: [[appraise_type=]] [permit_directio] |
14 | |
15 | base: func:= [BPRM_CHECK][MMAP_CHECK][FILE_CHECK][MODULE_CHECK] |
16 | [FIRMWARE_CHECK] |
17 | - mask:= [MAY_READ] [MAY_WRITE] [MAY_APPEND] [MAY_EXEC] |
18 | + mask:= [[^]MAY_READ] [[^]MAY_WRITE] [[^]MAY_APPEND] |
19 | + [[^]MAY_EXEC] |
20 | fsmagic:= hex value |
21 | fsuuid:= file system UUID (e.g 8bcbe394-4f13-4144-be8e-5aa9ea2ce2f6) |
22 | uid:= decimal value |
23 | + euid:= decimal value |
24 | fowner:=decimal value |
25 | lsm: are LSM specific |
26 | option: appraise_type:= [imasig] |
27 | diff --git a/Documentation/ABI/testing/sysfs-ata b/Documentation/ABI/testing/sysfs-ata |
28 | index 0a932155cbba..9231daef3813 100644 |
29 | --- a/Documentation/ABI/testing/sysfs-ata |
30 | +++ b/Documentation/ABI/testing/sysfs-ata |
31 | @@ -90,6 +90,17 @@ gscr |
32 | 130: SATA_PMP_GSCR_SII_GPIO |
33 | Only valid if the device is a PM. |
34 | |
35 | +trim |
36 | + |
37 | + Shows the DSM TRIM mode currently used by the device. Valid |
38 | + values are: |
39 | + unsupported: Drive does not support DSM TRIM |
40 | + unqueued: Drive supports unqueued DSM TRIM only |
41 | + queued: Drive supports queued DSM TRIM |
42 | + forced_unqueued: Drive's unqueued DSM support is known to be |
43 | + buggy and only unqueued TRIM commands |
44 | + are sent |
45 | + |
46 | spdn_cnt |
47 | |
48 | Number of time libata decided to lower the speed of link due to errors. |
49 | diff --git a/Documentation/devicetree/bindings/clock/keystone-pll.txt b/Documentation/devicetree/bindings/clock/keystone-pll.txt |
50 | index 225990f79b7c..47570d207215 100644 |
51 | --- a/Documentation/devicetree/bindings/clock/keystone-pll.txt |
52 | +++ b/Documentation/devicetree/bindings/clock/keystone-pll.txt |
53 | @@ -15,8 +15,8 @@ Required properties: |
54 | - compatible : shall be "ti,keystone,main-pll-clock" or "ti,keystone,pll-clock" |
55 | - clocks : parent clock phandle |
56 | - reg - pll control0 and pll multipler registers |
57 | -- reg-names : control and multiplier. The multiplier is applicable only for |
58 | - main pll clock |
59 | +- reg-names : control, multiplier and post-divider. The multiplier and |
60 | + post-divider registers are applicable only for main pll clock |
61 | - fixed-postdiv : fixed post divider value. If absent, use clkod register bits |
62 | for postdiv |
63 | |
64 | @@ -25,8 +25,8 @@ Example: |
65 | #clock-cells = <0>; |
66 | compatible = "ti,keystone,main-pll-clock"; |
67 | clocks = <&refclksys>; |
68 | - reg = <0x02620350 4>, <0x02310110 4>; |
69 | - reg-names = "control", "multiplier"; |
70 | + reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>; |
71 | + reg-names = "control", "multiplier", "post-divider"; |
72 | fixed-postdiv = <2>; |
73 | }; |
74 | |
75 | diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801 |
76 | index 793c83dac738..82f48f774afb 100644 |
77 | --- a/Documentation/i2c/busses/i2c-i801 |
78 | +++ b/Documentation/i2c/busses/i2c-i801 |
79 | @@ -29,6 +29,7 @@ Supported adapters: |
80 | * Intel Wildcat Point-LP (PCH) |
81 | * Intel BayTrail (SOC) |
82 | * Intel Sunrise Point-H (PCH) |
83 | + * Intel Sunrise Point-LP (PCH) |
84 | Datasheets: Publicly available at the Intel website |
85 | |
86 | On Intel Patsburg and later chipsets, both the normal host SMBus controller |
87 | diff --git a/Makefile b/Makefile |
88 | index 3ef589539cca..6be90fab361b 100644 |
89 | --- a/Makefile |
90 | +++ b/Makefile |
91 | @@ -1,6 +1,6 @@ |
92 | VERSION = 3 |
93 | PATCHLEVEL = 18 |
94 | -SUBLEVEL = 20 |
95 | +SUBLEVEL = 21 |
96 | EXTRAVERSION = |
97 | NAME = Diseased Newt |
98 | |
99 | diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi |
100 | index 6932928f3b45..667eb6a45f59 100644 |
101 | --- a/arch/arm/boot/dts/imx35.dtsi |
102 | +++ b/arch/arm/boot/dts/imx35.dtsi |
103 | @@ -286,8 +286,8 @@ |
104 | can1: can@53fe4000 { |
105 | compatible = "fsl,imx35-flexcan", "fsl,p1010-flexcan"; |
106 | reg = <0x53fe4000 0x1000>; |
107 | - clocks = <&clks 33>; |
108 | - clock-names = "ipg"; |
109 | + clocks = <&clks 33>, <&clks 33>; |
110 | + clock-names = "ipg", "per"; |
111 | interrupts = <43>; |
112 | status = "disabled"; |
113 | }; |
114 | @@ -295,8 +295,8 @@ |
115 | can2: can@53fe8000 { |
116 | compatible = "fsl,imx35-flexcan", "fsl,p1010-flexcan"; |
117 | reg = <0x53fe8000 0x1000>; |
118 | - clocks = <&clks 34>; |
119 | - clock-names = "ipg"; |
120 | + clocks = <&clks 34>, <&clks 34>; |
121 | + clock-names = "ipg", "per"; |
122 | interrupts = <44>; |
123 | status = "disabled"; |
124 | }; |
125 | diff --git a/arch/arm/boot/dts/k2e-clocks.dtsi b/arch/arm/boot/dts/k2e-clocks.dtsi |
126 | index 4773d6af66a0..d56d68fe7ffc 100644 |
127 | --- a/arch/arm/boot/dts/k2e-clocks.dtsi |
128 | +++ b/arch/arm/boot/dts/k2e-clocks.dtsi |
129 | @@ -13,9 +13,8 @@ clocks { |
130 | #clock-cells = <0>; |
131 | compatible = "ti,keystone,main-pll-clock"; |
132 | clocks = <&refclksys>; |
133 | - reg = <0x02620350 4>, <0x02310110 4>; |
134 | - reg-names = "control", "multiplier"; |
135 | - fixed-postdiv = <2>; |
136 | + reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>; |
137 | + reg-names = "control", "multiplier", "post-divider"; |
138 | }; |
139 | |
140 | papllclk: papllclk@2620358 { |
141 | diff --git a/arch/arm/boot/dts/k2hk-clocks.dtsi b/arch/arm/boot/dts/k2hk-clocks.dtsi |
142 | index d5adee3c0067..af9b7190533a 100644 |
143 | --- a/arch/arm/boot/dts/k2hk-clocks.dtsi |
144 | +++ b/arch/arm/boot/dts/k2hk-clocks.dtsi |
145 | @@ -22,9 +22,8 @@ clocks { |
146 | #clock-cells = <0>; |
147 | compatible = "ti,keystone,main-pll-clock"; |
148 | clocks = <&refclksys>; |
149 | - reg = <0x02620350 4>, <0x02310110 4>; |
150 | - reg-names = "control", "multiplier"; |
151 | - fixed-postdiv = <2>; |
152 | + reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>; |
153 | + reg-names = "control", "multiplier", "post-divider"; |
154 | }; |
155 | |
156 | papllclk: papllclk@2620358 { |
157 | diff --git a/arch/arm/boot/dts/k2l-clocks.dtsi b/arch/arm/boot/dts/k2l-clocks.dtsi |
158 | index eb1e3e29f073..ef8464bb11ff 100644 |
159 | --- a/arch/arm/boot/dts/k2l-clocks.dtsi |
160 | +++ b/arch/arm/boot/dts/k2l-clocks.dtsi |
161 | @@ -22,9 +22,8 @@ clocks { |
162 | #clock-cells = <0>; |
163 | compatible = "ti,keystone,main-pll-clock"; |
164 | clocks = <&refclksys>; |
165 | - reg = <0x02620350 4>, <0x02310110 4>; |
166 | - reg-names = "control", "multiplier"; |
167 | - fixed-postdiv = <2>; |
168 | + reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>; |
169 | + reg-names = "control", "multiplier", "post-divider"; |
170 | }; |
171 | |
172 | papllclk: papllclk@2620358 { |
173 | diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c |
174 | index 716247ed9e0c..bb9a148af8cc 100644 |
175 | --- a/arch/arm/mach-omap2/omap_hwmod.c |
176 | +++ b/arch/arm/mach-omap2/omap_hwmod.c |
177 | @@ -2452,6 +2452,9 @@ static int of_dev_hwmod_lookup(struct device_node *np, |
178 | * registers. This address is needed early so the OCP registers that |
179 | * are part of the device's address space can be ioremapped properly. |
180 | * |
181 | + * If SYSC access is not needed, the registers will not be remapped |
182 | + * and non-availability of MPU access is not treated as an error. |
183 | + * |
184 | * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and |
185 | * -ENXIO on absent or invalid register target address space. |
186 | */ |
187 | @@ -2466,6 +2469,11 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data, |
188 | |
189 | _save_mpu_port_index(oh); |
190 | |
191 | + /* if we don't need sysc access we don't need to ioremap */ |
192 | + if (!oh->class->sysc) |
193 | + return 0; |
194 | + |
195 | + /* we can't continue without MPU PORT if we need sysc access */ |
196 | if (oh->_int_flags & _HWMOD_NO_MPU_PORT) |
197 | return -ENXIO; |
198 | |
199 | @@ -2475,8 +2483,10 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data, |
200 | oh->name); |
201 | |
202 | /* Extract the IO space from device tree blob */ |
203 | - if (!np) |
204 | + if (!np) { |
205 | + pr_err("omap_hwmod: %s: no dt node\n", oh->name); |
206 | return -ENXIO; |
207 | + } |
208 | |
209 | va_start = of_iomap(np, index + oh->mpu_rt_idx); |
210 | } else { |
211 | @@ -2535,13 +2545,11 @@ static int __init _init(struct omap_hwmod *oh, void *data) |
212 | oh->name, np->name); |
213 | } |
214 | |
215 | - if (oh->class->sysc) { |
216 | - r = _init_mpu_rt_base(oh, NULL, index, np); |
217 | - if (r < 0) { |
218 | - WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n", |
219 | - oh->name); |
220 | - return 0; |
221 | - } |
222 | + r = _init_mpu_rt_base(oh, NULL, index, np); |
223 | + if (r < 0) { |
224 | + WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n", |
225 | + oh->name); |
226 | + return 0; |
227 | } |
228 | |
229 | r = _init_clocks(oh, NULL); |
230 | diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c |
231 | index 76920d4040d4..b4efc2e38336 100644 |
232 | --- a/arch/arm64/kernel/signal32.c |
233 | +++ b/arch/arm64/kernel/signal32.c |
234 | @@ -168,7 +168,8 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) |
235 | * Other callers might not initialize the si_lsb field, |
236 | * so check explicitely for the right codes here. |
237 | */ |
238 | - if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) |
239 | + if (from->si_signo == SIGBUS && |
240 | + (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)) |
241 | err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); |
242 | #endif |
243 | break; |
244 | @@ -195,8 +196,6 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) |
245 | |
246 | int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) |
247 | { |
248 | - memset(to, 0, sizeof *to); |
249 | - |
250 | if (copy_from_user(to, from, __ARCH_SI_PREAMBLE_SIZE) || |
251 | copy_from_user(to->_sifields._pad, |
252 | from->_sifields._pad, SI_PAD_SIZE)) |
253 | diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c |
254 | index 1d73662f00ff..54922d1275b8 100644 |
255 | --- a/arch/arm64/mm/mmap.c |
256 | +++ b/arch/arm64/mm/mmap.c |
257 | @@ -47,22 +47,14 @@ static int mmap_is_legacy(void) |
258 | return sysctl_legacy_va_layout; |
259 | } |
260 | |
261 | -/* |
262 | - * Since get_random_int() returns the same value within a 1 jiffy window, we |
263 | - * will almost always get the same randomisation for the stack and mmap |
264 | - * region. This will mean the relative distance between stack and mmap will be |
265 | - * the same. |
266 | - * |
267 | - * To avoid this we can shift the randomness by 1 bit. |
268 | - */ |
269 | static unsigned long mmap_rnd(void) |
270 | { |
271 | unsigned long rnd = 0; |
272 | |
273 | if (current->flags & PF_RANDOMIZE) |
274 | - rnd = (long)get_random_int() & (STACK_RND_MASK >> 1); |
275 | + rnd = (long)get_random_int() & STACK_RND_MASK; |
276 | |
277 | - return rnd << (PAGE_SHIFT + 1); |
278 | + return rnd << PAGE_SHIFT; |
279 | } |
280 | |
281 | static unsigned long mmap_base(void) |
282 | diff --git a/arch/avr32/mach-at32ap/clock.c b/arch/avr32/mach-at32ap/clock.c |
283 | index 23b1a97fae7a..52c179bec0cc 100644 |
284 | --- a/arch/avr32/mach-at32ap/clock.c |
285 | +++ b/arch/avr32/mach-at32ap/clock.c |
286 | @@ -80,6 +80,9 @@ int clk_enable(struct clk *clk) |
287 | { |
288 | unsigned long flags; |
289 | |
290 | + if (!clk) |
291 | + return 0; |
292 | + |
293 | spin_lock_irqsave(&clk_lock, flags); |
294 | __clk_enable(clk); |
295 | spin_unlock_irqrestore(&clk_lock, flags); |
296 | @@ -106,6 +109,9 @@ void clk_disable(struct clk *clk) |
297 | { |
298 | unsigned long flags; |
299 | |
300 | + if (IS_ERR_OR_NULL(clk)) |
301 | + return; |
302 | + |
303 | spin_lock_irqsave(&clk_lock, flags); |
304 | __clk_disable(clk); |
305 | spin_unlock_irqrestore(&clk_lock, flags); |
306 | @@ -117,6 +123,9 @@ unsigned long clk_get_rate(struct clk *clk) |
307 | unsigned long flags; |
308 | unsigned long rate; |
309 | |
310 | + if (!clk) |
311 | + return 0; |
312 | + |
313 | spin_lock_irqsave(&clk_lock, flags); |
314 | rate = clk->get_rate(clk); |
315 | spin_unlock_irqrestore(&clk_lock, flags); |
316 | @@ -129,6 +138,9 @@ long clk_round_rate(struct clk *clk, unsigned long rate) |
317 | { |
318 | unsigned long flags, actual_rate; |
319 | |
320 | + if (!clk) |
321 | + return 0; |
322 | + |
323 | if (!clk->set_rate) |
324 | return -ENOSYS; |
325 | |
326 | @@ -145,6 +157,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate) |
327 | unsigned long flags; |
328 | long ret; |
329 | |
330 | + if (!clk) |
331 | + return 0; |
332 | + |
333 | if (!clk->set_rate) |
334 | return -ENOSYS; |
335 | |
336 | @@ -161,6 +176,9 @@ int clk_set_parent(struct clk *clk, struct clk *parent) |
337 | unsigned long flags; |
338 | int ret; |
339 | |
340 | + if (!clk) |
341 | + return 0; |
342 | + |
343 | if (!clk->set_parent) |
344 | return -ENOSYS; |
345 | |
346 | @@ -174,7 +192,7 @@ EXPORT_SYMBOL(clk_set_parent); |
347 | |
348 | struct clk *clk_get_parent(struct clk *clk) |
349 | { |
350 | - return clk->parent; |
351 | + return !clk ? NULL : clk->parent; |
352 | } |
353 | EXPORT_SYMBOL(clk_get_parent); |
354 | |
355 | diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h |
356 | index bc3fc4fdc9ab..060fc2e50cd2 100644 |
357 | --- a/arch/mips/include/asm/pgtable.h |
358 | +++ b/arch/mips/include/asm/pgtable.h |
359 | @@ -187,8 +187,39 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) |
360 | * Make sure the buddy is global too (if it's !none, |
361 | * it better already be global) |
362 | */ |
363 | +#ifdef CONFIG_SMP |
364 | + /* |
365 | + * For SMP, multiple CPUs can race, so we need to do |
366 | + * this atomically. |
367 | + */ |
368 | +#ifdef CONFIG_64BIT |
369 | +#define LL_INSN "lld" |
370 | +#define SC_INSN "scd" |
371 | +#else /* CONFIG_32BIT */ |
372 | +#define LL_INSN "ll" |
373 | +#define SC_INSN "sc" |
374 | +#endif |
375 | + unsigned long page_global = _PAGE_GLOBAL; |
376 | + unsigned long tmp; |
377 | + |
378 | + __asm__ __volatile__ ( |
379 | + " .set push\n" |
380 | + " .set noreorder\n" |
381 | + "1: " LL_INSN " %[tmp], %[buddy]\n" |
382 | + " bnez %[tmp], 2f\n" |
383 | + " or %[tmp], %[tmp], %[global]\n" |
384 | + " " SC_INSN " %[tmp], %[buddy]\n" |
385 | + " beqz %[tmp], 1b\n" |
386 | + " nop\n" |
387 | + "2:\n" |
388 | + " .set pop" |
389 | + : [buddy] "+m" (buddy->pte), |
390 | + [tmp] "=&r" (tmp) |
391 | + : [global] "r" (page_global)); |
392 | +#else /* !CONFIG_SMP */ |
393 | if (pte_none(*buddy)) |
394 | pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL; |
395 | +#endif /* CONFIG_SMP */ |
396 | } |
397 | #endif |
398 | } |
399 | diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h |
400 | index b188c797565c..0562a24dc615 100644 |
401 | --- a/arch/mips/include/asm/stackframe.h |
402 | +++ b/arch/mips/include/asm/stackframe.h |
403 | @@ -152,6 +152,31 @@ |
404 | .set noreorder |
405 | bltz k0, 8f |
406 | move k1, sp |
407 | +#ifdef CONFIG_EVA |
408 | + /* |
409 | + * Flush interAptiv's Return Prediction Stack (RPS) by writing |
410 | + * EntryHi. Toggling Config7.RPS is slower and less portable. |
411 | + * |
412 | + * The RPS isn't automatically flushed when exceptions are |
413 | + * taken, which can result in kernel mode speculative accesses |
414 | + * to user addresses if the RPS mispredicts. That's harmless |
415 | + * when user and kernel share the same address space, but with |
416 | + * EVA the same user segments may be unmapped to kernel mode, |
417 | + * even containing sensitive MMIO regions or invalid memory. |
418 | + * |
419 | + * This can happen when the kernel sets the return address to |
420 | + * ret_from_* and jr's to the exception handler, which looks |
421 | + * more like a tail call than a function call. If nested calls |
422 | + * don't evict the last user address in the RPS, it will |
423 | + * mispredict the return and fetch from a user controlled |
424 | + * address into the icache. |
425 | + * |
426 | + * More recent EVA-capable cores with MAAR to restrict |
427 | + * speculative accesses aren't affected. |
428 | + */ |
429 | + MFC0 k0, CP0_ENTRYHI |
430 | + MTC0 k0, CP0_ENTRYHI |
431 | +#endif |
432 | .set reorder |
433 | /* Called from user mode, new stack. */ |
434 | get_saved_sp |
435 | diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c |
436 | index 362bb3707e62..116c67a5320a 100644 |
437 | --- a/arch/mips/kernel/mips-mt-fpaff.c |
438 | +++ b/arch/mips/kernel/mips-mt-fpaff.c |
439 | @@ -154,7 +154,7 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, |
440 | unsigned long __user *user_mask_ptr) |
441 | { |
442 | unsigned int real_len; |
443 | - cpumask_t mask; |
444 | + cpumask_t allowed, mask; |
445 | int retval; |
446 | struct task_struct *p; |
447 | |
448 | @@ -173,7 +173,8 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, |
449 | if (retval) |
450 | goto out_unlock; |
451 | |
452 | - cpumask_and(&mask, &p->thread.user_cpus_allowed, cpu_possible_mask); |
453 | + cpumask_or(&allowed, &p->thread.user_cpus_allowed, &p->cpus_allowed); |
454 | + cpumask_and(&mask, &allowed, cpu_active_mask); |
455 | |
456 | out_unlock: |
457 | read_unlock(&tasklist_lock); |
458 | diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c |
459 | index d69179c0d49d..f019f100a4bd 100644 |
460 | --- a/arch/mips/kernel/signal32.c |
461 | +++ b/arch/mips/kernel/signal32.c |
462 | @@ -409,8 +409,6 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) |
463 | |
464 | int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) |
465 | { |
466 | - memset(to, 0, sizeof *to); |
467 | - |
468 | if (copy_from_user(to, from, 3*sizeof(int)) || |
469 | copy_from_user(to->_sifields._pad, |
470 | from->_sifields._pad, SI_PAD_SIZE32)) |
471 | diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c |
472 | index d255a2a1837a..f506c53cb4f5 100644 |
473 | --- a/arch/mips/kernel/traps.c |
474 | +++ b/arch/mips/kernel/traps.c |
475 | @@ -190,6 +190,7 @@ static void show_stacktrace(struct task_struct *task, |
476 | void show_stack(struct task_struct *task, unsigned long *sp) |
477 | { |
478 | struct pt_regs regs; |
479 | + mm_segment_t old_fs = get_fs(); |
480 | if (sp) { |
481 | regs.regs[29] = (unsigned long)sp; |
482 | regs.regs[31] = 0; |
483 | @@ -208,7 +209,13 @@ void show_stack(struct task_struct *task, unsigned long *sp) |
484 | prepare_frametrace(®s); |
485 | } |
486 | } |
487 | + /* |
488 | + * show_stack() deals exclusively with kernel mode, so be sure to access |
489 | + * the stack in the kernel (not user) address space. |
490 | + */ |
491 | + set_fs(KERNEL_DS); |
492 | show_stacktrace(task, ®s); |
493 | + set_fs(old_fs); |
494 | } |
495 | |
496 | static void show_code(unsigned int __user *pc) |
497 | @@ -1376,6 +1383,7 @@ asmlinkage void do_mcheck(struct pt_regs *regs) |
498 | const int field = 2 * sizeof(unsigned long); |
499 | int multi_match = regs->cp0_status & ST0_TS; |
500 | enum ctx_state prev_state; |
501 | + mm_segment_t old_fs = get_fs(); |
502 | |
503 | prev_state = exception_enter(); |
504 | show_regs(regs); |
505 | @@ -1390,8 +1398,13 @@ asmlinkage void do_mcheck(struct pt_regs *regs) |
506 | dump_tlb_all(); |
507 | } |
508 | |
509 | + if (!user_mode(regs)) |
510 | + set_fs(KERNEL_DS); |
511 | + |
512 | show_code((unsigned int __user *) regs->cp0_epc); |
513 | |
514 | + set_fs(old_fs); |
515 | + |
516 | /* |
517 | * Some chips may have other causes of machine check (e.g. SB1 |
518 | * graduation timer) |
519 | diff --git a/arch/mips/mti-malta/malta-time.c b/arch/mips/mti-malta/malta-time.c |
520 | index 3778a359f3ad..38748da2a9d6 100644 |
521 | --- a/arch/mips/mti-malta/malta-time.c |
522 | +++ b/arch/mips/mti-malta/malta-time.c |
523 | @@ -158,14 +158,17 @@ unsigned int get_c0_compare_int(void) |
524 | |
525 | static void __init init_rtc(void) |
526 | { |
527 | - /* stop the clock whilst setting it up */ |
528 | - CMOS_WRITE(RTC_SET | RTC_24H, RTC_CONTROL); |
529 | + unsigned char freq, ctrl; |
530 | |
531 | - /* 32KHz time base */ |
532 | - CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT); |
533 | + /* Set 32KHz time base if not already set */ |
534 | + freq = CMOS_READ(RTC_FREQ_SELECT); |
535 | + if ((freq & RTC_DIV_CTL) != RTC_REF_CLCK_32KHZ) |
536 | + CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT); |
537 | |
538 | - /* start the clock */ |
539 | - CMOS_WRITE(RTC_24H, RTC_CONTROL); |
540 | + /* Ensure SET bit is clear so RTC can run */ |
541 | + ctrl = CMOS_READ(RTC_CONTROL); |
542 | + if (ctrl & RTC_SET) |
543 | + CMOS_WRITE(ctrl & ~RTC_SET, RTC_CONTROL); |
544 | } |
545 | |
546 | void __init plat_time_init(void) |
547 | diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c |
548 | index b171001698ff..28f36b9c0e55 100644 |
549 | --- a/arch/powerpc/kernel/signal_32.c |
550 | +++ b/arch/powerpc/kernel/signal_32.c |
551 | @@ -966,8 +966,6 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *d, const siginfo_t *s) |
552 | |
553 | int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from) |
554 | { |
555 | - memset(to, 0, sizeof *to); |
556 | - |
557 | if (copy_from_user(to, from, 3*sizeof(int)) || |
558 | copy_from_user(to->_sifields._pad, |
559 | from->_sifields._pad, SI_PAD_SIZE32)) |
560 | diff --git a/arch/s390/include/asm/kexec.h b/arch/s390/include/asm/kexec.h |
561 | index 694bcd6bd927..2f924bc30e35 100644 |
562 | --- a/arch/s390/include/asm/kexec.h |
563 | +++ b/arch/s390/include/asm/kexec.h |
564 | @@ -26,6 +26,9 @@ |
565 | /* Not more than 2GB */ |
566 | #define KEXEC_CONTROL_MEMORY_LIMIT (1UL<<31) |
567 | |
568 | +/* Allocate control page with GFP_DMA */ |
569 | +#define KEXEC_CONTROL_MEMORY_GFP GFP_DMA |
570 | + |
571 | /* Maximum address we can use for the crash control pages */ |
572 | #define KEXEC_CRASH_CONTROL_MEMORY_LIMIT (-1UL) |
573 | |
574 | diff --git a/arch/s390/kernel/sclp.S b/arch/s390/kernel/sclp.S |
575 | index a41f2c99dcc8..a0c4e7652647 100644 |
576 | --- a/arch/s390/kernel/sclp.S |
577 | +++ b/arch/s390/kernel/sclp.S |
578 | @@ -277,6 +277,8 @@ ENTRY(_sclp_print_early) |
579 | jno .Lesa2 |
580 | ahi %r15,-80 |
581 | stmh %r6,%r15,96(%r15) # store upper register halves |
582 | + basr %r13,0 |
583 | + lmh %r0,%r15,.Lzeroes-.(%r13) # clear upper register halves |
584 | .Lesa2: |
585 | #endif |
586 | lr %r10,%r2 # save string pointer |
587 | @@ -300,6 +302,8 @@ ENTRY(_sclp_print_early) |
588 | #endif |
589 | lm %r6,%r15,120(%r15) # restore registers |
590 | br %r14 |
591 | +.Lzeroes: |
592 | + .fill 64,4,0 |
593 | |
594 | .LwritedataS4: |
595 | .long 0x00760005 # SCLP command for write data |
596 | diff --git a/arch/sparc/include/asm/visasm.h b/arch/sparc/include/asm/visasm.h |
597 | index 1f0aa2024e94..6424249d5f78 100644 |
598 | --- a/arch/sparc/include/asm/visasm.h |
599 | +++ b/arch/sparc/include/asm/visasm.h |
600 | @@ -28,16 +28,10 @@ |
601 | * Must preserve %o5 between VISEntryHalf and VISExitHalf */ |
602 | |
603 | #define VISEntryHalf \ |
604 | - rd %fprs, %o5; \ |
605 | - andcc %o5, FPRS_FEF, %g0; \ |
606 | - be,pt %icc, 297f; \ |
607 | - sethi %hi(298f), %g7; \ |
608 | - sethi %hi(VISenterhalf), %g1; \ |
609 | - jmpl %g1 + %lo(VISenterhalf), %g0; \ |
610 | - or %g7, %lo(298f), %g7; \ |
611 | - clr %o5; \ |
612 | -297: wr %o5, FPRS_FEF, %fprs; \ |
613 | -298: |
614 | + VISEntry |
615 | + |
616 | +#define VISExitHalf \ |
617 | + VISExit |
618 | |
619 | #define VISEntryHalfFast(fail_label) \ |
620 | rd %fprs, %o5; \ |
621 | @@ -47,7 +41,7 @@ |
622 | ba,a,pt %xcc, fail_label; \ |
623 | 297: wr %o5, FPRS_FEF, %fprs; |
624 | |
625 | -#define VISExitHalf \ |
626 | +#define VISExitHalfFast \ |
627 | wr %o5, 0, %fprs; |
628 | |
629 | #ifndef __ASSEMBLY__ |
630 | diff --git a/arch/sparc/lib/NG4memcpy.S b/arch/sparc/lib/NG4memcpy.S |
631 | index 140527a20e7d..83aeeb1dffdb 100644 |
632 | --- a/arch/sparc/lib/NG4memcpy.S |
633 | +++ b/arch/sparc/lib/NG4memcpy.S |
634 | @@ -240,8 +240,11 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ |
635 | add %o0, 0x40, %o0 |
636 | bne,pt %icc, 1b |
637 | LOAD(prefetch, %g1 + 0x200, #n_reads_strong) |
638 | +#ifdef NON_USER_COPY |
639 | + VISExitHalfFast |
640 | +#else |
641 | VISExitHalf |
642 | - |
643 | +#endif |
644 | brz,pn %o2, .Lexit |
645 | cmp %o2, 19 |
646 | ble,pn %icc, .Lsmall_unaligned |
647 | diff --git a/arch/sparc/lib/VISsave.S b/arch/sparc/lib/VISsave.S |
648 | index b320ae9e2e2e..a063d84336d6 100644 |
649 | --- a/arch/sparc/lib/VISsave.S |
650 | +++ b/arch/sparc/lib/VISsave.S |
651 | @@ -44,9 +44,8 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 |
652 | |
653 | stx %g3, [%g6 + TI_GSR] |
654 | 2: add %g6, %g1, %g3 |
655 | - cmp %o5, FPRS_DU |
656 | - be,pn %icc, 6f |
657 | - sll %g1, 3, %g1 |
658 | + mov FPRS_DU | FPRS_DL | FPRS_FEF, %o5 |
659 | + sll %g1, 3, %g1 |
660 | stb %o5, [%g3 + TI_FPSAVED] |
661 | rd %gsr, %g2 |
662 | add %g6, %g1, %g3 |
663 | @@ -80,65 +79,3 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 |
664 | .align 32 |
665 | 80: jmpl %g7 + %g0, %g0 |
666 | nop |
667 | - |
668 | -6: ldub [%g3 + TI_FPSAVED], %o5 |
669 | - or %o5, FPRS_DU, %o5 |
670 | - add %g6, TI_FPREGS+0x80, %g2 |
671 | - stb %o5, [%g3 + TI_FPSAVED] |
672 | - |
673 | - sll %g1, 5, %g1 |
674 | - add %g6, TI_FPREGS+0xc0, %g3 |
675 | - wr %g0, FPRS_FEF, %fprs |
676 | - membar #Sync |
677 | - stda %f32, [%g2 + %g1] ASI_BLK_P |
678 | - stda %f48, [%g3 + %g1] ASI_BLK_P |
679 | - membar #Sync |
680 | - ba,pt %xcc, 80f |
681 | - nop |
682 | - |
683 | - .align 32 |
684 | -80: jmpl %g7 + %g0, %g0 |
685 | - nop |
686 | - |
687 | - .align 32 |
688 | -VISenterhalf: |
689 | - ldub [%g6 + TI_FPDEPTH], %g1 |
690 | - brnz,a,pn %g1, 1f |
691 | - cmp %g1, 1 |
692 | - stb %g0, [%g6 + TI_FPSAVED] |
693 | - stx %fsr, [%g6 + TI_XFSR] |
694 | - clr %o5 |
695 | - jmpl %g7 + %g0, %g0 |
696 | - wr %g0, FPRS_FEF, %fprs |
697 | - |
698 | -1: bne,pn %icc, 2f |
699 | - srl %g1, 1, %g1 |
700 | - ba,pt %xcc, vis1 |
701 | - sub %g7, 8, %g7 |
702 | -2: addcc %g6, %g1, %g3 |
703 | - sll %g1, 3, %g1 |
704 | - andn %o5, FPRS_DU, %g2 |
705 | - stb %g2, [%g3 + TI_FPSAVED] |
706 | - |
707 | - rd %gsr, %g2 |
708 | - add %g6, %g1, %g3 |
709 | - stx %g2, [%g3 + TI_GSR] |
710 | - add %g6, %g1, %g2 |
711 | - stx %fsr, [%g2 + TI_XFSR] |
712 | - sll %g1, 5, %g1 |
713 | -3: andcc %o5, FPRS_DL, %g0 |
714 | - be,pn %icc, 4f |
715 | - add %g6, TI_FPREGS, %g2 |
716 | - |
717 | - add %g6, TI_FPREGS+0x40, %g3 |
718 | - membar #Sync |
719 | - stda %f0, [%g2 + %g1] ASI_BLK_P |
720 | - stda %f16, [%g3 + %g1] ASI_BLK_P |
721 | - membar #Sync |
722 | - ba,pt %xcc, 4f |
723 | - nop |
724 | - |
725 | - .align 32 |
726 | -4: and %o5, FPRS_DU, %o5 |
727 | - jmpl %g7 + %g0, %g0 |
728 | - wr %o5, FPRS_FEF, %fprs |
729 | diff --git a/arch/sparc/lib/ksyms.c b/arch/sparc/lib/ksyms.c |
730 | index 1d649a95660c..8069ce12f20b 100644 |
731 | --- a/arch/sparc/lib/ksyms.c |
732 | +++ b/arch/sparc/lib/ksyms.c |
733 | @@ -135,10 +135,6 @@ EXPORT_SYMBOL(copy_user_page); |
734 | void VISenter(void); |
735 | EXPORT_SYMBOL(VISenter); |
736 | |
737 | -/* CRYPTO code needs this */ |
738 | -void VISenterhalf(void); |
739 | -EXPORT_SYMBOL(VISenterhalf); |
740 | - |
741 | extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *); |
742 | extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *, |
743 | unsigned long *); |
744 | diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c |
745 | index b9736ded06f2..656224502dfc 100644 |
746 | --- a/arch/tile/kernel/setup.c |
747 | +++ b/arch/tile/kernel/setup.c |
748 | @@ -1144,7 +1144,7 @@ static void __init load_hv_initrd(void) |
749 | |
750 | void __init free_initrd_mem(unsigned long begin, unsigned long end) |
751 | { |
752 | - free_bootmem(__pa(begin), end - begin); |
753 | + free_bootmem_late(__pa(begin), end - begin); |
754 | } |
755 | |
756 | static int __init setup_initrd(char *str) |
757 | diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c |
758 | index 3790a66d6898..acdf06bc418b 100644 |
759 | --- a/arch/x86/boot/compressed/eboot.c |
760 | +++ b/arch/x86/boot/compressed/eboot.c |
761 | @@ -1194,6 +1194,10 @@ static efi_status_t setup_e820(struct boot_params *params, |
762 | unsigned int e820_type = 0; |
763 | unsigned long m = efi->efi_memmap; |
764 | |
765 | +#ifdef CONFIG_X86_64 |
766 | + m |= (u64)efi->efi_memmap_hi << 32; |
767 | +#endif |
768 | + |
769 | d = (efi_memory_desc_t *)(m + (i * efi->efi_memdesc_size)); |
770 | switch (d->type) { |
771 | case EFI_RESERVED_TYPE: |
772 | diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h |
773 | index 6a11845fd8b9..72051730caf1 100644 |
774 | --- a/arch/x86/kvm/lapic.h |
775 | +++ b/arch/x86/kvm/lapic.h |
776 | @@ -165,7 +165,7 @@ static inline u16 apic_logical_id(struct kvm_apic_map *map, u32 ldr) |
777 | |
778 | static inline bool kvm_apic_has_events(struct kvm_vcpu *vcpu) |
779 | { |
780 | - return vcpu->arch.apic->pending_events; |
781 | + return kvm_vcpu_has_lapic(vcpu) && vcpu->arch.apic->pending_events; |
782 | } |
783 | |
784 | bool kvm_apic_pending_eoi(struct kvm_vcpu *vcpu, int vector); |
785 | diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c |
786 | index 7d67146c3f87..e180e097a53a 100644 |
787 | --- a/arch/x86/xen/enlighten.c |
788 | +++ b/arch/x86/xen/enlighten.c |
789 | @@ -481,6 +481,7 @@ static void set_aliased_prot(void *v, pgprot_t prot) |
790 | pte_t pte; |
791 | unsigned long pfn; |
792 | struct page *page; |
793 | + unsigned char dummy; |
794 | |
795 | ptep = lookup_address((unsigned long)v, &level); |
796 | BUG_ON(ptep == NULL); |
797 | @@ -490,6 +491,32 @@ static void set_aliased_prot(void *v, pgprot_t prot) |
798 | |
799 | pte = pfn_pte(pfn, prot); |
800 | |
801 | + /* |
802 | + * Careful: update_va_mapping() will fail if the virtual address |
803 | + * we're poking isn't populated in the page tables. We don't |
804 | + * need to worry about the direct map (that's always in the page |
805 | + * tables), but we need to be careful about vmap space. In |
806 | + * particular, the top level page table can lazily propagate |
807 | + * entries between processes, so if we've switched mms since we |
808 | + * vmapped the target in the first place, we might not have the |
809 | + * top-level page table entry populated. |
810 | + * |
811 | + * We disable preemption because we want the same mm active when |
812 | + * we probe the target and when we issue the hypercall. We'll |
813 | + * have the same nominal mm, but if we're a kernel thread, lazy |
814 | + * mm dropping could change our pgd. |
815 | + * |
816 | + * Out of an abundance of caution, this uses __get_user() to fault |
817 | + * in the target address just in case there's some obscure case |
818 | + * in which the target address isn't readable. |
819 | + */ |
820 | + |
821 | + preempt_disable(); |
822 | + |
823 | + pagefault_disable(); /* Avoid warnings due to being atomic. */ |
824 | + __get_user(dummy, (unsigned char __user __force *)v); |
825 | + pagefault_enable(); |
826 | + |
827 | if (HYPERVISOR_update_va_mapping((unsigned long)v, pte, 0)) |
828 | BUG(); |
829 | |
830 | @@ -501,6 +528,8 @@ static void set_aliased_prot(void *v, pgprot_t prot) |
831 | BUG(); |
832 | } else |
833 | kmap_flush_unused(); |
834 | + |
835 | + preempt_enable(); |
836 | } |
837 | |
838 | static void xen_alloc_ldt(struct desc_struct *ldt, unsigned entries) |
839 | @@ -508,6 +537,17 @@ static void xen_alloc_ldt(struct desc_struct *ldt, unsigned entries) |
840 | const unsigned entries_per_page = PAGE_SIZE / LDT_ENTRY_SIZE; |
841 | int i; |
842 | |
843 | + /* |
844 | + * We need to mark the all aliases of the LDT pages RO. We |
845 | + * don't need to call vm_flush_aliases(), though, since that's |
846 | + * only responsible for flushing aliases out the TLBs, not the |
847 | + * page tables, and Xen will flush the TLB for us if needed. |
848 | + * |
849 | + * To avoid confusing future readers: none of this is necessary |
850 | + * to load the LDT. The hypervisor only checks this when the |
851 | + * LDT is faulted in due to subsequent descriptor access. |
852 | + */ |
853 | + |
854 | for(i = 0; i < entries; i += entries_per_page) |
855 | set_aliased_prot(ldt + i, PAGE_KERNEL_RO); |
856 | } |
857 | diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c |
858 | index 0ac817b750db..6817e28960b7 100644 |
859 | --- a/block/blk-cgroup.c |
860 | +++ b/block/blk-cgroup.c |
861 | @@ -716,8 +716,12 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, |
862 | return -EINVAL; |
863 | |
864 | disk = get_gendisk(MKDEV(major, minor), &part); |
865 | - if (!disk || part) |
866 | + if (!disk) |
867 | return -EINVAL; |
868 | + if (part) { |
869 | + put_disk(disk); |
870 | + return -EINVAL; |
871 | + } |
872 | |
873 | rcu_read_lock(); |
874 | spin_lock_irq(disk->queue->queue_lock); |
875 | diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c |
876 | index 8b67bd0f6bb5..cd4598b2038d 100644 |
877 | --- a/drivers/acpi/bus.c |
878 | +++ b/drivers/acpi/bus.c |
879 | @@ -467,6 +467,16 @@ static int __init acpi_bus_init_irq(void) |
880 | return 0; |
881 | } |
882 | |
883 | +/** |
884 | + * acpi_early_init - Initialize ACPICA and populate the ACPI namespace. |
885 | + * |
886 | + * The ACPI tables are accessible after this, but the handling of events has not |
887 | + * been initialized and the global lock is not available yet, so AML should not |
888 | + * be executed at this point. |
889 | + * |
890 | + * Doing this before switching the EFI runtime services to virtual mode allows |
891 | + * the EfiBootServices memory to be freed slightly earlier on boot. |
892 | + */ |
893 | void __init acpi_early_init(void) |
894 | { |
895 | acpi_status status; |
896 | @@ -530,26 +540,42 @@ void __init acpi_early_init(void) |
897 | acpi_gbl_FADT.sci_interrupt = acpi_sci_override_gsi; |
898 | } |
899 | #endif |
900 | + return; |
901 | + |
902 | + error0: |
903 | + disable_acpi(); |
904 | +} |
905 | + |
906 | +/** |
907 | + * acpi_subsystem_init - Finalize the early initialization of ACPI. |
908 | + * |
909 | + * Switch over the platform to the ACPI mode (if possible), initialize the |
910 | + * handling of ACPI events, install the interrupt and global lock handlers. |
911 | + * |
912 | + * Doing this too early is generally unsafe, but at the same time it needs to be |
913 | + * done before all things that really depend on ACPI. The right spot appears to |
914 | + * be before finalizing the EFI initialization. |
915 | + */ |
916 | +void __init acpi_subsystem_init(void) |
917 | +{ |
918 | + acpi_status status; |
919 | + |
920 | + if (acpi_disabled) |
921 | + return; |
922 | |
923 | status = acpi_enable_subsystem(~ACPI_NO_ACPI_ENABLE); |
924 | if (ACPI_FAILURE(status)) { |
925 | printk(KERN_ERR PREFIX "Unable to enable ACPI\n"); |
926 | - goto error0; |
927 | + disable_acpi(); |
928 | + } else { |
929 | + /* |
930 | + * If the system is using ACPI then we can be reasonably |
931 | + * confident that any regulators are managed by the firmware |
932 | + * so tell the regulator core it has everything it needs to |
933 | + * know. |
934 | + */ |
935 | + regulator_has_full_constraints(); |
936 | } |
937 | - |
938 | - /* |
939 | - * If the system is using ACPI then we can be reasonably |
940 | - * confident that any regulators are managed by the firmware |
941 | - * so tell the regulator core it has everything it needs to |
942 | - * know. |
943 | - */ |
944 | - regulator_has_full_constraints(); |
945 | - |
946 | - return; |
947 | - |
948 | - error0: |
949 | - disable_acpi(); |
950 | - return; |
951 | } |
952 | |
953 | static int __init acpi_bus_init(void) |
954 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
955 | index 98dc0dc605bc..74e18e94bef2 100644 |
956 | --- a/drivers/ata/libata-core.c |
957 | +++ b/drivers/ata/libata-core.c |
958 | @@ -4226,10 +4226,47 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
959 | { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, |
960 | |
961 | /* devices that don't properly handle queued TRIM commands */ |
962 | - { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
963 | - { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
964 | - { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
965 | - { "Crucial_CT*M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
966 | + { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
967 | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
968 | + { "Crucial_CT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
969 | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
970 | + { "Micron_M5[15]0_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
971 | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
972 | + { "Crucial_CT*M550*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
973 | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
974 | + { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
975 | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
976 | + { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
977 | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
978 | + |
979 | + /* devices that don't properly handle TRIM commands */ |
980 | + { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, }, |
981 | + |
982 | + /* |
983 | + * As defined, the DRAT (Deterministic Read After Trim) and RZAT |
984 | + * (Return Zero After Trim) flags in the ATA Command Set are |
985 | + * unreliable in the sense that they only define what happens if |
986 | + * the device successfully executed the DSM TRIM command. TRIM |
987 | + * is only advisory, however, and the device is free to silently |
988 | + * ignore all or parts of the request. |
989 | + * |
990 | + * Whitelist drives that are known to reliably return zeroes |
991 | + * after TRIM. |
992 | + */ |
993 | + |
994 | + /* |
995 | + * The intel 510 drive has buggy DRAT/RZAT. Explicitly exclude |
996 | + * that model before whitelisting all other intel SSDs. |
997 | + */ |
998 | + { "INTEL*SSDSC2MH*", NULL, 0, }, |
999 | + |
1000 | + { "Micron*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1001 | + { "Crucial*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1002 | + { "INTEL*SSD*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1003 | + { "SSD*INTEL*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1004 | + { "Samsung*SSD*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1005 | + { "SAMSUNG*SSD*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1006 | + { "ST[1248][0248]0[FH]*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
1007 | |
1008 | /* devices that don't properly handle TRIM commands */ |
1009 | { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, }, |
1010 | diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c |
1011 | index 7ccc084bf1df..85aa76116a30 100644 |
1012 | --- a/drivers/ata/libata-pmp.c |
1013 | +++ b/drivers/ata/libata-pmp.c |
1014 | @@ -460,6 +460,13 @@ static void sata_pmp_quirks(struct ata_port *ap) |
1015 | ATA_LFLAG_NO_SRST | |
1016 | ATA_LFLAG_ASSUME_ATA; |
1017 | } |
1018 | + } else if (vendor == 0x11ab && devid == 0x4140) { |
1019 | + /* Marvell 4140 quirks */ |
1020 | + ata_for_each_link(link, ap, EDGE) { |
1021 | + /* port 4 is for SEMB device and it doesn't like SRST */ |
1022 | + if (link->pmp == 4) |
1023 | + link->flags |= ATA_LFLAG_DISABLED; |
1024 | + } |
1025 | } |
1026 | } |
1027 | |
1028 | diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c |
1029 | index d6ff64248c23..78d56c9390cc 100644 |
1030 | --- a/drivers/ata/libata-scsi.c |
1031 | +++ b/drivers/ata/libata-scsi.c |
1032 | @@ -2516,13 +2516,15 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) |
1033 | |
1034 | if (ata_id_has_trim(args->id) && |
1035 | !(dev->horkage & ATA_HORKAGE_NOTRIM)) { |
1036 | - rbuf[14] |= 0x80; /* TPE */ |
1037 | + rbuf[14] |= 0x80; /* LBPME */ |
1038 | |
1039 | - if (ata_id_has_zero_after_trim(args->id)) |
1040 | - rbuf[14] |= 0x40; /* TPRZ */ |
1041 | + if (ata_id_has_zero_after_trim(args->id) && |
1042 | + dev->horkage & ATA_HORKAGE_ZERO_AFTER_TRIM) { |
1043 | + ata_dev_info(dev, "Enabling discard_zeroes_data\n"); |
1044 | + rbuf[14] |= 0x40; /* LBPRZ */ |
1045 | + } |
1046 | } |
1047 | } |
1048 | - |
1049 | return 0; |
1050 | } |
1051 | |
1052 | diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c |
1053 | index e37413228228..fd29b7224082 100644 |
1054 | --- a/drivers/ata/libata-transport.c |
1055 | +++ b/drivers/ata/libata-transport.c |
1056 | @@ -559,6 +559,29 @@ show_ata_dev_gscr(struct device *dev, |
1057 | |
1058 | static DEVICE_ATTR(gscr, S_IRUGO, show_ata_dev_gscr, NULL); |
1059 | |
1060 | +static ssize_t |
1061 | +show_ata_dev_trim(struct device *dev, |
1062 | + struct device_attribute *attr, char *buf) |
1063 | +{ |
1064 | + struct ata_device *ata_dev = transport_class_to_dev(dev); |
1065 | + unsigned char *mode; |
1066 | + |
1067 | + if (!ata_id_has_trim(ata_dev->id)) |
1068 | + mode = "unsupported"; |
1069 | + else if (ata_dev->horkage & ATA_HORKAGE_NOTRIM) |
1070 | + mode = "forced_unsupported"; |
1071 | + else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) |
1072 | + mode = "forced_unqueued"; |
1073 | + else if (ata_fpdma_dsm_supported(ata_dev)) |
1074 | + mode = "queued"; |
1075 | + else |
1076 | + mode = "unqueued"; |
1077 | + |
1078 | + return snprintf(buf, 20, "%s\n", mode); |
1079 | +} |
1080 | + |
1081 | +static DEVICE_ATTR(trim, S_IRUGO, show_ata_dev_trim, NULL); |
1082 | + |
1083 | static DECLARE_TRANSPORT_CLASS(ata_dev_class, |
1084 | "ata_device", NULL, NULL, NULL); |
1085 | |
1086 | @@ -732,6 +755,7 @@ struct scsi_transport_template *ata_attach_transport(void) |
1087 | SETUP_DEV_ATTRIBUTE(ering); |
1088 | SETUP_DEV_ATTRIBUTE(id); |
1089 | SETUP_DEV_ATTRIBUTE(gscr); |
1090 | + SETUP_DEV_ATTRIBUTE(trim); |
1091 | BUG_ON(count > ATA_DEV_ATTRS); |
1092 | i->dev_attrs[count] = NULL; |
1093 | |
1094 | diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c |
1095 | index 501a8ca662f4..dc1ca84e90f1 100644 |
1096 | --- a/drivers/block/rbd.c |
1097 | +++ b/drivers/block/rbd.c |
1098 | @@ -520,6 +520,7 @@ void rbd_warn(struct rbd_device *rbd_dev, const char *fmt, ...) |
1099 | # define rbd_assert(expr) ((void) 0) |
1100 | #endif /* !RBD_DEBUG */ |
1101 | |
1102 | +static void rbd_osd_copyup_callback(struct rbd_obj_request *obj_request); |
1103 | static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request); |
1104 | static void rbd_img_parent_read(struct rbd_obj_request *obj_request); |
1105 | static void rbd_dev_remove_parent(struct rbd_device *rbd_dev); |
1106 | @@ -1795,6 +1796,16 @@ static void rbd_osd_stat_callback(struct rbd_obj_request *obj_request) |
1107 | obj_request_done_set(obj_request); |
1108 | } |
1109 | |
1110 | +static void rbd_osd_call_callback(struct rbd_obj_request *obj_request) |
1111 | +{ |
1112 | + dout("%s: obj %p\n", __func__, obj_request); |
1113 | + |
1114 | + if (obj_request_img_data_test(obj_request)) |
1115 | + rbd_osd_copyup_callback(obj_request); |
1116 | + else |
1117 | + obj_request_done_set(obj_request); |
1118 | +} |
1119 | + |
1120 | static void rbd_osd_req_callback(struct ceph_osd_request *osd_req, |
1121 | struct ceph_msg *msg) |
1122 | { |
1123 | @@ -1842,6 +1853,8 @@ static void rbd_osd_req_callback(struct ceph_osd_request *osd_req, |
1124 | rbd_osd_discard_callback(obj_request); |
1125 | break; |
1126 | case CEPH_OSD_OP_CALL: |
1127 | + rbd_osd_call_callback(obj_request); |
1128 | + break; |
1129 | case CEPH_OSD_OP_NOTIFY_ACK: |
1130 | case CEPH_OSD_OP_WATCH: |
1131 | rbd_osd_trivial_callback(obj_request); |
1132 | @@ -2499,13 +2512,15 @@ out_unwind: |
1133 | } |
1134 | |
1135 | static void |
1136 | -rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request) |
1137 | +rbd_osd_copyup_callback(struct rbd_obj_request *obj_request) |
1138 | { |
1139 | struct rbd_img_request *img_request; |
1140 | struct rbd_device *rbd_dev; |
1141 | struct page **pages; |
1142 | u32 page_count; |
1143 | |
1144 | + dout("%s: obj %p\n", __func__, obj_request); |
1145 | + |
1146 | rbd_assert(obj_request->type == OBJ_REQUEST_BIO || |
1147 | obj_request->type == OBJ_REQUEST_NODATA); |
1148 | rbd_assert(obj_request_img_data_test(obj_request)); |
1149 | @@ -2532,9 +2547,7 @@ rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request) |
1150 | if (!obj_request->result) |
1151 | obj_request->xferred = obj_request->length; |
1152 | |
1153 | - /* Finish up with the normal image object callback */ |
1154 | - |
1155 | - rbd_img_obj_callback(obj_request); |
1156 | + obj_request_done_set(obj_request); |
1157 | } |
1158 | |
1159 | static void |
1160 | @@ -2619,7 +2632,6 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) |
1161 | |
1162 | /* All set, send it off. */ |
1163 | |
1164 | - orig_request->callback = rbd_img_obj_copyup_callback; |
1165 | osdc = &rbd_dev->rbd_client->client->osdc; |
1166 | img_result = rbd_obj_request_submit(osdc, orig_request); |
1167 | if (!img_result) |
1168 | diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c |
1169 | index 8dc319dd3150..e527a3e13939 100644 |
1170 | --- a/drivers/bluetooth/ath3k.c |
1171 | +++ b/drivers/bluetooth/ath3k.c |
1172 | @@ -107,6 +107,7 @@ static const struct usb_device_id ath3k_table[] = { |
1173 | { USB_DEVICE(0x0cf3, 0xe003) }, |
1174 | { USB_DEVICE(0x0CF3, 0xE004) }, |
1175 | { USB_DEVICE(0x0CF3, 0xE005) }, |
1176 | + { USB_DEVICE(0x0CF3, 0xE006) }, |
1177 | { USB_DEVICE(0x13d3, 0x3362) }, |
1178 | { USB_DEVICE(0x13d3, 0x3375) }, |
1179 | { USB_DEVICE(0x13d3, 0x3393) }, |
1180 | @@ -165,6 +166,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { |
1181 | { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 }, |
1182 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
1183 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, |
1184 | + { USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 }, |
1185 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, |
1186 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
1187 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
1188 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
1189 | index c675e2bd9fd3..82360dd65a1f 100644 |
1190 | --- a/drivers/bluetooth/btusb.c |
1191 | +++ b/drivers/bluetooth/btusb.c |
1192 | @@ -195,6 +195,7 @@ static const struct usb_device_id blacklist_table[] = { |
1193 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, |
1194 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
1195 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, |
1196 | + { USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 }, |
1197 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
1198 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
1199 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, |
1200 | diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c |
1201 | index aa30a25c8d49..7d52c0aafa7f 100644 |
1202 | --- a/drivers/char/hw_random/core.c |
1203 | +++ b/drivers/char/hw_random/core.c |
1204 | @@ -365,7 +365,7 @@ static int hwrng_fillfn(void *unused) |
1205 | static void start_khwrngd(void) |
1206 | { |
1207 | hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng"); |
1208 | - if (hwrng_fill == ERR_PTR(-ENOMEM)) { |
1209 | + if (IS_ERR(hwrng_fill)) { |
1210 | pr_err("hwrng_fill thread creation failed"); |
1211 | hwrng_fill = NULL; |
1212 | } |
1213 | diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c |
1214 | index 471f985e38d2..26397bb7d826 100644 |
1215 | --- a/drivers/char/i8k.c |
1216 | +++ b/drivers/char/i8k.c |
1217 | @@ -796,6 +796,21 @@ static struct dmi_system_id i8k_dmi_table[] __initdata = { |
1218 | { } |
1219 | }; |
1220 | |
1221 | +static struct dmi_system_id i8k_blacklist_dmi_table[] __initdata = { |
1222 | + { |
1223 | + /* |
1224 | + * CPU fan speed going up and down on Dell Studio XPS 8100 |
1225 | + * for unknown reasons. |
1226 | + */ |
1227 | + .ident = "Dell Studio XPS 8100", |
1228 | + .matches = { |
1229 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
1230 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Studio XPS 8100"), |
1231 | + }, |
1232 | + }, |
1233 | + { } |
1234 | +}; |
1235 | + |
1236 | /* |
1237 | * Probe for the presence of a supported laptop. |
1238 | */ |
1239 | @@ -806,7 +821,8 @@ static int __init i8k_probe(void) |
1240 | /* |
1241 | * Get DMI information |
1242 | */ |
1243 | - if (!dmi_check_system(i8k_dmi_table)) { |
1244 | + if (!dmi_check_system(i8k_dmi_table) || |
1245 | + dmi_check_system(i8k_blacklist_dmi_table)) { |
1246 | if (!ignore_dmi && !force) |
1247 | return -ENODEV; |
1248 | |
1249 | diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c |
1250 | index 0dd8a4b12747..4a375ead70e9 100644 |
1251 | --- a/drivers/clk/keystone/pll.c |
1252 | +++ b/drivers/clk/keystone/pll.c |
1253 | @@ -37,7 +37,8 @@ |
1254 | * Main PLL or any other PLLs in the device such as ARM PLL, DDR PLL |
1255 | * or PA PLL available on keystone2. These PLLs are controlled by |
1256 | * this register. Main PLL is controlled by a PLL controller. |
1257 | - * @pllm: PLL register map address |
1258 | + * @pllm: PLL register map address for multiplier bits |
1259 | + * @pllod: PLL register map address for post divider bits |
1260 | * @pll_ctl0: PLL controller map address |
1261 | * @pllm_lower_mask: multiplier lower mask |
1262 | * @pllm_upper_mask: multiplier upper mask |
1263 | @@ -53,6 +54,7 @@ struct clk_pll_data { |
1264 | u32 phy_pllm; |
1265 | u32 phy_pll_ctl0; |
1266 | void __iomem *pllm; |
1267 | + void __iomem *pllod; |
1268 | void __iomem *pll_ctl0; |
1269 | u32 pllm_lower_mask; |
1270 | u32 pllm_upper_mask; |
1271 | @@ -102,7 +104,11 @@ static unsigned long clk_pllclk_recalc(struct clk_hw *hw, |
1272 | /* read post divider from od bits*/ |
1273 | postdiv = ((val & pll_data->clkod_mask) >> |
1274 | pll_data->clkod_shift) + 1; |
1275 | - else |
1276 | + else if (pll_data->pllod) { |
1277 | + postdiv = readl(pll_data->pllod); |
1278 | + postdiv = ((postdiv & pll_data->clkod_mask) >> |
1279 | + pll_data->clkod_shift) + 1; |
1280 | + } else |
1281 | postdiv = pll_data->postdiv; |
1282 | |
1283 | rate /= (prediv + 1); |
1284 | @@ -172,12 +178,21 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl) |
1285 | /* assume the PLL has output divider register bits */ |
1286 | pll_data->clkod_mask = CLKOD_MASK; |
1287 | pll_data->clkod_shift = CLKOD_SHIFT; |
1288 | + |
1289 | + /* |
1290 | + * Check if there is an post-divider register. If not |
1291 | + * assume od bits are part of control register. |
1292 | + */ |
1293 | + i = of_property_match_string(node, "reg-names", |
1294 | + "post-divider"); |
1295 | + pll_data->pllod = of_iomap(node, i); |
1296 | } |
1297 | |
1298 | i = of_property_match_string(node, "reg-names", "control"); |
1299 | pll_data->pll_ctl0 = of_iomap(node, i); |
1300 | if (!pll_data->pll_ctl0) { |
1301 | pr_err("%s: ioremap failed\n", __func__); |
1302 | + iounmap(pll_data->pllod); |
1303 | goto out; |
1304 | } |
1305 | |
1306 | @@ -193,6 +208,7 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl) |
1307 | pll_data->pllm = of_iomap(node, i); |
1308 | if (!pll_data->pllm) { |
1309 | iounmap(pll_data->pll_ctl0); |
1310 | + iounmap(pll_data->pllod); |
1311 | goto out; |
1312 | } |
1313 | } |
1314 | diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c |
1315 | index 4d2c8e861089..2a0d58959acf 100644 |
1316 | --- a/drivers/cpufreq/pcc-cpufreq.c |
1317 | +++ b/drivers/cpufreq/pcc-cpufreq.c |
1318 | @@ -603,6 +603,13 @@ static void __exit pcc_cpufreq_exit(void) |
1319 | free_percpu(pcc_cpu_info); |
1320 | } |
1321 | |
1322 | +static const struct acpi_device_id processor_device_ids[] = { |
1323 | + {ACPI_PROCESSOR_OBJECT_HID, }, |
1324 | + {ACPI_PROCESSOR_DEVICE_HID, }, |
1325 | + {}, |
1326 | +}; |
1327 | +MODULE_DEVICE_TABLE(acpi, processor_device_ids); |
1328 | + |
1329 | MODULE_AUTHOR("Matthew Garrett, Naga Chumbalkar"); |
1330 | MODULE_VERSION(PCC_VERSION); |
1331 | MODULE_DESCRIPTION("Processor Clocking Control interface driver"); |
1332 | diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c |
1333 | index f757a0f428bd..3beed38d306a 100644 |
1334 | --- a/drivers/crypto/ixp4xx_crypto.c |
1335 | +++ b/drivers/crypto/ixp4xx_crypto.c |
1336 | @@ -904,7 +904,6 @@ static int ablk_perform(struct ablkcipher_request *req, int encrypt) |
1337 | crypt->mode |= NPE_OP_NOT_IN_PLACE; |
1338 | /* This was never tested by Intel |
1339 | * for more than one dst buffer, I think. */ |
1340 | - BUG_ON(req->dst->length < nbytes); |
1341 | req_ctx->dst = NULL; |
1342 | if (!chainup_buffers(dev, req->dst, nbytes, &dst_hook, |
1343 | flags, DMA_FROM_DEVICE)) |
1344 | diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c |
1345 | index 9e9619cd4a79..5b35e5d2231d 100644 |
1346 | --- a/drivers/crypto/qat/qat_common/qat_algs.c |
1347 | +++ b/drivers/crypto/qat/qat_common/qat_algs.c |
1348 | @@ -73,7 +73,8 @@ |
1349 | ICP_QAT_HW_CIPHER_KEY_CONVERT, \ |
1350 | ICP_QAT_HW_CIPHER_DECRYPT) |
1351 | |
1352 | -static atomic_t active_dev; |
1353 | +static DEFINE_MUTEX(algs_lock); |
1354 | +static unsigned int active_devs; |
1355 | |
1356 | struct qat_alg_buf { |
1357 | uint32_t len; |
1358 | @@ -955,27 +956,34 @@ static struct crypto_alg qat_algs[] = { { |
1359 | |
1360 | int qat_algs_register(void) |
1361 | { |
1362 | - if (atomic_add_return(1, &active_dev) == 1) { |
1363 | + int ret = 0; |
1364 | + |
1365 | + mutex_lock(&algs_lock); |
1366 | + if (++active_devs == 1) { |
1367 | int i; |
1368 | |
1369 | for (i = 0; i < ARRAY_SIZE(qat_algs); i++) |
1370 | qat_algs[i].cra_flags = CRYPTO_ALG_TYPE_AEAD | |
1371 | CRYPTO_ALG_ASYNC; |
1372 | - return crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs)); |
1373 | + ret = crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs)); |
1374 | } |
1375 | - return 0; |
1376 | + mutex_unlock(&algs_lock); |
1377 | + return ret; |
1378 | } |
1379 | |
1380 | int qat_algs_unregister(void) |
1381 | { |
1382 | - if (atomic_sub_return(1, &active_dev) == 0) |
1383 | - return crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs)); |
1384 | - return 0; |
1385 | + int ret = 0; |
1386 | + |
1387 | + mutex_lock(&algs_lock); |
1388 | + if (--active_devs == 0) |
1389 | + ret = crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs)); |
1390 | + mutex_unlock(&algs_lock); |
1391 | + return ret; |
1392 | } |
1393 | |
1394 | int qat_algs_init(void) |
1395 | { |
1396 | - atomic_set(&active_dev, 0); |
1397 | crypto_get_default_rng(); |
1398 | return 0; |
1399 | } |
1400 | diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
1401 | index 1f5e42a1f5b4..dea239c38134 100644 |
1402 | --- a/drivers/gpu/drm/drm_dp_mst_topology.c |
1403 | +++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
1404 | @@ -1275,7 +1275,6 @@ retry: |
1405 | goto retry; |
1406 | } |
1407 | DRM_DEBUG_KMS("failed to dpcd write %d %d\n", tosend, ret); |
1408 | - WARN(1, "fail\n"); |
1409 | |
1410 | return -EIO; |
1411 | } |
1412 | diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h |
1413 | index a84971351eee..c68e9f2947a6 100644 |
1414 | --- a/drivers/gpu/drm/i915/i915_drv.h |
1415 | +++ b/drivers/gpu/drm/i915/i915_drv.h |
1416 | @@ -2899,15 +2899,14 @@ int vlv_freq_opcode(struct drm_i915_private *dev_priv, int val); |
1417 | #define I915_READ64(reg) dev_priv->uncore.funcs.mmio_readq(dev_priv, (reg), true) |
1418 | |
1419 | #define I915_READ64_2x32(lower_reg, upper_reg) ({ \ |
1420 | - u32 upper = I915_READ(upper_reg); \ |
1421 | - u32 lower = I915_READ(lower_reg); \ |
1422 | - u32 tmp = I915_READ(upper_reg); \ |
1423 | - if (upper != tmp) { \ |
1424 | - upper = tmp; \ |
1425 | - lower = I915_READ(lower_reg); \ |
1426 | - WARN_ON(I915_READ(upper_reg) != upper); \ |
1427 | - } \ |
1428 | - (u64)upper << 32 | lower; }) |
1429 | + u32 upper, lower, tmp; \ |
1430 | + tmp = I915_READ(upper_reg); \ |
1431 | + do { \ |
1432 | + upper = tmp; \ |
1433 | + lower = I915_READ(lower_reg); \ |
1434 | + tmp = I915_READ(upper_reg); \ |
1435 | + } while (upper != tmp); \ |
1436 | + (u64)upper << 32 | lower; }) |
1437 | |
1438 | #define POSTING_READ(reg) (void)I915_READ_NOTRACE(reg) |
1439 | #define POSTING_READ16(reg) (void)I915_READ16_NOTRACE(reg) |
1440 | diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c |
1441 | index 3e5f6b71f3ad..c097d3a82bda 100644 |
1442 | --- a/drivers/gpu/drm/radeon/radeon_combios.c |
1443 | +++ b/drivers/gpu/drm/radeon/radeon_combios.c |
1444 | @@ -1255,10 +1255,15 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoder |
1445 | |
1446 | if ((RBIOS16(tmp) == lvds->native_mode.hdisplay) && |
1447 | (RBIOS16(tmp + 2) == lvds->native_mode.vdisplay)) { |
1448 | + u32 hss = (RBIOS16(tmp + 21) - RBIOS16(tmp + 19) - 1) * 8; |
1449 | + |
1450 | + if (hss > lvds->native_mode.hdisplay) |
1451 | + hss = (10 - 1) * 8; |
1452 | + |
1453 | lvds->native_mode.htotal = lvds->native_mode.hdisplay + |
1454 | (RBIOS16(tmp + 17) - RBIOS16(tmp + 19)) * 8; |
1455 | lvds->native_mode.hsync_start = lvds->native_mode.hdisplay + |
1456 | - (RBIOS16(tmp + 21) - RBIOS16(tmp + 19) - 1) * 8; |
1457 | + hss; |
1458 | lvds->native_mode.hsync_end = lvds->native_mode.hsync_start + |
1459 | (RBIOS8(tmp + 23) * 8); |
1460 | |
1461 | diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
1462 | index 7eda03c13805..737d18c924bc 100644 |
1463 | --- a/drivers/hid/hid-core.c |
1464 | +++ b/drivers/hid/hid-core.c |
1465 | @@ -1943,6 +1943,7 @@ static const struct hid_device_id hid_have_special_driver[] = { |
1466 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, |
1467 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
1468 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
1469 | + { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) }, |
1470 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, |
1471 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, |
1472 | { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, |
1473 | @@ -2333,6 +2334,7 @@ static const struct hid_device_id hid_ignore_list[] = { |
1474 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, |
1475 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, |
1476 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) }, |
1477 | + { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICK16F1454) }, |
1478 | { HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) }, |
1479 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) }, |
1480 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) }, |
1481 | diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
1482 | index 252a7ed40f86..3603d0cb25d9 100644 |
1483 | --- a/drivers/hid/hid-ids.h |
1484 | +++ b/drivers/hid/hid-ids.h |
1485 | @@ -250,6 +250,8 @@ |
1486 | |
1487 | #define USB_DEVICE_ID_CYGNAL_RADIO_SI4713 0x8244 |
1488 | |
1489 | +#define USB_DEVICE_ID_CYGNAL_RADIO_SI4713 0x8244 |
1490 | + |
1491 | #define USB_VENDOR_ID_CYPRESS 0x04b4 |
1492 | #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 |
1493 | #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 |
1494 | @@ -648,6 +650,7 @@ |
1495 | #define USB_DEVICE_ID_PICKIT2 0x0033 |
1496 | #define USB_DEVICE_ID_PICOLCD 0xc002 |
1497 | #define USB_DEVICE_ID_PICOLCD_BOOTLOADER 0xf002 |
1498 | +#define USB_DEVICE_ID_PICK16F1454 0x0042 |
1499 | |
1500 | #define USB_VENDOR_ID_MICROSOFT 0x045e |
1501 | #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b |
1502 | @@ -895,6 +898,7 @@ |
1503 | #define USB_VENDOR_ID_TIVO 0x150a |
1504 | #define USB_DEVICE_ID_TIVO_SLIDE_BT 0x1200 |
1505 | #define USB_DEVICE_ID_TIVO_SLIDE 0x1201 |
1506 | +#define USB_DEVICE_ID_TIVO_SLIDE_PRO 0x1203 |
1507 | |
1508 | #define USB_VENDOR_ID_TOPSEED 0x0766 |
1509 | #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 |
1510 | diff --git a/drivers/hid/hid-tivo.c b/drivers/hid/hid-tivo.c |
1511 | index d790d8d71f7f..d98696927453 100644 |
1512 | --- a/drivers/hid/hid-tivo.c |
1513 | +++ b/drivers/hid/hid-tivo.c |
1514 | @@ -64,6 +64,7 @@ static const struct hid_device_id tivo_devices[] = { |
1515 | /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ |
1516 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
1517 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
1518 | + { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) }, |
1519 | { } |
1520 | }; |
1521 | MODULE_DEVICE_TABLE(hid, tivo_devices); |
1522 | diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig |
1523 | index 917c3585f45b..06e99eb64295 100644 |
1524 | --- a/drivers/i2c/busses/Kconfig |
1525 | +++ b/drivers/i2c/busses/Kconfig |
1526 | @@ -123,6 +123,7 @@ config I2C_I801 |
1527 | Wildcat Point-LP (PCH) |
1528 | BayTrail (SOC) |
1529 | Sunrise Point-H (PCH) |
1530 | + Sunrise Point-LP (PCH) |
1531 | |
1532 | This driver can also be built as a module. If so, the module |
1533 | will be called i2c-i801. |
1534 | diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c |
1535 | index 6ab4f1cb21f3..04d7d70ae32b 100644 |
1536 | --- a/drivers/i2c/busses/i2c-i801.c |
1537 | +++ b/drivers/i2c/busses/i2c-i801.c |
1538 | @@ -59,6 +59,7 @@ |
1539 | * Wildcat Point-LP (PCH) 0x9ca2 32 hard yes yes yes |
1540 | * BayTrail (SOC) 0x0f12 32 hard yes yes yes |
1541 | * Sunrise Point-H (PCH) 0xa123 32 hard yes yes yes |
1542 | + * Sunrise Point-LP (PCH) 0x9d23 32 hard yes yes yes |
1543 | * |
1544 | * Features supported by this driver: |
1545 | * Software PEC no |
1546 | @@ -182,6 +183,7 @@ |
1547 | #define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_SMBUS 0x9c22 |
1548 | #define PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_SMBUS 0x9ca2 |
1549 | #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_SMBUS 0xa123 |
1550 | +#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS 0x9d23 |
1551 | |
1552 | struct i801_mux_config { |
1553 | char *gpio_chip; |
1554 | @@ -829,6 +831,7 @@ static const struct pci_device_id i801_ids[] = { |
1555 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS) }, |
1556 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BRASWELL_SMBUS) }, |
1557 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_SMBUS) }, |
1558 | + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS) }, |
1559 | { 0, } |
1560 | }; |
1561 | |
1562 | diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c |
1563 | index 9b7ee7e427df..4a8a1d922e0f 100644 |
1564 | --- a/drivers/idle/intel_idle.c |
1565 | +++ b/drivers/idle/intel_idle.c |
1566 | @@ -727,6 +727,7 @@ static const struct x86_cpu_id intel_idle_ids[] = { |
1567 | ICPU(0x46, idle_cpu_hsw), |
1568 | ICPU(0x4d, idle_cpu_avn), |
1569 | ICPU(0x3d, idle_cpu_bdw), |
1570 | + ICPU(0x47, idle_cpu_bdw), |
1571 | ICPU(0x4f, idle_cpu_bdw), |
1572 | ICPU(0x56, idle_cpu_bdw), |
1573 | {} |
1574 | diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c |
1575 | index d5d95317003a..8ed7c0a70ed2 100644 |
1576 | --- a/drivers/iio/accel/hid-sensor-accel-3d.c |
1577 | +++ b/drivers/iio/accel/hid-sensor-accel-3d.c |
1578 | @@ -305,7 +305,6 @@ static int hid_accel_3d_probe(struct platform_device *pdev) |
1579 | struct iio_dev *indio_dev; |
1580 | struct accel_3d_state *accel_state; |
1581 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; |
1582 | - struct iio_chan_spec *channels; |
1583 | |
1584 | indio_dev = devm_iio_device_alloc(&pdev->dev, |
1585 | sizeof(struct accel_3d_state)); |
1586 | @@ -326,21 +325,21 @@ static int hid_accel_3d_probe(struct platform_device *pdev) |
1587 | return ret; |
1588 | } |
1589 | |
1590 | - channels = kmemdup(accel_3d_channels, sizeof(accel_3d_channels), |
1591 | - GFP_KERNEL); |
1592 | - if (!channels) { |
1593 | + indio_dev->channels = kmemdup(accel_3d_channels, |
1594 | + sizeof(accel_3d_channels), GFP_KERNEL); |
1595 | + if (!indio_dev->channels) { |
1596 | dev_err(&pdev->dev, "failed to duplicate channels\n"); |
1597 | return -ENOMEM; |
1598 | } |
1599 | |
1600 | - ret = accel_3d_parse_report(pdev, hsdev, channels, |
1601 | - HID_USAGE_SENSOR_ACCEL_3D, accel_state); |
1602 | + ret = accel_3d_parse_report(pdev, hsdev, |
1603 | + (struct iio_chan_spec *)indio_dev->channels, |
1604 | + HID_USAGE_SENSOR_ACCEL_3D, accel_state); |
1605 | if (ret) { |
1606 | dev_err(&pdev->dev, "failed to setup attributes\n"); |
1607 | goto error_free_dev_mem; |
1608 | } |
1609 | |
1610 | - indio_dev->channels = channels; |
1611 | indio_dev->num_channels = ARRAY_SIZE(accel_3d_channels); |
1612 | indio_dev->dev.parent = &pdev->dev; |
1613 | indio_dev->info = &accel_3d_info; |
1614 | diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c |
1615 | index 89d8aa1d2818..df12c57e6ce0 100644 |
1616 | --- a/drivers/iio/adc/twl6030-gpadc.c |
1617 | +++ b/drivers/iio/adc/twl6030-gpadc.c |
1618 | @@ -1001,7 +1001,7 @@ static struct platform_driver twl6030_gpadc_driver = { |
1619 | |
1620 | module_platform_driver(twl6030_gpadc_driver); |
1621 | |
1622 | -MODULE_ALIAS("platform: " DRIVER_NAME); |
1623 | +MODULE_ALIAS("platform:" DRIVER_NAME); |
1624 | MODULE_AUTHOR("Balaji T K <balajitk@ti.com>"); |
1625 | MODULE_AUTHOR("Graeme Gregory <gg@slimlogic.co.uk>"); |
1626 | MODULE_AUTHOR("Oleksandr Kozaruk <oleksandr.kozaruk@ti.com"); |
1627 | diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c |
1628 | index a3ea1e8785d7..c23c36bf99b5 100644 |
1629 | --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c |
1630 | +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c |
1631 | @@ -304,7 +304,6 @@ static int hid_gyro_3d_probe(struct platform_device *pdev) |
1632 | struct iio_dev *indio_dev; |
1633 | struct gyro_3d_state *gyro_state; |
1634 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; |
1635 | - struct iio_chan_spec *channels; |
1636 | |
1637 | indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*gyro_state)); |
1638 | if (!indio_dev) |
1639 | @@ -323,21 +322,21 @@ static int hid_gyro_3d_probe(struct platform_device *pdev) |
1640 | return ret; |
1641 | } |
1642 | |
1643 | - channels = kmemdup(gyro_3d_channels, sizeof(gyro_3d_channels), |
1644 | - GFP_KERNEL); |
1645 | - if (!channels) { |
1646 | + indio_dev->channels = kmemdup(gyro_3d_channels, |
1647 | + sizeof(gyro_3d_channels), GFP_KERNEL); |
1648 | + if (!indio_dev->channels) { |
1649 | dev_err(&pdev->dev, "failed to duplicate channels\n"); |
1650 | return -ENOMEM; |
1651 | } |
1652 | |
1653 | - ret = gyro_3d_parse_report(pdev, hsdev, channels, |
1654 | - HID_USAGE_SENSOR_GYRO_3D, gyro_state); |
1655 | + ret = gyro_3d_parse_report(pdev, hsdev, |
1656 | + (struct iio_chan_spec *)indio_dev->channels, |
1657 | + HID_USAGE_SENSOR_GYRO_3D, gyro_state); |
1658 | if (ret) { |
1659 | dev_err(&pdev->dev, "failed to setup attributes\n"); |
1660 | goto error_free_dev_mem; |
1661 | } |
1662 | |
1663 | - indio_dev->channels = channels; |
1664 | indio_dev->num_channels = ARRAY_SIZE(gyro_3d_channels); |
1665 | indio_dev->dev.parent = &pdev->dev; |
1666 | indio_dev->info = &gyro_3d_info; |
1667 | diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c |
1668 | index a5283d75c096..9c44fe02e62e 100644 |
1669 | --- a/drivers/iio/light/hid-sensor-als.c |
1670 | +++ b/drivers/iio/light/hid-sensor-als.c |
1671 | @@ -270,7 +270,6 @@ static int hid_als_probe(struct platform_device *pdev) |
1672 | struct iio_dev *indio_dev; |
1673 | struct als_state *als_state; |
1674 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; |
1675 | - struct iio_chan_spec *channels; |
1676 | |
1677 | indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct als_state)); |
1678 | if (!indio_dev) |
1679 | @@ -288,20 +287,21 @@ static int hid_als_probe(struct platform_device *pdev) |
1680 | return ret; |
1681 | } |
1682 | |
1683 | - channels = kmemdup(als_channels, sizeof(als_channels), GFP_KERNEL); |
1684 | - if (!channels) { |
1685 | + indio_dev->channels = kmemdup(als_channels, |
1686 | + sizeof(als_channels), GFP_KERNEL); |
1687 | + if (!indio_dev->channels) { |
1688 | dev_err(&pdev->dev, "failed to duplicate channels\n"); |
1689 | return -ENOMEM; |
1690 | } |
1691 | |
1692 | - ret = als_parse_report(pdev, hsdev, channels, |
1693 | - HID_USAGE_SENSOR_ALS, als_state); |
1694 | + ret = als_parse_report(pdev, hsdev, |
1695 | + (struct iio_chan_spec *)indio_dev->channels, |
1696 | + HID_USAGE_SENSOR_ALS, als_state); |
1697 | if (ret) { |
1698 | dev_err(&pdev->dev, "failed to setup attributes\n"); |
1699 | goto error_free_dev_mem; |
1700 | } |
1701 | |
1702 | - indio_dev->channels = channels; |
1703 | indio_dev->num_channels = |
1704 | ARRAY_SIZE(als_channels); |
1705 | indio_dev->dev.parent = &pdev->dev; |
1706 | diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c |
1707 | index a0966331a89b..c6f7e918b2b1 100644 |
1708 | --- a/drivers/input/touchscreen/usbtouchscreen.c |
1709 | +++ b/drivers/input/touchscreen/usbtouchscreen.c |
1710 | @@ -625,6 +625,9 @@ static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) |
1711 | goto err_out; |
1712 | } |
1713 | |
1714 | + /* TSC-25 data sheet specifies a delay after the RESET command */ |
1715 | + msleep(150); |
1716 | + |
1717 | /* set coordinate output rate */ |
1718 | buf[0] = buf[1] = 0xFF; |
1719 | ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0), |
1720 | diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c |
1721 | index da3604e73e8a..cced062cab4b 100644 |
1722 | --- a/drivers/md/bitmap.c |
1723 | +++ b/drivers/md/bitmap.c |
1724 | @@ -564,6 +564,8 @@ static int bitmap_read_sb(struct bitmap *bitmap) |
1725 | if (err) |
1726 | return err; |
1727 | |
1728 | + err = -EINVAL; |
1729 | + |
1730 | sb = kmap_atomic(sb_page); |
1731 | |
1732 | chunksize = le32_to_cpu(sb->chunksize); |
1733 | diff --git a/drivers/md/md.c b/drivers/md/md.c |
1734 | index 43390353d62f..dd7a3701b99c 100644 |
1735 | --- a/drivers/md/md.c |
1736 | +++ b/drivers/md/md.c |
1737 | @@ -5432,8 +5432,7 @@ static int get_bitmap_file(struct mddev *mddev, void __user * arg) |
1738 | char *ptr, *buf = NULL; |
1739 | int err = -ENOMEM; |
1740 | |
1741 | - file = kmalloc(sizeof(*file), GFP_NOIO); |
1742 | - |
1743 | + file = kzalloc(sizeof(*file), GFP_NOIO); |
1744 | if (!file) |
1745 | goto out; |
1746 | |
1747 | diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c |
1748 | index 2f2f38f4d83c..d24245c7b94a 100644 |
1749 | --- a/drivers/md/raid1.c |
1750 | +++ b/drivers/md/raid1.c |
1751 | @@ -336,7 +336,7 @@ static void raid1_end_read_request(struct bio *bio, int error) |
1752 | spin_lock_irqsave(&conf->device_lock, flags); |
1753 | if (r1_bio->mddev->degraded == conf->raid_disks || |
1754 | (r1_bio->mddev->degraded == conf->raid_disks-1 && |
1755 | - !test_bit(Faulty, &conf->mirrors[mirror].rdev->flags))) |
1756 | + test_bit(In_sync, &conf->mirrors[mirror].rdev->flags))) |
1757 | uptodate = 1; |
1758 | spin_unlock_irqrestore(&conf->device_lock, flags); |
1759 | } |
1760 | @@ -1474,6 +1474,7 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) |
1761 | { |
1762 | char b[BDEVNAME_SIZE]; |
1763 | struct r1conf *conf = mddev->private; |
1764 | + unsigned long flags; |
1765 | |
1766 | /* |
1767 | * If it is not operational, then we have already marked it as dead |
1768 | @@ -1493,14 +1494,13 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) |
1769 | return; |
1770 | } |
1771 | set_bit(Blocked, &rdev->flags); |
1772 | + spin_lock_irqsave(&conf->device_lock, flags); |
1773 | if (test_and_clear_bit(In_sync, &rdev->flags)) { |
1774 | - unsigned long flags; |
1775 | - spin_lock_irqsave(&conf->device_lock, flags); |
1776 | mddev->degraded++; |
1777 | set_bit(Faulty, &rdev->flags); |
1778 | - spin_unlock_irqrestore(&conf->device_lock, flags); |
1779 | } else |
1780 | set_bit(Faulty, &rdev->flags); |
1781 | + spin_unlock_irqrestore(&conf->device_lock, flags); |
1782 | /* |
1783 | * if recovery is running, make sure it aborts. |
1784 | */ |
1785 | @@ -1566,7 +1566,10 @@ static int raid1_spare_active(struct mddev *mddev) |
1786 | * Find all failed disks within the RAID1 configuration |
1787 | * and mark them readable. |
1788 | * Called under mddev lock, so rcu protection not needed. |
1789 | + * device_lock used to avoid races with raid1_end_read_request |
1790 | + * which expects 'In_sync' flags and ->degraded to be consistent. |
1791 | */ |
1792 | + spin_lock_irqsave(&conf->device_lock, flags); |
1793 | for (i = 0; i < conf->raid_disks; i++) { |
1794 | struct md_rdev *rdev = conf->mirrors[i].rdev; |
1795 | struct md_rdev *repl = conf->mirrors[conf->raid_disks + i].rdev; |
1796 | @@ -1596,7 +1599,6 @@ static int raid1_spare_active(struct mddev *mddev) |
1797 | sysfs_notify_dirent_safe(rdev->sysfs_state); |
1798 | } |
1799 | } |
1800 | - spin_lock_irqsave(&conf->device_lock, flags); |
1801 | mddev->degraded -= count; |
1802 | spin_unlock_irqrestore(&conf->device_lock, flags); |
1803 | |
1804 | diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h |
1805 | index 3497cfaf683c..a870c42731d7 100644 |
1806 | --- a/drivers/mmc/host/sdhci-esdhc.h |
1807 | +++ b/drivers/mmc/host/sdhci-esdhc.h |
1808 | @@ -45,6 +45,6 @@ |
1809 | #define ESDHC_DMA_SYSCTL 0x40c |
1810 | #define ESDHC_DMA_SNOOP 0x00000040 |
1811 | |
1812 | -#define ESDHC_HOST_CONTROL_RES 0x05 |
1813 | +#define ESDHC_HOST_CONTROL_RES 0x01 |
1814 | |
1815 | #endif /* _DRIVERS_MMC_SDHCI_ESDHC_H */ |
1816 | diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c |
1817 | index 7b04befd5271..13dd070a69da 100644 |
1818 | --- a/drivers/phy/phy-twl4030-usb.c |
1819 | +++ b/drivers/phy/phy-twl4030-usb.c |
1820 | @@ -144,6 +144,16 @@ |
1821 | #define PMBR1 0x0D |
1822 | #define GPIO_USB_4PIN_ULPI_2430C (3 << 0) |
1823 | |
1824 | +/* |
1825 | + * If VBUS is valid or ID is ground, then we know a |
1826 | + * cable is present and we need to be runtime-enabled |
1827 | + */ |
1828 | +static inline bool cable_present(enum omap_musb_vbus_id_status stat) |
1829 | +{ |
1830 | + return stat == OMAP_MUSB_VBUS_VALID || |
1831 | + stat == OMAP_MUSB_ID_GROUND; |
1832 | +} |
1833 | + |
1834 | struct twl4030_usb { |
1835 | struct usb_phy phy; |
1836 | struct device *dev; |
1837 | @@ -536,8 +546,10 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) |
1838 | |
1839 | mutex_lock(&twl->lock); |
1840 | if (status >= 0 && status != twl->linkstat) { |
1841 | + status_changed = |
1842 | + cable_present(twl->linkstat) != |
1843 | + cable_present(status); |
1844 | twl->linkstat = status; |
1845 | - status_changed = true; |
1846 | } |
1847 | mutex_unlock(&twl->lock); |
1848 | |
1849 | @@ -553,15 +565,11 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) |
1850 | * USB_LINK_VBUS state. musb_hdrc won't care until it |
1851 | * starts to handle softconnect right. |
1852 | */ |
1853 | - if ((status == OMAP_MUSB_VBUS_VALID) || |
1854 | - (status == OMAP_MUSB_ID_GROUND)) { |
1855 | - if (pm_runtime_suspended(twl->dev)) |
1856 | - pm_runtime_get_sync(twl->dev); |
1857 | + if (cable_present(status)) { |
1858 | + pm_runtime_get_sync(twl->dev); |
1859 | } else { |
1860 | - if (pm_runtime_active(twl->dev)) { |
1861 | - pm_runtime_mark_last_busy(twl->dev); |
1862 | - pm_runtime_put_autosuspend(twl->dev); |
1863 | - } |
1864 | + pm_runtime_mark_last_busy(twl->dev); |
1865 | + pm_runtime_put_autosuspend(twl->dev); |
1866 | } |
1867 | omap_musb_mailbox(status); |
1868 | } |
1869 | @@ -765,6 +773,9 @@ static int twl4030_usb_remove(struct platform_device *pdev) |
1870 | |
1871 | /* disable complete OTG block */ |
1872 | twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); |
1873 | + |
1874 | + if (cable_present(twl->linkstat)) |
1875 | + pm_runtime_put_noidle(twl->dev); |
1876 | pm_runtime_mark_last_busy(twl->dev); |
1877 | pm_runtime_put(twl->dev); |
1878 | |
1879 | diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c |
1880 | index cef5d49b59cd..b8311af7dda4 100644 |
1881 | --- a/drivers/scsi/hpsa.c |
1882 | +++ b/drivers/scsi/hpsa.c |
1883 | @@ -103,7 +103,6 @@ static const struct pci_device_id hpsa_pci_device_id[] = { |
1884 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1922}, |
1885 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1923}, |
1886 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1924}, |
1887 | - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1925}, |
1888 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1926}, |
1889 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1928}, |
1890 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1929}, |
1891 | @@ -149,6 +148,7 @@ static struct board_type products[] = { |
1892 | {0x3249103C, "Smart Array P812", &SA5_access}, |
1893 | {0x324A103C, "Smart Array P712m", &SA5_access}, |
1894 | {0x324B103C, "Smart Array P711m", &SA5_access}, |
1895 | + {0x3233103C, "HP StorageWorks 1210m", &SA5_access}, /* alias of 333f */ |
1896 | {0x3350103C, "Smart Array P222", &SA5_access}, |
1897 | {0x3351103C, "Smart Array P420", &SA5_access}, |
1898 | {0x3352103C, "Smart Array P421", &SA5_access}, |
1899 | diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c |
1900 | index c3bdca7bf1e9..f2e1b92eb314 100644 |
1901 | --- a/drivers/scsi/ipr.c |
1902 | +++ b/drivers/scsi/ipr.c |
1903 | @@ -592,9 +592,10 @@ static void ipr_trc_hook(struct ipr_cmnd *ipr_cmd, |
1904 | { |
1905 | struct ipr_trace_entry *trace_entry; |
1906 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; |
1907 | + unsigned int trace_index; |
1908 | |
1909 | - trace_entry = &ioa_cfg->trace[atomic_add_return |
1910 | - (1, &ioa_cfg->trace_index)%IPR_NUM_TRACE_ENTRIES]; |
1911 | + trace_index = atomic_add_return(1, &ioa_cfg->trace_index) & IPR_TRACE_INDEX_MASK; |
1912 | + trace_entry = &ioa_cfg->trace[trace_index]; |
1913 | trace_entry->time = jiffies; |
1914 | trace_entry->op_code = ipr_cmd->ioarcb.cmd_pkt.cdb[0]; |
1915 | trace_entry->type = type; |
1916 | @@ -1044,10 +1045,15 @@ static void ipr_send_blocking_cmd(struct ipr_cmnd *ipr_cmd, |
1917 | |
1918 | static int ipr_get_hrrq_index(struct ipr_ioa_cfg *ioa_cfg) |
1919 | { |
1920 | + unsigned int hrrq; |
1921 | + |
1922 | if (ioa_cfg->hrrq_num == 1) |
1923 | - return 0; |
1924 | - else |
1925 | - return (atomic_add_return(1, &ioa_cfg->hrrq_index) % (ioa_cfg->hrrq_num - 1)) + 1; |
1926 | + hrrq = 0; |
1927 | + else { |
1928 | + hrrq = atomic_add_return(1, &ioa_cfg->hrrq_index); |
1929 | + hrrq = (hrrq % (ioa_cfg->hrrq_num - 1)) + 1; |
1930 | + } |
1931 | + return hrrq; |
1932 | } |
1933 | |
1934 | /** |
1935 | @@ -6227,21 +6233,23 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd) |
1936 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; |
1937 | struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; |
1938 | u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); |
1939 | - unsigned long hrrq_flags; |
1940 | + unsigned long lock_flags; |
1941 | |
1942 | scsi_set_resid(scsi_cmd, be32_to_cpu(ipr_cmd->s.ioasa.hdr.residual_data_len)); |
1943 | |
1944 | if (likely(IPR_IOASC_SENSE_KEY(ioasc) == 0)) { |
1945 | scsi_dma_unmap(scsi_cmd); |
1946 | |
1947 | - spin_lock_irqsave(ipr_cmd->hrrq->lock, hrrq_flags); |
1948 | + spin_lock_irqsave(ipr_cmd->hrrq->lock, lock_flags); |
1949 | list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); |
1950 | scsi_cmd->scsi_done(scsi_cmd); |
1951 | - spin_unlock_irqrestore(ipr_cmd->hrrq->lock, hrrq_flags); |
1952 | + spin_unlock_irqrestore(ipr_cmd->hrrq->lock, lock_flags); |
1953 | } else { |
1954 | - spin_lock_irqsave(ipr_cmd->hrrq->lock, hrrq_flags); |
1955 | + spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
1956 | + spin_lock(&ipr_cmd->hrrq->_lock); |
1957 | ipr_erp_start(ioa_cfg, ipr_cmd); |
1958 | - spin_unlock_irqrestore(ipr_cmd->hrrq->lock, hrrq_flags); |
1959 | + spin_unlock(&ipr_cmd->hrrq->_lock); |
1960 | + spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
1961 | } |
1962 | } |
1963 | |
1964 | diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h |
1965 | index ae4626f64208..489487bdf230 100644 |
1966 | --- a/drivers/scsi/ipr.h |
1967 | +++ b/drivers/scsi/ipr.h |
1968 | @@ -1481,6 +1481,7 @@ struct ipr_ioa_cfg { |
1969 | |
1970 | #define IPR_NUM_TRACE_INDEX_BITS 8 |
1971 | #define IPR_NUM_TRACE_ENTRIES (1 << IPR_NUM_TRACE_INDEX_BITS) |
1972 | +#define IPR_TRACE_INDEX_MASK (IPR_NUM_TRACE_ENTRIES - 1) |
1973 | #define IPR_TRACE_SIZE (sizeof(struct ipr_trace_entry) * IPR_NUM_TRACE_ENTRIES) |
1974 | char trace_start[8]; |
1975 | #define IPR_TRACE_START_LABEL "trace" |
1976 | diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c |
1977 | index 07b2ea1fbf0d..b3c8aabfd687 100644 |
1978 | --- a/drivers/scsi/sg.c |
1979 | +++ b/drivers/scsi/sg.c |
1980 | @@ -1785,6 +1785,9 @@ sg_start_req(Sg_request *srp, unsigned char *cmd) |
1981 | md->from_user = 0; |
1982 | } |
1983 | |
1984 | + if (unlikely(iov_count > UIO_MAXIOV)) |
1985 | + return -EINVAL; |
1986 | + |
1987 | if (iov_count) { |
1988 | int len, size = sizeof(struct sg_iovec) * iov_count; |
1989 | struct iovec *iov; |
1990 | diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c |
1991 | index 4daa372ed381..2f3c5f5cfe14 100644 |
1992 | --- a/drivers/scsi/st.c |
1993 | +++ b/drivers/scsi/st.c |
1994 | @@ -1266,9 +1266,9 @@ static int st_open(struct inode *inode, struct file *filp) |
1995 | spin_lock(&st_use_lock); |
1996 | STp->in_use = 0; |
1997 | spin_unlock(&st_use_lock); |
1998 | - scsi_tape_put(STp); |
1999 | if (resumed) |
2000 | scsi_autopm_put_device(STp->device); |
2001 | + scsi_tape_put(STp); |
2002 | return retval; |
2003 | |
2004 | } |
2005 | diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
2006 | index 3c5dd9762476..06ea1a113e45 100644 |
2007 | --- a/drivers/target/iscsi/iscsi_target.c |
2008 | +++ b/drivers/target/iscsi/iscsi_target.c |
2009 | @@ -3961,7 +3961,13 @@ get_immediate: |
2010 | } |
2011 | |
2012 | transport_err: |
2013 | - iscsit_take_action_for_connection_exit(conn); |
2014 | + /* |
2015 | + * Avoid the normal connection failure code-path if this connection |
2016 | + * is still within LOGIN mode, and iscsi_np process context is |
2017 | + * responsible for cleaning up the early connection failure. |
2018 | + */ |
2019 | + if (conn->conn_state != TARG_CONN_STATE_IN_LOGIN) |
2020 | + iscsit_take_action_for_connection_exit(conn); |
2021 | out: |
2022 | return 0; |
2023 | } |
2024 | @@ -4047,7 +4053,7 @@ reject: |
2025 | |
2026 | int iscsi_target_rx_thread(void *arg) |
2027 | { |
2028 | - int ret; |
2029 | + int ret, rc; |
2030 | u8 buffer[ISCSI_HDR_LEN], opcode; |
2031 | u32 checksum = 0, digest = 0; |
2032 | struct iscsi_conn *conn = arg; |
2033 | @@ -4057,10 +4063,16 @@ int iscsi_target_rx_thread(void *arg) |
2034 | * connection recovery / failure event can be triggered externally. |
2035 | */ |
2036 | allow_signal(SIGINT); |
2037 | + /* |
2038 | + * Wait for iscsi_post_login_handler() to complete before allowing |
2039 | + * incoming iscsi/tcp socket I/O, and/or failing the connection. |
2040 | + */ |
2041 | + rc = wait_for_completion_interruptible(&conn->rx_login_comp); |
2042 | + if (rc < 0) |
2043 | + return 0; |
2044 | |
2045 | if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) { |
2046 | struct completion comp; |
2047 | - int rc; |
2048 | |
2049 | init_completion(&comp); |
2050 | rc = wait_for_completion_interruptible(&comp); |
2051 | @@ -4499,7 +4511,18 @@ static void iscsit_logout_post_handler_closesession( |
2052 | struct iscsi_conn *conn) |
2053 | { |
2054 | struct iscsi_session *sess = conn->sess; |
2055 | - int sleep = cmpxchg(&conn->tx_thread_active, true, false); |
2056 | + int sleep = 1; |
2057 | + /* |
2058 | + * Traditional iscsi/tcp will invoke this logic from TX thread |
2059 | + * context during session logout, so clear tx_thread_active and |
2060 | + * sleep if iscsit_close_connection() has not already occured. |
2061 | + * |
2062 | + * Since iser-target invokes this logic from it's own workqueue, |
2063 | + * always sleep waiting for RX/TX thread shutdown to complete |
2064 | + * within iscsit_close_connection(). |
2065 | + */ |
2066 | + if (conn->conn_transport->transport_type == ISCSI_TCP) |
2067 | + sleep = cmpxchg(&conn->tx_thread_active, true, false); |
2068 | |
2069 | atomic_set(&conn->conn_logout_remove, 0); |
2070 | complete(&conn->conn_logout_comp); |
2071 | @@ -4513,7 +4536,10 @@ static void iscsit_logout_post_handler_closesession( |
2072 | static void iscsit_logout_post_handler_samecid( |
2073 | struct iscsi_conn *conn) |
2074 | { |
2075 | - int sleep = cmpxchg(&conn->tx_thread_active, true, false); |
2076 | + int sleep = 1; |
2077 | + |
2078 | + if (conn->conn_transport->transport_type == ISCSI_TCP) |
2079 | + sleep = cmpxchg(&conn->tx_thread_active, true, false); |
2080 | |
2081 | atomic_set(&conn->conn_logout_remove, 0); |
2082 | complete(&conn->conn_logout_comp); |
2083 | @@ -4732,6 +4758,7 @@ int iscsit_release_sessions_for_tpg(struct iscsi_portal_group *tpg, int force) |
2084 | struct iscsi_session *sess; |
2085 | struct se_portal_group *se_tpg = &tpg->tpg_se_tpg; |
2086 | struct se_session *se_sess, *se_sess_tmp; |
2087 | + LIST_HEAD(free_list); |
2088 | int session_count = 0; |
2089 | |
2090 | spin_lock_bh(&se_tpg->session_lock); |
2091 | @@ -4753,14 +4780,17 @@ int iscsit_release_sessions_for_tpg(struct iscsi_portal_group *tpg, int force) |
2092 | } |
2093 | atomic_set(&sess->session_reinstatement, 1); |
2094 | spin_unlock(&sess->conn_lock); |
2095 | - spin_unlock_bh(&se_tpg->session_lock); |
2096 | |
2097 | - iscsit_free_session(sess); |
2098 | - spin_lock_bh(&se_tpg->session_lock); |
2099 | + list_move_tail(&se_sess->sess_list, &free_list); |
2100 | + } |
2101 | + spin_unlock_bh(&se_tpg->session_lock); |
2102 | + |
2103 | + list_for_each_entry_safe(se_sess, se_sess_tmp, &free_list, sess_list) { |
2104 | + sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; |
2105 | |
2106 | + iscsit_free_session(sess); |
2107 | session_count++; |
2108 | } |
2109 | - spin_unlock_bh(&se_tpg->session_lock); |
2110 | |
2111 | pr_debug("Released %d iSCSI Session(s) from Target Portal" |
2112 | " Group: %hu\n", session_count, tpg->tpgt); |
2113 | diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h |
2114 | index 2423f27e4670..62eb11329c71 100644 |
2115 | --- a/drivers/target/iscsi/iscsi_target_core.h |
2116 | +++ b/drivers/target/iscsi/iscsi_target_core.h |
2117 | @@ -605,6 +605,7 @@ struct iscsi_conn { |
2118 | int bitmap_id; |
2119 | int rx_thread_active; |
2120 | struct task_struct *rx_thread; |
2121 | + struct completion rx_login_comp; |
2122 | int tx_thread_active; |
2123 | struct task_struct *tx_thread; |
2124 | /* list_head for session connection list */ |
2125 | diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c |
2126 | index 2d87abc6b38c..719ec300cd24 100644 |
2127 | --- a/drivers/target/iscsi/iscsi_target_login.c |
2128 | +++ b/drivers/target/iscsi/iscsi_target_login.c |
2129 | @@ -83,6 +83,7 @@ static struct iscsi_login *iscsi_login_init_conn(struct iscsi_conn *conn) |
2130 | init_completion(&conn->conn_logout_comp); |
2131 | init_completion(&conn->rx_half_close_comp); |
2132 | init_completion(&conn->tx_half_close_comp); |
2133 | + init_completion(&conn->rx_login_comp); |
2134 | spin_lock_init(&conn->cmd_lock); |
2135 | spin_lock_init(&conn->conn_usage_lock); |
2136 | spin_lock_init(&conn->immed_queue_lock); |
2137 | @@ -734,6 +735,7 @@ int iscsit_start_kthreads(struct iscsi_conn *conn) |
2138 | |
2139 | return 0; |
2140 | out_tx: |
2141 | + send_sig(SIGINT, conn->tx_thread, 1); |
2142 | kthread_stop(conn->tx_thread); |
2143 | conn->tx_thread_active = false; |
2144 | out_bitmap: |
2145 | @@ -744,7 +746,7 @@ out_bitmap: |
2146 | return ret; |
2147 | } |
2148 | |
2149 | -int iscsi_post_login_handler( |
2150 | +void iscsi_post_login_handler( |
2151 | struct iscsi_np *np, |
2152 | struct iscsi_conn *conn, |
2153 | u8 zero_tsih) |
2154 | @@ -754,7 +756,6 @@ int iscsi_post_login_handler( |
2155 | struct se_session *se_sess = sess->se_sess; |
2156 | struct iscsi_portal_group *tpg = sess->tpg; |
2157 | struct se_portal_group *se_tpg = &tpg->tpg_se_tpg; |
2158 | - int rc; |
2159 | |
2160 | iscsit_inc_conn_usage_count(conn); |
2161 | |
2162 | @@ -795,10 +796,6 @@ int iscsi_post_login_handler( |
2163 | sess->sess_ops->InitiatorName); |
2164 | spin_unlock_bh(&sess->conn_lock); |
2165 | |
2166 | - rc = iscsit_start_kthreads(conn); |
2167 | - if (rc) |
2168 | - return rc; |
2169 | - |
2170 | iscsi_post_login_start_timers(conn); |
2171 | /* |
2172 | * Determine CPU mask to ensure connection's RX and TX kthreads |
2173 | @@ -807,15 +804,20 @@ int iscsi_post_login_handler( |
2174 | iscsit_thread_get_cpumask(conn); |
2175 | conn->conn_rx_reset_cpumask = 1; |
2176 | conn->conn_tx_reset_cpumask = 1; |
2177 | - |
2178 | + /* |
2179 | + * Wakeup the sleeping iscsi_target_rx_thread() now that |
2180 | + * iscsi_conn is in TARG_CONN_STATE_LOGGED_IN state. |
2181 | + */ |
2182 | + complete(&conn->rx_login_comp); |
2183 | iscsit_dec_conn_usage_count(conn); |
2184 | + |
2185 | if (stop_timer) { |
2186 | spin_lock_bh(&se_tpg->session_lock); |
2187 | iscsit_stop_time2retain_timer(sess); |
2188 | spin_unlock_bh(&se_tpg->session_lock); |
2189 | } |
2190 | iscsit_dec_session_usage_count(sess); |
2191 | - return 0; |
2192 | + return; |
2193 | } |
2194 | |
2195 | iscsi_set_session_parameters(sess->sess_ops, conn->param_list, 1); |
2196 | @@ -856,10 +858,6 @@ int iscsi_post_login_handler( |
2197 | " iSCSI Target Portal Group: %hu\n", tpg->nsessions, tpg->tpgt); |
2198 | spin_unlock_bh(&se_tpg->session_lock); |
2199 | |
2200 | - rc = iscsit_start_kthreads(conn); |
2201 | - if (rc) |
2202 | - return rc; |
2203 | - |
2204 | iscsi_post_login_start_timers(conn); |
2205 | /* |
2206 | * Determine CPU mask to ensure connection's RX and TX kthreads |
2207 | @@ -868,10 +866,12 @@ int iscsi_post_login_handler( |
2208 | iscsit_thread_get_cpumask(conn); |
2209 | conn->conn_rx_reset_cpumask = 1; |
2210 | conn->conn_tx_reset_cpumask = 1; |
2211 | - |
2212 | + /* |
2213 | + * Wakeup the sleeping iscsi_target_rx_thread() now that |
2214 | + * iscsi_conn is in TARG_CONN_STATE_LOGGED_IN state. |
2215 | + */ |
2216 | + complete(&conn->rx_login_comp); |
2217 | iscsit_dec_conn_usage_count(conn); |
2218 | - |
2219 | - return 0; |
2220 | } |
2221 | |
2222 | static void iscsi_handle_login_thread_timeout(unsigned long data) |
2223 | @@ -1435,23 +1435,12 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) |
2224 | if (ret < 0) |
2225 | goto new_sess_out; |
2226 | |
2227 | - if (!conn->sess) { |
2228 | - pr_err("struct iscsi_conn session pointer is NULL!\n"); |
2229 | - goto new_sess_out; |
2230 | - } |
2231 | - |
2232 | iscsi_stop_login_thread_timer(np); |
2233 | |
2234 | - if (signal_pending(current)) |
2235 | - goto new_sess_out; |
2236 | - |
2237 | if (ret == 1) { |
2238 | tpg_np = conn->tpg_np; |
2239 | |
2240 | - ret = iscsi_post_login_handler(np, conn, zero_tsih); |
2241 | - if (ret < 0) |
2242 | - goto new_sess_out; |
2243 | - |
2244 | + iscsi_post_login_handler(np, conn, zero_tsih); |
2245 | iscsit_deaccess_np(np, tpg, tpg_np); |
2246 | } |
2247 | |
2248 | diff --git a/drivers/target/iscsi/iscsi_target_login.h b/drivers/target/iscsi/iscsi_target_login.h |
2249 | index 29d098324b7f..55cbf4533544 100644 |
2250 | --- a/drivers/target/iscsi/iscsi_target_login.h |
2251 | +++ b/drivers/target/iscsi/iscsi_target_login.h |
2252 | @@ -12,7 +12,8 @@ extern int iscsit_accept_np(struct iscsi_np *, struct iscsi_conn *); |
2253 | extern int iscsit_get_login_rx(struct iscsi_conn *, struct iscsi_login *); |
2254 | extern int iscsit_put_login_tx(struct iscsi_conn *, struct iscsi_login *, u32); |
2255 | extern void iscsit_free_conn(struct iscsi_np *, struct iscsi_conn *); |
2256 | -extern int iscsi_post_login_handler(struct iscsi_np *, struct iscsi_conn *, u8); |
2257 | +extern int iscsit_start_kthreads(struct iscsi_conn *); |
2258 | +extern void iscsi_post_login_handler(struct iscsi_np *, struct iscsi_conn *, u8); |
2259 | extern void iscsi_target_login_sess_out(struct iscsi_conn *, struct iscsi_np *, |
2260 | bool, bool); |
2261 | extern int iscsi_target_login_thread(void *); |
2262 | diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c |
2263 | index 62a095f36bf2..092112e5e1a6 100644 |
2264 | --- a/drivers/target/iscsi/iscsi_target_nego.c |
2265 | +++ b/drivers/target/iscsi/iscsi_target_nego.c |
2266 | @@ -17,6 +17,7 @@ |
2267 | ******************************************************************************/ |
2268 | |
2269 | #include <linux/ctype.h> |
2270 | +#include <linux/kthread.h> |
2271 | #include <scsi/iscsi_proto.h> |
2272 | #include <target/target_core_base.h> |
2273 | #include <target/target_core_fabric.h> |
2274 | @@ -361,10 +362,24 @@ static int iscsi_target_do_tx_login_io(struct iscsi_conn *conn, struct iscsi_log |
2275 | ntohl(login_rsp->statsn), login->rsp_length); |
2276 | |
2277 | padding = ((-login->rsp_length) & 3); |
2278 | + /* |
2279 | + * Before sending the last login response containing the transition |
2280 | + * bit for full-feature-phase, go ahead and start up TX/RX threads |
2281 | + * now to avoid potential resource allocation failures after the |
2282 | + * final login response has been sent. |
2283 | + */ |
2284 | + if (login->login_complete) { |
2285 | + int rc = iscsit_start_kthreads(conn); |
2286 | + if (rc) { |
2287 | + iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, |
2288 | + ISCSI_LOGIN_STATUS_NO_RESOURCES); |
2289 | + return -1; |
2290 | + } |
2291 | + } |
2292 | |
2293 | if (conn->conn_transport->iscsit_put_login_tx(conn, login, |
2294 | login->rsp_length + padding) < 0) |
2295 | - return -1; |
2296 | + goto err; |
2297 | |
2298 | login->rsp_length = 0; |
2299 | mutex_lock(&sess->cmdsn_mutex); |
2300 | @@ -373,6 +388,23 @@ static int iscsi_target_do_tx_login_io(struct iscsi_conn *conn, struct iscsi_log |
2301 | mutex_unlock(&sess->cmdsn_mutex); |
2302 | |
2303 | return 0; |
2304 | + |
2305 | +err: |
2306 | + if (login->login_complete) { |
2307 | + if (conn->rx_thread && conn->rx_thread_active) { |
2308 | + send_sig(SIGINT, conn->rx_thread, 1); |
2309 | + kthread_stop(conn->rx_thread); |
2310 | + } |
2311 | + if (conn->tx_thread && conn->tx_thread_active) { |
2312 | + send_sig(SIGINT, conn->tx_thread, 1); |
2313 | + kthread_stop(conn->tx_thread); |
2314 | + } |
2315 | + spin_lock(&iscsit_global->ts_bitmap_lock); |
2316 | + bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id, |
2317 | + get_order(1)); |
2318 | + spin_unlock(&iscsit_global->ts_bitmap_lock); |
2319 | + } |
2320 | + return -1; |
2321 | } |
2322 | |
2323 | static void iscsi_target_sk_data_ready(struct sock *sk) |
2324 | diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c |
2325 | index 8803e693fe68..2f3b4ff5b9d1 100644 |
2326 | --- a/drivers/thermal/rcar_thermal.c |
2327 | +++ b/drivers/thermal/rcar_thermal.c |
2328 | @@ -372,6 +372,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) |
2329 | int i; |
2330 | int ret = -ENODEV; |
2331 | int idle = IDLE_INTERVAL; |
2332 | + u32 enr_bits = 0; |
2333 | |
2334 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); |
2335 | if (!common) |
2336 | @@ -408,9 +409,6 @@ static int rcar_thermal_probe(struct platform_device *pdev) |
2337 | if (IS_ERR(common->base)) |
2338 | return PTR_ERR(common->base); |
2339 | |
2340 | - /* enable temperature comparation */ |
2341 | - rcar_thermal_common_write(common, ENR, 0x00030303); |
2342 | - |
2343 | idle = 0; /* polling delay is not needed */ |
2344 | } |
2345 | |
2346 | @@ -452,8 +450,15 @@ static int rcar_thermal_probe(struct platform_device *pdev) |
2347 | rcar_thermal_irq_enable(priv); |
2348 | |
2349 | list_move_tail(&priv->list, &common->head); |
2350 | + |
2351 | + /* update ENR bits */ |
2352 | + enr_bits |= 3 << (i * 8); |
2353 | } |
2354 | |
2355 | + /* enable temperature comparation */ |
2356 | + if (irq) |
2357 | + rcar_thermal_common_write(common, ENR, enr_bits); |
2358 | + |
2359 | platform_set_drvdata(pdev, common); |
2360 | |
2361 | dev_info(dev, "%d sensor probed\n", i); |
2362 | diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c |
2363 | index 33e16658e5cf..df02947a77e3 100644 |
2364 | --- a/drivers/usb/gadget/function/f_uac2.c |
2365 | +++ b/drivers/usb/gadget/function/f_uac2.c |
2366 | @@ -1162,14 +1162,14 @@ afunc_set_alt(struct usb_function *fn, unsigned intf, unsigned alt) |
2367 | factor = 1000; |
2368 | } else { |
2369 | ep_desc = &hs_epin_desc; |
2370 | - factor = 125; |
2371 | + factor = 8000; |
2372 | } |
2373 | |
2374 | /* pre-compute some values for iso_complete() */ |
2375 | uac2->p_framesize = opts->p_ssize * |
2376 | num_channels(opts->p_chmask); |
2377 | rate = opts->p_srate * uac2->p_framesize; |
2378 | - uac2->p_interval = (1 << (ep_desc->bInterval - 1)) * factor; |
2379 | + uac2->p_interval = factor / (1 << (ep_desc->bInterval - 1)); |
2380 | uac2->p_pktsize = min_t(unsigned int, rate / uac2->p_interval, |
2381 | prm->max_psize); |
2382 | |
2383 | diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c |
2384 | index f2054659f25b..5442febcd7af 100644 |
2385 | --- a/drivers/usb/gadget/udc/udc-core.c |
2386 | +++ b/drivers/usb/gadget/udc/udc-core.c |
2387 | @@ -301,6 +301,7 @@ err4: |
2388 | |
2389 | err3: |
2390 | put_device(&udc->dev); |
2391 | + device_del(&gadget->dev); |
2392 | |
2393 | err2: |
2394 | put_device(&gadget->dev); |
2395 | diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
2396 | index 7ff97c39c8b4..8bdfb38782f8 100644 |
2397 | --- a/drivers/usb/host/xhci-hub.c |
2398 | +++ b/drivers/usb/host/xhci-hub.c |
2399 | @@ -484,10 +484,13 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci, |
2400 | u32 pls = status_reg & PORT_PLS_MASK; |
2401 | |
2402 | /* resume state is a xHCI internal state. |
2403 | - * Do not report it to usb core. |
2404 | + * Do not report it to usb core, instead, pretend to be U3, |
2405 | + * thus usb core knows it's not ready for transfer |
2406 | */ |
2407 | - if (pls == XDEV_RESUME) |
2408 | + if (pls == XDEV_RESUME) { |
2409 | + *status |= USB_SS_PORT_LS_U3; |
2410 | return; |
2411 | + } |
2412 | |
2413 | /* When the CAS bit is set then warm reset |
2414 | * should be performed on port |
2415 | @@ -588,7 +591,14 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, |
2416 | status |= USB_PORT_STAT_C_RESET << 16; |
2417 | /* USB3.0 only */ |
2418 | if (hcd->speed == HCD_USB3) { |
2419 | - if ((raw_port_status & PORT_PLC)) |
2420 | + /* Port link change with port in resume state should not be |
2421 | + * reported to usbcore, as this is an internal state to be |
2422 | + * handled by xhci driver. Reporting PLC to usbcore may |
2423 | + * cause usbcore clearing PLC first and port change event |
2424 | + * irq won't be generated. |
2425 | + */ |
2426 | + if ((raw_port_status & PORT_PLC) && |
2427 | + (raw_port_status & PORT_PLS_MASK) != XDEV_RESUME) |
2428 | status |= USB_PORT_STAT_C_LINK_STATE << 16; |
2429 | if ((raw_port_status & PORT_WRC)) |
2430 | status |= USB_PORT_STAT_C_BH_RESET << 16; |
2431 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c |
2432 | index a67018eddf41..d44c904df055 100644 |
2433 | --- a/drivers/usb/host/xhci-mem.c |
2434 | +++ b/drivers/usb/host/xhci-mem.c |
2435 | @@ -1796,7 +1796,8 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) |
2436 | int size; |
2437 | int i, j, num_ports; |
2438 | |
2439 | - del_timer_sync(&xhci->cmd_timer); |
2440 | + if (timer_pending(&xhci->cmd_timer)) |
2441 | + del_timer_sync(&xhci->cmd_timer); |
2442 | |
2443 | /* Free the Event Ring Segment Table and the actual Event Ring */ |
2444 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); |
2445 | diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
2446 | index 9848a67ddbbe..c70291cffc27 100644 |
2447 | --- a/drivers/usb/host/xhci-ring.c |
2448 | +++ b/drivers/usb/host/xhci-ring.c |
2449 | @@ -82,7 +82,7 @@ dma_addr_t xhci_trb_virt_to_dma(struct xhci_segment *seg, |
2450 | return 0; |
2451 | /* offset in TRBs */ |
2452 | segment_offset = trb - seg->trbs; |
2453 | - if (segment_offset > TRBS_PER_SEGMENT) |
2454 | + if (segment_offset >= TRBS_PER_SEGMENT) |
2455 | return 0; |
2456 | return seg->dma + (segment_offset * sizeof(*trb)); |
2457 | } |
2458 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
2459 | index 3bceabe109f7..8e5f46082316 100644 |
2460 | --- a/drivers/usb/host/xhci.c |
2461 | +++ b/drivers/usb/host/xhci.c |
2462 | @@ -3457,6 +3457,9 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) |
2463 | return -EINVAL; |
2464 | } |
2465 | |
2466 | + if (virt_dev->tt_info) |
2467 | + old_active_eps = virt_dev->tt_info->active_eps; |
2468 | + |
2469 | if (virt_dev->udev != udev) { |
2470 | /* If the virt_dev and the udev does not match, this virt_dev |
2471 | * may belong to another udev. |
2472 | diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c |
2473 | index b0c97a3f1bfe..634c14d022ce 100644 |
2474 | --- a/drivers/usb/renesas_usbhs/fifo.c |
2475 | +++ b/drivers/usb/renesas_usbhs/fifo.c |
2476 | @@ -621,6 +621,8 @@ struct usbhs_pkt_handle usbhs_fifo_pio_push_handler = { |
2477 | static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done) |
2478 | { |
2479 | struct usbhs_pipe *pipe = pkt->pipe; |
2480 | + struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); |
2481 | + struct usbhs_fifo *fifo = usbhsf_get_cfifo(priv); |
2482 | |
2483 | if (usbhs_pipe_is_busy(pipe)) |
2484 | return 0; |
2485 | @@ -634,6 +636,9 @@ static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done) |
2486 | usbhs_pipe_data_sequence(pipe, pkt->sequence); |
2487 | pkt->sequence = -1; /* -1 sequence will be ignored */ |
2488 | |
2489 | + if (usbhs_pipe_is_dcp(pipe)) |
2490 | + usbhsf_fifo_clear(pipe, fifo); |
2491 | + |
2492 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->length); |
2493 | usbhs_pipe_enable(pipe); |
2494 | usbhs_pipe_running(pipe, 1); |
2495 | @@ -683,7 +688,14 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done) |
2496 | *is_done = 1; |
2497 | usbhsf_rx_irq_ctrl(pipe, 0); |
2498 | usbhs_pipe_running(pipe, 0); |
2499 | - usbhs_pipe_disable(pipe); /* disable pipe first */ |
2500 | + /* |
2501 | + * If function mode, since this controller is possible to enter |
2502 | + * Control Write status stage at this timing, this driver |
2503 | + * should not disable the pipe. If such a case happens, this |
2504 | + * controller is not able to complete the status stage. |
2505 | + */ |
2506 | + if (!usbhs_mod_is_host(priv) && !usbhs_pipe_is_dcp(pipe)) |
2507 | + usbhs_pipe_disable(pipe); /* disable pipe first */ |
2508 | } |
2509 | |
2510 | /* |
2511 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
2512 | index c8c4e50ffee1..463feb836f20 100644 |
2513 | --- a/drivers/usb/serial/option.c |
2514 | +++ b/drivers/usb/serial/option.c |
2515 | @@ -1107,6 +1107,8 @@ static const struct usb_device_id option_ids[] = { |
2516 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ |
2517 | { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x68c0, 0xff), |
2518 | .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC73xx */ |
2519 | + { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x9041, 0xff), |
2520 | + .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC7305/MC7355 */ |
2521 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, |
2522 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, |
2523 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), |
2524 | diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c |
2525 | index 9c63897b3a56..d156545728c2 100644 |
2526 | --- a/drivers/usb/serial/qcserial.c |
2527 | +++ b/drivers/usb/serial/qcserial.c |
2528 | @@ -145,7 +145,6 @@ static const struct usb_device_id id_table[] = { |
2529 | {DEVICE_SWI(0x1199, 0x901c)}, /* Sierra Wireless EM7700 */ |
2530 | {DEVICE_SWI(0x1199, 0x901f)}, /* Sierra Wireless EM7355 */ |
2531 | {DEVICE_SWI(0x1199, 0x9040)}, /* Sierra Wireless Modem */ |
2532 | - {DEVICE_SWI(0x1199, 0x9041)}, /* Sierra Wireless MC7305/MC7355 */ |
2533 | {DEVICE_SWI(0x1199, 0x9051)}, /* Netgear AirCard 340U */ |
2534 | {DEVICE_SWI(0x1199, 0x9053)}, /* Sierra Wireless Modem */ |
2535 | {DEVICE_SWI(0x1199, 0x9054)}, /* Sierra Wireless Modem */ |
2536 | @@ -158,6 +157,7 @@ static const struct usb_device_id id_table[] = { |
2537 | {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ |
2538 | {DEVICE_SWI(0x413c, 0x81a8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ |
2539 | {DEVICE_SWI(0x413c, 0x81a9)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ |
2540 | + {DEVICE_SWI(0x413c, 0x81b1)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */ |
2541 | |
2542 | /* Huawei devices */ |
2543 | {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */ |
2544 | diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c |
2545 | index 46179a0828eb..07d1ecd564f7 100644 |
2546 | --- a/drivers/usb/serial/sierra.c |
2547 | +++ b/drivers/usb/serial/sierra.c |
2548 | @@ -289,6 +289,7 @@ static const struct usb_device_id id_table[] = { |
2549 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF), |
2550 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
2551 | }, |
2552 | + { USB_DEVICE(0x1199, 0x68AB) }, /* Sierra Wireless AR8550 */ |
2553 | /* AT&T Direct IP LTE modems */ |
2554 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), |
2555 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
2556 | diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
2557 | index 300ef9b817ed..36584e1f15c5 100644 |
2558 | --- a/drivers/usb/storage/unusual_devs.h |
2559 | +++ b/drivers/usb/storage/unusual_devs.h |
2560 | @@ -2065,6 +2065,18 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, |
2561 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
2562 | US_FL_NO_READ_DISC_INFO ), |
2563 | |
2564 | +/* Reported by Oliver Neukum <oneukum@suse.com> |
2565 | + * This device morphes spontaneously into another device if the access |
2566 | + * pattern of Windows isn't followed. Thus writable media would be dirty |
2567 | + * if the initial instance is used. So the device is limited to its |
2568 | + * virtual CD. |
2569 | + * And yes, the concept that BCD goes up to 9 is not heeded */ |
2570 | +UNUSUAL_DEV( 0x19d2, 0x1225, 0x0000, 0xffff, |
2571 | + "ZTE,Incorporated", |
2572 | + "ZTE WCDMA Technologies MSM", |
2573 | + USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
2574 | + US_FL_SINGLE_LUN ), |
2575 | + |
2576 | /* Reported by Sven Geggus <sven-usbst@geggus.net> |
2577 | * This encrypted pen drive returns bogus data for the initial READ(10). |
2578 | */ |
2579 | diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c |
2580 | index c90f4374442a..1fe2c8115be0 100644 |
2581 | --- a/drivers/vhost/vhost.c |
2582 | +++ b/drivers/vhost/vhost.c |
2583 | @@ -882,6 +882,7 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) |
2584 | } |
2585 | if (eventfp != d->log_file) { |
2586 | filep = d->log_file; |
2587 | + d->log_file = eventfp; |
2588 | ctx = d->log_ctx; |
2589 | d->log_ctx = eventfp ? |
2590 | eventfd_ctx_fileget(eventfp) : NULL; |
2591 | diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c |
2592 | index 073b4a19a8b0..91cc44611062 100644 |
2593 | --- a/drivers/xen/gntdev.c |
2594 | +++ b/drivers/xen/gntdev.c |
2595 | @@ -67,7 +67,7 @@ struct gntdev_priv { |
2596 | * Only populated if populate_freeable_maps == 1 */ |
2597 | struct list_head freeable_maps; |
2598 | /* lock protects maps and freeable_maps */ |
2599 | - spinlock_t lock; |
2600 | + struct mutex lock; |
2601 | struct mm_struct *mm; |
2602 | struct mmu_notifier mn; |
2603 | }; |
2604 | @@ -216,9 +216,9 @@ static void gntdev_put_map(struct gntdev_priv *priv, struct grant_map *map) |
2605 | } |
2606 | |
2607 | if (populate_freeable_maps && priv) { |
2608 | - spin_lock(&priv->lock); |
2609 | + mutex_lock(&priv->lock); |
2610 | list_del(&map->next); |
2611 | - spin_unlock(&priv->lock); |
2612 | + mutex_unlock(&priv->lock); |
2613 | } |
2614 | |
2615 | if (map->pages && !use_ptemod) |
2616 | @@ -387,9 +387,9 @@ static void gntdev_vma_close(struct vm_area_struct *vma) |
2617 | * not do any unmapping, since that has been done prior to |
2618 | * closing the vma, but it may still iterate the unmap_ops list. |
2619 | */ |
2620 | - spin_lock(&priv->lock); |
2621 | + mutex_lock(&priv->lock); |
2622 | map->vma = NULL; |
2623 | - spin_unlock(&priv->lock); |
2624 | + mutex_unlock(&priv->lock); |
2625 | } |
2626 | vma->vm_private_data = NULL; |
2627 | gntdev_put_map(priv, map); |
2628 | @@ -433,14 +433,14 @@ static void mn_invl_range_start(struct mmu_notifier *mn, |
2629 | struct gntdev_priv *priv = container_of(mn, struct gntdev_priv, mn); |
2630 | struct grant_map *map; |
2631 | |
2632 | - spin_lock(&priv->lock); |
2633 | + mutex_lock(&priv->lock); |
2634 | list_for_each_entry(map, &priv->maps, next) { |
2635 | unmap_if_in_range(map, start, end); |
2636 | } |
2637 | list_for_each_entry(map, &priv->freeable_maps, next) { |
2638 | unmap_if_in_range(map, start, end); |
2639 | } |
2640 | - spin_unlock(&priv->lock); |
2641 | + mutex_unlock(&priv->lock); |
2642 | } |
2643 | |
2644 | static void mn_invl_page(struct mmu_notifier *mn, |
2645 | @@ -457,7 +457,7 @@ static void mn_release(struct mmu_notifier *mn, |
2646 | struct grant_map *map; |
2647 | int err; |
2648 | |
2649 | - spin_lock(&priv->lock); |
2650 | + mutex_lock(&priv->lock); |
2651 | list_for_each_entry(map, &priv->maps, next) { |
2652 | if (!map->vma) |
2653 | continue; |
2654 | @@ -476,7 +476,7 @@ static void mn_release(struct mmu_notifier *mn, |
2655 | err = unmap_grant_pages(map, /* offset */ 0, map->count); |
2656 | WARN_ON(err); |
2657 | } |
2658 | - spin_unlock(&priv->lock); |
2659 | + mutex_unlock(&priv->lock); |
2660 | } |
2661 | |
2662 | static struct mmu_notifier_ops gntdev_mmu_ops = { |
2663 | @@ -498,7 +498,7 @@ static int gntdev_open(struct inode *inode, struct file *flip) |
2664 | |
2665 | INIT_LIST_HEAD(&priv->maps); |
2666 | INIT_LIST_HEAD(&priv->freeable_maps); |
2667 | - spin_lock_init(&priv->lock); |
2668 | + mutex_init(&priv->lock); |
2669 | |
2670 | if (use_ptemod) { |
2671 | priv->mm = get_task_mm(current); |
2672 | @@ -529,12 +529,14 @@ static int gntdev_release(struct inode *inode, struct file *flip) |
2673 | |
2674 | pr_debug("priv %p\n", priv); |
2675 | |
2676 | + mutex_lock(&priv->lock); |
2677 | while (!list_empty(&priv->maps)) { |
2678 | map = list_entry(priv->maps.next, struct grant_map, next); |
2679 | list_del(&map->next); |
2680 | gntdev_put_map(NULL /* already removed */, map); |
2681 | } |
2682 | WARN_ON(!list_empty(&priv->freeable_maps)); |
2683 | + mutex_unlock(&priv->lock); |
2684 | |
2685 | if (use_ptemod) |
2686 | mmu_notifier_unregister(&priv->mn, priv->mm); |
2687 | @@ -572,10 +574,10 @@ static long gntdev_ioctl_map_grant_ref(struct gntdev_priv *priv, |
2688 | return -EFAULT; |
2689 | } |
2690 | |
2691 | - spin_lock(&priv->lock); |
2692 | + mutex_lock(&priv->lock); |
2693 | gntdev_add_map(priv, map); |
2694 | op.index = map->index << PAGE_SHIFT; |
2695 | - spin_unlock(&priv->lock); |
2696 | + mutex_unlock(&priv->lock); |
2697 | |
2698 | if (copy_to_user(u, &op, sizeof(op)) != 0) |
2699 | return -EFAULT; |
2700 | @@ -594,7 +596,7 @@ static long gntdev_ioctl_unmap_grant_ref(struct gntdev_priv *priv, |
2701 | return -EFAULT; |
2702 | pr_debug("priv %p, del %d+%d\n", priv, (int)op.index, (int)op.count); |
2703 | |
2704 | - spin_lock(&priv->lock); |
2705 | + mutex_lock(&priv->lock); |
2706 | map = gntdev_find_map_index(priv, op.index >> PAGE_SHIFT, op.count); |
2707 | if (map) { |
2708 | list_del(&map->next); |
2709 | @@ -602,7 +604,7 @@ static long gntdev_ioctl_unmap_grant_ref(struct gntdev_priv *priv, |
2710 | list_add_tail(&map->next, &priv->freeable_maps); |
2711 | err = 0; |
2712 | } |
2713 | - spin_unlock(&priv->lock); |
2714 | + mutex_unlock(&priv->lock); |
2715 | if (map) |
2716 | gntdev_put_map(priv, map); |
2717 | return err; |
2718 | @@ -670,7 +672,7 @@ static long gntdev_ioctl_notify(struct gntdev_priv *priv, void __user *u) |
2719 | out_flags = op.action; |
2720 | out_event = op.event_channel_port; |
2721 | |
2722 | - spin_lock(&priv->lock); |
2723 | + mutex_lock(&priv->lock); |
2724 | |
2725 | list_for_each_entry(map, &priv->maps, next) { |
2726 | uint64_t begin = map->index << PAGE_SHIFT; |
2727 | @@ -698,7 +700,7 @@ static long gntdev_ioctl_notify(struct gntdev_priv *priv, void __user *u) |
2728 | rc = 0; |
2729 | |
2730 | unlock_out: |
2731 | - spin_unlock(&priv->lock); |
2732 | + mutex_unlock(&priv->lock); |
2733 | |
2734 | /* Drop the reference to the event channel we did not save in the map */ |
2735 | if (out_flags & UNMAP_NOTIFY_SEND_EVENT) |
2736 | @@ -748,7 +750,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) |
2737 | pr_debug("map %d+%d at %lx (pgoff %lx)\n", |
2738 | index, count, vma->vm_start, vma->vm_pgoff); |
2739 | |
2740 | - spin_lock(&priv->lock); |
2741 | + mutex_lock(&priv->lock); |
2742 | map = gntdev_find_map_index(priv, index, count); |
2743 | if (!map) |
2744 | goto unlock_out; |
2745 | @@ -783,7 +785,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) |
2746 | map->flags |= GNTMAP_readonly; |
2747 | } |
2748 | |
2749 | - spin_unlock(&priv->lock); |
2750 | + mutex_unlock(&priv->lock); |
2751 | |
2752 | if (use_ptemod) { |
2753 | err = apply_to_page_range(vma->vm_mm, vma->vm_start, |
2754 | @@ -811,11 +813,11 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) |
2755 | return 0; |
2756 | |
2757 | unlock_out: |
2758 | - spin_unlock(&priv->lock); |
2759 | + mutex_unlock(&priv->lock); |
2760 | return err; |
2761 | |
2762 | out_unlock_put: |
2763 | - spin_unlock(&priv->lock); |
2764 | + mutex_unlock(&priv->lock); |
2765 | out_put_map: |
2766 | if (use_ptemod) |
2767 | map->vma = NULL; |
2768 | diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c |
2769 | index bf3f424e0013..02391f3eb9b0 100644 |
2770 | --- a/fs/btrfs/extent_io.c |
2771 | +++ b/fs/btrfs/extent_io.c |
2772 | @@ -4484,8 +4484,11 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
2773 | } |
2774 | ret = fiemap_fill_next_extent(fieinfo, em_start, disko, |
2775 | em_len, flags); |
2776 | - if (ret) |
2777 | + if (ret) { |
2778 | + if (ret == 1) |
2779 | + ret = 0; |
2780 | goto out_free; |
2781 | + } |
2782 | } |
2783 | out_free: |
2784 | free_extent_map(em); |
2785 | diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c |
2786 | index cde9c03e3913..2105555657fc 100644 |
2787 | --- a/fs/btrfs/super.c |
2788 | +++ b/fs/btrfs/super.c |
2789 | @@ -901,6 +901,15 @@ find_root: |
2790 | if (IS_ERR(new_root)) |
2791 | return ERR_CAST(new_root); |
2792 | |
2793 | + if (!(sb->s_flags & MS_RDONLY)) { |
2794 | + int ret; |
2795 | + down_read(&fs_info->cleanup_work_sem); |
2796 | + ret = btrfs_orphan_cleanup(new_root); |
2797 | + up_read(&fs_info->cleanup_work_sem); |
2798 | + if (ret) |
2799 | + return ERR_PTR(ret); |
2800 | + } |
2801 | + |
2802 | dir_id = btrfs_root_dirid(&new_root->root_item); |
2803 | setup_root: |
2804 | location.objectid = dir_id; |
2805 | diff --git a/fs/dcache.c b/fs/dcache.c |
2806 | index d0539a4a1ab1..a66d6d80e2d9 100644 |
2807 | --- a/fs/dcache.c |
2808 | +++ b/fs/dcache.c |
2809 | @@ -629,6 +629,9 @@ repeat: |
2810 | if (unlikely(d_unhashed(dentry))) |
2811 | goto kill_it; |
2812 | |
2813 | + if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED)) |
2814 | + goto kill_it; |
2815 | + |
2816 | if (unlikely(dentry->d_flags & DCACHE_OP_DELETE)) { |
2817 | if (dentry->d_op->d_delete(dentry)) |
2818 | goto kill_it; |
2819 | diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c |
2820 | index 7cd00d3a7c9b..f445d155dfae 100644 |
2821 | --- a/fs/hpfs/super.c |
2822 | +++ b/fs/hpfs/super.c |
2823 | @@ -52,17 +52,20 @@ static void unmark_dirty(struct super_block *s) |
2824 | } |
2825 | |
2826 | /* Filesystem error... */ |
2827 | -static char err_buf[1024]; |
2828 | - |
2829 | void hpfs_error(struct super_block *s, const char *fmt, ...) |
2830 | { |
2831 | + struct va_format vaf; |
2832 | va_list args; |
2833 | |
2834 | va_start(args, fmt); |
2835 | - vsnprintf(err_buf, sizeof(err_buf), fmt, args); |
2836 | + |
2837 | + vaf.fmt = fmt; |
2838 | + vaf.va = &args; |
2839 | + |
2840 | + pr_err("filesystem error: %pV", &vaf); |
2841 | + |
2842 | va_end(args); |
2843 | |
2844 | - pr_err("filesystem error: %s", err_buf); |
2845 | if (!hpfs_sb(s)->sb_was_error) { |
2846 | if (hpfs_sb(s)->sb_err == 2) { |
2847 | pr_cont("; crashing the system because you wanted it\n"); |
2848 | diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
2849 | index 58f98ad93828..eda99c8ec3ed 100644 |
2850 | --- a/fs/nfsd/nfs4state.c |
2851 | +++ b/fs/nfsd/nfs4state.c |
2852 | @@ -4285,9 +4285,9 @@ laundromat_main(struct work_struct *laundry) |
2853 | queue_delayed_work(laundry_wq, &nn->laundromat_work, t*HZ); |
2854 | } |
2855 | |
2856 | -static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_ol_stateid *stp) |
2857 | +static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stid *stp) |
2858 | { |
2859 | - if (!nfsd_fh_match(&fhp->fh_handle, &stp->st_stid.sc_file->fi_fhandle)) |
2860 | + if (!nfsd_fh_match(&fhp->fh_handle, &stp->sc_file->fi_fhandle)) |
2861 | return nfserr_bad_stateid; |
2862 | return nfs_ok; |
2863 | } |
2864 | @@ -4462,20 +4462,49 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate, |
2865 | return nfs_ok; |
2866 | } |
2867 | |
2868 | +static struct file * |
2869 | +nfs4_find_file(struct nfs4_stid *s, int flags) |
2870 | +{ |
2871 | + switch (s->sc_type) { |
2872 | + case NFS4_DELEG_STID: |
2873 | + if (WARN_ON_ONCE(!s->sc_file->fi_deleg_file)) |
2874 | + return NULL; |
2875 | + return get_file(s->sc_file->fi_deleg_file); |
2876 | + case NFS4_OPEN_STID: |
2877 | + case NFS4_LOCK_STID: |
2878 | + if (flags & RD_STATE) |
2879 | + return find_readable_file(s->sc_file); |
2880 | + else |
2881 | + return find_writeable_file(s->sc_file); |
2882 | + break; |
2883 | + } |
2884 | + |
2885 | + return NULL; |
2886 | +} |
2887 | + |
2888 | +static __be32 |
2889 | +nfs4_check_olstateid(struct svc_fh *fhp, struct nfs4_ol_stateid *ols, int flags) |
2890 | +{ |
2891 | + __be32 status; |
2892 | + |
2893 | + status = nfsd4_check_openowner_confirmed(ols); |
2894 | + if (status) |
2895 | + return status; |
2896 | + return nfs4_check_openmode(ols, flags); |
2897 | +} |
2898 | + |
2899 | /* |
2900 | -* Checks for stateid operations |
2901 | -*/ |
2902 | + * Checks for stateid operations |
2903 | + */ |
2904 | __be32 |
2905 | nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate, |
2906 | stateid_t *stateid, int flags, struct file **filpp) |
2907 | { |
2908 | - struct nfs4_stid *s; |
2909 | - struct nfs4_ol_stateid *stp = NULL; |
2910 | - struct nfs4_delegation *dp = NULL; |
2911 | - struct svc_fh *current_fh = &cstate->current_fh; |
2912 | - struct inode *ino = current_fh->fh_dentry->d_inode; |
2913 | + struct svc_fh *fhp = &cstate->current_fh; |
2914 | + struct inode *ino = fhp->fh_dentry->d_inode; |
2915 | + |
2916 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); |
2917 | - struct file *file = NULL; |
2918 | + struct nfs4_stid *s; |
2919 | __be32 status; |
2920 | |
2921 | if (filpp) |
2922 | @@ -4485,60 +4514,39 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate, |
2923 | return nfserr_grace; |
2924 | |
2925 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) |
2926 | - return check_special_stateids(net, current_fh, stateid, flags); |
2927 | + return check_special_stateids(net, fhp, stateid, flags); |
2928 | |
2929 | status = nfsd4_lookup_stateid(cstate, stateid, |
2930 | NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID, |
2931 | &s, nn); |
2932 | if (status) |
2933 | return status; |
2934 | - status = check_stateid_generation(stateid, &s->sc_stateid, nfsd4_has_session(cstate)); |
2935 | + status = check_stateid_generation(stateid, &s->sc_stateid, |
2936 | + nfsd4_has_session(cstate)); |
2937 | if (status) |
2938 | goto out; |
2939 | + |
2940 | switch (s->sc_type) { |
2941 | case NFS4_DELEG_STID: |
2942 | - dp = delegstateid(s); |
2943 | - status = nfs4_check_delegmode(dp, flags); |
2944 | - if (status) |
2945 | - goto out; |
2946 | - if (filpp) { |
2947 | - file = dp->dl_stid.sc_file->fi_deleg_file; |
2948 | - if (!file) { |
2949 | - WARN_ON_ONCE(1); |
2950 | - status = nfserr_serverfault; |
2951 | - goto out; |
2952 | - } |
2953 | - get_file(file); |
2954 | - } |
2955 | + status = nfs4_check_delegmode(delegstateid(s), flags); |
2956 | break; |
2957 | case NFS4_OPEN_STID: |
2958 | case NFS4_LOCK_STID: |
2959 | - stp = openlockstateid(s); |
2960 | - status = nfs4_check_fh(current_fh, stp); |
2961 | - if (status) |
2962 | - goto out; |
2963 | - status = nfsd4_check_openowner_confirmed(stp); |
2964 | - if (status) |
2965 | - goto out; |
2966 | - status = nfs4_check_openmode(stp, flags); |
2967 | - if (status) |
2968 | - goto out; |
2969 | - if (filpp) { |
2970 | - struct nfs4_file *fp = stp->st_stid.sc_file; |
2971 | - |
2972 | - if (flags & RD_STATE) |
2973 | - file = find_readable_file(fp); |
2974 | - else |
2975 | - file = find_writeable_file(fp); |
2976 | - } |
2977 | + status = nfs4_check_olstateid(fhp, openlockstateid(s), flags); |
2978 | break; |
2979 | default: |
2980 | status = nfserr_bad_stateid; |
2981 | + break; |
2982 | + } |
2983 | + if (status) |
2984 | goto out; |
2985 | + status = nfs4_check_fh(fhp, s); |
2986 | + |
2987 | + if (!status && filpp) { |
2988 | + *filpp = nfs4_find_file(s, flags); |
2989 | + if (!*filpp) |
2990 | + status = nfserr_serverfault; |
2991 | } |
2992 | - status = nfs_ok; |
2993 | - if (file) |
2994 | - *filpp = file; |
2995 | out: |
2996 | nfs4_put_stid(s); |
2997 | return status; |
2998 | @@ -4642,7 +4650,7 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_ |
2999 | status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate)); |
3000 | if (status) |
3001 | return status; |
3002 | - return nfs4_check_fh(current_fh, stp); |
3003 | + return nfs4_check_fh(current_fh, &stp->st_stid); |
3004 | } |
3005 | |
3006 | /* |
3007 | diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c |
3008 | index 6abe96593225..0fd2f1c76e60 100644 |
3009 | --- a/fs/nfsd/nfs4xdr.c |
3010 | +++ b/fs/nfsd/nfs4xdr.c |
3011 | @@ -1974,6 +1974,7 @@ nfsd4_encode_aclname(struct xdr_stream *xdr, struct svc_rqst *rqstp, |
3012 | #define WORD0_ABSENT_FS_ATTRS (FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_FSID | \ |
3013 | FATTR4_WORD0_RDATTR_ERROR) |
3014 | #define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID |
3015 | +#define WORD2_ABSENT_FS_ATTRS 0 |
3016 | |
3017 | #ifdef CONFIG_NFSD_V4_SECURITY_LABEL |
3018 | static inline __be32 |
3019 | @@ -2002,7 +2003,7 @@ nfsd4_encode_security_label(struct xdr_stream *xdr, struct svc_rqst *rqstp, |
3020 | { return 0; } |
3021 | #endif |
3022 | |
3023 | -static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) |
3024 | +static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *bmval2, u32 *rdattr_err) |
3025 | { |
3026 | /* As per referral draft: */ |
3027 | if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS || |
3028 | @@ -2015,6 +2016,7 @@ static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) |
3029 | } |
3030 | *bmval0 &= WORD0_ABSENT_FS_ATTRS; |
3031 | *bmval1 &= WORD1_ABSENT_FS_ATTRS; |
3032 | + *bmval2 &= WORD2_ABSENT_FS_ATTRS; |
3033 | return 0; |
3034 | } |
3035 | |
3036 | @@ -2078,8 +2080,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, |
3037 | BUG_ON(bmval2 & ~nfsd_suppattrs2(minorversion)); |
3038 | |
3039 | if (exp->ex_fslocs.migrated) { |
3040 | - BUG_ON(bmval[2]); |
3041 | - status = fattr_handle_absent_fs(&bmval0, &bmval1, &rdattr_err); |
3042 | + status = fattr_handle_absent_fs(&bmval0, &bmval1, &bmval2, &rdattr_err); |
3043 | if (status) |
3044 | goto out; |
3045 | } |
3046 | @@ -2122,8 +2123,8 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, |
3047 | } |
3048 | |
3049 | #ifdef CONFIG_NFSD_V4_SECURITY_LABEL |
3050 | - if ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) || |
3051 | - bmval[0] & FATTR4_WORD0_SUPPORTED_ATTRS) { |
3052 | + if ((bmval2 & FATTR4_WORD2_SECURITY_LABEL) || |
3053 | + bmval0 & FATTR4_WORD0_SUPPORTED_ATTRS) { |
3054 | err = security_inode_getsecctx(dentry->d_inode, |
3055 | &context, &contextlen); |
3056 | contextsupport = (err == 0); |
3057 | diff --git a/fs/notify/mark.c b/fs/notify/mark.c |
3058 | index 34c38fabf514..28c90a6fcd6c 100644 |
3059 | --- a/fs/notify/mark.c |
3060 | +++ b/fs/notify/mark.c |
3061 | @@ -329,16 +329,36 @@ void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group, |
3062 | unsigned int flags) |
3063 | { |
3064 | struct fsnotify_mark *lmark, *mark; |
3065 | + LIST_HEAD(to_free); |
3066 | |
3067 | + /* |
3068 | + * We have to be really careful here. Anytime we drop mark_mutex, e.g. |
3069 | + * fsnotify_clear_marks_by_inode() can come and free marks. Even in our |
3070 | + * to_free list so we have to use mark_mutex even when accessing that |
3071 | + * list. And freeing mark requires us to drop mark_mutex. So we can |
3072 | + * reliably free only the first mark in the list. That's why we first |
3073 | + * move marks to free to to_free list in one go and then free marks in |
3074 | + * to_free list one by one. |
3075 | + */ |
3076 | mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING); |
3077 | list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) { |
3078 | - if (mark->flags & flags) { |
3079 | - fsnotify_get_mark(mark); |
3080 | - fsnotify_destroy_mark_locked(mark, group); |
3081 | - fsnotify_put_mark(mark); |
3082 | - } |
3083 | + if (mark->flags & flags) |
3084 | + list_move(&mark->g_list, &to_free); |
3085 | } |
3086 | mutex_unlock(&group->mark_mutex); |
3087 | + |
3088 | + while (1) { |
3089 | + mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING); |
3090 | + if (list_empty(&to_free)) { |
3091 | + mutex_unlock(&group->mark_mutex); |
3092 | + break; |
3093 | + } |
3094 | + mark = list_first_entry(&to_free, struct fsnotify_mark, g_list); |
3095 | + fsnotify_get_mark(mark); |
3096 | + fsnotify_destroy_mark_locked(mark, group); |
3097 | + mutex_unlock(&group->mark_mutex); |
3098 | + fsnotify_put_mark(mark); |
3099 | + } |
3100 | } |
3101 | |
3102 | /* |
3103 | diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c |
3104 | index 21262f2b1654..60d6fd9fb6ca 100644 |
3105 | --- a/fs/ocfs2/dlmglue.c |
3106 | +++ b/fs/ocfs2/dlmglue.c |
3107 | @@ -3993,9 +3993,13 @@ static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb) |
3108 | osb->dc_work_sequence = osb->dc_wake_sequence; |
3109 | |
3110 | processed = osb->blocked_lock_count; |
3111 | - while (processed) { |
3112 | - BUG_ON(list_empty(&osb->blocked_lock_list)); |
3113 | - |
3114 | + /* |
3115 | + * blocked lock processing in this loop might call iput which can |
3116 | + * remove items off osb->blocked_lock_list. Downconvert up to |
3117 | + * 'processed' number of locks, but stop short if we had some |
3118 | + * removed in ocfs2_mark_lockres_freeing when downconverting. |
3119 | + */ |
3120 | + while (processed && !list_empty(&osb->blocked_lock_list)) { |
3121 | lockres = list_entry(osb->blocked_lock_list.next, |
3122 | struct ocfs2_lock_res, l_blocked_list); |
3123 | list_del_init(&lockres->l_blocked_list); |
3124 | diff --git a/fs/signalfd.c b/fs/signalfd.c |
3125 | index 424b7b65321f..148f8e7af882 100644 |
3126 | --- a/fs/signalfd.c |
3127 | +++ b/fs/signalfd.c |
3128 | @@ -121,8 +121,9 @@ static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo, |
3129 | * Other callers might not initialize the si_lsb field, |
3130 | * so check explicitly for the right codes here. |
3131 | */ |
3132 | - if (kinfo->si_code == BUS_MCEERR_AR || |
3133 | - kinfo->si_code == BUS_MCEERR_AO) |
3134 | + if (kinfo->si_signo == SIGBUS && |
3135 | + (kinfo->si_code == BUS_MCEERR_AR || |
3136 | + kinfo->si_code == BUS_MCEERR_AO)) |
3137 | err |= __put_user((short) kinfo->si_addr_lsb, |
3138 | &uinfo->ssi_addr_lsb); |
3139 | #endif |
3140 | diff --git a/include/linux/acpi.h b/include/linux/acpi.h |
3141 | index 76d64d6a903a..1c7eaa718e65 100644 |
3142 | --- a/include/linux/acpi.h |
3143 | +++ b/include/linux/acpi.h |
3144 | @@ -415,6 +415,7 @@ extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, |
3145 | #define ACPI_OST_SC_INSERT_NOT_SUPPORTED 0x82 |
3146 | |
3147 | extern void acpi_early_init(void); |
3148 | +extern void acpi_subsystem_init(void); |
3149 | |
3150 | extern int acpi_nvs_register(__u64 start, __u64 size); |
3151 | |
3152 | @@ -450,6 +451,7 @@ static inline const char *acpi_dev_name(struct acpi_device *adev) |
3153 | } |
3154 | |
3155 | static inline void acpi_early_init(void) { } |
3156 | +static inline void acpi_subsystem_init(void) { } |
3157 | |
3158 | static inline int early_acpi_boot_init(void) |
3159 | { |
3160 | diff --git a/include/linux/kexec.h b/include/linux/kexec.h |
3161 | index 9d957b7ae095..9739607a6dfb 100644 |
3162 | --- a/include/linux/kexec.h |
3163 | +++ b/include/linux/kexec.h |
3164 | @@ -27,6 +27,10 @@ |
3165 | #error KEXEC_CONTROL_MEMORY_LIMIT not defined |
3166 | #endif |
3167 | |
3168 | +#ifndef KEXEC_CONTROL_MEMORY_GFP |
3169 | +#define KEXEC_CONTROL_MEMORY_GFP GFP_KERNEL |
3170 | +#endif |
3171 | + |
3172 | #ifndef KEXEC_CONTROL_PAGE_SIZE |
3173 | #error KEXEC_CONTROL_PAGE_SIZE not defined |
3174 | #endif |
3175 | diff --git a/include/linux/libata.h b/include/linux/libata.h |
3176 | index 8f6a07441b85..a60e04bcda0f 100644 |
3177 | --- a/include/linux/libata.h |
3178 | +++ b/include/linux/libata.h |
3179 | @@ -429,7 +429,9 @@ enum { |
3180 | ATA_HORKAGE_NO_NCQ_TRIM = (1 << 19), /* don't use queued TRIM */ |
3181 | ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */ |
3182 | ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */ |
3183 | - ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ |
3184 | + ATA_HORKAGE_ZERO_AFTER_TRIM = (1 << 22),/* guarantees zero after trim */ |
3185 | + ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ |
3186 | + |
3187 | |
3188 | /* DMA mask for user DMA control: User visible values; DO NOT |
3189 | renumber */ |
3190 | diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h |
3191 | index e4d451e4600b..49141aa5de3f 100644 |
3192 | --- a/include/linux/mtd/nand.h |
3193 | +++ b/include/linux/mtd/nand.h |
3194 | @@ -176,17 +176,17 @@ typedef enum { |
3195 | /* Chip may not exist, so silence any errors in scan */ |
3196 | #define NAND_SCAN_SILENT_NODEV 0x00040000 |
3197 | /* |
3198 | - * This option could be defined by controller drivers to protect against |
3199 | - * kmap'ed, vmalloc'ed highmem buffers being passed from upper layers |
3200 | - */ |
3201 | -#define NAND_USE_BOUNCE_BUFFER 0x00080000 |
3202 | -/* |
3203 | * Autodetect nand buswidth with readid/onfi. |
3204 | * This suppose the driver will configure the hardware in 8 bits mode |
3205 | * when calling nand_scan_ident, and update its configuration |
3206 | * before calling nand_scan_tail. |
3207 | */ |
3208 | #define NAND_BUSWIDTH_AUTO 0x00080000 |
3209 | +/* |
3210 | + * This option could be defined by controller drivers to protect against |
3211 | + * kmap'ed, vmalloc'ed highmem buffers being passed from upper layers |
3212 | + */ |
3213 | +#define NAND_USE_BOUNCE_BUFFER 0x00100000 |
3214 | |
3215 | /* Options set by nand scan */ |
3216 | /* Nand scan has allocated controller struct */ |
3217 | diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h |
3218 | index 4a1d0cc38ff2..7dd8d80edfb6 100644 |
3219 | --- a/include/uapi/linux/pci_regs.h |
3220 | +++ b/include/uapi/linux/pci_regs.h |
3221 | @@ -319,6 +319,7 @@ |
3222 | #define PCI_MSIX_PBA 8 /* Pending Bit Array offset */ |
3223 | #define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */ |
3224 | #define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */ |
3225 | +#define PCI_MSIX_FLAGS_BIRMASK PCI_MSIX_PBA_BIR /* deprecated */ |
3226 | #define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ |
3227 | |
3228 | /* MSI-X Table entry format */ |
3229 | diff --git a/init/main.c b/init/main.c |
3230 | index 321d0ceb26d3..32940a68ea48 100644 |
3231 | --- a/init/main.c |
3232 | +++ b/init/main.c |
3233 | @@ -667,6 +667,7 @@ asmlinkage __visible void __init start_kernel(void) |
3234 | |
3235 | check_bugs(); |
3236 | |
3237 | + acpi_subsystem_init(); |
3238 | sfi_init_late(); |
3239 | |
3240 | if (efi_enabled(EFI_RUNTIME_SERVICES)) { |
3241 | diff --git a/ipc/mqueue.c b/ipc/mqueue.c |
3242 | index 4fcf39af1776..f65a044d66c5 100644 |
3243 | --- a/ipc/mqueue.c |
3244 | +++ b/ipc/mqueue.c |
3245 | @@ -143,7 +143,6 @@ static int msg_insert(struct msg_msg *msg, struct mqueue_inode_info *info) |
3246 | if (!leaf) |
3247 | return -ENOMEM; |
3248 | INIT_LIST_HEAD(&leaf->msg_list); |
3249 | - info->qsize += sizeof(*leaf); |
3250 | } |
3251 | leaf->priority = msg->m_type; |
3252 | rb_link_node(&leaf->rb_node, parent, p); |
3253 | @@ -188,7 +187,6 @@ try_again: |
3254 | "lazy leaf delete!\n"); |
3255 | rb_erase(&leaf->rb_node, &info->msg_tree); |
3256 | if (info->node_cache) { |
3257 | - info->qsize -= sizeof(*leaf); |
3258 | kfree(leaf); |
3259 | } else { |
3260 | info->node_cache = leaf; |
3261 | @@ -201,7 +199,6 @@ try_again: |
3262 | if (list_empty(&leaf->msg_list)) { |
3263 | rb_erase(&leaf->rb_node, &info->msg_tree); |
3264 | if (info->node_cache) { |
3265 | - info->qsize -= sizeof(*leaf); |
3266 | kfree(leaf); |
3267 | } else { |
3268 | info->node_cache = leaf; |
3269 | @@ -1026,7 +1023,6 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, |
3270 | /* Save our speculative allocation into the cache */ |
3271 | INIT_LIST_HEAD(&new_leaf->msg_list); |
3272 | info->node_cache = new_leaf; |
3273 | - info->qsize += sizeof(*new_leaf); |
3274 | new_leaf = NULL; |
3275 | } else { |
3276 | kfree(new_leaf); |
3277 | @@ -1133,7 +1129,6 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, |
3278 | /* Save our speculative allocation into the cache */ |
3279 | INIT_LIST_HEAD(&new_leaf->msg_list); |
3280 | info->node_cache = new_leaf; |
3281 | - info->qsize += sizeof(*new_leaf); |
3282 | } else { |
3283 | kfree(new_leaf); |
3284 | } |
3285 | diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c |
3286 | index 9065107f083e..7a5237a1bce5 100644 |
3287 | --- a/kernel/irq/resend.c |
3288 | +++ b/kernel/irq/resend.c |
3289 | @@ -75,13 +75,21 @@ void check_irq_resend(struct irq_desc *desc, unsigned int irq) |
3290 | !desc->irq_data.chip->irq_retrigger(&desc->irq_data)) { |
3291 | #ifdef CONFIG_HARDIRQS_SW_RESEND |
3292 | /* |
3293 | - * If the interrupt has a parent irq and runs |
3294 | - * in the thread context of the parent irq, |
3295 | - * retrigger the parent. |
3296 | + * If the interrupt is running in the thread |
3297 | + * context of the parent irq we need to be |
3298 | + * careful, because we cannot trigger it |
3299 | + * directly. |
3300 | */ |
3301 | - if (desc->parent_irq && |
3302 | - irq_settings_is_nested_thread(desc)) |
3303 | + if (irq_settings_is_nested_thread(desc)) { |
3304 | + /* |
3305 | + * If the parent_irq is valid, we |
3306 | + * retrigger the parent, otherwise we |
3307 | + * do nothing. |
3308 | + */ |
3309 | + if (!desc->parent_irq) |
3310 | + return; |
3311 | irq = desc->parent_irq; |
3312 | + } |
3313 | /* Set it pending and activate the softirq: */ |
3314 | set_bit(irq, irqs_resend); |
3315 | tasklet_schedule(&resend_tasklet); |
3316 | diff --git a/kernel/kexec.c b/kernel/kexec.c |
3317 | index 2abf9f6e9a61..04eae03efe1e 100644 |
3318 | --- a/kernel/kexec.c |
3319 | +++ b/kernel/kexec.c |
3320 | @@ -707,7 +707,7 @@ static struct page *kimage_alloc_normal_control_pages(struct kimage *image, |
3321 | do { |
3322 | unsigned long pfn, epfn, addr, eaddr; |
3323 | |
3324 | - pages = kimage_alloc_pages(GFP_KERNEL, order); |
3325 | + pages = kimage_alloc_pages(KEXEC_CONTROL_MEMORY_GFP, order); |
3326 | if (!pages) |
3327 | break; |
3328 | pfn = page_to_pfn(pages); |
3329 | diff --git a/kernel/signal.c b/kernel/signal.c |
3330 | index 8f0876f9f6dd..74083306403f 100644 |
3331 | --- a/kernel/signal.c |
3332 | +++ b/kernel/signal.c |
3333 | @@ -2745,7 +2745,8 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from) |
3334 | * Other callers might not initialize the si_lsb field, |
3335 | * so check explicitly for the right codes here. |
3336 | */ |
3337 | - if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) |
3338 | + if (from->si_signo == SIGBUS && |
3339 | + (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)) |
3340 | err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); |
3341 | #endif |
3342 | break; |
3343 | @@ -3012,7 +3013,7 @@ COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo, |
3344 | int, sig, |
3345 | struct compat_siginfo __user *, uinfo) |
3346 | { |
3347 | - siginfo_t info; |
3348 | + siginfo_t info = {}; |
3349 | int ret = copy_siginfo_from_user32(&info, uinfo); |
3350 | if (unlikely(ret)) |
3351 | return ret; |
3352 | @@ -3058,7 +3059,7 @@ COMPAT_SYSCALL_DEFINE4(rt_tgsigqueueinfo, |
3353 | int, sig, |
3354 | struct compat_siginfo __user *, uinfo) |
3355 | { |
3356 | - siginfo_t info; |
3357 | + siginfo_t info = {}; |
3358 | |
3359 | if (copy_siginfo_from_user32(&info, uinfo)) |
3360 | return -EFAULT; |
3361 | diff --git a/mm/vmscan.c b/mm/vmscan.c |
3362 | index e3b0a54a44aa..e321fe20b979 100644 |
3363 | --- a/mm/vmscan.c |
3364 | +++ b/mm/vmscan.c |
3365 | @@ -895,21 +895,17 @@ static unsigned long shrink_page_list(struct list_head *page_list, |
3366 | * |
3367 | * 2) Global reclaim encounters a page, memcg encounters a |
3368 | * page that is not marked for immediate reclaim or |
3369 | - * the caller does not have __GFP_IO. In this case mark |
3370 | + * the caller does not have __GFP_FS (or __GFP_IO if it's |
3371 | + * simply going to swap, not to fs). In this case mark |
3372 | * the page for immediate reclaim and continue scanning. |
3373 | * |
3374 | - * __GFP_IO is checked because a loop driver thread might |
3375 | + * Require may_enter_fs because we would wait on fs, which |
3376 | + * may not have submitted IO yet. And the loop driver might |
3377 | * enter reclaim, and deadlock if it waits on a page for |
3378 | * which it is needed to do the write (loop masks off |
3379 | * __GFP_IO|__GFP_FS for this reason); but more thought |
3380 | * would probably show more reasons. |
3381 | * |
3382 | - * Don't require __GFP_FS, since we're not going into the |
3383 | - * FS, just waiting on its writeback completion. Worryingly, |
3384 | - * ext4 gfs2 and xfs allocate pages with |
3385 | - * grab_cache_page_write_begin(,,AOP_FLAG_NOFS), so testing |
3386 | - * may_enter_fs here is liable to OOM on them. |
3387 | - * |
3388 | * 3) memcg encounters a page that is not already marked |
3389 | * PageReclaim. memcg does not have any dirty pages |
3390 | * throttling so we could easily OOM just because too many |
3391 | @@ -926,7 +922,7 @@ static unsigned long shrink_page_list(struct list_head *page_list, |
3392 | |
3393 | /* Case 2 above */ |
3394 | } else if (global_reclaim(sc) || |
3395 | - !PageReclaim(page) || !(sc->gfp_mask & __GFP_IO)) { |
3396 | + !PageReclaim(page) || !may_enter_fs) { |
3397 | /* |
3398 | * This is slightly racy - end_page_writeback() |
3399 | * might have just cleared PageReclaim, then |
3400 | diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c |
3401 | index 1a7e979e80ba..15046aec8484 100644 |
3402 | --- a/net/ipv4/ip_vti.c |
3403 | +++ b/net/ipv4/ip_vti.c |
3404 | @@ -65,7 +65,6 @@ static int vti_input(struct sk_buff *skb, int nexthdr, __be32 spi, |
3405 | goto drop; |
3406 | |
3407 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = tunnel; |
3408 | - skb->mark = be32_to_cpu(tunnel->parms.i_key); |
3409 | |
3410 | return xfrm_input(skb, nexthdr, spi, encap_type); |
3411 | } |
3412 | @@ -91,6 +90,8 @@ static int vti_rcv_cb(struct sk_buff *skb, int err) |
3413 | struct pcpu_sw_netstats *tstats; |
3414 | struct xfrm_state *x; |
3415 | struct ip_tunnel *tunnel = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4; |
3416 | + u32 orig_mark = skb->mark; |
3417 | + int ret; |
3418 | |
3419 | if (!tunnel) |
3420 | return 1; |
3421 | @@ -107,7 +108,11 @@ static int vti_rcv_cb(struct sk_buff *skb, int err) |
3422 | x = xfrm_input_state(skb); |
3423 | family = x->inner_mode->afinfo->family; |
3424 | |
3425 | - if (!xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family)) |
3426 | + skb->mark = be32_to_cpu(tunnel->parms.i_key); |
3427 | + ret = xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family); |
3428 | + skb->mark = orig_mark; |
3429 | + |
3430 | + if (!ret) |
3431 | return -EPERM; |
3432 | |
3433 | skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(skb->dev))); |
3434 | @@ -216,8 +221,6 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) |
3435 | |
3436 | memset(&fl, 0, sizeof(fl)); |
3437 | |
3438 | - skb->mark = be32_to_cpu(tunnel->parms.o_key); |
3439 | - |
3440 | switch (skb->protocol) { |
3441 | case htons(ETH_P_IP): |
3442 | xfrm_decode_session(skb, &fl, AF_INET); |
3443 | @@ -233,6 +236,9 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) |
3444 | return NETDEV_TX_OK; |
3445 | } |
3446 | |
3447 | + /* override mark with tunnel output key */ |
3448 | + fl.flowi_mark = be32_to_cpu(tunnel->parms.o_key); |
3449 | + |
3450 | return vti_xmit(skb, dev, &fl); |
3451 | } |
3452 | |
3453 | diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c |
3454 | index 2459b7b0f705..1d67b37592d1 100644 |
3455 | --- a/net/ipv6/ip6_vti.c |
3456 | +++ b/net/ipv6/ip6_vti.c |
3457 | @@ -305,7 +305,6 @@ static int vti6_rcv(struct sk_buff *skb) |
3458 | } |
3459 | |
3460 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = t; |
3461 | - skb->mark = be32_to_cpu(t->parms.i_key); |
3462 | |
3463 | rcu_read_unlock(); |
3464 | |
3465 | @@ -325,6 +324,8 @@ static int vti6_rcv_cb(struct sk_buff *skb, int err) |
3466 | struct pcpu_sw_netstats *tstats; |
3467 | struct xfrm_state *x; |
3468 | struct ip6_tnl *t = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6; |
3469 | + u32 orig_mark = skb->mark; |
3470 | + int ret; |
3471 | |
3472 | if (!t) |
3473 | return 1; |
3474 | @@ -341,7 +342,11 @@ static int vti6_rcv_cb(struct sk_buff *skb, int err) |
3475 | x = xfrm_input_state(skb); |
3476 | family = x->inner_mode->afinfo->family; |
3477 | |
3478 | - if (!xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family)) |
3479 | + skb->mark = be32_to_cpu(t->parms.i_key); |
3480 | + ret = xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family); |
3481 | + skb->mark = orig_mark; |
3482 | + |
3483 | + if (!ret) |
3484 | return -EPERM; |
3485 | |
3486 | skb_scrub_packet(skb, !net_eq(t->net, dev_net(skb->dev))); |
3487 | @@ -472,7 +477,6 @@ vti6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
3488 | int ret; |
3489 | |
3490 | memset(&fl, 0, sizeof(fl)); |
3491 | - skb->mark = be32_to_cpu(t->parms.o_key); |
3492 | |
3493 | switch (skb->protocol) { |
3494 | case htons(ETH_P_IPV6): |
3495 | @@ -493,6 +497,9 @@ vti6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
3496 | goto tx_err; |
3497 | } |
3498 | |
3499 | + /* override mark with tunnel output key */ |
3500 | + fl.flowi_mark = be32_to_cpu(t->parms.o_key); |
3501 | + |
3502 | ret = vti6_xmit(skb, dev, &fl); |
3503 | if (ret < 0) |
3504 | goto tx_err; |
3505 | diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c |
3506 | index c68896adfa96..2d19963e6d97 100644 |
3507 | --- a/net/mac80211/debugfs_netdev.c |
3508 | +++ b/net/mac80211/debugfs_netdev.c |
3509 | @@ -725,6 +725,7 @@ void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) |
3510 | |
3511 | debugfs_remove_recursive(sdata->vif.debugfs_dir); |
3512 | sdata->vif.debugfs_dir = NULL; |
3513 | + sdata->debugfs.subdir_stations = NULL; |
3514 | } |
3515 | |
3516 | void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) |
3517 | diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c |
3518 | index 273b8bff6ba4..657ba9f5d308 100644 |
3519 | --- a/net/rds/ib_rdma.c |
3520 | +++ b/net/rds/ib_rdma.c |
3521 | @@ -759,8 +759,10 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents, |
3522 | } |
3523 | |
3524 | ibmr = rds_ib_alloc_fmr(rds_ibdev); |
3525 | - if (IS_ERR(ibmr)) |
3526 | + if (IS_ERR(ibmr)) { |
3527 | + rds_ib_dev_put(rds_ibdev); |
3528 | return ibmr; |
3529 | + } |
3530 | |
3531 | ret = rds_ib_map_fmr(rds_ibdev, ibmr, sg, nents); |
3532 | if (ret == 0) |
3533 | diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c |
3534 | index 85d1d4764612..00977873300c 100644 |
3535 | --- a/net/xfrm/xfrm_input.c |
3536 | +++ b/net/xfrm/xfrm_input.c |
3537 | @@ -13,6 +13,8 @@ |
3538 | #include <net/dst.h> |
3539 | #include <net/ip.h> |
3540 | #include <net/xfrm.h> |
3541 | +#include <net/ip_tunnels.h> |
3542 | +#include <net/ip6_tunnel.h> |
3543 | |
3544 | static struct kmem_cache *secpath_cachep __read_mostly; |
3545 | |
3546 | @@ -186,6 +188,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) |
3547 | struct xfrm_state *x = NULL; |
3548 | xfrm_address_t *daddr; |
3549 | struct xfrm_mode *inner_mode; |
3550 | + u32 mark = skb->mark; |
3551 | unsigned int family; |
3552 | int decaps = 0; |
3553 | int async = 0; |
3554 | @@ -203,6 +206,18 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) |
3555 | XFRM_SPI_SKB_CB(skb)->daddroff); |
3556 | family = XFRM_SPI_SKB_CB(skb)->family; |
3557 | |
3558 | + /* if tunnel is present override skb->mark value with tunnel i_key */ |
3559 | + if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4) { |
3560 | + switch (family) { |
3561 | + case AF_INET: |
3562 | + mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4->parms.i_key); |
3563 | + break; |
3564 | + case AF_INET6: |
3565 | + mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6->parms.i_key); |
3566 | + break; |
3567 | + } |
3568 | + } |
3569 | + |
3570 | /* Allocate new secpath or COW existing one. */ |
3571 | if (!skb->sp || atomic_read(&skb->sp->refcnt) != 1) { |
3572 | struct sec_path *sp; |
3573 | @@ -229,7 +244,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) |
3574 | goto drop; |
3575 | } |
3576 | |
3577 | - x = xfrm_state_lookup(net, skb->mark, daddr, spi, nexthdr, family); |
3578 | + x = xfrm_state_lookup(net, mark, daddr, spi, nexthdr, family); |
3579 | if (x == NULL) { |
3580 | XFRM_INC_STATS(net, LINUX_MIB_XFRMINNOSTATES); |
3581 | xfrm_audit_state_notfound(skb, family, spi, seq); |
3582 | diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c |
3583 | index cdc620b2152f..7e4ad2943918 100644 |
3584 | --- a/security/integrity/ima/ima_policy.c |
3585 | +++ b/security/integrity/ima/ima_policy.c |
3586 | @@ -27,6 +27,8 @@ |
3587 | #define IMA_UID 0x0008 |
3588 | #define IMA_FOWNER 0x0010 |
3589 | #define IMA_FSUUID 0x0020 |
3590 | +#define IMA_INMASK 0x0040 |
3591 | +#define IMA_EUID 0x0080 |
3592 | |
3593 | #define UNKNOWN 0 |
3594 | #define MEASURE 0x0001 /* same as IMA_MEASURE */ |
3595 | @@ -176,6 +178,9 @@ static bool ima_match_rules(struct ima_rule_entry *rule, |
3596 | if ((rule->flags & IMA_MASK) && |
3597 | (rule->mask != mask && func != POST_SETATTR)) |
3598 | return false; |
3599 | + if ((rule->flags & IMA_INMASK) && |
3600 | + (!(rule->mask & mask) && func != POST_SETATTR)) |
3601 | + return false; |
3602 | if ((rule->flags & IMA_FSMAGIC) |
3603 | && rule->fsmagic != inode->i_sb->s_magic) |
3604 | return false; |
3605 | @@ -184,6 +189,16 @@ static bool ima_match_rules(struct ima_rule_entry *rule, |
3606 | return false; |
3607 | if ((rule->flags & IMA_UID) && !uid_eq(rule->uid, cred->uid)) |
3608 | return false; |
3609 | + if (rule->flags & IMA_EUID) { |
3610 | + if (has_capability_noaudit(current, CAP_SETUID)) { |
3611 | + if (!uid_eq(rule->uid, cred->euid) |
3612 | + && !uid_eq(rule->uid, cred->suid) |
3613 | + && !uid_eq(rule->uid, cred->uid)) |
3614 | + return false; |
3615 | + } else if (!uid_eq(rule->uid, cred->euid)) |
3616 | + return false; |
3617 | + } |
3618 | + |
3619 | if ((rule->flags & IMA_FOWNER) && !uid_eq(rule->fowner, inode->i_uid)) |
3620 | return false; |
3621 | for (i = 0; i < MAX_LSM_RULES; i++) { |
3622 | @@ -378,7 +393,8 @@ enum { |
3623 | Opt_audit, |
3624 | Opt_obj_user, Opt_obj_role, Opt_obj_type, |
3625 | Opt_subj_user, Opt_subj_role, Opt_subj_type, |
3626 | - Opt_func, Opt_mask, Opt_fsmagic, Opt_uid, Opt_fowner, |
3627 | + Opt_func, Opt_mask, Opt_fsmagic, |
3628 | + Opt_uid, Opt_euid, Opt_fowner, |
3629 | Opt_appraise_type, Opt_fsuuid, Opt_permit_directio |
3630 | }; |
3631 | |
3632 | @@ -399,6 +415,7 @@ static match_table_t policy_tokens = { |
3633 | {Opt_fsmagic, "fsmagic=%s"}, |
3634 | {Opt_fsuuid, "fsuuid=%s"}, |
3635 | {Opt_uid, "uid=%s"}, |
3636 | + {Opt_euid, "euid=%s"}, |
3637 | {Opt_fowner, "fowner=%s"}, |
3638 | {Opt_appraise_type, "appraise_type=%s"}, |
3639 | {Opt_permit_directio, "permit_directio"}, |
3640 | @@ -440,6 +457,7 @@ static void ima_log_string(struct audit_buffer *ab, char *key, char *value) |
3641 | static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
3642 | { |
3643 | struct audit_buffer *ab; |
3644 | + char *from; |
3645 | char *p; |
3646 | int result = 0; |
3647 | |
3648 | @@ -530,18 +548,23 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
3649 | if (entry->mask) |
3650 | result = -EINVAL; |
3651 | |
3652 | - if ((strcmp(args[0].from, "MAY_EXEC")) == 0) |
3653 | + from = args[0].from; |
3654 | + if (*from == '^') |
3655 | + from++; |
3656 | + |
3657 | + if ((strcmp(from, "MAY_EXEC")) == 0) |
3658 | entry->mask = MAY_EXEC; |
3659 | - else if (strcmp(args[0].from, "MAY_WRITE") == 0) |
3660 | + else if (strcmp(from, "MAY_WRITE") == 0) |
3661 | entry->mask = MAY_WRITE; |
3662 | - else if (strcmp(args[0].from, "MAY_READ") == 0) |
3663 | + else if (strcmp(from, "MAY_READ") == 0) |
3664 | entry->mask = MAY_READ; |
3665 | - else if (strcmp(args[0].from, "MAY_APPEND") == 0) |
3666 | + else if (strcmp(from, "MAY_APPEND") == 0) |
3667 | entry->mask = MAY_APPEND; |
3668 | else |
3669 | result = -EINVAL; |
3670 | if (!result) |
3671 | - entry->flags |= IMA_MASK; |
3672 | + entry->flags |= (*args[0].from == '^') |
3673 | + ? IMA_INMASK : IMA_MASK; |
3674 | break; |
3675 | case Opt_fsmagic: |
3676 | ima_log_string(ab, "fsmagic", args[0].from); |
3677 | @@ -571,6 +594,9 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
3678 | break; |
3679 | case Opt_uid: |
3680 | ima_log_string(ab, "uid", args[0].from); |
3681 | + case Opt_euid: |
3682 | + if (token == Opt_euid) |
3683 | + ima_log_string(ab, "euid", args[0].from); |
3684 | |
3685 | if (uid_valid(entry->uid)) { |
3686 | result = -EINVAL; |
3687 | @@ -579,11 +605,14 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
3688 | |
3689 | result = kstrtoul(args[0].from, 10, &lnum); |
3690 | if (!result) { |
3691 | - entry->uid = make_kuid(current_user_ns(), (uid_t)lnum); |
3692 | - if (!uid_valid(entry->uid) || (((uid_t)lnum) != lnum)) |
3693 | + entry->uid = make_kuid(current_user_ns(), |
3694 | + (uid_t) lnum); |
3695 | + if (!uid_valid(entry->uid) || |
3696 | + (uid_t)lnum != lnum) |
3697 | result = -EINVAL; |
3698 | else |
3699 | - entry->flags |= IMA_UID; |
3700 | + entry->flags |= (token == Opt_uid) |
3701 | + ? IMA_UID : IMA_EUID; |
3702 | } |
3703 | break; |
3704 | case Opt_fowner: |
3705 | diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c |
3706 | index 95fc2eaf11dc..b960b7f26664 100644 |
3707 | --- a/sound/firewire/amdtp.c |
3708 | +++ b/sound/firewire/amdtp.c |
3709 | @@ -678,8 +678,9 @@ static void handle_in_packet(struct amdtp_stream *s, |
3710 | s->data_block_counter != UINT_MAX) |
3711 | data_block_counter = s->data_block_counter; |
3712 | |
3713 | - if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) && data_block_counter == 0) || |
3714 | - (s->data_block_counter == UINT_MAX)) { |
3715 | + if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) && |
3716 | + data_block_counter == s->tx_first_dbc) || |
3717 | + s->data_block_counter == UINT_MAX) { |
3718 | lost = false; |
3719 | } else if (!(s->flags & CIP_DBC_IS_END_EVENT)) { |
3720 | lost = data_block_counter != s->data_block_counter; |
3721 | diff --git a/sound/firewire/amdtp.h b/sound/firewire/amdtp.h |
3722 | index 4823c08196ac..6ce95b05ba2e 100644 |
3723 | --- a/sound/firewire/amdtp.h |
3724 | +++ b/sound/firewire/amdtp.h |
3725 | @@ -131,6 +131,8 @@ struct amdtp_stream { |
3726 | |
3727 | /* quirk: fixed interval of dbc between previos/current packets. */ |
3728 | unsigned int tx_dbc_interval; |
3729 | + /* quirk: indicate the value of dbc field in a first packet. */ |
3730 | + unsigned int tx_first_dbc; |
3731 | |
3732 | /* quirk: the first count of data blocks in an rx packet for MIDI */ |
3733 | unsigned int rx_blocks_for_midi; |
3734 | diff --git a/sound/firewire/fireworks/fireworks.c b/sound/firewire/fireworks/fireworks.c |
3735 | index 3e2ed8e82cbc..6813b0f6f185 100644 |
3736 | --- a/sound/firewire/fireworks/fireworks.c |
3737 | +++ b/sound/firewire/fireworks/fireworks.c |
3738 | @@ -237,8 +237,16 @@ efw_probe(struct fw_unit *unit, |
3739 | err = get_hardware_info(efw); |
3740 | if (err < 0) |
3741 | goto error; |
3742 | + /* AudioFire8 (since 2009) and AudioFirePre8 */ |
3743 | if (entry->model_id == MODEL_ECHO_AUDIOFIRE_9) |
3744 | efw->is_af9 = true; |
3745 | + /* These models uses the same firmware. */ |
3746 | + if (entry->model_id == MODEL_ECHO_AUDIOFIRE_2 || |
3747 | + entry->model_id == MODEL_ECHO_AUDIOFIRE_4 || |
3748 | + entry->model_id == MODEL_ECHO_AUDIOFIRE_9 || |
3749 | + entry->model_id == MODEL_GIBSON_RIP || |
3750 | + entry->model_id == MODEL_GIBSON_GOLDTOP) |
3751 | + efw->is_fireworks3 = true; |
3752 | |
3753 | snd_efw_proc_init(efw); |
3754 | |
3755 | diff --git a/sound/firewire/fireworks/fireworks.h b/sound/firewire/fireworks/fireworks.h |
3756 | index 4f0201a95222..084d414b228c 100644 |
3757 | --- a/sound/firewire/fireworks/fireworks.h |
3758 | +++ b/sound/firewire/fireworks/fireworks.h |
3759 | @@ -71,6 +71,7 @@ struct snd_efw { |
3760 | |
3761 | /* for quirks */ |
3762 | bool is_af9; |
3763 | + bool is_fireworks3; |
3764 | u32 firmware_version; |
3765 | |
3766 | unsigned int midi_in_ports; |
3767 | diff --git a/sound/firewire/fireworks/fireworks_stream.c b/sound/firewire/fireworks/fireworks_stream.c |
3768 | index b985fc5ebdc6..30c4042524d0 100644 |
3769 | --- a/sound/firewire/fireworks/fireworks_stream.c |
3770 | +++ b/sound/firewire/fireworks/fireworks_stream.c |
3771 | @@ -167,6 +167,15 @@ int snd_efw_stream_init_duplex(struct snd_efw *efw) |
3772 | efw->tx_stream.flags |= CIP_DBC_IS_END_EVENT; |
3773 | /* Fireworks reset dbc at bus reset. */ |
3774 | efw->tx_stream.flags |= CIP_SKIP_DBC_ZERO_CHECK; |
3775 | + /* |
3776 | + * But Recent firmwares starts packets with non-zero dbc. |
3777 | + * Driver version 5.7.6 installs firmware version 5.7.3. |
3778 | + */ |
3779 | + if (efw->is_fireworks3 && |
3780 | + (efw->firmware_version == 0x5070000 || |
3781 | + efw->firmware_version == 0x5070300 || |
3782 | + efw->firmware_version == 0x5080000)) |
3783 | + efw->tx_stream.tx_first_dbc = 0x02; |
3784 | /* AudioFire9 always reports wrong dbs. */ |
3785 | if (efw->is_af9) |
3786 | efw->tx_stream.flags |= CIP_WRONG_DBS; |
3787 | diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c |
3788 | index dd2b3d92071f..e5dac8ea65e4 100644 |
3789 | --- a/sound/pci/hda/patch_cirrus.c |
3790 | +++ b/sound/pci/hda/patch_cirrus.c |
3791 | @@ -1001,9 +1001,7 @@ static void cs4210_spdif_automute(struct hda_codec *codec, |
3792 | |
3793 | spec->spdif_present = spdif_present; |
3794 | /* SPDIF TX on/off */ |
3795 | - if (spdif_present) |
3796 | - snd_hda_set_pin_ctl(codec, spdif_pin, |
3797 | - spdif_present ? PIN_OUT : 0); |
3798 | + snd_hda_set_pin_ctl(codec, spdif_pin, spdif_present ? PIN_OUT : 0); |
3799 | |
3800 | cs_automute(codec); |
3801 | } |
3802 | diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
3803 | index edb6e6124a23..b422e406a9cb 100644 |
3804 | --- a/sound/pci/hda/patch_hdmi.c |
3805 | +++ b/sound/pci/hda/patch_hdmi.c |
3806 | @@ -47,7 +47,9 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); |
3807 | |
3808 | #define is_haswell(codec) ((codec)->vendor_id == 0x80862807) |
3809 | #define is_broadwell(codec) ((codec)->vendor_id == 0x80862808) |
3810 | -#define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec)) |
3811 | +#define is_skylake(codec) ((codec)->vendor_id == 0x80862809) |
3812 | +#define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec) \ |
3813 | + || is_skylake(codec)) |
3814 | |
3815 | #define is_valleyview(codec) ((codec)->vendor_id == 0x80862882) |
3816 | #define is_cherryview(codec) ((codec)->vendor_id == 0x80862883) |
3817 | @@ -3366,6 +3368,7 @@ static const struct hda_codec_preset snd_hda_preset_hdmi[] = { |
3818 | { .id = 0x80862806, .name = "PantherPoint HDMI", .patch = patch_generic_hdmi }, |
3819 | { .id = 0x80862807, .name = "Haswell HDMI", .patch = patch_generic_hdmi }, |
3820 | { .id = 0x80862808, .name = "Broadwell HDMI", .patch = patch_generic_hdmi }, |
3821 | +{ .id = 0x80862809, .name = "Skylake HDMI", .patch = patch_generic_hdmi }, |
3822 | { .id = 0x80862880, .name = "CedarTrail HDMI", .patch = patch_generic_hdmi }, |
3823 | { .id = 0x80862882, .name = "Valleyview2 HDMI", .patch = patch_generic_hdmi }, |
3824 | { .id = 0x80862883, .name = "Braswell HDMI", .patch = patch_generic_hdmi }, |
3825 | @@ -3427,6 +3430,7 @@ MODULE_ALIAS("snd-hda-codec-id:80862805"); |
3826 | MODULE_ALIAS("snd-hda-codec-id:80862806"); |
3827 | MODULE_ALIAS("snd-hda-codec-id:80862807"); |
3828 | MODULE_ALIAS("snd-hda-codec-id:80862808"); |
3829 | +MODULE_ALIAS("snd-hda-codec-id:80862809"); |
3830 | MODULE_ALIAS("snd-hda-codec-id:80862880"); |
3831 | MODULE_ALIAS("snd-hda-codec-id:80862882"); |
3832 | MODULE_ALIAS("snd-hda-codec-id:80862883"); |
3833 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
3834 | index 24cec17db1a4..f979293b421a 100644 |
3835 | --- a/sound/pci/hda/patch_realtek.c |
3836 | +++ b/sound/pci/hda/patch_realtek.c |
3837 | @@ -2221,7 +2221,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
3838 | SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF), |
3839 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), |
3840 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), |
3841 | - SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), |
3842 | + SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF), |
3843 | |
3844 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), |
3845 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), |
3846 | diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c |
3847 | index 477e13d30971..e7ba557979cb 100644 |
3848 | --- a/sound/soc/codecs/pcm1681.c |
3849 | +++ b/sound/soc/codecs/pcm1681.c |
3850 | @@ -102,7 +102,7 @@ static int pcm1681_set_deemph(struct snd_soc_codec *codec) |
3851 | |
3852 | if (val != -1) { |
3853 | regmap_update_bits(priv->regmap, PCM1681_DEEMPH_CONTROL, |
3854 | - PCM1681_DEEMPH_RATE_MASK, val); |
3855 | + PCM1681_DEEMPH_RATE_MASK, val << 3); |
3856 | enable = 1; |
3857 | } else |
3858 | enable = 0; |
3859 | diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c |
3860 | index 943e6a9a6319..34e5d8253c24 100644 |
3861 | --- a/sound/soc/soc-dapm.c |
3862 | +++ b/sound/soc/soc-dapm.c |
3863 | @@ -1854,6 +1854,7 @@ static ssize_t dapm_widget_power_read_file(struct file *file, |
3864 | size_t count, loff_t *ppos) |
3865 | { |
3866 | struct snd_soc_dapm_widget *w = file->private_data; |
3867 | + struct snd_soc_card *card = w->dapm->card; |
3868 | char *buf; |
3869 | int in, out; |
3870 | ssize_t ret; |
3871 | @@ -1863,6 +1864,8 @@ static ssize_t dapm_widget_power_read_file(struct file *file, |
3872 | if (!buf) |
3873 | return -ENOMEM; |
3874 | |
3875 | + mutex_lock(&card->dapm_mutex); |
3876 | + |
3877 | in = is_connected_input_ep(w, NULL); |
3878 | dapm_clear_walk_input(w->dapm, &w->sources); |
3879 | out = is_connected_output_ep(w, NULL); |
3880 | @@ -1905,6 +1908,8 @@ static ssize_t dapm_widget_power_read_file(struct file *file, |
3881 | p->sink->name); |
3882 | } |
3883 | |
3884 | + mutex_unlock(&card->dapm_mutex); |
3885 | + |
3886 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); |
3887 | |
3888 | kfree(buf); |
3889 | @@ -2165,11 +2170,15 @@ static ssize_t dapm_widget_show(struct device *dev, |
3890 | struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); |
3891 | int i, count = 0; |
3892 | |
3893 | + mutex_lock(&rtd->card->dapm_mutex); |
3894 | + |
3895 | for (i = 0; i < rtd->num_codecs; i++) { |
3896 | struct snd_soc_codec *codec = rtd->codec_dais[i]->codec; |
3897 | count += dapm_widget_show_codec(codec, buf + count); |
3898 | } |
3899 | |
3900 | + mutex_unlock(&rtd->card->dapm_mutex); |
3901 | + |
3902 | return count; |
3903 | } |
3904 | |
3905 | diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c |
3906 | index b16be3944213..9a3e1076a5b1 100644 |
3907 | --- a/sound/usb/mixer_maps.c |
3908 | +++ b/sound/usb/mixer_maps.c |
3909 | @@ -336,6 +336,20 @@ static const struct usbmix_name_map scms_usb3318_map[] = { |
3910 | { 0 } |
3911 | }; |
3912 | |
3913 | +/* Bose companion 5, the dB conversion factor is 16 instead of 256 */ |
3914 | +static struct usbmix_dB_map bose_companion5_dB = {-5006, -6}; |
3915 | +static struct usbmix_name_map bose_companion5_map[] = { |
3916 | + { 3, NULL, .dB = &bose_companion5_dB }, |
3917 | + { 0 } /* terminator */ |
3918 | +}; |
3919 | + |
3920 | +/* Dragonfly DAC 1.2, the dB conversion factor is 1 instead of 256 */ |
3921 | +static struct usbmix_dB_map dragonfly_1_2_dB = {0, 5000}; |
3922 | +static struct usbmix_name_map dragonfly_1_2_map[] = { |
3923 | + { 7, NULL, .dB = &dragonfly_1_2_dB }, |
3924 | + { 0 } /* terminator */ |
3925 | +}; |
3926 | + |
3927 | /* |
3928 | * Control map entries |
3929 | */ |
3930 | @@ -442,6 +456,16 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { |
3931 | .id = USB_ID(0x25c4, 0x0003), |
3932 | .map = scms_usb3318_map, |
3933 | }, |
3934 | + { |
3935 | + /* Bose Companion 5 */ |
3936 | + .id = USB_ID(0x05a7, 0x1020), |
3937 | + .map = bose_companion5_map, |
3938 | + }, |
3939 | + { |
3940 | + /* Dragonfly DAC 1.2 */ |
3941 | + .id = USB_ID(0x21b4, 0x0081), |
3942 | + .map = dragonfly_1_2_map, |
3943 | + }, |
3944 | { 0 } /* terminator */ |
3945 | }; |
3946 | |
3947 | diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
3948 | index fde5b6e3c8e5..17e1fdabd456 100644 |
3949 | --- a/sound/usb/quirks-table.h |
3950 | +++ b/sound/usb/quirks-table.h |
3951 | @@ -2516,6 +2516,74 @@ YAMAHA_DEVICE(0x7010, "UB99"), |
3952 | } |
3953 | }, |
3954 | |
3955 | +/* Steinberg devices */ |
3956 | +{ |
3957 | + /* Steinberg MI2 */ |
3958 | + USB_DEVICE_VENDOR_SPEC(0x0a4e, 0x2040), |
3959 | + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
3960 | + .ifnum = QUIRK_ANY_INTERFACE, |
3961 | + .type = QUIRK_COMPOSITE, |
3962 | + .data = & (const struct snd_usb_audio_quirk[]) { |
3963 | + { |
3964 | + .ifnum = 0, |
3965 | + .type = QUIRK_AUDIO_STANDARD_INTERFACE |
3966 | + }, |
3967 | + { |
3968 | + .ifnum = 1, |
3969 | + .type = QUIRK_AUDIO_STANDARD_INTERFACE |
3970 | + }, |
3971 | + { |
3972 | + .ifnum = 2, |
3973 | + .type = QUIRK_AUDIO_STANDARD_INTERFACE |
3974 | + }, |
3975 | + { |
3976 | + .ifnum = 3, |
3977 | + .type = QUIRK_MIDI_FIXED_ENDPOINT, |
3978 | + .data = &(const struct snd_usb_midi_endpoint_info) { |
3979 | + .out_cables = 0x0001, |
3980 | + .in_cables = 0x0001 |
3981 | + } |
3982 | + }, |
3983 | + { |
3984 | + .ifnum = -1 |
3985 | + } |
3986 | + } |
3987 | + } |
3988 | +}, |
3989 | +{ |
3990 | + /* Steinberg MI4 */ |
3991 | + USB_DEVICE_VENDOR_SPEC(0x0a4e, 0x4040), |
3992 | + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
3993 | + .ifnum = QUIRK_ANY_INTERFACE, |
3994 | + .type = QUIRK_COMPOSITE, |
3995 | + .data = & (const struct snd_usb_audio_quirk[]) { |
3996 | + { |
3997 | + .ifnum = 0, |
3998 | + .type = QUIRK_AUDIO_STANDARD_INTERFACE |
3999 | + }, |
4000 | + { |
4001 | + .ifnum = 1, |
4002 | + .type = QUIRK_AUDIO_STANDARD_INTERFACE |
4003 | + }, |
4004 | + { |
4005 | + .ifnum = 2, |
4006 | + .type = QUIRK_AUDIO_STANDARD_INTERFACE |
4007 | + }, |
4008 | + { |
4009 | + .ifnum = 3, |
4010 | + .type = QUIRK_MIDI_FIXED_ENDPOINT, |
4011 | + .data = &(const struct snd_usb_midi_endpoint_info) { |
4012 | + .out_cables = 0x0001, |
4013 | + .in_cables = 0x0001 |
4014 | + } |
4015 | + }, |
4016 | + { |
4017 | + .ifnum = -1 |
4018 | + } |
4019 | + } |
4020 | + } |
4021 | +}, |
4022 | + |
4023 | /* TerraTec devices */ |
4024 | { |
4025 | USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012), |