aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/tmpfs.txt9
-rw-r--r--arch/i386/kernel/Makefile2
-rw-r--r--arch/i386/kernel/cpu/common.c32
-rw-r--r--arch/i386/kernel/efi.c12
-rw-r--r--arch/i386/kernel/head.S2
-rw-r--r--arch/i386/kernel/i386_ksyms.c2
-rw-r--r--arch/i386/kernel/kprobes.c16
-rw-r--r--arch/i386/kernel/smpboot.c6
-rw-r--r--arch/i386/kernel/topology.c (renamed from arch/i386/mach-default/topology.c)6
-rw-r--r--arch/i386/mach-default/Makefile2
-rw-r--r--arch/i386/mach-voyager/voyager_basic.c15
-rw-r--r--arch/i386/mach-voyager/voyager_smp.c1
-rw-r--r--arch/m32r/Makefile6
-rw-r--r--arch/m32r/kernel/signal.c24
-rw-r--r--arch/m32r/lib/usercopy.c4
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/powerpc/kernel/prom.c54
-rw-r--r--arch/s390/kernel/compat_wrapper.S1
-rw-r--r--arch/um/drivers/cow.h2
-rw-r--r--arch/um/drivers/cow_sys.h6
-rw-r--r--arch/um/drivers/cow_user.c24
-rw-r--r--arch/um/drivers/net_user.c34
-rw-r--r--arch/um/drivers/ubd_kern.c2
-rw-r--r--arch/um/include/init.h2
-rw-r--r--arch/um/include/os.h3
-rw-r--r--arch/um/os-Linux/file.c19
-rw-r--r--arch/um/os-Linux/process.c16
-rw-r--r--arch/um/sys-i386/ldt.c9
-rw-r--r--drivers/md/dm.c8
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c1
-rw-r--r--drivers/video/Kconfig2
-rw-r--r--drivers/video/asiliantfb.c21
-rw-r--r--drivers/video/au1100fb.c3
-rw-r--r--drivers/video/console/vgacon.c67
-rw-r--r--drivers/video/gbefb.c3
-rw-r--r--fs/namei.c8
-rw-r--r--fs/ramfs/inode.c2
-rw-r--r--include/asm-i386/desc.h6
-rw-r--r--include/asm-i386/kprobes.h7
-rw-r--r--include/asm-m32r/uaccess.h8
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--mm/mempolicy.c22
-rw-r--r--mm/vmscan.c10
-rw-r--r--net/ipv6/ip6_output.c15
-rw-r--r--net/ipv6/ip6_tunnel.c1
-rw-r--r--sound/drivers/opl3/opl3_oss.c2
-rw-r--r--sound/isa/cs423x/cs4236.c2
47 files changed, 333 insertions, 170 deletions
diff --git a/Documentation/filesystems/tmpfs.txt b/Documentation/filesystems/tmpfs.txt
index 8a155418c705..1773106976a2 100644
--- a/Documentation/filesystems/tmpfs.txt
+++ b/Documentation/filesystems/tmpfs.txt
@@ -92,6 +92,15 @@ NodeList format is a comma-separated list of decimal numbers and ranges,
92a range being two hyphen-separated decimal numbers, the smallest and 92a range being two hyphen-separated decimal numbers, the smallest and
93largest node numbers in the range. For example, mpol=bind:0-3,5,7,9-15 93largest node numbers in the range. For example, mpol=bind:0-3,5,7,9-15
94 94
95Note that trying to mount a tmpfs with an mpol option will fail if the
96running kernel does not support NUMA; and will fail if its nodelist
97specifies a node >= MAX_NUMNODES. If your system relies on that tmpfs
98being mounted, but from time to time runs a kernel built without NUMA
99capability (perhaps a safe recovery kernel), or configured to support
100fewer nodes, then it is advisable to omit the mpol option from automatic
101mount options. It can be added later, when the tmpfs is already mounted
102on MountPoint, by 'mount -o remount,mpol=Policy:NodeList MountPoint'.
103
95 104
96To specify the initial root directory you can use the following mount 105To specify the initial root directory you can use the following mount
97options: 106options:
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index 60c3f76dfca4..53bb9a79e274 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -7,7 +7,7 @@ extra-y := head.o init_task.o vmlinux.lds
7obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ 7obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \
8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \ 8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
9 pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \ 9 pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \
10 quirks.o i8237.o 10 quirks.o i8237.o topology.o
11 11
12obj-y += cpu/ 12obj-y += cpu/
13obj-y += timers/ 13obj-y += timers/
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 7eb9213734a3..4ecd4b326ded 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -4,6 +4,7 @@
4#include <linux/smp.h> 4#include <linux/smp.h>
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/percpu.h> 6#include <linux/percpu.h>
7#include <linux/bootmem.h>
7#include <asm/semaphore.h> 8#include <asm/semaphore.h>
8#include <asm/processor.h> 9#include <asm/processor.h>
9#include <asm/i387.h> 10#include <asm/i387.h>
@@ -18,6 +19,9 @@
18 19
19#include "cpu.h" 20#include "cpu.h"
20 21
22DEFINE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr);
23EXPORT_PER_CPU_SYMBOL(cpu_gdt_descr);
24
21DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); 25DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]);
22EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack); 26EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack);
23 27
@@ -571,8 +575,9 @@ void __devinit cpu_init(void)
571 int cpu = smp_processor_id(); 575 int cpu = smp_processor_id();
572 struct tss_struct * t = &per_cpu(init_tss, cpu); 576 struct tss_struct * t = &per_cpu(init_tss, cpu);
573 struct thread_struct *thread = &current->thread; 577 struct thread_struct *thread = &current->thread;
574 struct desc_struct *gdt = get_cpu_gdt_table(cpu); 578 struct desc_struct *gdt;
575 __u32 stk16_off = (__u32)&per_cpu(cpu_16bit_stack, cpu); 579 __u32 stk16_off = (__u32)&per_cpu(cpu_16bit_stack, cpu);
580 struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu);
576 581
577 if (cpu_test_and_set(cpu, cpu_initialized)) { 582 if (cpu_test_and_set(cpu, cpu_initialized)) {
578 printk(KERN_WARNING "CPU#%d already initialized!\n", cpu); 583 printk(KERN_WARNING "CPU#%d already initialized!\n", cpu);
@@ -590,6 +595,25 @@ void __devinit cpu_init(void)
590 } 595 }
591 596
592 /* 597 /*
598 * This is a horrible hack to allocate the GDT. The problem
599 * is that cpu_init() is called really early for the boot CPU
600 * (and hence needs bootmem) but much later for the secondary
601 * CPUs, when bootmem will have gone away
602 */
603 if (NODE_DATA(0)->bdata->node_bootmem_map) {
604 gdt = (struct desc_struct *)alloc_bootmem_pages(PAGE_SIZE);
605 /* alloc_bootmem_pages panics on failure, so no check */
606 memset(gdt, 0, PAGE_SIZE);
607 } else {
608 gdt = (struct desc_struct *)get_zeroed_page(GFP_KERNEL);
609 if (unlikely(!gdt)) {
610 printk(KERN_CRIT "CPU%d failed to allocate GDT\n", cpu);
611 for (;;)
612 local_irq_enable();
613 }
614 }
615
616 /*
593 * Initialize the per-CPU GDT with the boot GDT, 617 * Initialize the per-CPU GDT with the boot GDT,
594 * and set up the GDT descriptor: 618 * and set up the GDT descriptor:
595 */ 619 */
@@ -601,10 +625,10 @@ void __devinit cpu_init(void)
601 ((((__u64)stk16_off) << 32) & 0xff00000000000000ULL) | 625 ((((__u64)stk16_off) << 32) & 0xff00000000000000ULL) |
602 (CPU_16BIT_STACK_SIZE - 1); 626 (CPU_16BIT_STACK_SIZE - 1);
603 627
604 cpu_gdt_descr[cpu].size = GDT_SIZE - 1; 628 cpu_gdt_descr->size = GDT_SIZE - 1;
605 cpu_gdt_descr[cpu].address = (unsigned long)gdt; 629 cpu_gdt_descr->address = (unsigned long)gdt;
606 630
607 load_gdt(&cpu_gdt_descr[cpu]); 631 load_gdt(cpu_gdt_descr);
608 load_idt(&idt_descr); 632 load_idt(&idt_descr);
609 633
610 /* 634 /*
diff --git a/arch/i386/kernel/efi.c b/arch/i386/kernel/efi.c
index ecad519fd395..e3e42fd62401 100644
--- a/arch/i386/kernel/efi.c
+++ b/arch/i386/kernel/efi.c
@@ -103,17 +103,19 @@ static void efi_call_phys_prelog(void)
103 */ 103 */
104 local_flush_tlb(); 104 local_flush_tlb();
105 105
106 cpu_gdt_descr[0].address = __pa(cpu_gdt_descr[0].address); 106 per_cpu(cpu_gdt_descr, 0).address =
107 load_gdt((struct Xgt_desc_struct *) __pa(&cpu_gdt_descr[0])); 107 __pa(per_cpu(cpu_gdt_descr, 0).address);
108 load_gdt((struct Xgt_desc_struct *)__pa(&per_cpu(cpu_gdt_descr, 0)));
108} 109}
109 110
110static void efi_call_phys_epilog(void) 111static void efi_call_phys_epilog(void)
111{ 112{
112 unsigned long cr4; 113 unsigned long cr4;
113 114
114 cpu_gdt_descr[0].address = 115 per_cpu(cpu_gdt_descr, 0).address =
115 (unsigned long) __va(cpu_gdt_descr[0].address); 116 (unsigned long)__va(per_cpu(cpu_gdt_descr, 0).address);
116 load_gdt(&cpu_gdt_descr[0]); 117 load_gdt((struct Xgt_desc_struct *)__va(&per_cpu(cpu_gdt_descr, 0)));
118
117 cr4 = read_cr4(); 119 cr4 = read_cr4();
118 120
119 if (cr4 & X86_CR4_PSE) { 121 if (cr4 & X86_CR4_PSE) {
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index 2bee6499edd9..e0b7c632efbc 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -534,5 +534,3 @@ ENTRY(cpu_gdt_table)
534 .quad 0x0000000000000000 /* 0xf0 - unused */ 534 .quad 0x0000000000000000 /* 0xf0 - unused */
535 .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */ 535 .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */
536 536
537 /* Be sure this is zeroed to avoid false validations in Xen */
538 .fill PAGE_SIZE_asm / 8 - GDT_ENTRIES,8,0
diff --git a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
index 3999bec50c33..055325056a74 100644
--- a/arch/i386/kernel/i386_ksyms.c
+++ b/arch/i386/kernel/i386_ksyms.c
@@ -3,8 +3,6 @@
3#include <asm/checksum.h> 3#include <asm/checksum.h>
4#include <asm/desc.h> 4#include <asm/desc.h>
5 5
6EXPORT_SYMBOL_GPL(cpu_gdt_descr);
7
8EXPORT_SYMBOL(__down_failed); 6EXPORT_SYMBOL(__down_failed);
9EXPORT_SYMBOL(__down_failed_interruptible); 7EXPORT_SYMBOL(__down_failed_interruptible);
10EXPORT_SYMBOL(__down_failed_trylock); 8EXPORT_SYMBOL(__down_failed_trylock);
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index 6483eeb1a4e8..694a13997637 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -58,6 +58,11 @@ static inline int is_IF_modifier(kprobe_opcode_t opcode)
58 58
59int __kprobes arch_prepare_kprobe(struct kprobe *p) 59int __kprobes arch_prepare_kprobe(struct kprobe *p)
60{ 60{
61 /* insn: must be on special executable page on i386. */
62 p->ainsn.insn = get_insn_slot();
63 if (!p->ainsn.insn)
64 return -ENOMEM;
65
61 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); 66 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
62 p->opcode = *p->addr; 67 p->opcode = *p->addr;
63 return 0; 68 return 0;
@@ -77,6 +82,13 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
77 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 82 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
78} 83}
79 84
85void __kprobes arch_remove_kprobe(struct kprobe *p)
86{
87 down(&kprobe_mutex);
88 free_insn_slot(p->ainsn.insn);
89 up(&kprobe_mutex);
90}
91
80static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) 92static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
81{ 93{
82 kcb->prev_kprobe.kp = kprobe_running(); 94 kcb->prev_kprobe.kp = kprobe_running();
@@ -111,7 +123,7 @@ static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
111 if (p->opcode == BREAKPOINT_INSTRUCTION) 123 if (p->opcode == BREAKPOINT_INSTRUCTION)
112 regs->eip = (unsigned long)p->addr; 124 regs->eip = (unsigned long)p->addr;
113 else 125 else
114 regs->eip = (unsigned long)&p->ainsn.insn; 126 regs->eip = (unsigned long)p->ainsn.insn;
115} 127}
116 128
117/* Called with kretprobe_lock held */ 129/* Called with kretprobe_lock held */
@@ -351,7 +363,7 @@ static void __kprobes resume_execution(struct kprobe *p,
351{ 363{
352 unsigned long *tos = (unsigned long *)&regs->esp; 364 unsigned long *tos = (unsigned long *)&regs->esp;
353 unsigned long next_eip = 0; 365 unsigned long next_eip = 0;
354 unsigned long copy_eip = (unsigned long)&p->ainsn.insn; 366 unsigned long copy_eip = (unsigned long)p->ainsn.insn;
355 unsigned long orig_eip = (unsigned long)p->addr; 367 unsigned long orig_eip = (unsigned long)p->addr;
356 368
357 switch (p->ainsn.insn[0]) { 369 switch (p->ainsn.insn[0]) {
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index fb00ab7b7612..eba7f53f8b4a 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -898,12 +898,6 @@ static int __devinit do_boot_cpu(int apicid, int cpu)
898 unsigned long start_eip; 898 unsigned long start_eip;
899 unsigned short nmi_high = 0, nmi_low = 0; 899 unsigned short nmi_high = 0, nmi_low = 0;
900 900
901 if (!cpu_gdt_descr[cpu].address &&
902 !(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) {
903 printk("Failed to allocate GDT for CPU %d\n", cpu);
904 return 1;
905 }
906
907 ++cpucount; 901 ++cpucount;
908 902
909 /* 903 /*
diff --git a/arch/i386/mach-default/topology.c b/arch/i386/kernel/topology.c
index b64314069e78..67a0e1baa28b 100644
--- a/arch/i386/mach-default/topology.c
+++ b/arch/i386/kernel/topology.c
@@ -1,12 +1,12 @@
1/* 1/*
2 * arch/i386/mach-generic/topology.c - Populate driverfs with topology information 2 * arch/i386/kernel/topology.c - Populate driverfs with topology information
3 * 3 *
4 * Written by: Matthew Dobson, IBM Corporation 4 * Written by: Matthew Dobson, IBM Corporation
5 * Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL 5 * Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL
6 * 6 *
7 * Copyright (C) 2002, IBM Corp. 7 * Copyright (C) 2002, IBM Corp.
8 * 8 *
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ static struct i386_cpu cpu_devices[NR_CPUS];
34 34
35int arch_register_cpu(int num){ 35int arch_register_cpu(int num){
36 struct node *parent = NULL; 36 struct node *parent = NULL;
37 37
38#ifdef CONFIG_NUMA 38#ifdef CONFIG_NUMA
39 int node = cpu_to_node(num); 39 int node = cpu_to_node(num);
40 if (node_online(node)) 40 if (node_online(node))
diff --git a/arch/i386/mach-default/Makefile b/arch/i386/mach-default/Makefile
index e95bb0237921..012fe34459e6 100644
--- a/arch/i386/mach-default/Makefile
+++ b/arch/i386/mach-default/Makefile
@@ -2,4 +2,4 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := setup.o topology.o 5obj-y := setup.o
diff --git a/arch/i386/mach-voyager/voyager_basic.c b/arch/i386/mach-voyager/voyager_basic.c
index aa49a33a572c..6761d294f260 100644
--- a/arch/i386/mach-voyager/voyager_basic.c
+++ b/arch/i386/mach-voyager/voyager_basic.c
@@ -23,6 +23,9 @@
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/reboot.h> 24#include <linux/reboot.h>
25#include <linux/sysrq.h> 25#include <linux/sysrq.h>
26#include <linux/smp.h>
27#include <linux/nodemask.h>
28#include <asm/cpu.h>
26#include <asm/io.h> 29#include <asm/io.h>
27#include <asm/voyager.h> 30#include <asm/voyager.h>
28#include <asm/vic.h> 31#include <asm/vic.h>
@@ -329,3 +332,15 @@ void machine_power_off(void)
329 pm_power_off(); 332 pm_power_off();
330} 333}
331 334
335static struct i386_cpu cpu_devices[NR_CPUS];
336
337static int __init topology_init(void)
338{
339 int i;
340
341 for_each_present_cpu(i)
342 register_cpu(&cpu_devices[i].cpu, i, NULL);
343 return 0;
344}
345
346subsys_initcall(topology_init);
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
index 6e4c3baef6cc..8165626a5c30 100644
--- a/arch/i386/mach-voyager/voyager_smp.c
+++ b/arch/i386/mach-voyager/voyager_smp.c
@@ -402,6 +402,7 @@ find_smp_config(void)
402 cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8; 402 cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8;
403 cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 2) << 16; 403 cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 2) << 16;
404 cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 3) << 24; 404 cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 3) << 24;
405 cpu_possible_map = phys_cpu_present_map;
405 printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", cpus_addr(phys_cpu_present_map)[0]); 406 printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", cpus_addr(phys_cpu_present_map)[0]);
406 /* Here we set up the VIC to enable SMP */ 407 /* Here we set up the VIC to enable SMP */
407 /* enable the CPIs by writing the base vector to their register */ 408 /* enable the CPIs by writing the base vector to their register */
diff --git a/arch/m32r/Makefile b/arch/m32r/Makefile
index 983d438b14b6..4b3c90ba926c 100644
--- a/arch/m32r/Makefile
+++ b/arch/m32r/Makefile
@@ -12,14 +12,14 @@ CFLAGS_MODULE += -mmodel=large
12 12
13ifdef CONFIG_CHIP_VDEC2 13ifdef CONFIG_CHIP_VDEC2
14cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst 14cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst
15aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst 15aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -O2 -Wa,-bitinst -Wa,-no-parallel
16else 16else
17cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 17cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2
18aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 18aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 -O2
19endif 19endif
20 20
21cflags-$(CONFIG_ISA_M32R) += -DNO_FPU 21cflags-$(CONFIG_ISA_M32R) += -DNO_FPU
22aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -Wa,-no-bitinst 22aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -O2 -Wa,-no-bitinst
23 23
24CFLAGS += $(cflags-y) 24CFLAGS += $(cflags-y)
25AFLAGS += $(aflags-y) 25AFLAGS += $(aflags-y)
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c
index 71763f7a1d19..cb33097fefc4 100644
--- a/arch/m32r/kernel/signal.c
+++ b/arch/m32r/kernel/signal.c
@@ -36,7 +36,7 @@ int do_signal(struct pt_regs *, sigset_t *);
36asmlinkage int 36asmlinkage int
37sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, 37sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
38 unsigned long r2, unsigned long r3, unsigned long r4, 38 unsigned long r2, unsigned long r3, unsigned long r4,
39 unsigned long r5, unsigned long r6, struct pt_regs regs) 39 unsigned long r5, unsigned long r6, struct pt_regs *regs)
40{ 40{
41 sigset_t saveset, newset; 41 sigset_t saveset, newset;
42 42
@@ -54,21 +54,21 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
54 recalc_sigpending(); 54 recalc_sigpending();
55 spin_unlock_irq(&current->sighand->siglock); 55 spin_unlock_irq(&current->sighand->siglock);
56 56
57 regs.r0 = -EINTR; 57 regs->r0 = -EINTR;
58 while (1) { 58 while (1) {
59 current->state = TASK_INTERRUPTIBLE; 59 current->state = TASK_INTERRUPTIBLE;
60 schedule(); 60 schedule();
61 if (do_signal(&regs, &saveset)) 61 if (do_signal(regs, &saveset))
62 return regs.r0; 62 return regs->r0;
63 } 63 }
64} 64}
65 65
66asmlinkage int 66asmlinkage int
67sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, 67sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
68 unsigned long r2, unsigned long r3, unsigned long r4, 68 unsigned long r2, unsigned long r3, unsigned long r4,
69 unsigned long r5, unsigned long r6, struct pt_regs regs) 69 unsigned long r5, unsigned long r6, struct pt_regs *regs)
70{ 70{
71 return do_sigaltstack(uss, uoss, regs.spu); 71 return do_sigaltstack(uss, uoss, regs->spu);
72} 72}
73 73
74 74
@@ -140,11 +140,10 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
140asmlinkage int 140asmlinkage int
141sys_rt_sigreturn(unsigned long r0, unsigned long r1, 141sys_rt_sigreturn(unsigned long r0, unsigned long r1,
142 unsigned long r2, unsigned long r3, unsigned long r4, 142 unsigned long r2, unsigned long r3, unsigned long r4,
143 unsigned long r5, unsigned long r6, struct pt_regs regs) 143 unsigned long r5, unsigned long r6, struct pt_regs *regs)
144{ 144{
145 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs.spu; 145 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->spu;
146 sigset_t set; 146 sigset_t set;
147 stack_t st;
148 int result; 147 int result;
149 148
150 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 149 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -158,14 +157,11 @@ sys_rt_sigreturn(unsigned long r0, unsigned long r1,
158 recalc_sigpending(); 157 recalc_sigpending();
159 spin_unlock_irq(&current->sighand->siglock); 158 spin_unlock_irq(&current->sighand->siglock);
160 159
161 if (restore_sigcontext(&regs, &frame->uc.uc_mcontext, &result)) 160 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &result))
162 goto badframe; 161 goto badframe;
163 162
164 if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st))) 163 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->spu) == -EFAULT)
165 goto badframe; 164 goto badframe;
166 /* It is more difficult to avoid calling this function than to
167 call it and ignore errors. */
168 do_sigaltstack(&st, NULL, regs.spu);
169 165
170 return result; 166 return result;
171 167
diff --git a/arch/m32r/lib/usercopy.c b/arch/m32r/lib/usercopy.c
index ce16bbe26a52..2d1dd2106c4d 100644
--- a/arch/m32r/lib/usercopy.c
+++ b/arch/m32r/lib/usercopy.c
@@ -64,7 +64,7 @@ do { \
64 " .balign 4\n" \ 64 " .balign 4\n" \
65 " .long 0b,3b\n" \ 65 " .long 0b,3b\n" \
66 ".previous" \ 66 ".previous" \
67 : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ 67 : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
68 "=&r" (__d2) \ 68 "=&r" (__d2) \
69 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ 69 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \
70 "4"(dst) \ 70 "4"(dst) \
@@ -101,7 +101,7 @@ do { \
101 " .balign 4\n" \ 101 " .balign 4\n" \
102 " .long 0b,3b\n" \ 102 " .long 0b,3b\n" \
103 ".previous" \ 103 ".previous" \
104 : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ 104 : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
105 "=&r" (__d2) \ 105 "=&r" (__d2) \
106 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ 106 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \
107 "4"(dst) \ 107 "4"(dst) \
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index d83e033dbc87..2f2dc54b2e26 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -626,7 +626,7 @@ einval: li v0, -EINVAL
626 sys sys_fstatat64 4 626 sys sys_fstatat64 4
627 sys sys_unlinkat 3 627 sys sys_unlinkat 3
628 sys sys_renameat 4 /* 4295 */ 628 sys sys_renameat 4 /* 4295 */
629 sys sys_linkat 4 629 sys sys_linkat 5
630 sys sys_symlinkat 3 630 sys sys_symlinkat 3
631 sys sys_readlinkat 4 631 sys sys_readlinkat 4
632 sys sys_fchmodat 3 632 sys sys_fchmodat 3
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 294832a7e0a6..6dbd21726770 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -816,8 +816,6 @@ void __init unflatten_device_tree(void)
816{ 816{
817 unsigned long start, mem, size; 817 unsigned long start, mem, size;
818 struct device_node **allnextp = &allnodes; 818 struct device_node **allnextp = &allnodes;
819 char *p = NULL;
820 int l = 0;
821 819
822 DBG(" -> unflatten_device_tree()\n"); 820 DBG(" -> unflatten_device_tree()\n");
823 821
@@ -857,19 +855,6 @@ void __init unflatten_device_tree(void)
857 if (of_chosen == NULL) 855 if (of_chosen == NULL)
858 of_chosen = of_find_node_by_path("/chosen@0"); 856 of_chosen = of_find_node_by_path("/chosen@0");
859 857
860 /* Retreive command line */
861 if (of_chosen != NULL) {
862 p = (char *)get_property(of_chosen, "bootargs", &l);
863 if (p != NULL && l > 0)
864 strlcpy(cmd_line, p, min(l, COMMAND_LINE_SIZE));
865 }
866#ifdef CONFIG_CMDLINE
867 if (l == 0 || (l == 1 && (*p) == 0))
868 strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
869#endif /* CONFIG_CMDLINE */
870
871 DBG("Command line is: %s\n", cmd_line);
872
873 DBG(" <- unflatten_device_tree()\n"); 858 DBG(" <- unflatten_device_tree()\n");
874} 859}
875 860
@@ -940,6 +925,8 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
940{ 925{
941 u32 *prop; 926 u32 *prop;
942 unsigned long *lprop; 927 unsigned long *lprop;
928 unsigned long l;
929 char *p;
943 930
944 DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname); 931 DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
945 932
@@ -1004,6 +991,41 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1004 crashk_res.end = crashk_res.start + *lprop - 1; 991 crashk_res.end = crashk_res.start + *lprop - 1;
1005#endif 992#endif
1006 993
994 /* Retreive command line */
995 p = of_get_flat_dt_prop(node, "bootargs", &l);
996 if (p != NULL && l > 0)
997 strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
998
999#ifdef CONFIG_CMDLINE
1000 if (l == 0 || (l == 1 && (*p) == 0))
1001 strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1002#endif /* CONFIG_CMDLINE */
1003
1004 DBG("Command line is: %s\n", cmd_line);
1005
1006 if (strstr(cmd_line, "mem=")) {
1007 char *p, *q;
1008 unsigned long maxmem = 0;
1009
1010 for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
1011 q = p + 4;
1012 if (p > cmd_line && p[-1] != ' ')
1013 continue;
1014 maxmem = simple_strtoul(q, &q, 0);
1015 if (*q == 'k' || *q == 'K') {
1016 maxmem <<= 10;
1017 ++q;
1018 } else if (*q == 'm' || *q == 'M') {
1019 maxmem <<= 20;
1020 ++q;
1021 } else if (*q == 'g' || *q == 'G') {
1022 maxmem <<= 30;
1023 ++q;
1024 }
1025 }
1026 memory_limit = maxmem;
1027 }
1028
1007 /* break now */ 1029 /* break now */
1008 return 1; 1030 return 1;
1009} 1031}
@@ -1124,7 +1146,7 @@ static void __init early_reserve_mem(void)
1124 size_32 = *(reserve_map_32++); 1146 size_32 = *(reserve_map_32++);
1125 if (size_32 == 0) 1147 if (size_32 == 0)
1126 break; 1148 break;
1127 DBG("reserving: %lx -> %lx\n", base_32, size_32); 1149 DBG("reserving: %x -> %x\n", base_32, size_32);
1128 lmb_reserve(base_32, size_32); 1150 lmb_reserve(base_32, size_32);
1129 } 1151 }
1130 return; 1152 return;
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 615964cca15f..50e80138e7ad 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1552,6 +1552,7 @@ sys_linkat_wrapper:
1552 llgtr %r3,%r3 # const char * 1552 llgtr %r3,%r3 # const char *
1553 lgfr %r4,%r4 # int 1553 lgfr %r4,%r4 # int
1554 llgtr %r5,%r5 # const char * 1554 llgtr %r5,%r5 # const char *
1555 lgfr %r6,%r6 # int
1555 jg sys_linkat 1556 jg sys_linkat
1556 1557
1557 .globl sys_symlinkat_wrapper 1558 .globl sys_symlinkat_wrapper
diff --git a/arch/um/drivers/cow.h b/arch/um/drivers/cow.h
index dc36b222100b..04e3958266e0 100644
--- a/arch/um/drivers/cow.h
+++ b/arch/um/drivers/cow.h
@@ -46,7 +46,7 @@ extern int file_reader(__u64 offset, char *buf, int len, void *arg);
46extern int read_cow_header(int (*reader)(__u64, char *, int, void *), 46extern int read_cow_header(int (*reader)(__u64, char *, int, void *),
47 void *arg, __u32 *version_out, 47 void *arg, __u32 *version_out,
48 char **backing_file_out, time_t *mtime_out, 48 char **backing_file_out, time_t *mtime_out,
49 unsigned long long *size_out, int *sectorsize_out, 49 __u64 *size_out, int *sectorsize_out,
50 __u32 *align_out, int *bitmap_offset_out); 50 __u32 *align_out, int *bitmap_offset_out);
51 51
52extern int write_cow_header(char *cow_file, int fd, char *backing_file, 52extern int write_cow_header(char *cow_file, int fd, char *backing_file,
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h
index c83fc5d68936..94de4ead4f7a 100644
--- a/arch/um/drivers/cow_sys.h
+++ b/arch/um/drivers/cow_sys.h
@@ -23,17 +23,17 @@ static inline char *cow_strdup(char *str)
23 return(uml_strdup(str)); 23 return(uml_strdup(str));
24} 24}
25 25
26static inline int cow_seek_file(int fd, unsigned long long offset) 26static inline int cow_seek_file(int fd, __u64 offset)
27{ 27{
28 return(os_seek_file(fd, offset)); 28 return(os_seek_file(fd, offset));
29} 29}
30 30
31static inline int cow_file_size(char *file, unsigned long long *size_out) 31static inline int cow_file_size(char *file, __u64 *size_out)
32{ 32{
33 return(os_file_size(file, size_out)); 33 return(os_file_size(file, size_out));
34} 34}
35 35
36static inline int cow_write_file(int fd, char *buf, int size) 36static inline int cow_write_file(int fd, void *buf, int size)
37{ 37{
38 return(os_write_file(fd, buf, size)); 38 return(os_write_file(fd, buf, size));
39} 39}
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c
index fbe2217db5dd..61951b721268 100644
--- a/arch/um/drivers/cow_user.c
+++ b/arch/um/drivers/cow_user.c
@@ -176,7 +176,7 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
176 err = -ENOMEM; 176 err = -ENOMEM;
177 header = cow_malloc(sizeof(*header)); 177 header = cow_malloc(sizeof(*header));
178 if(header == NULL){ 178 if(header == NULL){
179 cow_printf("Failed to allocate COW V3 header\n"); 179 cow_printf("write_cow_header - failed to allocate COW V3 header\n");
180 goto out; 180 goto out;
181 } 181 }
182 header->magic = htonl(COW_MAGIC); 182 header->magic = htonl(COW_MAGIC);
@@ -196,15 +196,17 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
196 196
197 err = os_file_modtime(header->backing_file, &modtime); 197 err = os_file_modtime(header->backing_file, &modtime);
198 if(err < 0){ 198 if(err < 0){
199 cow_printf("Backing file '%s' mtime request failed, " 199 cow_printf("write_cow_header - backing file '%s' mtime "
200 "err = %d\n", header->backing_file, -err); 200 "request failed, err = %d\n", header->backing_file,
201 -err);
201 goto out_free; 202 goto out_free;
202 } 203 }
203 204
204 err = cow_file_size(header->backing_file, size); 205 err = cow_file_size(header->backing_file, size);
205 if(err < 0){ 206 if(err < 0){
206 cow_printf("Couldn't get size of backing file '%s', " 207 cow_printf("write_cow_header - couldn't get size of "
207 "err = %d\n", header->backing_file, -err); 208 "backing file '%s', err = %d\n",
209 header->backing_file, -err);
208 goto out_free; 210 goto out_free;
209 } 211 }
210 212
@@ -214,10 +216,11 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
214 header->alignment = htonl(alignment); 216 header->alignment = htonl(alignment);
215 header->cow_format = COW_BITMAP; 217 header->cow_format = COW_BITMAP;
216 218
217 err = os_write_file(fd, header, sizeof(*header)); 219 err = cow_write_file(fd, header, sizeof(*header));
218 if(err != sizeof(*header)){ 220 if(err != sizeof(*header)){
219 cow_printf("Write of header to new COW file '%s' failed, " 221 cow_printf("write_cow_header - write of header to "
220 "err = %d\n", cow_file, -err); 222 "new COW file '%s' failed, err = %d\n", cow_file,
223 -err);
221 goto out_free; 224 goto out_free;
222 } 225 }
223 err = 0; 226 err = 0;
@@ -299,7 +302,7 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
299 } 302 }
300 else if(version == 3){ 303 else if(version == 3){
301 if(n < sizeof(header->v3)){ 304 if(n < sizeof(header->v3)){
302 cow_printf("read_cow_header - failed to read V2 " 305 cow_printf("read_cow_header - failed to read V3 "
303 "header\n"); 306 "header\n");
304 goto out; 307 goto out;
305 } 308 }
@@ -359,7 +362,8 @@ int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize,
359 if(err != sizeof(zero)){ 362 if(err != sizeof(zero)){
360 cow_printf("Write of bitmap to new COW file '%s' failed, " 363 cow_printf("Write of bitmap to new COW file '%s' failed, "
361 "err = %d\n", cow_file, -err); 364 "err = %d\n", cow_file, -err);
362 err = -EINVAL; 365 if (err >= 0)
366 err = -EINVAL;
363 goto out; 367 goto out;
364 } 368 }
365 369
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index 098fa65981ab..0e2f06187ea7 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -47,10 +47,12 @@ void tap_check_ips(char *gate_addr, unsigned char *eth_addr)
47 } 47 }
48} 48}
49 49
50/* Do reliable error handling as this fails frequently enough. */
50void read_output(int fd, char *output, int len) 51void read_output(int fd, char *output, int len)
51{ 52{
52 int remain, n, actual; 53 int remain, ret, expected;
53 char c; 54 char c;
55 char *str;
54 56
55 if(output == NULL){ 57 if(output == NULL){
56 output = &c; 58 output = &c;
@@ -58,23 +60,31 @@ void read_output(int fd, char *output, int len)
58 } 60 }
59 61
60 *output = '\0'; 62 *output = '\0';
61 n = os_read_file(fd, &remain, sizeof(remain)); 63 ret = os_read_file(fd, &remain, sizeof(remain));
62 if(n != sizeof(remain)){ 64
63 printk("read_output - read of length failed, err = %d\n", -n); 65 if (ret != sizeof(remain)) {
64 return; 66 expected = sizeof(remain);
67 str = "length";
68 goto err;
65 } 69 }
66 70
67 while(remain != 0){ 71 while(remain != 0){
68 n = (remain < len) ? remain : len; 72 expected = (remain < len) ? remain : len;
69 actual = os_read_file(fd, output, n); 73 ret = os_read_file(fd, output, expected);
70 if(actual != n){ 74 if (ret != expected) {
71 printk("read_output - read of data failed, " 75 str = "data";
72 "err = %d\n", -actual); 76 goto err;
73 return;
74 } 77 }
75 remain -= actual; 78 remain -= ret;
76 } 79 }
80
77 return; 81 return;
82
83err:
84 if (ret < 0)
85 printk("read_output - read of %s failed, errno = %d\n", str, -ret);
86 else
87 printk("read_output - read of %s failed, read only %d of %d bytes\n", str, ret, expected);
78} 88}
79 89
80int net_read(int fd, void *buf, int len) 90int net_read(int fd, void *buf, int len)
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 101efd26d467..fa617e0719ab 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1135,7 +1135,7 @@ static int path_requires_switch(char *from_cmdline, char *from_cow, char *cow)
1135static int backing_file_mismatch(char *file, __u64 size, time_t mtime) 1135static int backing_file_mismatch(char *file, __u64 size, time_t mtime)
1136{ 1136{
1137 unsigned long modtime; 1137 unsigned long modtime;
1138 long long actual; 1138 unsigned long long actual;
1139 int err; 1139 int err;
1140 1140
1141 err = os_file_modtime(file, &modtime); 1141 err = os_file_modtime(file, &modtime);
diff --git a/arch/um/include/init.h b/arch/um/include/init.h
index cbd79a8d213d..d4de7c0120ce 100644
--- a/arch/um/include/init.h
+++ b/arch/um/include/init.h
@@ -122,7 +122,7 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
122 122
123#define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn 123#define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn
124 124
125#define __init_call __attribute__ ((unused,__section__ (".initcall.init"))) 125#define __init_call __attribute_used__ __attribute__ ((__section__ (".initcall.init")))
126 126
127#endif 127#endif
128 128
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index eb1710b81255..2a1c64d8d0bf 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -179,8 +179,11 @@ extern void os_stop_process(int pid);
179extern void os_kill_process(int pid, int reap_child); 179extern void os_kill_process(int pid, int reap_child);
180extern void os_kill_ptraced_process(int pid, int reap_child); 180extern void os_kill_ptraced_process(int pid, int reap_child);
181extern void os_usr1_process(int pid); 181extern void os_usr1_process(int pid);
182extern long os_ptrace_ldt(long pid, long addr, long data);
183
182extern int os_getpid(void); 184extern int os_getpid(void);
183extern int os_getpgrp(void); 185extern int os_getpgrp(void);
186
184extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)); 187extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int));
185extern void init_new_thread_signals(int altstack); 188extern void init_new_thread_signals(int altstack);
186extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr); 189extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr);
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index f55773c819e6..3bd10deea280 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -272,14 +272,23 @@ int os_connect_socket(char *name)
272 snprintf(sock.sun_path, sizeof(sock.sun_path), "%s", name); 272 snprintf(sock.sun_path, sizeof(sock.sun_path), "%s", name);
273 273
274 fd = socket(AF_UNIX, SOCK_STREAM, 0); 274 fd = socket(AF_UNIX, SOCK_STREAM, 0);
275 if(fd < 0) 275 if(fd < 0) {
276 return(fd); 276 err = -errno;
277 goto out;
278 }
277 279
278 err = connect(fd, (struct sockaddr *) &sock, sizeof(sock)); 280 err = connect(fd, (struct sockaddr *) &sock, sizeof(sock));
279 if(err) 281 if(err) {
280 return(-errno); 282 err = -errno;
283 goto out_close;
284 }
281 285
282 return(fd); 286 return fd;
287
288out_close:
289 close(fd);
290out:
291 return err;
283} 292}
284 293
285void os_close_file(int fd) 294void os_close_file(int fd)
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index 7f5e2dac2a35..d261888f39c4 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -19,6 +19,7 @@
19#include "irq_user.h" 19#include "irq_user.h"
20#include "kern_util.h" 20#include "kern_util.h"
21#include "longjmp.h" 21#include "longjmp.h"
22#include "skas_ptrace.h"
22 23
23#define ARBITRARY_ADDR -1 24#define ARBITRARY_ADDR -1
24#define FAILURE_PID -1 25#define FAILURE_PID -1
@@ -100,6 +101,21 @@ void os_kill_process(int pid, int reap_child)
100 101
101} 102}
102 103
104/* This is here uniquely to have access to the userspace errno, i.e. the one
105 * used by ptrace in case of error.
106 */
107
108long os_ptrace_ldt(long pid, long addr, long data)
109{
110 int ret;
111
112 ret = ptrace(PTRACE_LDT, pid, addr, data);
113
114 if (ret < 0)
115 return -errno;
116 return ret;
117}
118
103/* Kill off a ptraced child by all means available. kill it normally first, 119/* Kill off a ptraced child by all means available. kill it normally first,
104 * then PTRACE_KILL it, then PTRACE_CONT it in case it's in a run state from 120 * then PTRACE_KILL it, then PTRACE_CONT it in case it's in a run state from
105 * which it can't exit directly. 121 * which it can't exit directly.
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 1fa09a79a10b..fe0877b3509c 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -107,7 +107,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
107 * So we need to switch child's mm into our userspace, then 107 * So we need to switch child's mm into our userspace, then
108 * later switch back. 108 * later switch back.
109 * 109 *
110 * Note: I'm unshure: should interrupts be disabled here? 110 * Note: I'm unsure: should interrupts be disabled here?
111 */ 111 */
112 if(!current->active_mm || current->active_mm == &init_mm || 112 if(!current->active_mm || current->active_mm == &init_mm ||
113 mm_idp != &current->active_mm->context.skas.id) 113 mm_idp != &current->active_mm->context.skas.id)
@@ -129,9 +129,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
129 pid = userspace_pid[cpu]; 129 pid = userspace_pid[cpu];
130 } 130 }
131 131
132 res = ptrace(PTRACE_LDT, pid, 0, (unsigned long) &ldt_op); 132 res = os_ptrace_ldt(pid, 0, (unsigned long) &ldt_op);
133 if(res)
134 res = errno;
135 133
136 if(proc_mm) 134 if(proc_mm)
137 put_cpu(); 135 put_cpu();
@@ -181,8 +179,7 @@ static long read_ldt_from_host(void __user * ptr, unsigned long bytecount)
181 */ 179 */
182 180
183 cpu = get_cpu(); 181 cpu = get_cpu();
184 res = ptrace(PTRACE_LDT, userspace_pid[cpu], 0, 182 res = os_ptrace_ldt(userspace_pid[cpu], 0, (unsigned long) &ptrace_ldt);
185 (unsigned long) &ptrace_ldt);
186 put_cpu(); 183 put_cpu();
187 if(res < 0) 184 if(res < 0)
188 goto out; 185 goto out;
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index e9adeb9d172f..745ca1f67b14 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -849,10 +849,16 @@ static struct mapped_device *alloc_dev(unsigned int minor, int persistent)
849 849
850static void free_dev(struct mapped_device *md) 850static void free_dev(struct mapped_device *md)
851{ 851{
852 free_minor(md->disk->first_minor); 852 unsigned int minor = md->disk->first_minor;
853
854 if (md->suspended_bdev) {
855 thaw_bdev(md->suspended_bdev, NULL);
856 bdput(md->suspended_bdev);
857 }
853 mempool_destroy(md->tio_pool); 858 mempool_destroy(md->tio_pool);
854 mempool_destroy(md->io_pool); 859 mempool_destroy(md->io_pool);
855 del_gendisk(md->disk); 860 del_gendisk(md->disk);
861 free_minor(minor);
856 put_disk(md->disk); 862 put_disk(md->disk);
857 blk_put_queue(md->queue); 863 blk_put_queue(md->queue);
858 kfree(md); 864 kfree(md);
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index ded2c33f5b85..1c074d63ff3a 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -408,6 +408,7 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
408 cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp; 408 cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp;
409 cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp; 409 cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp;
410 cfi->chips[i].ref_point_counter = 0; 410 cfi->chips[i].ref_point_counter = 0;
411 init_waitqueue_head(&(cfi->chips[i].wq));
411 } 412 }
412 413
413 map->fldrv = &cfi_intelext_chipdrv; 414 map->fldrv = &cfi_intelext_chipdrv;
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index e64ed16bd42f..f5079c78ba4e 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -520,7 +520,7 @@ config FB_GBE
520config FB_GBE_MEM 520config FB_GBE_MEM
521 int "Video memory size in MB" 521 int "Video memory size in MB"
522 depends on FB_GBE 522 depends on FB_GBE
523 default 8 523 default 4
524 help 524 help
525 This is the amount of memory reserved for the framebuffer, 525 This is the amount of memory reserved for the framebuffer,
526 which can be any value between 1MB and 8MB. 526 which can be any value between 1MB and 8MB.
diff --git a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c
index 69f75547865d..c924d81f7978 100644
--- a/drivers/video/asiliantfb.c
+++ b/drivers/video/asiliantfb.c
@@ -322,32 +322,29 @@ static int asiliantfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
322 writeb(green, mmio_base + 0x791); 322 writeb(green, mmio_base + 0x791);
323 writeb(blue, mmio_base + 0x791); 323 writeb(blue, mmio_base + 0x791);
324 324
325 switch(p->var.bits_per_pixel) { 325 if (regno < 16) {
326 case 15: 326 switch(p->var.red.offset) {
327 if (regno < 16) { 327 case 10: /* RGB 555 */
328 ((u32 *)(p->pseudo_palette))[regno] = 328 ((u32 *)(p->pseudo_palette))[regno] =
329 ((red & 0xf8) << 7) | 329 ((red & 0xf8) << 7) |
330 ((green & 0xf8) << 2) | 330 ((green & 0xf8) << 2) |
331 ((blue & 0xf8) >> 3); 331 ((blue & 0xf8) >> 3);
332 } 332 break;
333 break; 333 case 11: /* RGB 565 */
334 case 16:
335 if (regno < 16) {
336 ((u32 *)(p->pseudo_palette))[regno] = 334 ((u32 *)(p->pseudo_palette))[regno] =
337 ((red & 0xf8) << 8) | 335 ((red & 0xf8) << 8) |
338 ((green & 0xfc) << 3) | 336 ((green & 0xfc) << 3) |
339 ((blue & 0xf8) >> 3); 337 ((blue & 0xf8) >> 3);
340 } 338 break;
341 break; 339 case 16: /* RGB 888 */
342 case 24:
343 if (regno < 24) {
344 ((u32 *)(p->pseudo_palette))[regno] = 340 ((u32 *)(p->pseudo_palette))[regno] =
345 (red << 16) | 341 (red << 16) |
346 (green << 8) | 342 (green << 8) |
347 (blue); 343 (blue);
344 break;
348 } 345 }
349 break;
350 } 346 }
347
351 return 0; 348 return 0;
352} 349}
353 350
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index 2406899f1207..3d04b2def0f1 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -49,6 +49,7 @@
49#include <linux/interrupt.h> 49#include <linux/interrupt.h>
50#include <linux/ctype.h> 50#include <linux/ctype.h>
51#include <linux/dma-mapping.h> 51#include <linux/dma-mapping.h>
52#include <linux/platform_device.h>
52 53
53#include <asm/mach-au1x00/au1000.h> 54#include <asm/mach-au1x00/au1000.h>
54 55
@@ -406,7 +407,7 @@ int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma)
406 407
407 vma->vm_flags |= VM_IO; 408 vma->vm_flags |= VM_IO;
408 409
409 if (io_remap_page_range(vma, vma->vm_start, off, 410 if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
410 vma->vm_end - vma->vm_start, 411 vma->vm_end - vma->vm_start,
411 vma->vm_page_prot)) { 412 vma->vm_page_prot)) {
412 return -EAGAIN; 413 return -EAGAIN;
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 12d9329d1408..5a86978537d2 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -509,57 +509,60 @@ static int vgacon_doresize(struct vc_data *c,
509{ 509{
510 unsigned long flags; 510 unsigned long flags;
511 unsigned int scanlines = height * c->vc_font.height; 511 unsigned int scanlines = height * c->vc_font.height;
512 u8 scanlines_lo, r7, vsync_end, mode, max_scan; 512 u8 scanlines_lo = 0, r7 = 0, vsync_end = 0, mode, max_scan;
513 513
514 spin_lock_irqsave(&vga_lock, flags); 514 spin_lock_irqsave(&vga_lock, flags);
515 515
516 outb_p(VGA_CRTC_MAX_SCAN, vga_video_port_reg);
517 max_scan = inb_p(vga_video_port_val);
518
519 if (max_scan & 0x80)
520 scanlines <<= 1;
521
522 vgacon_xres = width * VGA_FONTWIDTH; 516 vgacon_xres = width * VGA_FONTWIDTH;
523 vgacon_yres = height * c->vc_font.height; 517 vgacon_yres = height * c->vc_font.height;
524 outb_p(VGA_CRTC_MODE, vga_video_port_reg); 518 if (vga_video_type >= VIDEO_TYPE_VGAC) {
525 mode = inb_p(vga_video_port_val); 519 outb_p(VGA_CRTC_MAX_SCAN, vga_video_port_reg);
520 max_scan = inb_p(vga_video_port_val);
526 521
527 if (mode & 0x04) 522 if (max_scan & 0x80)
528 scanlines >>= 1; 523 scanlines <<= 1;
529 524
530 scanlines -= 1; 525 outb_p(VGA_CRTC_MODE, vga_video_port_reg);
531 scanlines_lo = scanlines & 0xff; 526 mode = inb_p(vga_video_port_val);
532 527
533 outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); 528 if (mode & 0x04)
534 r7 = inb_p(vga_video_port_val) & ~0x42; 529 scanlines >>= 1;
535 530
536 if (scanlines & 0x100) 531 scanlines -= 1;
537 r7 |= 0x02; 532 scanlines_lo = scanlines & 0xff;
538 if (scanlines & 0x200)
539 r7 |= 0x40;
540 533
541 /* deprotect registers */ 534 outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg);
542 outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); 535 r7 = inb_p(vga_video_port_val) & ~0x42;
543 vsync_end = inb_p(vga_video_port_val); 536
544 outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); 537 if (scanlines & 0x100)
545 outb_p(vsync_end & ~0x80, vga_video_port_val); 538 r7 |= 0x02;
539 if (scanlines & 0x200)
540 r7 |= 0x40;
541
542 /* deprotect registers */
543 outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg);
544 vsync_end = inb_p(vga_video_port_val);
545 outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg);
546 outb_p(vsync_end & ~0x80, vga_video_port_val);
547 }
546 548
547 outb_p(VGA_CRTC_H_DISP, vga_video_port_reg); 549 outb_p(VGA_CRTC_H_DISP, vga_video_port_reg);
548 outb_p(width - 1, vga_video_port_val); 550 outb_p(width - 1, vga_video_port_val);
549 outb_p(VGA_CRTC_OFFSET, vga_video_port_reg); 551 outb_p(VGA_CRTC_OFFSET, vga_video_port_reg);
550 outb_p(width >> 1, vga_video_port_val); 552 outb_p(width >> 1, vga_video_port_val);
551 553
552 outb_p(VGA_CRTC_V_DISP_END, vga_video_port_reg); 554 if (vga_video_type >= VIDEO_TYPE_VGAC) {
553 outb_p(scanlines_lo, vga_video_port_val); 555 outb_p(VGA_CRTC_V_DISP_END, vga_video_port_reg);
554 outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); 556 outb_p(scanlines_lo, vga_video_port_val);
555 outb_p(r7,vga_video_port_val); 557 outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg);
558 outb_p(r7,vga_video_port_val);
556 559
557 /* reprotect registers */ 560 /* reprotect registers */
558 outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); 561 outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg);
559 outb_p(vsync_end, vga_video_port_val); 562 outb_p(vsync_end, vga_video_port_val);
563 }
560 564
561 spin_unlock_irqrestore(&vga_lock, flags); 565 spin_unlock_irqrestore(&vga_lock, flags);
562
563 return 0; 566 return 0;
564} 567}
565 568
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c
index c9a7cdf6d543..5e25b9860196 100644
--- a/drivers/video/gbefb.c
+++ b/drivers/video/gbefb.c
@@ -656,12 +656,15 @@ static int gbefb_set_par(struct fb_info *info)
656 switch (bytesPerPixel) { 656 switch (bytesPerPixel) {
657 case 1: 657 case 1:
658 SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_I8); 658 SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_I8);
659 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
659 break; 660 break;
660 case 2: 661 case 2:
661 SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_ARGB5); 662 SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_ARGB5);
663 info->fix.visual = FB_VISUAL_TRUECOLOR;
662 break; 664 break;
663 case 4: 665 case 4:
664 SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_RGB8); 666 SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_RGB8);
667 info->fix.visual = FB_VISUAL_TRUECOLOR;
665 break; 668 break;
666 } 669 }
667 SET_GBE_FIELD(WID, BUF, val, GBE_BMODE_BOTH); 670 SET_GBE_FIELD(WID, BUF, val, GBE_BMODE_BOTH);
diff --git a/fs/namei.c b/fs/namei.c
index e28de846c591..557dcf395ca1 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2224,13 +2224,17 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
2224 * and other special files. --ADM 2224 * and other special files. --ADM
2225 */ 2225 */
2226asmlinkage long sys_linkat(int olddfd, const char __user *oldname, 2226asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
2227 int newdfd, const char __user *newname) 2227 int newdfd, const char __user *newname,
2228 int flags)
2228{ 2229{
2229 struct dentry *new_dentry; 2230 struct dentry *new_dentry;
2230 struct nameidata nd, old_nd; 2231 struct nameidata nd, old_nd;
2231 int error; 2232 int error;
2232 char * to; 2233 char * to;
2233 2234
2235 if (flags != 0)
2236 return -EINVAL;
2237
2234 to = getname(newname); 2238 to = getname(newname);
2235 if (IS_ERR(to)) 2239 if (IS_ERR(to))
2236 return PTR_ERR(to); 2240 return PTR_ERR(to);
@@ -2263,7 +2267,7 @@ exit:
2263 2267
2264asmlinkage long sys_link(const char __user *oldname, const char __user *newname) 2268asmlinkage long sys_link(const char __user *oldname, const char __user *newname)
2265{ 2269{
2266 return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname); 2270 return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
2267} 2271}
2268 2272
2269/* 2273/*
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index c66bd5e4c05c..cde5d48994ae 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -27,6 +27,7 @@
27#include <linux/fs.h> 27#include <linux/fs.h>
28#include <linux/pagemap.h> 28#include <linux/pagemap.h>
29#include <linux/highmem.h> 29#include <linux/highmem.h>
30#include <linux/time.h>
30#include <linux/init.h> 31#include <linux/init.h>
31#include <linux/string.h> 32#include <linux/string.h>
32#include <linux/smp_lock.h> 33#include <linux/smp_lock.h>
@@ -104,6 +105,7 @@ ramfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
104 d_instantiate(dentry, inode); 105 d_instantiate(dentry, inode);
105 dget(dentry); /* Extra count - pin the dentry in core */ 106 dget(dentry); /* Extra count - pin the dentry in core */
106 error = 0; 107 error = 0;
108 dir->i_mtime = dir->i_ctime = CURRENT_TIME;
107 } 109 }
108 return error; 110 return error;
109} 111}
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index 494e73bca095..89b8b82c82b3 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -24,11 +24,13 @@ struct Xgt_desc_struct {
24 unsigned short pad; 24 unsigned short pad;
25} __attribute__ ((packed)); 25} __attribute__ ((packed));
26 26
27extern struct Xgt_desc_struct idt_descr, cpu_gdt_descr[NR_CPUS]; 27extern struct Xgt_desc_struct idt_descr;
28DECLARE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr);
29
28 30
29static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu) 31static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
30{ 32{
31 return ((struct desc_struct *)cpu_gdt_descr[cpu].address); 33 return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address;
32} 34}
33 35
34#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) 36#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8))
diff --git a/include/asm-i386/kprobes.h b/include/asm-i386/kprobes.h
index 27cac050a60e..a0d2d74a7dda 100644
--- a/include/asm-i386/kprobes.h
+++ b/include/asm-i386/kprobes.h
@@ -27,6 +27,9 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/ptrace.h> 28#include <linux/ptrace.h>
29 29
30#define __ARCH_WANT_KPROBES_INSN_SLOT
31
32struct kprobe;
30struct pt_regs; 33struct pt_regs;
31 34
32typedef u8 kprobe_opcode_t; 35typedef u8 kprobe_opcode_t;
@@ -40,14 +43,14 @@ typedef u8 kprobe_opcode_t;
40 43
41#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry 44#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
42#define ARCH_SUPPORTS_KRETPROBES 45#define ARCH_SUPPORTS_KRETPROBES
43#define arch_remove_kprobe(p) do {} while (0)
44 46
47void arch_remove_kprobe(struct kprobe *p);
45void kretprobe_trampoline(void); 48void kretprobe_trampoline(void);
46 49
47/* Architecture specific copy of original instruction*/ 50/* Architecture specific copy of original instruction*/
48struct arch_specific_insn { 51struct arch_specific_insn {
49 /* copy of the original instruction */ 52 /* copy of the original instruction */
50 kprobe_opcode_t insn[MAX_INSN_SIZE]; 53 kprobe_opcode_t *insn;
51}; 54};
52 55
53struct prev_kprobe { 56struct prev_kprobe {
diff --git a/include/asm-m32r/uaccess.h b/include/asm-m32r/uaccess.h
index 0da7c47d2f01..e8ae61956a51 100644
--- a/include/asm-m32r/uaccess.h
+++ b/include/asm-m32r/uaccess.h
@@ -328,7 +328,7 @@ extern void __put_user_bad(void);
328 " .long 1b,4b\n" \ 328 " .long 1b,4b\n" \
329 " .long 2b,4b\n" \ 329 " .long 2b,4b\n" \
330 ".previous" \ 330 ".previous" \
331 : "=r"(err) \ 331 : "=&r"(err) \
332 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ 332 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \
333 : "r14", "memory") 333 : "r14", "memory")
334 334
@@ -353,7 +353,7 @@ extern void __put_user_bad(void);
353 " .long 1b,4b\n" \ 353 " .long 1b,4b\n" \
354 " .long 2b,4b\n" \ 354 " .long 2b,4b\n" \
355 ".previous" \ 355 ".previous" \
356 : "=r"(err) \ 356 : "=&r"(err) \
357 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ 357 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \
358 : "r14", "memory") 358 : "r14", "memory")
359#else 359#else
@@ -398,7 +398,7 @@ struct __large_struct { unsigned long buf[100]; };
398 " .balign 4\n" \ 398 " .balign 4\n" \
399 " .long 1b,3b\n" \ 399 " .long 1b,3b\n" \
400 ".previous" \ 400 ".previous" \
401 : "=r"(err) \ 401 : "=&r"(err) \
402 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ 402 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \
403 : "r14", "memory") 403 : "r14", "memory")
404 404
@@ -442,7 +442,7 @@ do { \
442 " .balign 4\n" \ 442 " .balign 4\n" \
443 " .long 1b,3b\n" \ 443 " .long 1b,3b\n" \
444 ".previous" \ 444 ".previous" \
445 : "=r"(err), "=&r"(x) \ 445 : "=&r"(err), "=&r"(x) \
446 : "r"(addr), "i"(-EFAULT), "0"(err) \ 446 : "r"(addr), "i"(-EFAULT), "0"(err) \
447 : "r14", "memory") 447 : "r14", "memory")
448 448
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index d73501ba7e44..b9ea44ac0ddb 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -543,7 +543,7 @@ asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag);
543asmlinkage long sys_symlinkat(const char __user * oldname, 543asmlinkage long sys_symlinkat(const char __user * oldname,
544 int newdfd, const char __user * newname); 544 int newdfd, const char __user * newname);
545asmlinkage long sys_linkat(int olddfd, const char __user *oldname, 545asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
546 int newdfd, const char __user *newname); 546 int newdfd, const char __user *newname, int flags);
547asmlinkage long sys_renameat(int olddfd, const char __user * oldname, 547asmlinkage long sys_renameat(int olddfd, const char __user * oldname,
548 int newdfd, const char __user * newname); 548 int newdfd, const char __user * newname);
549asmlinkage long sys_futimesat(int dfd, char __user *filename, 549asmlinkage long sys_futimesat(int dfd, char __user *filename,
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 880831bd3003..67af4cea1e23 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -552,7 +552,7 @@ static void migrate_page_add(struct page *page, struct list_head *pagelist,
552 */ 552 */
553 if ((flags & MPOL_MF_MOVE_ALL) || page_mapcount(page) == 1) { 553 if ((flags & MPOL_MF_MOVE_ALL) || page_mapcount(page) == 1) {
554 if (isolate_lru_page(page)) 554 if (isolate_lru_page(page))
555 list_add(&page->lru, pagelist); 555 list_add_tail(&page->lru, pagelist);
556 } 556 }
557} 557}
558 558
@@ -569,6 +569,7 @@ static int migrate_pages_to(struct list_head *pagelist,
569 LIST_HEAD(moved); 569 LIST_HEAD(moved);
570 LIST_HEAD(failed); 570 LIST_HEAD(failed);
571 int err = 0; 571 int err = 0;
572 unsigned long offset = 0;
572 int nr_pages; 573 int nr_pages;
573 struct page *page; 574 struct page *page;
574 struct list_head *p; 575 struct list_head *p;
@@ -576,8 +577,21 @@ static int migrate_pages_to(struct list_head *pagelist,
576redo: 577redo:
577 nr_pages = 0; 578 nr_pages = 0;
578 list_for_each(p, pagelist) { 579 list_for_each(p, pagelist) {
579 if (vma) 580 if (vma) {
580 page = alloc_page_vma(GFP_HIGHUSER, vma, vma->vm_start); 581 /*
582 * The address passed to alloc_page_vma is used to
583 * generate the proper interleave behavior. We fake
584 * the address here by an increasing offset in order
585 * to get the proper distribution of pages.
586 *
587 * No decision has been made as to which page
588 * a certain old page is moved to so we cannot
589 * specify the correct address.
590 */
591 page = alloc_page_vma(GFP_HIGHUSER, vma,
592 offset + vma->vm_start);
593 offset += PAGE_SIZE;
594 }
581 else 595 else
582 page = alloc_pages_node(dest, GFP_HIGHUSER, 0); 596 page = alloc_pages_node(dest, GFP_HIGHUSER, 0);
583 597
@@ -585,7 +599,7 @@ redo:
585 err = -ENOMEM; 599 err = -ENOMEM;
586 goto out; 600 goto out;
587 } 601 }
588 list_add(&page->lru, &newlist); 602 list_add_tail(&page->lru, &newlist);
589 nr_pages++; 603 nr_pages++;
590 if (nr_pages > MIGRATE_CHUNK_SIZE) 604 if (nr_pages > MIGRATE_CHUNK_SIZE)
591 break; 605 break;
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1838c15ca4fd..b0af7593d01e 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1908,7 +1908,12 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
1908 sc.swap_cluster_max = SWAP_CLUSTER_MAX; 1908 sc.swap_cluster_max = SWAP_CLUSTER_MAX;
1909 1909
1910 cond_resched(); 1910 cond_resched();
1911 p->flags |= PF_MEMALLOC; 1911 /*
1912 * We need to be able to allocate from the reserves for RECLAIM_SWAP
1913 * and we also need to be able to write out pages for RECLAIM_WRITE
1914 * and RECLAIM_SWAP.
1915 */
1916 p->flags |= PF_MEMALLOC | PF_SWAPWRITE;
1912 reclaim_state.reclaimed_slab = 0; 1917 reclaim_state.reclaimed_slab = 0;
1913 p->reclaim_state = &reclaim_state; 1918 p->reclaim_state = &reclaim_state;
1914 1919
@@ -1932,11 +1937,10 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
1932 * a long time. 1937 * a long time.
1933 */ 1938 */
1934 shrink_slab(sc.nr_scanned, gfp_mask, order); 1939 shrink_slab(sc.nr_scanned, gfp_mask, order);
1935 sc.nr_reclaimed = 1; /* Avoid getting the off node timeout */
1936 } 1940 }
1937 1941
1938 p->reclaim_state = NULL; 1942 p->reclaim_state = NULL;
1939 current->flags &= ~PF_MEMALLOC; 1943 current->flags &= ~(PF_MEMALLOC | PF_SWAPWRITE);
1940 1944
1941 if (sc.nr_reclaimed == 0) 1945 if (sc.nr_reclaimed == 0)
1942 zone->last_unsuccessful_zone_reclaim = jiffies; 1946 zone->last_unsuccessful_zone_reclaim = jiffies;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index efa3e72cfcfa..f999edd846a9 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -494,6 +494,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
494 struct net_device *dev; 494 struct net_device *dev;
495 struct sk_buff *frag; 495 struct sk_buff *frag;
496 struct rt6_info *rt = (struct rt6_info*)skb->dst; 496 struct rt6_info *rt = (struct rt6_info*)skb->dst;
497 struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;
497 struct ipv6hdr *tmp_hdr; 498 struct ipv6hdr *tmp_hdr;
498 struct frag_hdr *fh; 499 struct frag_hdr *fh;
499 unsigned int mtu, hlen, left, len; 500 unsigned int mtu, hlen, left, len;
@@ -505,7 +506,12 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
505 hlen = ip6_find_1stfragopt(skb, &prevhdr); 506 hlen = ip6_find_1stfragopt(skb, &prevhdr);
506 nexthdr = *prevhdr; 507 nexthdr = *prevhdr;
507 508
508 mtu = dst_mtu(&rt->u.dst) - hlen - sizeof(struct frag_hdr); 509 mtu = dst_mtu(&rt->u.dst);
510 if (np && np->frag_size < mtu) {
511 if (np->frag_size)
512 mtu = np->frag_size;
513 }
514 mtu -= hlen + sizeof(struct frag_hdr);
509 515
510 if (skb_shinfo(skb)->frag_list) { 516 if (skb_shinfo(skb)->frag_list) {
511 int first_len = skb_pagelen(skb); 517 int first_len = skb_pagelen(skb);
@@ -882,7 +888,12 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
882 inet->cork.fl = *fl; 888 inet->cork.fl = *fl;
883 np->cork.hop_limit = hlimit; 889 np->cork.hop_limit = hlimit;
884 np->cork.tclass = tclass; 890 np->cork.tclass = tclass;
885 inet->cork.fragsize = mtu = dst_mtu(rt->u.dst.path); 891 mtu = dst_mtu(rt->u.dst.path);
892 if (np && np->frag_size < mtu) {
893 if (np->frag_size)
894 mtu = np->frag_size;
895 }
896 inet->cork.fragsize = mtu;
886 if (dst_allfrag(rt->u.dst.path)) 897 if (dst_allfrag(rt->u.dst.path))
887 inet->cork.flags |= IPCORK_ALLFRAG; 898 inet->cork.flags |= IPCORK_ALLFRAG;
888 inet->cork.length = 0; 899 inet->cork.length = 0;
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index faea8a120ee2..48597538db3f 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -884,6 +884,7 @@ ip6ip6_tnl_change(struct ip6_tnl *t, struct ip6_tnl_parm *p)
884 t->parms.encap_limit = p->encap_limit; 884 t->parms.encap_limit = p->encap_limit;
885 t->parms.flowinfo = p->flowinfo; 885 t->parms.flowinfo = p->flowinfo;
886 t->parms.link = p->link; 886 t->parms.link = p->link;
887 ip6_tnl_dst_reset(t);
887 ip6ip6_tnl_link_config(t); 888 ip6ip6_tnl_link_config(t);
888 return 0; 889 return 0;
889} 890}
diff --git a/sound/drivers/opl3/opl3_oss.c b/sound/drivers/opl3/opl3_oss.c
index 31f1f2e25aa0..0345ae647681 100644
--- a/sound/drivers/opl3/opl3_oss.c
+++ b/sound/drivers/opl3/opl3_oss.c
@@ -146,7 +146,7 @@ void snd_opl3_init_seq_oss(struct snd_opl3 *opl3, char *name)
146void snd_opl3_free_seq_oss(struct snd_opl3 *opl3) 146void snd_opl3_free_seq_oss(struct snd_opl3 *opl3)
147{ 147{
148 if (opl3->oss_seq_dev) { 148 if (opl3->oss_seq_dev) {
149 snd_device_free(opl3->card, opl3->oss_seq_dev); 149 /* The instance should have been released in prior */
150 opl3->oss_seq_dev = NULL; 150 opl3->oss_seq_dev = NULL;
151 } 151 }
152} 152}
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 4fa431040564..99a42138bea0 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -414,7 +414,7 @@ static int __devinit snd_card_cs423x_pnpc(int dev, struct snd_card_cs4236 *acard
414 } 414 }
415 /* MPU initialization */ 415 /* MPU initialization */
416 if (acard->mpu && mpu_port[dev] > 0) { 416 if (acard->mpu && mpu_port[dev] > 0) {
417 if (snd_cs423x_pnp_init_mpu(dev, acard->ctrl, cfg) < 0) 417 if (snd_cs423x_pnp_init_mpu(dev, acard->mpu, cfg) < 0)
418 goto error; 418 goto error;
419 } 419 }
420 kfree(cfg); 420 kfree(cfg);