ipv6: NULL pointer dereferrence in tcp_v6_send_ack

The following actions are possible:
tcp_v6_rcv
skb->dev = NULL;
tcp_v6_do_rcv
tcp_v6_hnd_req
tcp_check_req
req->rsk_ops->send_ack == tcp_v6_send_ack

So, skb->dev can be NULL in tcp_v6_send_ack. We must obtain namespace
from dst entry.

Thanks to Vitaliy Gusev <vgusev@openvz.org> for initial problem finding
in IPv4 code.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Denis V. Lunev and committed by David S. Miller 2a5b8275 4dd7972d

+1 -1
+1 -1
net/ipv6/tcp_ipv6.c
··· 1050 struct tcphdr *th = tcp_hdr(skb), *t1; 1051 struct sk_buff *buff; 1052 struct flowi fl; 1053 - struct net *net = dev_net(skb->dev); 1054 struct sock *ctl_sk = net->ipv6.tcp_sk; 1055 unsigned int tot_len = sizeof(struct tcphdr); 1056 __be32 *topt;
··· 1050 struct tcphdr *th = tcp_hdr(skb), *t1; 1051 struct sk_buff *buff; 1052 struct flowi fl; 1053 + struct net *net = dev_net(skb->dst->dev); 1054 struct sock *ctl_sk = net->ipv6.tcp_sk; 1055 unsigned int tot_len = sizeof(struct tcphdr); 1056 __be32 *topt;