Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lsm: integrate lsm_early_cred() and lsm_early_task() into caller

With only one caller of lsm_early_cred() and lsm_early_task(), insert
the functions' code directly into the caller and ger rid of the two
functions.

Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Reviewed-by: John Johansen <john.johhansen@canonical.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>

+5 -30
+5 -30
security/lsm_init.c
··· 291 291 kfree(sep); 292 292 } 293 293 294 - /** 295 - * lsm_early_cred - during initialization allocate a composite cred blob 296 - * @cred: the cred that needs a blob 297 - * 298 - * Allocate the cred blob for all the modules 299 - */ 300 - static void __init lsm_early_cred(struct cred *cred) 301 - { 302 - int rc = lsm_cred_alloc(cred, GFP_KERNEL); 303 - 304 - if (rc) 305 - panic("%s: Early cred alloc failed.\n", __func__); 306 - } 307 - 308 - /** 309 - * lsm_early_task - during initialization allocate a composite task blob 310 - * @task: the task that needs a blob 311 - * 312 - * Allocate the task blob for all the modules 313 - */ 314 - static void __init lsm_early_task(struct task_struct *task) 315 - { 316 - int rc = lsm_task_alloc(task); 317 - 318 - if (rc) 319 - panic("%s: Early task alloc failed.\n", __func__); 320 - } 321 - 322 294 static void __init ordered_lsm_init(void) 323 295 { 324 296 unsigned int first = 0; ··· 354 382 blob_sizes.lbs_inode, 0, 355 383 SLAB_PANIC, NULL); 356 384 357 - lsm_early_cred((struct cred *) current->cred); 358 - lsm_early_task(current); 385 + if (lsm_cred_alloc((struct cred __rcu *)current->cred, GFP_KERNEL)) 386 + panic("%s: early cred alloc failed.\n", __func__); 387 + if (lsm_task_alloc(current)) 388 + panic("%s: early task alloc failed.\n", __func__); 389 + 359 390 lsm_order_for_each(lsm) { 360 391 initialize_lsm(*lsm); 361 392 }