diff options
author | Hannes Frederic Sowa <hannes@stressinduktion.org> | 2015-04-08 17:01:22 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-08 12:09:42 -0400 |
commit | 926a882f6916fd76b6f8ee858d45a2241c5e7999 (patch) | |
tree | 3881c4b8379091fc59e20309e22a0661d2b8b807 /net/ipv4 | |
parent | 8bc0034cf6951a107e0c75c2d10b17b57d681229 (diff) | |
download | linux-926a882f6916fd76b6f8ee858d45a2241c5e7999.tar.bz2 |
ipv4: ip_tunnel: use net namespace from rtable not socket
The socket parameter might legally be NULL, thus sock_net is sometimes
causing a NULL pointer dereference. Using net_device pointer in dst_entry
is more reliable.
Fixes: b6a7719aedd7e5c ("ipv4: hash net ptr into fragmentation bucket selection")
Reported-by: Rick Jones <rick.jones2@hp.com>
Cc: Rick Jones <rick.jones2@hp.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ip_tunnel_core.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c index 8c4dcc46acd2..ce63ab21b6cd 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c @@ -74,7 +74,8 @@ int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, iph->daddr = dst; iph->saddr = src; iph->ttl = ttl; - __ip_select_ident(sock_net(sk), iph, skb_shinfo(skb)->gso_segs ?: 1); + __ip_select_ident(dev_net(rt->dst.dev), iph, + skb_shinfo(skb)->gso_segs ?: 1); err = ip_local_out_sk(sk, skb); if (unlikely(net_xmit_eval(err))) |