mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-09 14:14:00 +08:00
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>
This commit is contained in:
commit
a6fbcddad6
@ -883,6 +883,7 @@ static const struct nla_policy can_policy[IFLA_CAN_MAX + 1] = {
|
||||
= { .len = sizeof(struct can_bittiming) },
|
||||
[IFLA_CAN_DATA_BITTIMING_CONST]
|
||||
= { .len = sizeof(struct can_bittiming_const) },
|
||||
[IFLA_CAN_TERMINATION] = { .type = NLA_U16 },
|
||||
};
|
||||
|
||||
static int can_validate(struct nlattr *tb[], struct nlattr *data[],
|
||||
|
@ -3342,6 +3342,7 @@ static const struct device_type macsec_type = {
|
||||
|
||||
static const struct nla_policy macsec_rtnl_policy[IFLA_MACSEC_MAX + 1] = {
|
||||
[IFLA_MACSEC_SCI] = { .type = NLA_U64 },
|
||||
[IFLA_MACSEC_PORT] = { .type = NLA_U16 },
|
||||
[IFLA_MACSEC_ICV_LEN] = { .type = NLA_U8 },
|
||||
[IFLA_MACSEC_CIPHER_SUITE] = { .type = NLA_U64 },
|
||||
[IFLA_MACSEC_WINDOW] = { .type = NLA_U32 },
|
||||
|
@ -2240,6 +2240,8 @@ team_nl_option_policy[TEAM_ATTR_OPTION_MAX + 1] = {
|
||||
[TEAM_ATTR_OPTION_CHANGED] = { .type = NLA_FLAG },
|
||||
[TEAM_ATTR_OPTION_TYPE] = { .type = NLA_U8 },
|
||||
[TEAM_ATTR_OPTION_DATA] = { .type = NLA_BINARY },
|
||||
[TEAM_ATTR_OPTION_PORT_IFINDEX] = { .type = NLA_U32 },
|
||||
[TEAM_ATTR_OPTION_ARRAY_INDEX] = { .type = NLA_U32 },
|
||||
};
|
||||
|
||||
static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
|
||||
|
@ -108,6 +108,7 @@ struct fib_rule_notifier_info {
|
||||
[FRA_OIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
|
||||
[FRA_PRIORITY] = { .type = NLA_U32 }, \
|
||||
[FRA_FWMARK] = { .type = NLA_U32 }, \
|
||||
[FRA_TUN_ID] = { .type = NLA_U64 }, \
|
||||
[FRA_FWMASK] = { .type = NLA_U32 }, \
|
||||
[FRA_TABLE] = { .type = NLA_U32 }, \
|
||||
[FRA_SUPPRESS_PREFIXLEN] = { .type = NLA_U32 }, \
|
||||
|
@ -3352,34 +3352,41 @@ devlink_param_value_get_from_info(const struct devlink_param *param,
|
||||
struct genl_info *info,
|
||||
union devlink_param_value *value)
|
||||
{
|
||||
struct nlattr *param_data;
|
||||
int len;
|
||||
|
||||
if (param->type != DEVLINK_PARAM_TYPE_BOOL &&
|
||||
!info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA])
|
||||
param_data = info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA];
|
||||
|
||||
if (param->type != DEVLINK_PARAM_TYPE_BOOL && !param_data)
|
||||
return -EINVAL;
|
||||
|
||||
switch (param->type) {
|
||||
case DEVLINK_PARAM_TYPE_U8:
|
||||
value->vu8 = nla_get_u8(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]);
|
||||
if (nla_len(param_data) != sizeof(u8))
|
||||
return -EINVAL;
|
||||
value->vu8 = nla_get_u8(param_data);
|
||||
break;
|
||||
case DEVLINK_PARAM_TYPE_U16:
|
||||
value->vu16 = nla_get_u16(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]);
|
||||
if (nla_len(param_data) != sizeof(u16))
|
||||
return -EINVAL;
|
||||
value->vu16 = nla_get_u16(param_data);
|
||||
break;
|
||||
case DEVLINK_PARAM_TYPE_U32:
|
||||
value->vu32 = nla_get_u32(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]);
|
||||
if (nla_len(param_data) != sizeof(u32))
|
||||
return -EINVAL;
|
||||
value->vu32 = nla_get_u32(param_data);
|
||||
break;
|
||||
case DEVLINK_PARAM_TYPE_STRING:
|
||||
len = strnlen(nla_data(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]),
|
||||
nla_len(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]));
|
||||
if (len == nla_len(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]) ||
|
||||
len = strnlen(nla_data(param_data), nla_len(param_data));
|
||||
if (len == nla_len(param_data) ||
|
||||
len >= __DEVLINK_PARAM_MAX_STRING_VALUE)
|
||||
return -EINVAL;
|
||||
strcpy(value->vstr,
|
||||
nla_data(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]));
|
||||
strcpy(value->vstr, nla_data(param_data));
|
||||
break;
|
||||
case DEVLINK_PARAM_TYPE_BOOL:
|
||||
value->vbool = info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA] ?
|
||||
true : false;
|
||||
if (param_data && nla_len(param_data))
|
||||
return -EINVAL;
|
||||
value->vbool = nla_get_flag(param_data);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@ -5951,6 +5958,8 @@ static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = {
|
||||
[DEVLINK_ATTR_PARAM_VALUE_CMODE] = { .type = NLA_U8 },
|
||||
[DEVLINK_ATTR_REGION_NAME] = { .type = NLA_NUL_STRING },
|
||||
[DEVLINK_ATTR_REGION_SNAPSHOT_ID] = { .type = NLA_U32 },
|
||||
[DEVLINK_ATTR_REGION_CHUNK_ADDR] = { .type = NLA_U64 },
|
||||
[DEVLINK_ATTR_REGION_CHUNK_LEN] = { .type = NLA_U64 },
|
||||
[DEVLINK_ATTR_HEALTH_REPORTER_NAME] = { .type = NLA_NUL_STRING },
|
||||
[DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD] = { .type = NLA_U64 },
|
||||
[DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER] = { .type = NLA_U8 },
|
||||
|
@ -21,7 +21,13 @@ const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = {
|
||||
[IEEE802154_ATTR_HW_ADDR] = { .type = NLA_HW_ADDR, },
|
||||
[IEEE802154_ATTR_PAN_ID] = { .type = NLA_U16, },
|
||||
[IEEE802154_ATTR_CHANNEL] = { .type = NLA_U8, },
|
||||
[IEEE802154_ATTR_BCN_ORD] = { .type = NLA_U8, },
|
||||
[IEEE802154_ATTR_SF_ORD] = { .type = NLA_U8, },
|
||||
[IEEE802154_ATTR_PAN_COORD] = { .type = NLA_U8, },
|
||||
[IEEE802154_ATTR_BAT_EXT] = { .type = NLA_U8, },
|
||||
[IEEE802154_ATTR_COORD_REALIGN] = { .type = NLA_U8, },
|
||||
[IEEE802154_ATTR_PAGE] = { .type = NLA_U8, },
|
||||
[IEEE802154_ATTR_DEV_TYPE] = { .type = NLA_U8, },
|
||||
[IEEE802154_ATTR_COORD_SHORT_ADDR] = { .type = NLA_U16, },
|
||||
[IEEE802154_ATTR_COORD_HW_ADDR] = { .type = NLA_HW_ADDR, },
|
||||
[IEEE802154_ATTR_COORD_PAN_ID] = { .type = NLA_U16, },
|
||||
|
@ -32,6 +32,7 @@ static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = {
|
||||
[NFC_ATTR_DEVICE_NAME] = { .type = NLA_STRING,
|
||||
.len = NFC_DEVICE_NAME_MAXSIZE },
|
||||
[NFC_ATTR_PROTOCOLS] = { .type = NLA_U32 },
|
||||
[NFC_ATTR_TARGET_INDEX] = { .type = NLA_U32 },
|
||||
[NFC_ATTR_COMM_MODE] = { .type = NLA_U8 },
|
||||
[NFC_ATTR_RF_MODE] = { .type = NLA_U8 },
|
||||
[NFC_ATTR_DEVICE_POWERED] = { .type = NLA_U8 },
|
||||
@ -43,7 +44,10 @@ static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = {
|
||||
[NFC_ATTR_LLC_SDP] = { .type = NLA_NESTED },
|
||||
[NFC_ATTR_FIRMWARE_NAME] = { .type = NLA_STRING,
|
||||
.len = NFC_FIRMWARE_NAME_MAXSIZE },
|
||||
[NFC_ATTR_SE_INDEX] = { .type = NLA_U32 },
|
||||
[NFC_ATTR_SE_APDU] = { .type = NLA_BINARY },
|
||||
[NFC_ATTR_VENDOR_ID] = { .type = NLA_U32 },
|
||||
[NFC_ATTR_VENDOR_SUBCMD] = { .type = NLA_U32 },
|
||||
[NFC_ATTR_VENDOR_DATA] = { .type = NLA_BINARY },
|
||||
|
||||
};
|
||||
|
@ -645,6 +645,7 @@ static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = {
|
||||
[OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
|
||||
[OVS_PACKET_ATTR_PROBE] = { .type = NLA_FLAG },
|
||||
[OVS_PACKET_ATTR_MRU] = { .type = NLA_U16 },
|
||||
[OVS_PACKET_ATTR_HASH] = { .type = NLA_U64 },
|
||||
};
|
||||
|
||||
static const struct genl_ops dp_packet_genl_ops[] = {
|
||||
|
@ -744,6 +744,7 @@ static const struct nla_policy fq_policy[TCA_FQ_MAX + 1] = {
|
||||
[TCA_FQ_FLOW_MAX_RATE] = { .type = NLA_U32 },
|
||||
[TCA_FQ_BUCKETS_LOG] = { .type = NLA_U32 },
|
||||
[TCA_FQ_FLOW_REFILL_DELAY] = { .type = NLA_U32 },
|
||||
[TCA_FQ_ORPHAN_MASK] = { .type = NLA_U32 },
|
||||
[TCA_FQ_LOW_RATE_THRESHOLD] = { .type = NLA_U32 },
|
||||
[TCA_FQ_CE_THRESHOLD] = { .type = NLA_U32 },
|
||||
};
|
||||
|
@ -768,6 +768,7 @@ static const struct nla_policy taprio_policy[TCA_TAPRIO_ATTR_MAX + 1] = {
|
||||
[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME] = { .type = NLA_S64 },
|
||||
[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION] = { .type = NLA_S64 },
|
||||
[TCA_TAPRIO_ATTR_FLAGS] = { .type = NLA_U32 },
|
||||
[TCA_TAPRIO_ATTR_TXTIME_DELAY] = { .type = NLA_U32 },
|
||||
};
|
||||
|
||||
static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry,
|
||||
|
@ -116,6 +116,7 @@ const struct nla_policy tipc_nl_prop_policy[TIPC_NLA_PROP_MAX + 1] = {
|
||||
[TIPC_NLA_PROP_PRIO] = { .type = NLA_U32 },
|
||||
[TIPC_NLA_PROP_TOL] = { .type = NLA_U32 },
|
||||
[TIPC_NLA_PROP_WIN] = { .type = NLA_U32 },
|
||||
[TIPC_NLA_PROP_MTU] = { .type = NLA_U32 },
|
||||
[TIPC_NLA_PROP_BROADCAST] = { .type = NLA_U32 },
|
||||
[TIPC_NLA_PROP_BROADCAST_RATIO] = { .type = NLA_U32 }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user