Commit 1e313678 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

ipv4: fix refcount leak in fib_check_nh()



fib_lookup() forces FIB_LOOKUP_NOREF flag, while fib_table_lookup()
does not.

This patch solves the typical message at reboot time or device
dismantle :

unregister_netdevice: waiting for eth0 to become free. Usage count = 4

Fixes: 3bfd8472 ("net: Use passed in table for nexthop lookups")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: David Ahern <dsa@cumulusnetworks.com>
Acked-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d52736e2
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -708,7 +708,8 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,


			if (tbl)
			if (tbl)
				err = fib_table_lookup(tbl, &fl4, &res,
				err = fib_table_lookup(tbl, &fl4, &res,
						   FIB_LOOKUP_IGNORE_LINKSTATE);
						       FIB_LOOKUP_IGNORE_LINKSTATE |
						       FIB_LOOKUP_NOREF);
			else
			else
				err = fib_lookup(net, &fl4, &res,
				err = fib_lookup(net, &fl4, &res,
						 FIB_LOOKUP_IGNORE_LINKSTATE);
						 FIB_LOOKUP_IGNORE_LINKSTATE);