diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-10-17 08:11:08 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-10-17 08:28:03 -0400 |
commit | f0a0a978b66fea782a52b0a7075b3fa9ab27ad0a (patch) | |
tree | 52ecc0eafbac697c6afaa542efe324984484120c /security/selinux/hooks.c | |
parent | c8d71d08aa23679f56e7072358383442c6ede352 (diff) | |
parent | 4be3158abe1e02d24f82b34101e41d662fae2185 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
This merge resolves conflicts with 75aec9df3a78 ("bridge: Remove
br_nf_push_frag_xmit_sk") as part of Eric Biederman's effort to improve
netns support in the network stack that reached upstream via David's
net-next tree.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Conflicts:
net/bridge/br_netfilter_hooks.c
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 659bb50f0232..26f4039d54b8 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -4898,7 +4898,7 @@ static unsigned int selinux_ip_output(struct sk_buff *skb, | |||
4898 | if (sk) { | 4898 | if (sk) { |
4899 | struct sk_security_struct *sksec; | 4899 | struct sk_security_struct *sksec; |
4900 | 4900 | ||
4901 | if (sk->sk_state == TCP_LISTEN) | 4901 | if (sk_listener(sk)) |
4902 | /* if the socket is the listening state then this | 4902 | /* if the socket is the listening state then this |
4903 | * packet is a SYN-ACK packet which means it needs to | 4903 | * packet is a SYN-ACK packet which means it needs to |
4904 | * be labeled based on the connection/request_sock and | 4904 | * be labeled based on the connection/request_sock and |
@@ -5005,7 +5005,7 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, | |||
5005 | * unfortunately, this means more work, but it is only once per | 5005 | * unfortunately, this means more work, but it is only once per |
5006 | * connection. */ | 5006 | * connection. */ |
5007 | if (skb_dst(skb) != NULL && skb_dst(skb)->xfrm != NULL && | 5007 | if (skb_dst(skb) != NULL && skb_dst(skb)->xfrm != NULL && |
5008 | !(sk != NULL && sk->sk_state == TCP_LISTEN)) | 5008 | !(sk && sk_listener(sk))) |
5009 | return NF_ACCEPT; | 5009 | return NF_ACCEPT; |
5010 | #endif | 5010 | #endif |
5011 | 5011 | ||
@@ -5022,7 +5022,7 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, | |||
5022 | secmark_perm = PACKET__SEND; | 5022 | secmark_perm = PACKET__SEND; |
5023 | peer_sid = SECINITSID_KERNEL; | 5023 | peer_sid = SECINITSID_KERNEL; |
5024 | } | 5024 | } |
5025 | } else if (sk->sk_state == TCP_LISTEN) { | 5025 | } else if (sk_listener(sk)) { |
5026 | /* Locally generated packet but the associated socket is in the | 5026 | /* Locally generated packet but the associated socket is in the |
5027 | * listening state which means this is a SYN-ACK packet. In | 5027 | * listening state which means this is a SYN-ACK packet. In |
5028 | * this particular case the correct security label is assigned | 5028 | * this particular case the correct security label is assigned |
@@ -5033,7 +5033,11 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, | |||
5033 | * selinux_inet_conn_request(). See also selinux_ip_output() | 5033 | * selinux_inet_conn_request(). See also selinux_ip_output() |
5034 | * for similar problems. */ | 5034 | * for similar problems. */ |
5035 | u32 skb_sid; | 5035 | u32 skb_sid; |
5036 | struct sk_security_struct *sksec = sk->sk_security; | 5036 | struct sk_security_struct *sksec; |
5037 | |||
5038 | if (sk->sk_state == TCP_NEW_SYN_RECV) | ||
5039 | sk = inet_reqsk(sk)->rsk_listener; | ||
5040 | sksec = sk->sk_security; | ||
5037 | if (selinux_skb_peerlbl_sid(skb, family, &skb_sid)) | 5041 | if (selinux_skb_peerlbl_sid(skb, family, &skb_sid)) |
5038 | return NF_DROP; | 5042 | return NF_DROP; |
5039 | /* At this point, if the returned skb peerlbl is SECSID_NULL | 5043 | /* At this point, if the returned skb peerlbl is SECSID_NULL |