diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/cred.c | 25 | ||||
| -rw-r--r-- | kernel/module.c | 4 |
2 files changed, 28 insertions, 1 deletions
diff --git a/kernel/cred.c b/kernel/cred.c index a2d5504fbcc2..60bc8b1e32e6 100644 --- a/kernel/cred.c +++ b/kernel/cred.c | |||
| @@ -209,6 +209,31 @@ void exit_creds(struct task_struct *tsk) | |||
| 209 | } | 209 | } |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | /** | ||
| 213 | * get_task_cred - Get another task's objective credentials | ||
| 214 | * @task: The task to query | ||
| 215 | * | ||
| 216 | * Get the objective credentials of a task, pinning them so that they can't go | ||
| 217 | * away. Accessing a task's credentials directly is not permitted. | ||
| 218 | * | ||
| 219 | * The caller must also make sure task doesn't get deleted, either by holding a | ||
| 220 | * ref on task or by holding tasklist_lock to prevent it from being unlinked. | ||
| 221 | */ | ||
| 222 | const struct cred *get_task_cred(struct task_struct *task) | ||
| 223 | { | ||
| 224 | const struct cred *cred; | ||
| 225 | |||
| 226 | rcu_read_lock(); | ||
| 227 | |||
| 228 | do { | ||
| 229 | cred = __task_cred((task)); | ||
| 230 | BUG_ON(!cred); | ||
| 231 | } while (!atomic_inc_not_zero(&((struct cred *)cred)->usage)); | ||
| 232 | |||
| 233 | rcu_read_unlock(); | ||
| 234 | return cred; | ||
| 235 | } | ||
| 236 | |||
| 212 | /* | 237 | /* |
| 213 | * Allocate blank credentials, such that the credentials can be filled in at a | 238 | * Allocate blank credentials, such that the credentials can be filled in at a |
| 214 | * later date without risk of ENOMEM. | 239 | * later date without risk of ENOMEM. |
diff --git a/kernel/module.c b/kernel/module.c index 5d2d28197c82..6c562828c85c 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -787,7 +787,6 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user, | |||
| 787 | 787 | ||
| 788 | /* Store the name of the last unloaded module for diagnostic purposes */ | 788 | /* Store the name of the last unloaded module for diagnostic purposes */ |
| 789 | strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); | 789 | strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); |
| 790 | ddebug_remove_module(mod->name); | ||
| 791 | 790 | ||
| 792 | free_module(mod); | 791 | free_module(mod); |
| 793 | return 0; | 792 | return 0; |
| @@ -1550,6 +1549,9 @@ static void free_module(struct module *mod) | |||
| 1550 | remove_sect_attrs(mod); | 1549 | remove_sect_attrs(mod); |
| 1551 | mod_kobject_remove(mod); | 1550 | mod_kobject_remove(mod); |
| 1552 | 1551 | ||
| 1552 | /* Remove dynamic debug info */ | ||
| 1553 | ddebug_remove_module(mod->name); | ||
| 1554 | |||
| 1553 | /* Arch-specific cleanup. */ | 1555 | /* Arch-specific cleanup. */ |
| 1554 | module_arch_cleanup(mod); | 1556 | module_arch_cleanup(mod); |
| 1555 | 1557 | ||
