Skip to contentSkip to conversation

net: add missing netlink policies

PATCH In review Jakub Kicinski 9 participants 30 messages Mar 3, 2020

Subsystems (12)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

cover 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
author maintainer
#1 lore raw

PATCH 1/16 devlink: validate length of param values

DEVLINK_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.

Fixes e3b7ca18ad7b ("devlink: Add param set command")

---
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
index 5e220809844c..8e44dc5cde73 100644
@@ -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
maintainer Reviewed-by on v1 1/16
#2 lore raw

Re: [PATCH net 01/16] devlink: validate length of param values

Quoted 6 lines · Tue, Mar 03, 2020 at 06:05:11AM CET, [email protected] wrote:

DEVLINK_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.

Fixes e3b7ca18ad7b ("devlink: Add param set command")
author maintainer
#3 lore raw

PATCH 2/16 devlink: validate length of region addr/len

In reply to Jakub Kicinski

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.

Fixes 4e54795a27f5 ("devlink: Add support for region snapshot read command")

---
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
index 8e44dc5cde73..b831c5545d6a 100644
@@ -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
maintainer Reviewed-by on v1 2/16
#4 lore raw

Re: [PATCH net 02/16] devlink: validate length of region addr/len

Quoted 6 lines · Tue, Mar 03, 2020 at 06:05:12AM CET, [email protected] wrote:

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.

Fixes 4e54795a27f5 ("devlink: Add support for region snapshot read command")
author maintainer
#5 lore raw

PATCH 3/16 fib: add missing attribute validation for tun_id

In reply to Jakub Kicinski

Add missing netlink policy entry for FRA_TUN_ID.

