[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALDO+SaBrnE2rvnCw61J=eTE-h5ahKr7TZ5kznhZR08w6bs2Cw@mail.gmail.com>
Date: Fri, 13 Jul 2018 15:39:43 -0700
From: William Tu <u9012063@...il.com>
To: Prashant Bhole <bhole_prashant_q7@....ntt.co.jp>
Cc: "David S . Miller" <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] net: ip6_gre: get ipv6hdr after skb_cow_head()
On Thu, Jul 12, 2018 at 10:40 PM, Prashant Bhole
<bhole_prashant_q7@....ntt.co.jp> wrote:
> A KASAN:use-after-free bug was found related to ip6-erspan
> while running selftests/net/ip6_gre_headroom.sh
>
> It happens because of following sequence:
> - ipv6hdr pointer is obtained from skb
> - skb_cow_head() is called, skb->head memory is reallocated
> - old data is accessed using ipv6hdr pointer
>
> skb_cow_head() call was added in e41c7c68ea77 ("ip6erspan: make sure
> enough headroom at xmit."), but looking at the history there was a
> chance of similar bug because gre_handle_offloads() and pskb_trim()
> can also reallocate skb->head memory. Fixes tag points to commit
> which introduced possibility of this bug.
>
> This patch moves ipv6hdr pointer assignment after skb_cow_head() call.
>
> Fixes: 5a963eb61b7c ("ip6_gre: Add ERSPAN native tunnel support")
> Signed-off-by: Prashant Bhole <bhole_prashant_q7@....ntt.co.jp>
> ---
Thanks for the fix.
Acked-by: William Tu <u9012063@...il.com>
Powered by blists - more mailing lists