/[linux-patches]/genpatches-2.6/tags/3.0-30/1030_linux-3.0.31.patch
Gentoo

Contents of /genpatches-2.6/tags/3.0-30/1030_linux-3.0.31.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2206 - (show annotations) (download)
Mon Sep 17 18:58:14 2012 UTC (18 months, 4 weeks ago) by mpagano
File size: 57937 byte(s)
3.0-30 release
1 diff --git a/Makefile b/Makefile
2 index 8ab9415..ac9701b 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 3
7 PATCHLEVEL = 0
8 -SUBLEVEL = 30
9 +SUBLEVEL = 31
10 EXTRAVERSION =
11 NAME = Sneaky Weasel
12
13 diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h
14 index 60843eb..73409e6 100644
15 --- a/arch/arm/include/asm/tls.h
16 +++ b/arch/arm/include/asm/tls.h
17 @@ -7,6 +7,8 @@
18
19 .macro set_tls_v6k, tp, tmp1, tmp2
20 mcr p15, 0, \tp, c13, c0, 3 @ set TLS register
21 + mov \tmp1, #0
22 + mcr p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register
23 .endm
24
25 .macro set_tls_v6, tp, tmp1, tmp2
26 @@ -15,6 +17,8 @@
27 mov \tmp2, #0xffff0fff
28 tst \tmp1, #HWCAP_TLS @ hardware TLS available?
29 mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register
30 + movne \tmp1, #0
31 + mcrne p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register
32 streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0
33 .endm
34
35 diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
36 index b9338b8..1471695 100644
37 --- a/arch/x86/kernel/apic/apic.c
38 +++ b/arch/x86/kernel/apic/apic.c
39 @@ -1558,9 +1558,11 @@ static int __init apic_verify(void)
40 mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
41
42 /* The BIOS may have set up the APIC at some other address */
43 - rdmsr(MSR_IA32_APICBASE, l, h);
44 - if (l & MSR_IA32_APICBASE_ENABLE)
45 - mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
46 + if (boot_cpu_data.x86 >= 6) {
47 + rdmsr(MSR_IA32_APICBASE, l, h);
48 + if (l & MSR_IA32_APICBASE_ENABLE)
49 + mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
50 + }
51
52 pr_info("Found and enabled local APIC!\n");
53 return 0;
54 @@ -1578,13 +1580,15 @@ int __init apic_force_enable(unsigned long addr)
55 * MSR. This can only be done in software for Intel P6 or later
56 * and AMD K7 (Model > 1) or later.
57 */
58 - rdmsr(MSR_IA32_APICBASE, l, h);
59 - if (!(l & MSR_IA32_APICBASE_ENABLE)) {
60 - pr_info("Local APIC disabled by BIOS -- reenabling.\n");
61 - l &= ~MSR_IA32_APICBASE_BASE;
62 - l |= MSR_IA32_APICBASE_ENABLE | addr;
63 - wrmsr(MSR_IA32_APICBASE, l, h);
64 - enabled_via_apicbase = 1;
65 + if (boot_cpu_data.x86 >= 6) {
66 + rdmsr(MSR_IA32_APICBASE, l, h);
67 + if (!(l & MSR_IA32_APICBASE_ENABLE)) {
68 + pr_info("Local APIC disabled by BIOS -- reenabling.\n");
69 + l &= ~MSR_IA32_APICBASE_BASE;
70 + l |= MSR_IA32_APICBASE_ENABLE | addr;
71 + wrmsr(MSR_IA32_APICBASE, l, h);
72 + enabled_via_apicbase = 1;
73 + }
74 }
75 return apic_verify();
76 }
77 @@ -2112,10 +2116,12 @@ static void lapic_resume(void)
78 * FIXME! This will be wrong if we ever support suspend on
79 * SMP! We'll need to do this as part of the CPU restore!
80 */
81 - rdmsr(MSR_IA32_APICBASE, l, h);
82 - l &= ~MSR_IA32_APICBASE_BASE;
83 - l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;
84 - wrmsr(MSR_IA32_APICBASE, l, h);
85 + if (boot_cpu_data.x86 >= 6) {
86 + rdmsr(MSR_IA32_APICBASE, l, h);
87 + l &= ~MSR_IA32_APICBASE_BASE;
88 + l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;
89 + wrmsr(MSR_IA32_APICBASE, l, h);
90 + }
91 }
92
93 maxlvt = lapic_get_maxlvt();
94 diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
95 index d4fc6d4..2843b5e 100644
96 --- a/arch/x86/xen/smp.c
97 +++ b/arch/x86/xen/smp.c
98 @@ -172,6 +172,7 @@ static void __init xen_fill_possible_map(void)
99 static void __init xen_filter_cpu_maps(void)
100 {
101 int i, rc;
102 + unsigned int subtract = 0;
103
104 if (!xen_initial_domain())
105 return;
106 @@ -186,8 +187,22 @@ static void __init xen_filter_cpu_maps(void)
107 } else {
108 set_cpu_possible(i, false);
109 set_cpu_present(i, false);
110 + subtract++;
111 }
112 }
113 +#ifdef CONFIG_HOTPLUG_CPU
114 + /* This is akin to using 'nr_cpus' on the Linux command line.
115 + * Which is OK as when we use 'dom0_max_vcpus=X' we can only
116 + * have up to X, while nr_cpu_ids is greater than X. This
117 + * normally is not a problem, except when CPU hotplugging
118 + * is involved and then there might be more than X CPUs
119 + * in the guest - which will not work as there is no
120 + * hypercall to expand the max number of VCPUs an already
121 + * running guest has. So cap it up to X. */
122 + if (subtract)
123 + nr_cpu_ids = nr_cpu_ids - subtract;
124 +#endif
125 +
126 }
127
128 static void __init xen_smp_prepare_boot_cpu(void)
129 diff --git a/arch/x86/xen/xen-asm.S b/arch/x86/xen/xen-asm.S
130 index 79d7362..3e45aa0 100644
131 --- a/arch/x86/xen/xen-asm.S
132 +++ b/arch/x86/xen/xen-asm.S
133 @@ -96,7 +96,7 @@ ENTRY(xen_restore_fl_direct)
134
135 /* check for unmasked and pending */
136 cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending
137 - jz 1f
138 + jnz 1f
139 2: call check_events
140 1:
141 ENDPATCH(xen_restore_fl_direct)
142 diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
143 index 7f099d6..311c92d 100644
144 --- a/drivers/ata/libata-eh.c
145 +++ b/drivers/ata/libata-eh.c
146 @@ -3487,7 +3487,8 @@ static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg
147 u64 now = get_jiffies_64();
148 int *trials = void_arg;
149
150 - if (ent->timestamp < now - min(now, interval))
151 + if ((ent->eflags & ATA_EFLAG_OLD_ER) ||
152 + (ent->timestamp < now - min(now, interval)))
153 return -1;
154
155 (*trials)++;
156 diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
157 index 9e9318a..10c6349 100644
158 --- a/drivers/dma/at_hdmac.c
159 +++ b/drivers/dma/at_hdmac.c
160 @@ -237,10 +237,6 @@ static void atc_dostart(struct at_dma_chan *atchan, struct at_desc *first)
161
162 vdbg_dump_regs(atchan);
163
164 - /* clear any pending interrupt */
165 - while (dma_readl(atdma, EBCISR))
166 - cpu_relax();
167 -
168 channel_writel(atchan, SADDR, 0);
169 channel_writel(atchan, DADDR, 0);
170 channel_writel(atchan, CTRLA, 0);
171 diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
172 index 5f29aaf..e27d56c 100644
173 --- a/drivers/firmware/efivars.c
174 +++ b/drivers/firmware/efivars.c
175 @@ -141,23 +141,213 @@ efivar_create_sysfs_entry(struct efivars *efivars,
176
177 /* Return the number of unicode characters in data */
178 static unsigned long
179 -utf8_strlen(efi_char16_t *data, unsigned long maxlength)
180 +utf16_strnlen(efi_char16_t *s, size_t maxlength)
181 {
182 unsigned long length = 0;
183
184 - while (*data++ != 0 && length < maxlength)
185 + while (*s++ != 0 && length < maxlength)
186 length++;
187 return length;
188 }
189
190 +static inline unsigned long
191 +utf16_strlen(efi_char16_t *s)
192 +{
193 + return utf16_strnlen(s, ~0UL);
194 +}
195 +
196 /*
197 * Return the number of bytes is the length of this string
198 * Note: this is NOT the same as the number of unicode characters
199 */
200 static inline unsigned long
201 -utf8_strsize(efi_char16_t *data, unsigned long maxlength)
202 +utf16_strsize(efi_char16_t *data, unsigned long maxlength)
203 +{
204 + return utf16_strnlen(data, maxlength/sizeof(efi_char16_t)) * sizeof(efi_char16_t);
205 +}
206 +
207 +static bool
208 +validate_device_path(struct efi_variable *var, int match, u8 *buffer,
209 + unsigned long len)
210 +{
211 + struct efi_generic_dev_path *node;
212 + int offset = 0;
213 +
214 + node = (struct efi_generic_dev_path *)buffer;
215 +
216 + if (len < sizeof(*node))
217 + return false;
218 +
219 + while (offset <= len - sizeof(*node) &&
220 + node->length >= sizeof(*node) &&
221 + node->length <= len - offset) {
222 + offset += node->length;
223 +
224 + if ((node->type == EFI_DEV_END_PATH ||
225 + node->type == EFI_DEV_END_PATH2) &&
226 + node->sub_type == EFI_DEV_END_ENTIRE)
227 + return true;
228 +
229 + node = (struct efi_generic_dev_path *)(buffer + offset);
230 + }
231 +
232 + /*
233 + * If we're here then either node->length pointed past the end
234 + * of the buffer or we reached the end of the buffer without
235 + * finding a device path end node.
236 + */
237 + return false;
238 +}
239 +
240 +static bool
241 +validate_boot_order(struct efi_variable *var, int match, u8 *buffer,
242 + unsigned long len)
243 +{
244 + /* An array of 16-bit integers */
245 + if ((len % 2) != 0)
246 + return false;
247 +
248 + return true;
249 +}
250 +
251 +static bool
252 +validate_load_option(struct efi_variable *var, int match, u8 *buffer,
253 + unsigned long len)
254 +{
255 + u16 filepathlength;
256 + int i, desclength = 0, namelen;
257 +
258 + namelen = utf16_strnlen(var->VariableName, sizeof(var->VariableName));
259 +
260 + /* Either "Boot" or "Driver" followed by four digits of hex */
261 + for (i = match; i < match+4; i++) {
262 + if (var->VariableName[i] > 127 ||
263 + hex_to_bin(var->VariableName[i] & 0xff) < 0)
264 + return true;
265 + }
266 +
267 + /* Reject it if there's 4 digits of hex and then further content */
268 + if (namelen > match + 4)
269 + return false;
270 +
271 + /* A valid entry must be at least 8 bytes */
272 + if (len < 8)
273 + return false;
274 +
275 + filepathlength = buffer[4] | buffer[5] << 8;
276 +
277 + /*
278 + * There's no stored length for the description, so it has to be
279 + * found by hand
280 + */
281 + desclength = utf16_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2;
282 +
283 + /* Each boot entry must have a descriptor */
284 + if (!desclength)
285 + return false;
286 +
287 + /*
288 + * If the sum of the length of the description, the claimed filepath
289 + * length and the original header are greater than the length of the
290 + * variable, it's malformed
291 + */
292 + if ((desclength + filepathlength + 6) > len)
293 + return false;
294 +
295 + /*
296 + * And, finally, check the filepath
297 + */
298 + return validate_device_path(var, match, buffer + desclength + 6,
299 + filepathlength);
300 +}
301 +
302 +static bool
303 +validate_uint16(struct efi_variable *var, int match, u8 *buffer,
304 + unsigned long len)
305 {
306 - return utf8_strlen(data, maxlength/sizeof(efi_char16_t)) * sizeof(efi_char16_t);
307 + /* A single 16-bit integer */
308 + if (len != 2)
309 + return false;
310 +
311 + return true;
312 +}
313 +
314 +static bool
315 +validate_ascii_string(struct efi_variable *var, int match, u8 *buffer,
316 + unsigned long len)
317 +{
318 + int i;
319 +
320 + for (i = 0; i < len; i++) {
321 + if (buffer[i] > 127)
322 + return false;
323 +
324 + if (buffer[i] == 0)
325 + return true;
326 + }
327 +
328 + return false;
329 +}
330 +
331 +struct variable_validate {
332 + char *name;
333 + bool (*validate)(struct efi_variable *var, int match, u8 *data,
334 + unsigned long len);
335 +};
336 +
337 +static const struct variable_validate variable_validate[] = {
338 + { "BootNext", validate_uint16 },
339 + { "BootOrder", validate_boot_order },
340 + { "DriverOrder", validate_boot_order },
341 + { "Boot*", validate_load_option },
342 + { "Driver*", validate_load_option },
343 + { "ConIn", validate_device_path },
344 + { "ConInDev", validate_device_path },
345 + { "ConOut", validate_device_path },
346 + { "ConOutDev", validate_device_path },
347 + { "ErrOut", validate_device_path },
348 + { "ErrOutDev", validate_device_path },
349 + { "Timeout", validate_uint16 },
350 + { "Lang", validate_ascii_string },
351 + { "PlatformLang", validate_ascii_string },
352 + { "", NULL },
353 +};
354 +
355 +static bool
356 +validate_var(struct efi_variable *var, u8 *data, unsigned long len)
357 +{
358 + int i;
359 + u16 *unicode_name = var->VariableName;
360 +
361 + for (i = 0; variable_validate[i].validate != NULL; i++) {
362 + const char *name = variable_validate[i].name;
363 + int match;
364 +
365 + for (match = 0; ; match++) {
366 + char c = name[match];
367 + u16 u = unicode_name[match];
368 +
369 + /* All special variables are plain ascii */
370 + if (u > 127)
371 + return true;
372 +
373 + /* Wildcard in the matching name means we've matched */
374 + if (c == '*')
375 + return variable_validate[i].validate(var,
376 + match, data, len);
377 +
378 + /* Case sensitive match */
379 + if (c != u)
380 + break;
381 +
382 + /* Reached the end of the string while matching */
383 + if (!c)
384 + return variable_validate[i].validate(var,
385 + match, data, len);
386 + }
387 + }
388 +
389 + return true;
390 }
391
392 static efi_status_t
393 @@ -283,6 +473,12 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count)
394 return -EINVAL;
395 }
396
397 + if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 ||
398 + validate_var(new_var, new_var->Data, new_var->DataSize) == false) {
399 + printk(KERN_ERR "efivars: Malformed variable content\n");
400 + return -EINVAL;
401 + }
402 +
403 spin_lock(&efivars->lock);
404 status = efivars->ops->set_variable(new_var->VariableName,
405 &new_var->VendorGuid,
406 @@ -408,14 +604,20 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
407 if (!capable(CAP_SYS_ADMIN))
408 return -EACCES;
409
410 + if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 ||
411 + validate_var(new_var, new_var->Data, new_var->DataSize) == false) {
412 + printk(KERN_ERR "efivars: Malformed variable content\n");
413 + return -EINVAL;
414 + }
415 +
416 spin_lock(&efivars->lock);
417
418 /*
419 * Does this variable already exist?
420 */
421 list_for_each_entry_safe(search_efivar, n, &efivars->list, list) {
422 - strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024);
423 - strsize2 = utf8_strsize(new_var->VariableName, 1024);
424 + strsize1 = utf16_strsize(search_efivar->var.VariableName, 1024);
425 + strsize2 = utf16_strsize(new_var->VariableName, 1024);
426 if (strsize1 == strsize2 &&
427 !memcmp(&(search_efivar->var.VariableName),
428 new_var->VariableName, strsize1) &&
429 @@ -447,8 +649,8 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
430
431 /* Create the entry in sysfs. Locking is not required here */
432 status = efivar_create_sysfs_entry(efivars,
433 - utf8_strsize(new_var->VariableName,
434 - 1024),
435 + utf16_strsize(new_var->VariableName,
436 + 1024),
437 new_var->VariableName,
438 &new_var->VendorGuid);
439 if (status) {
440 @@ -477,8 +679,8 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj,
441 * Does this variable already exist?
442 */
443 list_for_each_entry_safe(search_efivar, n, &efivars->list, list) {
444 - strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024);
445 - strsize2 = utf8_strsize(del_var->VariableName, 1024);
446 + strsize1 = utf16_strsize(search_efivar->var.VariableName, 1024);
447 + strsize2 = utf16_strsize(del_var->VariableName, 1024);
448 if (strsize1 == strsize2 &&
449 !memcmp(&(search_efivar->var.VariableName),
450 del_var->VariableName, strsize1) &&
451 diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
452 index 4934cf8..bc927ae 100644
453 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
454 +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
455 @@ -1046,6 +1046,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
456 return -EINVAL;
457 }
458
459 + if (args->num_cliprects > UINT_MAX / sizeof(*cliprects)) {
460 + DRM_DEBUG("execbuf with %u cliprects\n",
461 + args->num_cliprects);
462 + return -EINVAL;
463 + }
464 cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects),
465 GFP_KERNEL);
466 if (cliprects == NULL) {
467 @@ -1296,7 +1301,8 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
468 struct drm_i915_gem_exec_object2 *exec2_list = NULL;
469 int ret;
470
471 - if (args->buffer_count < 1) {
472 + if (args->buffer_count < 1 ||
473 + args->buffer_count > UINT_MAX / sizeof(*exec2_list)) {
474 DRM_ERROR("execbuf2 with %d buffers\n", args->buffer_count);
475 return -EINVAL;
476 }
477 diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
478 index bdda08e..06bc46e 100644
479 --- a/drivers/gpu/drm/i915/intel_sdvo.c
480 +++ b/drivers/gpu/drm/i915/intel_sdvo.c
481 @@ -724,6 +724,7 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,
482 uint16_t width, height;
483 uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len;
484 uint16_t h_sync_offset, v_sync_offset;
485 + int mode_clock;
486
487 width = mode->crtc_hdisplay;
488 height = mode->crtc_vdisplay;
489 @@ -738,7 +739,11 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,
490 h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start;
491 v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start;
492
493 - dtd->part1.clock = mode->clock / 10;
494 + mode_clock = mode->clock;
495 + mode_clock /= intel_mode_get_pixel_multiplier(mode) ?: 1;
496 + mode_clock /= 10;
497 + dtd->part1.clock = mode_clock;
498 +
499 dtd->part1.h_active = width & 0xff;
500 dtd->part1.h_blank = h_blank_len & 0xff;
501 dtd->part1.h_high = (((width >> 8) & 0xf) << 4) |
502 @@ -990,7 +995,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
503 struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder);
504 u32 sdvox;
505 struct intel_sdvo_in_out_map in_out;
506 - struct intel_sdvo_dtd input_dtd;
507 + struct intel_sdvo_dtd input_dtd, output_dtd;
508 int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode);
509 int rate;
510
511 @@ -1015,20 +1020,13 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
512 intel_sdvo->attached_output))
513 return;
514
515 - /* We have tried to get input timing in mode_fixup, and filled into
516 - * adjusted_mode.
517 - */
518 - if (intel_sdvo->is_tv || intel_sdvo->is_lvds) {
519 - input_dtd = intel_sdvo->input_dtd;
520 - } else {
521 - /* Set the output timing to the screen */
522 - if (!intel_sdvo_set_target_output(intel_sdvo,
523 - intel_sdvo->attached_output))
524 - return;
525 -
526 - intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode);
527 - (void) intel_sdvo_set_output_timing(intel_sdvo, &input_dtd);
528 - }
529 + /* lvds has a special fixed output timing. */
530 + if (intel_sdvo->is_lvds)
531 + intel_sdvo_get_dtd_from_mode(&output_dtd,
532 + intel_sdvo->sdvo_lvds_fixed_mode);
533 + else
534 + intel_sdvo_get_dtd_from_mode(&output_dtd, mode);
535 + (void) intel_sdvo_set_output_timing(intel_sdvo, &output_dtd);
536
537 /* Set the input timing to the screen. Assume always input 0. */
538 if (!intel_sdvo_set_target_input(intel_sdvo))
539 @@ -1046,6 +1044,10 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
540 !intel_sdvo_set_tv_format(intel_sdvo))
541 return;
542
543 + /* We have tried to get input timing in mode_fixup, and filled into
544 + * adjusted_mode.
545 + */
546 + intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode);
547 (void) intel_sdvo_set_input_timing(intel_sdvo, &input_dtd);
548
549 switch (pixel_multiplier) {
550 diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
551 index 6163cfa..3cf2353 100644
552 --- a/drivers/hwmon/coretemp.c
553 +++ b/drivers/hwmon/coretemp.c
554 @@ -42,7 +42,7 @@
555 #define DRVNAME "coretemp"
556
557 #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */
558 -#define NUM_REAL_CORES 16 /* Number of Real cores per cpu */
559 +#define NUM_REAL_CORES 32 /* Number of Real cores per cpu */
560 #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */
561 #define MAX_ATTRS 5 /* Maximum no of per-core attrs */
562 #define MAX_CORE_DATA (NUM_REAL_CORES + BASE_SYSFS_ATTR_NO)
563 @@ -752,6 +752,10 @@ static void __cpuinit put_core_offline(unsigned int cpu)
564
565 indx = TO_ATTR_NO(cpu);
566
567 + /* The core id is too big, just return */
568 + if (indx > MAX_CORE_DATA - 1)
569 + return;
570 +
571 if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu)
572 coretemp_remove_core(pdata, &pdev->dev, indx);
573
574 diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
575 index 930370d..9a4c3ab 100644
576 --- a/drivers/hwmon/fam15h_power.c
577 +++ b/drivers/hwmon/fam15h_power.c
578 @@ -122,6 +122,41 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)
579 return true;
580 }
581
582 +/*
583 + * Newer BKDG versions have an updated recommendation on how to properly
584 + * initialize the running average range (was: 0xE, now: 0x9). This avoids
585 + * counter saturations resulting in bogus power readings.
586 + * We correct this value ourselves to cope with older BIOSes.
587 + */
588 +static DEFINE_PCI_DEVICE_TABLE(affected_device) = {
589 + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
590 + { 0 }
591 +};
592 +
593 +static void __devinit tweak_runavg_range(struct pci_dev *pdev)
594 +{
595 + u32 val;
596 +
597 + /*
598 + * let this quirk apply only to the current version of the
599 + * northbridge, since future versions may change the behavior
600 + */
601 + if (!pci_match_id(affected_device, pdev))
602 + return;
603 +
604 + pci_bus_read_config_dword(pdev->bus,
605 + PCI_DEVFN(PCI_SLOT(pdev->devfn), 5),
606 + REG_TDP_RUNNING_AVERAGE, &val);
607 + if ((val & 0xf) != 0xe)
608 + return;
609 +
610 + val &= ~0xf;
611 + val |= 0x9;
612 + pci_bus_write_config_dword(pdev->bus,
613 + PCI_DEVFN(PCI_SLOT(pdev->devfn), 5),
614 + REG_TDP_RUNNING_AVERAGE, val);
615 +}
616 +
617 static void __devinit fam15h_power_init_data(struct pci_dev *f4,
618 struct fam15h_power_data *data)
619 {
620 @@ -155,6 +190,13 @@ static int __devinit fam15h_power_probe(struct pci_dev *pdev,
621 struct device *dev;
622 int err;
623
624 + /*
625 + * though we ignore every other northbridge, we still have to
626 + * do the tweaking on _each_ node in MCM processors as the counters
627 + * are working hand-in-hand
628 + */
629 + tweak_runavg_range(pdev);
630 +
631 if (!fam15h_power_is_internal_node0(pdev)) {
632 err = -ENODEV;
633 goto exit;
634 diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
635 index 04be9f8..eb8ad53 100644
636 --- a/drivers/i2c/busses/i2c-pnx.c
637 +++ b/drivers/i2c/busses/i2c-pnx.c
638 @@ -546,8 +546,7 @@ static int i2c_pnx_controller_suspend(struct platform_device *pdev,
639 {
640 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev);
641
642 - /* FIXME: shouldn't this be clk_disable? */
643 - clk_enable(alg_data->clk);
644 + clk_disable(alg_data->clk);
645
646 return 0;
647 }
648 diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
649 index 92e5437..6fe8ced 100644
650 --- a/drivers/mmc/host/sdhci-esdhc-imx.c
651 +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
652 @@ -245,8 +245,7 @@ static int esdhc_pltfm_init(struct sdhci_host *host, struct sdhci_pltfm_data *pd
653 }
654 pltfm_host->priv = imx_data;
655
656 - if (!cpu_is_mx25())
657 - host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
658 + host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
659
660 if (cpu_is_mx25() || cpu_is_mx35()) {
661 /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */
662 diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
663 index 87813c3..b2707d73 100644
664 --- a/drivers/net/wireless/ipw2x00/ipw2200.c
665 +++ b/drivers/net/wireless/ipw2x00/ipw2200.c
666 @@ -2182,6 +2182,7 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
667 {
668 int rc = 0;
669 unsigned long flags;
670 + unsigned long now, end;
671
672 spin_lock_irqsave(&priv->lock, flags);
673 if (priv->status & STATUS_HCMD_ACTIVE) {
674 @@ -2223,10 +2224,20 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
675 }
676 spin_unlock_irqrestore(&priv->lock, flags);
677
678 + now = jiffies;
679 + end = now + HOST_COMPLETE_TIMEOUT;
680 +again:
681 rc = wait_event_interruptible_timeout(priv->wait_command_queue,
682 !(priv->
683 status & STATUS_HCMD_ACTIVE),
684 - HOST_COMPLETE_TIMEOUT);
685 + end - now);
686 + if (rc < 0) {
687 + now = jiffies;
688 + if (time_before(now, end))
689 + goto again;
690 + rc = 0;
691 + }
692 +
693 if (rc == 0) {
694 spin_lock_irqsave(&priv->lock, flags);
695 if (priv->status & STATUS_HCMD_ACTIVE) {
696 diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
697 index 61291a1..c29f398 100644
698 --- a/drivers/net/wireless/rtlwifi/pci.c
699 +++ b/drivers/net/wireless/rtlwifi/pci.c
700 @@ -1988,6 +1988,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev)
701 rtl_deinit_deferred_work(hw);
702 rtlpriv->intf_ops->adapter_stop(hw);
703 }
704 + rtlpriv->cfg->ops->disable_interrupt(hw);
705
706 /*deinit rfkill */
707 rtl_deinit_rfkill(hw);
708 diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c
709 index a14a48c..de9210c 100644
710 --- a/drivers/net/wireless/wl1251/main.c
711 +++ b/drivers/net/wireless/wl1251/main.c
712 @@ -479,6 +479,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw)
713 cancel_work_sync(&wl->irq_work);
714 cancel_work_sync(&wl->tx_work);
715 cancel_work_sync(&wl->filter_work);
716 + cancel_delayed_work_sync(&wl->elp_work);
717
718 mutex_lock(&wl->mutex);
719
720 diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c
721 index f51a024..85a7101 100644
722 --- a/drivers/net/wireless/wl1251/sdio.c
723 +++ b/drivers/net/wireless/wl1251/sdio.c
724 @@ -314,8 +314,8 @@ static void __devexit wl1251_sdio_remove(struct sdio_func *func)
725
726 if (wl->irq)
727 free_irq(wl->irq, wl);
728 - kfree(wl_sdio);
729 wl1251_free_hw(wl);
730 + kfree(wl_sdio);
731
732 sdio_claim_host(func);
733 sdio_release_irq(func);
734 diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
735 index 37cbe4d..e68fac6 100644
736 --- a/drivers/scsi/libsas/sas_expander.c
737 +++ b/drivers/scsi/libsas/sas_expander.c
738 @@ -192,7 +192,14 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id,
739 phy->attached_sata_ps = dr->attached_sata_ps;
740 phy->attached_iproto = dr->iproto << 1;
741 phy->attached_tproto = dr->tproto << 1;
742 - memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE);
743 + /* help some expanders that fail to zero sas_address in the 'no
744 + * device' case
745 + */
746 + if (phy->attached_dev_type == NO_DEVICE ||
747 + phy->linkrate < SAS_LINK_RATE_1_5_GBPS)
748 + memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
749 + else
750 + memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE);
751 phy->attached_phy_id = dr->attached_phy_id;
752 phy->phy_change_count = dr->change_count;
753 phy->routing_attr = dr->routing_attr;
754 @@ -1632,9 +1639,17 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id,
755 int phy_change_count = 0;
756
757 res = sas_get_phy_change_count(dev, i, &phy_change_count);
758 - if (res)
759 - goto out;
760 - else if (phy_change_count != ex->ex_phy[i].phy_change_count) {
761 + switch (res) {
762 + case SMP_RESP_PHY_VACANT:
763 + case SMP_RESP_NO_PHY:
764 + continue;
765 + case SMP_RESP_FUNC_ACC:
766 + break;
767 + default:
768 + return res;
769 + }
770 +
771 + if (phy_change_count != ex->ex_phy[i].phy_change_count) {
772 if (update)
773 ex->ex_phy[i].phy_change_count =
774 phy_change_count;
775 @@ -1642,8 +1657,7 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id,
776 return 0;
777 }
778 }
779 -out:
780 - return res;
781 + return 0;
782 }
783
784 static int sas_get_ex_change_count(struct domain_device *dev, int *ecc)
785 diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
786 index 4534926..934e7f9 100644
787 --- a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
788 +++ b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
789 @@ -143,7 +143,6 @@ static bool wlc_bmac_validate_chip_access(struct wlc_hw_info *wlc_hw);
790 static char *wlc_get_macaddr(struct wlc_hw_info *wlc_hw);
791 static void wlc_mhfdef(struct wlc_info *wlc, u16 *mhfs, u16 mhf2_init);
792 static void wlc_mctrl_write(struct wlc_hw_info *wlc_hw);
793 -static void wlc_bmac_mute(struct wlc_hw_info *wlc_hw, bool want, mbool flags);
794 static void wlc_ucode_mute_override_set(struct wlc_hw_info *wlc_hw);
795 static void wlc_ucode_mute_override_clear(struct wlc_hw_info *wlc_hw);
796 static u32 wlc_wlintrsoff(struct wlc_info *wlc);
797 @@ -2725,7 +2724,7 @@ void wlc_intrsrestore(struct wlc_info *wlc, u32 macintmask)
798 W_REG(&wlc_hw->regs->macintmask, wlc->macintmask);
799 }
800
801 -static void wlc_bmac_mute(struct wlc_hw_info *wlc_hw, bool on, mbool flags)
802 +void wlc_bmac_mute(struct wlc_hw_info *wlc_hw, bool on, mbool flags)
803 {
804 u8 null_ether_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
805
806 diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.h b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.h
807 index a5dccc2..a2a4e73 100644
808 --- a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.h
809 +++ b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.h
810 @@ -103,6 +103,7 @@ extern void wlc_bmac_macphyclk_set(struct wlc_hw_info *wlc_hw, bool clk);
811 extern void wlc_bmac_phy_reset(struct wlc_hw_info *wlc_hw);
812 extern void wlc_bmac_corereset(struct wlc_hw_info *wlc_hw, u32 flags);
813 extern void wlc_bmac_reset(struct wlc_hw_info *wlc_hw);
814 +extern void wlc_bmac_mute(struct wlc_hw_info *wlc_hw, bool want, mbool flags);
815 extern void wlc_bmac_init(struct wlc_hw_info *wlc_hw, chanspec_t chanspec,
816 bool mute);
817 extern int wlc_bmac_up_prep(struct wlc_hw_info *wlc_hw);
818 diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_main.c b/drivers/staging/brcm80211/brcmsmac/wlc_main.c
819 index 4b4a31e..99250e2 100644
820 --- a/drivers/staging/brcm80211/brcmsmac/wlc_main.c
821 +++ b/drivers/staging/brcm80211/brcmsmac/wlc_main.c
822 @@ -6145,6 +6145,7 @@ wlc_recvctl(struct wlc_info *wlc, d11rxhdr_t *rxh, struct sk_buff *p)
823 {
824 int len_mpdu;
825 struct ieee80211_rx_status rx_status;
826 + struct ieee80211_hdr *hdr;
827
828 memset(&rx_status, 0, sizeof(rx_status));
829 prep_mac80211_status(wlc, rxh, p, &rx_status);
830 @@ -6154,6 +6155,13 @@ wlc_recvctl(struct wlc_info *wlc, d11rxhdr_t *rxh, struct sk_buff *p)
831 skb_pull(p, D11_PHY_HDR_LEN);
832 __skb_trim(p, len_mpdu);
833
834 + /* unmute transmit */
835 + if (wlc->hw->suspended_fifos) {
836 + hdr = (struct ieee80211_hdr *)p->data;
837 + if (ieee80211_is_beacon(hdr->frame_control))
838 + wlc_bmac_mute(wlc->hw, false, 0);
839 + }
840 +
841 memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status));
842 ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p);
843 return;
844 diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
845 index 76f0613..00b7bf9 100644
846 --- a/drivers/usb/class/cdc-wdm.c
847 +++ b/drivers/usb/class/cdc-wdm.c
848 @@ -108,8 +108,9 @@ static void wdm_out_callback(struct urb *urb)
849 spin_lock(&desc->iuspin);
850 desc->werr = urb->status;
851 spin_unlock(&desc->iuspin);
852 - clear_bit(WDM_IN_USE, &desc->flags);
853 kfree(desc->outbuf);
854 + desc->outbuf = NULL;
855 + clear_bit(WDM_IN_USE, &desc->flags);
856 wake_up(&desc->wait);
857 }
858
859 @@ -312,7 +313,7 @@ static ssize_t wdm_write
860 if (we < 0)
861 return -EIO;
862
863 - desc->outbuf = buf = kmalloc(count, GFP_KERNEL);
864 + buf = kmalloc(count, GFP_KERNEL);
865 if (!buf) {
866 rv = -ENOMEM;
867 goto outnl;
868 @@ -376,10 +377,12 @@ static ssize_t wdm_write
869 req->wIndex = desc->inum;
870 req->wLength = cpu_to_le16(count);
871 set_bit(WDM_IN_USE, &desc->flags);
872 + desc->outbuf = buf;
873
874 rv = usb_submit_urb(desc->command, GFP_KERNEL);
875 if (rv < 0) {
876 kfree(buf);
877 + desc->outbuf = NULL;
878 clear_bit(WDM_IN_USE, &desc->flags);
879 dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv);
880 } else {
881 diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
882 index 6c1642b..aa7bbbc 100644
883 --- a/drivers/usb/core/hcd-pci.c
884 +++ b/drivers/usb/core/hcd-pci.c
885 @@ -495,6 +495,15 @@ static int hcd_pci_suspend_noirq(struct device *dev)
886
887 pci_save_state(pci_dev);
888
889 + /*
890 + * Some systems crash if an EHCI controller is in D3 during
891 + * a sleep transition. We have to leave such controllers in D0.
892 + */
893 + if (hcd->broken_pci_sleep) {
894 + dev_dbg(dev, "Staying in PCI D0\n");
895 + return retval;
896 + }
897 +
898 /* If the root hub is dead rather than suspended, disallow remote
899 * wakeup. usb_hc_died() should ensure that both hosts are marked as
900 * dying, so we only need to check the primary roothub.
901 diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
902 index efb58f9..3bbdc9a 100644
903 --- a/drivers/usb/gadget/f_mass_storage.c
904 +++ b/drivers/usb/gadget/f_mass_storage.c
905 @@ -2187,7 +2187,7 @@ unknown_cmnd:
906 common->data_size_from_cmnd = 0;
907 sprintf(unknown, "Unknown x%02x", common->cmnd[0]);
908 reply = check_command(common, common->cmnd_size,
909 - DATA_DIR_UNKNOWN, 0xff, 0, unknown);
910 + DATA_DIR_UNKNOWN, ~0, 0, unknown);
911 if (reply == 0) {
912 common->curlun->sense_data = SS_INVALID_COMMAND;
913 reply = -EINVAL;
914 diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
915 index 0360f56..e358130 100644
916 --- a/drivers/usb/gadget/file_storage.c
917 +++ b/drivers/usb/gadget/file_storage.c
918 @@ -2553,7 +2553,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
919 fsg->data_size_from_cmnd = 0;
920 sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]);
921 if ((reply = check_command(fsg, fsg->cmnd_size,
922 - DATA_DIR_UNKNOWN, 0xff, 0, unknown)) == 0) {
923 + DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) {
924 fsg->curlun->sense_data = SS_INVALID_COMMAND;
925 reply = -EINVAL;
926 }
927 diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h
928 index 5b79194..01a23c1 100644
929 --- a/drivers/usb/gadget/uvc.h
930 +++ b/drivers/usb/gadget/uvc.h
931 @@ -29,7 +29,7 @@
932
933 struct uvc_request_data
934 {
935 - unsigned int length;
936 + __s32 length;
937 __u8 data[60];
938 };
939
940 diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c
941 index 5e807f0..992f66b 100644
942 --- a/drivers/usb/gadget/uvc_v4l2.c
943 +++ b/drivers/usb/gadget/uvc_v4l2.c
944 @@ -41,7 +41,7 @@ uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data)
945 if (data->length < 0)
946 return usb_ep_set_halt(cdev->gadget->ep0);
947
948 - req->length = min(uvc->event_length, data->length);
949 + req->length = min_t(unsigned int, uvc->event_length, data->length);
950 req->zero = data->length < uvc->event_length;
951 req->dma = DMA_ADDR_INVALID;
952
953 diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
954 index 6a25c35..f89f77f 100644
955 --- a/drivers/usb/host/ehci-hcd.c
956 +++ b/drivers/usb/host/ehci-hcd.c
957 @@ -865,7 +865,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
958 pcd_status = status;
959
960 /* resume root hub? */
961 - if (!(cmd & CMD_RUN))
962 + if (hcd->state == HC_STATE_SUSPENDED)
963 usb_hcd_resume_root_hub(hcd);
964
965 /* get per-port change detect bits */
966 diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
967 index 1d1caa6..3940d28 100644
968 --- a/drivers/usb/host/ehci-pci.c
969 +++ b/drivers/usb/host/ehci-pci.c
970 @@ -144,6 +144,14 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
971 hcd->has_tt = 1;
972 tdi_reset(ehci);
973 }
974 + if (pdev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK) {
975 + /* EHCI #1 or #2 on 6 Series/C200 Series chipset */
976 + if (pdev->device == 0x1c26 || pdev->device == 0x1c2d) {
977 + ehci_info(ehci, "broken D3 during system sleep on ASUS\n");
978 + hcd->broken_pci_sleep = 1;
979 + device_set_wakeup_capable(&pdev->dev, false);
980 + }
981 + }
982 break;
983 case PCI_VENDOR_ID_TDI:
984 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
985 diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
986 index 8388771..79a66d6 100644
987 --- a/drivers/usb/host/fsl-mph-dr-of.c
988 +++ b/drivers/usb/host/fsl-mph-dr-of.c
989 @@ -93,6 +93,7 @@ struct platform_device * __devinit fsl_usb2_device_register(
990 pdev->dev.parent = &ofdev->dev;
991
992 pdev->dev.coherent_dma_mask = ofdev->dev.coherent_dma_mask;
993 + pdev->dev.dma_mask = &pdev->archdata.dma_mask;
994 *pdev->dev.dma_mask = *ofdev->dev.dma_mask;
995
996 retval = platform_device_add_data(pdev, pdata, sizeof(*pdata));
997 diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
998 index 10cc45a..756d328 100644
999 --- a/fs/autofs4/autofs_i.h
1000 +++ b/fs/autofs4/autofs_i.h
1001 @@ -120,7 +120,6 @@ struct autofs_sb_info {
1002 int sub_version;
1003 int min_proto;
1004 int max_proto;
1005 - int compat_daemon;
1006 unsigned long exp_timeout;
1007 unsigned int type;
1008 int reghost_enabled;
1009 @@ -279,6 +278,17 @@ int autofs4_fill_super(struct super_block *, void *, int);
1010 struct autofs_info *autofs4_new_ino(struct autofs_sb_info *);
1011 void autofs4_clean_ino(struct autofs_info *);
1012
1013 +static inline int autofs_prepare_pipe(struct file *pipe)
1014 +{
1015 + if (!pipe->f_op || !pipe->f_op->write)
1016 + return -EINVAL;
1017 + if (!S_ISFIFO(pipe->f_dentry->d_inode->i_mode))
1018 + return -EINVAL;
1019 + /* We want a packet pipe */
1020 + pipe->f_flags |= O_DIRECT;
1021 + return 0;
1022 +}
1023 +
1024 /* Queue management functions */
1025
1026 int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify);
1027 diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
1028 index 56bac70..de54271 100644
1029 --- a/fs/autofs4/dev-ioctl.c
1030 +++ b/fs/autofs4/dev-ioctl.c
1031 @@ -376,7 +376,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
1032 err = -EBADF;
1033 goto out;
1034 }
1035 - if (!pipe->f_op || !pipe->f_op->write) {
1036 + if (autofs_prepare_pipe(pipe) < 0) {
1037 err = -EPIPE;
1038 fput(pipe);
1039 goto out;
1040 @@ -385,7 +385,6 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
1041 sbi->pipefd = pipefd;
1042 sbi->pipe = pipe;
1043 sbi->catatonic = 0;
1044 - sbi->compat_daemon = is_compat_task();
1045 }
1046 out:
1047 mutex_unlock(&sbi->wq_mutex);
1048 diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
1049 index eb1e45c..7c26678 100644
1050 --- a/fs/autofs4/inode.c
1051 +++ b/fs/autofs4/inode.c
1052 @@ -19,7 +19,6 @@
1053 #include <linux/parser.h>
1054 #include <linux/bitops.h>
1055 #include <linux/magic.h>
1056 -#include <linux/compat.h>
1057 #include "autofs_i.h"
1058 #include <linux/module.h>
1059
1060 @@ -225,7 +224,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
1061 set_autofs_type_indirect(&sbi->type);
1062 sbi->min_proto = 0;
1063 sbi->max_proto = 0;
1064 - sbi->compat_daemon = is_compat_task();
1065 mutex_init(&sbi->wq_mutex);
1066 spin_lock_init(&sbi->fs_lock);
1067 sbi->queues = NULL;
1068 @@ -294,7 +292,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
1069 printk("autofs: could not open pipe file descriptor\n");
1070 goto fail_dput;
1071 }
1072 - if (!pipe->f_op || !pipe->f_op->write)
1073 + if (autofs_prepare_pipe(pipe) < 0)
1074 goto fail_fput;
1075 sbi->pipe = pipe;
1076 sbi->pipefd = pipefd;
1077 diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
1078 index fbbb749..813ea10 100644
1079 --- a/fs/autofs4/waitq.c
1080 +++ b/fs/autofs4/waitq.c
1081 @@ -91,23 +91,6 @@ static int autofs4_write(struct file *file, const void *addr, int bytes)
1082 return (bytes > 0);
1083 }
1084
1085 -/*
1086 - * The autofs_v5 packet was misdesigned.
1087 - *
1088 - * The packets are identical on x86-32 and x86-64, but have different
1089 - * alignment. Which means that 'sizeof()' will give different results.
1090 - * Fix it up for the case of running 32-bit user mode on a 64-bit kernel.
1091 - */
1092 -static noinline size_t autofs_v5_packet_size(struct autofs_sb_info *sbi)
1093 -{
1094 - size_t pktsz = sizeof(struct autofs_v5_packet);
1095 -#if defined(CONFIG_X86_64) && defined(CONFIG_COMPAT)
1096 - if (sbi->compat_daemon > 0)
1097 - pktsz -= 4;
1098 -#endif
1099 - return pktsz;
1100 -}
1101 -
1102 static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
1103 struct autofs_wait_queue *wq,
1104 int type)
1105 @@ -164,7 +147,8 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
1106 {
1107 struct autofs_v5_packet *packet = &pkt.v5_pkt.v5_packet;
1108
1109 - pktsz = autofs_v5_packet_size(sbi);
1110 + pktsz = sizeof(*packet);
1111 +
1112 packet->wait_queue_token = wq->wait_queue_token;
1113 packet->len = wq->name.len;
1114 memcpy(packet->name, wq->name.name, wq->name.len);
1115 diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
1116 index b4ba1b3..408073a 100644
1117 --- a/fs/hfsplus/catalog.c
1118 +++ b/fs/hfsplus/catalog.c
1119 @@ -360,6 +360,10 @@ int hfsplus_rename_cat(u32 cnid,
1120 err = hfs_brec_find(&src_fd);
1121 if (err)
1122 goto out;
1123 + if (src_fd.entrylength > sizeof(entry) || src_fd.entrylength < 0) {
1124 + err = -EIO;
1125 + goto out;
1126 + }
1127
1128 hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset,
1129 src_fd.entrylength);
1130 diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
1131 index 4df5059..159f5eb 100644
1132 --- a/fs/hfsplus/dir.c
1133 +++ b/fs/hfsplus/dir.c
1134 @@ -146,6 +146,11 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
1135 filp->f_pos++;
1136 /* fall through */
1137 case 1:
1138 + if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
1139 + err = -EIO;
1140 + goto out;
1141 + }
1142 +
1143 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
1144 fd.entrylength);
1145 if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) {
1146 @@ -177,6 +182,12 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
1147 err = -EIO;
1148 goto out;
1149 }
1150 +
1151 + if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
1152 + err = -EIO;
1153 + goto out;
1154 + }
1155 +
1156 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
1157 fd.entrylength);
1158 type = be16_to_cpu(entry.type);
1159 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
1160 index 301b0c9..3d67302 100644
1161 --- a/fs/nfs/nfs4proc.c
1162 +++ b/fs/nfs/nfs4proc.c
1163 @@ -4424,7 +4424,9 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
1164 static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request)
1165 {
1166 struct nfs_server *server = NFS_SERVER(state->inode);
1167 - struct nfs4_exception exception = { };
1168 + struct nfs4_exception exception = {
1169 + .inode = state->inode,
1170 + };
1171 int err;
1172
1173 do {
1174 @@ -4442,7 +4444,9 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request
1175 static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request)
1176 {
1177 struct nfs_server *server = NFS_SERVER(state->inode);
1178 - struct nfs4_exception exception = { };
1179 + struct nfs4_exception exception = {
1180 + .inode = state->inode,
1181 + };
1182 int err;
1183
1184 err = nfs4_set_lock_state(state, request);
1185 @@ -4508,6 +4512,7 @@ static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *
1186 {
1187 struct nfs4_exception exception = {
1188 .state = state,
1189 + .inode = state->inode,
1190 };
1191 int err;
1192
1193 @@ -4553,6 +4558,20 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request)
1194
1195 if (state == NULL)
1196 return -ENOLCK;
1197 + /*
1198 + * Don't rely on the VFS having checked the file open mode,
1199 + * since it won't do this for flock() locks.
1200 + */
1201 + switch (request->fl_type & (F_RDLCK|F_WRLCK|F_UNLCK)) {
1202 + case F_RDLCK:
1203 + if (!(filp->f_mode & FMODE_READ))
1204 + return -EBADF;
1205 + break;
1206 + case F_WRLCK:
1207 + if (!(filp->f_mode & FMODE_WRITE))
1208 + return -EBADF;
1209 + }
1210 +
1211 do {
1212 status = nfs4_proc_setlk(state, cmd, request);
1213 if ((status != -EAGAIN) || IS_SETLK(cmd))
1214 diff --git a/fs/nfs/super.c b/fs/nfs/super.c
1215 index 7e8b07d..8e7b61d 100644
1216 --- a/fs/nfs/super.c
1217 +++ b/fs/nfs/super.c
1218 @@ -2694,11 +2694,15 @@ static struct vfsmount *nfs_do_root_mount(struct file_system_type *fs_type,
1219 char *root_devname;
1220 size_t len;
1221
1222 - len = strlen(hostname) + 3;
1223 + len = strlen(hostname) + 5;
1224 root_devname = kmalloc(len, GFP_KERNEL);
1225 if (root_devname == NULL)
1226 return ERR_PTR(-ENOMEM);
1227 - snprintf(root_devname, len, "%s:/", hostname);
1228 + /* Does hostname needs to be enclosed in brackets? */
1229 + if (strchr(hostname, ':'))
1230 + snprintf(root_devname, len, "[%s]:/", hostname);
1231 + else
1232 + snprintf(root_devname, len, "%s:/", hostname);
1233 root_mnt = vfs_kern_mount(fs_type, flags, root_devname, data);
1234 kfree(root_devname);
1235 return root_mnt;
1236 diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
1237 index 0b8830c..d06a02c 100644
1238 --- a/fs/nfsd/nfs4proc.c
1239 +++ b/fs/nfsd/nfs4proc.c
1240 @@ -812,6 +812,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1241 struct nfsd4_setattr *setattr)
1242 {
1243 __be32 status = nfs_ok;
1244 + int err;
1245
1246 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
1247 nfs4_lock_state();
1248 @@ -823,9 +824,9 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1249 return status;
1250 }
1251 }
1252 - status = mnt_want_write(cstate->current_fh.fh_export->ex_path.mnt);
1253 - if (status)
1254 - return status;
1255 + err = mnt_want_write(cstate->current_fh.fh_export->ex_path.mnt);
1256 + if (err)
1257 + return nfserrno(err);
1258 status = nfs_ok;
1259
1260 status = check_attr_support(rqstp, cstate, setattr->sa_bmval,
1261 diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
1262 index ecd8152..92f7eb7 100644
1263 --- a/fs/nfsd/nfs4state.c
1264 +++ b/fs/nfsd/nfs4state.c
1265 @@ -3956,16 +3956,14 @@ out:
1266 * vfs_test_lock. (Arguably perhaps test_lock should be done with an
1267 * inode operation.)
1268 */
1269 -static int nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock)
1270 +static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock)
1271 {
1272 struct file *file;
1273 - int err;
1274 -
1275 - err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file);
1276 - if (err)
1277 - return err;
1278 - err = vfs_test_lock(file, lock);
1279 - nfsd_close(file);
1280 + __be32 err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file);
1281 + if (!err) {
1282 + err = nfserrno(vfs_test_lock(file, lock));
1283 + nfsd_close(file);
1284 + }
1285 return err;
1286 }
1287
1288 @@ -3978,7 +3976,6 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1289 {
1290 struct inode *inode;
1291 struct file_lock file_lock;
1292 - int error;
1293 __be32 status;
1294
1295 if (locks_in_grace())
1296 @@ -4030,12 +4027,10 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1297
1298 nfs4_transform_lock_offset(&file_lock);
1299
1300 - status = nfs_ok;
1301 - error = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock);
1302 - if (error) {
1303 - status = nfserrno(error);
1304 + status = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock);
1305 + if (status)
1306 goto out;
1307 - }
1308 +
1309 if (file_lock.fl_type != F_UNLCK) {
1310 status = nfserr_denied;
1311 nfs4_set_lock_denied(&file_lock, &lockt->lt_denied);
1312 diff --git a/fs/pipe.c b/fs/pipe.c
1313 index da42f7d..0499a96 100644
1314 --- a/fs/pipe.c
1315 +++ b/fs/pipe.c
1316 @@ -345,6 +345,16 @@ static const struct pipe_buf_operations anon_pipe_buf_ops = {
1317 .get = generic_pipe_buf_get,
1318 };
1319
1320 +static const struct pipe_buf_operations packet_pipe_buf_ops = {
1321 + .can_merge = 0,
1322 + .map = generic_pipe_buf_map,
1323 + .unmap = generic_pipe_buf_unmap,
1324 + .confirm = generic_pipe_buf_confirm,
1325 + .release = anon_pipe_buf_release,
1326 + .steal = generic_pipe_buf_steal,
1327 + .get = generic_pipe_buf_get,
1328 +};
1329 +
1330 static ssize_t
1331 pipe_read(struct kiocb *iocb, const struct iovec *_iov,
1332 unsigned long nr_segs, loff_t pos)
1333 @@ -406,6 +416,13 @@ redo:
1334 ret += chars;
1335 buf->offset += chars;
1336 buf->len -= chars;
1337 +
1338 + /* Was it a packet buffer? Clean up and exit */
1339 + if (buf->flags & PIPE_BUF_FLAG_PACKET) {
1340 + total_len = chars;
1341 + buf->len = 0;
1342 + }
1343 +
1344 if (!buf->len) {
1345 buf->ops = NULL;
1346 ops->release(pipe, buf);
1347 @@ -458,6 +475,11 @@ redo:
1348 return ret;
1349 }
1350
1351 +static inline int is_packetized(struct file *file)
1352 +{
1353 + return (file->f_flags & O_DIRECT) != 0;
1354 +}
1355 +
1356 static ssize_t
1357 pipe_write(struct kiocb *iocb, const struct iovec *_iov,
1358 unsigned long nr_segs, loff_t ppos)
1359 @@ -592,6 +614,11 @@ redo2:
1360 buf->ops = &anon_pipe_buf_ops;
1361 buf->offset = 0;
1362 buf->len = chars;
1363 + buf->flags = 0;
1364 + if (is_packetized(filp)) {
1365 + buf->ops = &packet_pipe_buf_ops;
1366 + buf->flags = PIPE_BUF_FLAG_PACKET;
1367 + }
1368 pipe->nrbufs = ++bufs;
1369 pipe->tmp_page = NULL;
1370
1371 @@ -1012,7 +1039,7 @@ struct file *create_write_pipe(int flags)
1372 goto err_dentry;
1373 f->f_mapping = inode->i_mapping;
1374
1375 - f->f_flags = O_WRONLY | (flags & O_NONBLOCK);
1376 + f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT));
1377 f->f_version = 0;
1378
1379 return f;
1380 @@ -1056,7 +1083,7 @@ int do_pipe_flags(int *fd, int flags)
1381 int error;
1382 int fdw, fdr;
1383
1384 - if (flags & ~(O_CLOEXEC | O_NONBLOCK))
1385 + if (flags & ~(O_CLOEXEC | O_NONBLOCK | O_DIRECT))
1386 return -EINVAL;
1387
1388 fw = create_write_pipe(flags);
1389 diff --git a/include/linux/efi.h b/include/linux/efi.h
1390 index e376270..e0ce165 100644
1391 --- a/include/linux/efi.h
1392 +++ b/include/linux/efi.h
1393 @@ -347,7 +347,18 @@ extern int __init efi_setup_pcdp_console(char *);
1394 #define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001
1395 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002
1396 #define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004
1397 -
1398 +#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x0000000000000008
1399 +#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x0000000000000010
1400 +#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x0000000000000020
1401 +#define EFI_VARIABLE_APPEND_WRITE 0x0000000000000040
1402 +
1403 +#define EFI_VARIABLE_MASK (EFI_VARIABLE_NON_VOLATILE | \
1404 + EFI_VARIABLE_BOOTSERVICE_ACCESS | \
1405 + EFI_VARIABLE_RUNTIME_ACCESS | \
1406 + EFI_VARIABLE_HARDWARE_ERROR_RECORD | \
1407 + EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \
1408 + EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \
1409 + EFI_VARIABLE_APPEND_WRITE)
1410 /*
1411 * EFI Device Path information
1412 */
1413 diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
1414 index 31ebb59..82d5476 100644
1415 --- a/include/linux/kvm_host.h
1416 +++ b/include/linux/kvm_host.h
1417 @@ -554,6 +554,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
1418
1419 #ifdef CONFIG_IOMMU_API
1420 int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
1421 +void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
1422 int kvm_iommu_map_guest(struct kvm *kvm);
1423 int kvm_iommu_unmap_guest(struct kvm *kvm);
1424 int kvm_assign_device(struct kvm *kvm,
1425 @@ -567,6 +568,11 @@ static inline int kvm_iommu_map_pages(struct kvm *kvm,
1426 return 0;
1427 }
1428
1429 +static inline void kvm_iommu_unmap_pages(struct kvm *kvm,
1430 + struct kvm_memory_slot *slot)
1431 +{
1432 +}
1433 +
1434 static inline int kvm_iommu_map_guest(struct kvm *kvm)
1435 {
1436 return -ENODEV;
1437 diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
1438 index 77257c9..0072a53 100644
1439 --- a/include/linux/pipe_fs_i.h
1440 +++ b/include/linux/pipe_fs_i.h
1441 @@ -8,6 +8,7 @@
1442 #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */
1443 #define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */
1444 #define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */
1445 +#define PIPE_BUF_FLAG_PACKET 0x08 /* read() as a packet */
1446
1447 /**
1448 * struct pipe_buffer - a linux kernel pipe buffer
1449 diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
1450 index c0ecc5a..32ba8c5 100644
1451 --- a/include/linux/usb/hcd.h
1452 +++ b/include/linux/usb/hcd.h
1453 @@ -128,6 +128,8 @@ struct usb_hcd {
1454 unsigned wireless:1; /* Wireless USB HCD */
1455 unsigned authorized_default:1;
1456 unsigned has_tt:1; /* Integrated TT in root hub */
1457 + unsigned broken_pci_sleep:1; /* Don't put the
1458 + controller in PCI-D3 for system sleep */
1459
1460 int irq; /* irq allocated */
1461 void __iomem *regs; /* device memory/io */
1462 diff --git a/kernel/sched.c b/kernel/sched.c
1463 index 063d7a4..03dff14 100644
1464 --- a/kernel/sched.c
1465 +++ b/kernel/sched.c
1466 @@ -3392,13 +3392,10 @@ calc_load_n(unsigned long load, unsigned long exp,
1467 * Once we've updated the global active value, we need to apply the exponential
1468 * weights adjusted to the number of cycles missed.
1469 */
1470 -static void calc_global_nohz(unsigned long ticks)
1471 +static void calc_global_nohz(void)
1472 {
1473 long delta, active, n;
1474
1475 - if (time_before(jiffies, calc_load_update))
1476 - return;
1477 -
1478 /*
1479 * If we crossed a calc_load_update boundary, make sure to fold
1480 * any pending idle changes, the respective CPUs might have
1481 @@ -3410,31 +3407,25 @@ static void calc_global_nohz(unsigned long ticks)
1482 atomic_long_add(delta, &calc_load_tasks);
1483
1484 /*
1485 - * If we were idle for multiple load cycles, apply them.
1486 + * It could be the one fold was all it took, we done!
1487 */
1488 - if (ticks >= LOAD_FREQ) {
1489 - n = ticks / LOAD_FREQ;
1490 + if (time_before(jiffies, calc_load_update + 10))
1491 + return;
1492
1493 - active = atomic_long_read(&calc_load_tasks);
1494 - active = active > 0 ? active * FIXED_1 : 0;
1495 + /*
1496 + * Catch-up, fold however many we are behind still
1497 + */
1498 + delta = jiffies - calc_load_update - 10;
1499 + n = 1 + (delta / LOAD_FREQ);
1500
1501 - avenrun[0] = calc_load_n(avenrun[0], EXP_1, active, n);
1502 - avenrun[1] = calc_load_n(avenrun[1], EXP_5, active, n);
1503 - avenrun[2] = calc_load_n(avenrun[2], EXP_15, active, n);
1504 + active = atomic_long_read(&calc_load_tasks);
1505 + active = active > 0 ? active * FIXED_1 : 0;
1506
1507 - calc_load_update += n * LOAD_FREQ;
1508 - }
1509 + avenrun[0] = calc_load_n(avenrun[0], EXP_1, active, n);
1510 + avenrun[1] = calc_load_n(avenrun[1], EXP_5, active, n);
1511 + avenrun[2] = calc_load_n(avenrun[2], EXP_15, active, n);
1512
1513 - /*
1514 - * Its possible the remainder of the above division also crosses
1515 - * a LOAD_FREQ period, the regular check in calc_global_load()
1516 - * which comes after this will take care of that.
1517 - *
1518 - * Consider us being 11 ticks before a cycle completion, and us
1519 - * sleeping for 4*LOAD_FREQ + 22 ticks, then the above code will
1520 - * age us 4 cycles, and the test in calc_global_load() will
1521 - * pick up the final one.
1522 - */
1523 + calc_load_update += n * LOAD_FREQ;
1524 }
1525 #else
1526 static void calc_load_account_idle(struct rq *this_rq)
1527 @@ -3446,7 +3437,7 @@ static inline long calc_load_fold_idle(void)
1528 return 0;
1529 }
1530
1531 -static void calc_global_nohz(unsigned long ticks)
1532 +static void calc_global_nohz(void)
1533 {
1534 }
1535 #endif
1536 @@ -3474,8 +3465,6 @@ void calc_global_load(unsigned long ticks)
1537 {
1538 long active;
1539
1540 - calc_global_nohz(ticks);
1541 -
1542 if (time_before(jiffies, calc_load_update + 10))
1543 return;
1544
1545 @@ -3487,6 +3476,16 @@ void calc_global_load(unsigned long ticks)
1546 avenrun[2] = calc_load(avenrun[2], EXP_15, active);
1547
1548 calc_load_update += LOAD_FREQ;
1549 +
1550 + /*
1551 + * Account one period with whatever state we found before
1552 + * folding in the nohz state and ageing the entire idle period.
1553 + *
1554 + * This avoids loosing a sample when we go idle between
1555 + * calc_load_account_active() (10 ticks ago) and now and thus
1556 + * under-accounting.
1557 + */
1558 + calc_global_nohz();
1559 }
1560
1561 /*
1562 diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
1563 index 3104c84..da878c1 100644
1564 --- a/net/mac80211/tx.c
1565 +++ b/net/mac80211/tx.c
1566 @@ -1222,7 +1222,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
1567 tx->sta = rcu_dereference(sdata->u.vlan.sta);
1568 if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr)
1569 return TX_DROP;
1570 - } else if (info->flags & IEEE80211_TX_CTL_INJECTED) {
1571 + } else if (info->flags & IEEE80211_TX_CTL_INJECTED ||
1572 + tx->sdata->control_port_protocol == tx->skb->protocol) {
1573 tx->sta = sta_info_get_bss(sdata, hdr->addr1);
1574 }
1575 if (!tx->sta)
1576 diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
1577 index 0c2b808..f310a0d 100644
1578 --- a/net/wireless/nl80211.c
1579 +++ b/net/wireless/nl80211.c
1580 @@ -1181,6 +1181,11 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1581 goto bad_res;
1582 }
1583
1584 + if (!netif_running(netdev)) {
1585 + result = -ENETDOWN;
1586 + goto bad_res;
1587 + }
1588 +
1589 nla_for_each_nested(nl_txq_params,
1590 info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS],
1591 rem_txq_params) {
1592 @@ -5432,7 +5437,7 @@ static struct genl_ops nl80211_ops[] = {
1593 .doit = nl80211_get_key,
1594 .policy = nl80211_policy,
1595 .flags = GENL_ADMIN_PERM,
1596 - .internal_flags = NL80211_FLAG_NEED_NETDEV |
1597 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1598 NL80211_FLAG_NEED_RTNL,
1599 },
1600 {
1601 @@ -5464,7 +5469,7 @@ static struct genl_ops nl80211_ops[] = {
1602 .policy = nl80211_policy,
1603 .flags = GENL_ADMIN_PERM,
1604 .doit = nl80211_addset_beacon,
1605 - .internal_flags = NL80211_FLAG_NEED_NETDEV |
1606 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1607 NL80211_FLAG_NEED_RTNL,
1608 },
1609 {
1610 @@ -5472,7 +5477,7 @@ static struct genl_ops nl80211_ops[] = {
1611 .policy = nl80211_policy,
1612 .flags = GENL_ADMIN_PERM,
1613 .doit = nl80211_addset_beacon,
1614 - .internal_flags = NL80211_FLAG_NEED_NETDEV |
1615 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1616 NL80211_FLAG_NEED_RTNL,
1617 },
1618 {
1619 @@ -5496,7 +5501,7 @@ static struct genl_ops nl80211_ops[] = {
1620 .doit = nl80211_set_station,
1621 .policy = nl80211_policy,
1622 .flags = GENL_ADMIN_PERM,
1623 - .internal_flags = NL80211_FLAG_NEED_NETDEV |
1624 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1625 NL80211_FLAG_NEED_RTNL,
1626 },
1627 {
1628 @@ -5512,7 +5517,7 @@ static struct genl_ops nl80211_ops[] = {
1629 .doit = nl80211_del_station,
1630 .policy = nl80211_policy,
1631 .flags = GENL_ADMIN_PERM,
1632 - .internal_flags = NL80211_FLAG_NEED_NETDEV |
1633 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1634 NL80211_FLAG_NEED_RTNL,
1635 },
1636 {
1637 @@ -5545,7 +5550,7 @@ static struct genl_ops nl80211_ops[] = {
1638 .doit = nl80211_del_mpath,
1639 .policy = nl80211_policy,
1640 .flags = GENL_ADMIN_PERM,
1641 - .internal_flags = NL80211_FLAG_NEED_NETDEV |
1642 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1643 NL80211_FLAG_NEED_RTNL,
1644 },
1645 {
1646 @@ -5553,7 +5558,7 @@ static struct genl_ops nl80211_ops[] = {
1647 .doit = nl80211_set_bss,
1648 .policy = nl80211_policy,
1649 .flags = GENL_ADMIN_PERM,
1650 - .internal_flags = NL80211_FLAG_NEED_NETDEV |
1651 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1652 NL80211_FLAG_NEED_RTNL,
1653 },
1654 {
1655 @@ -5579,7 +5584,7 @@ static struct genl_ops nl80211_ops[] = {
1656 .doit = nl80211_get_mesh_config,
1657 .policy = nl80211_policy,
1658 /* can be retrieved by unprivileged users */
1659 - .internal_flags = NL80211_FLAG_NEED_NETDEV |
1660 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1661 NL80211_FLAG_NEED_RTNL,
1662 },
1663 {
1664 @@ -5711,7 +5716,7 @@ static struct genl_ops nl80211_ops[] = {
1665 .doit = nl80211_setdel_pmksa,
1666 .policy = nl80211_policy,
1667 .flags = GENL_ADMIN_PERM,
1668 - .internal_flags = NL80211_FLAG_NEED_NETDEV |
1669 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1670 NL80211_FLAG_NEED_RTNL,
1671 },
1672 {
1673 @@ -5719,7 +5724,7 @@ static struct genl_ops nl80211_ops[] = {
1674 .doit = nl80211_setdel_pmksa,
1675 .policy = nl80211_policy,
1676 .flags = GENL_ADMIN_PERM,
1677 - .internal_flags = NL80211_FLAG_NEED_NETDEV |
1678 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1679 NL80211_FLAG_NEED_RTNL,
1680 },
1681 {
1682 @@ -5727,7 +5732,7 @@ static struct genl_ops nl80211_ops[] = {
1683 .doit = nl80211_flush_pmksa,
1684 .policy = nl80211_policy,
1685 .flags = GENL_ADMIN_PERM,
1686 - .internal_flags = NL80211_FLAG_NEED_NETDEV |
1687 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1688 NL80211_FLAG_NEED_RTNL,
1689 },
1690 {
1691 @@ -5815,7 +5820,7 @@ static struct genl_ops nl80211_ops[] = {
1692 .doit = nl80211_set_wds_peer,
1693 .policy = nl80211_policy,
1694 .flags = GENL_ADMIN_PERM,
1695 - .internal_flags = NL80211_FLAG_NEED_NETDEV |
1696 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
1697 NL80211_FLAG_NEED_RTNL,
1698 },
1699 {
1700 diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
1701 index e26e2fb..f210eae 100644
1702 --- a/scripts/mod/file2alias.c
1703 +++ b/scripts/mod/file2alias.c
1704 @@ -905,6 +905,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1705 if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections)
1706 return;
1707
1708 + /* We're looking for an object */
1709 + if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT)
1710 + return;
1711 +
1712 /* Handle all-NULL symbols allocated into .bss */
1713 if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) {
1714 zeros = calloc(1, sym->st_size);
1715 diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
1716 index 058c0a8..d5ec206 100644
1717 --- a/sound/soc/soc-dapm.c
1718 +++ b/sound/soc/soc-dapm.c
1719 @@ -67,6 +67,7 @@ static int dapm_up_seq[] = {
1720 [snd_soc_dapm_out_drv] = 10,
1721 [snd_soc_dapm_hp] = 10,
1722 [snd_soc_dapm_spk] = 10,
1723 + [snd_soc_dapm_line] = 10,
1724 [snd_soc_dapm_post] = 11,
1725 };
1726
1727 @@ -75,6 +76,7 @@ static int dapm_down_seq[] = {
1728 [snd_soc_dapm_adc] = 1,
1729 [snd_soc_dapm_hp] = 2,
1730 [snd_soc_dapm_spk] = 2,
1731 + [snd_soc_dapm_line] = 2,
1732 [snd_soc_dapm_out_drv] = 2,
1733 [snd_soc_dapm_pga] = 4,
1734 [snd_soc_dapm_mixer_named_ctl] = 5,
1735 diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
1736 index 62a9caf..fb0f6e4 100644
1737 --- a/virt/kvm/iommu.c
1738 +++ b/virt/kvm/iommu.c
1739 @@ -285,6 +285,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm,
1740 }
1741 }
1742
1743 +void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
1744 +{
1745 + kvm_iommu_put_pages(kvm, slot->base_gfn, slot->npages);
1746 +}
1747 +
1748 static int kvm_iommu_unmap_memslots(struct kvm *kvm)
1749 {
1750 int i, idx;
1751 @@ -293,10 +298,9 @@ static int kvm_iommu_unmap_memslots(struct kvm *kvm)
1752 idx = srcu_read_lock(&kvm->srcu);
1753 slots = kvm_memslots(kvm);
1754
1755 - for (i = 0; i < slots->nmemslots; i++) {
1756 - kvm_iommu_put_pages(kvm, slots->memslots[i].base_gfn,
1757 - slots->memslots[i].npages);
1758 - }
1759 + for (i = 0; i < slots->nmemslots; i++)
1760 + kvm_iommu_unmap_pages(kvm, &slots->memslots[i]);
1761 +
1762 srcu_read_unlock(&kvm->srcu, idx);
1763
1764 return 0;
1765 diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
1766 index 96ebc06..6b39ba9 100644
1767 --- a/virt/kvm/kvm_main.c
1768 +++ b/virt/kvm/kvm_main.c
1769 @@ -796,12 +796,13 @@ skip_lpage:
1770 if (r)
1771 goto out_free;
1772
1773 - /* map the pages in iommu page table */
1774 + /* map/unmap the pages in iommu page table */
1775 if (npages) {
1776 r = kvm_iommu_map_pages(kvm, &new);
1777 if (r)
1778 goto out_free;
1779 - }
1780 + } else
1781 + kvm_iommu_unmap_pages(kvm, &old);
1782
1783 r = -ENOMEM;
1784 slots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL);

  ViewVC Help
Powered by ViewVC 1.1.20