Magellan Linux

Annotation of /trunk/kernel26-magellan/patches-2.6.25-r5/0105-2.6.25.6-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 677 - (hide annotations) (download)
Wed Sep 10 21:27:27 2008 UTC (15 years, 8 months ago) by niro
File size: 63706 byte(s)
2.6.25-magellan-r5:
- updated to linux-2.6.25.17

1 niro 677 diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
2     index be35ffa..1457aa0 100644
3     --- a/arch/powerpc/kernel/smp.c
4     +++ b/arch/powerpc/kernel/smp.c
5     @@ -386,6 +386,8 @@ static void __init smp_create_idle(unsigned int cpu)
6     panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
7     #ifdef CONFIG_PPC64
8     paca[cpu].__current = p;
9     + paca[cpu].kstack = (unsigned long) task_thread_info(p)
10     + + THREAD_SIZE - STACK_FRAME_OVERHEAD;
11     #endif
12     current_set[cpu] = task_thread_info(p);
13     task_thread_info(p)->cpu = cpu;
14     diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
15     index 906daed..a9626d6 100644
16     --- a/arch/powerpc/mm/slb.c
17     +++ b/arch/powerpc/mm/slb.c
18     @@ -44,13 +44,13 @@ static void slb_allocate(unsigned long ea)
19     slb_allocate_realmode(ea);
20     }
21    
22     +#define slb_esid_mask(ssize) \
23     + (((ssize) == MMU_SEGSIZE_256M)? ESID_MASK: ESID_MASK_1T)
24     +
25     static inline unsigned long mk_esid_data(unsigned long ea, int ssize,
26     unsigned long slot)
27     {
28     - unsigned long mask;
29     -
30     - mask = (ssize == MMU_SEGSIZE_256M)? ESID_MASK: ESID_MASK_1T;
31     - return (ea & mask) | SLB_ESID_V | slot;
32     + return (ea & slb_esid_mask(ssize)) | SLB_ESID_V | slot;
33     }
34    
35     #define slb_vsid_shift(ssize) \
36     @@ -301,11 +301,16 @@ void slb_initialize(void)
37    
38     create_shadowed_slbe(VMALLOC_START, mmu_kernel_ssize, vflags, 1);
39    
40     + /* For the boot cpu, we're running on the stack in init_thread_union,
41     + * which is in the first segment of the linear mapping, and also
42     + * get_paca()->kstack hasn't been initialized yet.
43     + * For secondary cpus, we need to bolt the kernel stack entry now.
44     + */
45     slb_shadow_clear(2);
46     + if (raw_smp_processor_id() != boot_cpuid &&
47     + (get_paca()->kstack & slb_esid_mask(mmu_kernel_ssize)) > PAGE_OFFSET)
48     + create_shadowed_slbe(get_paca()->kstack,
49     + mmu_kernel_ssize, lflags, 2);
50    
51     - /* We don't bolt the stack for the time being - we're in boot,
52     - * so the stack is in the bolted segment. By the time it goes
53     - * elsewhere, we'll call _switch() which will bolt in the new
54     - * one. */
55     asm volatile("isync":::"memory");
56     }
57     diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
58     index d8d03e0..9629434 100644
59     --- a/arch/x86/kernel/apic_64.c
60     +++ b/arch/x86/kernel/apic_64.c
61     @@ -524,7 +524,7 @@ int setup_profiling_timer(unsigned int multiplier)
62     */
63     void clear_local_APIC(void)
64     {
65     - int maxlvt = lapic_get_maxlvt();
66     + int maxlvt;
67     u32 v;
68    
69     /* APIC hasn't been mapped yet */
70     diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
71     index a962dcb..404ff26 100644
72     --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
73     +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
74     @@ -339,6 +339,7 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
75     {
76     struct acpi_cpufreq_data *data = per_cpu(drv_data, cpu);
77     unsigned int freq;
78     + unsigned int cached_freq;
79    
80     dprintk("get_cur_freq_on_cpu (%d)\n", cpu);
81    
82     @@ -347,7 +348,16 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
83     return 0;
84     }
85    
86     + cached_freq = data->freq_table[data->acpi_data->state].frequency;
87     freq = extract_freq(get_cur_val(cpumask_of_cpu(cpu)), data);
88     + if (freq != cached_freq) {
89     + /*
90     + * The dreaded BIOS frequency change behind our back.
91     + * Force set the frequency on next target call.
92     + */
93     + data->resume = 1;
94     + }
95     +
96     dprintk("cur freq = %u\n", freq);
97    
98     return freq;
99     diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
100     index cef054b..89bb5ee 100644
101     --- a/arch/x86/kernel/irq_32.c
102     +++ b/arch/x86/kernel/irq_32.c
103     @@ -134,7 +134,7 @@ unsigned int do_IRQ(struct pt_regs *regs)
104     : "=a" (arg1), "=d" (arg2), "=b" (bx)
105     : "0" (irq), "1" (desc), "2" (isp),
106     "D" (desc->handle_irq)
107     - : "memory", "cc"
108     + : "memory", "cc", "ecx"
109     );
110     } else
111     #endif
112     diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
113     index 43930e7..c8890b8 100644
114     --- a/arch/x86/kernel/process_32.c
115     +++ b/arch/x86/kernel/process_32.c
116     @@ -710,8 +710,11 @@ struct task_struct * __switch_to(struct task_struct *prev_p, struct task_struct
117     /* If the task has used fpu the last 5 timeslices, just do a full
118     * restore of the math state immediately to avoid the trap; the
119     * chances of needing FPU soon are obviously high now
120     + *
121     + * tsk_used_math() checks prevent calling math_state_restore(),
122     + * which can sleep in the case of !tsk_used_math()
123     */
124     - if (next_p->fpu_counter > 5)
125     + if (tsk_used_math(next_p) && next_p->fpu_counter > 5)
126     math_state_restore();
127    
128     /*
129     diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
130     index 46c4c54..1316f1c 100644
131     --- a/arch/x86/kernel/process_64.c
132     +++ b/arch/x86/kernel/process_64.c
133     @@ -696,8 +696,11 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
134     /* If the task has used fpu the last 5 timeslices, just do a full
135     * restore of the math state immediately to avoid the trap; the
136     * chances of needing FPU soon are obviously high now
137     + *
138     + * tsk_used_math() checks prevent calling math_state_restore(),
139     + * which can sleep in the case of !tsk_used_math()
140     */
141     - if (next_p->fpu_counter>5)
142     + if (tsk_used_math(next_p) && next_p->fpu_counter > 5)
143     math_state_restore();
144     return prev_p;
145     }
146     diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
147     index eb92ccb..9003e0b 100644
148     --- a/arch/x86/kernel/ptrace.c
149     +++ b/arch/x86/kernel/ptrace.c
150     @@ -1382,6 +1382,9 @@ static const struct user_regset_view user_x86_64_view = {
151     #define genregs32_get genregs_get
152     #define genregs32_set genregs_set
153    
154     +#define user_i387_ia32_struct user_i387_struct
155     +#define user32_fxsr_struct user_fxsr_struct
156     +
157     #endif /* CONFIG_X86_64 */
158    
159     #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
160     @@ -1394,13 +1397,13 @@ static const struct user_regset x86_32_regsets[] = {
161     },
162     [REGSET_FP] = {
163     .core_note_type = NT_PRFPREG,
164     - .n = sizeof(struct user_i387_struct) / sizeof(u32),
165     + .n = sizeof(struct user_i387_ia32_struct) / sizeof(u32),
166     .size = sizeof(u32), .align = sizeof(u32),
167     .active = fpregs_active, .get = fpregs_get, .set = fpregs_set
168     },
169     [REGSET_XFP] = {
170     .core_note_type = NT_PRXFPREG,
171     - .n = sizeof(struct user_i387_struct) / sizeof(u32),
172     + .n = sizeof(struct user32_fxsr_struct) / sizeof(u32),
173     .size = sizeof(u32), .align = sizeof(u32),
174     .active = xfpregs_active, .get = xfpregs_get, .set = xfpregs_set
175     },
176     diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c
177     index c2241e0..01e4f8b 100644
178     --- a/arch/x86/kernel/tsc_32.c
179     +++ b/arch/x86/kernel/tsc_32.c
180     @@ -14,7 +14,7 @@
181    
182     #include "mach_timer.h"
183    
184     -static int tsc_enabled;
185     +static int tsc_disabled;
186    
187     /*
188     * On some systems the TSC frequency does not
189     @@ -28,8 +28,8 @@ EXPORT_SYMBOL_GPL(tsc_khz);
190     static int __init tsc_setup(char *str)
191     {
192     printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, "
193     - "cannot disable TSC completely.\n");
194     - mark_tsc_unstable("user disabled TSC");
195     + "cannot disable TSC completely.\n");
196     + tsc_disabled = 1;
197     return 1;
198     }
199     #else
200     @@ -121,7 +121,7 @@ unsigned long long native_sched_clock(void)
201     * very important for it to be as fast as the platform
202     * can achive it. )
203     */
204     - if (unlikely(!tsc_enabled && !tsc_unstable))
205     + if (unlikely(tsc_disabled))
206     /* No locking but a rare wrong value is not a big deal: */
207     return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
208    
209     @@ -310,7 +310,6 @@ void mark_tsc_unstable(char *reason)
210     {
211     if (!tsc_unstable) {
212     tsc_unstable = 1;
213     - tsc_enabled = 0;
214     printk("Marking TSC unstable due to: %s.\n", reason);
215     /* Can be called before registration */
216     if (clocksource_tsc.mult)
217     @@ -324,7 +323,7 @@ EXPORT_SYMBOL_GPL(mark_tsc_unstable);
218     static int __init dmi_mark_tsc_unstable(const struct dmi_system_id *d)
219     {
220     printk(KERN_NOTICE "%s detected: marking TSC unstable.\n",
221     - d->ident);
222     + d->ident);
223     tsc_unstable = 1;
224     return 0;
225     }
226     @@ -391,14 +390,24 @@ void __init tsc_init(void)
227     {
228     int cpu;
229    
230     - if (!cpu_has_tsc)
231     - goto out_no_tsc;
232     + if (!cpu_has_tsc || tsc_disabled) {
233     + /* Disable the TSC in case of !cpu_has_tsc */
234     + tsc_disabled = 1;
235     + return;
236     + }
237    
238     cpu_khz = calculate_cpu_khz();
239     tsc_khz = cpu_khz;
240    
241     - if (!cpu_khz)
242     - goto out_no_tsc;
243     + if (!cpu_khz) {
244     + mark_tsc_unstable("could not calculate TSC khz");
245     + /*
246     + * We need to disable the TSC completely in this case
247     + * to prevent sched_clock() from using it.
248     + */
249     + tsc_disabled = 1;
250     + return;
251     + }
252    
253     printk("Detected %lu.%03lu MHz processor.\n",
254     (unsigned long)cpu_khz / 1000,
255     @@ -427,13 +436,6 @@ void __init tsc_init(void)
256     if (check_tsc_unstable()) {
257     clocksource_tsc.rating = 0;
258     clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
259     - } else
260     - tsc_enabled = 1;
261     -
262     + }
263     clocksource_register(&clocksource_tsc);
264     -
265     - return;
266     -
267     -out_no_tsc:
268     - setup_clear_cpu_cap(X86_FEATURE_TSC);
269     }
270     diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c
271     index d3bebaa..5153afc 100644
272     --- a/arch/x86/kernel/tsc_64.c
273     +++ b/arch/x86/kernel/tsc_64.c
274     @@ -227,14 +227,14 @@ void __init tsc_calibrate(void)
275     /* hpet or pmtimer available ? */
276     if (!hpet && !pm1 && !pm2) {
277     printk(KERN_INFO "TSC calibrated against PIT\n");
278     - return;
279     + goto out;
280     }
281    
282     /* Check, whether the sampling was disturbed by an SMI */
283     if (tsc1 == ULONG_MAX || tsc2 == ULONG_MAX) {
284     printk(KERN_WARNING "TSC calibration disturbed by SMI, "
285     "using PIT calibration result\n");
286     - return;
287     + goto out;
288     }
289    
290     tsc2 = (tsc2 - tsc1) * 1000000L;
291     @@ -255,6 +255,7 @@ void __init tsc_calibrate(void)
292    
293     tsc_khz = tsc2 / tsc1;
294    
295     +out:
296     for_each_possible_cpu(cpu)
297     set_cyc2ns_scale(tsc_khz, cpu);
298     }
299     diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
300     index a02a14f..b2c5231 100644
301     --- a/arch/x86/mm/init_64.c
302     +++ b/arch/x86/mm/init_64.c
303     @@ -192,7 +192,7 @@ void __init cleanup_highmap(void)
304     pmd_t *last_pmd = pmd + PTRS_PER_PMD;
305    
306     for (; pmd < last_pmd; pmd++, vaddr += PMD_SIZE) {
307     - if (!pmd_present(*pmd))
308     + if (pmd_none(*pmd))
309     continue;
310     if (vaddr < (unsigned long) _text || vaddr > end)
311     set_pmd(pmd, __pmd(0));
312     diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
313     index 05356ce..c7e2a44 100644
314     --- a/arch/x86/pci/common.c
315     +++ b/arch/x86/pci/common.c
316     @@ -130,19 +130,6 @@ static void __devinit pcibios_fixup_ghosts(struct pci_bus *b)
317     }
318     }
319    
320     -static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
321     -{
322     - struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE];
323     -
324     - if (rom_r->parent)
325     - return;
326     - if (rom_r->start)
327     - /* we deal with BIOS assigned ROM later */
328     - return;
329     - if (!(pci_probe & PCI_ASSIGN_ROMS))
330     - rom_r->start = rom_r->end = rom_r->flags = 0;
331     -}
332     -
333     /*
334     * Called after each bus is probed, but before its children
335     * are examined.
336     @@ -150,12 +137,8 @@ static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
337    
338     void __devinit pcibios_fixup_bus(struct pci_bus *b)
339     {
340     - struct pci_dev *dev;
341     -
342     pcibios_fixup_ghosts(b);
343     pci_read_bridge_bases(b);
344     - list_for_each_entry(dev, &b->devices, bus_list)
345     - pcibios_fixup_device_resources(dev);
346     }
347    
348     /*
349     diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
350     index be95fdb..92da864 100644
351     --- a/drivers/ata/libata-core.c
352     +++ b/drivers/ata/libata-core.c
353     @@ -3947,6 +3947,7 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
354     struct ata_port *ap = link->ap;
355     struct ata_eh_context *ehc = &link->eh_context;
356     const unsigned long *timing = sata_ehc_deb_timing(ehc);
357     + u32 sstatus;
358     int rc;
359    
360     /* handle link resume */
361     @@ -3960,6 +3961,17 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
362     if (ap->flags & ATA_FLAG_PMP)
363     ehc->i.action |= ATA_EH_HARDRESET;
364    
365     + /* if link powersave is on, force hardreset */
366     + if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) {
367     + u8 ipm = sstatus >> 8;
368     +
369     + if (ipm == 2 || ipm == 6) {
370     + ata_link_printk(link, KERN_INFO, "link in powersave "
371     + "mode (ipm=%d), forcing hardreset\n", ipm);
372     + ehc->i.action |= ATA_EH_HARDRESET;
373     + }
374     + }
375     +
376     /* if we're about to do hardreset, nothing more to do */
377     if (ehc->i.action & ATA_EH_HARDRESET)
378     return 0;
379     diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
380     index 35a26a3..99aa5f5 100644
381     --- a/drivers/cpufreq/cpufreq.c
382     +++ b/drivers/cpufreq/cpufreq.c
383     @@ -607,7 +607,7 @@ static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy,
384     unsigned int freq = 0;
385     unsigned int ret;
386    
387     - if (!policy->governor->store_setspeed)
388     + if (!policy->governor || !policy->governor->store_setspeed)
389     return -EINVAL;
390    
391     ret = sscanf(buf, "%u", &freq);
392     @@ -621,7 +621,7 @@ static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy,
393    
394     static ssize_t show_scaling_setspeed(struct cpufreq_policy *policy, char *buf)
395     {
396     - if (!policy->governor->show_setspeed)
397     + if (!policy->governor || !policy->governor->show_setspeed)
398     return sprintf(buf, "<unsupported>\n");
399    
400     return policy->governor->show_setspeed(policy, buf);
401     diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
402     index c3eb3f1..452b94d 100644
403     --- a/drivers/hid/hid-input.c
404     +++ b/drivers/hid/hid-input.c
405     @@ -218,8 +218,9 @@ int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
406     }
407     }
408    
409     - if (test_bit(usage->code, hid->pb_pressed_numlock) ||
410     - test_bit(LED_NUML, input->led)) {
411     + if (hid->quirks & HID_QUIRK_APPLE_NUMLOCK_EMULATION && (
412     + test_bit(usage->code, hid->pb_pressed_numlock) ||
413     + test_bit(LED_NUML, input->led))) {
414     trans = find_translation(powerbook_numlock_keys, usage->code);
415    
416     if (trans) {
417     diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
418     index e29a057..7fbe08c 100644
419     --- a/drivers/hid/usbhid/hid-quirks.c
420     +++ b/drivers/hid/usbhid/hid-quirks.c
421     @@ -613,28 +613,28 @@ static const struct hid_blacklist {
422    
423     { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
424    
425     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
426     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
427     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
428     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
429     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
430     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
431     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
432     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
433     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
434     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
435     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
436     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
437     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
438     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
439     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
440     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
441     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
442     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
443     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
444     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
445     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
446     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
447     { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN },
448     { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
449     { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN },
450     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
451     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
452     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
453     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_HAS_FN },
454     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
455     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_HAS_FN },
456     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
457     - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
458     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
459     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
460     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
461     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN },
462     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
463     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN },
464     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
465     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
466    
467     { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS },
468     { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS },
469     diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
470     index 3dac920..43c9f8d 100644
471     --- a/drivers/i2c/busses/i2c-nforce2.c
472     +++ b/drivers/i2c/busses/i2c-nforce2.c
473     @@ -50,6 +50,7 @@
474     #include <linux/init.h>
475     #include <linux/i2c.h>
476     #include <linux/delay.h>
477     +#include <linux/dmi.h>
478     #include <asm/io.h>
479    
480     MODULE_LICENSE("GPL");
481     @@ -109,6 +110,18 @@ struct nforce2_smbus {
482     /* Misc definitions */
483     #define MAX_TIMEOUT 100
484    
485     +/* We disable the second SMBus channel on these boards */
486     +static struct dmi_system_id __devinitdata nforce2_dmi_blacklist2[] = {
487     + {
488     + .ident = "DFI Lanparty NF4 Expert",
489     + .matches = {
490     + DMI_MATCH(DMI_BOARD_VENDOR, "DFI Corp,LTD"),
491     + DMI_MATCH(DMI_BOARD_NAME, "LP UT NF4 Expert"),
492     + },
493     + },
494     + { }
495     +};
496     +
497     static struct pci_driver nforce2_driver;
498    
499     static void nforce2_abort(struct i2c_adapter *adap)
500     @@ -367,10 +380,17 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_
501     smbuses[0].base = 0; /* to have a check value */
502     }
503     /* SMBus adapter 2 */
504     - res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], "SMB2");
505     - if (res2 < 0) {
506     - dev_err(&dev->dev, "Error probing SMB2.\n");
507     - smbuses[1].base = 0; /* to have a check value */
508     + if (dmi_check_system(nforce2_dmi_blacklist2)) {
509     + dev_err(&dev->dev, "Disabling SMB2 for safety reasons.\n");
510     + res2 = -EPERM;
511     + smbuses[1].base = 0;
512     + } else {
513     + res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1],
514     + "SMB2");
515     + if (res2 < 0) {
516     + dev_err(&dev->dev, "Error probing SMB2.\n");
517     + smbuses[1].base = 0; /* to have a check value */
518     + }
519     }
520     if ((res1 < 0) && (res2 < 0)) {
521     /* we did not find even one of the SMBuses, so we give up */
522     diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c
523     index fb7ea56..cf507b3 100644
524     --- a/drivers/i2c/chips/max6875.c
525     +++ b/drivers/i2c/chips/max6875.c
526     @@ -207,9 +207,6 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind)
527     fake_client->flags = 0;
528     strlcpy(fake_client->name, "max6875 subclient", I2C_NAME_SIZE);
529    
530     - /* Prevent 24RF08 corruption (in case of user error) */
531     - i2c_smbus_write_quick(real_client, 0);
532     -
533     if ((err = i2c_attach_client(real_client)) != 0)
534     goto exit_kfree2;
535    
536     diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
537     index 31a53c5..ae7e6e7 100644
538     --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
539     +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
540     @@ -194,7 +194,13 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
541     /* Set the cached Q_Key before we attach if it's the broadcast group */
542     if (!memcmp(mcast->mcmember.mgid.raw, priv->dev->broadcast + 4,
543     sizeof (union ib_gid))) {
544     + spin_lock_irq(&priv->lock);
545     + if (!priv->broadcast) {
546     + spin_unlock_irq(&priv->lock);
547     + return -EAGAIN;
548     + }
549     priv->qkey = be32_to_cpu(priv->broadcast->mcmember.qkey);
550     + spin_unlock_irq(&priv->lock);
551     priv->tx_wr.wr.ud.remote_qkey = priv->qkey;
552     }
553    
554     diff --git a/drivers/md/md.c b/drivers/md/md.c
555     index 9f6d228..ba34990 100644
556     --- a/drivers/md/md.c
557     +++ b/drivers/md/md.c
558     @@ -274,6 +274,7 @@ static mddev_t * mddev_find(dev_t unit)
559     atomic_set(&new->active, 1);
560     spin_lock_init(&new->write_lock);
561     init_waitqueue_head(&new->sb_wait);
562     + init_waitqueue_head(&new->recovery_wait);
563     new->reshape_position = MaxSector;
564     new->resync_max = MaxSector;
565    
566     @@ -5559,7 +5560,6 @@ void md_do_sync(mddev_t *mddev)
567     window/2,(unsigned long long) max_sectors/2);
568    
569     atomic_set(&mddev->recovery_active, 0);
570     - init_waitqueue_head(&mddev->recovery_wait);
571     last_check = 0;
572    
573     if (j>2) {
574     diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
575     index 18a1379..705fe47 100644
576     --- a/drivers/md/raid5.c
577     +++ b/drivers/md/raid5.c
578     @@ -1984,6 +1984,7 @@ static int __handle_issuing_new_read_requests5(struct stripe_head *sh,
579     * have quiesced.
580     */
581     if ((s->uptodate == disks - 1) &&
582     + (s->failed && disk_idx == s->failed_num) &&
583     !test_bit(STRIPE_OP_CHECK, &sh->ops.pending)) {
584     set_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending);
585     set_bit(R5_Wantcompute, &dev->flags);
586     @@ -2069,7 +2070,9 @@ static void handle_issuing_new_read_requests6(struct stripe_head *sh,
587     /* we would like to get this block, possibly
588     * by computing it, but we might not be able to
589     */
590     - if (s->uptodate == disks-1) {
591     + if ((s->uptodate == disks - 1) &&
592     + (s->failed && (i == r6s->failed_num[0] ||
593     + i == r6s->failed_num[1]))) {
594     pr_debug("Computing stripe %llu block %d\n",
595     (unsigned long long)sh->sector, i);
596     compute_block_1(sh, i, 0);
597     @@ -2618,6 +2621,7 @@ static void handle_stripe5(struct stripe_head *sh)
598     struct stripe_head_state s;
599     struct r5dev *dev;
600     unsigned long pending = 0;
601     + int prexor;
602    
603     memset(&s, 0, sizeof(s));
604     pr_debug("handling stripe %llu, state=%#lx cnt=%d, pd_idx=%d "
605     @@ -2737,9 +2741,11 @@ static void handle_stripe5(struct stripe_head *sh)
606     /* leave prexor set until postxor is done, allows us to distinguish
607     * a rmw from a rcw during biodrain
608     */
609     + prexor = 0;
610     if (test_bit(STRIPE_OP_PREXOR, &sh->ops.complete) &&
611     test_bit(STRIPE_OP_POSTXOR, &sh->ops.complete)) {
612    
613     + prexor = 1;
614     clear_bit(STRIPE_OP_PREXOR, &sh->ops.complete);
615     clear_bit(STRIPE_OP_PREXOR, &sh->ops.ack);
616     clear_bit(STRIPE_OP_PREXOR, &sh->ops.pending);
617     @@ -2773,6 +2779,8 @@ static void handle_stripe5(struct stripe_head *sh)
618     if (!test_and_set_bit(
619     STRIPE_OP_IO, &sh->ops.pending))
620     sh->ops.count++;
621     + if (prexor)
622     + continue;
623     if (!test_bit(R5_Insync, &dev->flags) ||
624     (i == sh->pd_idx && s.failed == 0))
625     set_bit(STRIPE_INSYNC, &sh->state);
626     diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
627     index 129b8b3..68be4e1 100644
628     --- a/drivers/net/atl1/atl1_main.c
629     +++ b/drivers/net/atl1/atl1_main.c
630     @@ -1334,6 +1334,7 @@ rrd_ok:
631     /* Good Receive */
632     pci_unmap_page(adapter->pdev, buffer_info->dma,
633     buffer_info->length, PCI_DMA_FROMDEVICE);
634     + buffer_info->dma = 0;
635     skb = buffer_info->skb;
636     length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size);
637    
638     diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
639     index c16de51..42daf85 100644
640     --- a/drivers/net/ps3_gelic_wireless.c
641     +++ b/drivers/net/ps3_gelic_wireless.c
642     @@ -2474,6 +2474,8 @@ static void gelic_wl_free(struct gelic_wl_info *wl)
643    
644     pr_debug("%s: <-\n", __func__);
645    
646     + free_page((unsigned long)wl->buf);
647     +
648     pr_debug("%s: destroy queues\n", __func__);
649     destroy_workqueue(wl->eurus_cmd_queue);
650     destroy_workqueue(wl->event_queue);
651     diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
652     index 0147ea3..d8160fa 100644
653     --- a/drivers/usb/class/cdc-acm.c
654     +++ b/drivers/usb/class/cdc-acm.c
655     @@ -1242,6 +1242,9 @@ static struct usb_device_id acm_ids[] = {
656     { USB_DEVICE(0x22b8, 0x7000), /* Motorola Q Phone */
657     .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
658     },
659     + { USB_DEVICE(0x0803, 0x3095), /* Zoom Telephonics Model 3095F USB MODEM */
660     + .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
661     + },
662    
663     /* control interfaces with various AT-command sets */
664     { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
665     diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
666     index 611bc9f..d05375d 100644
667     --- a/drivers/usb/host/ohci-omap.c
668     +++ b/drivers/usb/host/ohci-omap.c
669     @@ -511,7 +511,8 @@ static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message)
670    
671     static int ohci_omap_resume(struct platform_device *dev)
672     {
673     - struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev));
674     + struct usb_hcd *hcd = platform_get_drvdata(dev);
675     + struct ohci_hcd *ohci = hcd_to_ohci(hcd);
676    
677     if (time_before(jiffies, ohci->next_statechange))
678     msleep(5);
679     diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
680     index c852f03..dd1a067 100644
681     --- a/drivers/usb/host/ohci-sm501.c
682     +++ b/drivers/usb/host/ohci-sm501.c
683     @@ -231,7 +231,8 @@ static int ohci_sm501_suspend(struct platform_device *pdev, pm_message_t msg)
684     static int ohci_sm501_resume(struct platform_device *pdev)
685     {
686     struct device *dev = &pdev->dev;
687     - struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(pdev));
688     + struct usb_hcd *hcd = platform_get_drvdata(pdev);
689     + struct ohci_hcd *ohci = hcd_to_ohci(hcd);
690    
691     if (time_before(jiffies, ohci->next_statechange))
692     msleep(5);
693     diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
694     index c730d20..7eb5f30 100644
695     --- a/drivers/usb/misc/ldusb.c
696     +++ b/drivers/usb/misc/ldusb.c
697     @@ -63,9 +63,6 @@
698     #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004
699     #define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006
700    
701     -#define USB_VENDOR_ID_MICROCHIP 0x04d8
702     -#define USB_DEVICE_ID_PICDEM 0x000c
703     -
704     #ifdef CONFIG_USB_DYNAMIC_MINORS
705     #define USB_LD_MINOR_BASE 0
706     #else
707     @@ -92,7 +89,6 @@ static struct usb_device_id ld_usb_table [] = {
708     { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) },
709     { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) },
710     { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) },
711     - { USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICDEM) },
712     { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) },
713     { } /* Terminating entry */
714     };
715     diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
716     index 3abb3c8..af2bd47 100644
717     --- a/drivers/usb/serial/ftdi_sio.c
718     +++ b/drivers/usb/serial/ftdi_sio.c
719     @@ -366,6 +366,7 @@ static struct usb_device_id id_table_combined [] = {
720     .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
721     { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID),
722     .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
723     + { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
724     { }, /* Optional parameter entry */
725     { } /* Terminating entry */
726     };
727     diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
728     index 6da539e..0e1c569 100644
729     --- a/drivers/usb/serial/ftdi_sio.h
730     +++ b/drivers/usb/serial/ftdi_sio.h
731     @@ -581,6 +581,12 @@
732     #define FIC_NEO1973_DEBUG_PID 0x5118
733    
734     /*
735     + * RATOC REX-USB60F
736     + */
737     +#define RATOC_VENDOR_ID 0x0584
738     +#define RATOC_PRODUCT_ID_USB60F 0xb020
739     +
740     +/*
741     * BmRequestType: 1100 0000b
742     * bRequest: FTDI_E2_READ
743     * wValue: 0
744     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
745     index d101025..4d7f357 100644
746     --- a/drivers/usb/serial/option.c
747     +++ b/drivers/usb/serial/option.c
748     @@ -154,8 +154,6 @@ static int option_send_setup(struct usb_serial_port *port);
749     #define NOVATELWIRELESS_PRODUCT_MC727 0x4100
750     #define NOVATELWIRELESS_PRODUCT_MC950D 0x4400
751    
752     -#define NOVATELWIRELESS_PRODUCT_U727 0x5010
753     -
754     /* FUTURE NOVATEL PRODUCTS */
755     #define NOVATELWIRELESS_PRODUCT_EVDO_1 0x6000
756     #define NOVATELWIRELESS_PRODUCT_HSPA_1 0x7000
757     @@ -195,6 +193,9 @@ static int option_send_setup(struct usb_serial_port *port);
758    
759     #define MAXON_VENDOR_ID 0x16d8
760    
761     +#define TELIT_VENDOR_ID 0x1bc7
762     +#define TELIT_PRODUCT_UC864E 0x1003
763     +
764     static struct usb_device_id option_ids[] = {
765     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
766     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
767     @@ -269,7 +270,6 @@ static struct usb_device_id option_ids[] = {
768     { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, /* Novatel EU850D/EU860D/EU870D */
769     { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, /* Novatel MC930D/MC950D */
770     { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */
771     - { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U727) }, /* Novatel U727 */
772     { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_1) }, /* Novatel EVDO product */
773     { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_1) }, /* Novatel HSPA product */
774     { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_1) }, /* Novatel Embedded product */
775     @@ -293,6 +293,7 @@ static struct usb_device_id option_ids[] = {
776     { USB_DEVICE(DELL_VENDOR_ID, 0x8133) }, /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */
777     { USB_DEVICE(DELL_VENDOR_ID, 0x8136) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */
778     { USB_DEVICE(DELL_VENDOR_ID, 0x8137) }, /* Dell Wireless HSDPA 5520 */
779     + { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */
780     { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) },
781     { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
782     { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) },
783     @@ -301,6 +302,8 @@ static struct usb_device_id option_ids[] = {
784     { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) },
785     { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
786     { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */
787     + { USB_DEVICE(0x19d2, 0x0001) }, /* Telstra NextG CDMA */
788     + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) },
789     { } /* Terminating entry */
790     };
791     MODULE_DEVICE_TABLE(usb, option_ids);
792     diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
793     index 2af7785..4c1a70a 100644
794     --- a/drivers/usb/serial/pl2303.c
795     +++ b/drivers/usb/serial/pl2303.c
796     @@ -66,7 +66,6 @@ static struct usb_device_id id_table [] = {
797     { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID_2080) },
798     { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) },
799     { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) },
800     - { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
801     { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) },
802     { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) },
803     { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) },
804     diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
805     index 10cf872..3bdefe0 100644
806     --- a/drivers/usb/serial/pl2303.h
807     +++ b/drivers/usb/serial/pl2303.h
808     @@ -36,7 +36,6 @@
809    
810     #define RATOC_VENDOR_ID 0x0584
811     #define RATOC_PRODUCT_ID 0xb000
812     -#define RATOC_PRODUCT_ID_USB60F 0xb020
813    
814     #define TRIPP_VENDOR_ID 0x2478
815     #define TRIPP_PRODUCT_ID 0x2008
816     diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
817     index 9125207..f1d14c9 100644
818     --- a/drivers/usb/storage/unusual_devs.h
819     +++ b/drivers/usb/storage/unusual_devs.h
820     @@ -1285,6 +1285,16 @@ UNUSUAL_DEV( 0x0ace, 0x20ff, 0x0101, 0x0101,
821     US_SC_DEVICE, US_PR_DEVICE, NULL,
822     US_FL_IGNORE_DEVICE ),
823    
824     +/* Reported by F. Aben <f.aben@option.com>
825     + * This device (wrongly) has a vendor-specific device descriptor.
826     + * The entry is needed so usb-storage can bind to it's mass-storage
827     + * interface as an interface driver */
828     +UNUSUAL_DEV( 0x0af0, 0x7401, 0x0000, 0x0000,
829     + "Option",
830     + "GI 0401 SD-Card",
831     + US_SC_DEVICE, US_PR_DEVICE, NULL,
832     + 0 ),
833     +
834     #ifdef CONFIG_USB_STORAGE_ISD200
835     UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110,
836     "ATI",
837     diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
838     index bc673c8..e1031b9 100644
839     --- a/fs/cifs/inode.c
840     +++ b/fs/cifs/inode.c
841     @@ -161,12 +161,14 @@ static void cifs_unix_info_to_inode(struct inode *inode,
842     spin_unlock(&inode->i_lock);
843     }
844    
845     -static const unsigned char *cifs_get_search_path(struct cifsTconInfo *pTcon,
846     - const char *search_path)
847     +static const unsigned char *cifs_get_search_path(struct cifs_sb_info *cifs_sb,
848     + const char *search_path)
849     {
850     int tree_len;
851     int path_len;
852     + int i;
853     char *tmp_path;
854     + struct cifsTconInfo *pTcon = cifs_sb->tcon;
855    
856     if (!(pTcon->Flags & SMB_SHARE_IS_IN_DFS))
857     return search_path;
858     @@ -180,6 +182,11 @@ static const unsigned char *cifs_get_search_path(struct cifsTconInfo *pTcon,
859     return search_path;
860    
861     strncpy(tmp_path, pTcon->treeName, tree_len);
862     + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
863     + for (i = 0; i < tree_len; i++) {
864     + if (tmp_path[i] == '\\')
865     + tmp_path[i] = '/';
866     + }
867     strncpy(tmp_path+tree_len, search_path, path_len);
868     tmp_path[tree_len+path_len] = 0;
869     return tmp_path;
870     @@ -199,7 +206,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
871     pTcon = cifs_sb->tcon;
872     cFYI(1, ("Getting info on %s", search_path));
873    
874     - full_path = cifs_get_search_path(pTcon, search_path);
875     + full_path = cifs_get_search_path(cifs_sb, search_path);
876    
877     try_again_CIFSSMBUnixQPathInfo:
878     /* could have done a find first instead but this returns more info */
879     @@ -402,7 +409,7 @@ int cifs_get_inode_info(struct inode **pinode,
880     return -ENOMEM;
881     pfindData = (FILE_ALL_INFO *)buf;
882    
883     - full_path = cifs_get_search_path(pTcon, search_path);
884     + full_path = cifs_get_search_path(cifs_sb, search_path);
885    
886     try_again_CIFSSMBQPathInfo:
887     /* could do find first instead but this returns more info */
888     diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
889     index 5007f78..7c607af 100644
890     --- a/fs/ecryptfs/ecryptfs_kernel.h
891     +++ b/fs/ecryptfs/ecryptfs_kernel.h
892     @@ -626,8 +626,6 @@ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm,
893     int ecryptfs_keyring_auth_tok_for_sig(struct key **auth_tok_key,
894     struct ecryptfs_auth_tok **auth_tok,
895     char *sig);
896     -int ecryptfs_write_zeros(struct file *file, pgoff_t index, int start,
897     - int num_zeros);
898     int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data,
899     loff_t offset, size_t size);
900     int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode,
901     diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c
902     index 0c49286..7cafdbc 100644
903     --- a/fs/ecryptfs/read_write.c
904     +++ b/fs/ecryptfs/read_write.c
905     @@ -157,20 +157,6 @@ int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset,
906     ecryptfs_page_idx, rc);
907     goto out;
908     }
909     - if (start_offset_in_page) {
910     - /* Read in the page from the lower
911     - * into the eCryptfs inode page cache,
912     - * decrypting */
913     - rc = ecryptfs_decrypt_page(ecryptfs_page);
914     - if (rc) {
915     - printk(KERN_ERR "%s: Error decrypting "
916     - "page; rc = [%d]\n",
917     - __FUNCTION__, rc);
918     - ClearPageUptodate(ecryptfs_page);
919     - page_cache_release(ecryptfs_page);
920     - goto out;
921     - }
922     - }
923     ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0);
924    
925     /*
926     @@ -349,14 +335,6 @@ int ecryptfs_read(char *data, loff_t offset, size_t size,
927     ecryptfs_page_idx, rc);
928     goto out;
929     }
930     - rc = ecryptfs_decrypt_page(ecryptfs_page);
931     - if (rc) {
932     - printk(KERN_ERR "%s: Error decrypting "
933     - "page; rc = [%d]\n", __FUNCTION__, rc);
934     - ClearPageUptodate(ecryptfs_page);
935     - page_cache_release(ecryptfs_page);
936     - goto out;
937     - }
938     ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0);
939     memcpy((data + data_offset),
940     ((char *)ecryptfs_page_virt + start_offset_in_page),
941     diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
942     index 4285654..84119af 100644
943     --- a/fs/ext3/xattr.c
944     +++ b/fs/ext3/xattr.c
945     @@ -1000,6 +1000,11 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
946     i.value = NULL;
947     error = ext3_xattr_block_set(handle, inode, &i, &bs);
948     } else if (error == -ENOSPC) {
949     + if (EXT3_I(inode)->i_file_acl && !bs.s.base) {
950     + error = ext3_xattr_block_find(inode, &i, &bs);
951     + if (error)
952     + goto cleanup;
953     + }
954     error = ext3_xattr_block_set(handle, inode, &i, &bs);
955     if (error)
956     goto cleanup;
957     diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
958     index e9054c1..70d856b 100644
959     --- a/fs/ext4/xattr.c
960     +++ b/fs/ext4/xattr.c
961     @@ -1011,6 +1011,11 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
962     i.value = NULL;
963     error = ext4_xattr_block_set(handle, inode, &i, &bs);
964     } else if (error == -ENOSPC) {
965     + if (EXT4_I(inode)->i_file_acl && !bs.s.base) {
966     + error = ext4_xattr_block_find(inode, &i, &bs);
967     + if (error)
968     + goto cleanup;
969     + }
970     error = ext4_xattr_block_set(handle, inode, &i, &bs);
971     if (error)
972     goto cleanup;
973     diff --git a/fs/proc/array.c b/fs/proc/array.c
974     index 07d6c48..6b1c67a 100644
975     --- a/fs/proc/array.c
976     +++ b/fs/proc/array.c
977     @@ -287,7 +287,7 @@ static void render_cap_t(struct seq_file *m, const char *header,
978     seq_printf(m, "%s", header);
979     CAP_FOR_EACH_U32(__capi) {
980     seq_printf(m, "%08x",
981     - a->cap[(_LINUX_CAPABILITY_U32S-1) - __capi]);
982     + a->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]);
983     }
984     seq_printf(m, "\n");
985     }
986     diff --git a/fs/proc/base.c b/fs/proc/base.c
987     index 81d7d14..d6f21bd 100644
988     --- a/fs/proc/base.c
989     +++ b/fs/proc/base.c
990     @@ -126,6 +126,25 @@ struct pid_entry {
991     NULL, &proc_single_file_operations, \
992     { .proc_show = &proc_##OTYPE } )
993    
994     +/*
995     + * Count the number of hardlinks for the pid_entry table, excluding the .
996     + * and .. links.
997     + */
998     +static unsigned int pid_entry_count_dirs(const struct pid_entry *entries,
999     + unsigned int n)
1000     +{
1001     + unsigned int i;
1002     + unsigned int count;
1003     +
1004     + count = 0;
1005     + for (i = 0; i < n; ++i) {
1006     + if (S_ISDIR(entries[i].mode))
1007     + ++count;
1008     + }
1009     +
1010     + return count;
1011     +}
1012     +
1013     int maps_protect;
1014     EXPORT_SYMBOL(maps_protect);
1015    
1016     @@ -2483,10 +2502,9 @@ static struct dentry *proc_pid_instantiate(struct inode *dir,
1017     inode->i_op = &proc_tgid_base_inode_operations;
1018     inode->i_fop = &proc_tgid_base_operations;
1019     inode->i_flags|=S_IMMUTABLE;
1020     - inode->i_nlink = 5;
1021     -#ifdef CONFIG_SECURITY
1022     - inode->i_nlink += 1;
1023     -#endif
1024     +
1025     + inode->i_nlink = 2 + pid_entry_count_dirs(tgid_base_stuff,
1026     + ARRAY_SIZE(tgid_base_stuff));
1027    
1028     dentry->d_op = &pid_dentry_operations;
1029    
1030     @@ -2713,10 +2731,9 @@ static struct dentry *proc_task_instantiate(struct inode *dir,
1031     inode->i_op = &proc_tid_base_inode_operations;
1032     inode->i_fop = &proc_tid_base_operations;
1033     inode->i_flags|=S_IMMUTABLE;
1034     - inode->i_nlink = 4;
1035     -#ifdef CONFIG_SECURITY
1036     - inode->i_nlink += 1;
1037     -#endif
1038     +
1039     + inode->i_nlink = 2 + pid_entry_count_dirs(tid_base_stuff,
1040     + ARRAY_SIZE(tid_base_stuff));
1041    
1042     dentry->d_op = &pid_dentry_operations;
1043    
1044     diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
1045     index 9dfb5ff..dca9b46 100644
1046     --- a/fs/proc/task_mmu.c
1047     +++ b/fs/proc/task_mmu.c
1048     @@ -524,7 +524,7 @@ const struct file_operations proc_clear_refs_operations = {
1049     };
1050    
1051     struct pagemapread {
1052     - char __user *out, *end;
1053     + u64 __user *out, *end;
1054     };
1055    
1056     #define PM_ENTRY_BYTES sizeof(u64)
1057     @@ -547,21 +547,11 @@ struct pagemapread {
1058     static int add_to_pagemap(unsigned long addr, u64 pfn,
1059     struct pagemapread *pm)
1060     {
1061     - /*
1062     - * Make sure there's room in the buffer for an
1063     - * entire entry. Otherwise, only copy part of
1064     - * the pfn.
1065     - */
1066     - if (pm->out + PM_ENTRY_BYTES >= pm->end) {
1067     - if (copy_to_user(pm->out, &pfn, pm->end - pm->out))
1068     - return -EFAULT;
1069     - pm->out = pm->end;
1070     - return PM_END_OF_BUFFER;
1071     - }
1072     -
1073     if (put_user(pfn, pm->out))
1074     return -EFAULT;
1075     - pm->out += PM_ENTRY_BYTES;
1076     + pm->out++;
1077     + if (pm->out >= pm->end)
1078     + return PM_END_OF_BUFFER;
1079     return 0;
1080     }
1081    
1082     @@ -662,7 +652,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
1083    
1084     ret = -EINVAL;
1085     /* file position must be aligned */
1086     - if (*ppos % PM_ENTRY_BYTES)
1087     + if ((*ppos % PM_ENTRY_BYTES) || (count % PM_ENTRY_BYTES))
1088     goto out_task;
1089    
1090     ret = 0;
1091     @@ -692,8 +682,8 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
1092     goto out_pages;
1093     }
1094    
1095     - pm.out = buf;
1096     - pm.end = buf + count;
1097     + pm.out = (u64 *)buf;
1098     + pm.end = (u64 *)(buf + count);
1099    
1100     if (!ptrace_may_attach(task)) {
1101     ret = -EIO;
1102     @@ -718,9 +708,9 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
1103     if (ret == PM_END_OF_BUFFER)
1104     ret = 0;
1105     /* don't need mmap_sem for these, but this looks cleaner */
1106     - *ppos += pm.out - buf;
1107     + *ppos += (char *)pm.out - buf;
1108     if (!ret)
1109     - ret = pm.out - buf;
1110     + ret = (char *)pm.out - buf;
1111     }
1112    
1113     out_pages:
1114     diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
1115     index e347bfd..9831c90 100644
1116     --- a/fs/xfs/linux-2.6/xfs_buf.c
1117     +++ b/fs/xfs/linux-2.6/xfs_buf.c
1118     @@ -387,6 +387,8 @@ _xfs_buf_lookup_pages(
1119     if (unlikely(page == NULL)) {
1120     if (flags & XBF_READ_AHEAD) {
1121     bp->b_page_count = i;
1122     + for (i = 0; i < bp->b_page_count; i++)
1123     + unlock_page(bp->b_pages[i]);
1124     return -ENOMEM;
1125     }
1126    
1127     @@ -416,17 +418,24 @@ _xfs_buf_lookup_pages(
1128     ASSERT(!PagePrivate(page));
1129     if (!PageUptodate(page)) {
1130     page_count--;
1131     - if (blocksize < PAGE_CACHE_SIZE && !PagePrivate(page)) {
1132     + if (blocksize >= PAGE_CACHE_SIZE) {
1133     + if (flags & XBF_READ)
1134     + bp->b_flags |= _XBF_PAGE_LOCKED;
1135     + } else if (!PagePrivate(page)) {
1136     if (test_page_region(page, offset, nbytes))
1137     page_count++;
1138     }
1139     }
1140    
1141     - unlock_page(page);
1142     bp->b_pages[i] = page;
1143     offset = 0;
1144     }
1145    
1146     + if (!(bp->b_flags & _XBF_PAGE_LOCKED)) {
1147     + for (i = 0; i < bp->b_page_count; i++)
1148     + unlock_page(bp->b_pages[i]);
1149     + }
1150     +
1151     if (page_count == bp->b_page_count)
1152     bp->b_flags |= XBF_DONE;
1153    
1154     @@ -746,6 +755,7 @@ xfs_buf_associate_memory(
1155     bp->b_count_desired = len;
1156     bp->b_buffer_length = buflen;
1157     bp->b_flags |= XBF_MAPPED;
1158     + bp->b_flags &= ~_XBF_PAGE_LOCKED;
1159    
1160     return 0;
1161     }
1162     @@ -1093,8 +1103,10 @@ _xfs_buf_ioend(
1163     xfs_buf_t *bp,
1164     int schedule)
1165     {
1166     - if (atomic_dec_and_test(&bp->b_io_remaining) == 1)
1167     + if (atomic_dec_and_test(&bp->b_io_remaining) == 1) {
1168     + bp->b_flags &= ~_XBF_PAGE_LOCKED;
1169     xfs_buf_ioend(bp, schedule);
1170     + }
1171     }
1172    
1173     STATIC void
1174     @@ -1125,6 +1137,9 @@ xfs_buf_bio_end_io(
1175    
1176     if (--bvec >= bio->bi_io_vec)
1177     prefetchw(&bvec->bv_page->flags);
1178     +
1179     + if (bp->b_flags & _XBF_PAGE_LOCKED)
1180     + unlock_page(page);
1181     } while (bvec >= bio->bi_io_vec);
1182    
1183     _xfs_buf_ioend(bp, 1);
1184     @@ -1163,7 +1178,8 @@ _xfs_buf_ioapply(
1185     * filesystem block size is not smaller than the page size.
1186     */
1187     if ((bp->b_buffer_length < PAGE_CACHE_SIZE) &&
1188     - (bp->b_flags & XBF_READ) &&
1189     + ((bp->b_flags & (XBF_READ|_XBF_PAGE_LOCKED)) ==
1190     + (XBF_READ|_XBF_PAGE_LOCKED)) &&
1191     (blocksize >= PAGE_CACHE_SIZE)) {
1192     bio = bio_alloc(GFP_NOIO, 1);
1193    
1194     diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
1195     index a3d207d..441f7c3 100644
1196     --- a/fs/xfs/linux-2.6/xfs_buf.h
1197     +++ b/fs/xfs/linux-2.6/xfs_buf.h
1198     @@ -66,6 +66,25 @@ typedef enum {
1199     _XBF_PAGES = (1 << 18), /* backed by refcounted pages */
1200     _XBF_RUN_QUEUES = (1 << 19),/* run block device task queue */
1201     _XBF_DELWRI_Q = (1 << 21), /* buffer on delwri queue */
1202     +
1203     + /*
1204     + * Special flag for supporting metadata blocks smaller than a FSB.
1205     + *
1206     + * In this case we can have multiple xfs_buf_t on a single page and
1207     + * need to lock out concurrent xfs_buf_t readers as they only
1208     + * serialise access to the buffer.
1209     + *
1210     + * If the FSB size >= PAGE_CACHE_SIZE case, we have no serialisation
1211     + * between reads of the page. Hence we can have one thread read the
1212     + * page and modify it, but then race with another thread that thinks
1213     + * the page is not up-to-date and hence reads it again.
1214     + *
1215     + * The result is that the first modifcation to the page is lost.
1216     + * This sort of AGF/AGI reading race can happen when unlinking inodes
1217     + * that require truncation and results in the AGI unlinked list
1218     + * modifications being lost.
1219     + */
1220     + _XBF_PAGE_LOCKED = (1 << 22),
1221     } xfs_buf_flags_t;
1222    
1223     typedef enum {
1224     diff --git a/include/asm-x86/tlbflush.h b/include/asm-x86/tlbflush.h
1225     index 3998709..b7a6a08 100644
1226     --- a/include/asm-x86/tlbflush.h
1227     +++ b/include/asm-x86/tlbflush.h
1228     @@ -22,12 +22,23 @@ static inline void __native_flush_tlb(void)
1229    
1230     static inline void __native_flush_tlb_global(void)
1231     {
1232     - unsigned long cr4 = read_cr4();
1233     + unsigned long flags;
1234     + unsigned long cr4;
1235    
1236     + /*
1237     + * Read-modify-write to CR4 - protect it from preemption and
1238     + * from interrupts. (Use the raw variant because this code can
1239     + * be called from deep inside debugging code.)
1240     + */
1241     + raw_local_irq_save(flags);
1242     +
1243     + cr4 = read_cr4();
1244     /* clear PGE */
1245     write_cr4(cr4 & ~X86_CR4_PGE);
1246     /* write old PGE again and flush TLBs */
1247     write_cr4(cr4);
1248     +
1249     + raw_local_irq_restore(flags);
1250     }
1251    
1252     static inline void __native_flush_tlb_single(unsigned long addr)
1253     diff --git a/include/linux/capability.h b/include/linux/capability.h
1254     index 7d50ff6..bb8d915 100644
1255     --- a/include/linux/capability.h
1256     +++ b/include/linux/capability.h
1257     @@ -31,11 +31,11 @@ struct task_struct;
1258     #define _LINUX_CAPABILITY_VERSION_1 0x19980330
1259     #define _LINUX_CAPABILITY_U32S_1 1
1260    
1261     -#define _LINUX_CAPABILITY_VERSION_2 0x20071026
1262     +#define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */
1263     #define _LINUX_CAPABILITY_U32S_2 2
1264    
1265     -#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_2
1266     -#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_2
1267     +#define _LINUX_CAPABILITY_VERSION_3 0x20080522
1268     +#define _LINUX_CAPABILITY_U32S_3 2
1269    
1270     typedef struct __user_cap_header_struct {
1271     __u32 version;
1272     @@ -77,10 +77,23 @@ struct vfs_cap_data {
1273     } data[VFS_CAP_U32];
1274     };
1275    
1276     -#ifdef __KERNEL__
1277     +#ifndef __KERNEL__
1278     +
1279     +/*
1280     + * Backwardly compatible definition for source code - trapped in a
1281     + * 32-bit world. If you find you need this, please consider using
1282     + * libcap to untrap yourself...
1283     + */
1284     +#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1
1285     +#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1
1286     +
1287     +#else
1288     +
1289     +#define _KERNEL_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3
1290     +#define _KERNEL_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_3
1291    
1292     typedef struct kernel_cap_struct {
1293     - __u32 cap[_LINUX_CAPABILITY_U32S];
1294     + __u32 cap[_KERNEL_CAPABILITY_U32S];
1295     } kernel_cap_t;
1296    
1297     #define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct))
1298     @@ -350,7 +363,7 @@ typedef struct kernel_cap_struct {
1299     */
1300    
1301     #define CAP_FOR_EACH_U32(__capi) \
1302     - for (__capi = 0; __capi < _LINUX_CAPABILITY_U32S; ++__capi)
1303     + for (__capi = 0; __capi < _KERNEL_CAPABILITY_U32S; ++__capi)
1304    
1305     # define CAP_FS_MASK_B0 (CAP_TO_MASK(CAP_CHOWN) \
1306     | CAP_TO_MASK(CAP_DAC_OVERRIDE) \
1307     @@ -360,7 +373,7 @@ typedef struct kernel_cap_struct {
1308    
1309     # define CAP_FS_MASK_B1 (CAP_TO_MASK(CAP_MAC_OVERRIDE))
1310    
1311     -#if _LINUX_CAPABILITY_U32S != 2
1312     +#if _KERNEL_CAPABILITY_U32S != 2
1313     # error Fix up hand-coded capability macro initializers
1314     #else /* HAND-CODED capability initializers */
1315    
1316     @@ -371,7 +384,7 @@ typedef struct kernel_cap_struct {
1317     # define CAP_NFSD_SET {{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \
1318     CAP_FS_MASK_B1 } }
1319    
1320     -#endif /* _LINUX_CAPABILITY_U32S != 2 */
1321     +#endif /* _KERNEL_CAPABILITY_U32S != 2 */
1322    
1323     #define CAP_INIT_INH_SET CAP_EMPTY_SET
1324    
1325     diff --git a/include/linux/hid.h b/include/linux/hid.h
1326     index 74ff575..02e70b7 100644
1327     --- a/include/linux/hid.h
1328     +++ b/include/linux/hid.h
1329     @@ -284,6 +284,7 @@ struct hid_item {
1330     #define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000
1331     #define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000
1332     #define HID_QUIRK_MICROSOFT_KEYS 0x08000000
1333     +#define HID_QUIRK_APPLE_NUMLOCK_EMULATION 0x10000000
1334    
1335     /*
1336     * Separate quirks for runtime report descriptor fixup
1337     diff --git a/include/linux/types.h b/include/linux/types.h
1338     index 9dc2346..d4a9ce6 100644
1339     --- a/include/linux/types.h
1340     +++ b/include/linux/types.h
1341     @@ -197,8 +197,6 @@ typedef u64 resource_size_t;
1342     typedef u32 resource_size_t;
1343     #endif
1344    
1345     -#endif /* __KERNEL__ */
1346     -
1347     struct ustat {
1348     __kernel_daddr_t f_tfree;
1349     __kernel_ino_t f_tinode;
1350     @@ -206,4 +204,6 @@ struct ustat {
1351     char f_fpack[6];
1352     };
1353    
1354     +#endif /* __KERNEL__ */
1355     +
1356     #endif /* _LINUX_TYPES_H */
1357     diff --git a/kernel/capability.c b/kernel/capability.c
1358     index 39e8193..cfbe442 100644
1359     --- a/kernel/capability.c
1360     +++ b/kernel/capability.c
1361     @@ -53,6 +53,69 @@ static void warn_legacy_capability_use(void)
1362     }
1363    
1364     /*
1365     + * Version 2 capabilities worked fine, but the linux/capability.h file
1366     + * that accompanied their introduction encouraged their use without
1367     + * the necessary user-space source code changes. As such, we have
1368     + * created a version 3 with equivalent functionality to version 2, but
1369     + * with a header change to protect legacy source code from using
1370     + * version 2 when it wanted to use version 1. If your system has code
1371     + * that trips the following warning, it is using version 2 specific
1372     + * capabilities and may be doing so insecurely.
1373     + *
1374     + * The remedy is to either upgrade your version of libcap (to 2.10+,
1375     + * if the application is linked against it), or recompile your
1376     + * application with modern kernel headers and this warning will go
1377     + * away.
1378     + */
1379     +
1380     +static void warn_deprecated_v2(void)
1381     +{
1382     + static int warned;
1383     +
1384     + if (!warned) {
1385     + char name[sizeof(current->comm)];
1386     +
1387     + printk(KERN_INFO "warning: `%s' uses deprecated v2"
1388     + " capabilities in a way that may be insecure.\n",
1389     + get_task_comm(name, current));
1390     + warned = 1;
1391     + }
1392     +}
1393     +
1394     +/*
1395     + * Version check. Return the number of u32s in each capability flag
1396     + * array, or a negative value on error.
1397     + */
1398     +static int cap_validate_magic(cap_user_header_t header, unsigned *tocopy)
1399     +{
1400     + __u32 version;
1401     +
1402     + if (get_user(version, &header->version))
1403     + return -EFAULT;
1404     +
1405     + switch (version) {
1406     + case _LINUX_CAPABILITY_VERSION_1:
1407     + warn_legacy_capability_use();
1408     + *tocopy = _LINUX_CAPABILITY_U32S_1;
1409     + break;
1410     + case _LINUX_CAPABILITY_VERSION_2:
1411     + warn_deprecated_v2();
1412     + /*
1413     + * fall through - v3 is otherwise equivalent to v2.
1414     + */
1415     + case _LINUX_CAPABILITY_VERSION_3:
1416     + *tocopy = _LINUX_CAPABILITY_U32S_3;
1417     + break;
1418     + default:
1419     + if (put_user((u32)_KERNEL_CAPABILITY_VERSION, &header->version))
1420     + return -EFAULT;
1421     + return -EINVAL;
1422     + }
1423     +
1424     + return 0;
1425     +}
1426     +
1427     +/*
1428     * For sys_getproccap() and sys_setproccap(), any of the three
1429     * capability set pointers may be NULL -- indicating that that set is
1430     * uninteresting and/or not to be changed.
1431     @@ -71,27 +134,13 @@ asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr)
1432     {
1433     int ret = 0;
1434     pid_t pid;
1435     - __u32 version;
1436     struct task_struct *target;
1437     unsigned tocopy;
1438     kernel_cap_t pE, pI, pP;
1439    
1440     - if (get_user(version, &header->version))
1441     - return -EFAULT;
1442     -
1443     - switch (version) {
1444     - case _LINUX_CAPABILITY_VERSION_1:
1445     - warn_legacy_capability_use();
1446     - tocopy = _LINUX_CAPABILITY_U32S_1;
1447     - break;
1448     - case _LINUX_CAPABILITY_VERSION_2:
1449     - tocopy = _LINUX_CAPABILITY_U32S_2;
1450     - break;
1451     - default:
1452     - if (put_user(_LINUX_CAPABILITY_VERSION, &header->version))
1453     - return -EFAULT;
1454     - return -EINVAL;
1455     - }
1456     + ret = cap_validate_magic(header, &tocopy);
1457     + if (ret != 0)
1458     + return ret;
1459    
1460     if (get_user(pid, &header->pid))
1461     return -EFAULT;
1462     @@ -118,7 +167,7 @@ out:
1463     spin_unlock(&task_capability_lock);
1464    
1465     if (!ret) {
1466     - struct __user_cap_data_struct kdata[_LINUX_CAPABILITY_U32S];
1467     + struct __user_cap_data_struct kdata[_KERNEL_CAPABILITY_U32S];
1468     unsigned i;
1469    
1470     for (i = 0; i < tocopy; i++) {
1471     @@ -128,7 +177,7 @@ out:
1472     }
1473    
1474     /*
1475     - * Note, in the case, tocopy < _LINUX_CAPABILITY_U32S,
1476     + * Note, in the case, tocopy < _KERNEL_CAPABILITY_U32S,
1477     * we silently drop the upper capabilities here. This
1478     * has the effect of making older libcap
1479     * implementations implicitly drop upper capability
1480     @@ -240,30 +289,16 @@ static inline int cap_set_all(kernel_cap_t *effective,
1481     */
1482     asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data)
1483     {
1484     - struct __user_cap_data_struct kdata[_LINUX_CAPABILITY_U32S];
1485     + struct __user_cap_data_struct kdata[_KERNEL_CAPABILITY_U32S];
1486     unsigned i, tocopy;
1487     kernel_cap_t inheritable, permitted, effective;
1488     - __u32 version;
1489     struct task_struct *target;
1490     int ret;
1491     pid_t pid;
1492    
1493     - if (get_user(version, &header->version))
1494     - return -EFAULT;
1495     -
1496     - switch (version) {
1497     - case _LINUX_CAPABILITY_VERSION_1:
1498     - warn_legacy_capability_use();
1499     - tocopy = _LINUX_CAPABILITY_U32S_1;
1500     - break;
1501     - case _LINUX_CAPABILITY_VERSION_2:
1502     - tocopy = _LINUX_CAPABILITY_U32S_2;
1503     - break;
1504     - default:
1505     - if (put_user(_LINUX_CAPABILITY_VERSION, &header->version))
1506     - return -EFAULT;
1507     - return -EINVAL;
1508     - }
1509     + ret = cap_validate_magic(header, &tocopy);
1510     + if (ret != 0)
1511     + return ret;
1512    
1513     if (get_user(pid, &header->pid))
1514     return -EFAULT;
1515     @@ -281,7 +316,7 @@ asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data)
1516     permitted.cap[i] = kdata[i].permitted;
1517     inheritable.cap[i] = kdata[i].inheritable;
1518     }
1519     - while (i < _LINUX_CAPABILITY_U32S) {
1520     + while (i < _KERNEL_CAPABILITY_U32S) {
1521     effective.cap[i] = 0;
1522     permitted.cap[i] = 0;
1523     inheritable.cap[i] = 0;
1524     diff --git a/kernel/cgroup.c b/kernel/cgroup.c
1525     index 6d8de05..4484139 100644
1526     --- a/kernel/cgroup.c
1527     +++ b/kernel/cgroup.c
1528     @@ -2808,7 +2808,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys)
1529     cg = tsk->cgroups;
1530     parent = task_cgroup(tsk, subsys->subsys_id);
1531    
1532     - snprintf(nodename, MAX_CGROUP_TYPE_NAMELEN, "node_%d", tsk->pid);
1533     + snprintf(nodename, MAX_CGROUP_TYPE_NAMELEN, "%d", tsk->pid);
1534    
1535     /* Pin the hierarchy */
1536     atomic_inc(&parent->root->sb->s_active);
1537     diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
1538     index 7469c50..4d1e8c7 100644
1539     --- a/mm/memory_hotplug.c
1540     +++ b/mm/memory_hotplug.c
1541     @@ -58,23 +58,59 @@ static void release_memory_resource(struct resource *res)
1542     return;
1543     }
1544    
1545     -
1546     #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
1547     +static void grow_zone_span(struct zone *zone, unsigned long start_pfn,
1548     + unsigned long end_pfn)
1549     +{
1550     + unsigned long old_zone_end_pfn;
1551     +
1552     + zone_span_writelock(zone);
1553     +
1554     + old_zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
1555     + if (start_pfn < zone->zone_start_pfn)
1556     + zone->zone_start_pfn = start_pfn;
1557     +
1558     + zone->spanned_pages = max(old_zone_end_pfn, end_pfn) -
1559     + zone->zone_start_pfn;
1560     +
1561     + zone_span_writeunlock(zone);
1562     +}
1563     +
1564     +static void grow_pgdat_span(struct pglist_data *pgdat, unsigned long start_pfn,
1565     + unsigned long end_pfn)
1566     +{
1567     + unsigned long old_pgdat_end_pfn =
1568     + pgdat->node_start_pfn + pgdat->node_spanned_pages;
1569     +
1570     + if (start_pfn < pgdat->node_start_pfn)
1571     + pgdat->node_start_pfn = start_pfn;
1572     +
1573     + pgdat->node_spanned_pages = max(old_pgdat_end_pfn, end_pfn) -
1574     + pgdat->node_start_pfn;
1575     +}
1576     +
1577     static int __add_zone(struct zone *zone, unsigned long phys_start_pfn)
1578     {
1579     struct pglist_data *pgdat = zone->zone_pgdat;
1580     int nr_pages = PAGES_PER_SECTION;
1581     int nid = pgdat->node_id;
1582     int zone_type;
1583     + unsigned long flags;
1584    
1585     zone_type = zone - pgdat->node_zones;
1586     if (!zone->wait_table) {
1587     - int ret = 0;
1588     + int ret;
1589     +
1590     ret = init_currently_empty_zone(zone, phys_start_pfn,
1591     nr_pages, MEMMAP_HOTPLUG);
1592     - if (ret < 0)
1593     + if (ret)
1594     return ret;
1595     }
1596     + pgdat_resize_lock(zone->zone_pgdat, &flags);
1597     + grow_zone_span(zone, phys_start_pfn, phys_start_pfn + nr_pages);
1598     + grow_pgdat_span(zone->zone_pgdat, phys_start_pfn,
1599     + phys_start_pfn + nr_pages);
1600     + pgdat_resize_unlock(zone->zone_pgdat, &flags);
1601     memmap_init_zone(nr_pages, nid, zone_type,
1602     phys_start_pfn, MEMMAP_HOTPLUG);
1603     return 0;
1604     @@ -134,36 +170,6 @@ int __add_pages(struct zone *zone, unsigned long phys_start_pfn,
1605     }
1606     EXPORT_SYMBOL_GPL(__add_pages);
1607    
1608     -static void grow_zone_span(struct zone *zone,
1609     - unsigned long start_pfn, unsigned long end_pfn)
1610     -{
1611     - unsigned long old_zone_end_pfn;
1612     -
1613     - zone_span_writelock(zone);
1614     -
1615     - old_zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
1616     - if (start_pfn < zone->zone_start_pfn)
1617     - zone->zone_start_pfn = start_pfn;
1618     -
1619     - zone->spanned_pages = max(old_zone_end_pfn, end_pfn) -
1620     - zone->zone_start_pfn;
1621     -
1622     - zone_span_writeunlock(zone);
1623     -}
1624     -
1625     -static void grow_pgdat_span(struct pglist_data *pgdat,
1626     - unsigned long start_pfn, unsigned long end_pfn)
1627     -{
1628     - unsigned long old_pgdat_end_pfn =
1629     - pgdat->node_start_pfn + pgdat->node_spanned_pages;
1630     -
1631     - if (start_pfn < pgdat->node_start_pfn)
1632     - pgdat->node_start_pfn = start_pfn;
1633     -
1634     - pgdat->node_spanned_pages = max(old_pgdat_end_pfn, end_pfn) -
1635     - pgdat->node_start_pfn;
1636     -}
1637     -
1638     static int online_pages_range(unsigned long start_pfn, unsigned long nr_pages,
1639     void *arg)
1640     {
1641     @@ -183,7 +189,6 @@ static int online_pages_range(unsigned long start_pfn, unsigned long nr_pages,
1642    
1643     int online_pages(unsigned long pfn, unsigned long nr_pages)
1644     {
1645     - unsigned long flags;
1646     unsigned long onlined_pages = 0;
1647     struct zone *zone;
1648     int need_zonelists_rebuild = 0;
1649     @@ -211,11 +216,6 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
1650     * memory_block->state_sem.
1651     */
1652     zone = page_zone(pfn_to_page(pfn));
1653     - pgdat_resize_lock(zone->zone_pgdat, &flags);
1654     - grow_zone_span(zone, pfn, pfn + nr_pages);
1655     - grow_pgdat_span(zone->zone_pgdat, pfn, pfn + nr_pages);
1656     - pgdat_resize_unlock(zone->zone_pgdat, &flags);
1657     -
1658     /*
1659     * If this zone is not populated, then it is not in zonelist.
1660     * This means the page allocator ignores this zone.
1661     diff --git a/mm/mmap.c b/mm/mmap.c
1662     index a32d28c..96bdd73 100644
1663     --- a/mm/mmap.c
1664     +++ b/mm/mmap.c
1665     @@ -242,10 +242,16 @@ asmlinkage unsigned long sys_brk(unsigned long brk)
1666     unsigned long rlim, retval;
1667     unsigned long newbrk, oldbrk;
1668     struct mm_struct *mm = current->mm;
1669     + unsigned long min_brk;
1670    
1671     down_write(&mm->mmap_sem);
1672    
1673     - if (brk < mm->start_brk)
1674     +#ifdef CONFIG_COMPAT_BRK
1675     + min_brk = mm->end_code;
1676     +#else
1677     + min_brk = mm->start_brk;
1678     +#endif
1679     + if (brk < min_brk)
1680     goto out;
1681    
1682     /*
1683     diff --git a/mm/page_alloc.c b/mm/page_alloc.c
1684     index 55443c2..f7082af 100644
1685     --- a/mm/page_alloc.c
1686     +++ b/mm/page_alloc.c
1687     @@ -2837,8 +2837,6 @@ __meminit int init_currently_empty_zone(struct zone *zone,
1688    
1689     zone->zone_start_pfn = zone_start_pfn;
1690    
1691     - memmap_init(size, pgdat->node_id, zone_idx(zone), zone_start_pfn);
1692     -
1693     zone_init_free_lists(zone);
1694    
1695     return 0;
1696     @@ -3408,6 +3406,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat,
1697     ret = init_currently_empty_zone(zone, zone_start_pfn,
1698     size, MEMMAP_EARLY);
1699     BUG_ON(ret);
1700     + memmap_init(size, nid, j, zone_start_pfn);
1701     zone_start_pfn += size;
1702     }
1703     }
1704     diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
1705     index 24c0d03..b8a917b 100644
1706     --- a/net/ipv6/netfilter/nf_conntrack_reasm.c
1707     +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
1708     @@ -209,7 +209,9 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst)
1709     arg.dst = dst;
1710     hash = ip6qhashfn(id, src, dst);
1711    
1712     + local_bh_disable();
1713     q = inet_frag_find(&nf_init_frags, &nf_frags, &arg, hash);
1714     + local_bh_enable();
1715     if (q == NULL)
1716     goto oom;
1717    
1718     @@ -638,10 +640,10 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
1719     goto ret_orig;
1720     }
1721    
1722     - spin_lock(&fq->q.lock);
1723     + spin_lock_bh(&fq->q.lock);
1724    
1725     if (nf_ct_frag6_queue(fq, clone, fhdr, nhoff) < 0) {
1726     - spin_unlock(&fq->q.lock);
1727     + spin_unlock_bh(&fq->q.lock);
1728     pr_debug("Can't insert skb to queue\n");
1729     fq_put(fq);
1730     goto ret_orig;
1731     @@ -652,7 +654,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
1732     if (ret_skb == NULL)
1733     pr_debug("Can't reassemble fragmented packets\n");
1734     }
1735     - spin_unlock(&fq->q.lock);
1736     + spin_unlock_bh(&fq->q.lock);
1737    
1738     fq_put(fq);
1739     return ret_skb;
1740     diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
1741     index 684ec9c..d15d70f 100644
1742     --- a/net/netfilter/nf_conntrack_expect.c
1743     +++ b/net/netfilter/nf_conntrack_expect.c
1744     @@ -550,10 +550,10 @@ int __init nf_conntrack_expect_init(void)
1745     return 0;
1746    
1747     err3:
1748     + kmem_cache_destroy(nf_ct_expect_cachep);
1749     +err2:
1750     nf_ct_free_hashtable(nf_ct_expect_hash, nf_ct_expect_vmalloc,
1751     nf_ct_expect_hsize);
1752     -err2:
1753     - kmem_cache_destroy(nf_ct_expect_cachep);
1754     err1:
1755     return err;
1756     }
1757     diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c
1758     index 3b01119..1692338 100644
1759     --- a/net/netfilter/xt_connlimit.c
1760     +++ b/net/netfilter/xt_connlimit.c
1761     @@ -75,7 +75,8 @@ static inline bool already_closed(const struct nf_conn *conn)
1762     u_int16_t proto = conn->tuplehash[0].tuple.dst.protonum;
1763    
1764     if (proto == IPPROTO_TCP)
1765     - return conn->proto.tcp.state == TCP_CONNTRACK_TIME_WAIT;
1766     + return conn->proto.tcp.state == TCP_CONNTRACK_TIME_WAIT ||
1767     + conn->proto.tcp.state == TCP_CONNTRACK_CLOSE;
1768     else
1769     return 0;
1770     }
1771     diff --git a/net/netfilter/xt_iprange.c b/net/netfilter/xt_iprange.c
1772     index 500528d..c63e933 100644
1773     --- a/net/netfilter/xt_iprange.c
1774     +++ b/net/netfilter/xt_iprange.c
1775     @@ -179,3 +179,5 @@ module_exit(iprange_mt_exit);
1776     MODULE_LICENSE("GPL");
1777     MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>, Jan Engelhardt <jengelh@computergmbh.de>");
1778     MODULE_DESCRIPTION("Xtables: arbitrary IPv4 range matching");
1779     +MODULE_ALIAS("ipt_iprange");
1780     +MODULE_ALIAS("ip6t_iprange");
1781     diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
1782     index 732ba27..62d77ff 100644
1783     --- a/security/smack/smack_lsm.c
1784     +++ b/security/smack/smack_lsm.c
1785     @@ -1865,6 +1865,18 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
1786     final = sbsp->smk_default;
1787    
1788     /*
1789     + * If this is the root inode the superblock
1790     + * may be in the process of initialization.
1791     + * If that is the case use the root value out
1792     + * of the superblock.
1793     + */
1794     + if (opt_dentry->d_parent == opt_dentry) {
1795     + isp->smk_inode = sbsp->smk_root;
1796     + isp->smk_flags |= SMK_INODE_INSTANT;
1797     + goto unlockandout;
1798     + }
1799     +
1800     + /*
1801     * This is pretty hackish.
1802     * Casey says that we shouldn't have to do
1803     * file system specific code, but it does help