Skip to content

Commit 69b6d71

Browse files
committed
Smack: use init_task_smack() in smack_cred_transfer()
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 <[email protected]>
1 parent f0816d4 commit 69b6d71

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

security/smack/smack_lsm.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,12 +2101,7 @@ static void smack_cred_transfer(struct cred *new, const struct cred *old)
21012101
struct task_smack *old_tsp = smack_cred(old);
21022102
struct task_smack *new_tsp = smack_cred(new);
21032103

2104-
new_tsp->smk_task = old_tsp->smk_task;
2105-
new_tsp->smk_forked = old_tsp->smk_task;
2106-
mutex_init(&new_tsp->smk_rules_lock);
2107-
INIT_LIST_HEAD(&new_tsp->smk_rules);
2108-
2109-
/* cbs copy rule list */
2104+
init_task_smack(new_tsp, old_tsp->smk_task, old_tsp->smk_task);
21102105
}
21112106

21122107
/**

0 commit comments

Comments
 (0)