Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'net-add-missing-netlink-policies'

Jakub Kicinski says:

====================
net: add missing netlink policies

Recent one-off fixes motivated me to do some grepping for
more missing netlink attribute policies. I didn't manage
to even produce a KASAN splat with these, but it should
be possible with sufficient luck. All the missing policies
are pretty trivial (NLA_Uxx).

I've only tested the devlink patches, the rest compiles.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+40 -12
+1
drivers/net/can/dev.c
··· 883 883 = { .len = sizeof(struct can_bittiming) }, 884 884 [IFLA_CAN_DATA_BITTIMING_CONST] 885 885 = { .len = sizeof(struct can_bittiming_const) }, 886 + [IFLA_CAN_TERMINATION] = { .type = NLA_U16 }, 886 887 }; 887 888 888 889 static int can_validate(struct nlattr *tb[], struct nlattr *data[],
+1
drivers/net/macsec.c
··· 3342 3342 3343 3343 static const struct nla_policy macsec_rtnl_policy[IFLA_MACSEC_MAX + 1] = { 3344 3344 [IFLA_MACSEC_SCI] = { .type = NLA_U64 }, 3345 + [IFLA_MACSEC_PORT] = { .type = NLA_U16 }, 3345 3346 [IFLA_MACSEC_ICV_LEN] = { .type = NLA_U8 }, 3346 3347 [IFLA_MACSEC_CIPHER_SUITE] = { .type = NLA_U64 }, 3347 3348 [IFLA_MACSEC_WINDOW] = { .type = NLA_U32 },
+2
drivers/net/team/team.c
··· 2240 2240 [TEAM_ATTR_OPTION_CHANGED] = { .type = NLA_FLAG }, 2241 2241 [TEAM_ATTR_OPTION_TYPE] = { .type = NLA_U8 }, 2242 2242 [TEAM_ATTR_OPTION_DATA] = { .type = NLA_BINARY }, 2243 + [TEAM_ATTR_OPTION_PORT_IFINDEX] = { .type = NLA_U32 }, 2244 + [TEAM_ATTR_OPTION_ARRAY_INDEX] = { .type = NLA_U32 }, 2243 2245 }; 2244 2246 2245 2247 static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
+1
include/net/fib_rules.h
··· 108 108 [FRA_OIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \ 109 109 [FRA_PRIORITY] = { .type = NLA_U32 }, \ 110 110 [FRA_FWMARK] = { .type = NLA_U32 }, \ 111 + [FRA_TUN_ID] = { .type = NLA_U64 }, \ 111 112 [FRA_FWMASK] = { .type = NLA_U32 }, \ 112 113 [FRA_TABLE] = { .type = NLA_U32 }, \ 113 114 [FRA_SUPPRESS_PREFIXLEN] = { .type = NLA_U32 }, \
+21 -12
net/core/devlink.c
··· 3352 3352 struct genl_info *info, 3353 3353 union devlink_param_value *value) 3354 3354 { 3355 + struct nlattr *param_data; 3355 3356 int len; 3356 3357 3357 - if (param->type != DEVLINK_PARAM_TYPE_BOOL && 3358 - !info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]) 3358 + param_data = info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]; 3359 + 3360 + if (param->type != DEVLINK_PARAM_TYPE_BOOL && !param_data) 3359 3361 return -EINVAL; 3360 3362 3361 3363 switch (param->type) { 3362 3364 case DEVLINK_PARAM_TYPE_U8: 3363 - value->vu8 = nla_get_u8(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]); 3365 + if (nla_len(param_data) != sizeof(u8)) 3366 + return -EINVAL; 3367 + value->vu8 = nla_get_u8(param_data); 3364 3368 break; 3365 3369 case DEVLINK_PARAM_TYPE_U16: 3366 - value->vu16 = nla_get_u16(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]); 3370 + if (nla_len(param_data) != sizeof(u16)) 3371 + return -EINVAL; 3372 + value->vu16 = nla_get_u16(param_data); 3367 3373 break; 3368 3374 case DEVLINK_PARAM_TYPE_U32: 3369 - value->vu32 = nla_get_u32(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]); 3375 + if (nla_len(param_data) != sizeof(u32)) 3376 + return -EINVAL; 3377 + value->vu32 = nla_get_u32(param_data); 3370 3378 break; 3371 3379 case DEVLINK_PARAM_TYPE_STRING: 3372 - len = strnlen(nla_data(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]), 3373 - nla_len(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA])); 3374 - if (len == nla_len(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]) || 3380 + len = strnlen(nla_data(param_data), nla_len(param_data)); 3381 + if (len == nla_len(param_data) || 3375 3382 len >= __DEVLINK_PARAM_MAX_STRING_VALUE) 3376 3383 return -EINVAL; 3377 - strcpy(value->vstr, 3378 - nla_data(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA])); 3384 + strcpy(value->vstr, nla_data(param_data)); 3379 3385 break; 3380 3386 case DEVLINK_PARAM_TYPE_BOOL: 3381 - value->vbool = info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA] ? 3382 - true : false; 3387 + if (param_data && nla_len(param_data)) 3388 + return -EINVAL; 3389 + value->vbool = nla_get_flag(param_data); 3383 3390 break; 3384 3391 } 3385 3392 return 0; ··· 5958 5951 [DEVLINK_ATTR_PARAM_VALUE_CMODE] = { .type = NLA_U8 }, 5959 5952 [DEVLINK_ATTR_REGION_NAME] = { .type = NLA_NUL_STRING }, 5960 5953 [DEVLINK_ATTR_REGION_SNAPSHOT_ID] = { .type = NLA_U32 }, 5954 + [DEVLINK_ATTR_REGION_CHUNK_ADDR] = { .type = NLA_U64 }, 5955 + [DEVLINK_ATTR_REGION_CHUNK_LEN] = { .type = NLA_U64 }, 5961 5956 [DEVLINK_ATTR_HEALTH_REPORTER_NAME] = { .type = NLA_NUL_STRING }, 5962 5957 [DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD] = { .type = NLA_U64 }, 5963 5958 [DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER] = { .type = NLA_U8 },
+6
net/ieee802154/nl_policy.c
··· 21 21 [IEEE802154_ATTR_HW_ADDR] = { .type = NLA_HW_ADDR, }, 22 22 [IEEE802154_ATTR_PAN_ID] = { .type = NLA_U16, }, 23 23 [IEEE802154_ATTR_CHANNEL] = { .type = NLA_U8, }, 24 + [IEEE802154_ATTR_BCN_ORD] = { .type = NLA_U8, }, 25 + [IEEE802154_ATTR_SF_ORD] = { .type = NLA_U8, }, 26 + [IEEE802154_ATTR_PAN_COORD] = { .type = NLA_U8, }, 27 + [IEEE802154_ATTR_BAT_EXT] = { .type = NLA_U8, }, 28 + [IEEE802154_ATTR_COORD_REALIGN] = { .type = NLA_U8, }, 24 29 [IEEE802154_ATTR_PAGE] = { .type = NLA_U8, }, 30 + [IEEE802154_ATTR_DEV_TYPE] = { .type = NLA_U8, }, 25 31 [IEEE802154_ATTR_COORD_SHORT_ADDR] = { .type = NLA_U16, }, 26 32 [IEEE802154_ATTR_COORD_HW_ADDR] = { .type = NLA_HW_ADDR, }, 27 33 [IEEE802154_ATTR_COORD_PAN_ID] = { .type = NLA_U16, },
+4
net/nfc/netlink.c
··· 32 32 [NFC_ATTR_DEVICE_NAME] = { .type = NLA_STRING, 33 33 .len = NFC_DEVICE_NAME_MAXSIZE }, 34 34 [NFC_ATTR_PROTOCOLS] = { .type = NLA_U32 }, 35 + [NFC_ATTR_TARGET_INDEX] = { .type = NLA_U32 }, 35 36 [NFC_ATTR_COMM_MODE] = { .type = NLA_U8 }, 36 37 [NFC_ATTR_RF_MODE] = { .type = NLA_U8 }, 37 38 [NFC_ATTR_DEVICE_POWERED] = { .type = NLA_U8 }, ··· 44 43 [NFC_ATTR_LLC_SDP] = { .type = NLA_NESTED }, 45 44 [NFC_ATTR_FIRMWARE_NAME] = { .type = NLA_STRING, 46 45 .len = NFC_FIRMWARE_NAME_MAXSIZE }, 46 + [NFC_ATTR_SE_INDEX] = { .type = NLA_U32 }, 47 47 [NFC_ATTR_SE_APDU] = { .type = NLA_BINARY }, 48 + [NFC_ATTR_VENDOR_ID] = { .type = NLA_U32 }, 49 + [NFC_ATTR_VENDOR_SUBCMD] = { .type = NLA_U32 }, 48 50 [NFC_ATTR_VENDOR_DATA] = { .type = NLA_BINARY }, 49 51 50 52 };
+1
net/openvswitch/datapath.c
··· 645 645 [OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED }, 646 646 [OVS_PACKET_ATTR_PROBE] = { .type = NLA_FLAG }, 647 647 [OVS_PACKET_ATTR_MRU] = { .type = NLA_U16 }, 648 + [OVS_PACKET_ATTR_HASH] = { .type = NLA_U64 }, 648 649 }; 649 650 650 651 static const struct genl_ops dp_packet_genl_ops[] = {
+1
net/sched/sch_fq.c
··· 744 744 [TCA_FQ_FLOW_MAX_RATE] = { .type = NLA_U32 }, 745 745 [TCA_FQ_BUCKETS_LOG] = { .type = NLA_U32 }, 746 746 [TCA_FQ_FLOW_REFILL_DELAY] = { .type = NLA_U32 }, 747 + [TCA_FQ_ORPHAN_MASK] = { .type = NLA_U32 }, 747 748 [TCA_FQ_LOW_RATE_THRESHOLD] = { .type = NLA_U32 }, 748 749 [TCA_FQ_CE_THRESHOLD] = { .type = NLA_U32 }, 749 750 };
+1
net/sched/sch_taprio.c
··· 768 768 [TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME] = { .type = NLA_S64 }, 769 769 [TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION] = { .type = NLA_S64 }, 770 770 [TCA_TAPRIO_ATTR_FLAGS] = { .type = NLA_U32 }, 771 + [TCA_TAPRIO_ATTR_TXTIME_DELAY] = { .type = NLA_U32 }, 771 772 }; 772 773 773 774 static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry,
+1
net/tipc/netlink.c
··· 116 116 [TIPC_NLA_PROP_PRIO] = { .type = NLA_U32 }, 117 117 [TIPC_NLA_PROP_TOL] = { .type = NLA_U32 }, 118 118 [TIPC_NLA_PROP_WIN] = { .type = NLA_U32 }, 119 + [TIPC_NLA_PROP_MTU] = { .type = NLA_U32 }, 119 120 [TIPC_NLA_PROP_BROADCAST] = { .type = NLA_U32 }, 120 121 [TIPC_NLA_PROP_BROADCAST_RATIO] = { .type = NLA_U32 } 121 122 };