diff options
author | Eric Dumazet <edumazet@google.com> | 2015-11-08 13:54:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-11-08 20:56:38 -0500 |
commit | 8827d90e29e664aa959817467a3da72041ca2269 (patch) | |
tree | b93d7f1df7eeb6411f300f9b94e1737f96ff350e | |
parent | 54abc686c2d111e98228943a7e1e51cc256e35d9 (diff) |
smack: use skb_to_full_sk() helper
This module wants to access sk->sk_security, which is not
available for request sockets.
Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of listener")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | security/smack/smack_netfilter.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/security/smack/smack_netfilter.c b/security/smack/smack_netfilter.c index 6d1706c9777e..aa6bf1b22ec5 100644 --- a/security/smack/smack_netfilter.c +++ b/security/smack/smack_netfilter.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/netfilter_ipv4.h> | 17 | #include <linux/netfilter_ipv4.h> |
18 | #include <linux/netfilter_ipv6.h> | 18 | #include <linux/netfilter_ipv6.h> |
19 | #include <linux/netdevice.h> | 19 | #include <linux/netdevice.h> |
20 | #include <net/inet_sock.h> | ||
20 | #include "smack.h" | 21 | #include "smack.h" |
21 | 22 | ||
22 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 23 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
@@ -25,11 +26,12 @@ static unsigned int smack_ipv6_output(void *priv, | |||
25 | struct sk_buff *skb, | 26 | struct sk_buff *skb, |
26 | const struct nf_hook_state *state) | 27 | const struct nf_hook_state *state) |
27 | { | 28 | { |
29 | struct sock *sk = skb_to_full_sk(skb); | ||
28 | struct socket_smack *ssp; | 30 | struct socket_smack *ssp; |
29 | struct smack_known *skp; | 31 | struct smack_known *skp; |
30 | 32 | ||
31 | if (skb && skb->sk && skb->sk->sk_security) { | 33 | if (sk && sk->sk_security) { |
32 | ssp = skb->sk->sk_security; | 34 | ssp = sk->sk_security; |
33 | skp = ssp->smk_out; | 35 | skp = ssp->smk_out; |
34 | skb->secmark = skp->smk_secid; | 36 | skb->secmark = skp->smk_secid; |
35 | } | 37 | } |
@@ -42,11 +44,12 @@ static unsigned int smack_ipv4_output(void *priv, | |||
42 | struct sk_buff *skb, | 44 | struct sk_buff *skb, |
43 | const struct nf_hook_state *state) | 45 | const struct nf_hook_state *state) |
44 | { | 46 | { |
47 | struct sock *sk = skb_to_full_sk(skb); | ||
45 | struct socket_smack *ssp; | 48 | struct socket_smack *ssp; |
46 | struct smack_known *skp; | 49 | struct smack_known *skp; |
47 | 50 | ||
48 | if (skb && skb->sk && skb->sk->sk_security) { | 51 | if (sk && sk->sk_security) { |
49 | ssp = skb->sk->sk_security; | 52 | ssp = sk->sk_security; |
50 | skp = ssp->smk_out; | 53 | skp = ssp->smk_out; |
51 | skb->secmark = skp->smk_secid; | 54 | skb->secmark = skp->smk_secid; |
52 | } | 55 | } |