RDMA/netlink: Audit policy settings for netlink attributes
authorDoug Ledford <dledford@redhat.com>
Fri, 21 Jun 2019 21:00:44 +0000 (17:00 -0400)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 25 Jun 2019 19:26:54 +0000 (16:26 -0300)
commit34d65cd837d0c77fac0c0da632c616030b2927e3
tree6f6fce7a3ca546a087090a6fcd84b9f3e8a4a7e7
parente9816ddf2a33f3afdf3dfc35c21aafad389ee482
RDMA/netlink: Audit policy settings for netlink attributes

For all string attributes for which we don't currently accept the element
as input, we only use it as output, set the string length to
RDMA_NLDEV_ATTR_EMPTY_STRING which is defined as 1.  That way we will only
accept a null string for that element.  This will prevent someone from
writing a new input routine that uses the element without also updating
the policy to have a valid value.

Also while there, make sure the existing entries that are valid have the
correct policy, if not, correct the policy.  Remove unnecessary checks
for nla_strlcpy() overflow once the policy has been set correctly.

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/nldev.c
include/rdma/rdma_netlink.h
include/uapi/rdma/rdma_netlink.h