Magellan Linux

Contents of /trunk/kernel-lts/patches-3.10/0120-3.10.21-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2395 - (show annotations) (download)
Mon Feb 3 12:41:31 2014 UTC (10 years, 2 months ago) by niro
File size: 89991 byte(s)
-copied
1 diff --git a/Makefile b/Makefile
2 index ba784b7b0f51..c0635fbab87f 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 3
7 PATCHLEVEL = 10
8 -SUBLEVEL = 20
9 +SUBLEVEL = 21
10 EXTRAVERSION =
11 NAME = TOSSUG Baby Fish
12
13 diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
14 index 84ba67b982c0..e04613906f1b 100644
15 --- a/arch/arm/kvm/mmu.c
16 +++ b/arch/arm/kvm/mmu.c
17 @@ -313,6 +313,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 @@ -324,16 +335,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/cris/include/asm/io.h b/arch/cris/include/asm/io.h
70 index ac12ae2b9286..db9a16c704f3 100644
71 --- a/arch/cris/include/asm/io.h
72 +++ b/arch/cris/include/asm/io.h
73 @@ -3,6 +3,7 @@
74
75 #include <asm/page.h> /* for __va, __pa */
76 #include <arch/io.h>
77 +#include <asm-generic/iomap.h>
78 #include <linux/kernel.h>
79
80 struct cris_io_operations
81 diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h
82 index e0a899a1a8a6..5a84b3a50741 100644
83 --- a/arch/ia64/include/asm/processor.h
84 +++ b/arch/ia64/include/asm/processor.h
85 @@ -319,7 +319,7 @@ struct thread_struct {
86 regs->loadrs = 0; \
87 regs->r8 = get_dumpable(current->mm); /* set "don't zap registers" flag */ \
88 regs->r12 = new_sp - 16; /* allocate 16 byte scratch area */ \
89 - if (unlikely(!get_dumpable(current->mm))) { \
90 + if (unlikely(get_dumpable(current->mm) != SUID_DUMP_USER)) { \
91 /* \
92 * Zap scratch regs to avoid leaking bits between processes with different \
93 * uid/privileges. \
94 diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
95 index 0f83122e6676..323309963cd3 100644
96 --- a/arch/powerpc/kernel/signal_32.c
97 +++ b/arch/powerpc/kernel/signal_32.c
98 @@ -454,7 +454,15 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
99 if (copy_vsx_to_user(&frame->mc_vsregs, current))
100 return 1;
101 msr |= MSR_VSX;
102 - }
103 + } else if (!ctx_has_vsx_region)
104 + /*
105 + * With a small context structure we can't hold the VSX
106 + * registers, hence clear the MSR value to indicate the state
107 + * was not saved.
108 + */
109 + msr &= ~MSR_VSX;
110 +
111 +
112 #endif /* CONFIG_VSX */
113 #ifdef CONFIG_SPE
114 /* save spe registers */
115 diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
116 index 2d845d8199fc..56d2e72c85de 100644
117 --- a/arch/powerpc/kernel/vio.c
118 +++ b/arch/powerpc/kernel/vio.c
119 @@ -1530,12 +1530,12 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
120
121 dn = dev->of_node;
122 if (!dn) {
123 - strcat(buf, "\n");
124 + strcpy(buf, "\n");
125 return strlen(buf);
126 }
127 cp = of_get_property(dn, "compatible", NULL);
128 if (!cp) {
129 - strcat(buf, "\n");
130 + strcpy(buf, "\n");
131 return strlen(buf);
132 }
133
134 diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
135 index 3e99c149271a..7ce9cf3b6988 100644
136 --- a/arch/powerpc/mm/slice.c
137 +++ b/arch/powerpc/mm/slice.c
138 @@ -258,7 +258,7 @@ static bool slice_scan_available(unsigned long addr,
139 slice = GET_HIGH_SLICE_INDEX(addr);
140 *boundary_addr = (slice + end) ?
141 ((slice + end) << SLICE_HIGH_SHIFT) : SLICE_LOW_TOP;
142 - return !!(available.high_slices & (1u << slice));
143 + return !!(available.high_slices & (1ul << slice));
144 }
145 }
146
147 diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig
148 index 90f4496017e4..af54174801f7 100644
149 --- a/arch/powerpc/platforms/52xx/Kconfig
150 +++ b/arch/powerpc/platforms/52xx/Kconfig
151 @@ -57,5 +57,5 @@ config PPC_MPC5200_BUGFIX
152
153 config PPC_MPC5200_LPBFIFO
154 tristate "MPC5200 LocalPlus bus FIFO driver"
155 - depends on PPC_MPC52xx
156 + depends on PPC_MPC52xx && PPC_BESTCOMM
157 select PPC_BESTCOMM_GEN_BD
158 diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
159 index 7816beff1db8..f75607c93e8a 100644
160 --- a/arch/powerpc/platforms/powernv/pci-ioda.c
161 +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
162 @@ -151,13 +151,23 @@ static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe)
163 rid_end = pe->rid + 1;
164 }
165
166 - /* Associate PE in PELT */
167 + /*
168 + * Associate PE in PELT. We need add the PE into the
169 + * corresponding PELT-V as well. Otherwise, the error
170 + * originated from the PE might contribute to other
171 + * PEs.
172 + */
173 rc = opal_pci_set_pe(phb->opal_id, pe->pe_number, pe->rid,
174 bcomp, dcomp, fcomp, OPAL_MAP_PE);
175 if (rc) {
176 pe_err(pe, "OPAL error %ld trying to setup PELT table\n", rc);
177 return -ENXIO;
178 }
179 +
180 + rc = opal_pci_set_peltv(phb->opal_id, pe->pe_number,
181 + pe->pe_number, OPAL_ADD_PE_TO_DOMAIN);
182 + if (rc)
183 + pe_warn(pe, "OPAL error %d adding self to PELTV\n", rc);
184 opal_pci_eeh_freeze_clear(phb->opal_id, pe->pe_number,
185 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
186
187 diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
188 index b4dbade8ca24..2e4b5be31a1b 100644
189 --- a/arch/s390/crypto/aes_s390.c
190 +++ b/arch/s390/crypto/aes_s390.c
191 @@ -35,7 +35,6 @@ static u8 *ctrblk;
192 static char keylen_flag;
193
194 struct s390_aes_ctx {
195 - u8 iv[AES_BLOCK_SIZE];
196 u8 key[AES_MAX_KEY_SIZE];
197 long enc;
198 long dec;
199 @@ -441,30 +440,36 @@ static int cbc_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
200 return aes_set_key(tfm, in_key, key_len);
201 }
202
203 -static int cbc_aes_crypt(struct blkcipher_desc *desc, long func, void *param,
204 +static int cbc_aes_crypt(struct blkcipher_desc *desc, long func,
205 struct blkcipher_walk *walk)
206 {
207 + struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm);
208 int ret = blkcipher_walk_virt(desc, walk);
209 unsigned int nbytes = walk->nbytes;
210 + struct {
211 + u8 iv[AES_BLOCK_SIZE];
212 + u8 key[AES_MAX_KEY_SIZE];
213 + } param;
214
215 if (!nbytes)
216 goto out;
217
218 - memcpy(param, walk->iv, AES_BLOCK_SIZE);
219 + memcpy(param.iv, walk->iv, AES_BLOCK_SIZE);
220 + memcpy(param.key, sctx->key, sctx->key_len);
221 do {
222 /* only use complete blocks */
223 unsigned int n = nbytes & ~(AES_BLOCK_SIZE - 1);
224 u8 *out = walk->dst.virt.addr;
225 u8 *in = walk->src.virt.addr;
226
227 - ret = crypt_s390_kmc(func, param, out, in, n);
228 + ret = crypt_s390_kmc(func, &param, out, in, n);
229 if (ret < 0 || ret != n)
230 return -EIO;
231
232 nbytes &= AES_BLOCK_SIZE - 1;
233 ret = blkcipher_walk_done(desc, walk, nbytes);
234 } while ((nbytes = walk->nbytes));
235 - memcpy(walk->iv, param, AES_BLOCK_SIZE);
236 + memcpy(walk->iv, param.iv, AES_BLOCK_SIZE);
237
238 out:
239 return ret;
240 @@ -481,7 +486,7 @@ static int cbc_aes_encrypt(struct blkcipher_desc *desc,
241 return fallback_blk_enc(desc, dst, src, nbytes);
242
243 blkcipher_walk_init(&walk, dst, src, nbytes);
244 - return cbc_aes_crypt(desc, sctx->enc, sctx->iv, &walk);
245 + return cbc_aes_crypt(desc, sctx->enc, &walk);
246 }
247
248 static int cbc_aes_decrypt(struct blkcipher_desc *desc,
249 @@ -495,7 +500,7 @@ static int cbc_aes_decrypt(struct blkcipher_desc *desc,
250 return fallback_blk_dec(desc, dst, src, nbytes);
251
252 blkcipher_walk_init(&walk, dst, src, nbytes);
253 - return cbc_aes_crypt(desc, sctx->dec, sctx->iv, &walk);
254 + return cbc_aes_crypt(desc, sctx->dec, &walk);
255 }
256
257 static struct crypto_alg cbc_aes_alg = {
258 diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
259 index 4f977d0d25c2..14647fe09d0c 100644
260 --- a/arch/s390/kernel/smp.c
261 +++ b/arch/s390/kernel/smp.c
262 @@ -933,7 +933,7 @@ static ssize_t show_idle_count(struct device *dev,
263 idle_count = ACCESS_ONCE(idle->idle_count);
264 if (ACCESS_ONCE(idle->clock_idle_enter))
265 idle_count++;
266 - } while ((sequence & 1) || (idle->sequence != sequence));
267 + } while ((sequence & 1) || (ACCESS_ONCE(idle->sequence) != sequence));
268 return sprintf(buf, "%llu\n", idle_count);
269 }
270 static DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL);
271 @@ -951,7 +951,7 @@ static ssize_t show_idle_time(struct device *dev,
272 idle_time = ACCESS_ONCE(idle->idle_time);
273 idle_enter = ACCESS_ONCE(idle->clock_idle_enter);
274 idle_exit = ACCESS_ONCE(idle->clock_idle_exit);
275 - } while ((sequence & 1) || (idle->sequence != sequence));
276 + } while ((sequence & 1) || (ACCESS_ONCE(idle->sequence) != sequence));
277 idle_time += idle_enter ? ((idle_exit ? : now) - idle_enter) : 0;
278 return sprintf(buf, "%llu\n", idle_time >> 12);
279 }
280 diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
281 index 3fb09359eda6..737d50caa4fe 100644
282 --- a/arch/s390/kernel/vtime.c
283 +++ b/arch/s390/kernel/vtime.c
284 @@ -190,7 +190,7 @@ cputime64_t s390_get_idle_time(int cpu)
285 sequence = ACCESS_ONCE(idle->sequence);
286 idle_enter = ACCESS_ONCE(idle->clock_idle_enter);
287 idle_exit = ACCESS_ONCE(idle->clock_idle_exit);
288 - } while ((sequence & 1) || (idle->sequence != sequence));
289 + } while ((sequence & 1) || (ACCESS_ONCE(idle->sequence) != sequence));
290 return idle_enter ? ((idle_exit ?: now) - idle_enter) : 0;
291 }
292
293 diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
294 index 42a392a9fd02..d4bdd253fea7 100644
295 --- a/arch/x86/kernel/ftrace.c
296 +++ b/arch/x86/kernel/ftrace.c
297 @@ -248,6 +248,15 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
298 return ret;
299 }
300
301 +static int is_ftrace_caller(unsigned long ip)
302 +{
303 + if (ip == (unsigned long)(&ftrace_call) ||
304 + ip == (unsigned long)(&ftrace_regs_call))
305 + return 1;
306 +
307 + return 0;
308 +}
309 +
310 /*
311 * A breakpoint was added to the code address we are about to
312 * modify, and this is the handle that will just skip over it.
313 @@ -257,10 +266,13 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
314 */
315 int ftrace_int3_handler(struct pt_regs *regs)
316 {
317 + unsigned long ip;
318 +
319 if (WARN_ON_ONCE(!regs))
320 return 0;
321
322 - if (!ftrace_location(regs->ip - 1))
323 + ip = regs->ip - 1;
324 + if (!ftrace_location(ip) && !is_ftrace_caller(ip))
325 return 0;
326
327 regs->ip += MCOUNT_INSN_SIZE - 1;
328 diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
329 index efdec7cd8e01..b516dfb411ec 100644
330 --- a/arch/x86/kernel/microcode_amd.c
331 +++ b/arch/x86/kernel/microcode_amd.c
332 @@ -430,7 +430,7 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device,
333 snprintf(fw_name, sizeof(fw_name), "amd-ucode/microcode_amd_fam%.2xh.bin", c->x86);
334
335 if (request_firmware(&fw, (const char *)fw_name, device)) {
336 - pr_err("failed to load file %s\n", fw_name);
337 + pr_debug("failed to load file %s\n", fw_name);
338 goto out;
339 }
340
341 diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
342 index 81a5f5e8f142..59b90379cb6a 100644
343 --- a/arch/x86/kernel/process.c
344 +++ b/arch/x86/kernel/process.c
345 @@ -391,9 +391,9 @@ static void amd_e400_idle(void)
346 * The switch back from broadcast mode needs to be
347 * called with interrupts disabled.
348 */
349 - local_irq_disable();
350 - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
351 - local_irq_enable();
352 + local_irq_disable();
353 + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
354 + local_irq_enable();
355 } else
356 default_idle();
357 }
358 diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
359 index 5953dcea752d..5484d54582ca 100644
360 --- a/arch/x86/kvm/emulate.c
361 +++ b/arch/x86/kvm/emulate.c
362 @@ -4207,7 +4207,10 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
363 case OpMem8:
364 ctxt->memop.bytes = 1;
365 if (ctxt->memop.type == OP_REG) {
366 - ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm, 1);
367 + int highbyte_regs = ctxt->rex_prefix == 0;
368 +
369 + ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm,
370 + highbyte_regs);
371 fetch_register_operand(&ctxt->memop);
372 }
373 goto mem_common;
374 diff --git a/block/blk-core.c b/block/blk-core.c
375 index d5745b5833c9..45f3a51f6b56 100644
376 --- a/block/blk-core.c
377 +++ b/block/blk-core.c
378 @@ -2229,6 +2229,7 @@ void blk_start_request(struct request *req)
379 if (unlikely(blk_bidi_rq(req)))
380 req->next_rq->resid_len = blk_rq_bytes(req->next_rq);
381
382 + BUG_ON(test_bit(REQ_ATOM_COMPLETE, &req->atomic_flags));
383 blk_add_timer(req);
384 }
385 EXPORT_SYMBOL(blk_start_request);
386 diff --git a/block/blk-settings.c b/block/blk-settings.c
387 index c50ecf0ea3b1..53309333c2f0 100644
388 --- a/block/blk-settings.c
389 +++ b/block/blk-settings.c
390 @@ -144,6 +144,7 @@ void blk_set_stacking_limits(struct queue_limits *lim)
391 lim->discard_zeroes_data = 1;
392 lim->max_segments = USHRT_MAX;
393 lim->max_hw_sectors = UINT_MAX;
394 + lim->max_segment_size = UINT_MAX;
395 lim->max_sectors = UINT_MAX;
396 lim->max_write_same_sectors = UINT_MAX;
397 }
398 diff --git a/block/blk-timeout.c b/block/blk-timeout.c
399 index 6e4744cbfb56..5a6296ef9a81 100644
400 --- a/block/blk-timeout.c
401 +++ b/block/blk-timeout.c
402 @@ -90,8 +90,8 @@ static void blk_rq_timed_out(struct request *req)
403 __blk_complete_request(req);
404 break;
405 case BLK_EH_RESET_TIMER:
406 - blk_clear_rq_complete(req);
407 blk_add_timer(req);
408 + blk_clear_rq_complete(req);
409 break;
410 case BLK_EH_NOT_HANDLED:
411 /*
412 @@ -173,7 +173,6 @@ void blk_add_timer(struct request *req)
413 return;
414
415 BUG_ON(!list_empty(&req->timeout_list));
416 - BUG_ON(test_bit(REQ_ATOM_COMPLETE, &req->atomic_flags));
417
418 /*
419 * Some LLDs, like scsi, peek at the timeout to prevent a
420 diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c
421 index c0bb3778f1ae..666f1962a160 100644
422 --- a/crypto/ansi_cprng.c
423 +++ b/crypto/ansi_cprng.c
424 @@ -230,11 +230,11 @@ remainder:
425 */
426 if (byte_count < DEFAULT_BLK_SZ) {
427 empty_rbuf:
428 - for (; ctx->rand_data_valid < DEFAULT_BLK_SZ;
429 - ctx->rand_data_valid++) {
430 + while (ctx->rand_data_valid < DEFAULT_BLK_SZ) {
431 *ptr = ctx->rand_data[ctx->rand_data_valid];
432 ptr++;
433 byte_count--;
434 + ctx->rand_data_valid++;
435 if (byte_count == 0)
436 goto done;
437 }
438 diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c
439 index b60c877f5906..c3241b188434 100644
440 --- a/drivers/acpi/acpica/exoparg1.c
441 +++ b/drivers/acpi/acpica/exoparg1.c
442 @@ -963,10 +963,17 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
443 */
444 return_desc =
445 *(operand[0]->reference.where);
446 - if (return_desc) {
447 - acpi_ut_add_reference
448 - (return_desc);
449 + if (!return_desc) {
450 + /*
451 + * Element is NULL, do not allow the dereference.
452 + * This provides compatibility with other ACPI
453 + * implementations.
454 + */
455 + return_ACPI_STATUS
456 + (AE_AML_UNINITIALIZED_ELEMENT);
457 }
458 +
459 + acpi_ut_add_reference(return_desc);
460 break;
461
462 default:
463 @@ -991,11 +998,40 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
464 acpi_namespace_node
465 *)
466 return_desc);
467 - }
468 + if (!return_desc) {
469 + break;
470 + }
471
472 - /* Add another reference to the object! */
473 + /*
474 + * June 2013:
475 + * buffer_fields/field_units require additional resolution
476 + */
477 + switch (return_desc->common.type) {
478 + case ACPI_TYPE_BUFFER_FIELD:
479 + case ACPI_TYPE_LOCAL_REGION_FIELD:
480 + case ACPI_TYPE_LOCAL_BANK_FIELD:
481 + case ACPI_TYPE_LOCAL_INDEX_FIELD:
482
483 - acpi_ut_add_reference(return_desc);
484 + status =
485 + acpi_ex_read_data_from_field
486 + (walk_state, return_desc,
487 + &temp_desc);
488 + if (ACPI_FAILURE(status)) {
489 + goto cleanup;
490 + }
491 +
492 + return_desc = temp_desc;
493 + break;
494 +
495 + default:
496 +
497 + /* Add another reference to the object */
498 +
499 + acpi_ut_add_reference
500 + (return_desc);
501 + break;
502 + }
503 + }
504 break;
505
506 default:
507 diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c
508 index 93c6049c2d75..b1ad39443cb6 100644
509 --- a/drivers/acpi/acpica/exstore.c
510 +++ b/drivers/acpi/acpica/exstore.c
511 @@ -57,6 +57,11 @@ acpi_ex_store_object_to_index(union acpi_operand_object *val_desc,
512 union acpi_operand_object *dest_desc,
513 struct acpi_walk_state *walk_state);
514
515 +static acpi_status
516 +acpi_ex_store_direct_to_node(union acpi_operand_object *source_desc,
517 + struct acpi_namespace_node *node,
518 + struct acpi_walk_state *walk_state);
519 +
520 /*******************************************************************************
521 *
522 * FUNCTION: acpi_ex_store
523 @@ -376,7 +381,11 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
524 * When storing into an object the data is converted to the
525 * target object type then stored in the object. This means
526 * that the target object type (for an initialized target) will
527 - * not be changed by a store operation.
528 + * not be changed by a store operation. A copy_object can change
529 + * the target type, however.
530 + *
531 + * The implicit_conversion flag is set to NO/FALSE only when
532 + * storing to an arg_x -- as per the rules of the ACPI spec.
533 *
534 * Assumes parameters are already validated.
535 *
536 @@ -400,7 +409,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
537 target_type = acpi_ns_get_type(node);
538 target_desc = acpi_ns_get_attached_object(node);
539
540 - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
541 + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Storing %p (%s) to node %p (%s)\n",
542 source_desc,
543 acpi_ut_get_object_type_name(source_desc), node,
544 acpi_ut_get_type_name(target_type)));
545 @@ -414,46 +423,31 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
546 return_ACPI_STATUS(status);
547 }
548
549 - /* If no implicit conversion, drop into the default case below */
550 -
551 - if ((!implicit_conversion) ||
552 - ((walk_state->opcode == AML_COPY_OP) &&
553 - (target_type != ACPI_TYPE_LOCAL_REGION_FIELD) &&
554 - (target_type != ACPI_TYPE_LOCAL_BANK_FIELD) &&
555 - (target_type != ACPI_TYPE_LOCAL_INDEX_FIELD))) {
556 - /*
557 - * Force execution of default (no implicit conversion). Note:
558 - * copy_object does not perform an implicit conversion, as per the ACPI
559 - * spec -- except in case of region/bank/index fields -- because these
560 - * objects must retain their original type permanently.
561 - */
562 - target_type = ACPI_TYPE_ANY;
563 - }
564 -
565 /* Do the actual store operation */
566
567 switch (target_type) {
568 - case ACPI_TYPE_BUFFER_FIELD:
569 - case ACPI_TYPE_LOCAL_REGION_FIELD:
570 - case ACPI_TYPE_LOCAL_BANK_FIELD:
571 - case ACPI_TYPE_LOCAL_INDEX_FIELD:
572 -
573 - /* For fields, copy the source data to the target field. */
574 -
575 - status = acpi_ex_write_data_to_field(source_desc, target_desc,
576 - &walk_state->result_obj);
577 - break;
578 -
579 case ACPI_TYPE_INTEGER:
580 case ACPI_TYPE_STRING:
581 case ACPI_TYPE_BUFFER:
582
583 /*
584 - * These target types are all of type Integer/String/Buffer, and
585 - * therefore support implicit conversion before the store.
586 - *
587 - * Copy and/or convert the source object to a new target object
588 + * The simple data types all support implicit source operand
589 + * conversion before the store.
590 */
591 +
592 + if ((walk_state->opcode == AML_COPY_OP) || !implicit_conversion) {
593 + /*
594 + * However, copy_object and Stores to arg_x do not perform
595 + * an implicit conversion, as per the ACPI specification.
596 + * A direct store is performed instead.
597 + */
598 + status = acpi_ex_store_direct_to_node(source_desc, node,
599 + walk_state);
600 + break;
601 + }
602 +
603 + /* Store with implicit source operand conversion support */
604 +
605 status =
606 acpi_ex_store_object_to_object(source_desc, target_desc,
607 &new_desc, walk_state);
608 @@ -467,13 +461,12 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
609 * the Name's type to that of the value being stored in it.
610 * source_desc reference count is incremented by attach_object.
611 *
612 - * Note: This may change the type of the node if an explicit store
613 - * has been performed such that the node/object type has been
614 - * changed.
615 + * Note: This may change the type of the node if an explicit
616 + * store has been performed such that the node/object type
617 + * has been changed.
618 */
619 - status =
620 - acpi_ns_attach_object(node, new_desc,
621 - new_desc->common.type);
622 + status = acpi_ns_attach_object(node, new_desc,
623 + new_desc->common.type);
624
625 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
626 "Store %s into %s via Convert/Attach\n",
627 @@ -484,38 +477,83 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
628 }
629 break;
630
631 - default:
632 -
633 - ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
634 - "Storing [%s] (%p) directly into node [%s] (%p)"
635 - " with no implicit conversion\n",
636 - acpi_ut_get_object_type_name(source_desc),
637 - source_desc,
638 - acpi_ut_get_object_type_name(target_desc),
639 - node));
640 + case ACPI_TYPE_BUFFER_FIELD:
641 + case ACPI_TYPE_LOCAL_REGION_FIELD:
642 + case ACPI_TYPE_LOCAL_BANK_FIELD:
643 + case ACPI_TYPE_LOCAL_INDEX_FIELD:
644 + /*
645 + * For all fields, always write the source data to the target
646 + * field. Any required implicit source operand conversion is
647 + * performed in the function below as necessary. Note, field
648 + * objects must retain their original type permanently.
649 + */
650 + status = acpi_ex_write_data_to_field(source_desc, target_desc,
651 + &walk_state->result_obj);
652 + break;
653
654 + default:
655 /*
656 * No conversions for all other types. Directly store a copy of
657 - * the source object. NOTE: This is a departure from the ACPI
658 - * spec, which states "If conversion is impossible, abort the
659 - * running control method".
660 + * the source object. This is the ACPI spec-defined behavior for
661 + * the copy_object operator.
662 *
663 - * This code implements "If conversion is impossible, treat the
664 - * Store operation as a CopyObject".
665 + * NOTE: For the Store operator, this is a departure from the
666 + * ACPI spec, which states "If conversion is impossible, abort
667 + * the running control method". Instead, this code implements
668 + * "If conversion is impossible, treat the Store operation as
669 + * a CopyObject".
670 */
671 - status =
672 - acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc,
673 - walk_state);
674 - if (ACPI_FAILURE(status)) {
675 - return_ACPI_STATUS(status);
676 - }
677 -
678 - status =
679 - acpi_ns_attach_object(node, new_desc,
680 - new_desc->common.type);
681 - acpi_ut_remove_reference(new_desc);
682 + status = acpi_ex_store_direct_to_node(source_desc, node,
683 + walk_state);
684 break;
685 }
686
687 return_ACPI_STATUS(status);
688 }
689 +
690 +/*******************************************************************************
691 + *
692 + * FUNCTION: acpi_ex_store_direct_to_node
693 + *
694 + * PARAMETERS: source_desc - Value to be stored
695 + * node - Named object to receive the value
696 + * walk_state - Current walk state
697 + *
698 + * RETURN: Status
699 + *
700 + * DESCRIPTION: "Store" an object directly to a node. This involves a copy
701 + * and an attach.
702 + *
703 + ******************************************************************************/
704 +
705 +static acpi_status
706 +acpi_ex_store_direct_to_node(union acpi_operand_object *source_desc,
707 + struct acpi_namespace_node *node,
708 + struct acpi_walk_state *walk_state)
709 +{
710 + acpi_status status;
711 + union acpi_operand_object *new_desc;
712 +
713 + ACPI_FUNCTION_TRACE(ex_store_direct_to_node);
714 +
715 + ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
716 + "Storing [%s] (%p) directly into node [%s] (%p)"
717 + " with no implicit conversion\n",
718 + acpi_ut_get_object_type_name(source_desc),
719 + source_desc, acpi_ut_get_type_name(node->type),
720 + node));
721 +
722 + /* Copy the source object to a new object */
723 +
724 + status =
725 + acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc, walk_state);
726 + if (ACPI_FAILURE(status)) {
727 + return_ACPI_STATUS(status);
728 + }
729 +
730 + /* Attach the new object to the node */
731 +
732 + status = acpi_ns_attach_object(node, new_desc, new_desc->common.type);
733 + acpi_ut_remove_reference(new_desc);
734 + return_ACPI_STATUS(status);
735 +}
736 diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
737 index 45af90a1ec1b..1ad5a4f9e0c3 100644
738 --- a/drivers/acpi/ec.c
739 +++ b/drivers/acpi/ec.c
740 @@ -175,9 +175,10 @@ static void start_transaction(struct acpi_ec *ec)
741 static void advance_transaction(struct acpi_ec *ec, u8 status)
742 {
743 unsigned long flags;
744 - struct transaction *t = ec->curr;
745 + struct transaction *t;
746
747 spin_lock_irqsave(&ec->lock, flags);
748 + t = ec->curr;
749 if (!t)
750 goto unlock;
751 if (t->wlen > t->wi) {
752 diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
753 index e427dc516c76..e36842b9e1fa 100644
754 --- a/drivers/acpi/pci_root.c
755 +++ b/drivers/acpi/pci_root.c
756 @@ -614,9 +614,12 @@ static void handle_root_bridge_removal(struct acpi_device *device)
757 ej_event->device = device;
758 ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
759
760 + get_device(&device->dev);
761 status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, ej_event);
762 - if (ACPI_FAILURE(status))
763 + if (ACPI_FAILURE(status)) {
764 + put_device(&device->dev);
765 kfree(ej_event);
766 + }
767 }
768
769 static void _handle_hotplug_event_root(struct work_struct *work)
770 diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
771 index eb133c77aadb..4056d3175178 100644
772 --- a/drivers/acpi/processor_idle.c
773 +++ b/drivers/acpi/processor_idle.c
774 @@ -121,17 +121,10 @@ static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = {
775 */
776 static void acpi_safe_halt(void)
777 {
778 - current_thread_info()->status &= ~TS_POLLING;
779 - /*
780 - * TS_POLLING-cleared state must be visible before we
781 - * test NEED_RESCHED:
782 - */
783 - smp_mb();
784 - if (!need_resched()) {
785 + if (!tif_need_resched()) {
786 safe_halt();
787 local_irq_disable();
788 }
789 - current_thread_info()->status |= TS_POLLING;
790 }
791
792 #ifdef ARCH_APICTIMER_STOPS_ON_C3
793 @@ -739,6 +732,11 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
794 if (unlikely(!pr))
795 return -EINVAL;
796
797 + if (cx->entry_method == ACPI_CSTATE_FFH) {
798 + if (current_set_polling_and_test())
799 + return -EINVAL;
800 + }
801 +
802 lapic_timer_state_broadcast(pr, cx, 1);
803 acpi_idle_do_entry(cx);
804
805 @@ -792,18 +790,9 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
806 if (unlikely(!pr))
807 return -EINVAL;
808
809 - if (cx->entry_method != ACPI_CSTATE_FFH) {
810 - current_thread_info()->status &= ~TS_POLLING;
811 - /*
812 - * TS_POLLING-cleared state must be visible before we test
813 - * NEED_RESCHED:
814 - */
815 - smp_mb();
816 -
817 - if (unlikely(need_resched())) {
818 - current_thread_info()->status |= TS_POLLING;
819 + if (cx->entry_method == ACPI_CSTATE_FFH) {
820 + if (current_set_polling_and_test())
821 return -EINVAL;
822 - }
823 }
824
825 /*
826 @@ -821,9 +810,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
827
828 sched_clock_idle_wakeup_event(0);
829
830 - if (cx->entry_method != ACPI_CSTATE_FFH)
831 - current_thread_info()->status |= TS_POLLING;
832 -
833 lapic_timer_state_broadcast(pr, cx, 0);
834 return index;
835 }
836 @@ -860,18 +846,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
837 }
838 }
839
840 - if (cx->entry_method != ACPI_CSTATE_FFH) {
841 - current_thread_info()->status &= ~TS_POLLING;
842 - /*
843 - * TS_POLLING-cleared state must be visible before we test
844 - * NEED_RESCHED:
845 - */
846 - smp_mb();
847 -
848 - if (unlikely(need_resched())) {
849 - current_thread_info()->status |= TS_POLLING;
850 + if (cx->entry_method == ACPI_CSTATE_FFH) {
851 + if (current_set_polling_and_test())
852 return -EINVAL;
853 - }
854 }
855
856 acpi_unlazy_tlb(smp_processor_id());
857 @@ -917,9 +894,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
858
859 sched_clock_idle_wakeup_event(0);
860
861 - if (cx->entry_method != ACPI_CSTATE_FFH)
862 - current_thread_info()->status |= TS_POLLING;
863 -
864 lapic_timer_state_broadcast(pr, cx, 0);
865 return index;
866 }
867 diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
868 index af658b2ff279..362f0c2aa1ea 100644
869 --- a/drivers/acpi/scan.c
870 +++ b/drivers/acpi/scan.c
871 @@ -244,8 +244,6 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source)
872 goto out;
873 }
874 }
875 - acpi_evaluate_hotplug_ost(handle, ost_source,
876 - ACPI_OST_SC_INSERT_IN_PROGRESS, NULL);
877 error = acpi_bus_scan(handle);
878 if (error) {
879 acpi_handle_warn(handle, "Namespace scan failure\n");
880 diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
881 index 0e4b96b62c75..055dfdfd7348 100644
882 --- a/drivers/acpi/video.c
883 +++ b/drivers/acpi/video.c
884 @@ -846,7 +846,7 @@ acpi_video_init_brightness(struct acpi_video_device *device)
885 for (i = 2; i < br->count; i++)
886 if (level_old == br->levels[i])
887 break;
888 - if (i == br->count)
889 + if (i == br->count || !level)
890 level = max_level;
891 }
892
893 diff --git a/drivers/block/brd.c b/drivers/block/brd.c
894 index 9bf4371755f2..d91f1a56e861 100644
895 --- a/drivers/block/brd.c
896 +++ b/drivers/block/brd.c
897 @@ -545,7 +545,7 @@ static struct kobject *brd_probe(dev_t dev, int *part, void *data)
898
899 mutex_lock(&brd_devices_mutex);
900 brd = brd_init_one(MINOR(dev) >> part_shift);
901 - kobj = brd ? get_disk(brd->brd_disk) : ERR_PTR(-ENOMEM);
902 + kobj = brd ? get_disk(brd->brd_disk) : NULL;
903 mutex_unlock(&brd_devices_mutex);
904
905 *part = 0;
906 diff --git a/drivers/block/loop.c b/drivers/block/loop.c
907 index d92d50fd84b7..00559736cee4 100644
908 --- a/drivers/block/loop.c
909 +++ b/drivers/block/loop.c
910 @@ -1741,7 +1741,7 @@ static struct kobject *loop_probe(dev_t dev, int *part, void *data)
911 if (err < 0)
912 err = loop_add(&lo, MINOR(dev) >> part_shift);
913 if (err < 0)
914 - kobj = ERR_PTR(err);
915 + kobj = NULL;
916 else
917 kobj = get_disk(lo->lo_disk);
918 mutex_unlock(&loop_index_mutex);
919 diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
920 index b95159b33c39..eb760a218da4 100644
921 --- a/drivers/firmware/dmi_scan.c
922 +++ b/drivers/firmware/dmi_scan.c
923 @@ -551,9 +551,15 @@ static bool dmi_matches(const struct dmi_system_id *dmi)
924 int s = dmi->matches[i].slot;
925 if (s == DMI_NONE)
926 break;
927 - if (dmi_ident[s]
928 - && strstr(dmi_ident[s], dmi->matches[i].substr))
929 - continue;
930 + if (dmi_ident[s]) {
931 + if (!dmi->matches[i].exact_match &&
932 + strstr(dmi_ident[s], dmi->matches[i].substr))
933 + continue;
934 + else if (dmi->matches[i].exact_match &&
935 + !strcmp(dmi_ident[s], dmi->matches[i].substr))
936 + continue;
937 + }
938 +
939 /* No match */
940 return false;
941 }
942 diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
943 index 29412cc89c7a..f77d42f74427 100644
944 --- a/drivers/gpu/drm/i915/intel_lvds.c
945 +++ b/drivers/gpu/drm/i915/intel_lvds.c
946 @@ -869,6 +869,30 @@ static const struct dmi_system_id intel_no_lvds[] = {
947 DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Q900"),
948 },
949 },
950 + {
951 + .callback = intel_no_lvds_dmi_callback,
952 + .ident = "Intel D410PT",
953 + .matches = {
954 + DMI_MATCH(DMI_BOARD_VENDOR, "Intel"),
955 + DMI_MATCH(DMI_BOARD_NAME, "D410PT"),
956 + },
957 + },
958 + {
959 + .callback = intel_no_lvds_dmi_callback,
960 + .ident = "Intel D425KT",
961 + .matches = {
962 + DMI_MATCH(DMI_BOARD_VENDOR, "Intel"),
963 + DMI_EXACT_MATCH(DMI_BOARD_NAME, "D425KT"),
964 + },
965 + },
966 + {
967 + .callback = intel_no_lvds_dmi_callback,
968 + .ident = "Intel D510MO",
969 + .matches = {
970 + DMI_MATCH(DMI_BOARD_VENDOR, "Intel"),
971 + DMI_EXACT_MATCH(DMI_BOARD_NAME, "D510MO"),
972 + },
973 + },
974
975 { } /* terminating entry */
976 };
977 diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c
978 index 373dbcc523b2..a19e7d79b847 100644
979 --- a/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c
980 +++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c
981 @@ -36,6 +36,8 @@ nva3_hda_eld(struct nv50_disp_priv *priv, int or, u8 *data, u32 size)
982 if (data && data[0]) {
983 for (i = 0; i < size; i++)
984 nv_wr32(priv, 0x61c440 + soff, (i << 8) | data[i]);
985 + for (; i < 0x60; i++)
986 + nv_wr32(priv, 0x61c440 + soff, (i << 8));
987 nv_mask(priv, 0x61c448 + soff, 0x80000003, 0x80000003);
988 } else
989 if (data) {
990 diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c
991 index dc57e24fc1df..717639386ced 100644
992 --- a/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c
993 +++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c
994 @@ -41,6 +41,8 @@ nvd0_hda_eld(struct nv50_disp_priv *priv, int or, u8 *data, u32 size)
995 if (data && data[0]) {
996 for (i = 0; i < size; i++)
997 nv_wr32(priv, 0x10ec00 + soff, (i << 8) | data[i]);
998 + for (; i < 0x60; i++)
999 + nv_wr32(priv, 0x10ec00 + soff, (i << 8));
1000 nv_mask(priv, 0x10ec10 + soff, 0x80000003, 0x80000003);
1001 } else
1002 if (data) {
1003 diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c
1004 index ab1e918469a8..526b75242899 100644
1005 --- a/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c
1006 +++ b/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c
1007 @@ -47,14 +47,8 @@ int
1008 nv50_sor_mthd(struct nouveau_object *object, u32 mthd, void *args, u32 size)
1009 {
1010 struct nv50_disp_priv *priv = (void *)object->engine;
1011 - struct nouveau_bios *bios = nouveau_bios(priv);
1012 - const u16 type = (mthd & NV50_DISP_SOR_MTHD_TYPE) >> 12;
1013 const u8 head = (mthd & NV50_DISP_SOR_MTHD_HEAD) >> 3;
1014 - const u8 link = (mthd & NV50_DISP_SOR_MTHD_LINK) >> 2;
1015 const u8 or = (mthd & NV50_DISP_SOR_MTHD_OR);
1016 - const u16 mask = (0x0100 << head) | (0x0040 << link) | (0x0001 << or);
1017 - struct dcb_output outp;
1018 - u8 ver, hdr;
1019 u32 data;
1020 int ret = -EINVAL;
1021
1022 @@ -62,8 +56,6 @@ nv50_sor_mthd(struct nouveau_object *object, u32 mthd, void *args, u32 size)
1023 return -EINVAL;
1024 data = *(u32 *)args;
1025
1026 - if (type && !dcb_outp_match(bios, type, mask, &ver, &hdr, &outp))
1027 - return -ENODEV;
1028
1029 switch (mthd & ~0x3f) {
1030 case NV50_DISP_SOR_PWR:
1031 diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
1032 index 8eeb141c85ac..74813130d211 100644
1033 --- a/drivers/hwmon/lm90.c
1034 +++ b/drivers/hwmon/lm90.c
1035 @@ -278,7 +278,7 @@ static const struct lm90_params lm90_params[] = {
1036 [max6696] = {
1037 .flags = LM90_HAVE_EMERGENCY
1038 | LM90_HAVE_EMERGENCY_ALARM | LM90_HAVE_TEMP3,
1039 - .alert_alarms = 0x187c,
1040 + .alert_alarms = 0x1c7c,
1041 .max_convrate = 6,
1042 .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
1043 },
1044 @@ -1500,19 +1500,22 @@ static void lm90_alert(struct i2c_client *client, unsigned int flag)
1045 if ((alarms & 0x7f) == 0 && (alarms2 & 0xfe) == 0) {
1046 dev_info(&client->dev, "Everything OK\n");
1047 } else {
1048 - if (alarms & 0x61)
1049 + if ((alarms & 0x61) || (alarms2 & 0x80))
1050 dev_warn(&client->dev,
1051 "temp%d out of range, please check!\n", 1);
1052 - if (alarms & 0x1a)
1053 + if ((alarms & 0x1a) || (alarms2 & 0x20))
1054 dev_warn(&client->dev,
1055 "temp%d out of range, please check!\n", 2);
1056 if (alarms & 0x04)
1057 dev_warn(&client->dev,
1058 "temp%d diode open, please check!\n", 2);
1059
1060 - if (alarms2 & 0x18)
1061 + if (alarms2 & 0x5a)
1062 dev_warn(&client->dev,
1063 "temp%d out of range, please check!\n", 3);
1064 + if (alarms2 & 0x04)
1065 + dev_warn(&client->dev,
1066 + "temp%d diode open, please check!\n", 3);
1067
1068 /*
1069 * Disable ALERT# output, because these chips don't implement
1070 diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
1071 index fa6964d8681a..f116d664b473 100644
1072 --- a/drivers/idle/intel_idle.c
1073 +++ b/drivers/idle/intel_idle.c
1074 @@ -359,7 +359,7 @@ static int intel_idle(struct cpuidle_device *dev,
1075 if (!(lapic_timer_reliable_states & (1 << (cstate))))
1076 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
1077
1078 - if (!need_resched()) {
1079 + if (!current_set_polling_and_test()) {
1080
1081 __monitor((void *)&current_thread_info()->flags, 0, 0);
1082 smp_mb();
1083 diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c
1084 index d0c6907dfd92..994ca4aff1a3 100644
1085 --- a/drivers/misc/mei/nfc.c
1086 +++ b/drivers/misc/mei/nfc.c
1087 @@ -485,8 +485,11 @@ int mei_nfc_host_init(struct mei_device *dev)
1088 if (ndev->cl_info)
1089 return 0;
1090
1091 - cl_info = mei_cl_allocate(dev);
1092 - cl = mei_cl_allocate(dev);
1093 + ndev->cl_info = mei_cl_allocate(dev);
1094 + ndev->cl = mei_cl_allocate(dev);
1095 +
1096 + cl = ndev->cl;
1097 + cl_info = ndev->cl_info;
1098
1099 if (!cl || !cl_info) {
1100 ret = -ENOMEM;
1101 @@ -527,10 +530,9 @@ int mei_nfc_host_init(struct mei_device *dev)
1102
1103 cl->device_uuid = mei_nfc_guid;
1104
1105 +
1106 list_add_tail(&cl->device_link, &dev->device_list);
1107
1108 - ndev->cl_info = cl_info;
1109 - ndev->cl = cl;
1110 ndev->req_id = 1;
1111
1112 INIT_WORK(&ndev->init_work, mei_nfc_init);
1113 diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
1114 index a668cd491cb3..e3fc07cf2f62 100644
1115 --- a/drivers/net/can/c_can/c_can.c
1116 +++ b/drivers/net/can/c_can/c_can.c
1117 @@ -814,9 +814,6 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota)
1118 msg_ctrl_save = priv->read_reg(priv,
1119 C_CAN_IFACE(MSGCTRL_REG, 0));
1120
1121 - if (msg_ctrl_save & IF_MCONT_EOB)
1122 - return num_rx_pkts;
1123 -
1124 if (msg_ctrl_save & IF_MCONT_MSGLST) {
1125 c_can_handle_lost_msg_obj(dev, 0, msg_obj);
1126 num_rx_pkts++;
1127 @@ -824,6 +821,9 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota)
1128 continue;
1129 }
1130
1131 + if (msg_ctrl_save & IF_MCONT_EOB)
1132 + return num_rx_pkts;
1133 +
1134 if (!(msg_ctrl_save & IF_MCONT_NEWDAT))
1135 continue;
1136
1137 diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
1138 index 3b9546588240..4b2d5ed62b11 100644
1139 --- a/drivers/net/can/usb/kvaser_usb.c
1140 +++ b/drivers/net/can/usb/kvaser_usb.c
1141 @@ -1544,9 +1544,9 @@ static int kvaser_usb_init_one(struct usb_interface *intf,
1142 return 0;
1143 }
1144
1145 -static void kvaser_usb_get_endpoints(const struct usb_interface *intf,
1146 - struct usb_endpoint_descriptor **in,
1147 - struct usb_endpoint_descriptor **out)
1148 +static int kvaser_usb_get_endpoints(const struct usb_interface *intf,
1149 + struct usb_endpoint_descriptor **in,
1150 + struct usb_endpoint_descriptor **out)
1151 {
1152 const struct usb_host_interface *iface_desc;
1153 struct usb_endpoint_descriptor *endpoint;
1154 @@ -1557,12 +1557,18 @@ static void kvaser_usb_get_endpoints(const struct usb_interface *intf,
1155 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
1156 endpoint = &iface_desc->endpoint[i].desc;
1157
1158 - if (usb_endpoint_is_bulk_in(endpoint))
1159 + if (!*in && usb_endpoint_is_bulk_in(endpoint))
1160 *in = endpoint;
1161
1162 - if (usb_endpoint_is_bulk_out(endpoint))
1163 + if (!*out && usb_endpoint_is_bulk_out(endpoint))
1164 *out = endpoint;
1165 +
1166 + /* use first bulk endpoint for in and out */
1167 + if (*in && *out)
1168 + return 0;
1169 }
1170 +
1171 + return -ENODEV;
1172 }
1173
1174 static int kvaser_usb_probe(struct usb_interface *intf,
1175 @@ -1576,8 +1582,8 @@ static int kvaser_usb_probe(struct usb_interface *intf,
1176 if (!dev)
1177 return -ENOMEM;
1178
1179 - kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out);
1180 - if (!dev->bulk_in || !dev->bulk_out) {
1181 + err = kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out);
1182 + if (err) {
1183 dev_err(&intf->dev, "Cannot get usb endpoint(s)");
1184 return err;
1185 }
1186 diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
1187 index 668dd27616a0..cc6a0a586f0b 100644
1188 --- a/drivers/net/wireless/libertas/debugfs.c
1189 +++ b/drivers/net/wireless/libertas/debugfs.c
1190 @@ -913,7 +913,10 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf,
1191 char *p2;
1192 struct debug_data *d = f->private_data;
1193
1194 - pdata = kmalloc(cnt, GFP_KERNEL);
1195 + if (cnt == 0)
1196 + return 0;
1197 +
1198 + pdata = kmalloc(cnt + 1, GFP_KERNEL);
1199 if (pdata == NULL)
1200 return 0;
1201
1202 @@ -922,6 +925,7 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf,
1203 kfree(pdata);
1204 return 0;
1205 }
1206 + pdata[cnt] = '\0';
1207
1208 p0 = pdata;
1209 for (i = 0; i < num_of_items; i++) {
1210 diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
1211 index f281971919f5..12652d204f7e 100644
1212 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
1213 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
1214 @@ -3400,10 +3400,13 @@ void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual,
1215
1216 vgc = rt2800_get_default_vgc(rt2x00dev);
1217
1218 - if (rt2x00_rt(rt2x00dev, RT5592) && qual->rssi > -65)
1219 - vgc += 0x20;
1220 - else if (qual->rssi > -80)
1221 - vgc += 0x10;
1222 + if (rt2x00_rt(rt2x00dev, RT5592)) {
1223 + if (qual->rssi > -65)
1224 + vgc += 0x20;
1225 + } else {
1226 + if (qual->rssi > -80)
1227 + vgc += 0x10;
1228 + }
1229
1230 rt2800_set_vgc(rt2x00dev, qual, vgc);
1231 }
1232 diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
1233 index ac854d75bd6c..9ef0711a5cc1 100644
1234 --- a/drivers/net/wireless/rt2x00/rt2800usb.c
1235 +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
1236 @@ -148,6 +148,8 @@ static bool rt2800usb_txstatus_timeout(struct rt2x00_dev *rt2x00dev)
1237 return false;
1238 }
1239
1240 +#define TXSTATUS_READ_INTERVAL 1000000
1241 +
1242 static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
1243 int urb_status, u32 tx_status)
1244 {
1245 @@ -176,8 +178,9 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
1246 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
1247
1248 if (rt2800usb_txstatus_pending(rt2x00dev)) {
1249 - /* Read register after 250 us */
1250 - hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000),
1251 + /* Read register after 1 ms */
1252 + hrtimer_start(&rt2x00dev->txstatus_timer,
1253 + ktime_set(0, TXSTATUS_READ_INTERVAL),
1254 HRTIMER_MODE_REL);
1255 return false;
1256 }
1257 @@ -202,8 +205,9 @@ static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev)
1258 if (test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags))
1259 return;
1260
1261 - /* Read TX_STA_FIFO register after 500 us */
1262 - hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 500000),
1263 + /* Read TX_STA_FIFO register after 2 ms */
1264 + hrtimer_start(&rt2x00dev->txstatus_timer,
1265 + ktime_set(0, 2*TXSTATUS_READ_INTERVAL),
1266 HRTIMER_MODE_REL);
1267 }
1268
1269 diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
1270 index 90dc14336980..a2889d1cfe37 100644
1271 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
1272 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
1273 @@ -181,6 +181,7 @@ static void rt2x00lib_autowakeup(struct work_struct *work)
1274 static void rt2x00lib_bc_buffer_iter(void *data, u8 *mac,
1275 struct ieee80211_vif *vif)
1276 {
1277 + struct ieee80211_tx_control control = {};
1278 struct rt2x00_dev *rt2x00dev = data;
1279 struct sk_buff *skb;
1280
1281 @@ -195,7 +196,7 @@ static void rt2x00lib_bc_buffer_iter(void *data, u8 *mac,
1282 */
1283 skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif);
1284 while (skb) {
1285 - rt2x00mac_tx(rt2x00dev->hw, NULL, skb);
1286 + rt2x00mac_tx(rt2x00dev->hw, &control, skb);
1287 skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif);
1288 }
1289 }
1290 diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
1291 index a0935987fa3a..7f40ab8e1bd8 100644
1292 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h
1293 +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
1294 @@ -146,7 +146,7 @@ void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length);
1295 * @local: frame is not from mac80211
1296 */
1297 int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
1298 - bool local);
1299 + struct ieee80211_sta *sta, bool local);
1300
1301 /**
1302 * rt2x00queue_update_beacon - Send new beacon from mac80211
1303 diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
1304 index f883802f3505..f8cff1f0b6b7 100644
1305 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c
1306 +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
1307 @@ -90,7 +90,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
1308 frag_skb->data, data_length, tx_info,
1309 (struct ieee80211_rts *)(skb->data));
1310
1311 - retval = rt2x00queue_write_tx_frame(queue, skb, true);
1312 + retval = rt2x00queue_write_tx_frame(queue, skb, NULL, true);
1313 if (retval) {
1314 dev_kfree_skb_any(skb);
1315 rt2x00_warn(rt2x00dev, "Failed to send RTS/CTS frame\n");
1316 @@ -151,7 +151,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw,
1317 goto exit_fail;
1318 }
1319
1320 - if (unlikely(rt2x00queue_write_tx_frame(queue, skb, false)))
1321 + if (unlikely(rt2x00queue_write_tx_frame(queue, skb, control->sta, false)))
1322 goto exit_fail;
1323
1324 /*
1325 @@ -754,6 +754,9 @@ void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
1326 struct rt2x00_dev *rt2x00dev = hw->priv;
1327 struct data_queue *queue;
1328
1329 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
1330 + return;
1331 +
1332 tx_queue_for_each(rt2x00dev, queue)
1333 rt2x00queue_flush_queue(queue, drop);
1334 }
1335 diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
1336 index d955741e48ff..1f17f5b64625 100644
1337 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
1338 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
1339 @@ -635,7 +635,7 @@ static void rt2x00queue_bar_check(struct queue_entry *entry)
1340 }
1341
1342 int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
1343 - bool local)
1344 + struct ieee80211_sta *sta, bool local)
1345 {
1346 struct ieee80211_tx_info *tx_info;
1347 struct queue_entry *entry;
1348 @@ -649,7 +649,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
1349 * after that we are free to use the skb->cb array
1350 * for our information.
1351 */
1352 - rt2x00queue_create_tx_descriptor(queue->rt2x00dev, skb, &txdesc, NULL);
1353 + rt2x00queue_create_tx_descriptor(queue->rt2x00dev, skb, &txdesc, sta);
1354
1355 /*
1356 * All information is retrieved from the skb->cb array,
1357 diff --git a/drivers/pci/access.c b/drivers/pci/access.c
1358 index 1cc23661f79b..061da8c3ab4b 100644
1359 --- a/drivers/pci/access.c
1360 +++ b/drivers/pci/access.c
1361 @@ -484,28 +484,29 @@ static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
1362 {
1363 int type = pci_pcie_type(dev);
1364
1365 - return pcie_cap_version(dev) > 1 ||
1366 + return type == PCI_EXP_TYPE_ENDPOINT ||
1367 + type == PCI_EXP_TYPE_LEG_END ||
1368 type == PCI_EXP_TYPE_ROOT_PORT ||
1369 - type == PCI_EXP_TYPE_ENDPOINT ||
1370 - type == PCI_EXP_TYPE_LEG_END;
1371 + type == PCI_EXP_TYPE_UPSTREAM ||
1372 + type == PCI_EXP_TYPE_DOWNSTREAM ||
1373 + type == PCI_EXP_TYPE_PCI_BRIDGE ||
1374 + type == PCI_EXP_TYPE_PCIE_BRIDGE;
1375 }
1376
1377 static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev)
1378 {
1379 int type = pci_pcie_type(dev);
1380
1381 - return pcie_cap_version(dev) > 1 ||
1382 - type == PCI_EXP_TYPE_ROOT_PORT ||
1383 - (type == PCI_EXP_TYPE_DOWNSTREAM &&
1384 - pcie_caps_reg(dev) & PCI_EXP_FLAGS_SLOT);
1385 + return (type == PCI_EXP_TYPE_ROOT_PORT ||
1386 + type == PCI_EXP_TYPE_DOWNSTREAM) &&
1387 + pcie_caps_reg(dev) & PCI_EXP_FLAGS_SLOT;
1388 }
1389
1390 static inline bool pcie_cap_has_rtctl(const struct pci_dev *dev)
1391 {
1392 int type = pci_pcie_type(dev);
1393
1394 - return pcie_cap_version(dev) > 1 ||
1395 - type == PCI_EXP_TYPE_ROOT_PORT ||
1396 + return type == PCI_EXP_TYPE_ROOT_PORT ||
1397 type == PCI_EXP_TYPE_RC_EC;
1398 }
1399
1400 diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
1401 index 1ef041bc60c8..ee6caddd978c 100644
1402 --- a/drivers/scsi/aacraid/commctrl.c
1403 +++ b/drivers/scsi/aacraid/commctrl.c
1404 @@ -510,7 +510,8 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
1405 goto cleanup;
1406 }
1407
1408 - if (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr))) {
1409 + if ((fibsize < (sizeof(struct user_aac_srb) - sizeof(struct user_sgentry))) ||
1410 + (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)))) {
1411 rcode = -EINVAL;
1412 goto cleanup;
1413 }
1414 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1415 index c8b9fa0e9275..1424a8988849 100644
1416 --- a/drivers/usb/core/hub.c
1417 +++ b/drivers/usb/core/hub.c
1418 @@ -1129,6 +1129,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
1419 usb_clear_port_feature(hub->hdev, port1,
1420 USB_PORT_FEAT_C_ENABLE);
1421 }
1422 + if (portchange & USB_PORT_STAT_C_RESET) {
1423 + need_debounce_delay = true;
1424 + usb_clear_port_feature(hub->hdev, port1,
1425 + USB_PORT_FEAT_C_RESET);
1426 + }
1427 if ((portchange & USB_PORT_STAT_C_BH_RESET) &&
1428 hub_is_superspeed(hub->hdev)) {
1429 need_debounce_delay = true;
1430 diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
1431 index 2c1749da1f7e..8b3d0abe7e14 100644
1432 --- a/drivers/usb/serial/mos7840.c
1433 +++ b/drivers/usb/serial/mos7840.c
1434 @@ -1593,7 +1593,11 @@ static int mos7840_tiocmget(struct tty_struct *tty)
1435 return -ENODEV;
1436
1437 status = mos7840_get_uart_reg(port, MODEM_STATUS_REGISTER, &msr);
1438 + if (status != 1)
1439 + return -EIO;
1440 status = mos7840_get_uart_reg(port, MODEM_CONTROL_REGISTER, &mcr);
1441 + if (status != 1)
1442 + return -EIO;
1443 result = ((mcr & MCR_DTR) ? TIOCM_DTR : 0)
1444 | ((mcr & MCR_RTS) ? TIOCM_RTS : 0)
1445 | ((mcr & MCR_LOOPBACK) ? TIOCM_LOOP : 0)
1446 diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
1447 index 7aabc6ad4e9b..fa38d076697d 100644
1448 --- a/fs/configfs/dir.c
1449 +++ b/fs/configfs/dir.c
1450 @@ -56,10 +56,19 @@ static void configfs_d_iput(struct dentry * dentry,
1451 struct configfs_dirent *sd = dentry->d_fsdata;
1452
1453 if (sd) {
1454 - BUG_ON(sd->s_dentry != dentry);
1455 /* Coordinate with configfs_readdir */
1456 spin_lock(&configfs_dirent_lock);
1457 - sd->s_dentry = NULL;
1458 + /* Coordinate with configfs_attach_attr where will increase
1459 + * sd->s_count and update sd->s_dentry to new allocated one.
1460 + * Only set sd->dentry to null when this dentry is the only
1461 + * sd owner.
1462 + * If not do so, configfs_d_iput may run just after
1463 + * configfs_attach_attr and set sd->s_dentry to null
1464 + * even it's still in use.
1465 + */
1466 + if (atomic_read(&sd->s_count) <= 2)
1467 + sd->s_dentry = NULL;
1468 +
1469 spin_unlock(&configfs_dirent_lock);
1470 configfs_put(sd);
1471 }
1472 @@ -426,8 +435,11 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den
1473 struct configfs_attribute * attr = sd->s_element;
1474 int error;
1475
1476 + spin_lock(&configfs_dirent_lock);
1477 dentry->d_fsdata = configfs_get(sd);
1478 sd->s_dentry = dentry;
1479 + spin_unlock(&configfs_dirent_lock);
1480 +
1481 error = configfs_create(dentry, (attr->ca_mode & S_IALLUGO) | S_IFREG,
1482 configfs_init_file);
1483 if (error) {
1484 diff --git a/fs/exec.c b/fs/exec.c
1485 index 1f446705636b..bb60cda5ee30 100644
1486 --- a/fs/exec.c
1487 +++ b/fs/exec.c
1488 @@ -1669,6 +1669,12 @@ int __get_dumpable(unsigned long mm_flags)
1489 return (ret > SUID_DUMP_USER) ? SUID_DUMP_ROOT : ret;
1490 }
1491
1492 +/*
1493 + * This returns the actual value of the suid_dumpable flag. For things
1494 + * that are using this for checking for privilege transitions, it must
1495 + * test against SUID_DUMP_USER rather than treating it as a boolean
1496 + * value.
1497 + */
1498 int get_dumpable(struct mm_struct *mm)
1499 {
1500 return __get_dumpable(mm->flags);
1501 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
1502 index d7ba5616989c..e78b8c2656ee 100644
1503 --- a/fs/nfs/nfs4proc.c
1504 +++ b/fs/nfs/nfs4proc.c
1505 @@ -1160,29 +1160,24 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data)
1506 int ret;
1507
1508 if (!data->rpc_done) {
1509 - ret = data->rpc_status;
1510 - goto err;
1511 + if (data->rpc_status) {
1512 + ret = data->rpc_status;
1513 + goto err;
1514 + }
1515 + /* cached opens have already been processed */
1516 + goto update;
1517 }
1518
1519 - ret = -ESTALE;
1520 - if (!(data->f_attr.valid & NFS_ATTR_FATTR_TYPE) ||
1521 - !(data->f_attr.valid & NFS_ATTR_FATTR_FILEID) ||
1522 - !(data->f_attr.valid & NFS_ATTR_FATTR_CHANGE))
1523 - goto err;
1524 -
1525 - ret = -ENOMEM;
1526 - state = nfs4_get_open_state(inode, data->owner);
1527 - if (state == NULL)
1528 - goto err;
1529 -
1530 ret = nfs_refresh_inode(inode, &data->f_attr);
1531 if (ret)
1532 goto err;
1533
1534 if (data->o_res.delegation_type != 0)
1535 nfs4_opendata_check_deleg(data, state);
1536 +update:
1537 update_open_stateid(state, &data->o_res.stateid, NULL,
1538 data->o_arg.fmode);
1539 + atomic_inc(&state->count);
1540
1541 return state;
1542 err:
1543 @@ -4572,6 +4567,7 @@ static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock
1544 status = 0;
1545 }
1546 request->fl_ops->fl_release_private(request);
1547 + request->fl_ops = NULL;
1548 out:
1549 return status;
1550 }
1551 diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
1552 index 5f38ea36e266..af51cf9bf2e3 100644
1553 --- a/fs/nfsd/export.c
1554 +++ b/fs/nfsd/export.c
1555 @@ -536,16 +536,12 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
1556 if (err)
1557 goto out3;
1558 exp.ex_anon_uid= make_kuid(&init_user_ns, an_int);
1559 - if (!uid_valid(exp.ex_anon_uid))
1560 - goto out3;
1561
1562 /* anon gid */
1563 err = get_int(&mesg, &an_int);
1564 if (err)
1565 goto out3;
1566 exp.ex_anon_gid= make_kgid(&init_user_ns, an_int);
1567 - if (!gid_valid(exp.ex_anon_gid))
1568 - goto out3;
1569
1570 /* fsid */
1571 err = get_int(&mesg, &an_int);
1572 @@ -583,6 +579,17 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
1573 exp.ex_uuid);
1574 if (err)
1575 goto out4;
1576 + /*
1577 + * For some reason exportfs has been passing down an
1578 + * invalid (-1) uid & gid on the "dummy" export which it
1579 + * uses to test export support. To make sure exportfs
1580 + * sees errors from check_export we therefore need to
1581 + * delay these checks till after check_export:
1582 + */
1583 + if (!uid_valid(exp.ex_anon_uid))
1584 + goto out4;
1585 + if (!gid_valid(exp.ex_anon_gid))
1586 + goto out4;
1587 }
1588
1589 expp = svc_export_lookup(&exp);
1590 diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
1591 index baf149a85263..62fd6616801d 100644
1592 --- a/fs/nfsd/vfs.c
1593 +++ b/fs/nfsd/vfs.c
1594 @@ -297,41 +297,12 @@ commit_metadata(struct svc_fh *fhp)
1595 }
1596
1597 /*
1598 - * Set various file attributes.
1599 - * N.B. After this call fhp needs an fh_put
1600 + * Go over the attributes and take care of the small differences between
1601 + * NFS semantics and what Linux expects.
1602 */
1603 -__be32
1604 -nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
1605 - int check_guard, time_t guardtime)
1606 +static void
1607 +nfsd_sanitize_attrs(struct inode *inode, struct iattr *iap)
1608 {
1609 - struct dentry *dentry;
1610 - struct inode *inode;
1611 - int accmode = NFSD_MAY_SATTR;
1612 - umode_t ftype = 0;
1613 - __be32 err;
1614 - int host_err;
1615 - int size_change = 0;
1616 -
1617 - if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE))
1618 - accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE;
1619 - if (iap->ia_valid & ATTR_SIZE)
1620 - ftype = S_IFREG;
1621 -
1622 - /* Get inode */
1623 - err = fh_verify(rqstp, fhp, ftype, accmode);
1624 - if (err)
1625 - goto out;
1626 -
1627 - dentry = fhp->fh_dentry;
1628 - inode = dentry->d_inode;
1629 -
1630 - /* Ignore any mode updates on symlinks */
1631 - if (S_ISLNK(inode->i_mode))
1632 - iap->ia_valid &= ~ATTR_MODE;
1633 -
1634 - if (!iap->ia_valid)
1635 - goto out;
1636 -
1637 /*
1638 * NFSv2 does not differentiate between "set-[ac]time-to-now"
1639 * which only requires access, and "set-[ac]time-to-X" which
1640 @@ -341,8 +312,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
1641 * convert to "set to now" instead of "set to explicit time"
1642 *
1643 * We only call inode_change_ok as the last test as technically
1644 - * it is not an interface that we should be using. It is only
1645 - * valid if the filesystem does not define it's own i_op->setattr.
1646 + * it is not an interface that we should be using.
1647 */
1648 #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET)
1649 #define MAX_TOUCH_TIME_ERROR (30*60)
1650 @@ -368,30 +338,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
1651 iap->ia_valid &= ~BOTH_TIME_SET;
1652 }
1653 }
1654 -
1655 - /*
1656 - * The size case is special.
1657 - * It changes the file as well as the attributes.
1658 - */
1659 - if (iap->ia_valid & ATTR_SIZE) {
1660 - if (iap->ia_size < inode->i_size) {
1661 - err = nfsd_permission(rqstp, fhp->fh_export, dentry,
1662 - NFSD_MAY_TRUNC|NFSD_MAY_OWNER_OVERRIDE);
1663 - if (err)
1664 - goto out;
1665 - }
1666 -
1667 - host_err = get_write_access(inode);
1668 - if (host_err)
1669 - goto out_nfserr;
1670 -
1671 - size_change = 1;
1672 - host_err = locks_verify_truncate(inode, NULL, iap->ia_size);
1673 - if (host_err) {
1674 - put_write_access(inode);
1675 - goto out_nfserr;
1676 - }
1677 - }
1678
1679 /* sanitize the mode change */
1680 if (iap->ia_valid & ATTR_MODE) {
1681 @@ -414,32 +360,111 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
1682 iap->ia_valid |= (ATTR_KILL_SUID | ATTR_KILL_SGID);
1683 }
1684 }
1685 +}
1686
1687 - /* Change the attributes. */
1688 +static __be32
1689 +nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp,
1690 + struct iattr *iap)
1691 +{
1692 + struct inode *inode = fhp->fh_dentry->d_inode;
1693 + int host_err;
1694
1695 - iap->ia_valid |= ATTR_CTIME;
1696 + if (iap->ia_size < inode->i_size) {
1697 + __be32 err;
1698
1699 - err = nfserr_notsync;
1700 - if (!check_guard || guardtime == inode->i_ctime.tv_sec) {
1701 - host_err = nfsd_break_lease(inode);
1702 - if (host_err)
1703 - goto out_nfserr;
1704 - fh_lock(fhp);
1705 + err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry,
1706 + NFSD_MAY_TRUNC | NFSD_MAY_OWNER_OVERRIDE);
1707 + if (err)
1708 + return err;
1709 + }
1710
1711 - host_err = notify_change(dentry, iap);
1712 - err = nfserrno(host_err);
1713 - fh_unlock(fhp);
1714 + host_err = get_write_access(inode);
1715 + if (host_err)
1716 + goto out_nfserrno;
1717 +
1718 + host_err = locks_verify_truncate(inode, NULL, iap->ia_size);
1719 + if (host_err)
1720 + goto out_put_write_access;
1721 + return 0;
1722 +
1723 +out_put_write_access:
1724 + put_write_access(inode);
1725 +out_nfserrno:
1726 + return nfserrno(host_err);
1727 +}
1728 +
1729 +/*
1730 + * Set various file attributes. After this call fhp needs an fh_put.
1731 + */
1732 +__be32
1733 +nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
1734 + int check_guard, time_t guardtime)
1735 +{
1736 + struct dentry *dentry;
1737 + struct inode *inode;
1738 + int accmode = NFSD_MAY_SATTR;
1739 + umode_t ftype = 0;
1740 + __be32 err;
1741 + int host_err;
1742 + int size_change = 0;
1743 +
1744 + if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE))
1745 + accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE;
1746 + if (iap->ia_valid & ATTR_SIZE)
1747 + ftype = S_IFREG;
1748 +
1749 + /* Get inode */
1750 + err = fh_verify(rqstp, fhp, ftype, accmode);
1751 + if (err)
1752 + goto out;
1753 +
1754 + dentry = fhp->fh_dentry;
1755 + inode = dentry->d_inode;
1756 +
1757 + /* Ignore any mode updates on symlinks */
1758 + if (S_ISLNK(inode->i_mode))
1759 + iap->ia_valid &= ~ATTR_MODE;
1760 +
1761 + if (!iap->ia_valid)
1762 + goto out;
1763 +
1764 + nfsd_sanitize_attrs(inode, iap);
1765 +
1766 + /*
1767 + * The size case is special, it changes the file in addition to the
1768 + * attributes.
1769 + */
1770 + if (iap->ia_valid & ATTR_SIZE) {
1771 + err = nfsd_get_write_access(rqstp, fhp, iap);
1772 + if (err)
1773 + goto out;
1774 + size_change = 1;
1775 }
1776 +
1777 + iap->ia_valid |= ATTR_CTIME;
1778 +
1779 + if (check_guard && guardtime != inode->i_ctime.tv_sec) {
1780 + err = nfserr_notsync;
1781 + goto out_put_write_access;
1782 + }
1783 +
1784 + host_err = nfsd_break_lease(inode);
1785 + if (host_err)
1786 + goto out_put_write_access_nfserror;
1787 +
1788 + fh_lock(fhp);
1789 + host_err = notify_change(dentry, iap);
1790 + fh_unlock(fhp);
1791 +
1792 +out_put_write_access_nfserror:
1793 + err = nfserrno(host_err);
1794 +out_put_write_access:
1795 if (size_change)
1796 put_write_access(inode);
1797 if (!err)
1798 commit_metadata(fhp);
1799 out:
1800 return err;
1801 -
1802 -out_nfserr:
1803 - err = nfserrno(host_err);
1804 - goto out;
1805 }
1806
1807 #if defined(CONFIG_NFSD_V2_ACL) || \
1808 diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
1809 index 70cf138690e9..df97ca4aae52 100644
1810 --- a/include/linux/binfmts.h
1811 +++ b/include/linux/binfmts.h
1812 @@ -99,9 +99,6 @@ extern void setup_new_exec(struct linux_binprm * bprm);
1813 extern void would_dump(struct linux_binprm *, struct file *);
1814
1815 extern int suid_dumpable;
1816 -#define SUID_DUMP_DISABLE 0 /* No setuid dumping */
1817 -#define SUID_DUMP_USER 1 /* Dump as user of process */
1818 -#define SUID_DUMP_ROOT 2 /* Dump as root */
1819
1820 /* Stack area protections */
1821 #define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */
1822 diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
1823 index b508016fb76d..b3bd7e737e8b 100644
1824 --- a/include/linux/mod_devicetable.h
1825 +++ b/include/linux/mod_devicetable.h
1826 @@ -456,7 +456,8 @@ enum dmi_field {
1827 };
1828
1829 struct dmi_strmatch {
1830 - unsigned char slot;
1831 + unsigned char slot:7;
1832 + unsigned char exact_match:1;
1833 char substr[79];
1834 };
1835
1836 @@ -474,7 +475,8 @@ struct dmi_system_id {
1837 */
1838 #define dmi_device_id dmi_system_id
1839
1840 -#define DMI_MATCH(a, b) { a, b }
1841 +#define DMI_MATCH(a, b) { .slot = a, .substr = b }
1842 +#define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, .exact_match = 1 }
1843
1844 #define PLATFORM_NAME_SIZE 20
1845 #define PLATFORM_MODULE_PREFIX "platform:"
1846 diff --git a/include/linux/sched.h b/include/linux/sched.h
1847 index 178a8d909f14..597c8ab005a0 100644
1848 --- a/include/linux/sched.h
1849 +++ b/include/linux/sched.h
1850 @@ -332,6 +332,10 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
1851 extern void set_dumpable(struct mm_struct *mm, int value);
1852 extern int get_dumpable(struct mm_struct *mm);
1853
1854 +#define SUID_DUMP_DISABLE 0 /* No setuid dumping */
1855 +#define SUID_DUMP_USER 1 /* Dump as user of process */
1856 +#define SUID_DUMP_ROOT 2 /* Dump as root */
1857 +
1858 /* mm flags */
1859 /* dumpable bits */
1860 #define MMF_DUMPABLE 0 /* core dump is permitted */
1861 @@ -2469,34 +2473,98 @@ static inline int tsk_is_polling(struct task_struct *p)
1862 {
1863 return task_thread_info(p)->status & TS_POLLING;
1864 }
1865 -static inline void current_set_polling(void)
1866 +static inline void __current_set_polling(void)
1867 {
1868 current_thread_info()->status |= TS_POLLING;
1869 }
1870
1871 -static inline void current_clr_polling(void)
1872 +static inline bool __must_check current_set_polling_and_test(void)
1873 +{
1874 + __current_set_polling();
1875 +
1876 + /*
1877 + * Polling state must be visible before we test NEED_RESCHED,
1878 + * paired by resched_task()
1879 + */
1880 + smp_mb();
1881 +
1882 + return unlikely(tif_need_resched());
1883 +}
1884 +
1885 +static inline void __current_clr_polling(void)
1886 {
1887 current_thread_info()->status &= ~TS_POLLING;
1888 - smp_mb__after_clear_bit();
1889 +}
1890 +
1891 +static inline bool __must_check current_clr_polling_and_test(void)
1892 +{
1893 + __current_clr_polling();
1894 +
1895 + /*
1896 + * Polling state must be visible before we test NEED_RESCHED,
1897 + * paired by resched_task()
1898 + */
1899 + smp_mb();
1900 +
1901 + return unlikely(tif_need_resched());
1902 }
1903 #elif defined(TIF_POLLING_NRFLAG)
1904 static inline int tsk_is_polling(struct task_struct *p)
1905 {
1906 return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG);
1907 }
1908 -static inline void current_set_polling(void)
1909 +
1910 +static inline void __current_set_polling(void)
1911 {
1912 set_thread_flag(TIF_POLLING_NRFLAG);
1913 }
1914
1915 -static inline void current_clr_polling(void)
1916 +static inline bool __must_check current_set_polling_and_test(void)
1917 +{
1918 + __current_set_polling();
1919 +
1920 + /*
1921 + * Polling state must be visible before we test NEED_RESCHED,
1922 + * paired by resched_task()
1923 + *
1924 + * XXX: assumes set/clear bit are identical barrier wise.
1925 + */
1926 + smp_mb__after_clear_bit();
1927 +
1928 + return unlikely(tif_need_resched());
1929 +}
1930 +
1931 +static inline void __current_clr_polling(void)
1932 {
1933 clear_thread_flag(TIF_POLLING_NRFLAG);
1934 }
1935 +
1936 +static inline bool __must_check current_clr_polling_and_test(void)
1937 +{
1938 + __current_clr_polling();
1939 +
1940 + /*
1941 + * Polling state must be visible before we test NEED_RESCHED,
1942 + * paired by resched_task()
1943 + */
1944 + smp_mb__after_clear_bit();
1945 +
1946 + return unlikely(tif_need_resched());
1947 +}
1948 +
1949 #else
1950 static inline int tsk_is_polling(struct task_struct *p) { return 0; }
1951 -static inline void current_set_polling(void) { }
1952 -static inline void current_clr_polling(void) { }
1953 +static inline void __current_set_polling(void) { }
1954 +static inline void __current_clr_polling(void) { }
1955 +
1956 +static inline bool __must_check current_set_polling_and_test(void)
1957 +{
1958 + return unlikely(tif_need_resched());
1959 +}
1960 +static inline bool __must_check current_clr_polling_and_test(void)
1961 +{
1962 + return unlikely(tif_need_resched());
1963 +}
1964 #endif
1965
1966 /*
1967 diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
1968 index e7e04736802f..4ae6f32c8033 100644
1969 --- a/include/linux/thread_info.h
1970 +++ b/include/linux/thread_info.h
1971 @@ -107,6 +107,8 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
1972 #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED)
1973 #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED)
1974
1975 +#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED)
1976 +
1977 #if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK
1978 /*
1979 * An arch can define its own version of set_restore_sigmask() to get the
1980 diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
1981 index 9031a26249b5..ae6c3b8ed2f5 100644
1982 --- a/include/sound/compress_driver.h
1983 +++ b/include/sound/compress_driver.h
1984 @@ -171,4 +171,13 @@ static inline void snd_compr_fragment_elapsed(struct snd_compr_stream *stream)
1985 wake_up(&stream->runtime->sleep);
1986 }
1987
1988 +static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
1989 +{
1990 + if (snd_BUG_ON(!stream))
1991 + return;
1992 +
1993 + stream->runtime->state = SNDRV_PCM_STATE_SETUP;
1994 + wake_up(&stream->runtime->sleep);
1995 +}
1996 +
1997 #endif
1998 diff --git a/ipc/shm.c b/ipc/shm.c
1999 index 7b87bea5245b..6dc55af8a29b 100644
2000 --- a/ipc/shm.c
2001 +++ b/ipc/shm.c
2002 @@ -208,15 +208,18 @@ static void shm_open(struct vm_area_struct *vma)
2003 */
2004 static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
2005 {
2006 + struct file *shm_file;
2007 +
2008 + shm_file = shp->shm_file;
2009 + shp->shm_file = NULL;
2010 ns->shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
2011 shm_rmid(ns, shp);
2012 shm_unlock(shp);
2013 - if (!is_file_hugepages(shp->shm_file))
2014 - shmem_lock(shp->shm_file, 0, shp->mlock_user);
2015 + if (!is_file_hugepages(shm_file))
2016 + shmem_lock(shm_file, 0, shp->mlock_user);
2017 else if (shp->mlock_user)
2018 - user_shm_unlock(file_inode(shp->shm_file)->i_size,
2019 - shp->mlock_user);
2020 - fput (shp->shm_file);
2021 + user_shm_unlock(file_inode(shm_file)->i_size, shp->mlock_user);
2022 + fput(shm_file);
2023 ipc_rcu_putref(shp, shm_rcu_free);
2024 }
2025
2026 @@ -974,15 +977,25 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
2027 ipc_lock_object(&shp->shm_perm);
2028 if (!ns_capable(ns->user_ns, CAP_IPC_LOCK)) {
2029 kuid_t euid = current_euid();
2030 - err = -EPERM;
2031 if (!uid_eq(euid, shp->shm_perm.uid) &&
2032 - !uid_eq(euid, shp->shm_perm.cuid))
2033 + !uid_eq(euid, shp->shm_perm.cuid)) {
2034 + err = -EPERM;
2035 goto out_unlock0;
2036 - if (cmd == SHM_LOCK && !rlimit(RLIMIT_MEMLOCK))
2037 + }
2038 + if (cmd == SHM_LOCK && !rlimit(RLIMIT_MEMLOCK)) {
2039 + err = -EPERM;
2040 goto out_unlock0;
2041 + }
2042 }
2043
2044 shm_file = shp->shm_file;
2045 +
2046 + /* check if shm_destroy() is tearing down shp */
2047 + if (shm_file == NULL) {
2048 + err = -EIDRM;
2049 + goto out_unlock0;
2050 + }
2051 +
2052 if (is_file_hugepages(shm_file))
2053 goto out_unlock0;
2054
2055 @@ -1101,6 +1114,14 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr,
2056 goto out_unlock;
2057
2058 ipc_lock_object(&shp->shm_perm);
2059 +
2060 + /* check if shm_destroy() is tearing down shp */
2061 + if (shp->shm_file == NULL) {
2062 + ipc_unlock_object(&shp->shm_perm);
2063 + err = -EIDRM;
2064 + goto out_unlock;
2065 + }
2066 +
2067 path = shp->shm_file->f_path;
2068 path_get(&path);
2069 shp->shm_nattch++;
2070 diff --git a/kernel/cpu/idle.c b/kernel/cpu/idle.c
2071 index e695c0a0bcb5..c261409500e4 100644
2072 --- a/kernel/cpu/idle.c
2073 +++ b/kernel/cpu/idle.c
2074 @@ -44,7 +44,7 @@ static inline int cpu_idle_poll(void)
2075 rcu_idle_enter();
2076 trace_cpu_idle_rcuidle(0, smp_processor_id());
2077 local_irq_enable();
2078 - while (!need_resched())
2079 + while (!tif_need_resched())
2080 cpu_relax();
2081 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
2082 rcu_idle_exit();
2083 @@ -92,8 +92,7 @@ static void cpu_idle_loop(void)
2084 if (cpu_idle_force_poll || tick_check_broadcast_expired()) {
2085 cpu_idle_poll();
2086 } else {
2087 - current_clr_polling();
2088 - if (!need_resched()) {
2089 + if (!current_clr_polling_and_test()) {
2090 stop_critical_timings();
2091 rcu_idle_enter();
2092 arch_cpu_idle();
2093 @@ -103,7 +102,7 @@ static void cpu_idle_loop(void)
2094 } else {
2095 local_irq_enable();
2096 }
2097 - current_set_polling();
2098 + __current_set_polling();
2099 }
2100 arch_cpu_idle_exit();
2101 }
2102 @@ -129,7 +128,7 @@ void cpu_startup_entry(enum cpuhp_state state)
2103 */
2104 boot_init_stack_canary();
2105 #endif
2106 - current_set_polling();
2107 + __current_set_polling();
2108 arch_cpu_idle_prepare();
2109 cpu_idle_loop();
2110 }
2111 diff --git a/kernel/ptrace.c b/kernel/ptrace.c
2112 index 335a7ae697f5..afadcf7b4a22 100644
2113 --- a/kernel/ptrace.c
2114 +++ b/kernel/ptrace.c
2115 @@ -257,7 +257,8 @@ ok:
2116 if (task->mm)
2117 dumpable = get_dumpable(task->mm);
2118 rcu_read_lock();
2119 - if (!dumpable && !ptrace_has_cap(__task_cred(task)->user_ns, mode)) {
2120 + if (dumpable != SUID_DUMP_USER &&
2121 + !ptrace_has_cap(__task_cred(task)->user_ns, mode)) {
2122 rcu_read_unlock();
2123 return -EPERM;
2124 }
2125 diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
2126 index 84b1e045faba..8354dc81ae64 100644
2127 --- a/kernel/trace/trace_event_perf.c
2128 +++ b/kernel/trace/trace_event_perf.c
2129 @@ -26,7 +26,7 @@ static int perf_trace_event_perm(struct ftrace_event_call *tp_event,
2130 {
2131 /* The ftrace function trace is allowed only for root. */
2132 if (ftrace_event_is_function(tp_event) &&
2133 - perf_paranoid_kernel() && !capable(CAP_SYS_ADMIN))
2134 + perf_paranoid_tracepoint_raw() && !capable(CAP_SYS_ADMIN))
2135 return -EPERM;
2136
2137 /* No tracing, just counting, so no obvious leak */
2138 diff --git a/mm/slub.c b/mm/slub.c
2139 index 57707f01bcfb..c34bd44e8be9 100644
2140 --- a/mm/slub.c
2141 +++ b/mm/slub.c
2142 @@ -1201,8 +1201,8 @@ static unsigned long kmem_cache_flags(unsigned long object_size,
2143 /*
2144 * Enable debugging if selected on the kernel commandline.
2145 */
2146 - if (slub_debug && (!slub_debug_slabs ||
2147 - !strncmp(slub_debug_slabs, name, strlen(slub_debug_slabs))))
2148 + if (slub_debug && (!slub_debug_slabs || (name &&
2149 + !strncmp(slub_debug_slabs, name, strlen(slub_debug_slabs)))))
2150 flags |= slub_debug;
2151
2152 return flags;
2153 diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
2154 index 426f8fcc4c6c..5b1bf7b530f1 100644
2155 --- a/net/sunrpc/clnt.c
2156 +++ b/net/sunrpc/clnt.c
2157 @@ -1407,9 +1407,9 @@ call_refreshresult(struct rpc_task *task)
2158 return;
2159 case -ETIMEDOUT:
2160 rpc_delay(task, 3*HZ);
2161 - case -EKEYEXPIRED:
2162 case -EAGAIN:
2163 status = -EACCES;
2164 + case -EKEYEXPIRED:
2165 if (!task->tk_cred_retry)
2166 break;
2167 task->tk_cred_retry--;
2168 diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
2169 index ffd50348a509..8a0e04d0928a 100644
2170 --- a/net/sunrpc/xprtsock.c
2171 +++ b/net/sunrpc/xprtsock.c
2172 @@ -391,8 +391,10 @@ static int xs_send_kvec(struct socket *sock, struct sockaddr *addr, int addrlen,
2173 return kernel_sendmsg(sock, &msg, NULL, 0, 0);
2174 }
2175
2176 -static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned int base, int more)
2177 +static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned int base, int more, bool zerocopy)
2178 {
2179 + ssize_t (*do_sendpage)(struct socket *sock, struct page *page,
2180 + int offset, size_t size, int flags);
2181 struct page **ppage;
2182 unsigned int remainder;
2183 int err, sent = 0;
2184 @@ -401,6 +403,9 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned i
2185 base += xdr->page_base;
2186 ppage = xdr->pages + (base >> PAGE_SHIFT);
2187 base &= ~PAGE_MASK;
2188 + do_sendpage = sock->ops->sendpage;
2189 + if (!zerocopy)
2190 + do_sendpage = sock_no_sendpage;
2191 for(;;) {
2192 unsigned int len = min_t(unsigned int, PAGE_SIZE - base, remainder);
2193 int flags = XS_SENDMSG_FLAGS;
2194 @@ -408,7 +413,7 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned i
2195 remainder -= len;
2196 if (remainder != 0 || more)
2197 flags |= MSG_MORE;
2198 - err = sock->ops->sendpage(sock, *ppage, base, len, flags);
2199 + err = do_sendpage(sock, *ppage, base, len, flags);
2200 if (remainder == 0 || err != len)
2201 break;
2202 sent += err;
2203 @@ -429,9 +434,10 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned i
2204 * @addrlen: UDP only -- length of destination address
2205 * @xdr: buffer containing this request
2206 * @base: starting position in the buffer
2207 + * @zerocopy: true if it is safe to use sendpage()
2208 *
2209 */
2210 -static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen, struct xdr_buf *xdr, unsigned int base)
2211 +static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen, struct xdr_buf *xdr, unsigned int base, bool zerocopy)
2212 {
2213 unsigned int remainder = xdr->len - base;
2214 int err, sent = 0;
2215 @@ -459,7 +465,7 @@ static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen,
2216 if (base < xdr->page_len) {
2217 unsigned int len = xdr->page_len - base;
2218 remainder -= len;
2219 - err = xs_send_pagedata(sock, xdr, base, remainder != 0);
2220 + err = xs_send_pagedata(sock, xdr, base, remainder != 0, zerocopy);
2221 if (remainder == 0 || err != len)
2222 goto out;
2223 sent += err;
2224 @@ -562,7 +568,7 @@ static int xs_local_send_request(struct rpc_task *task)
2225 req->rq_svec->iov_base, req->rq_svec->iov_len);
2226
2227 status = xs_sendpages(transport->sock, NULL, 0,
2228 - xdr, req->rq_bytes_sent);
2229 + xdr, req->rq_bytes_sent, true);
2230 dprintk("RPC: %s(%u) = %d\n",
2231 __func__, xdr->len - req->rq_bytes_sent, status);
2232 if (likely(status >= 0)) {
2233 @@ -618,7 +624,7 @@ static int xs_udp_send_request(struct rpc_task *task)
2234 status = xs_sendpages(transport->sock,
2235 xs_addr(xprt),
2236 xprt->addrlen, xdr,
2237 - req->rq_bytes_sent);
2238 + req->rq_bytes_sent, true);
2239
2240 dprintk("RPC: xs_udp_send_request(%u) = %d\n",
2241 xdr->len - req->rq_bytes_sent, status);
2242 @@ -689,6 +695,7 @@ static int xs_tcp_send_request(struct rpc_task *task)
2243 struct rpc_xprt *xprt = req->rq_xprt;
2244 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
2245 struct xdr_buf *xdr = &req->rq_snd_buf;
2246 + bool zerocopy = true;
2247 int status;
2248
2249 xs_encode_stream_record_marker(&req->rq_snd_buf);
2250 @@ -696,13 +703,20 @@ static int xs_tcp_send_request(struct rpc_task *task)
2251 xs_pktdump("packet data:",
2252 req->rq_svec->iov_base,
2253 req->rq_svec->iov_len);
2254 + /* Don't use zero copy if this is a resend. If the RPC call
2255 + * completes while the socket holds a reference to the pages,
2256 + * then we may end up resending corrupted data.
2257 + */
2258 + if (task->tk_flags & RPC_TASK_SENT)
2259 + zerocopy = false;
2260
2261 /* Continue transmitting the packet/record. We must be careful
2262 * to cope with writespace callbacks arriving _after_ we have
2263 * called sendmsg(). */
2264 while (1) {
2265 status = xs_sendpages(transport->sock,
2266 - NULL, 0, xdr, req->rq_bytes_sent);
2267 + NULL, 0, xdr, req->rq_bytes_sent,
2268 + zerocopy);
2269
2270 dprintk("RPC: xs_tcp_send_request(%u) = %d\n",
2271 xdr->len - req->rq_bytes_sent, status);
2272 diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
2273 index 399433ad614e..a9c3d3cd1990 100644
2274 --- a/security/integrity/ima/ima_policy.c
2275 +++ b/security/integrity/ima/ima_policy.c
2276 @@ -73,7 +73,6 @@ static struct ima_rule_entry default_rules[] = {
2277 {.action = DONT_MEASURE,.fsmagic = SYSFS_MAGIC,.flags = IMA_FSMAGIC},
2278 {.action = DONT_MEASURE,.fsmagic = DEBUGFS_MAGIC,.flags = IMA_FSMAGIC},
2279 {.action = DONT_MEASURE,.fsmagic = TMPFS_MAGIC,.flags = IMA_FSMAGIC},
2280 - {.action = DONT_MEASURE,.fsmagic = RAMFS_MAGIC,.flags = IMA_FSMAGIC},
2281 {.action = DONT_MEASURE,.fsmagic = DEVPTS_SUPER_MAGIC,.flags = IMA_FSMAGIC},
2282 {.action = DONT_MEASURE,.fsmagic = BINFMTFS_MAGIC,.flags = IMA_FSMAGIC},
2283 {.action = DONT_MEASURE,.fsmagic = SECURITYFS_MAGIC,.flags = IMA_FSMAGIC},
2284 diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
2285 index 5863ba6dd12b..19799931c51d 100644
2286 --- a/sound/core/compress_offload.c
2287 +++ b/sound/core/compress_offload.c
2288 @@ -668,14 +668,48 @@ static int snd_compr_stop(struct snd_compr_stream *stream)
2289 return -EPERM;
2290 retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP);
2291 if (!retval) {
2292 - stream->runtime->state = SNDRV_PCM_STATE_SETUP;
2293 - wake_up(&stream->runtime->sleep);
2294 + snd_compr_drain_notify(stream);
2295 stream->runtime->total_bytes_available = 0;
2296 stream->runtime->total_bytes_transferred = 0;
2297 }
2298 return retval;
2299 }
2300
2301 +static int snd_compress_wait_for_drain(struct snd_compr_stream *stream)
2302 +{
2303 + int ret;
2304 +
2305 + /*
2306 + * We are called with lock held. So drop the lock while we wait for
2307 + * drain complete notfication from the driver
2308 + *
2309 + * It is expected that driver will notify the drain completion and then
2310 + * stream will be moved to SETUP state, even if draining resulted in an
2311 + * error. We can trigger next track after this.
2312 + */
2313 + stream->runtime->state = SNDRV_PCM_STATE_DRAINING;
2314 + mutex_unlock(&stream->device->lock);
2315 +
2316 + /* we wait for drain to complete here, drain can return when
2317 + * interruption occurred, wait returned error or success.
2318 + * For the first two cases we don't do anything different here and
2319 + * return after waking up
2320 + */
2321 +
2322 + ret = wait_event_interruptible(stream->runtime->sleep,
2323 + (stream->runtime->state != SNDRV_PCM_STATE_DRAINING));
2324 + if (ret == -ERESTARTSYS)
2325 + pr_debug("wait aborted by a signal");
2326 + else if (ret)
2327 + pr_debug("wait for drain failed with %d\n", ret);
2328 +
2329 +
2330 + wake_up(&stream->runtime->sleep);
2331 + mutex_lock(&stream->device->lock);
2332 +
2333 + return ret;
2334 +}
2335 +
2336 static int snd_compr_drain(struct snd_compr_stream *stream)
2337 {
2338 int retval;
2339 @@ -683,12 +717,15 @@ static int snd_compr_drain(struct snd_compr_stream *stream)
2340 if (stream->runtime->state == SNDRV_PCM_STATE_PREPARED ||
2341 stream->runtime->state == SNDRV_PCM_STATE_SETUP)
2342 return -EPERM;
2343 +
2344 retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_DRAIN);
2345 - if (!retval) {
2346 - stream->runtime->state = SNDRV_PCM_STATE_DRAINING;
2347 + if (retval) {
2348 + pr_debug("SND_COMPR_TRIGGER_DRAIN failed %d\n", retval);
2349 wake_up(&stream->runtime->sleep);
2350 + return retval;
2351 }
2352 - return retval;
2353 +
2354 + return snd_compress_wait_for_drain(stream);
2355 }
2356
2357 static int snd_compr_next_track(struct snd_compr_stream *stream)
2358 @@ -724,9 +761,14 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream)
2359 return -EPERM;
2360
2361 retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_PARTIAL_DRAIN);
2362 + if (retval) {
2363 + pr_debug("Partial drain returned failure\n");
2364 + wake_up(&stream->runtime->sleep);
2365 + return retval;
2366 + }
2367
2368 stream->next_track = false;
2369 - return retval;
2370 + return snd_compress_wait_for_drain(stream);
2371 }
2372
2373 static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
2374 diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c
2375 index ddabb406b14c..3a7946ebbe23 100644
2376 --- a/sound/isa/msnd/msnd_pinnacle.c
2377 +++ b/sound/isa/msnd/msnd_pinnacle.c
2378 @@ -73,9 +73,11 @@
2379 #ifdef MSND_CLASSIC
2380 # include "msnd_classic.h"
2381 # define LOGNAME "msnd_classic"
2382 +# define DEV_NAME "msnd-classic"
2383 #else
2384 # include "msnd_pinnacle.h"
2385 # define LOGNAME "snd_msnd_pinnacle"
2386 +# define DEV_NAME "msnd-pinnacle"
2387 #endif
2388
2389 static void set_default_audio_parameters(struct snd_msnd *chip)
2390 @@ -1068,8 +1070,6 @@ static int snd_msnd_isa_remove(struct device *pdev, unsigned int dev)
2391 return 0;
2392 }
2393
2394 -#define DEV_NAME "msnd-pinnacle"
2395 -
2396 static struct isa_driver snd_msnd_driver = {
2397 .match = snd_msnd_isa_match,
2398 .probe = snd_msnd_isa_probe,
2399 diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
2400 index 31461ba32d3c..aeefec74a061 100644
2401 --- a/sound/pci/hda/hda_codec.c
2402 +++ b/sound/pci/hda/hda_codec.c
2403 @@ -2517,9 +2517,6 @@ int snd_hda_codec_reset(struct hda_codec *codec)
2404 cancel_delayed_work_sync(&codec->jackpoll_work);
2405 #ifdef CONFIG_PM
2406 cancel_delayed_work_sync(&codec->power_work);
2407 - codec->power_on = 0;
2408 - codec->power_transition = 0;
2409 - codec->power_jiffies = jiffies;
2410 flush_workqueue(bus->workq);
2411 #endif
2412 snd_hda_ctls_clear(codec);
2413 @@ -3927,6 +3924,10 @@ static void hda_call_codec_resume(struct hda_codec *codec)
2414 * in the resume / power-save sequence
2415 */
2416 hda_keep_power_on(codec);
2417 + if (codec->pm_down_notified) {
2418 + codec->pm_down_notified = 0;
2419 + hda_call_pm_notify(codec->bus, true);
2420 + }
2421 hda_set_power_state(codec, AC_PWRST_D0);
2422 restore_shutup_pins(codec);
2423 hda_exec_init_verbs(codec);
2424 diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
2425 index d0cc796f778a..26ed56f00b7c 100644
2426 --- a/sound/pci/hda/hda_generic.c
2427 +++ b/sound/pci/hda/hda_generic.c
2428 @@ -786,10 +786,10 @@ static void set_pin_eapd(struct hda_codec *codec, hda_nid_t pin, bool enable)
2429 if (spec->own_eapd_ctl ||
2430 !(snd_hda_query_pin_caps(codec, pin) & AC_PINCAP_EAPD))
2431 return;
2432 - if (codec->inv_eapd)
2433 - enable = !enable;
2434 if (spec->keep_eapd_on && !enable)
2435 return;
2436 + if (codec->inv_eapd)
2437 + enable = !enable;
2438 snd_hda_codec_update_cache(codec, pin, 0,
2439 AC_VERB_SET_EAPD_BTLENABLE,
2440 enable ? 0x02 : 0x00);
2441 diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
2442 index d97f0d61a15b..e17b55a95bc5 100644
2443 --- a/sound/pci/hda/patch_analog.c
2444 +++ b/sound/pci/hda/patch_analog.c
2445 @@ -1197,8 +1197,12 @@ static int alloc_ad_spec(struct hda_codec *codec)
2446 static void ad_fixup_inv_jack_detect(struct hda_codec *codec,
2447 const struct hda_fixup *fix, int action)
2448 {
2449 - if (action == HDA_FIXUP_ACT_PRE_PROBE)
2450 + struct ad198x_spec *spec = codec->spec;
2451 +
2452 + if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2453 codec->inv_jack_detect = 1;
2454 + spec->gen.keep_eapd_on = 1;
2455 + }
2456 }
2457
2458 enum {
2459 diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
2460 index c96e1945059d..1868d3a6e310 100644
2461 --- a/sound/pci/hda/patch_conexant.c
2462 +++ b/sound/pci/hda/patch_conexant.c
2463 @@ -3491,6 +3491,8 @@ static const struct hda_codec_preset snd_hda_preset_conexant[] = {
2464 .patch = patch_conexant_auto },
2465 { .id = 0x14f15115, .name = "CX20757",
2466 .patch = patch_conexant_auto },
2467 + { .id = 0x14f151d7, .name = "CX20952",
2468 + .patch = patch_conexant_auto },
2469 {} /* terminator */
2470 };
2471
2472 @@ -3517,6 +3519,7 @@ MODULE_ALIAS("snd-hda-codec-id:14f15111");
2473 MODULE_ALIAS("snd-hda-codec-id:14f15113");
2474 MODULE_ALIAS("snd-hda-codec-id:14f15114");
2475 MODULE_ALIAS("snd-hda-codec-id:14f15115");
2476 +MODULE_ALIAS("snd-hda-codec-id:14f151d7");
2477
2478 MODULE_LICENSE("GPL");
2479 MODULE_DESCRIPTION("Conexant HD-audio codec");
2480 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2481 index 4496e0ab693d..8bce044583ed 100644
2482 --- a/sound/pci/hda/patch_realtek.c
2483 +++ b/sound/pci/hda/patch_realtek.c
2484 @@ -1037,6 +1037,7 @@ enum {
2485 ALC880_FIXUP_UNIWILL,
2486 ALC880_FIXUP_UNIWILL_DIG,
2487 ALC880_FIXUP_Z71V,
2488 + ALC880_FIXUP_ASUS_W5A,
2489 ALC880_FIXUP_3ST_BASE,
2490 ALC880_FIXUP_3ST,
2491 ALC880_FIXUP_3ST_DIG,
2492 @@ -1207,6 +1208,26 @@ static const struct hda_fixup alc880_fixups[] = {
2493 { }
2494 }
2495 },
2496 + [ALC880_FIXUP_ASUS_W5A] = {
2497 + .type = HDA_FIXUP_PINS,
2498 + .v.pins = (const struct hda_pintbl[]) {
2499 + /* set up the whole pins as BIOS is utterly broken */
2500 + { 0x14, 0x0121411f }, /* HP */
2501 + { 0x15, 0x411111f0 }, /* N/A */
2502 + { 0x16, 0x411111f0 }, /* N/A */
2503 + { 0x17, 0x411111f0 }, /* N/A */
2504 + { 0x18, 0x90a60160 }, /* mic */
2505 + { 0x19, 0x411111f0 }, /* N/A */
2506 + { 0x1a, 0x411111f0 }, /* N/A */
2507 + { 0x1b, 0x411111f0 }, /* N/A */
2508 + { 0x1c, 0x411111f0 }, /* N/A */
2509 + { 0x1d, 0x411111f0 }, /* N/A */
2510 + { 0x1e, 0xb743111e }, /* SPDIF out */
2511 + { }
2512 + },
2513 + .chained = true,
2514 + .chain_id = ALC880_FIXUP_GPIO1,
2515 + },
2516 [ALC880_FIXUP_3ST_BASE] = {
2517 .type = HDA_FIXUP_PINS,
2518 .v.pins = (const struct hda_pintbl[]) {
2519 @@ -1328,6 +1349,7 @@ static const struct hda_fixup alc880_fixups[] = {
2520
2521 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
2522 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
2523 + SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
2524 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
2525 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
2526 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
2527 @@ -1473,6 +1495,7 @@ enum {
2528 ALC260_FIXUP_KN1,
2529 ALC260_FIXUP_FSC_S7020,
2530 ALC260_FIXUP_FSC_S7020_JWSE,
2531 + ALC260_FIXUP_VAIO_PINS,
2532 };
2533
2534 static void alc260_gpio1_automute(struct hda_codec *codec)
2535 @@ -1613,6 +1636,24 @@ static const struct hda_fixup alc260_fixups[] = {
2536 .chained = true,
2537 .chain_id = ALC260_FIXUP_FSC_S7020,
2538 },
2539 + [ALC260_FIXUP_VAIO_PINS] = {
2540 + .type = HDA_FIXUP_PINS,
2541 + .v.pins = (const struct hda_pintbl[]) {
2542 + /* Pin configs are missing completely on some VAIOs */
2543 + { 0x0f, 0x01211020 },
2544 + { 0x10, 0x0001003f },
2545 + { 0x11, 0x411111f0 },
2546 + { 0x12, 0x01a15930 },
2547 + { 0x13, 0x411111f0 },
2548 + { 0x14, 0x411111f0 },
2549 + { 0x15, 0x411111f0 },
2550 + { 0x16, 0x411111f0 },
2551 + { 0x17, 0x411111f0 },
2552 + { 0x18, 0x411111f0 },
2553 + { 0x19, 0x411111f0 },
2554 + { }
2555 + }
2556 + },
2557 };
2558
2559 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
2560 @@ -1621,6 +1662,8 @@ static const struct snd_pci_quirk alc260_fixup_tbl[] = {
2561 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
2562 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
2563 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
2564 + SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
2565 + SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
2566 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
2567 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
2568 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
2569 @@ -2380,6 +2423,7 @@ static const struct hda_verb alc268_beep_init_verbs[] = {
2570 enum {
2571 ALC268_FIXUP_INV_DMIC,
2572 ALC268_FIXUP_HP_EAPD,
2573 + ALC268_FIXUP_SPDIF,
2574 };
2575
2576 static const struct hda_fixup alc268_fixups[] = {
2577 @@ -2394,6 +2438,13 @@ static const struct hda_fixup alc268_fixups[] = {
2578 {}
2579 }
2580 },
2581 + [ALC268_FIXUP_SPDIF] = {
2582 + .type = HDA_FIXUP_PINS,
2583 + .v.pins = (const struct hda_pintbl[]) {
2584 + { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2585 + {}
2586 + }
2587 + },
2588 };
2589
2590 static const struct hda_model_fixup alc268_fixup_models[] = {
2591 @@ -2403,6 +2454,7 @@ static const struct hda_model_fixup alc268_fixup_models[] = {
2592 };
2593
2594 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2595 + SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2596 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2597 /* below is codec SSID since multiple Toshiba laptops have the
2598 * same PCI SSID 1179:ff00
2599 @@ -2531,6 +2583,7 @@ enum {
2600 ALC269_TYPE_ALC282,
2601 ALC269_TYPE_ALC284,
2602 ALC269_TYPE_ALC286,
2603 + ALC269_TYPE_ALC255,
2604 };
2605
2606 /*
2607 @@ -2555,6 +2608,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
2608 case ALC269_TYPE_ALC269VD:
2609 case ALC269_TYPE_ALC282:
2610 case ALC269_TYPE_ALC286:
2611 + case ALC269_TYPE_ALC255:
2612 ssids = alc269_ssids;
2613 break;
2614 default:
2615 @@ -2754,6 +2808,23 @@ static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
2616 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
2617 }
2618
2619 +/* Make sure the led works even in runtime suspend */
2620 +static unsigned int led_power_filter(struct hda_codec *codec,
2621 + hda_nid_t nid,
2622 + unsigned int power_state)
2623 +{
2624 + struct alc_spec *spec = codec->spec;
2625 +
2626 + if (power_state != AC_PWRST_D3 || nid != spec->mute_led_nid)
2627 + return power_state;
2628 +
2629 + /* Set pin ctl again, it might have just been set to 0 */
2630 + snd_hda_set_pin_ctl(codec, nid,
2631 + snd_hda_codec_get_pin_target(codec, nid));
2632 +
2633 + return AC_PWRST_D0;
2634 +}
2635 +
2636 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
2637 const struct hda_fixup *fix, int action)
2638 {
2639 @@ -2773,6 +2844,7 @@ static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
2640 spec->mute_led_nid = pin - 0x0a + 0x18;
2641 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
2642 spec->gen.vmaster_mute_enum = 1;
2643 + codec->power_filter = led_power_filter;
2644 snd_printd("Detected mute LED for %x:%d\n", spec->mute_led_nid,
2645 spec->mute_led_polarity);
2646 break;
2647 @@ -2788,6 +2860,7 @@ static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
2648 spec->mute_led_nid = 0x18;
2649 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
2650 spec->gen.vmaster_mute_enum = 1;
2651 + codec->power_filter = led_power_filter;
2652 }
2653 }
2654
2655 @@ -2800,6 +2873,7 @@ static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
2656 spec->mute_led_nid = 0x19;
2657 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
2658 spec->gen.vmaster_mute_enum = 1;
2659 + codec->power_filter = led_power_filter;
2660 }
2661 }
2662
2663 @@ -3040,8 +3114,10 @@ static void alc_update_headset_mode(struct hda_codec *codec)
2664 else
2665 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
2666
2667 - if (new_headset_mode == spec->current_headset_mode)
2668 + if (new_headset_mode == spec->current_headset_mode) {
2669 + snd_hda_gen_update_outputs(codec);
2670 return;
2671 + }
2672
2673 switch (new_headset_mode) {
2674 case ALC_HEADSET_MODE_UNPLUGGED:
2675 @@ -3545,6 +3621,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2676 SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
2677 SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
2678 SND_PCI_QUIRK(0x1028, 0x0613, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
2679 + SND_PCI_QUIRK(0x1028, 0x0614, "Dell Inspiron 3135", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
2680 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_MONO_SPEAKERS),
2681 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
2682 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
2683 @@ -3765,6 +3842,9 @@ static int patch_alc269(struct hda_codec *codec)
2684 case 0x10ec0286:
2685 spec->codec_variant = ALC269_TYPE_ALC286;
2686 break;
2687 + case 0x10ec0255:
2688 + spec->codec_variant = ALC269_TYPE_ALC255;
2689 + break;
2690 }
2691
2692 /* automatic parse from the BIOS config */
2693 @@ -4472,6 +4552,7 @@ static int patch_alc680(struct hda_codec *codec)
2694 static const struct hda_codec_preset snd_hda_preset_realtek[] = {
2695 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
2696 { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 },
2697 + { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 },
2698 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
2699 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
2700 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
2701 diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c
2702 index 4394ae796356..0716ba691398 100644
2703 --- a/sound/usb/6fire/chip.c
2704 +++ b/sound/usb/6fire/chip.c
2705 @@ -101,7 +101,7 @@ static int usb6fire_chip_probe(struct usb_interface *intf,
2706 usb_set_intfdata(intf, chips[i]);
2707 mutex_unlock(&register_mutex);
2708 return 0;
2709 - } else if (regidx < 0)
2710 + } else if (!devices[i] && regidx < 0)
2711 regidx = i;
2712 }
2713 if (regidx < 0) {
2714 diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
2715 index 72a130bc448a..c329c8fc57f4 100644
2716 --- a/virt/kvm/iommu.c
2717 +++ b/virt/kvm/iommu.c
2718 @@ -103,6 +103,10 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
2719 while ((gfn << PAGE_SHIFT) & (page_size - 1))
2720 page_size >>= 1;
2721
2722 + /* Make sure hva is aligned to the page size we want to map */
2723 + while (__gfn_to_hva_memslot(slot, gfn) & (page_size - 1))
2724 + page_size >>= 1;
2725 +
2726 /*
2727 * Pin all pages we are about to map in memory. This is
2728 * important because we unmap and unpin in 4kb steps later.