diff options
| -rw-r--r-- | security/smack/smack_lsm.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index ce9273a18165..2874c7316783 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
| @@ -2684,9 +2684,7 @@ static int smack_getprocattr(struct task_struct *p, char *name, char **value) | |||
| 2684 | static int smack_setprocattr(struct task_struct *p, char *name, | 2684 | static int smack_setprocattr(struct task_struct *p, char *name, |
| 2685 | void *value, size_t size) | 2685 | void *value, size_t size) |
| 2686 | { | 2686 | { |
| 2687 | int rc; | ||
| 2688 | struct task_smack *tsp; | 2687 | struct task_smack *tsp; |
| 2689 | struct task_smack *oldtsp; | ||
| 2690 | struct cred *new; | 2688 | struct cred *new; |
| 2691 | char *newsmack; | 2689 | char *newsmack; |
| 2692 | 2690 | ||
| @@ -2716,21 +2714,13 @@ static int smack_setprocattr(struct task_struct *p, char *name, | |||
| 2716 | if (newsmack == smack_known_web.smk_known) | 2714 | if (newsmack == smack_known_web.smk_known) |
| 2717 | return -EPERM; | 2715 | return -EPERM; |
| 2718 | 2716 | ||
| 2719 | oldtsp = p->cred->security; | ||
| 2720 | new = prepare_creds(); | 2717 | new = prepare_creds(); |
| 2721 | if (new == NULL) | 2718 | if (new == NULL) |
| 2722 | return -ENOMEM; | 2719 | return -ENOMEM; |
| 2723 | 2720 | ||
| 2724 | tsp = new_task_smack(newsmack, oldtsp->smk_forked, GFP_KERNEL); | 2721 | tsp = new->security; |
| 2725 | if (tsp == NULL) { | 2722 | tsp->smk_task = newsmack; |
| 2726 | kfree(new); | ||
| 2727 | return -ENOMEM; | ||
| 2728 | } | ||
| 2729 | rc = smk_copy_rules(&tsp->smk_rules, &oldtsp->smk_rules, GFP_KERNEL); | ||
| 2730 | if (rc != 0) | ||
| 2731 | return rc; | ||
| 2732 | 2723 | ||
| 2733 | new->security = tsp; | ||
| 2734 | commit_creds(new); | 2724 | commit_creds(new); |
| 2735 | return size; | 2725 | return size; |
| 2736 | } | 2726 | } |
