aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ldt_32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/ldt_32.c')
-rw-r--r--arch/x86/kernel/ldt_32.c14
1 files changed, 7 insertions, 7 deletions
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(&current->mm->context, ldt_info.entry_number+1, 1); 199 error = alloc_ldt(&current->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
223out_unlock: 223out_unlock:
224 up(&mm->context.sem); 224 mutex_unlock(&mm->context.lock);
225out: 225out:
226 return error; 226 return error;
227} 227}