ipv6: Fix dump of specific table with strict checking
authorDavid Ahern <dsahern@gmail.com>
Thu, 3 Jan 2019 02:26:13 +0000 (18:26 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 Jan 2019 04:15:43 +0000 (20:15 -0800)
Dump of a specific table with strict checking enabled is looping. The
problem is that the end of the table dump is not marked in the cb. When
dumping a specific table, cb args 0 and 1 are not used (they are the hash
index and entry with an hash table index when dumping all tables). Re-use
args[0] to hold a 'done' flag for the specific table dump.

Fixes: 13e38901d46ca ("net/ipv6: Plumb support for filtering route dumps")
Reported-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6_fib.c

index ae3786132c236b2bcde4f8f3008fceb2d6bc1cdd..6613d8dbb0e5a5c3ba883c957e5bc4ba2bf00777 100644 (file)
@@ -627,7 +627,11 @@ static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
                        return -ENOENT;
                }
 
-               res = fib6_dump_table(tb, skb, cb);
+               if (!cb->args[0]) {
+                       res = fib6_dump_table(tb, skb, cb);
+                       if (!res)
+                               cb->args[0] = 1;
+               }
                goto out;
        }