aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/ldt_64.c14
-rw-r--r--arch/x86/kernel/ptrace_64.c4
2 files changed, 9 insertions, 9 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}
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;