aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ldt_64.c
diff options
context:
space:
mode:
authorLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>2007-10-17 12:04:41 -0400
committerThomas Gleixner <tglx@inhelltoy.tec.linutronix.de>2007-10-17 14:17:00 -0400
commitc7537ab234bc629e0a3b0d725dd08e6f24768037 (patch)
treed368089c218964ad504308753f74da78a22323bb /arch/x86/kernel/ldt_64.c
parent99741faa34b342e6a0b327efb6c28c1a693b7307 (diff)
x86: convert mm_context_t semaphore to a mutex
[ tglx: arch/x86 adaptation ] Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/ldt_64.c')
-rw-r--r--arch/x86/kernel/ldt_64.c14
1 files changed, 7 insertions, 7 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(&current->mm->context, ldt_info.entry_number+1, 1); 198 error = alloc_ldt(&current->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
225out_unlock: 225out_unlock:
226 up(&mm->context.sem); 226 mutex_unlock(&mm->context.lock);
227out: 227out:
228 return error; 228 return error;
229} 229}