]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
RDMA/nldev: Don't expose number of not-visible entries
authorLeon Romanovsky <leonro@mellanox.com>
Mon, 18 Feb 2019 20:25:52 +0000 (22:25 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 19 Feb 2019 17:13:39 +0000 (10:13 -0700)
Netlink dumpit handshake exchanges the index from which kernel should
start to return its value, in current code, this index included
not-visible in this PID items too and indirectly revealed the number of
entries.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/nldev.c

index 8b4f86ce50ce85e75e28c6d3c92ce346ed4a6888..e7350d9d60e9b748c189c6bc8b325548083b739b 100644 (file)
@@ -1123,13 +1123,10 @@ static int res_get_common_dumpit(struct sk_buff *skb,
         * objects.
         */
        xa_for_each(&rt->xa, id, res) {
-               if (idx < start)
-                       goto next;
-
                if (!is_visible_in_pid_ns(res))
-                       goto next;
+                       continue;
 
-               if (!rdma_restrack_get(res))
+               if (idx < start || !rdma_restrack_get(res))
                        goto next;
 
                xa_unlock(&rt->xa);