Messages in this thread Patch in this message |  | | | Date | Thu, 27 May 2010 17:36:39 +0200 | | From | Oleg Nesterov <> | | Subject | [PATCH 3/3] __set_personality: no need to check the old ->exec_domain |
| |
Cleanup. __set_personality() always changes ->exec_domain/personality, the special case when ->exec_domain remains the same buys nothing but complicates the code.
I don't understand why lookup_exec_domain() always succeeds even if the search in ->exec_domains list fails, we use default_exec_domain in this case.
Signed-off-by: Oleg Nesterov <oleg@redhat.com> --- kernel/exec_domain.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) --- 34-rc1/kernel/exec_domain.c~3_CLEANUP_SET_PERSONALITY 2010-05-27 15:54:33.000000000 +0200 +++ 34-rc1/kernel/exec_domain.c 2010-05-27 17:03:29.000000000 +0200 @@ -134,23 +134,14 @@ unregister: return 0; } -int -__set_personality(u_long personality) +int __set_personality(u_long personality) { - struct exec_domain *ep, *oep; - - ep = lookup_exec_domain(personality); - if (ep == current_thread_info()->exec_domain) { - current->personality = personality; - module_put(ep->module); - return 0; - } + struct exec_domain *oep = current_thread_info()->exec_domain; + current_thread_info()->exec_domain = lookup_exec_domain(personality); current->personality = personality; - oep = current_thread_info()->exec_domain; - current_thread_info()->exec_domain = ep; - module_put(oep->module); + return 0; }
|  |