mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
This commit is contained in:
parent
e9816ddf2a
commit
34d65cd837
3 changed files with 18 additions and 17 deletions
|
|
@ -6,6 +6,12 @@
|
|||
#include <linux/netlink.h>
|
||||
#include <uapi/rdma/rdma_netlink.h>
|
||||
|
||||
enum {
|
||||
RDMA_NLDEV_ATTR_EMPTY_STRING = 1,
|
||||
RDMA_NLDEV_ATTR_ENTRY_STRLEN = 16,
|
||||
RDMA_NLDEV_ATTR_CHARDEV_TYPE_SIZE = 32,
|
||||
};
|
||||
|
||||
struct rdma_nl_cbs {
|
||||
int (*doit)(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||
struct netlink_ext_ack *extack);
|
||||
|
|
|
|||
Loading…
Reference in a new issue