linux/drivers/net/netdevsim
Ido Schimmel 180a6a3ee6 netdevsim: fib: Fix reference count leak on route deletion failure
As part of FIB offload simulation, netdevsim stores IPv4 and IPv6 routes
and holds a reference on FIB info structures that in turn hold a
reference on the associated nexthop device(s).

In the unlikely case where we are unable to allocate memory to process a
route deletion request, netdevsim will not release the reference from
the associated FIB info structure, thereby preventing the associated
nexthop device(s) from ever being removed [1].

Fix this by scheduling a work item that will flush netdevsim's FIB table
upon route deletion failure. This will cause netdevsim to release its
reference from all the FIB info structures in its table.

Reported by Lucas Leong of Trend Micro Zero Day Initiative.

Fixes: 0ae3eb7b46 ("netdevsim: fib: Perform the route programming in a non-atomic context")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-07-29 12:21:02 +01:00
..
bpf.c netdevsim: Zero-initialize memory for new map's value in function nsim_bpf_map_alloc 2021-12-15 17:49:13 -08:00
bus.c netdevsim: rename 'driver' entry points 2021-11-01 13:29:41 +00:00
dev.c devlink: hold the instance lock during eswitch_mode callbacks 2022-03-21 14:11:38 +00:00
ethtool.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-12-16 16:13:19 -08:00
fib.c netdevsim: fib: Fix reference count leak on route deletion failure 2022-07-29 12:21:02 +01:00
health.c devlink: Delete not-used devlink APIs 2021-09-17 14:19:39 +01:00
hwstats.c netdevsim: Introduce support for L3 offload xstats 2022-03-15 14:00:51 +01:00
ipsec.c netdevsim: rely on XFRM state direction instead of flags 2022-05-06 08:34:33 +02:00
Makefile netdevsim: Introduce support for L3 offload xstats 2022-03-15 14:00:51 +01:00
netdev.c netdevsim: move vfconfig to nsim_dev 2021-11-01 13:29:41 +00:00
netdevsim.h netdevsim: replace vfs_lock with devlink instance lock 2022-03-21 14:11:38 +00:00
psample.c netdevsim: Only use sampling truncation length when valid 2021-04-22 13:23:56 -07:00
udp_tunnels.c netdevsim: set .owner to THIS_MODULE 2020-11-17 14:08:59 -08:00