aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/nf_log_common.c
diff options
context:
space:
mode:
authorFlavio Leitner <fbl@redhat.com>2018-06-27 10:34:25 -0300
committerDavid S. Miller <davem@davemloft.net>2018-06-28 22:21:32 +0900
commitf564650106a6e85702660fefd59fdff0877ab46a (patch)
tree5bc5ca2ef701a097f0447a7073c2ee0be9b79e01 /net/netfilter/nf_log_common.c
parentMerge branch 'net-sched-actions-code-style-cleanup-and-fixes' (diff)
downloadlinux-dev-f564650106a6e85702660fefd59fdff0877ab46a.tar.xz
linux-dev-f564650106a6e85702660fefd59fdff0877ab46a.zip
netfilter: check if the socket netns is correct.
Netfilter assumes that if the socket is present in the skb, then it can be used because that reference is cleaned up while the skb is crossing netns. We want to change that to preserve the socket reference in a future patch, so this is a preparation updating netfilter to check if the socket netns matches before use it. Signed-off-by: Flavio Leitner <fbl@redhat.com> Acked-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netfilter/nf_log_common.c')
-rw-r--r--net/netfilter/nf_log_common.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/netfilter/nf_log_common.c b/net/netfilter/nf_log_common.c
index dc61399e30be..a8c5c846aec1 100644
--- a/net/netfilter/nf_log_common.c
+++ b/net/netfilter/nf_log_common.c
@@ -132,9 +132,10 @@ int nf_log_dump_tcp_header(struct nf_log_buf *m, const struct sk_buff *skb,
}
EXPORT_SYMBOL_GPL(nf_log_dump_tcp_header);
-void nf_log_dump_sk_uid_gid(struct nf_log_buf *m, struct sock *sk)
+void nf_log_dump_sk_uid_gid(struct net *net, struct nf_log_buf *m,
+ struct sock *sk)
{
- if (!sk || !sk_fullsock(sk))
+ if (!sk || !sk_fullsock(sk) || !net_eq(net, sock_net(sk)))
return;
read_lock_bh(&sk->sk_callback_lock);