Skip to content

Commit a6fbcdd

Browse files
committed
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 <[email protected]>
2 parents ab124d5 + 6ba3da4 commit a6fbcdd

File tree

11 files changed

+40
-12
lines changed

11 files changed

+40
-12
lines changed

drivers/net/can/dev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,7 @@ static const struct nla_policy can_policy[IFLA_CAN_MAX + 1] = {
883883
= { .len = sizeof(struct can_bittiming) },
884884
[IFLA_CAN_DATA_BITTIMING_CONST]
885885
= { .len = sizeof(struct can_bittiming_const) },
886+
[IFLA_CAN_TERMINATION] = { .type = NLA_U16 },
886887
};
887888

888889
static int can_validate(struct nlattr *tb[], struct nlattr *data[],

drivers/net/macsec.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3342,6 +3342,7 @@ static const struct device_type macsec_type = {
33423342

33433343
static const struct nla_policy macsec_rtnl_policy[IFLA_MACSEC_MAX + 1] = {
33443344
[IFLA_MACSEC_SCI] = { .type = NLA_U64 },
3345+
[IFLA_MACSEC_PORT] = { .type = NLA_U16 },
33453346
[IFLA_MACSEC_ICV_LEN] = { .type = NLA_U8 },
33463347
[IFLA_MACSEC_CIPHER_SUITE] = { .type = NLA_U64 },
33473348
[IFLA_MACSEC_WINDOW] = { .type = NLA_U32 },

drivers/net/team/team.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,6 +2240,8 @@ team_nl_option_policy[TEAM_ATTR_OPTION_MAX + 1] = {
22402240
[TEAM_ATTR_OPTION_CHANGED] = { .type = NLA_FLAG },
22412241
[TEAM_ATTR_OPTION_TYPE] = { .type = NLA_U8 },
22422242
[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 },
22432245
};
22442246

22452247
static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)

include/net/fib_rules.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ struct fib_rule_notifier_info {
108108
[FRA_OIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
109109
[FRA_PRIORITY] = { .type = NLA_U32 }, \
110110
[FRA_FWMARK] = { .type = NLA_U32 }, \
111+
[FRA_TUN_ID] = { .type = NLA_U64 }, \
111112
[FRA_FWMASK] = { .type = NLA_U32 }, \
112113
[FRA_TABLE] = { .type = NLA_U32 }, \
113114
[FRA_SUPPRESS_PREFIXLEN] = { .type = NLA_U32 }, \

net/core/devlink.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3352,34 +3352,41 @@ devlink_param_value_get_from_info(const struct devlink_param *param,
33523352
struct genl_info *info,
33533353
union devlink_param_value *value)
33543354
{
3355+
struct nlattr *param_data;
33553356
int len;
33563357

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)
33593361
return -EINVAL;
33603362

33613363
switch (param->type) {
33623364
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);
33643368
break;
33653369
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);
33673373
break;
33683374
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);
33703378
break;
33713379
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) ||
33753382
len >= __DEVLINK_PARAM_MAX_STRING_VALUE)
33763383
return -EINVAL;
3377-
strcpy(value->vstr,
3378-
nla_data(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]));
3384+
strcpy(value->vstr, nla_data(param_data));
33793385
break;
33803386
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);
33833390
break;
33843391
}
33853392
return 0;
@@ -5951,6 +5958,8 @@ static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = {
59515958
[DEVLINK_ATTR_PARAM_VALUE_CMODE] = { .type = NLA_U8 },
59525959
[DEVLINK_ATTR_REGION_NAME] = { .type = NLA_NUL_STRING },
59535960
[DEVLINK_ATTR_REGION_SNAPSHOT_ID] = { .type = NLA_U32 },
5961+
[DEVLINK_ATTR_REGION_CHUNK_ADDR] = { .type = NLA_U64 },
5962+
[DEVLINK_ATTR_REGION_CHUNK_LEN] = { .type = NLA_U64 },
59545963
[DEVLINK_ATTR_HEALTH_REPORTER_NAME] = { .type = NLA_NUL_STRING },
59555964
[DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD] = { .type = NLA_U64 },
59565965
[DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER] = { .type = NLA_U8 },

net/ieee802154/nl_policy.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = {
2121
[IEEE802154_ATTR_HW_ADDR] = { .type = NLA_HW_ADDR, },
2222
[IEEE802154_ATTR_PAN_ID] = { .type = NLA_U16, },
2323
[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, },
2429
[IEEE802154_ATTR_PAGE] = { .type = NLA_U8, },
30+
[IEEE802154_ATTR_DEV_TYPE] = { .type = NLA_U8, },
2531
[IEEE802154_ATTR_COORD_SHORT_ADDR] = { .type = NLA_U16, },
2632
[IEEE802154_ATTR_COORD_HW_ADDR] = { .type = NLA_HW_ADDR, },
2733
[IEEE802154_ATTR_COORD_PAN_ID] = { .type = NLA_U16, },

net/nfc/netlink.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = {
3232
[NFC_ATTR_DEVICE_NAME] = { .type = NLA_STRING,
3333
.len = NFC_DEVICE_NAME_MAXSIZE },
3434
[NFC_ATTR_PROTOCOLS] = { .type = NLA_U32 },
35+
[NFC_ATTR_TARGET_INDEX] = { .type = NLA_U32 },
3536
[NFC_ATTR_COMM_MODE] = { .type = NLA_U8 },
3637
[NFC_ATTR_RF_MODE] = { .type = NLA_U8 },
3738
[NFC_ATTR_DEVICE_POWERED] = { .type = NLA_U8 },
@@ -43,7 +44,10 @@ static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = {
4344
[NFC_ATTR_LLC_SDP] = { .type = NLA_NESTED },
4445
[NFC_ATTR_FIRMWARE_NAME] = { .type = NLA_STRING,
4546
.len = NFC_FIRMWARE_NAME_MAXSIZE },
47+
[NFC_ATTR_SE_INDEX] = { .type = NLA_U32 },
4648
[NFC_ATTR_SE_APDU] = { .type = NLA_BINARY },
49+
[NFC_ATTR_VENDOR_ID] = { .type = NLA_U32 },
50+
[NFC_ATTR_VENDOR_SUBCMD] = { .type = NLA_U32 },
4751
[NFC_ATTR_VENDOR_DATA] = { .type = NLA_BINARY },
4852

4953
};

net/openvswitch/datapath.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = {
645645
[OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
646646
[OVS_PACKET_ATTR_PROBE] = { .type = NLA_FLAG },
647647
[OVS_PACKET_ATTR_MRU] = { .type = NLA_U16 },
648+
[OVS_PACKET_ATTR_HASH] = { .type = NLA_U64 },
648649
};
649650

650651
static const struct genl_ops dp_packet_genl_ops[] = {

net/sched/sch_fq.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ static const struct nla_policy fq_policy[TCA_FQ_MAX + 1] = {
744744
[TCA_FQ_FLOW_MAX_RATE] = { .type = NLA_U32 },
745745
[TCA_FQ_BUCKETS_LOG] = { .type = NLA_U32 },
746746
[TCA_FQ_FLOW_REFILL_DELAY] = { .type = NLA_U32 },
747+
[TCA_FQ_ORPHAN_MASK] = { .type = NLA_U32 },
747748
[TCA_FQ_LOW_RATE_THRESHOLD] = { .type = NLA_U32 },
748749
[TCA_FQ_CE_THRESHOLD] = { .type = NLA_U32 },
749750
};

net/sched/sch_taprio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ static const struct nla_policy taprio_policy[TCA_TAPRIO_ATTR_MAX + 1] = {
768768
[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME] = { .type = NLA_S64 },
769769
[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION] = { .type = NLA_S64 },
770770
[TCA_TAPRIO_ATTR_FLAGS] = { .type = NLA_U32 },
771+
[TCA_TAPRIO_ATTR_TXTIME_DELAY] = { .type = NLA_U32 },
771772
};
772773

773774
static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry,

0 commit comments

Comments
 (0)