net: add missing netlink policies
Subsystems (12)
Jakub Kicinski
maintainercover net: add missing netlink policies
Hi!
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.
Jakub Kicinski (16):
devlink: validate length of param values
devlink: validate length of region addr/len
fib: add missing attribute validation for tun_id
nl802154: add missing attribute validation
nl802154: add missing attribute validation for dev_type
can: add missing attribute validation for termination
macsec: add missing attribute validation for port
openvswitch: add missing attribute validation for hash
net: fq: add missing attribute validation for orphan mask
net: taprio: add missing attribute validation for txtime delay
team: add missing attribute validation for port ifindex
team: add missing attribute validation for array index
tipc: add missing attribute validation for MTU property
nfc: add missing attribute validation for SE API
nfc: add missing attribute validation for deactivate target
nfc: add missing attribute validation for vendor subcommand
drivers/net/can/dev.c | 1 + drivers/net/macsec.c | 1 + drivers/net/team/team.c | 2 ++ include/net/fib_rules.h | 1 + net/core/devlink.c | 33 +++++++++++++++++++++------------ net/ieee802154/nl_policy.c | 6 ++++++ net/nfc/netlink.c | 4 ++++ net/openvswitch/datapath.c | 1 + net/sched/sch_fq.c | 1 + net/sched/sch_taprio.c | 1 + net/tipc/netlink.c | 1 + 11 files changed, 40 insertions(+), 12 deletions(-)
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 2/16 devlink: validate length of region addr/len
DEVLINK_ATTR_REGION_CHUNK_ADDR and DEVLINK_ATTR_REGION_CHUNK_LEN lack entries in the netlink policy. Corresponding nla_get_u64()s may read beyond the end of the message.
---
CC: Jiri Pirko <[email protected]>
CC: Alex Vesker <[email protected]>
--- net/core/devlink.c | 2 ++ 1 file changed, 2 insertions(+)
net/core/devlink.c +2 -0
@@ -5958,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 },
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 6/16 can: add missing attribute validation for termination
In reply to Jakub KicinskiAdd missing attribute validation for IFLA_CAN_TERMINATION to the netlink policy.
---
CC: Wolfgang Grandegger <[email protected]>
CC: Marc Kleine-Budde <[email protected]>
CC: Oliver Hartkopp <[email protected]>
CC: [email protected]
--- drivers/net/can/dev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/can/dev.c +1 -0
@@ -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[],
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 4/16 nl802154: add missing attribute validation
In reply to Jakub KicinskiAdd missing attribute validation for several u8 types.
---
CC: Alexander Aring <[email protected]>
CC: Stefan Schmidt <[email protected]>
CC: Dmitry Eremin-Solenikov <[email protected]>
CC: Sergey Lapin <[email protected]>
CC: [email protected]
--- net/ieee802154/nl_policy.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ieee802154/nl_policy.c +5 -0
@@ -21,6 +21,11 @@ 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_COORD_SHORT_ADDR] = { .type = NLA_U16, }, [IEEE802154_ATTR_COORD_HW_ADDR] = { .type = NLA_HW_ADDR, },
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 8/16 openvswitch: add missing attribute validation for hash
In reply to Jakub KicinskiAdd missing attribute validation for OVS_PACKET_ATTR_HASH to the netlink policy.
---
CC: Pravin B Shelar <[email protected]>
CC: Tonghao Zhang <[email protected]>
CC: [email protected]
--- net/openvswitch/datapath.c | 1 + 1 file changed, 1 insertion(+)
net/openvswitch/datapath.c +1 -0
@@ -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[] = {
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 7/16 macsec: add missing attribute validation for port
In reply to Jakub KicinskiAdd missing attribute validation for IFLA_MACSEC_PORT to the netlink policy.
---
CC: Antoine Tenart <[email protected]>
CC: Sabrina Dubroca <[email protected]>
--- drivers/net/macsec.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/macsec.c +1 -0
@@ -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 },
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 11/16 team: add missing attribute validation for port ifindex
In reply to Jakub KicinskiAdd missing attribute validation for TEAM_ATTR_OPTION_PORT_IFINDEX to the netlink policy.
---
CC: Jiri Pirko <[email protected]>
--- drivers/net/team/team.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/team/team.c +1 -0
@@ -2240,6 +2240,7 @@ 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 }, };static int team_nl_cmd_noop (struct sk_buff *skb,struct genl_info *info)
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 16/16 nfc: add missing attribute validation for vendor subcommand
In reply to Jakub KicinskiAdd missing attribute validation for vendor subcommand attributes to the netlink policy.
---
CC: Johannes Berg <[email protected]>
CC: Jiri Pirko <[email protected]>
CC: Samuel Ortiz <[email protected]>
--- net/nfc/netlink.c | 2 ++ 1 file changed, 2 insertions(+)
net/nfc/netlink.c +2 -0
@@ -46,6 +46,8 @@ static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = { .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 }, };
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 12/16 team: add missing attribute validation for array index
In reply to Jakub KicinskiAdd missing attribute validation for TEAM_ATTR_OPTION_ARRAY_INDEX to the netlink policy.
---
CC: Jiri Pirko <[email protected]>
--- drivers/net/team/team.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/team/team.c +1 -0
@@ -2241,6 +2241,7 @@ team_nl_option_policy[TEAM_ATTR_OPTION_MAX + 1] = { [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)
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 15/16 nfc: add missing attribute validation for deactivate target
In reply to Jakub KicinskiAdd missing attribute validation for NFC_ATTR_TARGET_INDEX to the netlink policy.
---
CC: Johannes Berg <[email protected]>
CC: Jiri Pirko <[email protected]>
CC: Michal Kubecek <[email protected]>
CC: Samuel Ortiz <[email protected]>
CC: Mark Greer <[email protected]>
--- net/nfc/netlink.c | 1 + 1 file changed, 1 insertion(+)
net/nfc/netlink.c +1 -0
@@ -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 },
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 13/16 tipc: add missing attribute validation for MTU property
In reply to Jakub KicinskiAdd missing attribute validation for TIPC_NLA_PROP_MTU to the netlink policy.
---
CC: Jon Maloy <[email protected]>
CC: Ying Xue <[email protected]>
CC: GhantaKrishnamurthy MohanKrishna <[email protected]>
--- net/tipc/netlink.c | 1 + 1 file changed, 1 insertion(+)
net/tipc/netlink.c +1 -0
@@ -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 } };
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 10/16 net: taprio: add missing attribute validation for txtime delay
In reply to Jakub KicinskiAdd missing attribute validation for TCA_TAPRIO_ATTR_TXTIME_DELAY to the netlink policy.
---
CC: Jamal Hadi Salim <[email protected]>
CC: Cong Wang <[email protected]>
CC: Jiri Pirko <[email protected]>
CC: Vedang Patel <[email protected]>
CC: Vinicius Costa Gomes <[email protected]>
--- net/sched/sch_taprio.c | 1 + 1 file changed, 1 insertion(+)
net/sched/sch_taprio.c +1 -0
@@ -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,
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 14/16 nfc: add missing attribute validation for SE API
In reply to Jakub KicinskiAdd missing attribute validation for NFC_ATTR_SE_INDEX to the netlink policy.
---
CC: Johannes Berg <[email protected]>
CC: Jiri Pirko <[email protected]>
CC: Samuel Ortiz <[email protected]>
--- net/nfc/netlink.c | 1 + 1 file changed, 1 insertion(+)
net/nfc/netlink.c +1 -0
@@ -43,6 +43,7 @@ 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_DATA] = { .type = NLA_BINARY },
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 9/16 net: fq: add missing attribute validation for orphan mask
In reply to Jakub KicinskiAdd missing attribute validation for TCA_FQ_ORPHAN_MASK to the netlink policy.
---
CC: Jamal Hadi Salim <[email protected]>
CC: Cong Wang <[email protected]>
CC: Jiri Pirko <[email protected]>
CC: Eric Dumazet <[email protected]>
--- net/sched/sch_fq.c | 1 + 1 file changed, 1 insertion(+)
net/sched/sch_fq.c +1 -0
@@ -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 }, };
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 5/16 nl802154: add missing attribute validation for dev_type
In reply to Jakub KicinskiAdd missing attribute type validation for IEEE802154_ATTR_DEV_TYPE to the netlink policy.
---
CC: Alexander Aring <[email protected]>
CC: Stefan Schmidt <[email protected]>
CC: [email protected]
CC: [email protected]
--- net/ieee802154/nl_policy.c | 1 + 1 file changed, 1 insertion(+)
net/ieee802154/nl_policy.c +1 -0
@@ -27,6 +27,7 @@ const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = { [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, },
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 1/16 devlink: validate length of param values
In reply to Jakub KicinskiDEVLINK_ATTR_PARAM_VALUE_DATA may have different types so it's not checked by the normal netlink policy. Make sure the attribute length is what we expect.
---
CC: Jiri Pirko <[email protected]>
CC: Moshe Shemesh <[email protected]>
--- net/core/devlink.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
net/core/devlink.c +19 -12
@@ -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 ;
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH 3/16 fib: add missing attribute validation for tun_id
In reply to Jakub KicinskiAdd missing netlink policy entry for FRA_TUN_ID.
---
CC: [email protected]
CC: Thomas Graf <[email protected]>
--- include/net/fib_rules.h | 1 + 1 file changed, 1 insertion(+)
include/net/fib_rules.h +1 -0
@@ -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 }, \
Signature · 1 line
2.24.1
Re: [PATCH net 11/16] team: add missing attribute validation for port ifindex
In reply to Jakub KicinskiQuoted 5 lines · Tue, Mar 03, 2020 at 06:05:21AM CET, [email protected] wrote:
Add missing attribute validation for
TEAM_ATTR_OPTION_PORT_IFINDEXto the netlink policy.Fixes 80f7c6683fe0 ("team: add support for per-port options")Signed-off-by Jakub Kicinski <[email protected]>
Re: [PATCH net 12/16] team: add missing attribute validation for array index
In reply to Jakub KicinskiQuoted 5 lines · Tue, Mar 03, 2020 at 06:05:22AM CET, [email protected] wrote:
Add missing attribute validation for
TEAM_ATTR_OPTION_ARRAY_INDEXto the netlink policy.Fixes b13033262d24 ("team: introduce array options")Signed-off-by Jakub Kicinski <[email protected]>
Re: [PATCH net 01/16] devlink: validate length of param values
In reply to Jakub KicinskiQuoted 6 lines · Tue, Mar 03, 2020 at 06:05:11AM CET, [email protected] wrote:
DEVLINK_ATTR_PARAM_VALUE_DATAmay have different types so it's not checked by the normal netlink policy. Make sure the attribute length is what we expect.Fixes e3b7ca18ad7b ("devlink: Add param set command")Signed-off-by Jakub Kicinski <[email protected]>
RE: [PATCH net 13/16] tipc: add missing attribute validation for MTU property
In reply to Jakub KicinskiThanks! The patch looks good to me.
-----Original Message-----
From: Jakub Kicinski [mailto:[email protected]]
Sent: Tuesday, March 3, 2020 1:05 PM
To: [email protected]
Cc: [email protected]; Jakub Kicinski; Jon Maloy; Xue, Ying; GhantaKrishnamurthy MohanKrishna
Subject: [PATCH net 13/16] tipc: add missing attribute validation for MTU property
Add missing attribute validation for TIPC_NLA_PROP_MTU to the netlink policy.
---
CC: Jon Maloy <[email protected]>
CC: Ying Xue <[email protected]>
CC: GhantaKrishnamurthy MohanKrishna <[email protected]>
--- net/tipc/netlink.c | 1 + 1 file changed, 1 insertion(+)
net/tipc/netlink.c +1 -0
@@ -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 } };
Signature · 1 line
2.24.1
Re: [PATCH net 02/16] devlink: validate length of region addr/len
In reply to Jakub KicinskiQuoted 6 lines · Tue, Mar 03, 2020 at 06:05:12AM CET, [email protected] wrote:
DEVLINK_ATTR_REGION_CHUNK_ADDRandDEVLINK_ATTR_REGION_CHUNK_LENlack entries in the netlink policy. Corresponding nla_get_u64()s may read beyond the end of the message.Fixes 4e54795a27f5 ("devlink: Add support for region snapshot read command")Signed-off-by Jakub Kicinski <[email protected]>
Re: [PATCH net 04/16] nl802154: add missing attribute validation
In reply to Jakub KicinskiHello.
Quoted 21 lines · Jakub Kicinski
Add missing attribute validation for several u8 types.
Fixes 2c21d11518b6 ("net: add NL802154 interface for configuration of 802.15.4 devices")Signed-off-by Jakub Kicinski <[email protected]>---
CC: Alexander Aring <[email protected]>
CC: Stefan Schmidt <[email protected]>
CC: Dmitry Eremin-Solenikov <[email protected]>
CC: Sergey Lapin <[email protected]>
CC: [email protected]--- net/ieee802154/nl_policy.c | 5 +++++ 1 file changed, 5 insertions(+)net/ieee802154/nl_policy.c +0
-0@@ -21,6 +21,11 @@ const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = { [IEEE802154_ATTR_HW_ADDR] = { .type = NLA_HW_ADDR, },
net/ieee802154/nl_policy.c const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = { · line 31
Quoted 10 lines
net/ieee802154/nl_policy.c +5
-0[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_COORD_SHORT_ADDR] = { .type = NLA_U16, }, [IEEE802154_ATTR_COORD_HW_ADDR] = { .type = NLA_HW_ADDR, },
regards
Stefan Schmidt
Re: [PATCH net 05/16] nl802154: add missing attribute validation for dev_type
In reply to Jakub KicinskiHello.
Quoted 20 lines · Jakub Kicinski
Add missing attribute type validation for
IEEE802154_ATTR_DEV_TYPEto the netlink policy.Fixes 90c049b2c6ae ("ieee802154: interface type to be added")Signed-off-by Jakub Kicinski <[email protected]>---
CC: Alexander Aring <[email protected]>
CC: Stefan Schmidt <[email protected]>
CC: [email protected]
CC: [email protected]--- net/ieee802154/nl_policy.c | 1 + 1 file changed, 1 insertion(+)net/ieee802154/nl_policy.c +0
-0
net/ieee802154/nl_policy.c const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = { · line 33
Quoted 7 lines
net/ieee802154/nl_policy.c +1
-0@@ -27,6 +27,7 @@ const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = { [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, },
The reason to split this off from the patch before is to have the Fixes tag differently to point to its origin?
Might be a bit to much work for this little subsystem, but you did it already, so:
regards
Stefan Schmidt
Re: [PATCH net 03/16] fib: add missing attribute validation for tun_id
In reply to Jakub KicinskiQuoted 11 lines · Jakub Kicinski
Add missing netlink policy entry for
FRA_TUN_ID.Fixes e7030878fc84 ("fib: Add fib rule match on tunnel id")Signed-off-by Jakub Kicinski <[email protected]>---
CC: [email protected]
CC: Thomas Graf <[email protected]>--- include/net/fib_rules.h | 1 + 1 file changed, 1 insertion(+)
Jakub Kicinski
maintainerRe: [PATCH net 05/16] nl802154: add missing attribute validation for dev_type
In reply to Stefan SchmidtQuoted 7 lines · On Tue, 3 Mar 2020 16:39:55 +0100 Stefan Schmidt wrote:
Quoted 5 lines · Jakub Kicinski
Add missing attribute type validation for
IEEE802154_ATTR_DEV_TYPEto the netlink policy.Fixes 90c049b2c6ae ("ieee802154: interface type to be added")Signed-off-by Jakub Kicinski <[email protected]>
Quoted 16 lines
net/ieee802154/nl_policy.c const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = { · line 33
Quoted 13 lines
net/ieee802154/nl_policy.c +1
-0@@ -27,6 +27,7 @@ const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = { [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, },The reason to split this off from the patch before is to have the Fixes tag differently to point to its origin?
Yup, plus they should hopefully be in chronological order to avoid conflicts :)
Quoted 4 lines
Might be a bit to much work for this little subsystem, but you did it already, so:
Acked-by Stefan Schmidt <[email protected]>
Thanks!
Re: [PATCH net 10/16] net: taprio: add missing attribute validation for txtime delay
In reply to Jakub KicinskiQuoted 5 lines · Jakub Kicinski
Add missing attribute validation for
TCA_TAPRIO_ATTR_TXTIME_DELAYto the netlink policy.Fixes 4cfd5779bd6e ("taprio: Add support for txtime-assist mode")Signed-off-by Jakub Kicinski <[email protected]>
Quoted 7 lines
---
CC: Jamal Hadi Salim <[email protected]>
CC: Cong Wang <[email protected]>
CC: Jiri Pirko <[email protected]>
CC: Vedang Patel <[email protected]>
CC: Vinicius Costa Gomes <[email protected]>
---
Signature · 1 line
Vinicius
Re: [PATCH net 06/16] can: add missing attribute validation for termination
In reply to Jakub KicinskiQuoted 19 lines · Jakub Kicinski
Add missing attribute validation for
IFLA_CAN_TERMINATIONto the netlink policy.Fixes 12a6075cabc0 ("can: dev: add CAN interface termination API")Signed-off-by Jakub Kicinski <[email protected]>---
CC: Wolfgang Grandegger <[email protected]>
CC: Marc Kleine-Budde <[email protected]>
CC: Oliver Hartkopp <[email protected]>
CC: [email protected]--- drivers/net/can/dev.c | 1 + 1 file changed, 1 insertion(+)drivers/net/can/dev.c +0
-0
drivers/net/can/dev.c static const struct nla_policy can_policy[IFLA_CAN_MAX + 1] = { · line 889
Quoted 7 lines
drivers/net/can/dev.c +1
-0@@ -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[],
Thanks Jakub for catching all these missing defs!
Best regards,
Oliver
Re: [ovs-dev] [PATCH net 08/16] openvswitch: add missing attribute validation for hash
In reply to Jakub KicinskiQuoted 18 lines · Jakub Kicinski
Add missing attribute validation for
OVS_PACKET_ATTR_HASHto the netlink policy.Fixes bd1903b7c459 ("net: openvswitch: add hash info to upcall")Signed-off-by Jakub Kicinski <[email protected]>---
CC: Pravin B Shelar <[email protected]>
CC: Tonghao Zhang <[email protected]>
CC: [email protected]--- net/openvswitch/datapath.c | 1 + 1 file changed, 1 insertion(+)net/openvswitch/datapath.c +0
-0
net/openvswitch/datapath.c static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = { · line 651
Quoted 7 lines
net/openvswitch/datapath.c +1
-0@@ -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[] = {
LGTM
David Miller
maintainerFrom: Jakub Kicinski <[email protected]>
Date: Mon, 2 Mar 2020 21:05:10 -0800
Quoted 7 lines
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.
Looks good to me, and I'll queue these up for -stable as well.
Thanks.