[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALnjE+rb33CdoA5Paho4WyX=ED8WCo6G4BaHdQ4u6_N4DMqh9w@mail.gmail.com>
Date: Fri, 17 Oct 2014 10:07:37 -0700
From: Pravin Shelar <pshelar@...ira.com>
To: Li RongQing <roy.qing.li@...il.com>
Cc: netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH] ipv4: fix a potential use after free
On Fri, Oct 17, 2014 at 1:53 AM, <roy.qing.li@...il.com> wrote:
> From: Li RongQing <roy.qing.li@...il.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@...ira.com>
> Signed-off-by: Li RongQing <roy.qing.li@...il.com>
Looks good.
Acked-by: Pravin B Shelar <pshelar@...ira.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
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists