@@ -25,7 +25,6 @@ struct ldt_entry {
typedef struct uml_ldt {
int entry_count;
- struct mutex lock;
union {
struct ldt_entry * pages[LDT_PAGES_MAX];
struct ldt_entry entries[LDT_DIRECT_ENTRIES];
@@ -65,7 +65,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES;
err = bytecount;
- mutex_lock(&ldt->lock);
+ mmap_read_lock(current->mm);
if (ldt->entry_count <= LDT_DIRECT_ENTRIES) {
size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES;
if (size > bytecount)
@@ -89,7 +89,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
ptr += size;
}
}
- mutex_unlock(&ldt->lock);
+ mmap_read_unlock(current->mm);
if (bytecount == 0 || err == -EFAULT)
goto out;
@@ -146,7 +146,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
goto out;
}
- mutex_lock(&ldt->lock);
+ mmap_write_lock(current->mm);
err = write_ldt_entry(mm_idp, func, &ldt_info, &addr, 1);
if (err)
@@ -201,7 +201,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
err = 0;
out_unlock:
- mutex_unlock(&ldt->lock);
+ mmap_write_unlock(current->mm);
out:
return err;
}
@@ -305,9 +305,6 @@ long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
long page, err=0;
void *addr = NULL;
-
- mutex_init(&new_mm->arch.ldt.lock);
-
if (!from_mm) {
memset(&desc, 0, sizeof(desc));
/*
@@ -334,7 +331,6 @@ long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
* i.e., we have to use the stub for modify_ldt, which
* can't handle the big read buffer of up to 64kB.
*/
- mutex_lock(&from_mm->arch.ldt.lock);
if (from_mm->arch.ldt.entry_count <= LDT_DIRECT_ENTRIES)
memcpy(new_mm->arch.ldt.u.entries, from_mm->arch.ldt.u.entries,
sizeof(new_mm->arch.ldt.u.entries));
@@ -353,8 +349,6 @@ long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
}
}
new_mm->arch.ldt.entry_count = from_mm->arch.ldt.entry_count;
- mutex_unlock(&from_mm->arch.ldt.lock);
-
out:
return err;
}