summaryrefslogtreecommitdiffstats
path: root/kernel/kmod.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-06-21 17:47:44 +0900
committerPaul Mundt <lethal@linux-sh.org>2011-06-21 17:47:44 +0900
commit9dd056e9eba106ef622795b566f769a9ab0a49a8 (patch)
tree390c07ea2c3b9631c2e8fe64c1a6feba0b503e8b /kernel/kmod.c
parent08ef2e427b59393d68a65b16e97e894b662a5573 (diff)
parentf2b9726105824fdeea32a339e5072a358f89a25b (diff)
downloadop-kernel-dev-9dd056e9eba106ef622795b566f769a9ab0a49a8.zip
op-kernel-dev-9dd056e9eba106ef622795b566f769a9ab0a49a8.tar.gz
Merge branch 'sh/stable-updates' into sh-latest
Diffstat (limited to 'kernel/kmod.c')
-rw-r--r--kernel/kmod.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/kernel/kmod.c b/kernel/kmod.c
index ad6a81c..47613df 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -156,12 +156,6 @@ static int ____call_usermodehelper(void *data)
*/
set_user_nice(current, 0);
- if (sub_info->init) {
- retval = sub_info->init(sub_info);
- if (retval)
- goto fail;
- }
-
retval = -ENOMEM;
new = prepare_kernel_cred(current);
if (!new)
@@ -173,6 +167,14 @@ static int ____call_usermodehelper(void *data)
new->cap_inheritable);
spin_unlock(&umh_sysctl_lock);
+ if (sub_info->init) {
+ retval = sub_info->init(sub_info, new);
+ if (retval) {
+ abort_creds(new);
+ goto fail;
+ }
+ }
+
commit_creds(new);
retval = kernel_execve(sub_info->path,
@@ -388,7 +390,7 @@ EXPORT_SYMBOL(call_usermodehelper_setup);
* context in which call_usermodehelper_exec is called.
*/
void call_usermodehelper_setfns(struct subprocess_info *info,
- int (*init)(struct subprocess_info *info),
+ int (*init)(struct subprocess_info *info, struct cred *new),
void (*cleanup)(struct subprocess_info *info),
void *data)
{
OpenPOWER on IntegriCloud