]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
rdma: Fix incorrectly handled NLA validation
authorLeon Romanovsky <leonro@mellanox.com>
Sun, 30 Dec 2018 13:34:09 +0000 (15:34 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 1 Jan 2019 06:15:13 +0000 (22:15 -0800)
mnl_attr_type_valid() receives maximum attribute type, which means that
we were supposed to supply the latest valid netlink attribute and not
the number of attributes. Such coding mistake caused to failures while
NLA attributes were extended.

Fixes: 74bd75c2b68d ("rdma: Add basic infrastructure for RDMA tool")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
rdma/utils.c

index 1a0cf56800d4c54ce31dbef2bb6227ab39e7e04c..c7023367001eff091050b4bbef1dc5ba63d75689 100644 (file)
@@ -425,8 +425,8 @@ int rd_attr_cb(const struct nlattr *attr, void *data)
        const struct nlattr **tb = data;
        int type;
 
-       if (mnl_attr_type_valid(attr, RDMA_NLDEV_ATTR_MAX) < 0)
-               /* We received uknown attribute */
+       if (mnl_attr_type_valid(attr, RDMA_NLDEV_ATTR_MAX - 1) < 0)
+               /* We received unknown attribute */
                return MNL_CB_OK;
 
        type = mnl_attr_get_type(attr);