diff options
-rw-r--r-- | arch/x86/kernel/i386_ksyms_32.c | 1 | ||||
-rw-r--r-- | arch/x86/kernel/ldt_32.c | 14 | ||||
-rw-r--r-- | arch/x86/kernel/ptrace_32.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/fault_32.c | 4 | ||||
-rw-r--r-- | include/asm-x86/mmu_32.h | 4 |
5 files changed, 14 insertions, 13 deletions
diff --git a/arch/x86/kernel/i386_ksyms_32.c b/arch/x86/kernel/i386_ksyms_32.c index e3d4b73bfdb0..edd39ccf139e 100644 --- a/arch/x86/kernel/i386_ksyms_32.c +++ b/arch/x86/kernel/i386_ksyms_32.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include <linux/module.h> | 1 | #include <linux/module.h> |
2 | #include <asm/semaphore.h> | ||
2 | #include <asm/checksum.h> | 3 | #include <asm/checksum.h> |
3 | #include <asm/desc.h> | 4 | #include <asm/desc.h> |
4 | 5 | ||
diff --git a/arch/x86/kernel/ldt_32.c b/arch/x86/kernel/ldt_32.c index a8b18421863a..9ff90a27c45f 100644 --- a/arch/x86/kernel/ldt_32.c +++ b/arch/x86/kernel/ldt_32.c | |||
@@ -92,13 +92,13 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) | |||
92 | struct mm_struct * old_mm; | 92 | struct mm_struct * old_mm; |
93 | int retval = 0; | 93 | int retval = 0; |
94 | 94 | ||
95 | init_MUTEX(&mm->context.sem); | 95 | mutex_init(&mm->context.lock); |
96 | mm->context.size = 0; | 96 | mm->context.size = 0; |
97 | old_mm = current->mm; | 97 | old_mm = current->mm; |
98 | if (old_mm && old_mm->context.size > 0) { | 98 | if (old_mm && old_mm->context.size > 0) { |
99 | down(&old_mm->context.sem); | 99 | mutex_lock(&old_mm->context.lock); |
100 | retval = copy_ldt(&mm->context, &old_mm->context); | 100 | retval = copy_ldt(&mm->context, &old_mm->context); |
101 | up(&old_mm->context.sem); | 101 | mutex_unlock(&old_mm->context.lock); |
102 | } | 102 | } |
103 | return retval; | 103 | return retval; |
104 | } | 104 | } |
@@ -130,7 +130,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount) | |||
130 | if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES) | 130 | if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES) |
131 | bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES; | 131 | bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES; |
132 | 132 | ||
133 | down(&mm->context.sem); | 133 | mutex_lock(&mm->context.lock); |
134 | size = mm->context.size*LDT_ENTRY_SIZE; | 134 | size = mm->context.size*LDT_ENTRY_SIZE; |
135 | if (size > bytecount) | 135 | if (size > bytecount) |
136 | size = bytecount; | 136 | size = bytecount; |
@@ -138,7 +138,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount) | |||
138 | err = 0; | 138 | err = 0; |
139 | if (copy_to_user(ptr, mm->context.ldt, size)) | 139 | if (copy_to_user(ptr, mm->context.ldt, size)) |
140 | err = -EFAULT; | 140 | err = -EFAULT; |
141 | up(&mm->context.sem); | 141 | mutex_unlock(&mm->context.lock); |
142 | if (err < 0) | 142 | if (err < 0) |
143 | goto error_return; | 143 | goto error_return; |
144 | if (size != bytecount) { | 144 | if (size != bytecount) { |
@@ -194,7 +194,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) | |||
194 | goto out; | 194 | goto out; |
195 | } | 195 | } |
196 | 196 | ||
197 | down(&mm->context.sem); | 197 | mutex_lock(&mm->context.lock); |
198 | if (ldt_info.entry_number >= mm->context.size) { | 198 | if (ldt_info.entry_number >= mm->context.size) { |
199 | error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); | 199 | error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); |
200 | if (error < 0) | 200 | if (error < 0) |
@@ -221,7 +221,7 @@ install: | |||
221 | error = 0; | 221 | error = 0; |
222 | 222 | ||
223 | out_unlock: | 223 | out_unlock: |
224 | up(&mm->context.sem); | 224 | mutex_unlock(&mm->context.lock); |
225 | out: | 225 | out: |
226 | return error; | 226 | return error; |
227 | } | 227 | } |
diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c index 8622b9cd3e38..99102ec5fade 100644 --- a/arch/x86/kernel/ptrace_32.c +++ b/arch/x86/kernel/ptrace_32.c | |||
@@ -165,7 +165,7 @@ static unsigned long convert_eip_to_linear(struct task_struct *child, struct pt_ | |||
165 | 165 | ||
166 | seg &= ~7UL; | 166 | seg &= ~7UL; |
167 | 167 | ||
168 | down(&child->mm->context.sem); | 168 | mutex_lock(&child->mm->context.lock); |
169 | if (unlikely((seg >> 3) >= child->mm->context.size)) | 169 | if (unlikely((seg >> 3) >= child->mm->context.size)) |
170 | addr = -1L; /* bogus selector, access would fault */ | 170 | addr = -1L; /* bogus selector, access would fault */ |
171 | else { | 171 | else { |
@@ -179,7 +179,7 @@ static unsigned long convert_eip_to_linear(struct task_struct *child, struct pt_ | |||
179 | addr &= 0xffff; | 179 | addr &= 0xffff; |
180 | addr += base; | 180 | addr += base; |
181 | } | 181 | } |
182 | up(&child->mm->context.sem); | 182 | mutex_unlock(&child->mm->context.lock); |
183 | } | 183 | } |
184 | return addr; | 184 | return addr; |
185 | } | 185 | } |
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c index d84314ce22bb..6555c3d14371 100644 --- a/arch/x86/mm/fault_32.c +++ b/arch/x86/mm/fault_32.c | |||
@@ -105,7 +105,7 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs, | |||
105 | LDT and other horrors are only used in user space. */ | 105 | LDT and other horrors are only used in user space. */ |
106 | if (seg & (1<<2)) { | 106 | if (seg & (1<<2)) { |
107 | /* Must lock the LDT while reading it. */ | 107 | /* Must lock the LDT while reading it. */ |
108 | down(¤t->mm->context.sem); | 108 | mutex_lock(¤t->mm->context.lock); |
109 | desc = current->mm->context.ldt; | 109 | desc = current->mm->context.ldt; |
110 | desc = (void *)desc + (seg & ~7); | 110 | desc = (void *)desc + (seg & ~7); |
111 | } else { | 111 | } else { |
@@ -118,7 +118,7 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs, | |||
118 | base = get_desc_base((unsigned long *)desc); | 118 | base = get_desc_base((unsigned long *)desc); |
119 | 119 | ||
120 | if (seg & (1<<2)) { | 120 | if (seg & (1<<2)) { |
121 | up(¤t->mm->context.sem); | 121 | mutex_unlock(¤t->mm->context.lock); |
122 | } else | 122 | } else |
123 | put_cpu(); | 123 | put_cpu(); |
124 | 124 | ||
diff --git a/include/asm-x86/mmu_32.h b/include/asm-x86/mmu_32.h index 8358dd3df7aa..5e249c51ef56 100644 --- a/include/asm-x86/mmu_32.h +++ b/include/asm-x86/mmu_32.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef __i386_MMU_H | 1 | #ifndef __i386_MMU_H |
2 | #define __i386_MMU_H | 2 | #define __i386_MMU_H |
3 | 3 | ||
4 | #include <asm/semaphore.h> | 4 | #include <linux/mutex.h> |
5 | /* | 5 | /* |
6 | * The i386 doesn't have a mmu context, but | 6 | * The i386 doesn't have a mmu context, but |
7 | * we put the segment information here. | 7 | * we put the segment information here. |
@@ -10,7 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | typedef struct { | 11 | typedef struct { |
12 | int size; | 12 | int size; |
13 | struct semaphore sem; | 13 | struct mutex lock; |
14 | void *ldt; | 14 | void *ldt; |
15 | void *vdso; | 15 | void *vdso; |
16 | } mm_context_t; | 16 | } mm_context_t; |