Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1617 - genpatches-2.6/trunk/2.6.30
Date: Tue, 06 Oct 2009 15:22:06
Message-Id: E1MvBrW-0000cB-Jk@stork.gentoo.org
1 Author: mpagano
2 Date: 2009-10-06 15:22:02 +0000 (Tue, 06 Oct 2009)
3 New Revision: 1617
4
5 Added:
6 genpatches-2.6/trunk/2.6.30/1008_linux-2.6.30.9.patch
7 Modified:
8 genpatches-2.6/trunk/2.6.30/0000_README
9 Log:
10 Linux patch version 2.6.30.9
11
12 Modified: genpatches-2.6/trunk/2.6.30/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/2.6.30/0000_README 2009-10-05 21:46:35 UTC (rev 1616)
15 +++ genpatches-2.6/trunk/2.6.30/0000_README 2009-10-06 15:22:02 UTC (rev 1617)
16 @@ -71,6 +71,10 @@
17 From: http://www.kernel.org
18 Desc: Linux 2.6.30.8
19
20 +Patch: 1008_linux-2.6.30.9.patch
21 +From: http://www.kernel.org
22 +Desc: Linux 2.6.30.9
23 +
24 Patch: 1510_hid-move-deref-below-null-test.patch
25 From: http://lwn.net/Articles/342440/
26 Desc: HID: Move dereferences below a NULL test
27
28 Added: genpatches-2.6/trunk/2.6.30/1008_linux-2.6.30.9.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/2.6.30/1008_linux-2.6.30.9.patch (rev 0)
31 +++ genpatches-2.6/trunk/2.6.30/1008_linux-2.6.30.9.patch 2009-10-06 15:22:02 UTC (rev 1617)
32 @@ -0,0 +1,1072 @@
33 +diff --git a/arch/powerpc/include/asm/pte-common.h b/arch/powerpc/include/asm/pte-common.h
34 +index a7e210b..0cd2e34 100644
35 +--- a/arch/powerpc/include/asm/pte-common.h
36 ++++ b/arch/powerpc/include/asm/pte-common.h
37 +@@ -176,7 +176,7 @@ extern unsigned long bad_call_to_PMD_PAGE_SIZE(void);
38 + #define HAVE_PAGE_AGP
39 +
40 + /* Advertise support for _PAGE_SPECIAL */
41 +-#ifdef _PAGE_SPECIAL
42 ++#if _PAGE_SPECIAL != 0
43 + #define __HAVE_ARCH_PTE_SPECIAL
44 + #endif
45 +
46 +diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
47 +index ae1d67c..f1d5f0c 100644
48 +--- a/arch/powerpc/mm/pgtable.c
49 ++++ b/arch/powerpc/mm/pgtable.c
50 +@@ -30,6 +30,8 @@
51 + #include <asm/tlbflush.h>
52 + #include <asm/tlb.h>
53 +
54 ++#include "mmu_decl.h"
55 ++
56 + static DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur);
57 + static unsigned long pte_freelist_forced_free;
58 +
59 +@@ -119,7 +121,7 @@ void pte_free_finish(void)
60 + /*
61 + * Handle i/d cache flushing, called from set_pte_at() or ptep_set_access_flags()
62 + */
63 +-static pte_t do_dcache_icache_coherency(pte_t pte)
64 ++static pte_t do_dcache_icache_coherency(pte_t pte, unsigned long addr)
65 + {
66 + unsigned long pfn = pte_pfn(pte);
67 + struct page *page;
68 +@@ -128,6 +130,17 @@ static pte_t do_dcache_icache_coherency(pte_t pte)
69 + return pte;
70 + page = pfn_to_page(pfn);
71 +
72 ++#ifdef CONFIG_8xx
73 ++ /* On 8xx, cache control instructions (particularly
74 ++ * "dcbst" from flush_dcache_icache) fault as write
75 ++ * operation if there is an unpopulated TLB entry
76 ++ * for the address in question. To workaround that,
77 ++ * we invalidate the TLB here, thus avoiding dcbst
78 ++ * misbehaviour.
79 ++ */
80 ++ _tlbil_va(addr, 0 /* 8xx doesn't care about PID */);
81 ++#endif
82 ++
83 + if (!PageReserved(page) && !test_bit(PG_arch_1, &page->flags)) {
84 + pr_debug("do_dcache_icache_coherency... flushing\n");
85 + flush_dcache_icache_page(page);
86 +@@ -198,7 +211,7 @@ void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte
87 + */
88 + pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS);
89 + if (pte_need_exec_flush(pte, 1))
90 +- pte = do_dcache_icache_coherency(pte);
91 ++ pte = do_dcache_icache_coherency(pte, addr);
92 +
93 + /* Perform the setting of the PTE */
94 + __set_pte_at(mm, addr, ptep, pte, 0);
95 +@@ -216,7 +229,7 @@ int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address,
96 + {
97 + int changed;
98 + if (!dirty && pte_need_exec_flush(entry, 0))
99 +- entry = do_dcache_icache_coherency(entry);
100 ++ entry = do_dcache_icache_coherency(entry, address);
101 + changed = !pte_same(*(ptep), entry);
102 + if (changed) {
103 + if (!(vma->vm_flags & VM_HUGETLB))
104 +diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
105 +index 9a9efb0..e8b9c8c 100644
106 +--- a/arch/x86/include/asm/kvm_host.h
107 ++++ b/arch/x86/include/asm/kvm_host.h
108 +@@ -620,6 +620,7 @@ void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr);
109 + void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code);
110 + void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2,
111 + u32 error_code);
112 ++bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl);
113 +
114 + int kvm_pic_set_irq(void *opaque, int irq, int level);
115 +
116 +diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
117 +index cf52215..66a37cf 100644
118 +--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
119 ++++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
120 +@@ -618,9 +618,10 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst,
121 + return 0;
122 + }
123 +
124 +-static void invalidate_entry(struct powernow_k8_data *data, unsigned int entry)
125 ++static void invalidate_entry(struct cpufreq_frequency_table *powernow_table,
126 ++ unsigned int entry)
127 + {
128 +- data->powernow_table[entry].frequency = CPUFREQ_ENTRY_INVALID;
129 ++ powernow_table[entry].frequency = CPUFREQ_ENTRY_INVALID;
130 + }
131 +
132 + static void print_basics(struct powernow_k8_data *data)
133 +@@ -926,13 +927,13 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data,
134 + "bad value %d.\n", i, index);
135 + printk(KERN_ERR PFX "Please report to BIOS "
136 + "manufacturer\n");
137 +- invalidate_entry(data, i);
138 ++ invalidate_entry(powernow_table, i);
139 + continue;
140 + }
141 + rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi);
142 + if (!(hi & HW_PSTATE_VALID_MASK)) {
143 + dprintk("invalid pstate %d, ignoring\n", index);
144 +- invalidate_entry(data, i);
145 ++ invalidate_entry(powernow_table, i);
146 + continue;
147 + }
148 +
149 +@@ -982,7 +983,7 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data,
150 + /* verify frequency is OK */
151 + if ((freq > (MAX_FREQ * 1000)) || (freq < (MIN_FREQ * 1000))) {
152 + dprintk("invalid freq %u kHz, ignoring\n", freq);
153 +- invalidate_entry(data, i);
154 ++ invalidate_entry(powernow_table, i);
155 + continue;
156 + }
157 +
158 +@@ -990,7 +991,7 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data,
159 + * BIOSs are using "off" to indicate invalid */
160 + if (vid == VID_OFF) {
161 + dprintk("invalid vid %u, ignoring\n", vid);
162 +- invalidate_entry(data, i);
163 ++ invalidate_entry(powernow_table, i);
164 + continue;
165 + }
166 +
167 +@@ -1021,7 +1022,7 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data,
168 + (unsigned int)
169 + (data->acpi_data.states[i].core_frequency
170 + * 1000));
171 +- invalidate_entry(data, i);
172 ++ invalidate_entry(powernow_table, i);
173 + continue;
174 + }
175 + }
176 +diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
177 +index 223af43..e5efcdc 100644
178 +--- a/arch/x86/kernel/kvmclock.c
179 ++++ b/arch/x86/kernel/kvmclock.c
180 +@@ -50,8 +50,8 @@ static unsigned long kvm_get_wallclock(void)
181 + struct timespec ts;
182 + int low, high;
183 +
184 +- low = (int)__pa(&wall_clock);
185 +- high = ((u64)__pa(&wall_clock) >> 32);
186 ++ low = (int)__pa_symbol(&wall_clock);
187 ++ high = ((u64)__pa_symbol(&wall_clock) >> 32);
188 + native_write_msr(MSR_KVM_WALL_CLOCK, low, high);
189 +
190 + vcpu_time = &get_cpu_var(hv_clock);
191 +diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
192 +index f0b67f2..dba1f4d 100644
193 +--- a/arch/x86/kvm/lapic.c
194 ++++ b/arch/x86/kvm/lapic.c
195 +@@ -635,6 +635,15 @@ static void start_apic_timer(struct kvm_lapic *apic)
196 +
197 + if (!apic->timer.period)
198 + return;
199 ++ /*
200 ++ * Do not allow the guest to program periodic timers with small
201 ++ * interval, since the hrtimers are not throttled by the host
202 ++ * scheduler.
203 ++ */
204 ++ if (apic_lvtt_period(apic)) {
205 ++ if (apic->timer.period < NSEC_PER_MSEC/2)
206 ++ apic->timer.period = NSEC_PER_MSEC/2;
207 ++ }
208 +
209 + hrtimer_start(&apic->timer.dev,
210 + ktime_add_ns(now, apic->timer.period),
211 +diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
212 +index d7ce26b..0c43e13 100644
213 +--- a/arch/x86/kvm/mmu.c
214 ++++ b/arch/x86/kvm/mmu.c
215 +@@ -2612,7 +2612,8 @@ EXPORT_SYMBOL_GPL(kvm_mmu_unprotect_page_virt);
216 +
217 + void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu)
218 + {
219 +- while (vcpu->kvm->arch.n_free_mmu_pages < KVM_REFILL_PAGES) {
220 ++ while (vcpu->kvm->arch.n_free_mmu_pages < KVM_REFILL_PAGES &&
221 ++ !list_empty(&vcpu->kvm->arch.active_mmu_pages)) {
222 + struct kvm_mmu_page *sp;
223 +
224 + sp = container_of(vcpu->kvm->arch.active_mmu_pages.prev,
225 +@@ -2691,12 +2692,6 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu)
226 +
227 + ASSERT(vcpu);
228 +
229 +- if (vcpu->kvm->arch.n_requested_mmu_pages)
230 +- vcpu->kvm->arch.n_free_mmu_pages =
231 +- vcpu->kvm->arch.n_requested_mmu_pages;
232 +- else
233 +- vcpu->kvm->arch.n_free_mmu_pages =
234 +- vcpu->kvm->arch.n_alloc_mmu_pages;
235 + /*
236 + * When emulating 32-bit mode, cr3 is only 32 bits even on x86_64.
237 + * Therefore we need to allocate shadow page tables in the first
238 +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
239 +index 1a0d5cd..691f8e0 100644
240 +--- a/arch/x86/kvm/vmx.c
241 ++++ b/arch/x86/kvm/vmx.c
242 +@@ -1206,12 +1206,9 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
243 + if (_cpu_based_2nd_exec_control & SECONDARY_EXEC_ENABLE_EPT) {
244 + /* CR3 accesses and invlpg don't need to cause VM Exits when EPT
245 + enabled */
246 +- min &= ~(CPU_BASED_CR3_LOAD_EXITING |
247 +- CPU_BASED_CR3_STORE_EXITING |
248 +- CPU_BASED_INVLPG_EXITING);
249 +- if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PROCBASED_CTLS,
250 +- &_cpu_based_exec_control) < 0)
251 +- return -EIO;
252 ++ _cpu_based_exec_control &= ~(CPU_BASED_CR3_LOAD_EXITING |
253 ++ CPU_BASED_CR3_STORE_EXITING |
254 ++ CPU_BASED_INVLPG_EXITING);
255 + rdmsr(MSR_IA32_VMX_EPT_VPID_CAP,
256 + vmx_capability.ept, vmx_capability.vpid);
257 + }
258 +@@ -2865,6 +2862,8 @@ static int handle_dr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
259 + unsigned long val;
260 + int dr, reg;
261 +
262 ++ if (!kvm_require_cpl(vcpu, 0))
263 ++ return 1;
264 + dr = vmcs_readl(GUEST_DR7);
265 + if (dr & DR7_GD) {
266 + /*
267 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
268 +index 0b1bfc6..ec56c78 100644
269 +--- a/arch/x86/kvm/x86.c
270 ++++ b/arch/x86/kvm/x86.c
271 +@@ -217,6 +217,19 @@ static void __queue_exception(struct kvm_vcpu *vcpu)
272 + }
273 +
274 + /*
275 ++ * Checks if cpl <= required_cpl; if true, return true. Otherwise queue
276 ++ * a #GP and return false.
277 ++ */
278 ++bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl)
279 ++{
280 ++ if (kvm_x86_ops->get_cpl(vcpu) <= required_cpl)
281 ++ return true;
282 ++ kvm_queue_exception_e(vcpu, GP_VECTOR, 0);
283 ++ return false;
284 ++}
285 ++EXPORT_SYMBOL_GPL(kvm_require_cpl);
286 ++
287 ++/*
288 + * Load the pae pdptrs. Return true is they are all valid.
289 + */
290 + int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3)
291 +@@ -1425,6 +1438,10 @@ static int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid,
292 + for (func = 0x80000001; func <= limit && nent < cpuid->nent; ++func)
293 + do_cpuid_ent(&cpuid_entries[nent], func, 0,
294 + &nent, cpuid->nent);
295 ++ r = -E2BIG;
296 ++ if (nent >= cpuid->nent)
297 ++ goto out_free;
298 ++
299 + r = -EFAULT;
300 + if (copy_to_user(entries, cpuid_entries,
301 + nent * sizeof(struct kvm_cpuid_entry2)))
302 +@@ -2885,6 +2902,11 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
303 + a3 &= 0xFFFFFFFF;
304 + }
305 +
306 ++ if (kvm_x86_ops->get_cpl(vcpu) != 0) {
307 ++ ret = -KVM_EPERM;
308 ++ goto out;
309 ++ }
310 ++
311 + switch (nr) {
312 + case KVM_HC_VAPIC_POLL_IRQ:
313 + ret = 0;
314 +@@ -2896,6 +2918,7 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
315 + ret = -KVM_ENOSYS;
316 + break;
317 + }
318 ++out:
319 + kvm_register_write(vcpu, VCPU_REGS_RAX, ret);
320 + ++vcpu->stat.hypercalls;
321 + return r;
322 +@@ -3989,13 +4012,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
323 +
324 + vcpu->arch.cr2 = sregs->cr2;
325 + mmu_reset_needed |= vcpu->arch.cr3 != sregs->cr3;
326 +-
327 +- down_read(&vcpu->kvm->slots_lock);
328 +- if (gfn_to_memslot(vcpu->kvm, sregs->cr3 >> PAGE_SHIFT))
329 +- vcpu->arch.cr3 = sregs->cr3;
330 +- else
331 +- set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests);
332 +- up_read(&vcpu->kvm->slots_lock);
333 ++ vcpu->arch.cr3 = sregs->cr3;
334 +
335 + kvm_set_cr8(vcpu, sregs->cr8);
336 +
337 +diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
338 +index 12158e0..da9d6d2 100644
339 +--- a/drivers/acpi/pci_slot.c
340 ++++ b/drivers/acpi/pci_slot.c
341 +@@ -57,7 +57,7 @@ ACPI_MODULE_NAME("pci_slot");
342 + MY_NAME , ## arg); \
343 + } while (0)
344 +
345 +-#define SLOT_NAME_SIZE 20 /* Inspired by #define in acpiphp.h */
346 ++#define SLOT_NAME_SIZE 21 /* Inspired by #define in acpiphp.h */
347 +
348 + struct acpi_pci_slot {
349 + acpi_handle root_handle; /* handle of the root bridge */
350 +@@ -149,7 +149,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
351 + return AE_OK;
352 + }
353 +
354 +- snprintf(name, sizeof(name), "%u", (u32)sun);
355 ++ snprintf(name, sizeof(name), "%llu", sun);
356 + pci_slot = pci_create_slot(pci_bus, device, name, NULL);
357 + if (IS_ERR(pci_slot)) {
358 + err("pci_create_slot returned %ld\n", PTR_ERR(pci_slot));
359 +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
360 +index 6b91c26..bc06245 100644
361 +--- a/drivers/ata/ahci.c
362 ++++ b/drivers/ata/ahci.c
363 +@@ -2744,8 +2744,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
364 + if (board_id == board_ahci_sb700 && pdev->revision >= 0x40)
365 + hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL;
366 +
367 +- if (!(hpriv->flags & AHCI_HFLAG_NO_MSI))
368 +- pci_enable_msi(pdev);
369 ++ if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev))
370 ++ pci_intx(pdev, 1);
371 +
372 + /* save initial config */
373 + ahci_save_initial_config(pdev, hpriv);
374 +diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
375 +index 6cc6cbc..0d72890 100644
376 +--- a/drivers/net/wireless/p54/p54usb.c
377 ++++ b/drivers/net/wireless/p54/p54usb.c
378 +@@ -66,6 +66,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
379 + {USB_DEVICE(0x0bf8, 0x1009)}, /* FUJITSU E-5400 USB D1700*/
380 + {USB_DEVICE(0x0cde, 0x0006)}, /* Medion MD40900 */
381 + {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */
382 ++ {USB_DEVICE(0x0cde, 0x0015)}, /* Zcomax XG-705A */
383 + {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */
384 + {USB_DEVICE(0x124a, 0x4025)}, /* IOGear GWU513 (GW3887IK chip) */
385 + {USB_DEVICE(0x1260, 0xee22)}, /* SMC 2862W-G version 2 */
386 +diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
387 +index 9e1140f..e1dcced 100644
388 +--- a/drivers/pcmcia/at91_cf.c
389 ++++ b/drivers/pcmcia/at91_cf.c
390 +@@ -363,7 +363,7 @@ static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
391 + struct at91_cf_socket *cf = platform_get_drvdata(pdev);
392 + struct at91_cf_data *board = cf->board;
393 +
394 +- pcmcia_socket_dev_suspend(&pdev->dev, mesg);
395 ++ pcmcia_socket_dev_suspend(&pdev->dev);
396 + if (device_may_wakeup(&pdev->dev)) {
397 + enable_irq_wake(board->det_pin);
398 + if (board->irq_pin)
399 +diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
400 +index 9001334..0208870 100644
401 +--- a/drivers/pcmcia/au1000_generic.c
402 ++++ b/drivers/pcmcia/au1000_generic.c
403 +@@ -515,7 +515,7 @@ static int au1x00_drv_pcmcia_probe(struct platform_device *dev)
404 + static int au1x00_drv_pcmcia_suspend(struct platform_device *dev,
405 + pm_message_t state)
406 + {
407 +- return pcmcia_socket_dev_suspend(&dev->dev, state);
408 ++ return pcmcia_socket_dev_suspend(&dev->dev);
409 + }
410 +
411 + static int au1x00_drv_pcmcia_resume(struct platform_device *dev)
412 +diff --git a/drivers/pcmcia/bfin_cf_pcmcia.c b/drivers/pcmcia/bfin_cf_pcmcia.c
413 +index b59d411..300b368 100644
414 +--- a/drivers/pcmcia/bfin_cf_pcmcia.c
415 ++++ b/drivers/pcmcia/bfin_cf_pcmcia.c
416 +@@ -302,7 +302,7 @@ static int __devexit bfin_cf_remove(struct platform_device *pdev)
417 +
418 + static int bfin_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
419 + {
420 +- return pcmcia_socket_dev_suspend(&pdev->dev, mesg);
421 ++ return pcmcia_socket_dev_suspend(&pdev->dev);
422 + }
423 +
424 + static int bfin_cf_resume(struct platform_device *pdev)
425 +diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
426 +index 0660ad1..934d4be 100644
427 +--- a/drivers/pcmcia/cs.c
428 ++++ b/drivers/pcmcia/cs.c
429 +@@ -101,7 +101,7 @@ EXPORT_SYMBOL(pcmcia_socket_list_rwsem);
430 + static int socket_resume(struct pcmcia_socket *skt);
431 + static int socket_suspend(struct pcmcia_socket *skt);
432 +
433 +-int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state)
434 ++int pcmcia_socket_dev_suspend(struct device *dev)
435 + {
436 + struct pcmcia_socket *socket;
437 +
438 +diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
439 +index 46561fa..a04f21c 100644
440 +--- a/drivers/pcmcia/i82092.c
441 ++++ b/drivers/pcmcia/i82092.c
442 +@@ -42,7 +42,7 @@ MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids);
443 + #ifdef CONFIG_PM
444 + static int i82092aa_socket_suspend (struct pci_dev *dev, pm_message_t state)
445 + {
446 +- return pcmcia_socket_dev_suspend(&dev->dev, state);
447 ++ return pcmcia_socket_dev_suspend(&dev->dev);
448 + }
449 +
450 + static int i82092aa_socket_resume (struct pci_dev *dev)
451 +diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
452 +index 40d4953..b906abe 100644
453 +--- a/drivers/pcmcia/i82365.c
454 ++++ b/drivers/pcmcia/i82365.c
455 +@@ -1241,7 +1241,7 @@ static int pcic_init(struct pcmcia_socket *s)
456 + static int i82365_drv_pcmcia_suspend(struct platform_device *dev,
457 + pm_message_t state)
458 + {
459 +- return pcmcia_socket_dev_suspend(&dev->dev, state);
460 ++ return pcmcia_socket_dev_suspend(&dev->dev);
461 + }
462 +
463 + static int i82365_drv_pcmcia_resume(struct platform_device *dev)
464 +diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c
465 +index 62b4ecc..d1d89c4 100644
466 +--- a/drivers/pcmcia/m32r_cfc.c
467 ++++ b/drivers/pcmcia/m32r_cfc.c
468 +@@ -699,7 +699,7 @@ static struct pccard_operations pcc_operations = {
469 + static int cfc_drv_pcmcia_suspend(struct platform_device *dev,
470 + pm_message_t state)
471 + {
472 +- return pcmcia_socket_dev_suspend(&dev->dev, state);
473 ++ return pcmcia_socket_dev_suspend(&dev->dev);
474 + }
475 +
476 + static int cfc_drv_pcmcia_resume(struct platform_device *dev)
477 +diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c
478 +index 12034b4..a065583 100644
479 +--- a/drivers/pcmcia/m32r_pcc.c
480 ++++ b/drivers/pcmcia/m32r_pcc.c
481 +@@ -675,7 +675,7 @@ static struct pccard_operations pcc_operations = {
482 + static int pcc_drv_pcmcia_suspend(struct platform_device *dev,
483 + pm_message_t state)
484 + {
485 +- return pcmcia_socket_dev_suspend(&dev->dev, state);
486 ++ return pcmcia_socket_dev_suspend(&dev->dev);
487 + }
488 +
489 + static int pcc_drv_pcmcia_resume(struct platform_device *dev)
490 +diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
491 +index d1ad096..c69f2c4 100644
492 +--- a/drivers/pcmcia/m8xx_pcmcia.c
493 ++++ b/drivers/pcmcia/m8xx_pcmcia.c
494 +@@ -1296,7 +1296,7 @@ static int m8xx_remove(struct of_device *ofdev)
495 + #ifdef CONFIG_PM
496 + static int m8xx_suspend(struct platform_device *pdev, pm_message_t state)
497 + {
498 +- return pcmcia_socket_dev_suspend(&pdev->dev, state);
499 ++ return pcmcia_socket_dev_suspend(&pdev->dev);
500 + }
501 +
502 + static int m8xx_resume(struct platform_device *pdev)
503 +diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
504 +index f373639..68570bc 100644
505 +--- a/drivers/pcmcia/omap_cf.c
506 ++++ b/drivers/pcmcia/omap_cf.c
507 +@@ -334,7 +334,7 @@ static int __exit omap_cf_remove(struct platform_device *pdev)
508 +
509 + static int omap_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
510 + {
511 +- return pcmcia_socket_dev_suspend(&pdev->dev, mesg);
512 ++ return pcmcia_socket_dev_suspend(&pdev->dev);
513 + }
514 +
515 + static int omap_cf_resume(struct platform_device *pdev)
516 +diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
517 +index 8bed1da..1c39d34 100644
518 +--- a/drivers/pcmcia/pd6729.c
519 ++++ b/drivers/pcmcia/pd6729.c
520 +@@ -758,7 +758,7 @@ static void __devexit pd6729_pci_remove(struct pci_dev *dev)
521 + #ifdef CONFIG_PM
522 + static int pd6729_socket_suspend(struct pci_dev *dev, pm_message_t state)
523 + {
524 +- return pcmcia_socket_dev_suspend(&dev->dev, state);
525 ++ return pcmcia_socket_dev_suspend(&dev->dev);
526 + }
527 +
528 + static int pd6729_socket_resume(struct pci_dev *dev)
529 +diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
530 +index c49a726..86ad876 100644
531 +--- a/drivers/pcmcia/pxa2xx_base.c
532 ++++ b/drivers/pcmcia/pxa2xx_base.c
533 +@@ -302,7 +302,7 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev)
534 +
535 + static int pxa2xx_drv_pcmcia_suspend(struct platform_device *dev, pm_message_t state)
536 + {
537 +- return pcmcia_socket_dev_suspend(&dev->dev, state);
538 ++ return pcmcia_socket_dev_suspend(&dev->dev);
539 + }
540 +
541 + static int pxa2xx_drv_pcmcia_resume(struct platform_device *dev)
542 +diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c
543 +index d8da5ac..2d0e997 100644
544 +--- a/drivers/pcmcia/sa1100_generic.c
545 ++++ b/drivers/pcmcia/sa1100_generic.c
546 +@@ -89,7 +89,7 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
547 + static int sa11x0_drv_pcmcia_suspend(struct platform_device *dev,
548 + pm_message_t state)
549 + {
550 +- return pcmcia_socket_dev_suspend(&dev->dev, state);
551 ++ return pcmcia_socket_dev_suspend(&dev->dev);
552 + }
553 +
554 + static int sa11x0_drv_pcmcia_resume(struct platform_device *dev)
555 +diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
556 +index 401052a..4be4e17 100644
557 +--- a/drivers/pcmcia/sa1111_generic.c
558 ++++ b/drivers/pcmcia/sa1111_generic.c
559 +@@ -159,7 +159,7 @@ static int __devexit pcmcia_remove(struct sa1111_dev *dev)
560 +
561 + static int pcmcia_suspend(struct sa1111_dev *dev, pm_message_t state)
562 + {
563 +- return pcmcia_socket_dev_suspend(&dev->dev, state);
564 ++ return pcmcia_socket_dev_suspend(&dev->dev);
565 + }
566 +
567 + static int pcmcia_resume(struct sa1111_dev *dev)
568 +diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c
569 +index 9ad97ea..9974410 100644
570 +--- a/drivers/pcmcia/tcic.c
571 ++++ b/drivers/pcmcia/tcic.c
572 +@@ -366,7 +366,7 @@ static int __init get_tcic_id(void)
573 + static int tcic_drv_pcmcia_suspend(struct platform_device *dev,
574 + pm_message_t state)
575 + {
576 +- return pcmcia_socket_dev_suspend(&dev->dev, state);
577 ++ return pcmcia_socket_dev_suspend(&dev->dev);
578 + }
579 +
580 + static int tcic_drv_pcmcia_resume(struct platform_device *dev)
581 +diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c
582 +index 659421d..05144e7 100644
583 +--- a/drivers/pcmcia/vrc4171_card.c
584 ++++ b/drivers/pcmcia/vrc4171_card.c
585 +@@ -707,7 +707,7 @@ __setup("vrc4171_card=", vrc4171_card_setup);
586 + static int vrc4171_card_suspend(struct platform_device *dev,
587 + pm_message_t state)
588 + {
589 +- return pcmcia_socket_dev_suspend(&dev->dev, state);
590 ++ return pcmcia_socket_dev_suspend(&dev->dev);
591 + }
592 +
593 + static int vrc4171_card_resume(struct platform_device *dev)
594 +diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
595 +index 3ecd7c9..f728a45 100644
596 +--- a/drivers/pcmcia/yenta_socket.c
597 ++++ b/drivers/pcmcia/yenta_socket.c
598 +@@ -1225,60 +1225,71 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
599 + }
600 +
601 + #ifdef CONFIG_PM
602 +-static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state)
603 ++static int yenta_dev_suspend_noirq(struct device *dev)
604 + {
605 +- struct yenta_socket *socket = pci_get_drvdata(dev);
606 ++ struct pci_dev *pdev = to_pci_dev(dev);
607 ++ struct yenta_socket *socket = pci_get_drvdata(pdev);
608 + int ret;
609 +
610 +- ret = pcmcia_socket_dev_suspend(&dev->dev, state);
611 ++ ret = pcmcia_socket_dev_suspend(dev);
612 +
613 +- if (socket) {
614 +- if (socket->type && socket->type->save_state)
615 +- socket->type->save_state(socket);
616 ++ if (!socket)
617 ++ return ret;
618 +
619 +- /* FIXME: pci_save_state needs to have a better interface */
620 +- pci_save_state(dev);
621 +- pci_read_config_dword(dev, 16*4, &socket->saved_state[0]);
622 +- pci_read_config_dword(dev, 17*4, &socket->saved_state[1]);
623 +- pci_disable_device(dev);
624 ++ if (socket->type && socket->type->save_state)
625 ++ socket->type->save_state(socket);
626 +
627 +- /*
628 +- * Some laptops (IBM T22) do not like us putting the Cardbus
629 +- * bridge into D3. At a guess, some other laptop will
630 +- * probably require this, so leave it commented out for now.
631 +- */
632 +- /* pci_set_power_state(dev, 3); */
633 +- }
634 ++ pci_save_state(pdev);
635 ++ pci_read_config_dword(pdev, 16*4, &socket->saved_state[0]);
636 ++ pci_read_config_dword(pdev, 17*4, &socket->saved_state[1]);
637 ++ pci_disable_device(pdev);
638 ++
639 ++ /*
640 ++ * Some laptops (IBM T22) do not like us putting the Cardbus
641 ++ * bridge into D3. At a guess, some other laptop will
642 ++ * probably require this, so leave it commented out for now.
643 ++ */
644 ++ /* pci_set_power_state(dev, 3); */
645 +
646 + return ret;
647 + }
648 +
649 +-
650 +-static int yenta_dev_resume (struct pci_dev *dev)
651 ++static int yenta_dev_resume_noirq(struct device *dev)
652 + {
653 +- struct yenta_socket *socket = pci_get_drvdata(dev);
654 ++ struct pci_dev *pdev = to_pci_dev(dev);
655 ++ struct yenta_socket *socket = pci_get_drvdata(pdev);
656 ++ int ret;
657 +
658 +- if (socket) {
659 +- int rc;
660 ++ if (!socket)
661 ++ return 0;
662 +
663 +- pci_set_power_state(dev, 0);
664 +- /* FIXME: pci_restore_state needs to have a better interface */
665 +- pci_restore_state(dev);
666 +- pci_write_config_dword(dev, 16*4, socket->saved_state[0]);
667 +- pci_write_config_dword(dev, 17*4, socket->saved_state[1]);
668 ++ pci_write_config_dword(pdev, 16*4, socket->saved_state[0]);
669 ++ pci_write_config_dword(pdev, 17*4, socket->saved_state[1]);
670 +
671 +- rc = pci_enable_device(dev);
672 +- if (rc)
673 +- return rc;
674 ++ ret = pci_enable_device(pdev);
675 ++ if (ret)
676 ++ return ret;
677 +
678 +- pci_set_master(dev);
679 ++ pci_set_master(pdev);
680 +
681 +- if (socket->type && socket->type->restore_state)
682 +- socket->type->restore_state(socket);
683 +- }
684 ++ if (socket->type && socket->type->restore_state)
685 ++ socket->type->restore_state(socket);
686 +
687 +- return pcmcia_socket_dev_resume(&dev->dev);
688 ++ return pcmcia_socket_dev_resume(dev);
689 + }
690 ++
691 ++static struct dev_pm_ops yenta_pm_ops = {
692 ++ .suspend_noirq = yenta_dev_suspend_noirq,
693 ++ .resume_noirq = yenta_dev_resume_noirq,
694 ++ .freeze_noirq = yenta_dev_suspend_noirq,
695 ++ .thaw_noirq = yenta_dev_resume_noirq,
696 ++ .poweroff_noirq = yenta_dev_suspend_noirq,
697 ++ .restore_noirq = yenta_dev_resume_noirq,
698 ++};
699 ++
700 ++#define YENTA_PM_OPS (&yenta_pm_ops)
701 ++#else
702 ++#define YENTA_PM_OPS NULL
703 + #endif
704 +
705 + #define CB_ID(vend,dev,type) \
706 +@@ -1376,10 +1387,7 @@ static struct pci_driver yenta_cardbus_driver = {
707 + .id_table = yenta_table,
708 + .probe = yenta_probe,
709 + .remove = __devexit_p(yenta_close),
710 +-#ifdef CONFIG_PM
711 +- .suspend = yenta_dev_suspend,
712 +- .resume = yenta_dev_resume,
713 +-#endif
714 ++ .driver.pm = YENTA_PM_OPS,
715 + };
716 +
717 +
718 +diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
719 +index 912be65..7cd6d11 100644
720 +--- a/drivers/platform/x86/thinkpad_acpi.c
721 ++++ b/drivers/platform/x86/thinkpad_acpi.c
722 +@@ -286,6 +286,8 @@ struct thinkpad_id_data {
723 +
724 + u16 bios_model; /* Big Endian, TP-1Y = 0x5931, 0 = unknown */
725 + u16 ec_model;
726 ++ u16 bios_release; /* 1ZETK1WW = 0x314b, 0 = unknown */
727 ++ u16 ec_release;
728 +
729 + char *model_str; /* ThinkPad T43 */
730 + char *nummodel_str; /* 9384A9C for a 9384-A9C model */
731 +@@ -362,6 +364,45 @@ static void tpacpi_log_usertask(const char * const what)
732 + } \
733 + } while (0)
734 +
735 ++#define TPACPI_MATCH_ANY 0xffffU
736 ++#define TPACPI_MATCH_UNKNOWN 0U
737 ++
738 ++/* TPID('1', 'Y') == 0x5931 */
739 ++#define TPID(__c1, __c2) (((__c2) << 8) | (__c1))
740 ++
741 ++#define TPACPI_Q_IBM(__id1, __id2, __quirk) \
742 ++ { .vendor = PCI_VENDOR_ID_IBM, \
743 ++ .bios = TPID(__id1, __id2), \
744 ++ .ec = TPACPI_MATCH_ANY, \
745 ++ .quirks = (__quirk) }
746 ++
747 ++struct tpacpi_quirk {
748 ++ unsigned int vendor;
749 ++ u16 bios;
750 ++ u16 ec;
751 ++ unsigned long quirks;
752 ++};
753 ++
754 ++static unsigned long __init tpacpi_check_quirks(
755 ++ const struct tpacpi_quirk *qlist,
756 ++ unsigned int qlist_size)
757 ++{
758 ++ while (qlist_size) {
759 ++ if ((qlist->vendor == thinkpad_id.vendor ||
760 ++ qlist->vendor == TPACPI_MATCH_ANY) &&
761 ++ (qlist->bios == thinkpad_id.bios_model ||
762 ++ qlist->bios == TPACPI_MATCH_ANY) &&
763 ++ (qlist->ec == thinkpad_id.ec_model ||
764 ++ qlist->ec == TPACPI_MATCH_ANY))
765 ++ return qlist->quirks;
766 ++
767 ++ qlist_size--;
768 ++ qlist++;
769 ++ }
770 ++ return 0;
771 ++}
772 ++
773 ++
774 + /****************************************************************************
775 + ****************************************************************************
776 + *
777 +@@ -5757,14 +5798,27 @@ static struct backlight_ops ibm_backlight_data = {
778 +
779 + /* --------------------------------------------------------------------- */
780 +
781 ++#define TPACPI_BRGHT_Q_EC 0x0002 /* Should or must use EC HBRV */
782 ++
783 ++static const struct tpacpi_quirk brightness_quirk_table[] __initconst = {
784 ++ TPACPI_Q_IBM('1', 'Y', TPACPI_BRGHT_Q_EC),
785 ++ TPACPI_Q_IBM('1', 'Q', TPACPI_BRGHT_Q_EC),
786 ++ TPACPI_Q_IBM('7', '6', TPACPI_BRGHT_Q_EC),
787 ++ TPACPI_Q_IBM('7', '8', TPACPI_BRGHT_Q_EC),
788 ++};
789 ++
790 + static int __init brightness_init(struct ibm_init_struct *iibm)
791 + {
792 + int b;
793 ++ unsigned long quirks;
794 +
795 + vdbg_printk(TPACPI_DBG_INIT, "initializing brightness subdriver\n");
796 +
797 + mutex_init(&brightness_mutex);
798 +
799 ++ quirks = tpacpi_check_quirks(brightness_quirk_table,
800 ++ ARRAY_SIZE(brightness_quirk_table));
801 ++
802 + /*
803 + * We always attempt to detect acpi support, so as to switch
804 + * Lenovo Vista BIOS to ACPI brightness mode even if we are not
805 +@@ -5821,19 +5875,9 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
806 + /* TPACPI_BRGHT_MODE_AUTO not implemented yet, just use default */
807 + if (brightness_mode == TPACPI_BRGHT_MODE_AUTO ||
808 + brightness_mode == TPACPI_BRGHT_MODE_MAX) {
809 +- if (thinkpad_id.vendor == PCI_VENDOR_ID_IBM) {
810 +- /*
811 +- * IBM models that define HBRV probably have
812 +- * EC-based backlight level control
813 +- */
814 +- if (acpi_evalf(ec_handle, NULL, "HBRV", "qd"))
815 +- /* T40-T43, R50-R52, R50e, R51e, X31-X41 */
816 +- brightness_mode = TPACPI_BRGHT_MODE_ECNVRAM;
817 +- else
818 +- /* all other IBM ThinkPads */
819 +- brightness_mode = TPACPI_BRGHT_MODE_UCMS_STEP;
820 +- } else
821 +- /* All Lenovo ThinkPads */
822 ++ if (quirks & TPACPI_BRGHT_Q_EC)
823 ++ brightness_mode = TPACPI_BRGHT_MODE_ECNVRAM;
824 ++ else
825 + brightness_mode = TPACPI_BRGHT_MODE_UCMS_STEP;
826 +
827 + dbg_printk(TPACPI_DBG_BRGHT,
828 +@@ -7387,6 +7431,8 @@ static int __must_check __init get_thinkpad_model_data(
829 + return 0;
830 + tp->bios_model = tp->bios_version_str[0]
831 + | (tp->bios_version_str[1] << 8);
832 ++ tp->bios_release = (tp->bios_version_str[4] << 8)
833 ++ | tp->bios_version_str[5];
834 +
835 + /*
836 + * ThinkPad T23 or newer, A31 or newer, R50e or newer,
837 +@@ -7407,6 +7453,8 @@ static int __must_check __init get_thinkpad_model_data(
838 + return -ENOMEM;
839 + tp->ec_model = ec_fw_string[0]
840 + | (ec_fw_string[1] << 8);
841 ++ tp->ec_release = (ec_fw_string[4] << 8)
842 ++ | ec_fw_string[5];
843 + break;
844 + }
845 + }
846 +diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
847 +index a61ab77..115036f 100644
848 +--- a/fs/cifs/cifsglob.h
849 ++++ b/fs/cifs/cifsglob.h
850 +@@ -544,9 +544,9 @@ require use of the stronger protocol */
851 + #define CIFSSEC_MUST_LANMAN 0x10010
852 + #define CIFSSEC_MUST_PLNTXT 0x20020
853 + #ifdef CONFIG_CIFS_UPCALL
854 +-#define CIFSSEC_MASK 0xAF0AF /* allows weak security but also krb5 */
855 ++#define CIFSSEC_MASK 0xBF0BF /* allows weak security but also krb5 */
856 + #else
857 +-#define CIFSSEC_MASK 0xA70A7 /* current flags supported if weak */
858 ++#define CIFSSEC_MASK 0xB70B7 /* current flags supported if weak */
859 + #endif /* UPCALL */
860 + #else /* do not allow weak pw hash */
861 + #ifdef CONFIG_CIFS_UPCALL
862 +diff --git a/fs/inode.c b/fs/inode.c
863 +index a9e8ef0..d69a0eb 100644
864 +--- a/fs/inode.c
865 ++++ b/fs/inode.c
866 +@@ -672,13 +672,15 @@ void unlock_new_inode(struct inode *inode)
867 + }
868 + #endif
869 + /*
870 +- * This is special! We do not need the spinlock
871 +- * when clearing I_LOCK, because we're guaranteed
872 +- * that nobody else tries to do anything about the
873 +- * state of the inode when it is locked, as we
874 +- * just created it (so there can be no old holders
875 +- * that haven't tested I_LOCK).
876 ++ * This is special! We do not need the spinlock when clearing I_LOCK,
877 ++ * because we're guaranteed that nobody else tries to do anything about
878 ++ * the state of the inode when it is locked, as we just created it (so
879 ++ * there can be no old holders that haven't tested I_LOCK).
880 ++ * However we must emit the memory barrier so that other CPUs reliably
881 ++ * see the clearing of I_LOCK after the other inode initialisation has
882 ++ * completed.
883 + */
884 ++ smp_mb();
885 + WARN_ON((inode->i_state & (I_LOCK|I_NEW)) != (I_LOCK|I_NEW));
886 + inode->i_state &= ~(I_LOCK|I_NEW);
887 + wake_up_inode(inode);
888 +diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c
889 +index b55f31c..8344005 100644
890 +--- a/fs/nilfs2/btnode.c
891 ++++ b/fs/nilfs2/btnode.c
892 +@@ -36,6 +36,7 @@
893 +
894 + void nilfs_btnode_cache_init_once(struct address_space *btnc)
895 + {
896 ++ memset(btnc, 0, sizeof(*btnc));
897 + INIT_RADIX_TREE(&btnc->page_tree, GFP_ATOMIC);
898 + spin_lock_init(&btnc->tree_lock);
899 + INIT_LIST_HEAD(&btnc->private_list);
900 +diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
901 +index 59b43a0..5fd7d2b 100644
902 +--- a/fs/proc/kcore.c
903 ++++ b/fs/proc/kcore.c
904 +@@ -361,7 +361,13 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
905 + /* don't dump ioremap'd stuff! (TA) */
906 + if (m->flags & VM_IOREMAP)
907 + continue;
908 +- memcpy(elf_buf + (vmstart - start),
909 ++ /*
910 ++ * we may access memory holes, then use
911 ++ * ex_table. checking return value just for
912 ++ * avoid warnings.
913 ++ */
914 ++ vmsize = __copy_from_user_inatomic(
915 ++ elf_buf + (vmstart - start),
916 + (char *)vmstart, vmsize);
917 + }
918 + read_unlock(&vmlist_lock);
919 +diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c
920 +index 0c10a0b..766b1d4 100644
921 +--- a/fs/proc/uptime.c
922 ++++ b/fs/proc/uptime.c
923 +@@ -4,13 +4,18 @@
924 + #include <linux/sched.h>
925 + #include <linux/seq_file.h>
926 + #include <linux/time.h>
927 ++#include <linux/kernel_stat.h>
928 + #include <asm/cputime.h>
929 +
930 + static int uptime_proc_show(struct seq_file *m, void *v)
931 + {
932 + struct timespec uptime;
933 + struct timespec idle;
934 +- cputime_t idletime = cputime_add(init_task.utime, init_task.stime);
935 ++ int i;
936 ++ cputime_t idletime = cputime_zero;
937 ++
938 ++ for_each_possible_cpu(i)
939 ++ idletime = cputime64_add(idletime, kstat_cpu(i).cpustat.idle);
940 +
941 + do_posix_clock_monotonic_gettime(&uptime);
942 + monotonic_to_bootbased(&uptime);
943 +diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
944 +index 3ddce03..d731092 100644
945 +--- a/include/linux/kvm_para.h
946 ++++ b/include/linux/kvm_para.h
947 +@@ -13,6 +13,7 @@
948 + #define KVM_ENOSYS 1000
949 + #define KVM_EFAULT EFAULT
950 + #define KVM_E2BIG E2BIG
951 ++#define KVM_EPERM EPERM
952 +
953 + #define KVM_HC_VAPIC_POLL_IRQ 1
954 + #define KVM_HC_MMU_OP 2
955 +diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
956 +index 9b4ac93..56677eb 100644
957 +--- a/include/pcmcia/ss.h
958 ++++ b/include/pcmcia/ss.h
959 +@@ -279,7 +279,7 @@ extern struct pccard_resource_ops pccard_iodyn_ops;
960 + extern struct pccard_resource_ops pccard_nonstatic_ops;
961 +
962 + /* socket drivers are expected to use these callbacks in their .drv struct */
963 +-extern int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state);
964 ++extern int pcmcia_socket_dev_suspend(struct device *dev);
965 + extern int pcmcia_socket_dev_resume(struct device *dev);
966 +
967 + /* socket drivers use this callback in their IRQ handler */
968 +diff --git a/mm/hugetlb.c b/mm/hugetlb.c
969 +index 2403eb9..42f7e1a 100644
970 +--- a/mm/hugetlb.c
971 ++++ b/mm/hugetlb.c
972 +@@ -1017,6 +1017,7 @@ int __weak alloc_bootmem_huge_page(struct hstate *h)
973 + NODE_DATA(h->hugetlb_next_nid),
974 + huge_page_size(h), huge_page_size(h), 0);
975 +
976 ++ hstate_next_node(h);
977 + if (addr) {
978 + /*
979 + * Use the beginning of the huge page to store the
980 +@@ -1026,7 +1027,6 @@ int __weak alloc_bootmem_huge_page(struct hstate *h)
981 + m = addr;
982 + goto found;
983 + }
984 +- hstate_next_node(h);
985 + nr_nodes--;
986 + }
987 + return 0;
988 +diff --git a/mm/memory.c b/mm/memory.c
989 +index 4126dd1..445ff30 100644
990 +--- a/mm/memory.c
991 ++++ b/mm/memory.c
992 +@@ -2586,7 +2586,8 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
993 + goto oom_free_page;
994 +
995 + entry = mk_pte(page, vma->vm_page_prot);
996 +- entry = maybe_mkwrite(pte_mkdirty(entry), vma);
997 ++ if (vma->vm_flags & VM_WRITE)
998 ++ entry = pte_mkwrite(pte_mkdirty(entry));
999 +
1000 + page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
1001 + if (!pte_none(*page_table))
1002 +diff --git a/mm/mmap.c b/mm/mmap.c
1003 +index 2b43fa1..2429a7b 100644
1004 +--- a/mm/mmap.c
1005 ++++ b/mm/mmap.c
1006 +@@ -572,9 +572,9 @@ again: remove_next = 1 + (end > next->vm_end);
1007 +
1008 + /*
1009 + * When changing only vma->vm_end, we don't really need
1010 +- * anon_vma lock: but is that case worth optimizing out?
1011 ++ * anon_vma lock.
1012 + */
1013 +- if (vma->anon_vma)
1014 ++ if (vma->anon_vma && (insert || importer || start != vma->vm_start))
1015 + anon_vma = vma->anon_vma;
1016 + if (anon_vma) {
1017 + spin_lock(&anon_vma->lock);
1018 +diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
1019 +index fd9d06f..e7af49d 100644
1020 +--- a/net/ax25/af_ax25.c
1021 ++++ b/net/ax25/af_ax25.c
1022 +@@ -539,7 +539,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,
1023 + if (level != SOL_AX25)
1024 + return -ENOPROTOOPT;
1025 +
1026 +- if (optlen < sizeof(int))
1027 ++ if (optlen < (int)sizeof(int))
1028 + return -EINVAL;
1029 +
1030 + if (get_user(opt, (int __user *)optval))
1031 +diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
1032 +index e4a418f..9de46b4 100644
1033 +--- a/net/bridge/br_netfilter.c
1034 ++++ b/net/bridge/br_netfilter.c
1035 +@@ -357,7 +357,7 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)
1036 + },
1037 + .proto = 0,
1038 + };
1039 +- struct in_device *in_dev = in_dev_get(dev);
1040 ++ struct in_device *in_dev = __in_dev_get_rcu(dev);
1041 +
1042 + /* If err equals -EHOSTUNREACH the error is due to a
1043 + * martian destination or due to the fact that
1044 +diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c
1045 +index 133eeae..ce50688 100644
1046 +--- a/net/bridge/netfilter/ebt_ulog.c
1047 ++++ b/net/bridge/netfilter/ebt_ulog.c
1048 +@@ -266,7 +266,7 @@ static bool ebt_ulog_tg_check(const struct xt_tgchk_param *par)
1049 + if (uloginfo->qthreshold > EBT_ULOG_MAX_QLEN)
1050 + uloginfo->qthreshold = EBT_ULOG_MAX_QLEN;
1051 +
1052 +- return 0;
1053 ++ return true;
1054 + }
1055 +
1056 + static struct xt_target ebt_ulog_tg_reg __read_mostly = {
1057 +diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
1058 +index 3229e0a..b6ddd56 100644
1059 +--- a/net/ipv4/netfilter/nf_nat_core.c
1060 ++++ b/net/ipv4/netfilter/nf_nat_core.c
1061 +@@ -212,7 +212,7 @@ find_best_ips_proto(struct nf_conntrack_tuple *tuple,
1062 + maxip = ntohl(range->max_ip);
1063 + j = jhash_2words((__force u32)tuple->src.u3.ip,
1064 + range->flags & IP_NAT_RANGE_PERSISTENT ?
1065 +- (__force u32)tuple->dst.u3.ip : 0, 0);
1066 ++ 0 : (__force u32)tuple->dst.u3.ip, 0);
1067 + j = ((u64)j * (maxip - minip + 1)) >> 32;
1068 + *var_ipp = htonl(minip + j);
1069 + }
1070 +diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
1071 +index f546e81..854d14b 100644
1072 +--- a/net/packet/af_packet.c
1073 ++++ b/net/packet/af_packet.c
1074 +@@ -1501,7 +1501,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
1075 + static int packet_getsockopt(struct socket *sock, int level, int optname,
1076 + char __user *optval, int __user *optlen)
1077 + {
1078 +- int len;
1079 ++ unsigned int len;
1080 + int val;
1081 + struct sock *sk = sock->sk;
1082 + struct packet_sock *po = pkt_sk(sk);
1083 +@@ -1514,7 +1514,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
1084 + if (get_user(len, optlen))
1085 + return -EFAULT;
1086 +
1087 +- if (len < 0)
1088 ++ if ((int)len < 0)
1089 + return -EINVAL;
1090 +
1091 + switch(optname) {
1092 +diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
1093 +index 6654cbe..b187edc 100644
1094 +--- a/scripts/kallsyms.c
1095 ++++ b/scripts/kallsyms.c
1096 +@@ -539,7 +539,7 @@ static int prefix_underscores_count(const char *str)
1097 + {
1098 + const char *tail = str;
1099 +
1100 +- while (*tail != '_')
1101 ++ while (*tail == '_')
1102 + tail++;
1103 +
1104 + return tail - str;