diff options
Diffstat (limited to 'security/smack/smack_lsm.c')
-rw-r--r-- | security/smack/smack_lsm.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 84b62b5e9e2c..fd20d15f5b9a 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -1508,7 +1508,8 @@ static char *smack_host_label(struct sockaddr_in *sip) | |||
1508 | if (siap->s_addr == 0) | 1508 | if (siap->s_addr == 0) |
1509 | return NULL; | 1509 | return NULL; |
1510 | 1510 | ||
1511 | for (snp = smack_netlbladdrs; snp != NULL; snp = snp->smk_next) { | 1511 | rcu_read_lock(); |
1512 | list_for_each_entry_rcu(snp, &smk_netlbladdr_list, list) { | ||
1512 | /* | 1513 | /* |
1513 | * we break after finding the first match because | 1514 | * we break after finding the first match because |
1514 | * the list is sorted from longest to shortest mask | 1515 | * the list is sorted from longest to shortest mask |
@@ -1516,10 +1517,11 @@ static char *smack_host_label(struct sockaddr_in *sip) | |||
1516 | */ | 1517 | */ |
1517 | if ((&snp->smk_host.sin_addr)->s_addr == | 1518 | if ((&snp->smk_host.sin_addr)->s_addr == |
1518 | (siap->s_addr & (&snp->smk_mask)->s_addr)) { | 1519 | (siap->s_addr & (&snp->smk_mask)->s_addr)) { |
1520 | rcu_read_unlock(); | ||
1519 | return snp->smk_label; | 1521 | return snp->smk_label; |
1520 | } | 1522 | } |
1521 | } | 1523 | } |
1522 | 1524 | rcu_read_unlock(); | |
1523 | return NULL; | 1525 | return NULL; |
1524 | } | 1526 | } |
1525 | 1527 | ||
@@ -2930,6 +2932,17 @@ struct security_operations smack_ops = { | |||
2930 | .release_secctx = smack_release_secctx, | 2932 | .release_secctx = smack_release_secctx, |
2931 | }; | 2933 | }; |
2932 | 2934 | ||
2935 | |||
2936 | static __init void init_smack_know_list(void) | ||
2937 | { | ||
2938 | list_add(&smack_known_huh.list, &smack_known_list); | ||
2939 | list_add(&smack_known_hat.list, &smack_known_list); | ||
2940 | list_add(&smack_known_star.list, &smack_known_list); | ||
2941 | list_add(&smack_known_floor.list, &smack_known_list); | ||
2942 | list_add(&smack_known_invalid.list, &smack_known_list); | ||
2943 | list_add(&smack_known_web.list, &smack_known_list); | ||
2944 | } | ||
2945 | |||
2933 | /** | 2946 | /** |
2934 | * smack_init - initialize the smack system | 2947 | * smack_init - initialize the smack system |
2935 | * | 2948 | * |
@@ -2950,6 +2963,8 @@ static __init int smack_init(void) | |||
2950 | cred = (struct cred *) current->cred; | 2963 | cred = (struct cred *) current->cred; |
2951 | cred->security = &smack_known_floor.smk_known; | 2964 | cred->security = &smack_known_floor.smk_known; |
2952 | 2965 | ||
2966 | /* initilize the smack_know_list */ | ||
2967 | init_smack_know_list(); | ||
2953 | /* | 2968 | /* |
2954 | * Initialize locks | 2969 | * Initialize locks |
2955 | */ | 2970 | */ |