* [PATCH] ipv4: fix a potential use after free
@ 2014-10-17 8:53 roy.qing.li
2014-10-17 17:07 ` Pravin Shelar
2014-10-18 3:46 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: roy.qing.li @ 2014-10-17 8:53 UTC (permalink / raw)
To: netdev; +Cc: pshelar
From: Li RongQing <roy.qing.li@gmail.com>
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>
---
net/ipv4/ip_tunnel_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index f4c987b..88c386c 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
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv4: fix a potential use after free
2014-10-17 8:53 [PATCH] ipv4: fix a potential use after free roy.qing.li
@ 2014-10-17 17:07 ` Pravin Shelar
2014-10-18 3:46 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Pravin Shelar @ 2014-10-17 17:07 UTC (permalink / raw)
To: Li RongQing; +Cc: netdev
On Fri, Oct 17, 2014 at 1:53 AM, <roy.qing.li@gmail.com> wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
>
> 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>
Looks good.
Acked-by: Pravin B Shelar <pshelar@nicira.com>
> ---
> net/ipv4/ip_tunnel_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
> index f4c987b..88c386c 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
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv4: fix a potential use after free
2014-10-17 8:53 [PATCH] ipv4: fix a potential use after free roy.qing.li
2014-10-17 17:07 ` Pravin Shelar
@ 2014-10-18 3:46 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-10-18 3:46 UTC (permalink / raw)
To: roy.qing.li; +Cc: netdev, pshelar
From: roy.qing.li@gmail.com
Date: Fri, 17 Oct 2014 16:53:23 +0800
> From: Li RongQing <roy.qing.li@gmail.com>
>
> 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>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-18 3:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-17 8:53 [PATCH] ipv4: fix a potential use after free roy.qing.li
2014-10-17 17:07 ` Pravin Shelar
2014-10-18 3:46 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.