Skip to content

Commit

Permalink
Smack: use init_task_smack() in smack_cred_transfer()
Browse files Browse the repository at this point in the history
smack_cred_transfer() open codes the same initialization
as init_task_smack(). Remove the open coding and replace it
with a call to init_task_smack().

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
  • Loading branch information
Casey Schaufler committed Feb 14, 2024
1 parent f0816d4 commit 69b6d71
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions security/smack/smack_lsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2101,12 +2101,7 @@ static void smack_cred_transfer(struct cred *new, const struct cred *old)
struct task_smack *old_tsp = smack_cred(old);
struct task_smack *new_tsp = smack_cred(new);

new_tsp->smk_task = old_tsp->smk_task;
new_tsp->smk_forked = old_tsp->smk_task;
mutex_init(&new_tsp->smk_rules_lock);
INIT_LIST_HEAD(&new_tsp->smk_rules);

/* cbs copy rule list */
init_task_smack(new_tsp, old_tsp->smk_task, old_tsp->smk_task);
}

/**
Expand Down

0 comments on commit 69b6d71

Please sign in to comment.