diff options
author | Oleg Nesterov <oleg@redhat.com> | 2010-05-26 17:43:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:45 -0400 |
commit | c70a626d3eba373514c72287c93588b6974a0059 (patch) | |
tree | c23b890cbbeb824e52e1eaee6812bc88496a246d /kernel/kmod.c | |
parent | 685bfd2c48bb3284d31e73ff3151c957d76deda9 (diff) |
umh: creds: kill subprocess_info->cred logic
Now that nobody ever changes subprocess_info->cred we can kill this member
and related code. ____call_usermodehelper() always runs in the context of
freshly forked kernel thread, it has the proper ->cred copied from its
parent kthread, keventd.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/kmod.c')
-rw-r--r-- | kernel/kmod.c | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/kernel/kmod.c b/kernel/kmod.c index 743d3883517c..6194ec2f737b 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
@@ -134,8 +134,6 @@ static int ____call_usermodehelper(void *data) | |||
134 | struct subprocess_info *sub_info = data; | 134 | struct subprocess_info *sub_info = data; |
135 | int retval; | 135 | int retval; |
136 | 136 | ||
137 | BUG_ON(atomic_read(&sub_info->cred->usage) != 1); | ||
138 | |||
139 | /* Unblock all signals */ | 137 | /* Unblock all signals */ |
140 | spin_lock_irq(¤t->sighand->siglock); | 138 | spin_lock_irq(¤t->sighand->siglock); |
141 | flush_signal_handlers(current, 1); | 139 | flush_signal_handlers(current, 1); |
@@ -143,10 +141,6 @@ static int ____call_usermodehelper(void *data) | |||
143 | recalc_sigpending(); | 141 | recalc_sigpending(); |
144 | spin_unlock_irq(¤t->sighand->siglock); | 142 | spin_unlock_irq(¤t->sighand->siglock); |
145 | 143 | ||
146 | /* Install the credentials */ | ||
147 | commit_creds(sub_info->cred); | ||
148 | sub_info->cred = NULL; | ||
149 | |||
150 | /* We can run anywhere, unlike our parent keventd(). */ | 144 | /* We can run anywhere, unlike our parent keventd(). */ |
151 | set_cpus_allowed_ptr(current, cpu_all_mask); | 145 | set_cpus_allowed_ptr(current, cpu_all_mask); |
152 | 146 | ||
@@ -174,8 +168,6 @@ void call_usermodehelper_freeinfo(struct subprocess_info *info) | |||
174 | { | 168 | { |
175 | if (info->cleanup) | 169 | if (info->cleanup) |
176 | (*info->cleanup)(info); | 170 | (*info->cleanup)(info); |
177 | if (info->cred) | ||
178 | put_cred(info->cred); | ||
179 | kfree(info); | 171 | kfree(info); |
180 | } | 172 | } |
181 | EXPORT_SYMBOL(call_usermodehelper_freeinfo); | 173 | EXPORT_SYMBOL(call_usermodehelper_freeinfo); |
@@ -231,8 +223,6 @@ static void __call_usermodehelper(struct work_struct *work) | |||
231 | pid_t pid; | 223 | pid_t pid; |
232 | enum umh_wait wait = sub_info->wait; | 224 | enum umh_wait wait = sub_info->wait; |
233 | 225 | ||
234 | BUG_ON(atomic_read(&sub_info->cred->usage) != 1); | ||
235 | |||
236 | /* CLONE_VFORK: wait until the usermode helper has execve'd | 226 | /* CLONE_VFORK: wait until the usermode helper has execve'd |
237 | * successfully We need the data structures to stay around | 227 | * successfully We need the data structures to stay around |
238 | * until that is done. */ | 228 | * until that is done. */ |
@@ -355,12 +345,6 @@ struct subprocess_info *call_usermodehelper_setup(char *path, char **argv, | |||
355 | sub_info->path = path; | 345 | sub_info->path = path; |
356 | sub_info->argv = argv; | 346 | sub_info->argv = argv; |
357 | sub_info->envp = envp; | 347 | sub_info->envp = envp; |
358 | sub_info->cred = prepare_usermodehelper_creds(); | ||
359 | if (!sub_info->cred) { | ||
360 | kfree(sub_info); | ||
361 | return NULL; | ||
362 | } | ||
363 | |||
364 | out: | 348 | out: |
365 | return sub_info; | 349 | return sub_info; |
366 | } | 350 | } |
@@ -411,9 +395,6 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, | |||
411 | DECLARE_COMPLETION_ONSTACK(done); | 395 | DECLARE_COMPLETION_ONSTACK(done); |
412 | int retval = 0; | 396 | int retval = 0; |
413 | 397 | ||
414 | BUG_ON(atomic_read(&sub_info->cred->usage) != 1); | ||
415 | validate_creds(sub_info->cred); | ||
416 | |||
417 | helper_lock(); | 398 | helper_lock(); |
418 | if (sub_info->path[0] == '\0') | 399 | if (sub_info->path[0] == '\0') |
419 | goto out; | 400 | goto out; |