netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: bhole_prashant_q7@lab.ntt.co.jp
Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org,
	u9012063@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next] net: ip6_gre: get ipv6hdr after skb_cow_head()
Date: Mon, 16 Jul 2018 13:40:33 -0700 (PDT)	[thread overview]
Message-ID: <20180716.134033.1692048780587026378.davem@davemloft.net> (raw)
In-Reply-To: <20180713054050.5656-1-bhole_prashant_q7@lab.ntt.co.jp>

From: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Date: Fri, 13 Jul 2018 14:40:50 +0900

> 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@lab.ntt.co.jp>

This bug goes back to 4.16, therefore applied to 'net' and queued up
for -stable.

Please do not submit bug fixes against 'net-next' in this situation
in the future.

Thanks.

      parent reply	other threads:[~2018-07-16 21:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13  5:40 [PATCH net-next] net: ip6_gre: get ipv6hdr after skb_cow_head() Prashant Bhole
2018-07-13 20:45 ` Gregory Rose
2018-07-13 22:39 ` William Tu
2018-07-16 20:40 ` David Miller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180716.134033.1692048780587026378.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=bhole_prashant_q7@lab.ntt.co.jp \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=u9012063@gmail.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).