Skip to content

Commit 92ed350

Browse files
committed
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>
1 parent cb1513d commit 92ed350

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

security/lsm_init.c

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -291,34 +291,6 @@ static void __init ordered_lsm_parse(const char *order, const char *origin)
291291
kfree(sep);
292292
}
293293

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-
322294
static void __init ordered_lsm_init(void)
323295
{
324296
unsigned int first = 0;
@@ -382,8 +354,11 @@ static void __init ordered_lsm_init(void)
382354
blob_sizes.lbs_inode, 0,
383355
SLAB_PANIC, NULL);
384356

385-
lsm_early_cred((struct cred *) current->cred);
386-
lsm_early_task(current);
357+
if (lsm_cred_alloc((struct cred __rcu *)current->cred, GFP_KERNEL))
358+
panic("%s: early cred alloc failed.\n", __func__);
359+
if (lsm_task_alloc(current))
360+
panic("%s: early task alloc failed.\n", __func__);
361+
387362
lsm_order_for_each(lsm) {
388363
initialize_lsm(*lsm);
389364
}

0 commit comments

Comments
 (0)