diff options
author | Li Hongjun <hongjun.li@6wind.com> | 2013-08-28 11:54:50 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-30 23:13:28 +0200 |
commit | 737e828bdbdaf2f9d7de07f20a0308ac46ce5178 (patch) | |
tree | ab12496674c4006b6a5cde6c53b7e18407bb1d44 /net/ipv6/sit.c | |
parent | tipc: set sk_err correctly when connection fails (diff) | |
download | linux-737e828bdbdaf2f9d7de07f20a0308ac46ce5178.tar.xz linux-737e828bdbdaf2f9d7de07f20a0308ac46ce5178.zip |
ipv4 tunnels: fix an oops when using ipip/sit with IPsec
Since commit 3d7b46cd20e3 (ip_tunnel: push generic protocol handling to
ip_tunnel module.), an Oops is triggered when an xfrm policy is configured on
an IPv4 over IPv4 tunnel.
xfrm4_policy_check() calls __xfrm_policy_check2(), which uses skb_dst(skb). But
this field is NULL because iptunnel_pull_header() calls skb_dst_drop(skb).
Signed-off-by: Li Hongjun <hongjun.li@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | net/ipv6/sit.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index fbfc5a83867f..21b25dd8466b 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -645,11 +645,7 @@ static int ipip_rcv(struct sk_buff *skb) const struct iphdr *iph; struct ip_tunnel *tunnel; - if (iptunnel_pull_header(skb, 0, tpi.proto)) - goto drop; - iph = ip_hdr(skb); - tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev, iph->saddr, iph->daddr); if (tunnel != NULL) { @@ -659,6 +655,8 @@ static int ipip_rcv(struct sk_buff *skb) if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) goto drop; + if (iptunnel_pull_header(skb, 0, tpi.proto)) + goto drop; return ip_tunnel_rcv(tunnel, skb, &tpi, log_ecn_error); } |