Annotation of /trunk/kernel-alx/patches-3.12/0101-3.12.2-all-fixes.patch
Parent Directory | Revision Log
Revision 2423 -
(hide annotations)
(download)
Tue Mar 25 12:29:50 2014 UTC (10 years, 6 months ago) by niro
File size: 124358 byte(s)
Tue Mar 25 12:29:50 2014 UTC (10 years, 6 months ago) by niro
File size: 124358 byte(s)
-added 3.12 branch
1 | niro | 2423 | diff --git a/Makefile b/Makefile |
2 | index eb29ec754a9e..e6e72b629da7 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,6 +1,6 @@ | ||
6 | VERSION = 3 | ||
7 | PATCHLEVEL = 12 | ||
8 | -SUBLEVEL = 1 | ||
9 | +SUBLEVEL = 2 | ||
10 | EXTRAVERSION = | ||
11 | NAME = One Giant Leap for Frogkind | ||
12 | |||
13 | diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c | ||
14 | index b0de86b56c13..cb79a5dd6d96 100644 | ||
15 | --- a/arch/arm/kvm/mmu.c | ||
16 | +++ b/arch/arm/kvm/mmu.c | ||
17 | @@ -307,6 +307,17 @@ out: | ||
18 | return err; | ||
19 | } | ||
20 | |||
21 | +static phys_addr_t kvm_kaddr_to_phys(void *kaddr) | ||
22 | +{ | ||
23 | + if (!is_vmalloc_addr(kaddr)) { | ||
24 | + BUG_ON(!virt_addr_valid(kaddr)); | ||
25 | + return __pa(kaddr); | ||
26 | + } else { | ||
27 | + return page_to_phys(vmalloc_to_page(kaddr)) + | ||
28 | + offset_in_page(kaddr); | ||
29 | + } | ||
30 | +} | ||
31 | + | ||
32 | /** | ||
33 | * create_hyp_mappings - duplicate a kernel virtual address range in Hyp mode | ||
34 | * @from: The virtual kernel start address of the range | ||
35 | @@ -318,16 +329,27 @@ out: | ||
36 | */ | ||
37 | int create_hyp_mappings(void *from, void *to) | ||
38 | { | ||
39 | - unsigned long phys_addr = virt_to_phys(from); | ||
40 | + phys_addr_t phys_addr; | ||
41 | + unsigned long virt_addr; | ||
42 | unsigned long start = KERN_TO_HYP((unsigned long)from); | ||
43 | unsigned long end = KERN_TO_HYP((unsigned long)to); | ||
44 | |||
45 | - /* Check for a valid kernel memory mapping */ | ||
46 | - if (!virt_addr_valid(from) || !virt_addr_valid(to - 1)) | ||
47 | - return -EINVAL; | ||
48 | + start = start & PAGE_MASK; | ||
49 | + end = PAGE_ALIGN(end); | ||
50 | |||
51 | - return __create_hyp_mappings(hyp_pgd, start, end, | ||
52 | - __phys_to_pfn(phys_addr), PAGE_HYP); | ||
53 | + for (virt_addr = start; virt_addr < end; virt_addr += PAGE_SIZE) { | ||
54 | + int err; | ||
55 | + | ||
56 | + phys_addr = kvm_kaddr_to_phys(from + virt_addr - start); | ||
57 | + err = __create_hyp_mappings(hyp_pgd, virt_addr, | ||
58 | + virt_addr + PAGE_SIZE, | ||
59 | + __phys_to_pfn(phys_addr), | ||
60 | + PAGE_HYP); | ||
61 | + if (err) | ||
62 | + return err; | ||
63 | + } | ||
64 | + | ||
65 | + return 0; | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c | ||
70 | index d9ee0ff094d4..3d5db8c83b3c 100644 | ||
71 | --- a/arch/arm/mach-omap2/omap_hwmod.c | ||
72 | +++ b/arch/arm/mach-omap2/omap_hwmod.c | ||
73 | @@ -2361,21 +2361,23 @@ static struct device_node *of_dev_hwmod_lookup(struct device_node *np, | ||
74 | * Cache the virtual address used by the MPU to access this IP block's | ||
75 | * registers. This address is needed early so the OCP registers that | ||
76 | * are part of the device's address space can be ioremapped properly. | ||
77 | - * No return value. | ||
78 | + * | ||
79 | + * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and | ||
80 | + * -ENXIO on absent or invalid register target address space. | ||
81 | */ | ||
82 | -static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) | ||
83 | +static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) | ||
84 | { | ||
85 | struct omap_hwmod_addr_space *mem; | ||
86 | void __iomem *va_start = NULL; | ||
87 | struct device_node *np; | ||
88 | |||
89 | if (!oh) | ||
90 | - return; | ||
91 | + return -EINVAL; | ||
92 | |||
93 | _save_mpu_port_index(oh); | ||
94 | |||
95 | if (oh->_int_flags & _HWMOD_NO_MPU_PORT) | ||
96 | - return; | ||
97 | + return -ENXIO; | ||
98 | |||
99 | mem = _find_mpu_rt_addr_space(oh); | ||
100 | if (!mem) { | ||
101 | @@ -2384,7 +2386,7 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) | ||
102 | |||
103 | /* Extract the IO space from device tree blob */ | ||
104 | if (!of_have_populated_dt()) | ||
105 | - return; | ||
106 | + return -ENXIO; | ||
107 | |||
108 | np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); | ||
109 | if (np) | ||
110 | @@ -2395,13 +2397,14 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) | ||
111 | |||
112 | if (!va_start) { | ||
113 | pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name); | ||
114 | - return; | ||
115 | + return -ENXIO; | ||
116 | } | ||
117 | |||
118 | pr_debug("omap_hwmod: %s: MPU register target at va %p\n", | ||
119 | oh->name, va_start); | ||
120 | |||
121 | oh->_mpu_rt_va = va_start; | ||
122 | + return 0; | ||
123 | } | ||
124 | |||
125 | /** | ||
126 | @@ -2414,8 +2417,8 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) | ||
127 | * registered at this point. This is the first of two phases for | ||
128 | * hwmod initialization. Code called here does not touch any hardware | ||
129 | * registers, it simply prepares internal data structures. Returns 0 | ||
130 | - * upon success or if the hwmod isn't registered, or -EINVAL upon | ||
131 | - * failure. | ||
132 | + * upon success or if the hwmod isn't registered or if the hwmod's | ||
133 | + * address space is not defined, or -EINVAL upon failure. | ||
134 | */ | ||
135 | static int __init _init(struct omap_hwmod *oh, void *data) | ||
136 | { | ||
137 | @@ -2424,8 +2427,14 @@ static int __init _init(struct omap_hwmod *oh, void *data) | ||
138 | if (oh->_state != _HWMOD_STATE_REGISTERED) | ||
139 | return 0; | ||
140 | |||
141 | - if (oh->class->sysc) | ||
142 | - _init_mpu_rt_base(oh, NULL); | ||
143 | + if (oh->class->sysc) { | ||
144 | + r = _init_mpu_rt_base(oh, NULL); | ||
145 | + if (r < 0) { | ||
146 | + WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n", | ||
147 | + oh->name); | ||
148 | + return 0; | ||
149 | + } | ||
150 | + } | ||
151 | |||
152 | r = _init_clocks(oh, NULL); | ||
153 | if (r < 0) { | ||
154 | diff --git a/arch/cris/include/asm/io.h b/arch/cris/include/asm/io.h | ||
155 | index 5d3047e5563b..4353cf239a13 100644 | ||
156 | --- a/arch/cris/include/asm/io.h | ||
157 | +++ b/arch/cris/include/asm/io.h | ||
158 | @@ -3,6 +3,7 @@ | ||
159 | |||
160 | #include <asm/page.h> /* for __va, __pa */ | ||
161 | #include <arch/io.h> | ||
162 | +#include <asm-generic/iomap.h> | ||
163 | #include <linux/kernel.h> | ||
164 | |||
165 | struct cris_io_operations | ||
166 | diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h | ||
167 | index e0a899a1a8a6..5a84b3a50741 100644 | ||
168 | --- a/arch/ia64/include/asm/processor.h | ||
169 | +++ b/arch/ia64/include/asm/processor.h | ||
170 | @@ -319,7 +319,7 @@ struct thread_struct { | ||
171 | regs->loadrs = 0; \ | ||
172 | regs->r8 = get_dumpable(current->mm); /* set "don't zap registers" flag */ \ | ||
173 | regs->r12 = new_sp - 16; /* allocate 16 byte scratch area */ \ | ||
174 | - if (unlikely(!get_dumpable(current->mm))) { \ | ||
175 | + if (unlikely(get_dumpable(current->mm) != SUID_DUMP_USER)) { \ | ||
176 | /* \ | ||
177 | * Zap scratch regs to avoid leaking bits between processes with different \ | ||
178 | * uid/privileges. \ | ||
179 | diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c | ||
180 | index 55593ee2d5aa..c766cf575520 100644 | ||
181 | --- a/arch/powerpc/kernel/eeh.c | ||
182 | +++ b/arch/powerpc/kernel/eeh.c | ||
183 | @@ -687,6 +687,15 @@ void eeh_save_bars(struct eeh_dev *edev) | ||
184 | |||
185 | for (i = 0; i < 16; i++) | ||
186 | eeh_ops->read_config(dn, i * 4, 4, &edev->config_space[i]); | ||
187 | + | ||
188 | + /* | ||
189 | + * For PCI bridges including root port, we need enable bus | ||
190 | + * master explicitly. Otherwise, it can't fetch IODA table | ||
191 | + * entries correctly. So we cache the bit in advance so that | ||
192 | + * we can restore it after reset, either PHB range or PE range. | ||
193 | + */ | ||
194 | + if (edev->mode & EEH_DEV_BRIDGE) | ||
195 | + edev->config_space[1] |= PCI_COMMAND_MASTER; | ||
196 | } | ||
197 | |||
198 | /** | ||
199 | diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c | ||
200 | index bebdf1a1a540..36d49e6b7c4c 100644 | ||
201 | --- a/arch/powerpc/kernel/signal_32.c | ||
202 | +++ b/arch/powerpc/kernel/signal_32.c | ||
203 | @@ -457,7 +457,15 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, | ||
204 | if (copy_vsx_to_user(&frame->mc_vsregs, current)) | ||
205 | return 1; | ||
206 | msr |= MSR_VSX; | ||
207 | - } | ||
208 | + } else if (!ctx_has_vsx_region) | ||
209 | + /* | ||
210 | + * With a small context structure we can't hold the VSX | ||
211 | + * registers, hence clear the MSR value to indicate the state | ||
212 | + * was not saved. | ||
213 | + */ | ||
214 | + msr &= ~MSR_VSX; | ||
215 | + | ||
216 | + | ||
217 | #endif /* CONFIG_VSX */ | ||
218 | #ifdef CONFIG_SPE | ||
219 | /* save spe registers */ | ||
220 | diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c | ||
221 | index 192b051df97e..b3b144121cc9 100644 | ||
222 | --- a/arch/powerpc/kernel/time.c | ||
223 | +++ b/arch/powerpc/kernel/time.c | ||
224 | @@ -213,8 +213,6 @@ static u64 scan_dispatch_log(u64 stop_tb) | ||
225 | if (i == be64_to_cpu(vpa->dtl_idx)) | ||
226 | return 0; | ||
227 | while (i < be64_to_cpu(vpa->dtl_idx)) { | ||
228 | - if (dtl_consumer) | ||
229 | - dtl_consumer(dtl, i); | ||
230 | dtb = be64_to_cpu(dtl->timebase); | ||
231 | tb_delta = be32_to_cpu(dtl->enqueue_to_dispatch_time) + | ||
232 | be32_to_cpu(dtl->ready_to_enqueue_time); | ||
233 | @@ -227,6 +225,8 @@ static u64 scan_dispatch_log(u64 stop_tb) | ||
234 | } | ||
235 | if (dtb > stop_tb) | ||
236 | break; | ||
237 | + if (dtl_consumer) | ||
238 | + dtl_consumer(dtl, i); | ||
239 | stolen += tb_delta; | ||
240 | ++i; | ||
241 | ++dtl; | ||
242 | diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c | ||
243 | index d38cc08b16c7..cb92d8204ec7 100644 | ||
244 | --- a/arch/powerpc/kernel/vio.c | ||
245 | +++ b/arch/powerpc/kernel/vio.c | ||
246 | @@ -1531,12 +1531,12 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, | ||
247 | |||
248 | dn = dev->of_node; | ||
249 | if (!dn) { | ||
250 | - strcat(buf, "\n"); | ||
251 | + strcpy(buf, "\n"); | ||
252 | return strlen(buf); | ||
253 | } | ||
254 | cp = of_get_property(dn, "compatible", NULL); | ||
255 | if (!cp) { | ||
256 | - strcat(buf, "\n"); | ||
257 | + strcpy(buf, "\n"); | ||
258 | return strlen(buf); | ||
259 | } | ||
260 | |||
261 | diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c | ||
262 | index 6936547018b8..c5f734e20b0f 100644 | ||
263 | --- a/arch/powerpc/mm/gup.c | ||
264 | +++ b/arch/powerpc/mm/gup.c | ||
265 | @@ -123,6 +123,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, | ||
266 | struct mm_struct *mm = current->mm; | ||
267 | unsigned long addr, len, end; | ||
268 | unsigned long next; | ||
269 | + unsigned long flags; | ||
270 | pgd_t *pgdp; | ||
271 | int nr = 0; | ||
272 | |||
273 | @@ -156,7 +157,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, | ||
274 | * So long as we atomically load page table pointers versus teardown, | ||
275 | * we can follow the address down to the the page and take a ref on it. | ||
276 | */ | ||
277 | - local_irq_disable(); | ||
278 | + local_irq_save(flags); | ||
279 | |||
280 | pgdp = pgd_offset(mm, addr); | ||
281 | do { | ||
282 | @@ -179,7 +180,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, | ||
283 | break; | ||
284 | } while (pgdp++, addr = next, addr != end); | ||
285 | |||
286 | - local_irq_enable(); | ||
287 | + local_irq_restore(flags); | ||
288 | |||
289 | return nr; | ||
290 | } | ||
291 | diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c | ||
292 | index 3e99c149271a..7ce9cf3b6988 100644 | ||
293 | --- a/arch/powerpc/mm/slice.c | ||
294 | +++ b/arch/powerpc/mm/slice.c | ||
295 | @@ -258,7 +258,7 @@ static bool slice_scan_available(unsigned long addr, | ||
296 | slice = GET_HIGH_SLICE_INDEX(addr); | ||
297 | *boundary_addr = (slice + end) ? | ||
298 | ((slice + end) << SLICE_HIGH_SHIFT) : SLICE_LOW_TOP; | ||
299 | - return !!(available.high_slices & (1u << slice)); | ||
300 | + return !!(available.high_slices & (1ul << slice)); | ||
301 | } | ||
302 | } | ||
303 | |||
304 | diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c | ||
305 | index a82a41b4fd91..1a7b1d0f41df 100644 | ||
306 | --- a/arch/powerpc/platforms/512x/mpc512x_shared.c | ||
307 | +++ b/arch/powerpc/platforms/512x/mpc512x_shared.c | ||
308 | @@ -303,6 +303,9 @@ void __init mpc512x_setup_diu(void) | ||
309 | diu_ops.release_bootmem = mpc512x_release_bootmem; | ||
310 | } | ||
311 | |||
312 | +#else | ||
313 | +void __init mpc512x_setup_diu(void) { /* EMPTY */ } | ||
314 | +void __init mpc512x_init_diu(void) { /* EMPTY */ } | ||
315 | #endif | ||
316 | |||
317 | void __init mpc512x_init_IRQ(void) | ||
318 | diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig | ||
319 | index 90f4496017e4..af54174801f7 100644 | ||
320 | --- a/arch/powerpc/platforms/52xx/Kconfig | ||
321 | +++ b/arch/powerpc/platforms/52xx/Kconfig | ||
322 | @@ -57,5 +57,5 @@ config PPC_MPC5200_BUGFIX | ||
323 | |||
324 | config PPC_MPC5200_LPBFIFO | ||
325 | tristate "MPC5200 LocalPlus bus FIFO driver" | ||
326 | - depends on PPC_MPC52xx | ||
327 | + depends on PPC_MPC52xx && PPC_BESTCOMM | ||
328 | select PPC_BESTCOMM_GEN_BD | ||
329 | diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c | ||
330 | index 74a5a5773b1f..930e1fe78214 100644 | ||
331 | --- a/arch/powerpc/platforms/powernv/pci-ioda.c | ||
332 | +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | ||
333 | @@ -153,13 +153,23 @@ static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe) | ||
334 | rid_end = pe->rid + 1; | ||
335 | } | ||
336 | |||
337 | - /* Associate PE in PELT */ | ||
338 | + /* | ||
339 | + * Associate PE in PELT. We need add the PE into the | ||
340 | + * corresponding PELT-V as well. Otherwise, the error | ||
341 | + * originated from the PE might contribute to other | ||
342 | + * PEs. | ||
343 | + */ | ||
344 | rc = opal_pci_set_pe(phb->opal_id, pe->pe_number, pe->rid, | ||
345 | bcomp, dcomp, fcomp, OPAL_MAP_PE); | ||
346 | if (rc) { | ||
347 | pe_err(pe, "OPAL error %ld trying to setup PELT table\n", rc); | ||
348 | return -ENXIO; | ||
349 | } | ||
350 | + | ||
351 | + rc = opal_pci_set_peltv(phb->opal_id, pe->pe_number, | ||
352 | + pe->pe_number, OPAL_ADD_PE_TO_DOMAIN); | ||
353 | + if (rc) | ||
354 | + pe_warn(pe, "OPAL error %d adding self to PELTV\n", rc); | ||
355 | opal_pci_eeh_freeze_clear(phb->opal_id, pe->pe_number, | ||
356 | OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); | ||
357 | |||
358 | diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c | ||
359 | index b4dbade8ca24..2e4b5be31a1b 100644 | ||
360 | --- a/arch/s390/crypto/aes_s390.c | ||
361 | +++ b/arch/s390/crypto/aes_s390.c | ||
362 | @@ -35,7 +35,6 @@ static u8 *ctrblk; | ||
363 | static char keylen_flag; | ||
364 | |||
365 | struct s390_aes_ctx { | ||
366 | - u8 iv[AES_BLOCK_SIZE]; | ||
367 | u8 key[AES_MAX_KEY_SIZE]; | ||
368 | long enc; | ||
369 | long dec; | ||
370 | @@ -441,30 +440,36 @@ static int cbc_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, | ||
371 | return aes_set_key(tfm, in_key, key_len); | ||
372 | } | ||
373 | |||
374 | -static int cbc_aes_crypt(struct blkcipher_desc *desc, long func, void *param, | ||
375 | +static int cbc_aes_crypt(struct blkcipher_desc *desc, long func, | ||
376 | struct blkcipher_walk *walk) | ||
377 | { | ||
378 | + struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); | ||
379 | int ret = blkcipher_walk_virt(desc, walk); | ||
380 | unsigned int nbytes = walk->nbytes; | ||
381 | + struct { | ||
382 | + u8 iv[AES_BLOCK_SIZE]; | ||
383 | + u8 key[AES_MAX_KEY_SIZE]; | ||
384 | + } param; | ||
385 | |||
386 | if (!nbytes) | ||
387 | goto out; | ||
388 | |||
389 | - memcpy(param, walk->iv, AES_BLOCK_SIZE); | ||
390 | + memcpy(param.iv, walk->iv, AES_BLOCK_SIZE); | ||
391 | + memcpy(param.key, sctx->key, sctx->key_len); | ||
392 | do { | ||
393 | /* only use complete blocks */ | ||
394 | unsigned int n = nbytes & ~(AES_BLOCK_SIZE - 1); | ||
395 | u8 *out = walk->dst.virt.addr; | ||
396 | u8 *in = walk->src.virt.addr; | ||
397 | |||
398 | - ret = crypt_s390_kmc(func, param, out, in, n); | ||
399 | + ret = crypt_s390_kmc(func, ¶m, out, in, n); | ||
400 | if (ret < 0 || ret != n) | ||
401 | return -EIO; | ||
402 | |||
403 | nbytes &= AES_BLOCK_SIZE - 1; | ||
404 | ret = blkcipher_walk_done(desc, walk, nbytes); | ||
405 | } while ((nbytes = walk->nbytes)); | ||
406 | - memcpy(walk->iv, param, AES_BLOCK_SIZE); | ||
407 | + memcpy(walk->iv, param.iv, AES_BLOCK_SIZE); | ||
408 | |||
409 | out: | ||
410 | return ret; | ||
411 | @@ -481,7 +486,7 @@ static int cbc_aes_encrypt(struct blkcipher_desc *desc, | ||
412 | return fallback_blk_enc(desc, dst, src, nbytes); | ||
413 | |||
414 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
415 | - return cbc_aes_crypt(desc, sctx->enc, sctx->iv, &walk); | ||
416 | + return cbc_aes_crypt(desc, sctx->enc, &walk); | ||
417 | } | ||
418 | |||
419 | static int cbc_aes_decrypt(struct blkcipher_desc *desc, | ||
420 | @@ -495,7 +500,7 @@ static int cbc_aes_decrypt(struct blkcipher_desc *desc, | ||
421 | return fallback_blk_dec(desc, dst, src, nbytes); | ||
422 | |||
423 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
424 | - return cbc_aes_crypt(desc, sctx->dec, sctx->iv, &walk); | ||
425 | + return cbc_aes_crypt(desc, sctx->dec, &walk); | ||
426 | } | ||
427 | |||
428 | static struct crypto_alg cbc_aes_alg = { | ||
429 | diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h | ||
430 | index 819b94d22720..8beee1cceba4 100644 | ||
431 | --- a/arch/s390/include/asm/timex.h | ||
432 | +++ b/arch/s390/include/asm/timex.h | ||
433 | @@ -71,9 +71,11 @@ static inline void local_tick_enable(unsigned long long comp) | ||
434 | |||
435 | typedef unsigned long long cycles_t; | ||
436 | |||
437 | -static inline void get_tod_clock_ext(char *clk) | ||
438 | +static inline void get_tod_clock_ext(char clk[16]) | ||
439 | { | ||
440 | - asm volatile("stcke %0" : "=Q" (*clk) : : "cc"); | ||
441 | + typedef struct { char _[sizeof(clk)]; } addrtype; | ||
442 | + | ||
443 | + asm volatile("stcke %0" : "=Q" (*(addrtype *) clk) : : "cc"); | ||
444 | } | ||
445 | |||
446 | static inline unsigned long long get_tod_clock(void) | ||
447 | diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c | ||
448 | index 1a4313a1b60f..93439cd04406 100644 | ||
449 | --- a/arch/s390/kernel/smp.c | ||
450 | +++ b/arch/s390/kernel/smp.c | ||
451 | @@ -929,7 +929,7 @@ static ssize_t show_idle_count(struct device *dev, | ||
452 | idle_count = ACCESS_ONCE(idle->idle_count); | ||
453 | if (ACCESS_ONCE(idle->clock_idle_enter)) | ||
454 | idle_count++; | ||
455 | - } while ((sequence & 1) || (idle->sequence != sequence)); | ||
456 | + } while ((sequence & 1) || (ACCESS_ONCE(idle->sequence) != sequence)); | ||
457 | return sprintf(buf, "%llu\n", idle_count); | ||
458 | } | ||
459 | static DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL); | ||
460 | @@ -947,7 +947,7 @@ static ssize_t show_idle_time(struct device *dev, | ||
461 | idle_time = ACCESS_ONCE(idle->idle_time); | ||
462 | idle_enter = ACCESS_ONCE(idle->clock_idle_enter); | ||
463 | idle_exit = ACCESS_ONCE(idle->clock_idle_exit); | ||
464 | - } while ((sequence & 1) || (idle->sequence != sequence)); | ||
465 | + } while ((sequence & 1) || (ACCESS_ONCE(idle->sequence) != sequence)); | ||
466 | idle_time += idle_enter ? ((idle_exit ? : now) - idle_enter) : 0; | ||
467 | return sprintf(buf, "%llu\n", idle_time >> 12); | ||
468 | } | ||
469 | diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c | ||
470 | index abcfab55f99b..bb06a76040bf 100644 | ||
471 | --- a/arch/s390/kernel/vtime.c | ||
472 | +++ b/arch/s390/kernel/vtime.c | ||
473 | @@ -191,7 +191,7 @@ cputime64_t s390_get_idle_time(int cpu) | ||
474 | sequence = ACCESS_ONCE(idle->sequence); | ||
475 | idle_enter = ACCESS_ONCE(idle->clock_idle_enter); | ||
476 | idle_exit = ACCESS_ONCE(idle->clock_idle_exit); | ||
477 | - } while ((sequence & 1) || (idle->sequence != sequence)); | ||
478 | + } while ((sequence & 1) || (ACCESS_ONCE(idle->sequence) != sequence)); | ||
479 | return idle_enter ? ((idle_exit ?: now) - idle_enter) : 0; | ||
480 | } | ||
481 | |||
482 | diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c | ||
483 | index e0e0841eef45..18677a90d6a3 100644 | ||
484 | --- a/arch/x86/kernel/crash.c | ||
485 | +++ b/arch/x86/kernel/crash.c | ||
486 | @@ -127,12 +127,12 @@ void native_machine_crash_shutdown(struct pt_regs *regs) | ||
487 | cpu_emergency_vmxoff(); | ||
488 | cpu_emergency_svm_disable(); | ||
489 | |||
490 | - lapic_shutdown(); | ||
491 | #ifdef CONFIG_X86_IO_APIC | ||
492 | /* Prevent crash_kexec() from deadlocking on ioapic_lock. */ | ||
493 | ioapic_zap_locks(); | ||
494 | disable_IO_APIC(); | ||
495 | #endif | ||
496 | + lapic_shutdown(); | ||
497 | #ifdef CONFIG_HPET_TIMER | ||
498 | hpet_disable(); | ||
499 | #endif | ||
500 | diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c | ||
501 | index 42a392a9fd02..d4bdd253fea7 100644 | ||
502 | --- a/arch/x86/kernel/ftrace.c | ||
503 | +++ b/arch/x86/kernel/ftrace.c | ||
504 | @@ -248,6 +248,15 @@ int ftrace_update_ftrace_func(ftrace_func_t func) | ||
505 | return ret; | ||
506 | } | ||
507 | |||
508 | +static int is_ftrace_caller(unsigned long ip) | ||
509 | +{ | ||
510 | + if (ip == (unsigned long)(&ftrace_call) || | ||
511 | + ip == (unsigned long)(&ftrace_regs_call)) | ||
512 | + return 1; | ||
513 | + | ||
514 | + return 0; | ||
515 | +} | ||
516 | + | ||
517 | /* | ||
518 | * A breakpoint was added to the code address we are about to | ||
519 | * modify, and this is the handle that will just skip over it. | ||
520 | @@ -257,10 +266,13 @@ int ftrace_update_ftrace_func(ftrace_func_t func) | ||
521 | */ | ||
522 | int ftrace_int3_handler(struct pt_regs *regs) | ||
523 | { | ||
524 | + unsigned long ip; | ||
525 | + | ||
526 | if (WARN_ON_ONCE(!regs)) | ||
527 | return 0; | ||
528 | |||
529 | - if (!ftrace_location(regs->ip - 1)) | ||
530 | + ip = regs->ip - 1; | ||
531 | + if (!ftrace_location(ip) && !is_ftrace_caller(ip)) | ||
532 | return 0; | ||
533 | |||
534 | regs->ip += MCOUNT_INSN_SIZE - 1; | ||
535 | diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c | ||
536 | index af99f71aeb7f..c3d4cc972eca 100644 | ||
537 | --- a/arch/x86/kernel/microcode_amd.c | ||
538 | +++ b/arch/x86/kernel/microcode_amd.c | ||
539 | @@ -431,7 +431,7 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device, | ||
540 | snprintf(fw_name, sizeof(fw_name), "amd-ucode/microcode_amd_fam%.2xh.bin", c->x86); | ||
541 | |||
542 | if (request_firmware(&fw, (const char *)fw_name, device)) { | ||
543 | - pr_err("failed to load file %s\n", fw_name); | ||
544 | + pr_debug("failed to load file %s\n", fw_name); | ||
545 | goto out; | ||
546 | } | ||
547 | |||
548 | diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c | ||
549 | index c83516be1052..3fb8d95ab8b5 100644 | ||
550 | --- a/arch/x86/kernel/process.c | ||
551 | +++ b/arch/x86/kernel/process.c | ||
552 | @@ -391,9 +391,9 @@ static void amd_e400_idle(void) | ||
553 | * The switch back from broadcast mode needs to be | ||
554 | * called with interrupts disabled. | ||
555 | */ | ||
556 | - local_irq_disable(); | ||
557 | - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); | ||
558 | - local_irq_enable(); | ||
559 | + local_irq_disable(); | ||
560 | + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); | ||
561 | + local_irq_enable(); | ||
562 | } else | ||
563 | default_idle(); | ||
564 | } | ||
565 | diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c | ||
566 | index 7e920bff99a3..618ce264b237 100644 | ||
567 | --- a/arch/x86/kernel/reboot.c | ||
568 | +++ b/arch/x86/kernel/reboot.c | ||
569 | @@ -550,6 +550,10 @@ static void native_machine_emergency_restart(void) | ||
570 | void native_machine_shutdown(void) | ||
571 | { | ||
572 | /* Stop the cpus and apics */ | ||
573 | +#ifdef CONFIG_X86_IO_APIC | ||
574 | + disable_IO_APIC(); | ||
575 | +#endif | ||
576 | + | ||
577 | #ifdef CONFIG_SMP | ||
578 | /* | ||
579 | * Stop all of the others. Also disable the local irq to | ||
580 | @@ -562,10 +566,6 @@ void native_machine_shutdown(void) | ||
581 | |||
582 | lapic_shutdown(); | ||
583 | |||
584 | -#ifdef CONFIG_X86_IO_APIC | ||
585 | - disable_IO_APIC(); | ||
586 | -#endif | ||
587 | - | ||
588 | #ifdef CONFIG_HPET_TIMER | ||
589 | hpet_disable(); | ||
590 | #endif | ||
591 | diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c | ||
592 | index ddc3f3d2afdb..92e6f4a8ba0e 100644 | ||
593 | --- a/arch/x86/kvm/emulate.c | ||
594 | +++ b/arch/x86/kvm/emulate.c | ||
595 | @@ -4040,7 +4040,10 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, | ||
596 | case OpMem8: | ||
597 | ctxt->memop.bytes = 1; | ||
598 | if (ctxt->memop.type == OP_REG) { | ||
599 | - ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm, 1); | ||
600 | + int highbyte_regs = ctxt->rex_prefix == 0; | ||
601 | + | ||
602 | + ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm, | ||
603 | + highbyte_regs); | ||
604 | fetch_register_operand(&ctxt->memop); | ||
605 | } | ||
606 | goto mem_common; | ||
607 | diff --git a/block/blk-core.c b/block/blk-core.c | ||
608 | index 0a00e4ecf87c..5e00b5a58f6a 100644 | ||
609 | --- a/block/blk-core.c | ||
610 | +++ b/block/blk-core.c | ||
611 | @@ -2227,6 +2227,7 @@ void blk_start_request(struct request *req) | ||
612 | if (unlikely(blk_bidi_rq(req))) | ||
613 | req->next_rq->resid_len = blk_rq_bytes(req->next_rq); | ||
614 | |||
615 | + BUG_ON(test_bit(REQ_ATOM_COMPLETE, &req->atomic_flags)); | ||
616 | blk_add_timer(req); | ||
617 | } | ||
618 | EXPORT_SYMBOL(blk_start_request); | ||
619 | diff --git a/block/blk-settings.c b/block/blk-settings.c | ||
620 | index c50ecf0ea3b1..53309333c2f0 100644 | ||
621 | --- a/block/blk-settings.c | ||
622 | +++ b/block/blk-settings.c | ||
623 | @@ -144,6 +144,7 @@ void blk_set_stacking_limits(struct queue_limits *lim) | ||
624 | lim->discard_zeroes_data = 1; | ||
625 | lim->max_segments = USHRT_MAX; | ||
626 | lim->max_hw_sectors = UINT_MAX; | ||
627 | + lim->max_segment_size = UINT_MAX; | ||
628 | lim->max_sectors = UINT_MAX; | ||
629 | lim->max_write_same_sectors = UINT_MAX; | ||
630 | } | ||
631 | diff --git a/block/blk-timeout.c b/block/blk-timeout.c | ||
632 | index 65f103563969..655ba909cd6a 100644 | ||
633 | --- a/block/blk-timeout.c | ||
634 | +++ b/block/blk-timeout.c | ||
635 | @@ -91,8 +91,8 @@ static void blk_rq_timed_out(struct request *req) | ||
636 | __blk_complete_request(req); | ||
637 | break; | ||
638 | case BLK_EH_RESET_TIMER: | ||
639 | - blk_clear_rq_complete(req); | ||
640 | blk_add_timer(req); | ||
641 | + blk_clear_rq_complete(req); | ||
642 | break; | ||
643 | case BLK_EH_NOT_HANDLED: | ||
644 | /* | ||
645 | @@ -174,7 +174,6 @@ void blk_add_timer(struct request *req) | ||
646 | return; | ||
647 | |||
648 | BUG_ON(!list_empty(&req->timeout_list)); | ||
649 | - BUG_ON(test_bit(REQ_ATOM_COMPLETE, &req->atomic_flags)); | ||
650 | |||
651 | /* | ||
652 | * Some LLDs, like scsi, peek at the timeout to prevent a | ||
653 | diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c | ||
654 | index c0bb3778f1ae..666f1962a160 100644 | ||
655 | --- a/crypto/ansi_cprng.c | ||
656 | +++ b/crypto/ansi_cprng.c | ||
657 | @@ -230,11 +230,11 @@ remainder: | ||
658 | */ | ||
659 | if (byte_count < DEFAULT_BLK_SZ) { | ||
660 | empty_rbuf: | ||
661 | - for (; ctx->rand_data_valid < DEFAULT_BLK_SZ; | ||
662 | - ctx->rand_data_valid++) { | ||
663 | + while (ctx->rand_data_valid < DEFAULT_BLK_SZ) { | ||
664 | *ptr = ctx->rand_data[ctx->rand_data_valid]; | ||
665 | ptr++; | ||
666 | byte_count--; | ||
667 | + ctx->rand_data_valid++; | ||
668 | if (byte_count == 0) | ||
669 | goto done; | ||
670 | } | ||
671 | diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c | ||
672 | index a06d98374705..15986f32009e 100644 | ||
673 | --- a/drivers/acpi/ec.c | ||
674 | +++ b/drivers/acpi/ec.c | ||
675 | @@ -175,9 +175,10 @@ static void start_transaction(struct acpi_ec *ec) | ||
676 | static void advance_transaction(struct acpi_ec *ec, u8 status) | ||
677 | { | ||
678 | unsigned long flags; | ||
679 | - struct transaction *t = ec->curr; | ||
680 | + struct transaction *t; | ||
681 | |||
682 | spin_lock_irqsave(&ec->lock, flags); | ||
683 | + t = ec->curr; | ||
684 | if (!t) | ||
685 | goto unlock; | ||
686 | if (t->wlen > t->wi) { | ||
687 | diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c | ||
688 | index d3874f425653..d7e53ea53d6c 100644 | ||
689 | --- a/drivers/acpi/pci_root.c | ||
690 | +++ b/drivers/acpi/pci_root.c | ||
691 | @@ -608,9 +608,12 @@ static void handle_root_bridge_removal(struct acpi_device *device) | ||
692 | ej_event->device = device; | ||
693 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; | ||
694 | |||
695 | + get_device(&device->dev); | ||
696 | status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, ej_event); | ||
697 | - if (ACPI_FAILURE(status)) | ||
698 | + if (ACPI_FAILURE(status)) { | ||
699 | + put_device(&device->dev); | ||
700 | kfree(ej_event); | ||
701 | + } | ||
702 | } | ||
703 | |||
704 | static void _handle_hotplug_event_root(struct work_struct *work) | ||
705 | diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c | ||
706 | index f98dd00b51a9..c7414a545a4f 100644 | ||
707 | --- a/drivers/acpi/processor_idle.c | ||
708 | +++ b/drivers/acpi/processor_idle.c | ||
709 | @@ -119,17 +119,10 @@ static struct dmi_system_id processor_power_dmi_table[] = { | ||
710 | */ | ||
711 | static void acpi_safe_halt(void) | ||
712 | { | ||
713 | - current_thread_info()->status &= ~TS_POLLING; | ||
714 | - /* | ||
715 | - * TS_POLLING-cleared state must be visible before we | ||
716 | - * test NEED_RESCHED: | ||
717 | - */ | ||
718 | - smp_mb(); | ||
719 | - if (!need_resched()) { | ||
720 | + if (!tif_need_resched()) { | ||
721 | safe_halt(); | ||
722 | local_irq_disable(); | ||
723 | } | ||
724 | - current_thread_info()->status |= TS_POLLING; | ||
725 | } | ||
726 | |||
727 | #ifdef ARCH_APICTIMER_STOPS_ON_C3 | ||
728 | @@ -737,6 +730,11 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | ||
729 | if (unlikely(!pr)) | ||
730 | return -EINVAL; | ||
731 | |||
732 | + if (cx->entry_method == ACPI_CSTATE_FFH) { | ||
733 | + if (current_set_polling_and_test()) | ||
734 | + return -EINVAL; | ||
735 | + } | ||
736 | + | ||
737 | lapic_timer_state_broadcast(pr, cx, 1); | ||
738 | acpi_idle_do_entry(cx); | ||
739 | |||
740 | @@ -790,18 +788,9 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | ||
741 | if (unlikely(!pr)) | ||
742 | return -EINVAL; | ||
743 | |||
744 | - if (cx->entry_method != ACPI_CSTATE_FFH) { | ||
745 | - current_thread_info()->status &= ~TS_POLLING; | ||
746 | - /* | ||
747 | - * TS_POLLING-cleared state must be visible before we test | ||
748 | - * NEED_RESCHED: | ||
749 | - */ | ||
750 | - smp_mb(); | ||
751 | - | ||
752 | - if (unlikely(need_resched())) { | ||
753 | - current_thread_info()->status |= TS_POLLING; | ||
754 | + if (cx->entry_method == ACPI_CSTATE_FFH) { | ||
755 | + if (current_set_polling_and_test()) | ||
756 | return -EINVAL; | ||
757 | - } | ||
758 | } | ||
759 | |||
760 | /* | ||
761 | @@ -819,9 +808,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | ||
762 | |||
763 | sched_clock_idle_wakeup_event(0); | ||
764 | |||
765 | - if (cx->entry_method != ACPI_CSTATE_FFH) | ||
766 | - current_thread_info()->status |= TS_POLLING; | ||
767 | - | ||
768 | lapic_timer_state_broadcast(pr, cx, 0); | ||
769 | return index; | ||
770 | } | ||
771 | @@ -858,18 +844,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | ||
772 | } | ||
773 | } | ||
774 | |||
775 | - if (cx->entry_method != ACPI_CSTATE_FFH) { | ||
776 | - current_thread_info()->status &= ~TS_POLLING; | ||
777 | - /* | ||
778 | - * TS_POLLING-cleared state must be visible before we test | ||
779 | - * NEED_RESCHED: | ||
780 | - */ | ||
781 | - smp_mb(); | ||
782 | - | ||
783 | - if (unlikely(need_resched())) { | ||
784 | - current_thread_info()->status |= TS_POLLING; | ||
785 | + if (cx->entry_method == ACPI_CSTATE_FFH) { | ||
786 | + if (current_set_polling_and_test()) | ||
787 | return -EINVAL; | ||
788 | - } | ||
789 | } | ||
790 | |||
791 | acpi_unlazy_tlb(smp_processor_id()); | ||
792 | @@ -915,9 +892,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | ||
793 | |||
794 | sched_clock_idle_wakeup_event(0); | ||
795 | |||
796 | - if (cx->entry_method != ACPI_CSTATE_FFH) | ||
797 | - current_thread_info()->status |= TS_POLLING; | ||
798 | - | ||
799 | lapic_timer_state_broadcast(pr, cx, 0); | ||
800 | return index; | ||
801 | } | ||
802 | diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c | ||
803 | index fee8a297c7d9..3601738ef6f4 100644 | ||
804 | --- a/drivers/acpi/scan.c | ||
805 | +++ b/drivers/acpi/scan.c | ||
806 | @@ -331,8 +331,6 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source) | ||
807 | goto out; | ||
808 | } | ||
809 | } | ||
810 | - acpi_evaluate_hotplug_ost(handle, ost_source, | ||
811 | - ACPI_OST_SC_INSERT_IN_PROGRESS, NULL); | ||
812 | error = acpi_bus_scan(handle); | ||
813 | if (error) { | ||
814 | acpi_handle_warn(handle, "Namespace scan failure\n"); | ||
815 | diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c | ||
816 | index aebcf6355df4..f193285968f8 100644 | ||
817 | --- a/drivers/acpi/video.c | ||
818 | +++ b/drivers/acpi/video.c | ||
819 | @@ -832,7 +832,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | ||
820 | for (i = 2; i < br->count; i++) | ||
821 | if (level_old == br->levels[i]) | ||
822 | break; | ||
823 | - if (i == br->count) | ||
824 | + if (i == br->count || !level) | ||
825 | level = max_level; | ||
826 | } | ||
827 | |||
828 | diff --git a/drivers/block/brd.c b/drivers/block/brd.c | ||
829 | index 9bf4371755f2..d91f1a56e861 100644 | ||
830 | --- a/drivers/block/brd.c | ||
831 | +++ b/drivers/block/brd.c | ||
832 | @@ -545,7 +545,7 @@ static struct kobject *brd_probe(dev_t dev, int *part, void *data) | ||
833 | |||
834 | mutex_lock(&brd_devices_mutex); | ||
835 | brd = brd_init_one(MINOR(dev) >> part_shift); | ||
836 | - kobj = brd ? get_disk(brd->brd_disk) : ERR_PTR(-ENOMEM); | ||
837 | + kobj = brd ? get_disk(brd->brd_disk) : NULL; | ||
838 | mutex_unlock(&brd_devices_mutex); | ||
839 | |||
840 | *part = 0; | ||
841 | diff --git a/drivers/block/loop.c b/drivers/block/loop.c | ||
842 | index 40e715531aa6..2f036ca4b6ee 100644 | ||
843 | --- a/drivers/block/loop.c | ||
844 | +++ b/drivers/block/loop.c | ||
845 | @@ -1741,7 +1741,7 @@ static struct kobject *loop_probe(dev_t dev, int *part, void *data) | ||
846 | if (err < 0) | ||
847 | err = loop_add(&lo, MINOR(dev) >> part_shift); | ||
848 | if (err < 0) | ||
849 | - kobj = ERR_PTR(err); | ||
850 | + kobj = NULL; | ||
851 | else | ||
852 | kobj = get_disk(lo->lo_disk); | ||
853 | mutex_unlock(&loop_index_mutex); | ||
854 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c | ||
855 | index f3dfc0a88fdc..d593c99121c3 100644 | ||
856 | --- a/drivers/bluetooth/btusb.c | ||
857 | +++ b/drivers/bluetooth/btusb.c | ||
858 | @@ -1628,7 +1628,6 @@ static struct usb_driver btusb_driver = { | ||
859 | #ifdef CONFIG_PM | ||
860 | .suspend = btusb_suspend, | ||
861 | .resume = btusb_resume, | ||
862 | - .reset_resume = btusb_resume, | ||
863 | #endif | ||
864 | .id_table = btusb_table, | ||
865 | .supports_autosuspend = 1, | ||
866 | diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c | ||
867 | index e5be3ee7f172..71b4283f7fad 100644 | ||
868 | --- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c | ||
869 | +++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c | ||
870 | @@ -587,6 +587,7 @@ nvc1_grctx_init_unk58xx[] = { | ||
871 | { 0x405870, 4, 0x04, 0x00000001 }, | ||
872 | { 0x405a00, 2, 0x04, 0x00000000 }, | ||
873 | { 0x405a18, 1, 0x04, 0x00000000 }, | ||
874 | + {} | ||
875 | }; | ||
876 | |||
877 | static struct nvc0_graph_init | ||
878 | @@ -598,6 +599,7 @@ nvc1_grctx_init_rop[] = { | ||
879 | { 0x408904, 1, 0x04, 0x62000001 }, | ||
880 | { 0x408908, 1, 0x04, 0x00c80929 }, | ||
881 | { 0x408980, 1, 0x04, 0x0000011d }, | ||
882 | + {} | ||
883 | }; | ||
884 | |||
885 | static struct nvc0_graph_init | ||
886 | @@ -671,6 +673,7 @@ nvc1_grctx_init_gpc_0[] = { | ||
887 | { 0x419000, 1, 0x04, 0x00000780 }, | ||
888 | { 0x419004, 2, 0x04, 0x00000000 }, | ||
889 | { 0x419014, 1, 0x04, 0x00000004 }, | ||
890 | + {} | ||
891 | }; | ||
892 | |||
893 | static struct nvc0_graph_init | ||
894 | @@ -717,6 +720,7 @@ nvc1_grctx_init_tpc[] = { | ||
895 | { 0x419e98, 1, 0x04, 0x00000000 }, | ||
896 | { 0x419ee0, 1, 0x04, 0x00011110 }, | ||
897 | { 0x419f30, 11, 0x04, 0x00000000 }, | ||
898 | + {} | ||
899 | }; | ||
900 | |||
901 | void | ||
902 | diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c | ||
903 | index 438e78410808..c4740d528532 100644 | ||
904 | --- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c | ||
905 | +++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c | ||
906 | @@ -258,6 +258,7 @@ nvd7_grctx_init_hub[] = { | ||
907 | nvc0_grctx_init_unk78xx, | ||
908 | nvc0_grctx_init_unk80xx, | ||
909 | nvd9_grctx_init_rop, | ||
910 | + NULL | ||
911 | }; | ||
912 | |||
913 | struct nvc0_graph_init * | ||
914 | diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c | ||
915 | index 818a4751df46..a1102cbf2fdc 100644 | ||
916 | --- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c | ||
917 | +++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c | ||
918 | @@ -466,6 +466,7 @@ nvd9_grctx_init_hub[] = { | ||
919 | nvc0_grctx_init_unk78xx, | ||
920 | nvc0_grctx_init_unk80xx, | ||
921 | nvd9_grctx_init_rop, | ||
922 | + NULL | ||
923 | }; | ||
924 | |||
925 | struct nvc0_graph_init * | ||
926 | diff --git a/drivers/gpu/drm/shmobile/Kconfig b/drivers/gpu/drm/shmobile/Kconfig | ||
927 | index ca498d151a76..5240690b96c3 100644 | ||
928 | --- a/drivers/gpu/drm/shmobile/Kconfig | ||
929 | +++ b/drivers/gpu/drm/shmobile/Kconfig | ||
930 | @@ -1,6 +1,7 @@ | ||
931 | config DRM_SHMOBILE | ||
932 | tristate "DRM Support for SH Mobile" | ||
933 | depends on DRM && (ARM || SUPERH) | ||
934 | + select BACKLIGHT_CLASS_DEVICE | ||
935 | select DRM_KMS_HELPER | ||
936 | select DRM_KMS_CMA_HELPER | ||
937 | select DRM_GEM_CMA_HELPER | ||
938 | diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c | ||
939 | index bbff5f200bef..fa920469bf10 100644 | ||
940 | --- a/drivers/hv/channel_mgmt.c | ||
941 | +++ b/drivers/hv/channel_mgmt.c | ||
942 | @@ -203,7 +203,8 @@ static void vmbus_process_rescind_offer(struct work_struct *work) | ||
943 | struct vmbus_channel *primary_channel; | ||
944 | struct vmbus_channel_relid_released msg; | ||
945 | |||
946 | - vmbus_device_unregister(channel->device_obj); | ||
947 | + if (channel->device_obj) | ||
948 | + vmbus_device_unregister(channel->device_obj); | ||
949 | memset(&msg, 0, sizeof(struct vmbus_channel_relid_released)); | ||
950 | msg.child_relid = channel->offermsg.child_relid; | ||
951 | msg.header.msgtype = CHANNELMSG_RELID_RELEASED; | ||
952 | @@ -216,7 +217,7 @@ static void vmbus_process_rescind_offer(struct work_struct *work) | ||
953 | } else { | ||
954 | primary_channel = channel->primary_channel; | ||
955 | spin_lock_irqsave(&primary_channel->sc_lock, flags); | ||
956 | - list_del(&channel->listentry); | ||
957 | + list_del(&channel->sc_list); | ||
958 | spin_unlock_irqrestore(&primary_channel->sc_lock, flags); | ||
959 | } | ||
960 | free_channel(channel); | ||
961 | diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c | ||
962 | index cdff74282955..14e36c114d61 100644 | ||
963 | --- a/drivers/hwmon/lm90.c | ||
964 | +++ b/drivers/hwmon/lm90.c | ||
965 | @@ -278,7 +278,7 @@ static const struct lm90_params lm90_params[] = { | ||
966 | [max6696] = { | ||
967 | .flags = LM90_HAVE_EMERGENCY | ||
968 | | LM90_HAVE_EMERGENCY_ALARM | LM90_HAVE_TEMP3, | ||
969 | - .alert_alarms = 0x187c, | ||
970 | + .alert_alarms = 0x1c7c, | ||
971 | .max_convrate = 6, | ||
972 | .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, | ||
973 | }, | ||
974 | @@ -1500,19 +1500,22 @@ static void lm90_alert(struct i2c_client *client, unsigned int flag) | ||
975 | if ((alarms & 0x7f) == 0 && (alarms2 & 0xfe) == 0) { | ||
976 | dev_info(&client->dev, "Everything OK\n"); | ||
977 | } else { | ||
978 | - if (alarms & 0x61) | ||
979 | + if ((alarms & 0x61) || (alarms2 & 0x80)) | ||
980 | dev_warn(&client->dev, | ||
981 | "temp%d out of range, please check!\n", 1); | ||
982 | - if (alarms & 0x1a) | ||
983 | + if ((alarms & 0x1a) || (alarms2 & 0x20)) | ||
984 | dev_warn(&client->dev, | ||
985 | "temp%d out of range, please check!\n", 2); | ||
986 | if (alarms & 0x04) | ||
987 | dev_warn(&client->dev, | ||
988 | "temp%d diode open, please check!\n", 2); | ||
989 | |||
990 | - if (alarms2 & 0x18) | ||
991 | + if (alarms2 & 0x5a) | ||
992 | dev_warn(&client->dev, | ||
993 | "temp%d out of range, please check!\n", 3); | ||
994 | + if (alarms2 & 0x04) | ||
995 | + dev_warn(&client->dev, | ||
996 | + "temp%d diode open, please check!\n", 3); | ||
997 | |||
998 | /* | ||
999 | * Disable ALERT# output, because these chips don't implement | ||
1000 | diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c | ||
1001 | index fa6964d8681a..f116d664b473 100644 | ||
1002 | --- a/drivers/idle/intel_idle.c | ||
1003 | +++ b/drivers/idle/intel_idle.c | ||
1004 | @@ -359,7 +359,7 @@ static int intel_idle(struct cpuidle_device *dev, | ||
1005 | if (!(lapic_timer_reliable_states & (1 << (cstate)))) | ||
1006 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); | ||
1007 | |||
1008 | - if (!need_resched()) { | ||
1009 | + if (!current_set_polling_and_test()) { | ||
1010 | |||
1011 | __monitor((void *)¤t_thread_info()->flags, 0, 0); | ||
1012 | smp_mb(); | ||
1013 | diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c | ||
1014 | index 08e70232062f..9188ef5d677e 100644 | ||
1015 | --- a/drivers/memstick/core/ms_block.c | ||
1016 | +++ b/drivers/memstick/core/ms_block.c | ||
1017 | @@ -401,7 +401,7 @@ again: | ||
1018 | sizeof(struct ms_status_register))) | ||
1019 | return 0; | ||
1020 | |||
1021 | - msb->state = MSB_RP_RECEIVE_OOB_READ; | ||
1022 | + msb->state = MSB_RP_RECIVE_STATUS_REG; | ||
1023 | return 0; | ||
1024 | |||
1025 | case MSB_RP_RECIVE_STATUS_REG: | ||
1026 | diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c | ||
1027 | index 2fc0586ce3bb..9cbd0370ca44 100644 | ||
1028 | --- a/drivers/misc/lkdtm.c | ||
1029 | +++ b/drivers/misc/lkdtm.c | ||
1030 | @@ -297,6 +297,14 @@ static void do_nothing(void) | ||
1031 | return; | ||
1032 | } | ||
1033 | |||
1034 | +static noinline void corrupt_stack(void) | ||
1035 | +{ | ||
1036 | + /* Use default char array length that triggers stack protection. */ | ||
1037 | + char data[8]; | ||
1038 | + | ||
1039 | + memset((void *)data, 0, 64); | ||
1040 | +} | ||
1041 | + | ||
1042 | static void execute_location(void *dst) | ||
1043 | { | ||
1044 | void (*func)(void) = dst; | ||
1045 | @@ -327,13 +335,9 @@ static void lkdtm_do_action(enum ctype which) | ||
1046 | case CT_OVERFLOW: | ||
1047 | (void) recursive_loop(0); | ||
1048 | break; | ||
1049 | - case CT_CORRUPT_STACK: { | ||
1050 | - /* Make sure the compiler creates and uses an 8 char array. */ | ||
1051 | - volatile char data[8]; | ||
1052 | - | ||
1053 | - memset((void *)data, 0, 64); | ||
1054 | + case CT_CORRUPT_STACK: | ||
1055 | + corrupt_stack(); | ||
1056 | break; | ||
1057 | - } | ||
1058 | case CT_UNALIGNED_LOAD_STORE_WRITE: { | ||
1059 | static u8 data[5] __attribute__((aligned(4))) = {1, 2, | ||
1060 | 3, 4, 5}; | ||
1061 | diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c | ||
1062 | index d0c6907dfd92..994ca4aff1a3 100644 | ||
1063 | --- a/drivers/misc/mei/nfc.c | ||
1064 | +++ b/drivers/misc/mei/nfc.c | ||
1065 | @@ -485,8 +485,11 @@ int mei_nfc_host_init(struct mei_device *dev) | ||
1066 | if (ndev->cl_info) | ||
1067 | return 0; | ||
1068 | |||
1069 | - cl_info = mei_cl_allocate(dev); | ||
1070 | - cl = mei_cl_allocate(dev); | ||
1071 | + ndev->cl_info = mei_cl_allocate(dev); | ||
1072 | + ndev->cl = mei_cl_allocate(dev); | ||
1073 | + | ||
1074 | + cl = ndev->cl; | ||
1075 | + cl_info = ndev->cl_info; | ||
1076 | |||
1077 | if (!cl || !cl_info) { | ||
1078 | ret = -ENOMEM; | ||
1079 | @@ -527,10 +530,9 @@ int mei_nfc_host_init(struct mei_device *dev) | ||
1080 | |||
1081 | cl->device_uuid = mei_nfc_guid; | ||
1082 | |||
1083 | + | ||
1084 | list_add_tail(&cl->device_link, &dev->device_list); | ||
1085 | |||
1086 | - ndev->cl_info = cl_info; | ||
1087 | - ndev->cl = cl; | ||
1088 | ndev->req_id = 1; | ||
1089 | |||
1090 | INIT_WORK(&ndev->init_work, mei_nfc_init); | ||
1091 | diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c | ||
1092 | index a668cd491cb3..e3fc07cf2f62 100644 | ||
1093 | --- a/drivers/net/can/c_can/c_can.c | ||
1094 | +++ b/drivers/net/can/c_can/c_can.c | ||
1095 | @@ -814,9 +814,6 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota) | ||
1096 | msg_ctrl_save = priv->read_reg(priv, | ||
1097 | C_CAN_IFACE(MSGCTRL_REG, 0)); | ||
1098 | |||
1099 | - if (msg_ctrl_save & IF_MCONT_EOB) | ||
1100 | - return num_rx_pkts; | ||
1101 | - | ||
1102 | if (msg_ctrl_save & IF_MCONT_MSGLST) { | ||
1103 | c_can_handle_lost_msg_obj(dev, 0, msg_obj); | ||
1104 | num_rx_pkts++; | ||
1105 | @@ -824,6 +821,9 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota) | ||
1106 | continue; | ||
1107 | } | ||
1108 | |||
1109 | + if (msg_ctrl_save & IF_MCONT_EOB) | ||
1110 | + return num_rx_pkts; | ||
1111 | + | ||
1112 | if (!(msg_ctrl_save & IF_MCONT_NEWDAT)) | ||
1113 | continue; | ||
1114 | |||
1115 | diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c | ||
1116 | index 3b9546588240..4b2d5ed62b11 100644 | ||
1117 | --- a/drivers/net/can/usb/kvaser_usb.c | ||
1118 | +++ b/drivers/net/can/usb/kvaser_usb.c | ||
1119 | @@ -1544,9 +1544,9 @@ static int kvaser_usb_init_one(struct usb_interface *intf, | ||
1120 | return 0; | ||
1121 | } | ||
1122 | |||
1123 | -static void kvaser_usb_get_endpoints(const struct usb_interface *intf, | ||
1124 | - struct usb_endpoint_descriptor **in, | ||
1125 | - struct usb_endpoint_descriptor **out) | ||
1126 | +static int kvaser_usb_get_endpoints(const struct usb_interface *intf, | ||
1127 | + struct usb_endpoint_descriptor **in, | ||
1128 | + struct usb_endpoint_descriptor **out) | ||
1129 | { | ||
1130 | const struct usb_host_interface *iface_desc; | ||
1131 | struct usb_endpoint_descriptor *endpoint; | ||
1132 | @@ -1557,12 +1557,18 @@ static void kvaser_usb_get_endpoints(const struct usb_interface *intf, | ||
1133 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { | ||
1134 | endpoint = &iface_desc->endpoint[i].desc; | ||
1135 | |||
1136 | - if (usb_endpoint_is_bulk_in(endpoint)) | ||
1137 | + if (!*in && usb_endpoint_is_bulk_in(endpoint)) | ||
1138 | *in = endpoint; | ||
1139 | |||
1140 | - if (usb_endpoint_is_bulk_out(endpoint)) | ||
1141 | + if (!*out && usb_endpoint_is_bulk_out(endpoint)) | ||
1142 | *out = endpoint; | ||
1143 | + | ||
1144 | + /* use first bulk endpoint for in and out */ | ||
1145 | + if (*in && *out) | ||
1146 | + return 0; | ||
1147 | } | ||
1148 | + | ||
1149 | + return -ENODEV; | ||
1150 | } | ||
1151 | |||
1152 | static int kvaser_usb_probe(struct usb_interface *intf, | ||
1153 | @@ -1576,8 +1582,8 @@ static int kvaser_usb_probe(struct usb_interface *intf, | ||
1154 | if (!dev) | ||
1155 | return -ENOMEM; | ||
1156 | |||
1157 | - kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out); | ||
1158 | - if (!dev->bulk_in || !dev->bulk_out) { | ||
1159 | + err = kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out); | ||
1160 | + if (err) { | ||
1161 | dev_err(&intf->dev, "Cannot get usb endpoint(s)"); | ||
1162 | return err; | ||
1163 | } | ||
1164 | diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c | ||
1165 | index fc95b235e210..6305a5d29db2 100644 | ||
1166 | --- a/drivers/net/ethernet/atheros/alx/main.c | ||
1167 | +++ b/drivers/net/ethernet/atheros/alx/main.c | ||
1168 | @@ -1389,6 +1389,9 @@ static int alx_resume(struct device *dev) | ||
1169 | { | ||
1170 | struct pci_dev *pdev = to_pci_dev(dev); | ||
1171 | struct alx_priv *alx = pci_get_drvdata(pdev); | ||
1172 | + struct alx_hw *hw = &alx->hw; | ||
1173 | + | ||
1174 | + alx_reset_phy(hw); | ||
1175 | |||
1176 | if (!netif_running(alx->dev)) | ||
1177 | return 0; | ||
1178 | diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c | ||
1179 | index 668dd27616a0..cc6a0a586f0b 100644 | ||
1180 | --- a/drivers/net/wireless/libertas/debugfs.c | ||
1181 | +++ b/drivers/net/wireless/libertas/debugfs.c | ||
1182 | @@ -913,7 +913,10 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf, | ||
1183 | char *p2; | ||
1184 | struct debug_data *d = f->private_data; | ||
1185 | |||
1186 | - pdata = kmalloc(cnt, GFP_KERNEL); | ||
1187 | + if (cnt == 0) | ||
1188 | + return 0; | ||
1189 | + | ||
1190 | + pdata = kmalloc(cnt + 1, GFP_KERNEL); | ||
1191 | if (pdata == NULL) | ||
1192 | return 0; | ||
1193 | |||
1194 | @@ -922,6 +925,7 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf, | ||
1195 | kfree(pdata); | ||
1196 | return 0; | ||
1197 | } | ||
1198 | + pdata[cnt] = '\0'; | ||
1199 | |||
1200 | p0 = pdata; | ||
1201 | for (i = 0; i < num_of_items; i++) { | ||
1202 | diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c | ||
1203 | index 88ce656f96cd..14007870302b 100644 | ||
1204 | --- a/drivers/net/wireless/rt2x00/rt2800lib.c | ||
1205 | +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | ||
1206 | @@ -4461,10 +4461,13 @@ void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, | ||
1207 | |||
1208 | vgc = rt2800_get_default_vgc(rt2x00dev); | ||
1209 | |||
1210 | - if (rt2x00_rt(rt2x00dev, RT5592) && qual->rssi > -65) | ||
1211 | - vgc += 0x20; | ||
1212 | - else if (qual->rssi > -80) | ||
1213 | - vgc += 0x10; | ||
1214 | + if (rt2x00_rt(rt2x00dev, RT5592)) { | ||
1215 | + if (qual->rssi > -65) | ||
1216 | + vgc += 0x20; | ||
1217 | + } else { | ||
1218 | + if (qual->rssi > -80) | ||
1219 | + vgc += 0x10; | ||
1220 | + } | ||
1221 | |||
1222 | rt2800_set_vgc(rt2x00dev, qual, vgc); | ||
1223 | } | ||
1224 | diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c | ||
1225 | index 96961b9a395c..4feb35aef990 100644 | ||
1226 | --- a/drivers/net/wireless/rt2x00/rt2800usb.c | ||
1227 | +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | ||
1228 | @@ -148,6 +148,8 @@ static bool rt2800usb_txstatus_timeout(struct rt2x00_dev *rt2x00dev) | ||
1229 | return false; | ||
1230 | } | ||
1231 | |||
1232 | +#define TXSTATUS_READ_INTERVAL 1000000 | ||
1233 | + | ||
1234 | static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev, | ||
1235 | int urb_status, u32 tx_status) | ||
1236 | { | ||
1237 | @@ -176,8 +178,9 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev, | ||
1238 | queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); | ||
1239 | |||
1240 | if (rt2800usb_txstatus_pending(rt2x00dev)) { | ||
1241 | - /* Read register after 250 us */ | ||
1242 | - hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000), | ||
1243 | + /* Read register after 1 ms */ | ||
1244 | + hrtimer_start(&rt2x00dev->txstatus_timer, | ||
1245 | + ktime_set(0, TXSTATUS_READ_INTERVAL), | ||
1246 | HRTIMER_MODE_REL); | ||
1247 | return false; | ||
1248 | } | ||
1249 | @@ -202,8 +205,9 @@ static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev) | ||
1250 | if (test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags)) | ||
1251 | return; | ||
1252 | |||
1253 | - /* Read TX_STA_FIFO register after 500 us */ | ||
1254 | - hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 500000), | ||
1255 | + /* Read TX_STA_FIFO register after 2 ms */ | ||
1256 | + hrtimer_start(&rt2x00dev->txstatus_timer, | ||
1257 | + ktime_set(0, 2*TXSTATUS_READ_INTERVAL), | ||
1258 | HRTIMER_MODE_REL); | ||
1259 | } | ||
1260 | |||
1261 | diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c | ||
1262 | index 712eea9d398f..f12e909cbb48 100644 | ||
1263 | --- a/drivers/net/wireless/rt2x00/rt2x00dev.c | ||
1264 | +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | ||
1265 | @@ -181,6 +181,7 @@ static void rt2x00lib_autowakeup(struct work_struct *work) | ||
1266 | static void rt2x00lib_bc_buffer_iter(void *data, u8 *mac, | ||
1267 | struct ieee80211_vif *vif) | ||
1268 | { | ||
1269 | + struct ieee80211_tx_control control = {}; | ||
1270 | struct rt2x00_dev *rt2x00dev = data; | ||
1271 | struct sk_buff *skb; | ||
1272 | |||
1273 | @@ -195,7 +196,7 @@ static void rt2x00lib_bc_buffer_iter(void *data, u8 *mac, | ||
1274 | */ | ||
1275 | skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif); | ||
1276 | while (skb) { | ||
1277 | - rt2x00mac_tx(rt2x00dev->hw, NULL, skb); | ||
1278 | + rt2x00mac_tx(rt2x00dev->hw, &control, skb); | ||
1279 | skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif); | ||
1280 | } | ||
1281 | } | ||
1282 | diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h | ||
1283 | index a0935987fa3a..7f40ab8e1bd8 100644 | ||
1284 | --- a/drivers/net/wireless/rt2x00/rt2x00lib.h | ||
1285 | +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | ||
1286 | @@ -146,7 +146,7 @@ void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length); | ||
1287 | * @local: frame is not from mac80211 | ||
1288 | */ | ||
1289 | int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, | ||
1290 | - bool local); | ||
1291 | + struct ieee80211_sta *sta, bool local); | ||
1292 | |||
1293 | /** | ||
1294 | * rt2x00queue_update_beacon - Send new beacon from mac80211 | ||
1295 | diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c | ||
1296 | index f883802f3505..f8cff1f0b6b7 100644 | ||
1297 | --- a/drivers/net/wireless/rt2x00/rt2x00mac.c | ||
1298 | +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | ||
1299 | @@ -90,7 +90,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev, | ||
1300 | frag_skb->data, data_length, tx_info, | ||
1301 | (struct ieee80211_rts *)(skb->data)); | ||
1302 | |||
1303 | - retval = rt2x00queue_write_tx_frame(queue, skb, true); | ||
1304 | + retval = rt2x00queue_write_tx_frame(queue, skb, NULL, true); | ||
1305 | if (retval) { | ||
1306 | dev_kfree_skb_any(skb); | ||
1307 | rt2x00_warn(rt2x00dev, "Failed to send RTS/CTS frame\n"); | ||
1308 | @@ -151,7 +151,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw, | ||
1309 | goto exit_fail; | ||
1310 | } | ||
1311 | |||
1312 | - if (unlikely(rt2x00queue_write_tx_frame(queue, skb, false))) | ||
1313 | + if (unlikely(rt2x00queue_write_tx_frame(queue, skb, control->sta, false))) | ||
1314 | goto exit_fail; | ||
1315 | |||
1316 | /* | ||
1317 | @@ -754,6 +754,9 @@ void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | ||
1318 | struct rt2x00_dev *rt2x00dev = hw->priv; | ||
1319 | struct data_queue *queue; | ||
1320 | |||
1321 | + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | ||
1322 | + return; | ||
1323 | + | ||
1324 | tx_queue_for_each(rt2x00dev, queue) | ||
1325 | rt2x00queue_flush_queue(queue, drop); | ||
1326 | } | ||
1327 | diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c | ||
1328 | index 6c8a33b6ee22..66a2db8c260d 100644 | ||
1329 | --- a/drivers/net/wireless/rt2x00/rt2x00queue.c | ||
1330 | +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | ||
1331 | @@ -635,7 +635,7 @@ static void rt2x00queue_bar_check(struct queue_entry *entry) | ||
1332 | } | ||
1333 | |||
1334 | int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, | ||
1335 | - bool local) | ||
1336 | + struct ieee80211_sta *sta, bool local) | ||
1337 | { | ||
1338 | struct ieee80211_tx_info *tx_info; | ||
1339 | struct queue_entry *entry; | ||
1340 | @@ -649,7 +649,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, | ||
1341 | * after that we are free to use the skb->cb array | ||
1342 | * for our information. | ||
1343 | */ | ||
1344 | - rt2x00queue_create_tx_descriptor(queue->rt2x00dev, skb, &txdesc, NULL); | ||
1345 | + rt2x00queue_create_tx_descriptor(queue->rt2x00dev, skb, &txdesc, sta); | ||
1346 | |||
1347 | /* | ||
1348 | * All information is retrieved from the skb->cb array, | ||
1349 | diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c | ||
1350 | index 03ca6c139f1a..4e86e9767ba6 100644 | ||
1351 | --- a/drivers/platform/x86/thinkpad_acpi.c | ||
1352 | +++ b/drivers/platform/x86/thinkpad_acpi.c | ||
1353 | @@ -6420,7 +6420,12 @@ static struct ibm_struct brightness_driver_data = { | ||
1354 | #define TPACPI_ALSA_SHRTNAME "ThinkPad Console Audio Control" | ||
1355 | #define TPACPI_ALSA_MIXERNAME TPACPI_ALSA_SHRTNAME | ||
1356 | |||
1357 | -static int alsa_index = ~((1 << (SNDRV_CARDS - 3)) - 1); /* last three slots */ | ||
1358 | +#if SNDRV_CARDS <= 32 | ||
1359 | +#define DEFAULT_ALSA_IDX ~((1 << (SNDRV_CARDS - 3)) - 1) | ||
1360 | +#else | ||
1361 | +#define DEFAULT_ALSA_IDX ~((1 << (32 - 3)) - 1) | ||
1362 | +#endif | ||
1363 | +static int alsa_index = DEFAULT_ALSA_IDX; /* last three slots */ | ||
1364 | static char *alsa_id = "ThinkPadEC"; | ||
1365 | static bool alsa_enable = SNDRV_DEFAULT_ENABLE1; | ||
1366 | |||
1367 | diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c | ||
1368 | index d85ac1a9d2c0..fbcd48d0bfc3 100644 | ||
1369 | --- a/drivers/scsi/aacraid/commctrl.c | ||
1370 | +++ b/drivers/scsi/aacraid/commctrl.c | ||
1371 | @@ -511,7 +511,8 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | ||
1372 | goto cleanup; | ||
1373 | } | ||
1374 | |||
1375 | - if (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr))) { | ||
1376 | + if ((fibsize < (sizeof(struct user_aac_srb) - sizeof(struct user_sgentry))) || | ||
1377 | + (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)))) { | ||
1378 | rcode = -EINVAL; | ||
1379 | goto cleanup; | ||
1380 | } | ||
1381 | diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c | ||
1382 | index 8e76ddca0999..5a5e9c915c25 100644 | ||
1383 | --- a/drivers/staging/android/ashmem.c | ||
1384 | +++ b/drivers/staging/android/ashmem.c | ||
1385 | @@ -706,7 +706,7 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
1386 | .gfp_mask = GFP_KERNEL, | ||
1387 | .nr_to_scan = LONG_MAX, | ||
1388 | }; | ||
1389 | - | ||
1390 | + ret = ashmem_shrink_count(&ashmem_shrinker, &sc); | ||
1391 | nodes_setall(sc.nodes_to_scan); | ||
1392 | ashmem_shrink_scan(&ashmem_shrinker, &sc); | ||
1393 | } | ||
1394 | diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c | ||
1395 | index 1636c7ca57e2..a3af4699eb4d 100644 | ||
1396 | --- a/drivers/staging/comedi/comedi_fops.c | ||
1397 | +++ b/drivers/staging/comedi/comedi_fops.c | ||
1398 | @@ -543,7 +543,7 @@ void *comedi_alloc_spriv(struct comedi_subdevice *s, size_t size) | ||
1399 | { | ||
1400 | s->private = kzalloc(size, GFP_KERNEL); | ||
1401 | if (s->private) | ||
1402 | - comedi_set_subdevice_runflags(s, ~0, SRF_FREE_SPRIV); | ||
1403 | + s->runflags |= SRF_FREE_SPRIV; | ||
1404 | return s->private; | ||
1405 | } | ||
1406 | EXPORT_SYMBOL_GPL(comedi_alloc_spriv); | ||
1407 | @@ -1485,7 +1485,8 @@ static int do_cmd_ioctl(struct comedi_device *dev, | ||
1408 | if (async->cmd.flags & TRIG_WAKE_EOS) | ||
1409 | async->cb_mask |= COMEDI_CB_EOS; | ||
1410 | |||
1411 | - comedi_set_subdevice_runflags(s, ~0, SRF_USER | SRF_RUNNING); | ||
1412 | + comedi_set_subdevice_runflags(s, SRF_USER | SRF_ERROR | SRF_RUNNING, | ||
1413 | + SRF_USER | SRF_RUNNING); | ||
1414 | |||
1415 | /* set s->busy _after_ setting SRF_RUNNING flag to avoid race with | ||
1416 | * comedi_read() or comedi_write() */ | ||
1417 | diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c | ||
1418 | index 63bc913eba6d..8b2b4a8d1f08 100644 | ||
1419 | --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c | ||
1420 | +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c | ||
1421 | @@ -707,6 +707,10 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) | ||
1422 | return 0; | ||
1423 | } | ||
1424 | |||
1425 | +static const struct device_type wlan_type = { | ||
1426 | + .name = "wlan", | ||
1427 | +}; | ||
1428 | + | ||
1429 | struct net_device *rtw_init_netdev(struct adapter *old_padapter) | ||
1430 | { | ||
1431 | struct adapter *padapter; | ||
1432 | @@ -722,6 +726,7 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter) | ||
1433 | if (!pnetdev) | ||
1434 | return NULL; | ||
1435 | |||
1436 | + pnetdev->dev.type = &wlan_type; | ||
1437 | padapter = rtw_netdev_priv(pnetdev); | ||
1438 | padapter->pnetdev = pnetdev; | ||
1439 | DBG_88E("register rtw_netdev_ops to netdev_ops\n"); | ||
1440 | diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c | ||
1441 | index 2c4ed52ca849..012ba15ec490 100644 | ||
1442 | --- a/drivers/staging/zram/zram_drv.c | ||
1443 | +++ b/drivers/staging/zram/zram_drv.c | ||
1444 | @@ -648,6 +648,9 @@ static ssize_t reset_store(struct device *dev, | ||
1445 | zram = dev_to_zram(dev); | ||
1446 | bdev = bdget_disk(zram->disk, 0); | ||
1447 | |||
1448 | + if (!bdev) | ||
1449 | + return -ENOMEM; | ||
1450 | + | ||
1451 | /* Do not reset an active device! */ | ||
1452 | if (bdev->bd_holders) | ||
1453 | return -EBUSY; | ||
1454 | @@ -660,8 +663,7 @@ static ssize_t reset_store(struct device *dev, | ||
1455 | return -EINVAL; | ||
1456 | |||
1457 | /* Make sure all pending I/O is finished */ | ||
1458 | - if (bdev) | ||
1459 | - fsync_bdev(bdev); | ||
1460 | + fsync_bdev(bdev); | ||
1461 | |||
1462 | zram_reset_device(zram, true); | ||
1463 | return len; | ||
1464 | diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c | ||
1465 | index f7841d44feda..689433cdef25 100644 | ||
1466 | --- a/drivers/usb/core/driver.c | ||
1467 | +++ b/drivers/usb/core/driver.c | ||
1468 | @@ -1790,6 +1790,9 @@ int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable) | ||
1469 | struct usb_hcd *hcd = bus_to_hcd(udev->bus); | ||
1470 | int ret = -EPERM; | ||
1471 | |||
1472 | + if (enable && !udev->usb2_hw_lpm_allowed) | ||
1473 | + return 0; | ||
1474 | + | ||
1475 | if (hcd->driver->set_usb2_hw_lpm) { | ||
1476 | ret = hcd->driver->set_usb2_hw_lpm(hcd, udev, enable); | ||
1477 | if (!ret) | ||
1478 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c | ||
1479 | index 879651cb6b45..243c6729c320 100644 | ||
1480 | --- a/drivers/usb/core/hub.c | ||
1481 | +++ b/drivers/usb/core/hub.c | ||
1482 | @@ -1135,6 +1135,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | ||
1483 | usb_clear_port_feature(hub->hdev, port1, | ||
1484 | USB_PORT_FEAT_C_ENABLE); | ||
1485 | } | ||
1486 | + if (portchange & USB_PORT_STAT_C_RESET) { | ||
1487 | + need_debounce_delay = true; | ||
1488 | + usb_clear_port_feature(hub->hdev, port1, | ||
1489 | + USB_PORT_FEAT_C_RESET); | ||
1490 | + } | ||
1491 | if ((portchange & USB_PORT_STAT_C_BH_RESET) && | ||
1492 | hub_is_superspeed(hub->hdev)) { | ||
1493 | need_debounce_delay = true; | ||
1494 | @@ -3954,6 +3959,32 @@ static int hub_set_address(struct usb_device *udev, int devnum) | ||
1495 | return retval; | ||
1496 | } | ||
1497 | |||
1498 | +/* | ||
1499 | + * There are reports of USB 3.0 devices that say they support USB 2.0 Link PM | ||
1500 | + * when they're plugged into a USB 2.0 port, but they don't work when LPM is | ||
1501 | + * enabled. | ||
1502 | + * | ||
1503 | + * Only enable USB 2.0 Link PM if the port is internal (hardwired), or the | ||
1504 | + * device says it supports the new USB 2.0 Link PM errata by setting the BESL | ||
1505 | + * support bit in the BOS descriptor. | ||
1506 | + */ | ||
1507 | +static void hub_set_initial_usb2_lpm_policy(struct usb_device *udev) | ||
1508 | +{ | ||
1509 | + int connect_type; | ||
1510 | + | ||
1511 | + if (!udev->usb2_hw_lpm_capable) | ||
1512 | + return; | ||
1513 | + | ||
1514 | + connect_type = usb_get_hub_port_connect_type(udev->parent, | ||
1515 | + udev->portnum); | ||
1516 | + | ||
1517 | + if ((udev->bos->ext_cap->bmAttributes & USB_BESL_SUPPORT) || | ||
1518 | + connect_type == USB_PORT_CONNECT_TYPE_HARD_WIRED) { | ||
1519 | + udev->usb2_hw_lpm_allowed = 1; | ||
1520 | + usb_set_usb2_hardware_lpm(udev, 1); | ||
1521 | + } | ||
1522 | +} | ||
1523 | + | ||
1524 | /* Reset device, (re)assign address, get device descriptor. | ||
1525 | * Device connection must be stable, no more debouncing needed. | ||
1526 | * Returns device in USB_STATE_ADDRESS, except on error. | ||
1527 | @@ -4247,6 +4278,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | ||
1528 | /* notify HCD that we have a device connected and addressed */ | ||
1529 | if (hcd->driver->update_device) | ||
1530 | hcd->driver->update_device(hcd, udev); | ||
1531 | + hub_set_initial_usb2_lpm_policy(udev); | ||
1532 | fail: | ||
1533 | if (retval) { | ||
1534 | hub_port_disable(hub, port1, 0); | ||
1535 | @@ -5091,6 +5123,12 @@ static int usb_reset_and_verify_device(struct usb_device *udev) | ||
1536 | } | ||
1537 | parent_hub = usb_hub_to_struct_hub(parent_hdev); | ||
1538 | |||
1539 | + /* Disable USB2 hardware LPM. | ||
1540 | + * It will be re-enabled by the enumeration process. | ||
1541 | + */ | ||
1542 | + if (udev->usb2_hw_lpm_enabled == 1) | ||
1543 | + usb_set_usb2_hardware_lpm(udev, 0); | ||
1544 | + | ||
1545 | bos = udev->bos; | ||
1546 | udev->bos = NULL; | ||
1547 | |||
1548 | @@ -5198,6 +5236,7 @@ static int usb_reset_and_verify_device(struct usb_device *udev) | ||
1549 | |||
1550 | done: | ||
1551 | /* Now that the alt settings are re-installed, enable LTM and LPM. */ | ||
1552 | + usb_set_usb2_hardware_lpm(udev, 1); | ||
1553 | usb_unlocked_enable_lpm(udev); | ||
1554 | usb_enable_ltm(udev); | ||
1555 | usb_release_bos_descriptor(udev); | ||
1556 | diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c | ||
1557 | index 6d2c8edb1ffe..ca516ac0f234 100644 | ||
1558 | --- a/drivers/usb/core/sysfs.c | ||
1559 | +++ b/drivers/usb/core/sysfs.c | ||
1560 | @@ -449,7 +449,7 @@ static ssize_t usb2_hardware_lpm_show(struct device *dev, | ||
1561 | struct usb_device *udev = to_usb_device(dev); | ||
1562 | const char *p; | ||
1563 | |||
1564 | - if (udev->usb2_hw_lpm_enabled == 1) | ||
1565 | + if (udev->usb2_hw_lpm_allowed == 1) | ||
1566 | p = "enabled"; | ||
1567 | else | ||
1568 | p = "disabled"; | ||
1569 | @@ -469,8 +469,10 @@ static ssize_t usb2_hardware_lpm_store(struct device *dev, | ||
1570 | |||
1571 | ret = strtobool(buf, &value); | ||
1572 | |||
1573 | - if (!ret) | ||
1574 | + if (!ret) { | ||
1575 | + udev->usb2_hw_lpm_allowed = value; | ||
1576 | ret = usb_set_usb2_hardware_lpm(udev, value); | ||
1577 | + } | ||
1578 | |||
1579 | usb_unlock_device(udev); | ||
1580 | |||
1581 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c | ||
1582 | index 83bcd13622c3..49b8bd063fab 100644 | ||
1583 | --- a/drivers/usb/host/xhci-mem.c | ||
1584 | +++ b/drivers/usb/host/xhci-mem.c | ||
1585 | @@ -1693,9 +1693,7 @@ void xhci_free_command(struct xhci_hcd *xhci, | ||
1586 | void xhci_mem_cleanup(struct xhci_hcd *xhci) | ||
1587 | { | ||
1588 | struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); | ||
1589 | - struct dev_info *dev_info, *next; | ||
1590 | struct xhci_cd *cur_cd, *next_cd; | ||
1591 | - unsigned long flags; | ||
1592 | int size; | ||
1593 | int i, j, num_ports; | ||
1594 | |||
1595 | @@ -1756,13 +1754,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | ||
1596 | |||
1597 | scratchpad_free(xhci); | ||
1598 | |||
1599 | - spin_lock_irqsave(&xhci->lock, flags); | ||
1600 | - list_for_each_entry_safe(dev_info, next, &xhci->lpm_failed_devs, list) { | ||
1601 | - list_del(&dev_info->list); | ||
1602 | - kfree(dev_info); | ||
1603 | - } | ||
1604 | - spin_unlock_irqrestore(&xhci->lock, flags); | ||
1605 | - | ||
1606 | if (!xhci->rh_bw) | ||
1607 | goto no_bw; | ||
1608 | |||
1609 | @@ -2231,7 +2222,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | ||
1610 | u32 page_size, temp; | ||
1611 | int i; | ||
1612 | |||
1613 | - INIT_LIST_HEAD(&xhci->lpm_failed_devs); | ||
1614 | INIT_LIST_HEAD(&xhci->cancel_cmd_list); | ||
1615 | |||
1616 | page_size = xhci_readl(xhci, &xhci->op_regs->page_size); | ||
1617 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c | ||
1618 | index 6e0d886bcce5..ed6c186a5393 100644 | ||
1619 | --- a/drivers/usb/host/xhci.c | ||
1620 | +++ b/drivers/usb/host/xhci.c | ||
1621 | @@ -4025,133 +4025,6 @@ static int xhci_calculate_usb2_hw_lpm_params(struct usb_device *udev) | ||
1622 | return PORT_BESLD(besld) | PORT_L1_TIMEOUT(l1) | PORT_HIRDM(hirdm); | ||
1623 | } | ||
1624 | |||
1625 | -static int xhci_usb2_software_lpm_test(struct usb_hcd *hcd, | ||
1626 | - struct usb_device *udev) | ||
1627 | -{ | ||
1628 | - struct xhci_hcd *xhci = hcd_to_xhci(hcd); | ||
1629 | - struct dev_info *dev_info; | ||
1630 | - __le32 __iomem **port_array; | ||
1631 | - __le32 __iomem *addr, *pm_addr; | ||
1632 | - u32 temp, dev_id; | ||
1633 | - unsigned int port_num; | ||
1634 | - unsigned long flags; | ||
1635 | - int hird; | ||
1636 | - int ret; | ||
1637 | - | ||
1638 | - if (hcd->speed == HCD_USB3 || !xhci->sw_lpm_support || | ||
1639 | - !udev->lpm_capable) | ||
1640 | - return -EINVAL; | ||
1641 | - | ||
1642 | - /* we only support lpm for non-hub device connected to root hub yet */ | ||
1643 | - if (!udev->parent || udev->parent->parent || | ||
1644 | - udev->descriptor.bDeviceClass == USB_CLASS_HUB) | ||
1645 | - return -EINVAL; | ||
1646 | - | ||
1647 | - spin_lock_irqsave(&xhci->lock, flags); | ||
1648 | - | ||
1649 | - /* Look for devices in lpm_failed_devs list */ | ||
1650 | - dev_id = le16_to_cpu(udev->descriptor.idVendor) << 16 | | ||
1651 | - le16_to_cpu(udev->descriptor.idProduct); | ||
1652 | - list_for_each_entry(dev_info, &xhci->lpm_failed_devs, list) { | ||
1653 | - if (dev_info->dev_id == dev_id) { | ||
1654 | - ret = -EINVAL; | ||
1655 | - goto finish; | ||
1656 | - } | ||
1657 | - } | ||
1658 | - | ||
1659 | - port_array = xhci->usb2_ports; | ||
1660 | - port_num = udev->portnum - 1; | ||
1661 | - | ||
1662 | - if (port_num > HCS_MAX_PORTS(xhci->hcs_params1)) { | ||
1663 | - xhci_dbg(xhci, "invalid port number %d\n", udev->portnum); | ||
1664 | - ret = -EINVAL; | ||
1665 | - goto finish; | ||
1666 | - } | ||
1667 | - | ||
1668 | - /* | ||
1669 | - * Test USB 2.0 software LPM. | ||
1670 | - * FIXME: some xHCI 1.0 hosts may implement a new register to set up | ||
1671 | - * hardware-controlled USB 2.0 LPM. See section 5.4.11 and 4.23.5.1.1.1 | ||
1672 | - * in the June 2011 errata release. | ||
1673 | - */ | ||
1674 | - xhci_dbg(xhci, "test port %d software LPM\n", port_num); | ||
1675 | - /* | ||
1676 | - * Set L1 Device Slot and HIRD/BESL. | ||
1677 | - * Check device's USB 2.0 extension descriptor to determine whether | ||
1678 | - * HIRD or BESL shoule be used. See USB2.0 LPM errata. | ||
1679 | - */ | ||
1680 | - pm_addr = port_array[port_num] + PORTPMSC; | ||
1681 | - hird = xhci_calculate_hird_besl(xhci, udev); | ||
1682 | - temp = PORT_L1DS(udev->slot_id) | PORT_HIRD(hird); | ||
1683 | - xhci_writel(xhci, temp, pm_addr); | ||
1684 | - | ||
1685 | - /* Set port link state to U2(L1) */ | ||
1686 | - addr = port_array[port_num]; | ||
1687 | - xhci_set_link_state(xhci, port_array, port_num, XDEV_U2); | ||
1688 | - | ||
1689 | - /* wait for ACK */ | ||
1690 | - spin_unlock_irqrestore(&xhci->lock, flags); | ||
1691 | - msleep(10); | ||
1692 | - spin_lock_irqsave(&xhci->lock, flags); | ||
1693 | - | ||
1694 | - /* Check L1 Status */ | ||
1695 | - ret = xhci_handshake(xhci, pm_addr, | ||
1696 | - PORT_L1S_MASK, PORT_L1S_SUCCESS, 125); | ||
1697 | - if (ret != -ETIMEDOUT) { | ||
1698 | - /* enter L1 successfully */ | ||
1699 | - temp = xhci_readl(xhci, addr); | ||
1700 | - xhci_dbg(xhci, "port %d entered L1 state, port status 0x%x\n", | ||
1701 | - port_num, temp); | ||
1702 | - ret = 0; | ||
1703 | - } else { | ||
1704 | - temp = xhci_readl(xhci, pm_addr); | ||
1705 | - xhci_dbg(xhci, "port %d software lpm failed, L1 status %d\n", | ||
1706 | - port_num, temp & PORT_L1S_MASK); | ||
1707 | - ret = -EINVAL; | ||
1708 | - } | ||
1709 | - | ||
1710 | - /* Resume the port */ | ||
1711 | - xhci_set_link_state(xhci, port_array, port_num, XDEV_U0); | ||
1712 | - | ||
1713 | - spin_unlock_irqrestore(&xhci->lock, flags); | ||
1714 | - msleep(10); | ||
1715 | - spin_lock_irqsave(&xhci->lock, flags); | ||
1716 | - | ||
1717 | - /* Clear PLC */ | ||
1718 | - xhci_test_and_clear_bit(xhci, port_array, port_num, PORT_PLC); | ||
1719 | - | ||
1720 | - /* Check PORTSC to make sure the device is in the right state */ | ||
1721 | - if (!ret) { | ||
1722 | - temp = xhci_readl(xhci, addr); | ||
1723 | - xhci_dbg(xhci, "resumed port %d status 0x%x\n", port_num, temp); | ||
1724 | - if (!(temp & PORT_CONNECT) || !(temp & PORT_PE) || | ||
1725 | - (temp & PORT_PLS_MASK) != XDEV_U0) { | ||
1726 | - xhci_dbg(xhci, "port L1 resume fail\n"); | ||
1727 | - ret = -EINVAL; | ||
1728 | - } | ||
1729 | - } | ||
1730 | - | ||
1731 | - if (ret) { | ||
1732 | - /* Insert dev to lpm_failed_devs list */ | ||
1733 | - xhci_warn(xhci, "device LPM test failed, may disconnect and " | ||
1734 | - "re-enumerate\n"); | ||
1735 | - dev_info = kzalloc(sizeof(struct dev_info), GFP_ATOMIC); | ||
1736 | - if (!dev_info) { | ||
1737 | - ret = -ENOMEM; | ||
1738 | - goto finish; | ||
1739 | - } | ||
1740 | - dev_info->dev_id = dev_id; | ||
1741 | - INIT_LIST_HEAD(&dev_info->list); | ||
1742 | - list_add(&dev_info->list, &xhci->lpm_failed_devs); | ||
1743 | - } else { | ||
1744 | - xhci_ring_device(xhci, udev->slot_id); | ||
1745 | - } | ||
1746 | - | ||
1747 | -finish: | ||
1748 | - spin_unlock_irqrestore(&xhci->lock, flags); | ||
1749 | - return ret; | ||
1750 | -} | ||
1751 | - | ||
1752 | int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, | ||
1753 | struct usb_device *udev, int enable) | ||
1754 | { | ||
1755 | @@ -4228,7 +4101,7 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, | ||
1756 | } | ||
1757 | |||
1758 | pm_val &= ~PORT_HIRD_MASK; | ||
1759 | - pm_val |= PORT_HIRD(hird) | PORT_RWE; | ||
1760 | + pm_val |= PORT_HIRD(hird) | PORT_RWE | PORT_L1DS(udev->slot_id); | ||
1761 | xhci_writel(xhci, pm_val, pm_addr); | ||
1762 | pm_val = xhci_readl(xhci, pm_addr); | ||
1763 | pm_val |= PORT_HLE; | ||
1764 | @@ -4236,7 +4109,7 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, | ||
1765 | /* flush write */ | ||
1766 | xhci_readl(xhci, pm_addr); | ||
1767 | } else { | ||
1768 | - pm_val &= ~(PORT_HLE | PORT_RWE | PORT_HIRD_MASK); | ||
1769 | + pm_val &= ~(PORT_HLE | PORT_RWE | PORT_HIRD_MASK | PORT_L1DS_MASK); | ||
1770 | xhci_writel(xhci, pm_val, pm_addr); | ||
1771 | /* flush write */ | ||
1772 | xhci_readl(xhci, pm_addr); | ||
1773 | @@ -4279,24 +4152,26 @@ static int xhci_check_usb2_port_capability(struct xhci_hcd *xhci, int port, | ||
1774 | int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) | ||
1775 | { | ||
1776 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | ||
1777 | - int ret; | ||
1778 | int portnum = udev->portnum - 1; | ||
1779 | |||
1780 | - ret = xhci_usb2_software_lpm_test(hcd, udev); | ||
1781 | - if (!ret) { | ||
1782 | - xhci_dbg(xhci, "software LPM test succeed\n"); | ||
1783 | - if (xhci->hw_lpm_support == 1 && | ||
1784 | - xhci_check_usb2_port_capability(xhci, portnum, XHCI_HLC)) { | ||
1785 | - udev->usb2_hw_lpm_capable = 1; | ||
1786 | - udev->l1_params.timeout = XHCI_L1_TIMEOUT; | ||
1787 | - udev->l1_params.besl = XHCI_DEFAULT_BESL; | ||
1788 | - if (xhci_check_usb2_port_capability(xhci, portnum, | ||
1789 | - XHCI_BLC)) | ||
1790 | - udev->usb2_hw_lpm_besl_capable = 1; | ||
1791 | - ret = xhci_set_usb2_hardware_lpm(hcd, udev, 1); | ||
1792 | - if (!ret) | ||
1793 | - udev->usb2_hw_lpm_enabled = 1; | ||
1794 | - } | ||
1795 | + if (hcd->speed == HCD_USB3 || !xhci->sw_lpm_support || | ||
1796 | + !udev->lpm_capable) | ||
1797 | + return 0; | ||
1798 | + | ||
1799 | + /* we only support lpm for non-hub device connected to root hub yet */ | ||
1800 | + if (!udev->parent || udev->parent->parent || | ||
1801 | + udev->descriptor.bDeviceClass == USB_CLASS_HUB) | ||
1802 | + return 0; | ||
1803 | + | ||
1804 | + if (xhci->hw_lpm_support == 1 && | ||
1805 | + xhci_check_usb2_port_capability( | ||
1806 | + xhci, portnum, XHCI_HLC)) { | ||
1807 | + udev->usb2_hw_lpm_capable = 1; | ||
1808 | + udev->l1_params.timeout = XHCI_L1_TIMEOUT; | ||
1809 | + udev->l1_params.besl = XHCI_DEFAULT_BESL; | ||
1810 | + if (xhci_check_usb2_port_capability(xhci, portnum, | ||
1811 | + XHCI_BLC)) | ||
1812 | + udev->usb2_hw_lpm_besl_capable = 1; | ||
1813 | } | ||
1814 | |||
1815 | return 0; | ||
1816 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h | ||
1817 | index 941d5f59e4dc..ed3a425de8ce 100644 | ||
1818 | --- a/drivers/usb/host/xhci.h | ||
1819 | +++ b/drivers/usb/host/xhci.h | ||
1820 | @@ -383,6 +383,7 @@ struct xhci_op_regs { | ||
1821 | #define PORT_RWE (1 << 3) | ||
1822 | #define PORT_HIRD(p) (((p) & 0xf) << 4) | ||
1823 | #define PORT_HIRD_MASK (0xf << 4) | ||
1824 | +#define PORT_L1DS_MASK (0xff << 8) | ||
1825 | #define PORT_L1DS(p) (((p) & 0xff) << 8) | ||
1826 | #define PORT_HLE (1 << 16) | ||
1827 | |||
1828 | diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c | ||
1829 | index cd70cc886171..0d0d11880968 100644 | ||
1830 | --- a/drivers/usb/musb/musb_core.c | ||
1831 | +++ b/drivers/usb/musb/musb_core.c | ||
1832 | @@ -1809,6 +1809,7 @@ static void musb_free(struct musb *musb) | ||
1833 | disable_irq_wake(musb->nIrq); | ||
1834 | free_irq(musb->nIrq, musb); | ||
1835 | } | ||
1836 | + cancel_work_sync(&musb->irq_work); | ||
1837 | if (musb->dma_controller) | ||
1838 | dma_controller_destroy(musb->dma_controller); | ||
1839 | |||
1840 | @@ -1946,6 +1947,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | ||
1841 | if (status < 0) | ||
1842 | goto fail3; | ||
1843 | status = musb_gadget_setup(musb); | ||
1844 | + if (status) | ||
1845 | + musb_host_cleanup(musb); | ||
1846 | break; | ||
1847 | default: | ||
1848 | dev_err(dev, "unsupported port mode %d\n", musb->port_mode); | ||
1849 | @@ -1972,6 +1975,7 @@ fail5: | ||
1850 | |||
1851 | fail4: | ||
1852 | musb_gadget_cleanup(musb); | ||
1853 | + musb_host_cleanup(musb); | ||
1854 | |||
1855 | fail3: | ||
1856 | if (musb->dma_controller) | ||
1857 | diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c | ||
1858 | index bd4138d80a48..1edee7906b73 100644 | ||
1859 | --- a/drivers/usb/musb/musb_dsps.c | ||
1860 | +++ b/drivers/usb/musb/musb_dsps.c | ||
1861 | @@ -121,6 +121,7 @@ struct dsps_glue { | ||
1862 | unsigned long last_timer; /* last timer data for each instance */ | ||
1863 | }; | ||
1864 | |||
1865 | +static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout); | ||
1866 | /** | ||
1867 | * dsps_musb_enable - enable interrupts | ||
1868 | */ | ||
1869 | @@ -143,6 +144,7 @@ static void dsps_musb_enable(struct musb *musb) | ||
1870 | /* Force the DRVVBUS IRQ so we can start polling for ID change. */ | ||
1871 | dsps_writel(reg_base, wrp->coreintr_set, | ||
1872 | (1 << wrp->drvvbus) << wrp->usb_shift); | ||
1873 | + dsps_musb_try_idle(musb, 0); | ||
1874 | } | ||
1875 | |||
1876 | /** | ||
1877 | @@ -171,6 +173,7 @@ static void otg_timer(unsigned long _musb) | ||
1878 | const struct dsps_musb_wrapper *wrp = glue->wrp; | ||
1879 | u8 devctl; | ||
1880 | unsigned long flags; | ||
1881 | + int skip_session = 0; | ||
1882 | |||
1883 | /* | ||
1884 | * We poll because DSPS IP's won't expose several OTG-critical | ||
1885 | @@ -183,10 +186,12 @@ static void otg_timer(unsigned long _musb) | ||
1886 | spin_lock_irqsave(&musb->lock, flags); | ||
1887 | switch (musb->xceiv->state) { | ||
1888 | case OTG_STATE_A_WAIT_BCON: | ||
1889 | - devctl &= ~MUSB_DEVCTL_SESSION; | ||
1890 | - dsps_writeb(musb->mregs, MUSB_DEVCTL, devctl); | ||
1891 | + dsps_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
1892 | + skip_session = 1; | ||
1893 | + /* fall */ | ||
1894 | |||
1895 | - devctl = dsps_readb(musb->mregs, MUSB_DEVCTL); | ||
1896 | + case OTG_STATE_A_IDLE: | ||
1897 | + case OTG_STATE_B_IDLE: | ||
1898 | if (devctl & MUSB_DEVCTL_BDEVICE) { | ||
1899 | musb->xceiv->state = OTG_STATE_B_IDLE; | ||
1900 | MUSB_DEV_MODE(musb); | ||
1901 | @@ -194,20 +199,15 @@ static void otg_timer(unsigned long _musb) | ||
1902 | musb->xceiv->state = OTG_STATE_A_IDLE; | ||
1903 | MUSB_HST_MODE(musb); | ||
1904 | } | ||
1905 | + if (!(devctl & MUSB_DEVCTL_SESSION) && !skip_session) | ||
1906 | + dsps_writeb(mregs, MUSB_DEVCTL, MUSB_DEVCTL_SESSION); | ||
1907 | + mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); | ||
1908 | break; | ||
1909 | case OTG_STATE_A_WAIT_VFALL: | ||
1910 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | ||
1911 | dsps_writel(musb->ctrl_base, wrp->coreintr_set, | ||
1912 | MUSB_INTR_VBUSERROR << wrp->usb_shift); | ||
1913 | break; | ||
1914 | - case OTG_STATE_B_IDLE: | ||
1915 | - devctl = dsps_readb(mregs, MUSB_DEVCTL); | ||
1916 | - if (devctl & MUSB_DEVCTL_BDEVICE) | ||
1917 | - mod_timer(&glue->timer, | ||
1918 | - jiffies + wrp->poll_seconds * HZ); | ||
1919 | - else | ||
1920 | - musb->xceiv->state = OTG_STATE_A_IDLE; | ||
1921 | - break; | ||
1922 | default: | ||
1923 | break; | ||
1924 | } | ||
1925 | @@ -234,6 +234,9 @@ static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout) | ||
1926 | if (musb->port_mode == MUSB_PORT_MODE_HOST) | ||
1927 | return; | ||
1928 | |||
1929 | + if (!musb->g.dev.driver) | ||
1930 | + return; | ||
1931 | + | ||
1932 | if (time_after(glue->last_timer, timeout) && | ||
1933 | timer_pending(&glue->timer)) { | ||
1934 | dev_dbg(musb->controller, | ||
1935 | diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c | ||
1936 | index d1d6b83aabca..9af6bba5eac9 100644 | ||
1937 | --- a/drivers/usb/musb/musb_virthub.c | ||
1938 | +++ b/drivers/usb/musb/musb_virthub.c | ||
1939 | @@ -220,6 +220,23 @@ int musb_hub_status_data(struct usb_hcd *hcd, char *buf) | ||
1940 | return retval; | ||
1941 | } | ||
1942 | |||
1943 | +static int musb_has_gadget(struct musb *musb) | ||
1944 | +{ | ||
1945 | + /* | ||
1946 | + * In host-only mode we start a connection right away. In OTG mode | ||
1947 | + * we have to wait until we loaded a gadget. We don't really need a | ||
1948 | + * gadget if we operate as a host but we should not start a session | ||
1949 | + * as a device without a gadget or else we explode. | ||
1950 | + */ | ||
1951 | +#ifdef CONFIG_USB_MUSB_HOST | ||
1952 | + return 1; | ||
1953 | +#else | ||
1954 | + if (musb->port_mode == MUSB_PORT_MODE_HOST) | ||
1955 | + return 1; | ||
1956 | + return musb->g.dev.driver != NULL; | ||
1957 | +#endif | ||
1958 | +} | ||
1959 | + | ||
1960 | int musb_hub_control( | ||
1961 | struct usb_hcd *hcd, | ||
1962 | u16 typeReq, | ||
1963 | @@ -362,7 +379,7 @@ int musb_hub_control( | ||
1964 | * initialization logic, e.g. for OTG, or change any | ||
1965 | * logic relating to VBUS power-up. | ||
1966 | */ | ||
1967 | - if (!hcd->self.is_b_host) | ||
1968 | + if (!hcd->self.is_b_host && musb_has_gadget(musb)) | ||
1969 | musb_start(musb); | ||
1970 | break; | ||
1971 | case USB_PORT_FEAT_RESET: | ||
1972 | diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c | ||
1973 | index fdf953539c62..e5bdd987b9e8 100644 | ||
1974 | --- a/drivers/usb/serial/mos7840.c | ||
1975 | +++ b/drivers/usb/serial/mos7840.c | ||
1976 | @@ -1532,7 +1532,11 @@ static int mos7840_tiocmget(struct tty_struct *tty) | ||
1977 | return -ENODEV; | ||
1978 | |||
1979 | status = mos7840_get_uart_reg(port, MODEM_STATUS_REGISTER, &msr); | ||
1980 | + if (status != 1) | ||
1981 | + return -EIO; | ||
1982 | status = mos7840_get_uart_reg(port, MODEM_CONTROL_REGISTER, &mcr); | ||
1983 | + if (status != 1) | ||
1984 | + return -EIO; | ||
1985 | result = ((mcr & MCR_DTR) ? TIOCM_DTR : 0) | ||
1986 | | ((mcr & MCR_RTS) ? TIOCM_RTS : 0) | ||
1987 | | ((mcr & MCR_LOOPBACK) ? TIOCM_LOOP : 0) | ||
1988 | diff --git a/drivers/usb/wusbcore/wa-rpipe.c b/drivers/usb/wusbcore/wa-rpipe.c | ||
1989 | index fd4f1ce6256a..b5e4fc19dec0 100644 | ||
1990 | --- a/drivers/usb/wusbcore/wa-rpipe.c | ||
1991 | +++ b/drivers/usb/wusbcore/wa-rpipe.c | ||
1992 | @@ -333,7 +333,10 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa, | ||
1993 | /* FIXME: compute so seg_size > ep->maxpktsize */ | ||
1994 | rpipe->descr.wBlocks = cpu_to_le16(16); /* given */ | ||
1995 | /* ep0 maxpktsize is 0x200 (WUSB1.0[4.8.1]) */ | ||
1996 | - rpipe->descr.wMaxPacketSize = cpu_to_le16(ep->desc.wMaxPacketSize); | ||
1997 | + if (usb_endpoint_xfer_isoc(&ep->desc)) | ||
1998 | + rpipe->descr.wMaxPacketSize = epcd->wOverTheAirPacketSize; | ||
1999 | + else | ||
2000 | + rpipe->descr.wMaxPacketSize = ep->desc.wMaxPacketSize; | ||
2001 | |||
2002 | rpipe->descr.hwa_bMaxBurst = max(min_t(unsigned int, | ||
2003 | epcd->bMaxBurst, 16U), 1U); | ||
2004 | diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c | ||
2005 | index 4a355726151e..26450d850f14 100644 | ||
2006 | --- a/fs/btrfs/relocation.c | ||
2007 | +++ b/fs/btrfs/relocation.c | ||
2008 | @@ -4481,6 +4481,7 @@ int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len) | ||
2009 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
2010 | int ret; | ||
2011 | u64 disk_bytenr; | ||
2012 | + u64 new_bytenr; | ||
2013 | LIST_HEAD(list); | ||
2014 | |||
2015 | ordered = btrfs_lookup_ordered_extent(inode, file_pos); | ||
2016 | @@ -4492,13 +4493,24 @@ int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len) | ||
2017 | if (ret) | ||
2018 | goto out; | ||
2019 | |||
2020 | - disk_bytenr = ordered->start; | ||
2021 | while (!list_empty(&list)) { | ||
2022 | sums = list_entry(list.next, struct btrfs_ordered_sum, list); | ||
2023 | list_del_init(&sums->list); | ||
2024 | |||
2025 | - sums->bytenr = disk_bytenr; | ||
2026 | - disk_bytenr += sums->len; | ||
2027 | + /* | ||
2028 | + * We need to offset the new_bytenr based on where the csum is. | ||
2029 | + * We need to do this because we will read in entire prealloc | ||
2030 | + * extents but we may have written to say the middle of the | ||
2031 | + * prealloc extent, so we need to make sure the csum goes with | ||
2032 | + * the right disk offset. | ||
2033 | + * | ||
2034 | + * We can do this because the data reloc inode refers strictly | ||
2035 | + * to the on disk bytes, so we don't have to worry about | ||
2036 | + * disk_len vs real len like with real inodes since it's all | ||
2037 | + * disk length. | ||
2038 | + */ | ||
2039 | + new_bytenr = ordered->start + (sums->bytenr - disk_bytenr); | ||
2040 | + sums->bytenr = new_bytenr; | ||
2041 | |||
2042 | btrfs_add_ordered_sum(inode, ordered, sums); | ||
2043 | } | ||
2044 | diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c | ||
2045 | index 277bd1be21fd..511d41546791 100644 | ||
2046 | --- a/fs/configfs/dir.c | ||
2047 | +++ b/fs/configfs/dir.c | ||
2048 | @@ -56,10 +56,19 @@ static void configfs_d_iput(struct dentry * dentry, | ||
2049 | struct configfs_dirent *sd = dentry->d_fsdata; | ||
2050 | |||
2051 | if (sd) { | ||
2052 | - BUG_ON(sd->s_dentry != dentry); | ||
2053 | /* Coordinate with configfs_readdir */ | ||
2054 | spin_lock(&configfs_dirent_lock); | ||
2055 | - sd->s_dentry = NULL; | ||
2056 | + /* Coordinate with configfs_attach_attr where will increase | ||
2057 | + * sd->s_count and update sd->s_dentry to new allocated one. | ||
2058 | + * Only set sd->dentry to null when this dentry is the only | ||
2059 | + * sd owner. | ||
2060 | + * If not do so, configfs_d_iput may run just after | ||
2061 | + * configfs_attach_attr and set sd->s_dentry to null | ||
2062 | + * even it's still in use. | ||
2063 | + */ | ||
2064 | + if (atomic_read(&sd->s_count) <= 2) | ||
2065 | + sd->s_dentry = NULL; | ||
2066 | + | ||
2067 | spin_unlock(&configfs_dirent_lock); | ||
2068 | configfs_put(sd); | ||
2069 | } | ||
2070 | @@ -426,8 +435,11 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den | ||
2071 | struct configfs_attribute * attr = sd->s_element; | ||
2072 | int error; | ||
2073 | |||
2074 | + spin_lock(&configfs_dirent_lock); | ||
2075 | dentry->d_fsdata = configfs_get(sd); | ||
2076 | sd->s_dentry = dentry; | ||
2077 | + spin_unlock(&configfs_dirent_lock); | ||
2078 | + | ||
2079 | error = configfs_create(dentry, (attr->ca_mode & S_IALLUGO) | S_IFREG, | ||
2080 | configfs_init_file); | ||
2081 | if (error) { | ||
2082 | diff --git a/fs/dcache.c b/fs/dcache.c | ||
2083 | index ae6ebb88ceff..89f96719a29b 100644 | ||
2084 | --- a/fs/dcache.c | ||
2085 | +++ b/fs/dcache.c | ||
2086 | @@ -2881,9 +2881,9 @@ static int prepend_path(const struct path *path, | ||
2087 | const struct path *root, | ||
2088 | char **buffer, int *buflen) | ||
2089 | { | ||
2090 | - struct dentry *dentry = path->dentry; | ||
2091 | - struct vfsmount *vfsmnt = path->mnt; | ||
2092 | - struct mount *mnt = real_mount(vfsmnt); | ||
2093 | + struct dentry *dentry; | ||
2094 | + struct vfsmount *vfsmnt; | ||
2095 | + struct mount *mnt; | ||
2096 | int error = 0; | ||
2097 | unsigned seq = 0; | ||
2098 | char *bptr; | ||
2099 | @@ -2893,6 +2893,9 @@ static int prepend_path(const struct path *path, | ||
2100 | restart: | ||
2101 | bptr = *buffer; | ||
2102 | blen = *buflen; | ||
2103 | + dentry = path->dentry; | ||
2104 | + vfsmnt = path->mnt; | ||
2105 | + mnt = real_mount(vfsmnt); | ||
2106 | read_seqbegin_or_lock(&rename_lock, &seq); | ||
2107 | while (dentry != root->dentry || vfsmnt != root->mnt) { | ||
2108 | struct dentry * parent; | ||
2109 | diff --git a/fs/exec.c b/fs/exec.c | ||
2110 | index 8875dd10ae7a..bb8afc1d1df4 100644 | ||
2111 | --- a/fs/exec.c | ||
2112 | +++ b/fs/exec.c | ||
2113 | @@ -1668,6 +1668,12 @@ int __get_dumpable(unsigned long mm_flags) | ||
2114 | return (ret > SUID_DUMP_USER) ? SUID_DUMP_ROOT : ret; | ||
2115 | } | ||
2116 | |||
2117 | +/* | ||
2118 | + * This returns the actual value of the suid_dumpable flag. For things | ||
2119 | + * that are using this for checking for privilege transitions, it must | ||
2120 | + * test against SUID_DUMP_USER rather than treating it as a boolean | ||
2121 | + * value. | ||
2122 | + */ | ||
2123 | int get_dumpable(struct mm_struct *mm) | ||
2124 | { | ||
2125 | return __get_dumpable(mm->flags); | ||
2126 | diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c | ||
2127 | index ced3257f06e8..968d4c56e5eb 100644 | ||
2128 | --- a/fs/gfs2/inode.c | ||
2129 | +++ b/fs/gfs2/inode.c | ||
2130 | @@ -584,17 +584,17 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | ||
2131 | if (!IS_ERR(inode)) { | ||
2132 | d = d_splice_alias(inode, dentry); | ||
2133 | error = 0; | ||
2134 | - if (file && !IS_ERR(d)) { | ||
2135 | - if (d == NULL) | ||
2136 | - d = dentry; | ||
2137 | - if (S_ISREG(inode->i_mode)) | ||
2138 | - error = finish_open(file, d, gfs2_open_common, opened); | ||
2139 | - else | ||
2140 | + if (file) { | ||
2141 | + if (S_ISREG(inode->i_mode)) { | ||
2142 | + WARN_ON(d != NULL); | ||
2143 | + error = finish_open(file, dentry, gfs2_open_common, opened); | ||
2144 | + } else { | ||
2145 | error = finish_no_open(file, d); | ||
2146 | + } | ||
2147 | + } else { | ||
2148 | + dput(d); | ||
2149 | } | ||
2150 | gfs2_glock_dq_uninit(ghs); | ||
2151 | - if (IS_ERR(d)) | ||
2152 | - return PTR_ERR(d); | ||
2153 | return error; | ||
2154 | } else if (error != -ENOENT) { | ||
2155 | goto fail_gunlock; | ||
2156 | @@ -781,8 +781,10 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry, | ||
2157 | error = finish_open(file, dentry, gfs2_open_common, opened); | ||
2158 | |||
2159 | gfs2_glock_dq_uninit(&gh); | ||
2160 | - if (error) | ||
2161 | + if (error) { | ||
2162 | + dput(d); | ||
2163 | return ERR_PTR(error); | ||
2164 | + } | ||
2165 | return d; | ||
2166 | } | ||
2167 | |||
2168 | @@ -1163,14 +1165,16 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry, | ||
2169 | d = __gfs2_lookup(dir, dentry, file, opened); | ||
2170 | if (IS_ERR(d)) | ||
2171 | return PTR_ERR(d); | ||
2172 | - if (d == NULL) | ||
2173 | - d = dentry; | ||
2174 | - if (d->d_inode) { | ||
2175 | + if (d != NULL) | ||
2176 | + dentry = d; | ||
2177 | + if (dentry->d_inode) { | ||
2178 | if (!(*opened & FILE_OPENED)) | ||
2179 | - return finish_no_open(file, d); | ||
2180 | + return finish_no_open(file, dentry); | ||
2181 | + dput(d); | ||
2182 | return 0; | ||
2183 | } | ||
2184 | |||
2185 | + BUG_ON(d != NULL); | ||
2186 | if (!(flags & O_CREAT)) | ||
2187 | return -ENOENT; | ||
2188 | |||
2189 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c | ||
2190 | index d53d6785cba2..3b115653d422 100644 | ||
2191 | --- a/fs/nfs/nfs4proc.c | ||
2192 | +++ b/fs/nfs/nfs4proc.c | ||
2193 | @@ -1318,21 +1318,14 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data) | ||
2194 | int ret; | ||
2195 | |||
2196 | if (!data->rpc_done) { | ||
2197 | - ret = data->rpc_status; | ||
2198 | - goto err; | ||
2199 | + if (data->rpc_status) { | ||
2200 | + ret = data->rpc_status; | ||
2201 | + goto err; | ||
2202 | + } | ||
2203 | + /* cached opens have already been processed */ | ||
2204 | + goto update; | ||
2205 | } | ||
2206 | |||
2207 | - ret = -ESTALE; | ||
2208 | - if (!(data->f_attr.valid & NFS_ATTR_FATTR_TYPE) || | ||
2209 | - !(data->f_attr.valid & NFS_ATTR_FATTR_FILEID) || | ||
2210 | - !(data->f_attr.valid & NFS_ATTR_FATTR_CHANGE)) | ||
2211 | - goto err; | ||
2212 | - | ||
2213 | - ret = -ENOMEM; | ||
2214 | - state = nfs4_get_open_state(inode, data->owner); | ||
2215 | - if (state == NULL) | ||
2216 | - goto err; | ||
2217 | - | ||
2218 | ret = nfs_refresh_inode(inode, &data->f_attr); | ||
2219 | if (ret) | ||
2220 | goto err; | ||
2221 | @@ -1341,8 +1334,10 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data) | ||
2222 | |||
2223 | if (data->o_res.delegation_type != 0) | ||
2224 | nfs4_opendata_check_deleg(data, state); | ||
2225 | +update: | ||
2226 | update_open_stateid(state, &data->o_res.stateid, NULL, | ||
2227 | data->o_arg.fmode); | ||
2228 | + atomic_inc(&state->count); | ||
2229 | |||
2230 | return state; | ||
2231 | err: | ||
2232 | @@ -4575,7 +4570,7 @@ static int _nfs4_get_security_label(struct inode *inode, void *buf, | ||
2233 | struct nfs4_label label = {0, 0, buflen, buf}; | ||
2234 | |||
2235 | u32 bitmask[3] = { 0, 0, FATTR4_WORD2_SECURITY_LABEL }; | ||
2236 | - struct nfs4_getattr_arg args = { | ||
2237 | + struct nfs4_getattr_arg arg = { | ||
2238 | .fh = NFS_FH(inode), | ||
2239 | .bitmask = bitmask, | ||
2240 | }; | ||
2241 | @@ -4586,14 +4581,14 @@ static int _nfs4_get_security_label(struct inode *inode, void *buf, | ||
2242 | }; | ||
2243 | struct rpc_message msg = { | ||
2244 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETATTR], | ||
2245 | - .rpc_argp = &args, | ||
2246 | + .rpc_argp = &arg, | ||
2247 | .rpc_resp = &res, | ||
2248 | }; | ||
2249 | int ret; | ||
2250 | |||
2251 | nfs_fattr_init(&fattr); | ||
2252 | |||
2253 | - ret = rpc_call_sync(server->client, &msg, 0); | ||
2254 | + ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 0); | ||
2255 | if (ret) | ||
2256 | return ret; | ||
2257 | if (!(fattr.valid & NFS_ATTR_FATTR_V4_SECURITY_LABEL)) | ||
2258 | @@ -4630,7 +4625,7 @@ static int _nfs4_do_set_security_label(struct inode *inode, | ||
2259 | struct iattr sattr = {0}; | ||
2260 | struct nfs_server *server = NFS_SERVER(inode); | ||
2261 | const u32 bitmask[3] = { 0, 0, FATTR4_WORD2_SECURITY_LABEL }; | ||
2262 | - struct nfs_setattrargs args = { | ||
2263 | + struct nfs_setattrargs arg = { | ||
2264 | .fh = NFS_FH(inode), | ||
2265 | .iap = &sattr, | ||
2266 | .server = server, | ||
2267 | @@ -4644,14 +4639,14 @@ static int _nfs4_do_set_security_label(struct inode *inode, | ||
2268 | }; | ||
2269 | struct rpc_message msg = { | ||
2270 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SETATTR], | ||
2271 | - .rpc_argp = &args, | ||
2272 | + .rpc_argp = &arg, | ||
2273 | .rpc_resp = &res, | ||
2274 | }; | ||
2275 | int status; | ||
2276 | |||
2277 | - nfs4_stateid_copy(&args.stateid, &zero_stateid); | ||
2278 | + nfs4_stateid_copy(&arg.stateid, &zero_stateid); | ||
2279 | |||
2280 | - status = rpc_call_sync(server->client, &msg, 0); | ||
2281 | + status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1); | ||
2282 | if (status) | ||
2283 | dprintk("%s failed: %d\n", __func__, status); | ||
2284 | |||
2285 | @@ -5106,6 +5101,7 @@ static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock | ||
2286 | status = 0; | ||
2287 | } | ||
2288 | request->fl_ops->fl_release_private(request); | ||
2289 | + request->fl_ops = NULL; | ||
2290 | out: | ||
2291 | return status; | ||
2292 | } | ||
2293 | diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c | ||
2294 | index cc14cbb78b73..ebced8d71157 100644 | ||
2295 | --- a/fs/nfs/nfs4state.c | ||
2296 | +++ b/fs/nfs/nfs4state.c | ||
2297 | @@ -1422,7 +1422,7 @@ restart: | ||
2298 | if (status >= 0) { | ||
2299 | status = nfs4_reclaim_locks(state, ops); | ||
2300 | if (status >= 0) { | ||
2301 | - if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0) { | ||
2302 | + if (!test_bit(NFS_DELEGATED_STATE, &state->flags)) { | ||
2303 | spin_lock(&state->state_lock); | ||
2304 | list_for_each_entry(lock, &state->lock_states, ls_locks) { | ||
2305 | if (!test_bit(NFS_LOCK_INITIALIZED, &lock->ls_flags)) | ||
2306 | @@ -1881,10 +1881,15 @@ again: | ||
2307 | nfs4_root_machine_cred(clp); | ||
2308 | goto again; | ||
2309 | } | ||
2310 | - if (i > 2) | ||
2311 | + if (clnt->cl_auth->au_flavor == RPC_AUTH_UNIX) | ||
2312 | break; | ||
2313 | case -NFS4ERR_CLID_INUSE: | ||
2314 | case -NFS4ERR_WRONGSEC: | ||
2315 | + /* No point in retrying if we already used RPC_AUTH_UNIX */ | ||
2316 | + if (clnt->cl_auth->au_flavor == RPC_AUTH_UNIX) { | ||
2317 | + status = -EPERM; | ||
2318 | + break; | ||
2319 | + } | ||
2320 | clnt = rpc_clone_client_set_auth(clnt, RPC_AUTH_UNIX); | ||
2321 | if (IS_ERR(clnt)) { | ||
2322 | status = PTR_ERR(clnt); | ||
2323 | diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c | ||
2324 | index 5f38ea36e266..af51cf9bf2e3 100644 | ||
2325 | --- a/fs/nfsd/export.c | ||
2326 | +++ b/fs/nfsd/export.c | ||
2327 | @@ -536,16 +536,12 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) | ||
2328 | if (err) | ||
2329 | goto out3; | ||
2330 | exp.ex_anon_uid= make_kuid(&init_user_ns, an_int); | ||
2331 | - if (!uid_valid(exp.ex_anon_uid)) | ||
2332 | - goto out3; | ||
2333 | |||
2334 | /* anon gid */ | ||
2335 | err = get_int(&mesg, &an_int); | ||
2336 | if (err) | ||
2337 | goto out3; | ||
2338 | exp.ex_anon_gid= make_kgid(&init_user_ns, an_int); | ||
2339 | - if (!gid_valid(exp.ex_anon_gid)) | ||
2340 | - goto out3; | ||
2341 | |||
2342 | /* fsid */ | ||
2343 | err = get_int(&mesg, &an_int); | ||
2344 | @@ -583,6 +579,17 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) | ||
2345 | exp.ex_uuid); | ||
2346 | if (err) | ||
2347 | goto out4; | ||
2348 | + /* | ||
2349 | + * For some reason exportfs has been passing down an | ||
2350 | + * invalid (-1) uid & gid on the "dummy" export which it | ||
2351 | + * uses to test export support. To make sure exportfs | ||
2352 | + * sees errors from check_export we therefore need to | ||
2353 | + * delay these checks till after check_export: | ||
2354 | + */ | ||
2355 | + if (!uid_valid(exp.ex_anon_uid)) | ||
2356 | + goto out4; | ||
2357 | + if (!gid_valid(exp.ex_anon_gid)) | ||
2358 | + goto out4; | ||
2359 | } | ||
2360 | |||
2361 | expp = svc_export_lookup(&exp); | ||
2362 | diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c | ||
2363 | index d9454fe5653f..ecc735e30bea 100644 | ||
2364 | --- a/fs/nfsd/nfs4xdr.c | ||
2365 | +++ b/fs/nfsd/nfs4xdr.c | ||
2366 | @@ -141,8 +141,8 @@ xdr_error: \ | ||
2367 | |||
2368 | static void next_decode_page(struct nfsd4_compoundargs *argp) | ||
2369 | { | ||
2370 | - argp->pagelist++; | ||
2371 | argp->p = page_address(argp->pagelist[0]); | ||
2372 | + argp->pagelist++; | ||
2373 | if (argp->pagelen < PAGE_SIZE) { | ||
2374 | argp->end = argp->p + (argp->pagelen>>2); | ||
2375 | argp->pagelen = 0; | ||
2376 | @@ -411,6 +411,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, | ||
2377 | label->data = kzalloc(dummy32 + 1, GFP_KERNEL); | ||
2378 | if (!label->data) | ||
2379 | return nfserr_jukebox; | ||
2380 | + label->len = dummy32; | ||
2381 | defer_free(argp, kfree, label->data); | ||
2382 | memcpy(label->data, buf, dummy32); | ||
2383 | } | ||
2384 | @@ -1208,6 +1209,7 @@ nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write) | ||
2385 | len -= pages * PAGE_SIZE; | ||
2386 | |||
2387 | argp->p = (__be32 *)page_address(argp->pagelist[0]); | ||
2388 | + argp->pagelist++; | ||
2389 | argp->end = argp->p + XDR_QUADLEN(PAGE_SIZE); | ||
2390 | } | ||
2391 | argp->p += XDR_QUADLEN(len); | ||
2392 | diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c | ||
2393 | index c827acb0e943..72cb28e73ca0 100644 | ||
2394 | --- a/fs/nfsd/vfs.c | ||
2395 | +++ b/fs/nfsd/vfs.c | ||
2396 | @@ -298,41 +298,12 @@ commit_metadata(struct svc_fh *fhp) | ||
2397 | } | ||
2398 | |||
2399 | /* | ||
2400 | - * Set various file attributes. | ||
2401 | - * N.B. After this call fhp needs an fh_put | ||
2402 | + * Go over the attributes and take care of the small differences between | ||
2403 | + * NFS semantics and what Linux expects. | ||
2404 | */ | ||
2405 | -__be32 | ||
2406 | -nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | ||
2407 | - int check_guard, time_t guardtime) | ||
2408 | +static void | ||
2409 | +nfsd_sanitize_attrs(struct inode *inode, struct iattr *iap) | ||
2410 | { | ||
2411 | - struct dentry *dentry; | ||
2412 | - struct inode *inode; | ||
2413 | - int accmode = NFSD_MAY_SATTR; | ||
2414 | - umode_t ftype = 0; | ||
2415 | - __be32 err; | ||
2416 | - int host_err; | ||
2417 | - int size_change = 0; | ||
2418 | - | ||
2419 | - if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) | ||
2420 | - accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE; | ||
2421 | - if (iap->ia_valid & ATTR_SIZE) | ||
2422 | - ftype = S_IFREG; | ||
2423 | - | ||
2424 | - /* Get inode */ | ||
2425 | - err = fh_verify(rqstp, fhp, ftype, accmode); | ||
2426 | - if (err) | ||
2427 | - goto out; | ||
2428 | - | ||
2429 | - dentry = fhp->fh_dentry; | ||
2430 | - inode = dentry->d_inode; | ||
2431 | - | ||
2432 | - /* Ignore any mode updates on symlinks */ | ||
2433 | - if (S_ISLNK(inode->i_mode)) | ||
2434 | - iap->ia_valid &= ~ATTR_MODE; | ||
2435 | - | ||
2436 | - if (!iap->ia_valid) | ||
2437 | - goto out; | ||
2438 | - | ||
2439 | /* | ||
2440 | * NFSv2 does not differentiate between "set-[ac]time-to-now" | ||
2441 | * which only requires access, and "set-[ac]time-to-X" which | ||
2442 | @@ -342,8 +313,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | ||
2443 | * convert to "set to now" instead of "set to explicit time" | ||
2444 | * | ||
2445 | * We only call inode_change_ok as the last test as technically | ||
2446 | - * it is not an interface that we should be using. It is only | ||
2447 | - * valid if the filesystem does not define it's own i_op->setattr. | ||
2448 | + * it is not an interface that we should be using. | ||
2449 | */ | ||
2450 | #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET) | ||
2451 | #define MAX_TOUCH_TIME_ERROR (30*60) | ||
2452 | @@ -369,30 +339,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | ||
2453 | iap->ia_valid &= ~BOTH_TIME_SET; | ||
2454 | } | ||
2455 | } | ||
2456 | - | ||
2457 | - /* | ||
2458 | - * The size case is special. | ||
2459 | - * It changes the file as well as the attributes. | ||
2460 | - */ | ||
2461 | - if (iap->ia_valid & ATTR_SIZE) { | ||
2462 | - if (iap->ia_size < inode->i_size) { | ||
2463 | - err = nfsd_permission(rqstp, fhp->fh_export, dentry, | ||
2464 | - NFSD_MAY_TRUNC|NFSD_MAY_OWNER_OVERRIDE); | ||
2465 | - if (err) | ||
2466 | - goto out; | ||
2467 | - } | ||
2468 | - | ||
2469 | - host_err = get_write_access(inode); | ||
2470 | - if (host_err) | ||
2471 | - goto out_nfserr; | ||
2472 | - | ||
2473 | - size_change = 1; | ||
2474 | - host_err = locks_verify_truncate(inode, NULL, iap->ia_size); | ||
2475 | - if (host_err) { | ||
2476 | - put_write_access(inode); | ||
2477 | - goto out_nfserr; | ||
2478 | - } | ||
2479 | - } | ||
2480 | |||
2481 | /* sanitize the mode change */ | ||
2482 | if (iap->ia_valid & ATTR_MODE) { | ||
2483 | @@ -415,32 +361,111 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | ||
2484 | iap->ia_valid |= (ATTR_KILL_SUID | ATTR_KILL_SGID); | ||
2485 | } | ||
2486 | } | ||
2487 | +} | ||
2488 | |||
2489 | - /* Change the attributes. */ | ||
2490 | +static __be32 | ||
2491 | +nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp, | ||
2492 | + struct iattr *iap) | ||
2493 | +{ | ||
2494 | + struct inode *inode = fhp->fh_dentry->d_inode; | ||
2495 | + int host_err; | ||
2496 | |||
2497 | - iap->ia_valid |= ATTR_CTIME; | ||
2498 | + if (iap->ia_size < inode->i_size) { | ||
2499 | + __be32 err; | ||
2500 | |||
2501 | - err = nfserr_notsync; | ||
2502 | - if (!check_guard || guardtime == inode->i_ctime.tv_sec) { | ||
2503 | - host_err = nfsd_break_lease(inode); | ||
2504 | - if (host_err) | ||
2505 | - goto out_nfserr; | ||
2506 | - fh_lock(fhp); | ||
2507 | + err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry, | ||
2508 | + NFSD_MAY_TRUNC | NFSD_MAY_OWNER_OVERRIDE); | ||
2509 | + if (err) | ||
2510 | + return err; | ||
2511 | + } | ||
2512 | |||
2513 | - host_err = notify_change(dentry, iap); | ||
2514 | - err = nfserrno(host_err); | ||
2515 | - fh_unlock(fhp); | ||
2516 | + host_err = get_write_access(inode); | ||
2517 | + if (host_err) | ||
2518 | + goto out_nfserrno; | ||
2519 | + | ||
2520 | + host_err = locks_verify_truncate(inode, NULL, iap->ia_size); | ||
2521 | + if (host_err) | ||
2522 | + goto out_put_write_access; | ||
2523 | + return 0; | ||
2524 | + | ||
2525 | +out_put_write_access: | ||
2526 | + put_write_access(inode); | ||
2527 | +out_nfserrno: | ||
2528 | + return nfserrno(host_err); | ||
2529 | +} | ||
2530 | + | ||
2531 | +/* | ||
2532 | + * Set various file attributes. After this call fhp needs an fh_put. | ||
2533 | + */ | ||
2534 | +__be32 | ||
2535 | +nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | ||
2536 | + int check_guard, time_t guardtime) | ||
2537 | +{ | ||
2538 | + struct dentry *dentry; | ||
2539 | + struct inode *inode; | ||
2540 | + int accmode = NFSD_MAY_SATTR; | ||
2541 | + umode_t ftype = 0; | ||
2542 | + __be32 err; | ||
2543 | + int host_err; | ||
2544 | + int size_change = 0; | ||
2545 | + | ||
2546 | + if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) | ||
2547 | + accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE; | ||
2548 | + if (iap->ia_valid & ATTR_SIZE) | ||
2549 | + ftype = S_IFREG; | ||
2550 | + | ||
2551 | + /* Get inode */ | ||
2552 | + err = fh_verify(rqstp, fhp, ftype, accmode); | ||
2553 | + if (err) | ||
2554 | + goto out; | ||
2555 | + | ||
2556 | + dentry = fhp->fh_dentry; | ||
2557 | + inode = dentry->d_inode; | ||
2558 | + | ||
2559 | + /* Ignore any mode updates on symlinks */ | ||
2560 | + if (S_ISLNK(inode->i_mode)) | ||
2561 | + iap->ia_valid &= ~ATTR_MODE; | ||
2562 | + | ||
2563 | + if (!iap->ia_valid) | ||
2564 | + goto out; | ||
2565 | + | ||
2566 | + nfsd_sanitize_attrs(inode, iap); | ||
2567 | + | ||
2568 | + /* | ||
2569 | + * The size case is special, it changes the file in addition to the | ||
2570 | + * attributes. | ||
2571 | + */ | ||
2572 | + if (iap->ia_valid & ATTR_SIZE) { | ||
2573 | + err = nfsd_get_write_access(rqstp, fhp, iap); | ||
2574 | + if (err) | ||
2575 | + goto out; | ||
2576 | + size_change = 1; | ||
2577 | } | ||
2578 | + | ||
2579 | + iap->ia_valid |= ATTR_CTIME; | ||
2580 | + | ||
2581 | + if (check_guard && guardtime != inode->i_ctime.tv_sec) { | ||
2582 | + err = nfserr_notsync; | ||
2583 | + goto out_put_write_access; | ||
2584 | + } | ||
2585 | + | ||
2586 | + host_err = nfsd_break_lease(inode); | ||
2587 | + if (host_err) | ||
2588 | + goto out_put_write_access_nfserror; | ||
2589 | + | ||
2590 | + fh_lock(fhp); | ||
2591 | + host_err = notify_change(dentry, iap); | ||
2592 | + fh_unlock(fhp); | ||
2593 | + | ||
2594 | +out_put_write_access_nfserror: | ||
2595 | + err = nfserrno(host_err); | ||
2596 | +out_put_write_access: | ||
2597 | if (size_change) | ||
2598 | put_write_access(inode); | ||
2599 | if (!err) | ||
2600 | commit_metadata(fhp); | ||
2601 | out: | ||
2602 | return err; | ||
2603 | - | ||
2604 | -out_nfserr: | ||
2605 | - err = nfserrno(host_err); | ||
2606 | - goto out; | ||
2607 | } | ||
2608 | |||
2609 | #if defined(CONFIG_NFSD_V2_ACL) || \ | ||
2610 | diff --git a/fs/xfs/xfs_sb.c b/fs/xfs/xfs_sb.c | ||
2611 | index a5b59d92eb70..039708122038 100644 | ||
2612 | --- a/fs/xfs/xfs_sb.c | ||
2613 | +++ b/fs/xfs/xfs_sb.c | ||
2614 | @@ -596,6 +596,11 @@ xfs_sb_verify( | ||
2615 | * single bit error could clear the feature bit and unused parts of the | ||
2616 | * superblock are supposed to be zero. Hence a non-null crc field indicates that | ||
2617 | * we've potentially lost a feature bit and we should check it anyway. | ||
2618 | + * | ||
2619 | + * However, past bugs (i.e. in growfs) left non-zeroed regions beyond the | ||
2620 | + * last field in V4 secondary superblocks. So for secondary superblocks, | ||
2621 | + * we are more forgiving, and ignore CRC failures if the primary doesn't | ||
2622 | + * indicate that the fs version is V5. | ||
2623 | */ | ||
2624 | static void | ||
2625 | xfs_sb_read_verify( | ||
2626 | @@ -616,8 +621,12 @@ xfs_sb_read_verify( | ||
2627 | |||
2628 | if (!xfs_verify_cksum(bp->b_addr, be16_to_cpu(dsb->sb_sectsize), | ||
2629 | offsetof(struct xfs_sb, sb_crc))) { | ||
2630 | - error = EFSCORRUPTED; | ||
2631 | - goto out_error; | ||
2632 | + /* Only fail bad secondaries on a known V5 filesystem */ | ||
2633 | + if (bp->b_bn != XFS_SB_DADDR && | ||
2634 | + xfs_sb_version_hascrc(&mp->m_sb)) { | ||
2635 | + error = EFSCORRUPTED; | ||
2636 | + goto out_error; | ||
2637 | + } | ||
2638 | } | ||
2639 | } | ||
2640 | error = xfs_sb_verify(bp, true); | ||
2641 | diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h | ||
2642 | index e8112ae50531..7554fd410bcc 100644 | ||
2643 | --- a/include/linux/binfmts.h | ||
2644 | +++ b/include/linux/binfmts.h | ||
2645 | @@ -99,9 +99,6 @@ extern void setup_new_exec(struct linux_binprm * bprm); | ||
2646 | extern void would_dump(struct linux_binprm *, struct file *); | ||
2647 | |||
2648 | extern int suid_dumpable; | ||
2649 | -#define SUID_DUMP_DISABLE 0 /* No setuid dumping */ | ||
2650 | -#define SUID_DUMP_USER 1 /* Dump as user of process */ | ||
2651 | -#define SUID_DUMP_ROOT 2 /* Dump as root */ | ||
2652 | |||
2653 | /* Stack area protections */ | ||
2654 | #define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */ | ||
2655 | diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h | ||
2656 | index e36dee52f224..3859ddbecb5f 100644 | ||
2657 | --- a/include/linux/nfs4.h | ||
2658 | +++ b/include/linux/nfs4.h | ||
2659 | @@ -395,7 +395,7 @@ enum lock_type4 { | ||
2660 | #define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) | ||
2661 | #define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) | ||
2662 | #define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) | ||
2663 | -#define FATTR4_WORD2_SECURITY_LABEL (1UL << 17) | ||
2664 | +#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16) | ||
2665 | |||
2666 | /* MDS threshold bitmap bits */ | ||
2667 | #define THRESHOLD_RD (1UL << 0) | ||
2668 | diff --git a/include/linux/sched.h b/include/linux/sched.h | ||
2669 | index e27baeeda3f4..b1e963efbde8 100644 | ||
2670 | --- a/include/linux/sched.h | ||
2671 | +++ b/include/linux/sched.h | ||
2672 | @@ -322,6 +322,10 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} | ||
2673 | extern void set_dumpable(struct mm_struct *mm, int value); | ||
2674 | extern int get_dumpable(struct mm_struct *mm); | ||
2675 | |||
2676 | +#define SUID_DUMP_DISABLE 0 /* No setuid dumping */ | ||
2677 | +#define SUID_DUMP_USER 1 /* Dump as user of process */ | ||
2678 | +#define SUID_DUMP_ROOT 2 /* Dump as root */ | ||
2679 | + | ||
2680 | /* mm flags */ | ||
2681 | /* dumpable bits */ | ||
2682 | #define MMF_DUMPABLE 0 /* core dump is permitted */ | ||
2683 | @@ -2474,34 +2478,98 @@ static inline int tsk_is_polling(struct task_struct *p) | ||
2684 | { | ||
2685 | return task_thread_info(p)->status & TS_POLLING; | ||
2686 | } | ||
2687 | -static inline void current_set_polling(void) | ||
2688 | +static inline void __current_set_polling(void) | ||
2689 | { | ||
2690 | current_thread_info()->status |= TS_POLLING; | ||
2691 | } | ||
2692 | |||
2693 | -static inline void current_clr_polling(void) | ||
2694 | +static inline bool __must_check current_set_polling_and_test(void) | ||
2695 | +{ | ||
2696 | + __current_set_polling(); | ||
2697 | + | ||
2698 | + /* | ||
2699 | + * Polling state must be visible before we test NEED_RESCHED, | ||
2700 | + * paired by resched_task() | ||
2701 | + */ | ||
2702 | + smp_mb(); | ||
2703 | + | ||
2704 | + return unlikely(tif_need_resched()); | ||
2705 | +} | ||
2706 | + | ||
2707 | +static inline void __current_clr_polling(void) | ||
2708 | { | ||
2709 | current_thread_info()->status &= ~TS_POLLING; | ||
2710 | - smp_mb__after_clear_bit(); | ||
2711 | +} | ||
2712 | + | ||
2713 | +static inline bool __must_check current_clr_polling_and_test(void) | ||
2714 | +{ | ||
2715 | + __current_clr_polling(); | ||
2716 | + | ||
2717 | + /* | ||
2718 | + * Polling state must be visible before we test NEED_RESCHED, | ||
2719 | + * paired by resched_task() | ||
2720 | + */ | ||
2721 | + smp_mb(); | ||
2722 | + | ||
2723 | + return unlikely(tif_need_resched()); | ||
2724 | } | ||
2725 | #elif defined(TIF_POLLING_NRFLAG) | ||
2726 | static inline int tsk_is_polling(struct task_struct *p) | ||
2727 | { | ||
2728 | return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG); | ||
2729 | } | ||
2730 | -static inline void current_set_polling(void) | ||
2731 | + | ||
2732 | +static inline void __current_set_polling(void) | ||
2733 | { | ||
2734 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
2735 | } | ||
2736 | |||
2737 | -static inline void current_clr_polling(void) | ||
2738 | +static inline bool __must_check current_set_polling_and_test(void) | ||
2739 | +{ | ||
2740 | + __current_set_polling(); | ||
2741 | + | ||
2742 | + /* | ||
2743 | + * Polling state must be visible before we test NEED_RESCHED, | ||
2744 | + * paired by resched_task() | ||
2745 | + * | ||
2746 | + * XXX: assumes set/clear bit are identical barrier wise. | ||
2747 | + */ | ||
2748 | + smp_mb__after_clear_bit(); | ||
2749 | + | ||
2750 | + return unlikely(tif_need_resched()); | ||
2751 | +} | ||
2752 | + | ||
2753 | +static inline void __current_clr_polling(void) | ||
2754 | { | ||
2755 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
2756 | } | ||
2757 | + | ||
2758 | +static inline bool __must_check current_clr_polling_and_test(void) | ||
2759 | +{ | ||
2760 | + __current_clr_polling(); | ||
2761 | + | ||
2762 | + /* | ||
2763 | + * Polling state must be visible before we test NEED_RESCHED, | ||
2764 | + * paired by resched_task() | ||
2765 | + */ | ||
2766 | + smp_mb__after_clear_bit(); | ||
2767 | + | ||
2768 | + return unlikely(tif_need_resched()); | ||
2769 | +} | ||
2770 | + | ||
2771 | #else | ||
2772 | static inline int tsk_is_polling(struct task_struct *p) { return 0; } | ||
2773 | -static inline void current_set_polling(void) { } | ||
2774 | -static inline void current_clr_polling(void) { } | ||
2775 | +static inline void __current_set_polling(void) { } | ||
2776 | +static inline void __current_clr_polling(void) { } | ||
2777 | + | ||
2778 | +static inline bool __must_check current_set_polling_and_test(void) | ||
2779 | +{ | ||
2780 | + return unlikely(tif_need_resched()); | ||
2781 | +} | ||
2782 | +static inline bool __must_check current_clr_polling_and_test(void) | ||
2783 | +{ | ||
2784 | + return unlikely(tif_need_resched()); | ||
2785 | +} | ||
2786 | #endif | ||
2787 | |||
2788 | /* | ||
2789 | diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h | ||
2790 | index e7e04736802f..4ae6f32c8033 100644 | ||
2791 | --- a/include/linux/thread_info.h | ||
2792 | +++ b/include/linux/thread_info.h | ||
2793 | @@ -107,6 +107,8 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag) | ||
2794 | #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) | ||
2795 | #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) | ||
2796 | |||
2797 | +#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) | ||
2798 | + | ||
2799 | #if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK | ||
2800 | /* | ||
2801 | * An arch can define its own version of set_restore_sigmask() to get the | ||
2802 | diff --git a/include/linux/usb.h b/include/linux/usb.h | ||
2803 | index 001629cd1a97..39cfa0aca91f 100644 | ||
2804 | --- a/include/linux/usb.h | ||
2805 | +++ b/include/linux/usb.h | ||
2806 | @@ -475,7 +475,8 @@ struct usb3_lpm_parameters { | ||
2807 | * @lpm_capable: device supports LPM | ||
2808 | * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM | ||
2809 | * @usb2_hw_lpm_besl_capable: device can perform USB2 hardware BESL LPM | ||
2810 | - * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled | ||
2811 | + * @usb2_hw_lpm_enabled: USB2 hardware LPM is enabled | ||
2812 | + * @usb2_hw_lpm_allowed: Userspace allows USB 2.0 LPM to be enabled | ||
2813 | * @usb3_lpm_enabled: USB3 hardware LPM enabled | ||
2814 | * @string_langid: language ID for strings | ||
2815 | * @product: iProduct string, if present (static) | ||
2816 | @@ -548,6 +549,7 @@ struct usb_device { | ||
2817 | unsigned usb2_hw_lpm_capable:1; | ||
2818 | unsigned usb2_hw_lpm_besl_capable:1; | ||
2819 | unsigned usb2_hw_lpm_enabled:1; | ||
2820 | + unsigned usb2_hw_lpm_allowed:1; | ||
2821 | unsigned usb3_lpm_enabled:1; | ||
2822 | int string_langid; | ||
2823 | |||
2824 | diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h | ||
2825 | index 9031a26249b5..ae6c3b8ed2f5 100644 | ||
2826 | --- a/include/sound/compress_driver.h | ||
2827 | +++ b/include/sound/compress_driver.h | ||
2828 | @@ -171,4 +171,13 @@ static inline void snd_compr_fragment_elapsed(struct snd_compr_stream *stream) | ||
2829 | wake_up(&stream->runtime->sleep); | ||
2830 | } | ||
2831 | |||
2832 | +static inline void snd_compr_drain_notify(struct snd_compr_stream *stream) | ||
2833 | +{ | ||
2834 | + if (snd_BUG_ON(!stream)) | ||
2835 | + return; | ||
2836 | + | ||
2837 | + stream->runtime->state = SNDRV_PCM_STATE_SETUP; | ||
2838 | + wake_up(&stream->runtime->sleep); | ||
2839 | +} | ||
2840 | + | ||
2841 | #endif | ||
2842 | diff --git a/ipc/shm.c b/ipc/shm.c | ||
2843 | index d69739610fd4..7a51443a51d6 100644 | ||
2844 | --- a/ipc/shm.c | ||
2845 | +++ b/ipc/shm.c | ||
2846 | @@ -208,15 +208,18 @@ static void shm_open(struct vm_area_struct *vma) | ||
2847 | */ | ||
2848 | static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp) | ||
2849 | { | ||
2850 | + struct file *shm_file; | ||
2851 | + | ||
2852 | + shm_file = shp->shm_file; | ||
2853 | + shp->shm_file = NULL; | ||
2854 | ns->shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
2855 | shm_rmid(ns, shp); | ||
2856 | shm_unlock(shp); | ||
2857 | - if (!is_file_hugepages(shp->shm_file)) | ||
2858 | - shmem_lock(shp->shm_file, 0, shp->mlock_user); | ||
2859 | + if (!is_file_hugepages(shm_file)) | ||
2860 | + shmem_lock(shm_file, 0, shp->mlock_user); | ||
2861 | else if (shp->mlock_user) | ||
2862 | - user_shm_unlock(file_inode(shp->shm_file)->i_size, | ||
2863 | - shp->mlock_user); | ||
2864 | - fput (shp->shm_file); | ||
2865 | + user_shm_unlock(file_inode(shm_file)->i_size, shp->mlock_user); | ||
2866 | + fput(shm_file); | ||
2867 | ipc_rcu_putref(shp, shm_rcu_free); | ||
2868 | } | ||
2869 | |||
2870 | @@ -974,15 +977,25 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf) | ||
2871 | ipc_lock_object(&shp->shm_perm); | ||
2872 | if (!ns_capable(ns->user_ns, CAP_IPC_LOCK)) { | ||
2873 | kuid_t euid = current_euid(); | ||
2874 | - err = -EPERM; | ||
2875 | if (!uid_eq(euid, shp->shm_perm.uid) && | ||
2876 | - !uid_eq(euid, shp->shm_perm.cuid)) | ||
2877 | + !uid_eq(euid, shp->shm_perm.cuid)) { | ||
2878 | + err = -EPERM; | ||
2879 | goto out_unlock0; | ||
2880 | - if (cmd == SHM_LOCK && !rlimit(RLIMIT_MEMLOCK)) | ||
2881 | + } | ||
2882 | + if (cmd == SHM_LOCK && !rlimit(RLIMIT_MEMLOCK)) { | ||
2883 | + err = -EPERM; | ||
2884 | goto out_unlock0; | ||
2885 | + } | ||
2886 | } | ||
2887 | |||
2888 | shm_file = shp->shm_file; | ||
2889 | + | ||
2890 | + /* check if shm_destroy() is tearing down shp */ | ||
2891 | + if (shm_file == NULL) { | ||
2892 | + err = -EIDRM; | ||
2893 | + goto out_unlock0; | ||
2894 | + } | ||
2895 | + | ||
2896 | if (is_file_hugepages(shm_file)) | ||
2897 | goto out_unlock0; | ||
2898 | |||
2899 | @@ -1101,6 +1114,14 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr, | ||
2900 | goto out_unlock; | ||
2901 | |||
2902 | ipc_lock_object(&shp->shm_perm); | ||
2903 | + | ||
2904 | + /* check if shm_destroy() is tearing down shp */ | ||
2905 | + if (shp->shm_file == NULL) { | ||
2906 | + ipc_unlock_object(&shp->shm_perm); | ||
2907 | + err = -EIDRM; | ||
2908 | + goto out_unlock; | ||
2909 | + } | ||
2910 | + | ||
2911 | path = shp->shm_file->f_path; | ||
2912 | path_get(&path); | ||
2913 | shp->shm_nattch++; | ||
2914 | diff --git a/kernel/cpu/idle.c b/kernel/cpu/idle.c | ||
2915 | index e695c0a0bcb5..c261409500e4 100644 | ||
2916 | --- a/kernel/cpu/idle.c | ||
2917 | +++ b/kernel/cpu/idle.c | ||
2918 | @@ -44,7 +44,7 @@ static inline int cpu_idle_poll(void) | ||
2919 | rcu_idle_enter(); | ||
2920 | trace_cpu_idle_rcuidle(0, smp_processor_id()); | ||
2921 | local_irq_enable(); | ||
2922 | - while (!need_resched()) | ||
2923 | + while (!tif_need_resched()) | ||
2924 | cpu_relax(); | ||
2925 | trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id()); | ||
2926 | rcu_idle_exit(); | ||
2927 | @@ -92,8 +92,7 @@ static void cpu_idle_loop(void) | ||
2928 | if (cpu_idle_force_poll || tick_check_broadcast_expired()) { | ||
2929 | cpu_idle_poll(); | ||
2930 | } else { | ||
2931 | - current_clr_polling(); | ||
2932 | - if (!need_resched()) { | ||
2933 | + if (!current_clr_polling_and_test()) { | ||
2934 | stop_critical_timings(); | ||
2935 | rcu_idle_enter(); | ||
2936 | arch_cpu_idle(); | ||
2937 | @@ -103,7 +102,7 @@ static void cpu_idle_loop(void) | ||
2938 | } else { | ||
2939 | local_irq_enable(); | ||
2940 | } | ||
2941 | - current_set_polling(); | ||
2942 | + __current_set_polling(); | ||
2943 | } | ||
2944 | arch_cpu_idle_exit(); | ||
2945 | } | ||
2946 | @@ -129,7 +128,7 @@ void cpu_startup_entry(enum cpuhp_state state) | ||
2947 | */ | ||
2948 | boot_init_stack_canary(); | ||
2949 | #endif | ||
2950 | - current_set_polling(); | ||
2951 | + __current_set_polling(); | ||
2952 | arch_cpu_idle_prepare(); | ||
2953 | cpu_idle_loop(); | ||
2954 | } | ||
2955 | diff --git a/kernel/ptrace.c b/kernel/ptrace.c | ||
2956 | index dd562e9aa2c8..1f4bcb3cc21c 100644 | ||
2957 | --- a/kernel/ptrace.c | ||
2958 | +++ b/kernel/ptrace.c | ||
2959 | @@ -257,7 +257,8 @@ ok: | ||
2960 | if (task->mm) | ||
2961 | dumpable = get_dumpable(task->mm); | ||
2962 | rcu_read_lock(); | ||
2963 | - if (!dumpable && !ptrace_has_cap(__task_cred(task)->user_ns, mode)) { | ||
2964 | + if (dumpable != SUID_DUMP_USER && | ||
2965 | + !ptrace_has_cap(__task_cred(task)->user_ns, mode)) { | ||
2966 | rcu_read_unlock(); | ||
2967 | return -EPERM; | ||
2968 | } | ||
2969 | diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c | ||
2970 | index 80c36bcf66e8..78e27e3b52ac 100644 | ||
2971 | --- a/kernel/trace/trace_event_perf.c | ||
2972 | +++ b/kernel/trace/trace_event_perf.c | ||
2973 | @@ -26,7 +26,7 @@ static int perf_trace_event_perm(struct ftrace_event_call *tp_event, | ||
2974 | { | ||
2975 | /* The ftrace function trace is allowed only for root. */ | ||
2976 | if (ftrace_event_is_function(tp_event) && | ||
2977 | - perf_paranoid_kernel() && !capable(CAP_SYS_ADMIN)) | ||
2978 | + perf_paranoid_tracepoint_raw() && !capable(CAP_SYS_ADMIN)) | ||
2979 | return -EPERM; | ||
2980 | |||
2981 | /* No tracing, just counting, so no obvious leak */ | ||
2982 | diff --git a/mm/slub.c b/mm/slub.c | ||
2983 | index c3eb3d3ca835..96f21691b67c 100644 | ||
2984 | --- a/mm/slub.c | ||
2985 | +++ b/mm/slub.c | ||
2986 | @@ -1217,8 +1217,8 @@ static unsigned long kmem_cache_flags(unsigned long object_size, | ||
2987 | /* | ||
2988 | * Enable debugging if selected on the kernel commandline. | ||
2989 | */ | ||
2990 | - if (slub_debug && (!slub_debug_slabs || | ||
2991 | - !strncmp(slub_debug_slabs, name, strlen(slub_debug_slabs)))) | ||
2992 | + if (slub_debug && (!slub_debug_slabs || (name && | ||
2993 | + !strncmp(slub_debug_slabs, name, strlen(slub_debug_slabs))))) | ||
2994 | flags |= slub_debug; | ||
2995 | |||
2996 | return flags; | ||
2997 | diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c | ||
2998 | index 084656671d6e..cc24323d3045 100644 | ||
2999 | --- a/net/sunrpc/auth_gss/auth_gss.c | ||
3000 | +++ b/net/sunrpc/auth_gss/auth_gss.c | ||
3001 | @@ -482,6 +482,7 @@ gss_alloc_msg(struct gss_auth *gss_auth, | ||
3002 | switch (vers) { | ||
3003 | case 0: | ||
3004 | gss_encode_v0_msg(gss_msg); | ||
3005 | + break; | ||
3006 | default: | ||
3007 | gss_encode_v1_msg(gss_msg, service_name, gss_auth->target_name); | ||
3008 | }; | ||
3009 | diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c | ||
3010 | index 77479606a971..941d19f8c999 100644 | ||
3011 | --- a/net/sunrpc/clnt.c | ||
3012 | +++ b/net/sunrpc/clnt.c | ||
3013 | @@ -656,14 +656,16 @@ EXPORT_SYMBOL_GPL(rpc_shutdown_client); | ||
3014 | /* | ||
3015 | * Free an RPC client | ||
3016 | */ | ||
3017 | -static void | ||
3018 | +static struct rpc_clnt * | ||
3019 | rpc_free_client(struct rpc_clnt *clnt) | ||
3020 | { | ||
3021 | + struct rpc_clnt *parent = NULL; | ||
3022 | + | ||
3023 | dprintk_rcu("RPC: destroying %s client for %s\n", | ||
3024 | clnt->cl_program->name, | ||
3025 | rcu_dereference(clnt->cl_xprt)->servername); | ||
3026 | if (clnt->cl_parent != clnt) | ||
3027 | - rpc_release_client(clnt->cl_parent); | ||
3028 | + parent = clnt->cl_parent; | ||
3029 | rpc_clnt_remove_pipedir(clnt); | ||
3030 | rpc_unregister_client(clnt); | ||
3031 | rpc_free_iostats(clnt->cl_metrics); | ||
3032 | @@ -672,18 +674,17 @@ rpc_free_client(struct rpc_clnt *clnt) | ||
3033 | rpciod_down(); | ||
3034 | rpc_free_clid(clnt); | ||
3035 | kfree(clnt); | ||
3036 | + return parent; | ||
3037 | } | ||
3038 | |||
3039 | /* | ||
3040 | * Free an RPC client | ||
3041 | */ | ||
3042 | -static void | ||
3043 | +static struct rpc_clnt * | ||
3044 | rpc_free_auth(struct rpc_clnt *clnt) | ||
3045 | { | ||
3046 | - if (clnt->cl_auth == NULL) { | ||
3047 | - rpc_free_client(clnt); | ||
3048 | - return; | ||
3049 | - } | ||
3050 | + if (clnt->cl_auth == NULL) | ||
3051 | + return rpc_free_client(clnt); | ||
3052 | |||
3053 | /* | ||
3054 | * Note: RPCSEC_GSS may need to send NULL RPC calls in order to | ||
3055 | @@ -694,7 +695,8 @@ rpc_free_auth(struct rpc_clnt *clnt) | ||
3056 | rpcauth_release(clnt->cl_auth); | ||
3057 | clnt->cl_auth = NULL; | ||
3058 | if (atomic_dec_and_test(&clnt->cl_count)) | ||
3059 | - rpc_free_client(clnt); | ||
3060 | + return rpc_free_client(clnt); | ||
3061 | + return NULL; | ||
3062 | } | ||
3063 | |||
3064 | /* | ||
3065 | @@ -705,10 +707,13 @@ rpc_release_client(struct rpc_clnt *clnt) | ||
3066 | { | ||
3067 | dprintk("RPC: rpc_release_client(%p)\n", clnt); | ||
3068 | |||
3069 | - if (list_empty(&clnt->cl_tasks)) | ||
3070 | - wake_up(&destroy_wait); | ||
3071 | - if (atomic_dec_and_test(&clnt->cl_count)) | ||
3072 | - rpc_free_auth(clnt); | ||
3073 | + do { | ||
3074 | + if (list_empty(&clnt->cl_tasks)) | ||
3075 | + wake_up(&destroy_wait); | ||
3076 | + if (!atomic_dec_and_test(&clnt->cl_count)) | ||
3077 | + break; | ||
3078 | + clnt = rpc_free_auth(clnt); | ||
3079 | + } while (clnt != NULL); | ||
3080 | } | ||
3081 | EXPORT_SYMBOL_GPL(rpc_release_client); | ||
3082 | |||
3083 | diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c | ||
3084 | index ee03d35677d9..b752e1de2e7d 100644 | ||
3085 | --- a/net/sunrpc/xprtsock.c | ||
3086 | +++ b/net/sunrpc/xprtsock.c | ||
3087 | @@ -393,8 +393,10 @@ static int xs_send_kvec(struct socket *sock, struct sockaddr *addr, int addrlen, | ||
3088 | return kernel_sendmsg(sock, &msg, NULL, 0, 0); | ||
3089 | } | ||
3090 | |||
3091 | -static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned int base, int more) | ||
3092 | +static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned int base, int more, bool zerocopy) | ||
3093 | { | ||
3094 | + ssize_t (*do_sendpage)(struct socket *sock, struct page *page, | ||
3095 | + int offset, size_t size, int flags); | ||
3096 | struct page **ppage; | ||
3097 | unsigned int remainder; | ||
3098 | int err, sent = 0; | ||
3099 | @@ -403,6 +405,9 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned i | ||
3100 | base += xdr->page_base; | ||
3101 | ppage = xdr->pages + (base >> PAGE_SHIFT); | ||
3102 | base &= ~PAGE_MASK; | ||
3103 | + do_sendpage = sock->ops->sendpage; | ||
3104 | + if (!zerocopy) | ||
3105 | + do_sendpage = sock_no_sendpage; | ||
3106 | for(;;) { | ||
3107 | unsigned int len = min_t(unsigned int, PAGE_SIZE - base, remainder); | ||
3108 | int flags = XS_SENDMSG_FLAGS; | ||
3109 | @@ -410,7 +415,7 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned i | ||
3110 | remainder -= len; | ||
3111 | if (remainder != 0 || more) | ||
3112 | flags |= MSG_MORE; | ||
3113 | - err = sock->ops->sendpage(sock, *ppage, base, len, flags); | ||
3114 | + err = do_sendpage(sock, *ppage, base, len, flags); | ||
3115 | if (remainder == 0 || err != len) | ||
3116 | break; | ||
3117 | sent += err; | ||
3118 | @@ -431,9 +436,10 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned i | ||
3119 | * @addrlen: UDP only -- length of destination address | ||
3120 | * @xdr: buffer containing this request | ||
3121 | * @base: starting position in the buffer | ||
3122 | + * @zerocopy: true if it is safe to use sendpage() | ||
3123 | * | ||
3124 | */ | ||
3125 | -static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen, struct xdr_buf *xdr, unsigned int base) | ||
3126 | +static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen, struct xdr_buf *xdr, unsigned int base, bool zerocopy) | ||
3127 | { | ||
3128 | unsigned int remainder = xdr->len - base; | ||
3129 | int err, sent = 0; | ||
3130 | @@ -461,7 +467,7 @@ static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen, | ||
3131 | if (base < xdr->page_len) { | ||
3132 | unsigned int len = xdr->page_len - base; | ||
3133 | remainder -= len; | ||
3134 | - err = xs_send_pagedata(sock, xdr, base, remainder != 0); | ||
3135 | + err = xs_send_pagedata(sock, xdr, base, remainder != 0, zerocopy); | ||
3136 | if (remainder == 0 || err != len) | ||
3137 | goto out; | ||
3138 | sent += err; | ||
3139 | @@ -564,7 +570,7 @@ static int xs_local_send_request(struct rpc_task *task) | ||
3140 | req->rq_svec->iov_base, req->rq_svec->iov_len); | ||
3141 | |||
3142 | status = xs_sendpages(transport->sock, NULL, 0, | ||
3143 | - xdr, req->rq_bytes_sent); | ||
3144 | + xdr, req->rq_bytes_sent, true); | ||
3145 | dprintk("RPC: %s(%u) = %d\n", | ||
3146 | __func__, xdr->len - req->rq_bytes_sent, status); | ||
3147 | if (likely(status >= 0)) { | ||
3148 | @@ -620,7 +626,7 @@ static int xs_udp_send_request(struct rpc_task *task) | ||
3149 | status = xs_sendpages(transport->sock, | ||
3150 | xs_addr(xprt), | ||
3151 | xprt->addrlen, xdr, | ||
3152 | - req->rq_bytes_sent); | ||
3153 | + req->rq_bytes_sent, true); | ||
3154 | |||
3155 | dprintk("RPC: xs_udp_send_request(%u) = %d\n", | ||
3156 | xdr->len - req->rq_bytes_sent, status); | ||
3157 | @@ -693,6 +699,7 @@ static int xs_tcp_send_request(struct rpc_task *task) | ||
3158 | struct rpc_xprt *xprt = req->rq_xprt; | ||
3159 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); | ||
3160 | struct xdr_buf *xdr = &req->rq_snd_buf; | ||
3161 | + bool zerocopy = true; | ||
3162 | int status; | ||
3163 | |||
3164 | xs_encode_stream_record_marker(&req->rq_snd_buf); | ||
3165 | @@ -700,13 +707,20 @@ static int xs_tcp_send_request(struct rpc_task *task) | ||
3166 | xs_pktdump("packet data:", | ||
3167 | req->rq_svec->iov_base, | ||
3168 | req->rq_svec->iov_len); | ||
3169 | + /* Don't use zero copy if this is a resend. If the RPC call | ||
3170 | + * completes while the socket holds a reference to the pages, | ||
3171 | + * then we may end up resending corrupted data. | ||
3172 | + */ | ||
3173 | + if (task->tk_flags & RPC_TASK_SENT) | ||
3174 | + zerocopy = false; | ||
3175 | |||
3176 | /* Continue transmitting the packet/record. We must be careful | ||
3177 | * to cope with writespace callbacks arriving _after_ we have | ||
3178 | * called sendmsg(). */ | ||
3179 | while (1) { | ||
3180 | status = xs_sendpages(transport->sock, | ||
3181 | - NULL, 0, xdr, req->rq_bytes_sent); | ||
3182 | + NULL, 0, xdr, req->rq_bytes_sent, | ||
3183 | + zerocopy); | ||
3184 | |||
3185 | dprintk("RPC: xs_tcp_send_request(%u) = %d\n", | ||
3186 | xdr->len - req->rq_bytes_sent, status); | ||
3187 | diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c | ||
3188 | index 399433ad614e..a9c3d3cd1990 100644 | ||
3189 | --- a/security/integrity/ima/ima_policy.c | ||
3190 | +++ b/security/integrity/ima/ima_policy.c | ||
3191 | @@ -73,7 +73,6 @@ static struct ima_rule_entry default_rules[] = { | ||
3192 | {.action = DONT_MEASURE,.fsmagic = SYSFS_MAGIC,.flags = IMA_FSMAGIC}, | ||
3193 | {.action = DONT_MEASURE,.fsmagic = DEBUGFS_MAGIC,.flags = IMA_FSMAGIC}, | ||
3194 | {.action = DONT_MEASURE,.fsmagic = TMPFS_MAGIC,.flags = IMA_FSMAGIC}, | ||
3195 | - {.action = DONT_MEASURE,.fsmagic = RAMFS_MAGIC,.flags = IMA_FSMAGIC}, | ||
3196 | {.action = DONT_MEASURE,.fsmagic = DEVPTS_SUPER_MAGIC,.flags = IMA_FSMAGIC}, | ||
3197 | {.action = DONT_MEASURE,.fsmagic = BINFMTFS_MAGIC,.flags = IMA_FSMAGIC}, | ||
3198 | {.action = DONT_MEASURE,.fsmagic = SECURITYFS_MAGIC,.flags = IMA_FSMAGIC}, | ||
3199 | diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c | ||
3200 | index bea523a5d852..d9af6387f37c 100644 | ||
3201 | --- a/sound/core/compress_offload.c | ||
3202 | +++ b/sound/core/compress_offload.c | ||
3203 | @@ -680,14 +680,48 @@ static int snd_compr_stop(struct snd_compr_stream *stream) | ||
3204 | return -EPERM; | ||
3205 | retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP); | ||
3206 | if (!retval) { | ||
3207 | - stream->runtime->state = SNDRV_PCM_STATE_SETUP; | ||
3208 | - wake_up(&stream->runtime->sleep); | ||
3209 | + snd_compr_drain_notify(stream); | ||
3210 | stream->runtime->total_bytes_available = 0; | ||
3211 | stream->runtime->total_bytes_transferred = 0; | ||
3212 | } | ||
3213 | return retval; | ||
3214 | } | ||
3215 | |||
3216 | +static int snd_compress_wait_for_drain(struct snd_compr_stream *stream) | ||
3217 | +{ | ||
3218 | + int ret; | ||
3219 | + | ||
3220 | + /* | ||
3221 | + * We are called with lock held. So drop the lock while we wait for | ||
3222 | + * drain complete notfication from the driver | ||
3223 | + * | ||
3224 | + * It is expected that driver will notify the drain completion and then | ||
3225 | + * stream will be moved to SETUP state, even if draining resulted in an | ||
3226 | + * error. We can trigger next track after this. | ||
3227 | + */ | ||
3228 | + stream->runtime->state = SNDRV_PCM_STATE_DRAINING; | ||
3229 | + mutex_unlock(&stream->device->lock); | ||
3230 | + | ||
3231 | + /* we wait for drain to complete here, drain can return when | ||
3232 | + * interruption occurred, wait returned error or success. | ||
3233 | + * For the first two cases we don't do anything different here and | ||
3234 | + * return after waking up | ||
3235 | + */ | ||
3236 | + | ||
3237 | + ret = wait_event_interruptible(stream->runtime->sleep, | ||
3238 | + (stream->runtime->state != SNDRV_PCM_STATE_DRAINING)); | ||
3239 | + if (ret == -ERESTARTSYS) | ||
3240 | + pr_debug("wait aborted by a signal"); | ||
3241 | + else if (ret) | ||
3242 | + pr_debug("wait for drain failed with %d\n", ret); | ||
3243 | + | ||
3244 | + | ||
3245 | + wake_up(&stream->runtime->sleep); | ||
3246 | + mutex_lock(&stream->device->lock); | ||
3247 | + | ||
3248 | + return ret; | ||
3249 | +} | ||
3250 | + | ||
3251 | static int snd_compr_drain(struct snd_compr_stream *stream) | ||
3252 | { | ||
3253 | int retval; | ||
3254 | @@ -695,12 +729,15 @@ static int snd_compr_drain(struct snd_compr_stream *stream) | ||
3255 | if (stream->runtime->state == SNDRV_PCM_STATE_PREPARED || | ||
3256 | stream->runtime->state == SNDRV_PCM_STATE_SETUP) | ||
3257 | return -EPERM; | ||
3258 | + | ||
3259 | retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_DRAIN); | ||
3260 | - if (!retval) { | ||
3261 | - stream->runtime->state = SNDRV_PCM_STATE_DRAINING; | ||
3262 | + if (retval) { | ||
3263 | + pr_debug("SND_COMPR_TRIGGER_DRAIN failed %d\n", retval); | ||
3264 | wake_up(&stream->runtime->sleep); | ||
3265 | + return retval; | ||
3266 | } | ||
3267 | - return retval; | ||
3268 | + | ||
3269 | + return snd_compress_wait_for_drain(stream); | ||
3270 | } | ||
3271 | |||
3272 | static int snd_compr_next_track(struct snd_compr_stream *stream) | ||
3273 | @@ -736,9 +773,14 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream) | ||
3274 | return -EPERM; | ||
3275 | |||
3276 | retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_PARTIAL_DRAIN); | ||
3277 | + if (retval) { | ||
3278 | + pr_debug("Partial drain returned failure\n"); | ||
3279 | + wake_up(&stream->runtime->sleep); | ||
3280 | + return retval; | ||
3281 | + } | ||
3282 | |||
3283 | stream->next_track = false; | ||
3284 | - return retval; | ||
3285 | + return snd_compress_wait_for_drain(stream); | ||
3286 | } | ||
3287 | |||
3288 | static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg) | ||
3289 | diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c | ||
3290 | index 1c19cd7ad26e..83b8a9a9163e 100644 | ||
3291 | --- a/sound/drivers/pcsp/pcsp.c | ||
3292 | +++ b/sound/drivers/pcsp/pcsp.c | ||
3293 | @@ -187,8 +187,8 @@ static int pcsp_probe(struct platform_device *dev) | ||
3294 | static int pcsp_remove(struct platform_device *dev) | ||
3295 | { | ||
3296 | struct snd_pcsp *chip = platform_get_drvdata(dev); | ||
3297 | - alsa_card_pcsp_exit(chip); | ||
3298 | pcspkr_input_remove(chip->input_dev); | ||
3299 | + alsa_card_pcsp_exit(chip); | ||
3300 | return 0; | ||
3301 | } | ||
3302 | |||
3303 | diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c | ||
3304 | index 81aeb934261a..0a90bd6ae232 100644 | ||
3305 | --- a/sound/isa/msnd/msnd_pinnacle.c | ||
3306 | +++ b/sound/isa/msnd/msnd_pinnacle.c | ||
3307 | @@ -73,9 +73,11 @@ | ||
3308 | #ifdef MSND_CLASSIC | ||
3309 | # include "msnd_classic.h" | ||
3310 | # define LOGNAME "msnd_classic" | ||
3311 | +# define DEV_NAME "msnd-classic" | ||
3312 | #else | ||
3313 | # include "msnd_pinnacle.h" | ||
3314 | # define LOGNAME "snd_msnd_pinnacle" | ||
3315 | +# define DEV_NAME "msnd-pinnacle" | ||
3316 | #endif | ||
3317 | |||
3318 | static void set_default_audio_parameters(struct snd_msnd *chip) | ||
3319 | @@ -1067,8 +1069,6 @@ static int snd_msnd_isa_remove(struct device *pdev, unsigned int dev) | ||
3320 | return 0; | ||
3321 | } | ||
3322 | |||
3323 | -#define DEV_NAME "msnd-pinnacle" | ||
3324 | - | ||
3325 | static struct isa_driver snd_msnd_driver = { | ||
3326 | .match = snd_msnd_isa_match, | ||
3327 | .probe = snd_msnd_isa_probe, | ||
3328 | diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c | ||
3329 | index 748c6a941963..e938a68625ea 100644 | ||
3330 | --- a/sound/pci/hda/hda_codec.c | ||
3331 | +++ b/sound/pci/hda/hda_codec.c | ||
3332 | @@ -2579,9 +2579,6 @@ int snd_hda_codec_reset(struct hda_codec *codec) | ||
3333 | cancel_delayed_work_sync(&codec->jackpoll_work); | ||
3334 | #ifdef CONFIG_PM | ||
3335 | cancel_delayed_work_sync(&codec->power_work); | ||
3336 | - codec->power_on = 0; | ||
3337 | - codec->power_transition = 0; | ||
3338 | - codec->power_jiffies = jiffies; | ||
3339 | flush_workqueue(bus->workq); | ||
3340 | #endif | ||
3341 | snd_hda_ctls_clear(codec); | ||
3342 | @@ -3991,6 +3988,10 @@ static void hda_call_codec_resume(struct hda_codec *codec) | ||
3343 | * in the resume / power-save sequence | ||
3344 | */ | ||
3345 | hda_keep_power_on(codec); | ||
3346 | + if (codec->pm_down_notified) { | ||
3347 | + codec->pm_down_notified = 0; | ||
3348 | + hda_call_pm_notify(codec->bus, true); | ||
3349 | + } | ||
3350 | hda_set_power_state(codec, AC_PWRST_D0); | ||
3351 | restore_shutup_pins(codec); | ||
3352 | hda_exec_init_verbs(codec); | ||
3353 | diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c | ||
3354 | index b7c89dff7066..3067ed4fe3b2 100644 | ||
3355 | --- a/sound/pci/hda/hda_generic.c | ||
3356 | +++ b/sound/pci/hda/hda_generic.c | ||
3357 | @@ -549,11 +549,15 @@ static hda_nid_t look_for_out_mute_nid(struct hda_codec *codec, | ||
3358 | static hda_nid_t look_for_out_vol_nid(struct hda_codec *codec, | ||
3359 | struct nid_path *path) | ||
3360 | { | ||
3361 | + struct hda_gen_spec *spec = codec->spec; | ||
3362 | int i; | ||
3363 | |||
3364 | for (i = path->depth - 1; i >= 0; i--) { | ||
3365 | - if (nid_has_volume(codec, path->path[i], HDA_OUTPUT)) | ||
3366 | - return path->path[i]; | ||
3367 | + hda_nid_t nid = path->path[i]; | ||
3368 | + if ((spec->out_vol_mask >> nid) & 1) | ||
3369 | + continue; | ||
3370 | + if (nid_has_volume(codec, nid, HDA_OUTPUT)) | ||
3371 | + return nid; | ||
3372 | } | ||
3373 | return 0; | ||
3374 | } | ||
3375 | @@ -792,10 +796,10 @@ static void set_pin_eapd(struct hda_codec *codec, hda_nid_t pin, bool enable) | ||
3376 | if (spec->own_eapd_ctl || | ||
3377 | !(snd_hda_query_pin_caps(codec, pin) & AC_PINCAP_EAPD)) | ||
3378 | return; | ||
3379 | - if (codec->inv_eapd) | ||
3380 | - enable = !enable; | ||
3381 | if (spec->keep_eapd_on && !enable) | ||
3382 | return; | ||
3383 | + if (codec->inv_eapd) | ||
3384 | + enable = !enable; | ||
3385 | snd_hda_codec_update_cache(codec, pin, 0, | ||
3386 | AC_VERB_SET_EAPD_BTLENABLE, | ||
3387 | enable ? 0x02 : 0x00); | ||
3388 | diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h | ||
3389 | index 48d44026705b..7e45cb44d151 100644 | ||
3390 | --- a/sound/pci/hda/hda_generic.h | ||
3391 | +++ b/sound/pci/hda/hda_generic.h | ||
3392 | @@ -242,6 +242,9 @@ struct hda_gen_spec { | ||
3393 | /* additional mute flags (only effective with auto_mute_via_amp=1) */ | ||
3394 | u64 mute_bits; | ||
3395 | |||
3396 | + /* bitmask for skipping volume controls */ | ||
3397 | + u64 out_vol_mask; | ||
3398 | + | ||
3399 | /* badness tables for output path evaluations */ | ||
3400 | const struct badness_table *main_out_badness; | ||
3401 | const struct badness_table *extra_out_badness; | ||
3402 | diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c | ||
3403 | index 6e61a019aa5e..a63aff2ca594 100644 | ||
3404 | --- a/sound/pci/hda/hda_intel.c | ||
3405 | +++ b/sound/pci/hda/hda_intel.c | ||
3406 | @@ -612,6 +612,11 @@ enum { | ||
3407 | #define AZX_DCAPS_INTEL_PCH \ | ||
3408 | (AZX_DCAPS_INTEL_PCH_NOPM | AZX_DCAPS_PM_RUNTIME) | ||
3409 | |||
3410 | +#define AZX_DCAPS_INTEL_HASWELL \ | ||
3411 | + (AZX_DCAPS_SCH_SNOOP | AZX_DCAPS_ALIGN_BUFSIZE | \ | ||
3412 | + AZX_DCAPS_COUNT_LPIB_DELAY | AZX_DCAPS_PM_RUNTIME | \ | ||
3413 | + AZX_DCAPS_I915_POWERWELL) | ||
3414 | + | ||
3415 | /* quirks for ATI SB / AMD Hudson */ | ||
3416 | #define AZX_DCAPS_PRESET_ATI_SB \ | ||
3417 | (AZX_DCAPS_ATI_SNOOP | AZX_DCAPS_NO_TCSEL | \ | ||
3418 | @@ -3987,14 +3992,11 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { | ||
3419 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | ||
3420 | /* Haswell */ | ||
3421 | { PCI_DEVICE(0x8086, 0x0a0c), | ||
3422 | - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH | | ||
3423 | - AZX_DCAPS_I915_POWERWELL }, | ||
3424 | + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_HASWELL }, | ||
3425 | { PCI_DEVICE(0x8086, 0x0c0c), | ||
3426 | - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH | | ||
3427 | - AZX_DCAPS_I915_POWERWELL }, | ||
3428 | + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_HASWELL }, | ||
3429 | { PCI_DEVICE(0x8086, 0x0d0c), | ||
3430 | - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH | | ||
3431 | - AZX_DCAPS_I915_POWERWELL }, | ||
3432 | + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_HASWELL }, | ||
3433 | /* 5 Series/3400 */ | ||
3434 | { PCI_DEVICE(0x8086, 0x3b56), | ||
3435 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, | ||
3436 | diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c | ||
3437 | index 2aa2f579b4d6..a52d2a1a5e83 100644 | ||
3438 | --- a/sound/pci/hda/patch_analog.c | ||
3439 | +++ b/sound/pci/hda/patch_analog.c | ||
3440 | @@ -219,8 +219,12 @@ static int alloc_ad_spec(struct hda_codec *codec) | ||
3441 | static void ad_fixup_inv_jack_detect(struct hda_codec *codec, | ||
3442 | const struct hda_fixup *fix, int action) | ||
3443 | { | ||
3444 | - if (action == HDA_FIXUP_ACT_PRE_PROBE) | ||
3445 | + struct ad198x_spec *spec = codec->spec; | ||
3446 | + | ||
3447 | + if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
3448 | codec->inv_jack_detect = 1; | ||
3449 | + spec->gen.keep_eapd_on = 1; | ||
3450 | + } | ||
3451 | } | ||
3452 | |||
3453 | enum { | ||
3454 | diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c | ||
3455 | index 18d972501585..072755c8289c 100644 | ||
3456 | --- a/sound/pci/hda/patch_cirrus.c | ||
3457 | +++ b/sound/pci/hda/patch_cirrus.c | ||
3458 | @@ -597,6 +597,7 @@ static int patch_cs420x(struct hda_codec *codec) | ||
3459 | * Its layout is no longer compatible with CS4206/CS4207 | ||
3460 | */ | ||
3461 | enum { | ||
3462 | + CS4208_MAC_AUTO, | ||
3463 | CS4208_MBA6, | ||
3464 | CS4208_GPIO0, | ||
3465 | }; | ||
3466 | @@ -608,7 +609,12 @@ static const struct hda_model_fixup cs4208_models[] = { | ||
3467 | }; | ||
3468 | |||
3469 | static const struct snd_pci_quirk cs4208_fixup_tbl[] = { | ||
3470 | - /* codec SSID */ | ||
3471 | + SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS4208_MAC_AUTO), | ||
3472 | + {} /* terminator */ | ||
3473 | +}; | ||
3474 | + | ||
3475 | +/* codec SSID matching */ | ||
3476 | +static const struct snd_pci_quirk cs4208_mac_fixup_tbl[] = { | ||
3477 | SND_PCI_QUIRK(0x106b, 0x7100, "MacBookAir 6,1", CS4208_MBA6), | ||
3478 | SND_PCI_QUIRK(0x106b, 0x7200, "MacBookAir 6,2", CS4208_MBA6), | ||
3479 | {} /* terminator */ | ||
3480 | @@ -626,6 +632,20 @@ static void cs4208_fixup_gpio0(struct hda_codec *codec, | ||
3481 | } | ||
3482 | } | ||
3483 | |||
3484 | +static const struct hda_fixup cs4208_fixups[]; | ||
3485 | + | ||
3486 | +/* remap the fixup from codec SSID and apply it */ | ||
3487 | +static void cs4208_fixup_mac(struct hda_codec *codec, | ||
3488 | + const struct hda_fixup *fix, int action) | ||
3489 | +{ | ||
3490 | + if (action != HDA_FIXUP_ACT_PRE_PROBE) | ||
3491 | + return; | ||
3492 | + snd_hda_pick_fixup(codec, NULL, cs4208_mac_fixup_tbl, cs4208_fixups); | ||
3493 | + if (codec->fixup_id < 0 || codec->fixup_id == CS4208_MAC_AUTO) | ||
3494 | + codec->fixup_id = CS4208_GPIO0; /* default fixup */ | ||
3495 | + snd_hda_apply_fixup(codec, action); | ||
3496 | +} | ||
3497 | + | ||
3498 | static const struct hda_fixup cs4208_fixups[] = { | ||
3499 | [CS4208_MBA6] = { | ||
3500 | .type = HDA_FIXUP_PINS, | ||
3501 | @@ -637,6 +657,10 @@ static const struct hda_fixup cs4208_fixups[] = { | ||
3502 | .type = HDA_FIXUP_FUNC, | ||
3503 | .v.func = cs4208_fixup_gpio0, | ||
3504 | }, | ||
3505 | + [CS4208_MAC_AUTO] = { | ||
3506 | + .type = HDA_FIXUP_FUNC, | ||
3507 | + .v.func = cs4208_fixup_mac, | ||
3508 | + }, | ||
3509 | }; | ||
3510 | |||
3511 | /* correct the 0dB offset of input pins */ | ||
3512 | @@ -660,6 +684,8 @@ static int patch_cs4208(struct hda_codec *codec) | ||
3513 | return -ENOMEM; | ||
3514 | |||
3515 | spec->gen.automute_hook = cs_automute; | ||
3516 | + /* exclude NID 0x10 (HP) from output volumes due to different steps */ | ||
3517 | + spec->gen.out_vol_mask = 1ULL << 0x10; | ||
3518 | |||
3519 | snd_hda_pick_fixup(codec, cs4208_models, cs4208_fixup_tbl, | ||
3520 | cs4208_fixups); | ||
3521 | diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c | ||
3522 | index ec68eaea0336..96f07ce56603 100644 | ||
3523 | --- a/sound/pci/hda/patch_conexant.c | ||
3524 | +++ b/sound/pci/hda/patch_conexant.c | ||
3525 | @@ -3568,6 +3568,8 @@ static const struct hda_codec_preset snd_hda_preset_conexant[] = { | ||
3526 | .patch = patch_conexant_auto }, | ||
3527 | { .id = 0x14f15115, .name = "CX20757", | ||
3528 | .patch = patch_conexant_auto }, | ||
3529 | + { .id = 0x14f151d7, .name = "CX20952", | ||
3530 | + .patch = patch_conexant_auto }, | ||
3531 | {} /* terminator */ | ||
3532 | }; | ||
3533 | |||
3534 | @@ -3594,6 +3596,7 @@ MODULE_ALIAS("snd-hda-codec-id:14f15111"); | ||
3535 | MODULE_ALIAS("snd-hda-codec-id:14f15113"); | ||
3536 | MODULE_ALIAS("snd-hda-codec-id:14f15114"); | ||
3537 | MODULE_ALIAS("snd-hda-codec-id:14f15115"); | ||
3538 | +MODULE_ALIAS("snd-hda-codec-id:14f151d7"); | ||
3539 | |||
3540 | MODULE_LICENSE("GPL"); | ||
3541 | MODULE_DESCRIPTION("Conexant HD-audio codec"); | ||
3542 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c | ||
3543 | index 8ad554312b69..2f39631f54c8 100644 | ||
3544 | --- a/sound/pci/hda/patch_realtek.c | ||
3545 | +++ b/sound/pci/hda/patch_realtek.c | ||
3546 | @@ -1043,6 +1043,7 @@ enum { | ||
3547 | ALC880_FIXUP_UNIWILL, | ||
3548 | ALC880_FIXUP_UNIWILL_DIG, | ||
3549 | ALC880_FIXUP_Z71V, | ||
3550 | + ALC880_FIXUP_ASUS_W5A, | ||
3551 | ALC880_FIXUP_3ST_BASE, | ||
3552 | ALC880_FIXUP_3ST, | ||
3553 | ALC880_FIXUP_3ST_DIG, | ||
3554 | @@ -1213,6 +1214,26 @@ static const struct hda_fixup alc880_fixups[] = { | ||
3555 | { } | ||
3556 | } | ||
3557 | }, | ||
3558 | + [ALC880_FIXUP_ASUS_W5A] = { | ||
3559 | + .type = HDA_FIXUP_PINS, | ||
3560 | + .v.pins = (const struct hda_pintbl[]) { | ||
3561 | + /* set up the whole pins as BIOS is utterly broken */ | ||
3562 | + { 0x14, 0x0121411f }, /* HP */ | ||
3563 | + { 0x15, 0x411111f0 }, /* N/A */ | ||
3564 | + { 0x16, 0x411111f0 }, /* N/A */ | ||
3565 | + { 0x17, 0x411111f0 }, /* N/A */ | ||
3566 | + { 0x18, 0x90a60160 }, /* mic */ | ||
3567 | + { 0x19, 0x411111f0 }, /* N/A */ | ||
3568 | + { 0x1a, 0x411111f0 }, /* N/A */ | ||
3569 | + { 0x1b, 0x411111f0 }, /* N/A */ | ||
3570 | + { 0x1c, 0x411111f0 }, /* N/A */ | ||
3571 | + { 0x1d, 0x411111f0 }, /* N/A */ | ||
3572 | + { 0x1e, 0xb743111e }, /* SPDIF out */ | ||
3573 | + { } | ||
3574 | + }, | ||
3575 | + .chained = true, | ||
3576 | + .chain_id = ALC880_FIXUP_GPIO1, | ||
3577 | + }, | ||
3578 | [ALC880_FIXUP_3ST_BASE] = { | ||
3579 | .type = HDA_FIXUP_PINS, | ||
3580 | .v.pins = (const struct hda_pintbl[]) { | ||
3581 | @@ -1334,6 +1355,7 @@ static const struct hda_fixup alc880_fixups[] = { | ||
3582 | |||
3583 | static const struct snd_pci_quirk alc880_fixup_tbl[] = { | ||
3584 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810), | ||
3585 | + SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A), | ||
3586 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V), | ||
3587 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1), | ||
3588 | SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2), | ||
3589 | @@ -1479,6 +1501,7 @@ enum { | ||
3590 | ALC260_FIXUP_KN1, | ||
3591 | ALC260_FIXUP_FSC_S7020, | ||
3592 | ALC260_FIXUP_FSC_S7020_JWSE, | ||
3593 | + ALC260_FIXUP_VAIO_PINS, | ||
3594 | }; | ||
3595 | |||
3596 | static void alc260_gpio1_automute(struct hda_codec *codec) | ||
3597 | @@ -1619,6 +1642,24 @@ static const struct hda_fixup alc260_fixups[] = { | ||
3598 | .chained = true, | ||
3599 | .chain_id = ALC260_FIXUP_FSC_S7020, | ||
3600 | }, | ||
3601 | + [ALC260_FIXUP_VAIO_PINS] = { | ||
3602 | + .type = HDA_FIXUP_PINS, | ||
3603 | + .v.pins = (const struct hda_pintbl[]) { | ||
3604 | + /* Pin configs are missing completely on some VAIOs */ | ||
3605 | + { 0x0f, 0x01211020 }, | ||
3606 | + { 0x10, 0x0001003f }, | ||
3607 | + { 0x11, 0x411111f0 }, | ||
3608 | + { 0x12, 0x01a15930 }, | ||
3609 | + { 0x13, 0x411111f0 }, | ||
3610 | + { 0x14, 0x411111f0 }, | ||
3611 | + { 0x15, 0x411111f0 }, | ||
3612 | + { 0x16, 0x411111f0 }, | ||
3613 | + { 0x17, 0x411111f0 }, | ||
3614 | + { 0x18, 0x411111f0 }, | ||
3615 | + { 0x19, 0x411111f0 }, | ||
3616 | + { } | ||
3617 | + } | ||
3618 | + }, | ||
3619 | }; | ||
3620 | |||
3621 | static const struct snd_pci_quirk alc260_fixup_tbl[] = { | ||
3622 | @@ -1627,6 +1668,8 @@ static const struct snd_pci_quirk alc260_fixup_tbl[] = { | ||
3623 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1), | ||
3624 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750), | ||
3625 | SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900), | ||
3626 | + SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS), | ||
3627 | + SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F), | ||
3628 | SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020), | ||
3629 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1), | ||
3630 | SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1), | ||
3631 | @@ -2388,6 +2431,7 @@ static const struct hda_verb alc268_beep_init_verbs[] = { | ||
3632 | enum { | ||
3633 | ALC268_FIXUP_INV_DMIC, | ||
3634 | ALC268_FIXUP_HP_EAPD, | ||
3635 | + ALC268_FIXUP_SPDIF, | ||
3636 | }; | ||
3637 | |||
3638 | static const struct hda_fixup alc268_fixups[] = { | ||
3639 | @@ -2402,6 +2446,13 @@ static const struct hda_fixup alc268_fixups[] = { | ||
3640 | {} | ||
3641 | } | ||
3642 | }, | ||
3643 | + [ALC268_FIXUP_SPDIF] = { | ||
3644 | + .type = HDA_FIXUP_PINS, | ||
3645 | + .v.pins = (const struct hda_pintbl[]) { | ||
3646 | + { 0x1e, 0x014b1180 }, /* enable SPDIF out */ | ||
3647 | + {} | ||
3648 | + } | ||
3649 | + }, | ||
3650 | }; | ||
3651 | |||
3652 | static const struct hda_model_fixup alc268_fixup_models[] = { | ||
3653 | @@ -2411,6 +2462,7 @@ static const struct hda_model_fixup alc268_fixup_models[] = { | ||
3654 | }; | ||
3655 | |||
3656 | static const struct snd_pci_quirk alc268_fixup_tbl[] = { | ||
3657 | + SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF), | ||
3658 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC), | ||
3659 | /* below is codec SSID since multiple Toshiba laptops have the | ||
3660 | * same PCI SSID 1179:ff00 | ||
3661 | @@ -2540,6 +2592,7 @@ enum { | ||
3662 | ALC269_TYPE_ALC283, | ||
3663 | ALC269_TYPE_ALC284, | ||
3664 | ALC269_TYPE_ALC286, | ||
3665 | + ALC269_TYPE_ALC255, | ||
3666 | }; | ||
3667 | |||
3668 | /* | ||
3669 | @@ -2565,6 +2618,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | ||
3670 | case ALC269_TYPE_ALC282: | ||
3671 | case ALC269_TYPE_ALC283: | ||
3672 | case ALC269_TYPE_ALC286: | ||
3673 | + case ALC269_TYPE_ALC255: | ||
3674 | ssids = alc269_ssids; | ||
3675 | break; | ||
3676 | default: | ||
3677 | @@ -2944,6 +2998,23 @@ static void alc269_fixup_mic_mute_hook(void *private_data, int enabled) | ||
3678 | snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval); | ||
3679 | } | ||
3680 | |||
3681 | +/* Make sure the led works even in runtime suspend */ | ||
3682 | +static unsigned int led_power_filter(struct hda_codec *codec, | ||
3683 | + hda_nid_t nid, | ||
3684 | + unsigned int power_state) | ||
3685 | +{ | ||
3686 | + struct alc_spec *spec = codec->spec; | ||
3687 | + | ||
3688 | + if (power_state != AC_PWRST_D3 || nid != spec->mute_led_nid) | ||
3689 | + return power_state; | ||
3690 | + | ||
3691 | + /* Set pin ctl again, it might have just been set to 0 */ | ||
3692 | + snd_hda_set_pin_ctl(codec, nid, | ||
3693 | + snd_hda_codec_get_pin_target(codec, nid)); | ||
3694 | + | ||
3695 | + return AC_PWRST_D0; | ||
3696 | +} | ||
3697 | + | ||
3698 | static void alc269_fixup_hp_mute_led(struct hda_codec *codec, | ||
3699 | const struct hda_fixup *fix, int action) | ||
3700 | { | ||
3701 | @@ -2963,6 +3034,7 @@ static void alc269_fixup_hp_mute_led(struct hda_codec *codec, | ||
3702 | spec->mute_led_nid = pin - 0x0a + 0x18; | ||
3703 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; | ||
3704 | spec->gen.vmaster_mute_enum = 1; | ||
3705 | + codec->power_filter = led_power_filter; | ||
3706 | snd_printd("Detected mute LED for %x:%d\n", spec->mute_led_nid, | ||
3707 | spec->mute_led_polarity); | ||
3708 | break; | ||
3709 | @@ -2978,6 +3050,7 @@ static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, | ||
3710 | spec->mute_led_nid = 0x18; | ||
3711 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; | ||
3712 | spec->gen.vmaster_mute_enum = 1; | ||
3713 | + codec->power_filter = led_power_filter; | ||
3714 | } | ||
3715 | } | ||
3716 | |||
3717 | @@ -2990,6 +3063,7 @@ static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, | ||
3718 | spec->mute_led_nid = 0x19; | ||
3719 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; | ||
3720 | spec->gen.vmaster_mute_enum = 1; | ||
3721 | + codec->power_filter = led_power_filter; | ||
3722 | } | ||
3723 | } | ||
3724 | |||
3725 | @@ -3230,8 +3304,10 @@ static void alc_update_headset_mode(struct hda_codec *codec) | ||
3726 | else | ||
3727 | new_headset_mode = ALC_HEADSET_MODE_HEADPHONE; | ||
3728 | |||
3729 | - if (new_headset_mode == spec->current_headset_mode) | ||
3730 | + if (new_headset_mode == spec->current_headset_mode) { | ||
3731 | + snd_hda_gen_update_outputs(codec); | ||
3732 | return; | ||
3733 | + } | ||
3734 | |||
3735 | switch (new_headset_mode) { | ||
3736 | case ALC_HEADSET_MODE_UNPLUGGED: | ||
3737 | @@ -3895,6 +3971,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | ||
3738 | SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | ||
3739 | SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | ||
3740 | SND_PCI_QUIRK(0x1028, 0x0613, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | ||
3741 | + SND_PCI_QUIRK(0x1028, 0x0614, "Dell Inspiron 3135", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | ||
3742 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_MONO_SPEAKERS), | ||
3743 | SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), | ||
3744 | SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), | ||
3745 | @@ -4128,6 +4205,9 @@ static int patch_alc269(struct hda_codec *codec) | ||
3746 | case 0x10ec0286: | ||
3747 | spec->codec_variant = ALC269_TYPE_ALC286; | ||
3748 | break; | ||
3749 | + case 0x10ec0255: | ||
3750 | + spec->codec_variant = ALC269_TYPE_ALC255; | ||
3751 | + break; | ||
3752 | } | ||
3753 | |||
3754 | if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { | ||
3755 | @@ -4842,6 +4922,7 @@ static int patch_alc680(struct hda_codec *codec) | ||
3756 | static const struct hda_codec_preset snd_hda_preset_realtek[] = { | ||
3757 | { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 }, | ||
3758 | { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 }, | ||
3759 | + { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 }, | ||
3760 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, | ||
3761 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, | ||
3762 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, | ||
3763 | diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c | ||
3764 | index c39c77978468..66edc4a7917f 100644 | ||
3765 | --- a/sound/usb/6fire/chip.c | ||
3766 | +++ b/sound/usb/6fire/chip.c | ||
3767 | @@ -101,7 +101,7 @@ static int usb6fire_chip_probe(struct usb_interface *intf, | ||
3768 | usb_set_intfdata(intf, chips[i]); | ||
3769 | mutex_unlock(®ister_mutex); | ||
3770 | return 0; | ||
3771 | - } else if (regidx < 0) | ||
3772 | + } else if (!devices[i] && regidx < 0) | ||
3773 | regidx = i; | ||
3774 | } | ||
3775 | if (regidx < 0) { | ||
3776 | diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c | ||
3777 | index 72a130bc448a..c329c8fc57f4 100644 | ||
3778 | --- a/virt/kvm/iommu.c | ||
3779 | +++ b/virt/kvm/iommu.c | ||
3780 | @@ -103,6 +103,10 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) | ||
3781 | while ((gfn << PAGE_SHIFT) & (page_size - 1)) | ||
3782 | page_size >>= 1; | ||
3783 | |||
3784 | + /* Make sure hva is aligned to the page size we want to map */ | ||
3785 | + while (__gfn_to_hva_memslot(slot, gfn) & (page_size - 1)) | ||
3786 | + page_size >>= 1; | ||
3787 | + | ||
3788 | /* | ||
3789 | * Pin all pages we are about to map in memory. This is | ||
3790 | * important because we unmap and unpin in 4kb steps later. |