diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-04-29 21:13:14 +0000 |
---|---|---|
committer | <ralf@linux-mips.org> | 1997-04-29 21:13:14 +0000 |
commit | 19c9bba94152148523ba0f7ef7cffe3d45656b11 (patch) | |
tree | 40b1cb534496a7f1ca0f5c314a523c69f1fee464 /kernel/exec_domain.c | |
parent | 7206675c40394c78a90e74812bbdbf8cf3cca1be (diff) |
Import of Linux/MIPS 2.1.36
Diffstat (limited to 'kernel/exec_domain.c')
-rw-r--r-- | kernel/exec_domain.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c index 9a202359a..5d7e2f056 100644 --- a/kernel/exec_domain.c +++ b/kernel/exec_domain.c @@ -2,6 +2,9 @@ #include <linux/ptrace.h> #include <linux/sched.h> #include <linux/mm.h> +#include <linux/smp.h> +#include <linux/smp_lock.h> +#include <linux/module.h> static asmlinkage void no_lcall7(struct pt_regs * regs); @@ -34,14 +37,14 @@ static asmlinkage void no_lcall7(struct pt_regs * regs) * personality set incorrectly. Check to see whether SVr4 is available, * and use it, otherwise give the user a SEGV. */ - if (current->exec_domain && current->exec_domain->use_count) - (*current->exec_domain->use_count)--; + if (current->exec_domain && current->exec_domain->module) + __MOD_DEC_USE_COUNT(current->exec_domain->module); current->personality = PER_SVR4; current->exec_domain = lookup_exec_domain(current->personality); - if (current->exec_domain && current->exec_domain->use_count) - (*current->exec_domain->use_count)++; + if (current->exec_domain && current->exec_domain->module) + __MOD_INC_USE_COUNT(current->exec_domain->module); if (current->exec_domain && current->exec_domain->handler && current->exec_domain->handler != no_lcall7) { @@ -103,21 +106,27 @@ asmlinkage int sys_personality(unsigned long personality) { struct exec_domain *it; unsigned long old_personality; + int ret; + lock_kernel(); + ret = current->personality; if (personality == 0xffffffff) - return current->personality; + goto out; + ret = -EINVAL; it = lookup_exec_domain(personality); if (!it) - return -EINVAL; + goto out; old_personality = current->personality; - if (current->exec_domain && current->exec_domain->use_count) - (*current->exec_domain->use_count)--; + if (current->exec_domain && current->exec_domain->module) + __MOD_DEC_USE_COUNT(current->exec_domain->module); current->personality = personality; current->exec_domain = it; - if (current->exec_domain->use_count) - (*current->exec_domain->use_count)++; - - return old_personality; + if (current->exec_domain->module) + __MOD_INC_USE_COUNT(current->exec_domain->module); + ret = old_personality; +out: + unlock_kernel(); + return ret; } |