Fixes e7030878fc84 ("fib: Add fib rule match on tunnel 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
index 54e227e6b06a..a259050f84af 100644
@@ -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
author maintainer
#7 lore raw

PATCH 4/16 nl802154: add missing attribute validation

In reply to Jakub Kicinski

Add missing attribute validation for several u8 types.

Fixes 2c21d11518b6 ("net: add NL802154 interface for configuration of 802.15.4 devices")

---
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
index 2c7a38d76a3a..824e7e84014c 100644
@@ -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
maintainer Acked-by on v1 4/16
#8 lore raw

Re: [PATCH net 04/16] nl802154: add missing attribute validation

Hello.

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")

---
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
index 2c7a38d76a3a..824e7e84014c 100644
@@ -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

author maintainer
#9 lore raw

PATCH 5/16 nl802154: add missing attribute validation for dev_type

In reply to Jakub Kicinski

Add missing attribute type validation for IEEE802154_ATTR_DEV_TYPE to the netlink policy.

Fixes 90c049b2c6ae ("ieee802154: interface type to be added")

---
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
index 824e7e84014c..0672b2f01586 100644
@@ -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
maintainer Acked-by on v1 5/16
#10 lore raw

Re: [PATCH net 05/16] nl802154: add missing attribute validation for dev_type

Hello.

Quoted 20 lines · Jakub Kicinski

Add missing attribute type validation for IEEE802154_ATTR_DEV_TYPE to the netlink policy.

Fixes 90c049b2c6ae ("ieee802154: interface type to be added")

---
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
index 824e7e84014c..0672b2f01586 100644

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

author maintainer
#11 lore raw

Re: [PATCH net 05/16] nl802154: add missing attribute validation for dev_type

Quoted 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_TYPE to the netlink policy.

Fixes 90c049b2c6ae ("ieee802154: interface type to be added")
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
index 824e7e84014c..0672b2f01586 100644
@@ -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:

Thanks!

author maintainer
#12 lore raw

PATCH 6/16 can: add missing attribute validation for termination

In reply to Jakub Kicinski

Add missing attribute validation for IFLA_CAN_TERMINATION to the netlink policy.

Fixes 12a6075cabc0 ("can: dev: add CAN interface termination API")

---
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
index 6ee06a49fb4c..68834a2853c9 100644
@@ -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
Acked-by on v1 6/16
#13 lore raw

Re: [PATCH net 06/16] can: add missing attribute validation for termination

Quoted 19 lines · Jakub Kicinski

Add missing attribute validation for IFLA_CAN_TERMINATION to the netlink policy.

Fixes 12a6075cabc0 ("can: dev: add CAN interface termination API")

---
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
index 6ee06a49fb4c..68834a2853c9 100644

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

author maintainer
#14 lore raw

PATCH 7/16 macsec: add missing attribute validation for port

In reply to Jakub Kicinski

Add missing attribute validation for IFLA_MACSEC_PORT to the netlink policy.

Fixes c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver")

---
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
index 45bfd99f17fa..5af424eeea86 100644
@@ -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
author maintainer
#15 lore raw

PATCH 8/16 openvswitch: add missing attribute validation for hash

In reply to Jakub Kicinski

Add missing attribute validation for OVS_PACKET_ATTR_HASH to the netlink policy.

Fixes bd1903b7c459 ("net: openvswitch: add hash info to upcall")

---
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
index c047afd12116..07a7dd185995 100644
@@ -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
Reviewed-by on v1 8/16
#16 lore raw

Re: [ovs-dev] [PATCH net 08/16] openvswitch: add missing attribute validation for hash

Quoted 18 lines · Jakub Kicinski

Add missing attribute validation for OVS_PACKET_ATTR_HASH to the netlink policy.

Fixes bd1903b7c459 ("net: openvswitch: add hash info to upcall")

---
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
index c047afd12116..07a7dd185995 100644

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

author maintainer
#17 lore raw

PATCH 9/16 net: fq: add missing attribute validation for orphan mask

In reply to Jakub Kicinski

Add missing attribute validation for TCA_FQ_ORPHAN_MASK to the netlink policy.

Fixes 06eb395fa985 ("pkt_sched: fq: better control of DDOS traffic")

---
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
index a5a295477ecc..371ad84def3b 100644
@@ -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
author maintainer
#18 lore raw

PATCH 10/16 net: taprio: add missing attribute validation for txtime delay

In reply to Jakub Kicinski

Add missing attribute validation for TCA_TAPRIO_ATTR_TXTIME_DELAY to the netlink policy.

Fixes 4cfd5779bd6e ("taprio: Add support for txtime-assist mode")

---
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
index 660fc45ee40f..ee717e05372b 100644
@@ -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
maintainer Reviewed-by on v1 10/16
#19 lore raw

Re: [PATCH net 10/16] net: taprio: add missing attribute validation for txtime delay

Quoted 5 lines · Jakub Kicinski

Add missing attribute validation for TCA_TAPRIO_ATTR_TXTIME_DELAY to the netlink policy.

Fixes 4cfd5779bd6e ("taprio: Add support for txtime-assist mode")
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
author maintainer
#20 lore raw

PATCH 11/16 team: add missing attribute validation for port ifindex

In reply to Jakub Kicinski

Add missing attribute validation for TEAM_ATTR_OPTION_PORT_IFINDEX to the netlink policy.

Fixes 80f7c6683fe0 ("team: add support for per-port options")

---
CC: Jiri Pirko <[email protected]>

---
 drivers/net/team/team.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/team/team.c +1 -0
index ca70a1d840eb..44dd26a62a6d 100644
@@ -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
author maintainer
#22 lore raw

PATCH 12/16 team: add missing attribute validation for array index

In reply to Jakub Kicinski

Add missing attribute validation for TEAM_ATTR_OPTION_ARRAY_INDEX to the netlink policy.

Fixes b13033262d24 ("team: introduce array options")

---
CC: Jiri Pirko <[email protected]>

---
 drivers/net/team/team.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/team/team.c +1 -0
index 44dd26a62a6d..4004f98e50d9 100644
@@ -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
author maintainer
#24 lore raw

PATCH 13/16 tipc: add missing attribute validation for MTU property

In reply to Jakub Kicinski

Add missing attribute validation for TIPC_NLA_PROP_MTU to the netlink policy.

Fixes 901271e0403a ("tipc: implement configuration of UDP media MTU")

---
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
index 7c35094c20b8..bb9862410e68 100644
@@ -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
#25 lore raw

RE: [PATCH net 13/16] tipc: add missing attribute validation for MTU property

Thanks! 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.

Fixes 901271e0403a ("tipc: implement configuration of UDP media MTU")

---
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
index 7c35094c20b8..bb9862410e68 100644
@@ -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
author maintainer
#26 lore raw

PATCH 14/16 nfc: add missing attribute validation for SE API

In reply to Jakub Kicinski

Add missing attribute validation for NFC_ATTR_SE_INDEX to the netlink policy.

Fixes 5ce3f32b5264 ("NFC: netlink: SE API implementation")

---
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
index eee0dddb7749..842407a48f96 100644
@@ -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
author maintainer
#27 lore raw

PATCH 15/16 nfc: add missing attribute validation for deactivate target

In reply to Jakub Kicinski

Add missing attribute validation for NFC_ATTR_TARGET_INDEX to the netlink policy.

Fixes 4d63adfe12dd ("NFC: Add NFC_CMD_DEACTIVATE_TARGET support")

---
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
index 842407a48f96..e988ca486d66 100644
@@ -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
author maintainer
#28 lore raw

PATCH 16/16 nfc: add missing attribute validation for vendor subcommand

In reply to Jakub Kicinski

Add missing attribute validation for vendor subcommand attributes to the netlink policy.

Fixes 9e58095f9660 ("NFC: netlink: Implement vendor command support")

---
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
index e988ca486d66..e894254c17d4 100644
@@ -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
maintainer
#29 lore raw
In reply to Jakub Kicinski

From: 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.