All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Wei Wang <weiwan@google.com>, David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org
Cc: Eric Dumazet <edumazet@google.com>, Martin KaFai Lau <kafai@fb.com>
Subject: Re: [PATCH net] ipv6: use fib6_info_hold_safe() when necessary
Date: Mon, 23 Jul 2018 08:28:42 -0600	[thread overview]
Message-ID: <853fa714-9529-684b-78ed-a545c24a3894@gmail.com> (raw)
In-Reply-To: <20180722035632.136090-1-tracywwnj@gmail.com>

On 7/21/18 9:56 PM, Wei Wang wrote:
> From: Wei Wang <weiwan@google.com>
> 
> In the code path where only rcu read lock is held, e.g. in the route
> lookup code path, it is not safe to directly call fib6_info_hold()
> because the fib6_info may already have been deleted but still exists
> in the rcu grace period. Holding reference to it could cause double
> free and crash the kernel.
> 
> This patch adds a new function fib6_info_hold_safe() and replace
> fib6_info_hold() in all necessary places.
> 
> Syzbot reported 3 crash traces because of this. One of them is:
> 8021q: adding VLAN 0 to HW filter on device team0
> IPv6: ADDRCONF(NETDEV_CHANGE): team0: link becomes ready
> dst_release: dst:(____ptrval____) refcnt:-1
> dst_release: dst:(____ptrval____) refcnt:-2
> WARNING: CPU: 1 PID: 4845 at include/net/dst.h:239 dst_hold include/net/dst.h:239 [inline]
> WARNING: CPU: 1 PID: 4845 at include/net/dst.h:239 ip6_setup_cork+0xd66/0x1830 net/ipv6/ip6_output.c:1204
> dst_release: dst:(____ptrval____) refcnt:-1
> Kernel panic - not syncing: panic_on_warn set ...
> 

...

> 
> Fixes: 93531c674315 (net/ipv6: separate handling of FIB entries from dst based routes)
> Reported-by: syzbot+902e2a1bcd4f7808cef5@syzkaller.appspotmail.com
> Reported-by: syzbot+8ae62d67f647abeeceb9@syzkaller.appspotmail.com
> Reported-by: syzbot+3f08feb14086930677d0@syzkaller.appspotmail.com
> Signed-off-by: Wei Wang <weiwan@google.com>
> Acked-by: Eric Dumazet <edumazet@google.com>
> ---
>  include/net/ip6_fib.h |  5 +++++
>  net/ipv6/addrconf.c   |  3 ++-
>  net/ipv6/route.c      | 41 +++++++++++++++++++++++++++++++----------
>  3 files changed, 38 insertions(+), 11 deletions(-)

Reviewed-by: David Ahern <dsahern@gmail.com>

Thanks for fixing.

  reply	other threads:[~2018-07-23 15:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-22  3:56 [PATCH net] ipv6: use fib6_info_hold_safe() when necessary Wei Wang
2018-07-23 14:28 ` David Ahern [this message]
2018-07-23 18:19 ` David Miller
2018-07-23 18:25 ` Martin KaFai Lau

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=853fa714-9529-684b-78ed-a545c24a3894@gmail.com \
    --to=dsahern@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=weiwan@google.com \
    /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 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.