aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/i386/kernel/ldt.c7
-rw-r--r--include/asm-i386/desc.h7
2 files changed, 9 insertions, 5 deletions
diff --git a/arch/i386/kernel/ldt.c b/arch/i386/kernel/ldt.c
index bb50afbee921..fe1ffa55587d 100644
--- a/arch/i386/kernel/ldt.c
+++ b/arch/i386/kernel/ldt.c
@@ -177,7 +177,7 @@ static int read_default_ldt(void __user * ptr, unsigned long bytecount)
177static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) 177static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
178{ 178{
179 struct mm_struct * mm = current->mm; 179 struct mm_struct * mm = current->mm;
180 __u32 entry_1, entry_2, *lp; 180 __u32 entry_1, entry_2;
181 int error; 181 int error;
182 struct user_desc ldt_info; 182 struct user_desc ldt_info;
183 183
@@ -205,8 +205,6 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
205 goto out_unlock; 205 goto out_unlock;
206 } 206 }
207 207
208 lp = (__u32 *) ((ldt_info.entry_number << 3) + (char *) mm->context.ldt);
209
210 /* Allow LDTs to be cleared by the user. */ 208 /* Allow LDTs to be cleared by the user. */
211 if (ldt_info.base_addr == 0 && ldt_info.limit == 0) { 209 if (ldt_info.base_addr == 0 && ldt_info.limit == 0) {
212 if (oldmode || LDT_empty(&ldt_info)) { 210 if (oldmode || LDT_empty(&ldt_info)) {
@@ -223,8 +221,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
223 221
224 /* Install the new entry ... */ 222 /* Install the new entry ... */
225install: 223install:
226 *lp = entry_1; 224 write_ldt_entry(mm->context.ldt, ldt_info.entry_number, entry_1, entry_2);
227 *(lp+1) = entry_2;
228 error = 0; 225 error = 0;
229 226
230out_unlock: 227out_unlock:
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index ccb11c032839..6df1a53c190e 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -96,6 +96,13 @@ static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size)
96 (info)->seg_not_present == 1 && \ 96 (info)->seg_not_present == 1 && \
97 (info)->useable == 0 ) 97 (info)->useable == 0 )
98 98
99static inline void write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b)
100{
101 __u32 *lp = (__u32 *)((char *)ldt + entry*8);
102 *lp = entry_a;
103 *(lp+1) = entry_b;
104}
105
99#if TLS_SIZE != 24 106#if TLS_SIZE != 24
100# error update this code. 107# error update this code.
101#endif 108#endif