diff options
author | Li RongQing <roy.qing.li@gmail.com> | 2014-10-17 16:53:23 +0800 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-11-05 10:03:21 +0100 |
commit | 690050bfb427bd2191188d032ad6bac5f277bafd (patch) | |
tree | 0f0a00ad464ad7f8739c3ba1b61c3ca659cfe3cd /net | |
parent | 4cb545d54ca5815e9a2d56daef266a39096e6157 (diff) | |
download | lwn-690050bfb427bd2191188d032ad6bac5f277bafd.tar.gz lwn-690050bfb427bd2191188d032ad6bac5f277bafd.zip |
ipv4: fix a potential use after free in ip_tunnel_core.c
[ Upstream commit 1245dfc8cadb258386fcd27df38215a0eccb1f17 ]
pskb_may_pull() maybe change skb->data and make eth pointer oboslete,
so set eth after pskb_may_pull()
Fixes:3d7b46cd("ip_tunnel: push generic protocol handling to ip_tunnel module")
Cc: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-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 8469d2338727..ff3f84f38e6d 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c @@ -91,11 +91,12 @@ int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto) skb_pull_rcsum(skb, hdr_len); if (inner_proto == htons(ETH_P_TEB)) { - struct ethhdr *eh = (struct ethhdr *)skb->data; + struct ethhdr *eh; if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) return -ENOMEM; + eh = (struct ethhdr *)skb->data; if (likely(ntohs(eh->h_proto) >= ETH_P_802_3_MIN)) skb->protocol = eh->h_proto; else |