Skip to content

Commit

Permalink
Smack: ipv6 label match fix
Browse files Browse the repository at this point in the history
The check for a deleted entry in the list of IPv6 host
addresses was being performed in the wrong place, leading
to most peculiar results in some cases. This puts the
check into the right place.

Signed-off-by: Casey Schaufler <[email protected]>
  • Loading branch information
cschaufler committed Nov 10, 2016
1 parent b437aba commit 2e4939f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions security/smack/smack_lsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2443,18 +2443,18 @@ static struct smack_known *smack_ipv6host_label(struct sockaddr_in6 *sip)
return NULL;

list_for_each_entry_rcu(snp, &smk_net6addr_list, list) {
/*
* If the label is NULL the entry has
* been renounced. Ignore it.
*/
if (snp->smk_label == NULL)
continue;
/*
* we break after finding the first match because
* the list is sorted from longest to shortest mask
* so we have found the most specific match
*/
for (found = 1, i = 0; i < 8; i++) {
/*
* If the label is NULL the entry has
* been renounced. Ignore it.
*/
if (snp->smk_label == NULL)
continue;
if ((sap->s6_addr16[i] & snp->smk_mask.s6_addr16[i]) !=
snp->smk_host.s6_addr16[i]) {
found = 0;
Expand Down

0 comments on commit 2e4939f

Please sign in to comment.