diff options
-rw-r--r-- | arch/x86/kernel/ldt_64.c | 14 | ||||
-rw-r--r-- | arch/x86/kernel/ptrace_64.c | 4 | ||||
-rw-r--r-- | include/asm-x86/mmu_64.h | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/arch/x86/kernel/ldt_64.c b/arch/x86/kernel/ldt_64.c index 3796523d616a..60e57abb8e90 100644 --- a/arch/x86/kernel/ldt_64.c +++ b/arch/x86/kernel/ldt_64.c | |||
@@ -96,13 +96,13 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) | |||
96 | struct mm_struct * old_mm; | 96 | struct mm_struct * old_mm; |
97 | int retval = 0; | 97 | int retval = 0; |
98 | 98 | ||
99 | init_MUTEX(&mm->context.sem); | 99 | mutex_init(&mm->context.lock); |
100 | mm->context.size = 0; | 100 | mm->context.size = 0; |
101 | old_mm = current->mm; | 101 | old_mm = current->mm; |
102 | if (old_mm && old_mm->context.size > 0) { | 102 | if (old_mm && old_mm->context.size > 0) { |
103 | down(&old_mm->context.sem); | 103 | mutex_lock(&old_mm->context.lock); |
104 | retval = copy_ldt(&mm->context, &old_mm->context); | 104 | retval = copy_ldt(&mm->context, &old_mm->context); |
105 | up(&old_mm->context.sem); | 105 | mutex_unlock(&old_mm->context.lock); |
106 | } | 106 | } |
107 | return retval; | 107 | return retval; |
108 | } | 108 | } |
@@ -133,7 +133,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount) | |||
133 | if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES) | 133 | if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES) |
134 | bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES; | 134 | bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES; |
135 | 135 | ||
136 | down(&mm->context.sem); | 136 | mutex_lock(&mm->context.lock); |
137 | size = mm->context.size*LDT_ENTRY_SIZE; | 137 | size = mm->context.size*LDT_ENTRY_SIZE; |
138 | if (size > bytecount) | 138 | if (size > bytecount) |
139 | size = bytecount; | 139 | size = bytecount; |
@@ -141,7 +141,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount) | |||
141 | err = 0; | 141 | err = 0; |
142 | if (copy_to_user(ptr, mm->context.ldt, size)) | 142 | if (copy_to_user(ptr, mm->context.ldt, size)) |
143 | err = -EFAULT; | 143 | err = -EFAULT; |
144 | up(&mm->context.sem); | 144 | mutex_unlock(&mm->context.lock); |
145 | if (err < 0) | 145 | if (err < 0) |
146 | goto error_return; | 146 | goto error_return; |
147 | if (size != bytecount) { | 147 | if (size != bytecount) { |
@@ -193,7 +193,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) | |||
193 | goto out; | 193 | goto out; |
194 | } | 194 | } |
195 | 195 | ||
196 | down(&mm->context.sem); | 196 | mutex_lock(&mm->context.lock); |
197 | if (ldt_info.entry_number >= (unsigned)mm->context.size) { | 197 | if (ldt_info.entry_number >= (unsigned)mm->context.size) { |
198 | error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); | 198 | error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); |
199 | if (error < 0) | 199 | if (error < 0) |
@@ -223,7 +223,7 @@ install: | |||
223 | error = 0; | 223 | error = 0; |
224 | 224 | ||
225 | out_unlock: | 225 | out_unlock: |
226 | up(&mm->context.sem); | 226 | mutex_unlock(&mm->context.lock); |
227 | out: | 227 | out: |
228 | return error; | 228 | return error; |
229 | } | 229 | } |
diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c index 86321ee6da93..607085f3f08a 100644 --- a/arch/x86/kernel/ptrace_64.c +++ b/arch/x86/kernel/ptrace_64.c | |||
@@ -103,7 +103,7 @@ unsigned long convert_rip_to_linear(struct task_struct *child, struct pt_regs *r | |||
103 | 103 | ||
104 | seg &= ~7UL; | 104 | seg &= ~7UL; |
105 | 105 | ||
106 | down(&child->mm->context.sem); | 106 | mutex_lock(&child->mm->context.lock); |
107 | if (unlikely((seg >> 3) >= child->mm->context.size)) | 107 | if (unlikely((seg >> 3) >= child->mm->context.size)) |
108 | addr = -1L; /* bogus selector, access would fault */ | 108 | addr = -1L; /* bogus selector, access would fault */ |
109 | else { | 109 | else { |
@@ -117,7 +117,7 @@ unsigned long convert_rip_to_linear(struct task_struct *child, struct pt_regs *r | |||
117 | addr &= 0xffff; | 117 | addr &= 0xffff; |
118 | addr += base; | 118 | addr += base; |
119 | } | 119 | } |
120 | up(&child->mm->context.sem); | 120 | mutex_unlock(&child->mm->context.lock); |
121 | } | 121 | } |
122 | 122 | ||
123 | return addr; | 123 | return addr; |
diff --git a/include/asm-x86/mmu_64.h b/include/asm-x86/mmu_64.h index d2cd4a9d984d..024357c27222 100644 --- a/include/asm-x86/mmu_64.h +++ b/include/asm-x86/mmu_64.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define __x86_64_MMU_H | 2 | #define __x86_64_MMU_H |
3 | 3 | ||
4 | #include <linux/spinlock.h> | 4 | #include <linux/spinlock.h> |
5 | #include <asm/semaphore.h> | 5 | #include <linux/mutex.h> |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * The x86_64 doesn't have a mmu context, but | 8 | * The x86_64 doesn't have a mmu context, but |
@@ -14,7 +14,7 @@ typedef struct { | |||
14 | void *ldt; | 14 | void *ldt; |
15 | rwlock_t ldtlock; | 15 | rwlock_t ldtlock; |
16 | int size; | 16 | int size; |
17 | struct semaphore sem; | 17 | struct mutex lock; |
18 | void *vdso; | 18 | void *vdso; |
19 | } mm_context_t; | 19 | } mm_context_t; |
20 | 20 | ||