From: Eric Dumazet Date: Sat, 15 Aug 2015 17:54:07 +0000 (-0700) Subject: ipv4: fix refcount leak in fib_check_nh() X-Git-Tag: firefly_0821_release~176^2~1159^2~164 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1e3136789975f03e461798149309034e5213c1b4;p=firefly-linux-kernel-4.4.55.git 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: 3bfd847203c6 ("net: Use passed in table for nexthop lookups") Signed-off-by: Eric Dumazet Cc: David Ahern Acked-by: David Ahern Signed-off-by: David S. Miller --- diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index b7f1d20a9615..c8025851dac7 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -708,7 +708,8 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi, if (tbl) err = fib_table_lookup(tbl, &fl4, &res, - FIB_LOOKUP_IGNORE_LINKSTATE); + FIB_LOOKUP_IGNORE_LINKSTATE | + FIB_LOOKUP_NOREF); else err = fib_lookup(net, &fl4, &res, FIB_LOOKUP_IGNORE_LINKSTATE);