]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commit
ipv6: prevent possible fib6 leaks
authorEric Dumazet <edumazet@google.com>
Thu, 16 May 2019 02:39:52 +0000 (19:39 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 12 Aug 2019 09:30:38 +0000 (11:30 +0200)
commitb206977bb7296091c91da825dcc9e43a8b7f9a46
tree3ecd9795b55e687362aa90100927e2fb46e37b4e
parentaff8ce0a85d626d0f4745865712eeda2b79cf03a
ipv6: prevent possible fib6 leaks

BugLink: https://bugs.launchpad.net/bugs/1837516
[ Upstream commit 61fb0d01680771f72cc9d39783fb2c122aaad51e ]

At ipv6 route dismantle, fib6_drop_pcpu_from() is responsible
for finding all percpu routes and set their ->from pointer
to NULL, so that fib6_ref can reach its expected value (1).

The problem right now is that other cpus can still catch the
route being deleted, since there is no rcu grace period
between the route deletion and call to fib6_drop_pcpu_from()

This can leak the fib6 and associated resources, since no
notifier will take care of removing the last reference(s).

I decided to add another boolean (fib6_destroying) instead
of reusing/renaming exception_bucket_flushed to ease stable backports,
and properly document the memory barriers used to implement this fix.

This patch has been co-developped with Wei Wang.

Fixes: 93531c674315 ("net/ipv6: separate handling of FIB entries from dst based routes")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: Wei Wang <weiwan@google.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Martin Lau <kafai@fb.com>
Acked-by: Wei Wang <weiwan@google.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
include/net/ip6_fib.h
net/ipv6/ip6_fib.c
net/ipv6/route.c