diff options
Diffstat (limited to 'kernel/cred.c')
| -rw-r--r-- | kernel/cred.c | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/kernel/cred.c b/kernel/cred.c index 2c24870c55d1..a2d5504fbcc2 100644 --- a/kernel/cred.c +++ b/kernel/cred.c | |||
| @@ -347,66 +347,6 @@ struct cred *prepare_exec_creds(void) | |||
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | /* | 349 | /* |
| 350 | * prepare new credentials for the usermode helper dispatcher | ||
| 351 | */ | ||
| 352 | struct cred *prepare_usermodehelper_creds(void) | ||
| 353 | { | ||
| 354 | #ifdef CONFIG_KEYS | ||
| 355 | struct thread_group_cred *tgcred = NULL; | ||
| 356 | #endif | ||
| 357 | struct cred *new; | ||
| 358 | |||
| 359 | #ifdef CONFIG_KEYS | ||
| 360 | tgcred = kzalloc(sizeof(*new->tgcred), GFP_ATOMIC); | ||
| 361 | if (!tgcred) | ||
| 362 | return NULL; | ||
| 363 | #endif | ||
| 364 | |||
| 365 | new = kmem_cache_alloc(cred_jar, GFP_ATOMIC); | ||
| 366 | if (!new) | ||
| 367 | goto free_tgcred; | ||
| 368 | |||
| 369 | kdebug("prepare_usermodehelper_creds() alloc %p", new); | ||
| 370 | |||
| 371 | memcpy(new, &init_cred, sizeof(struct cred)); | ||
| 372 | |||
| 373 | atomic_set(&new->usage, 1); | ||
| 374 | set_cred_subscribers(new, 0); | ||
| 375 | get_group_info(new->group_info); | ||
| 376 | get_uid(new->user); | ||
| 377 | |||
| 378 | #ifdef CONFIG_KEYS | ||
| 379 | new->thread_keyring = NULL; | ||
| 380 | new->request_key_auth = NULL; | ||
| 381 | new->jit_keyring = KEY_REQKEY_DEFL_DEFAULT; | ||
| 382 | |||
| 383 | atomic_set(&tgcred->usage, 1); | ||
| 384 | spin_lock_init(&tgcred->lock); | ||
| 385 | new->tgcred = tgcred; | ||
| 386 | #endif | ||
| 387 | |||
| 388 | #ifdef CONFIG_SECURITY | ||
| 389 | new->security = NULL; | ||
| 390 | #endif | ||
| 391 | if (security_prepare_creds(new, &init_cred, GFP_ATOMIC) < 0) | ||
| 392 | goto error; | ||
| 393 | validate_creds(new); | ||
| 394 | |||
| 395 | BUG_ON(atomic_read(&new->usage) != 1); | ||
| 396 | return new; | ||
| 397 | |||
| 398 | error: | ||
| 399 | put_cred(new); | ||
| 400 | return NULL; | ||
| 401 | |||
| 402 | free_tgcred: | ||
| 403 | #ifdef CONFIG_KEYS | ||
| 404 | kfree(tgcred); | ||
| 405 | #endif | ||
| 406 | return NULL; | ||
| 407 | } | ||
| 408 | |||
| 409 | /* | ||
| 410 | * Copy credentials for the new process created by fork() | 350 | * Copy credentials for the new process created by fork() |
| 411 | * | 351 | * |
| 412 | * We share if we can, but under some circumstances we have to generate a new | 352 | * We share if we can, but under some circumstances we have to generate a new |
