netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 00/16] net: add missing netlink policies
@ 2020-03-03  5:05 Jakub Kicinski
  2020-03-03  5:05 ` [PATCH net 01/16] devlink: validate length of param values Jakub Kicinski
                   ` (16 more replies)
  0 siblings, 17 replies; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski

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

-- 
2.24.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH net 01/16] devlink: validate length of param values
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03 10:23   ` Jiri Pirko
  2020-03-03  5:05 ` [PATCH net 02/16] devlink: validate length of region addr/len Jakub Kicinski
                   ` (15 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Jiri Pirko, Moshe Shemesh

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")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Jiri Pirko <jiri@mellanox.com>
CC: Moshe Shemesh <moshe@mellanox.com>
---
 net/core/devlink.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/net/core/devlink.c b/net/core/devlink.c
index 5e220809844c..8e44dc5cde73 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -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;
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 02/16] devlink: validate length of region addr/len
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
  2020-03-03  5:05 ` [PATCH net 01/16] devlink: validate length of param values Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03 13:31   ` Jiri Pirko
  2020-03-03  5:05 ` [PATCH net 03/16] fib: add missing attribute validation for tun_id Jakub Kicinski
                   ` (14 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Jiri Pirko, Alex Vesker

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")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Jiri Pirko <jiri@mellanox.com>
CC: Alex Vesker <valex@mellanox.com>
---
 net/core/devlink.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/devlink.c b/net/core/devlink.c
index 8e44dc5cde73..b831c5545d6a 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -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 },
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 03/16] fib: add missing attribute validation for tun_id
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
  2020-03-03  5:05 ` [PATCH net 01/16] devlink: validate length of param values Jakub Kicinski
  2020-03-03  5:05 ` [PATCH net 02/16] devlink: validate length of region addr/len Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03 16:01   ` David Ahern
  2020-03-03  5:05 ` [PATCH net 04/16] nl802154: add missing attribute validation Jakub Kicinski
                   ` (13 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, dsahern, Thomas Graf

Add missing netlink policy entry for FRA_TUN_ID.

Fixes: e7030878fc84 ("fib: Add fib rule match on tunnel id")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: dsahern@kernel.org
CC: Thomas Graf <tgraf@suug.ch>
---
 include/net/fib_rules.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 54e227e6b06a..a259050f84af 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -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 }, \
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 04/16] nl802154: add missing attribute validation
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (2 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 03/16] fib: add missing attribute validation for tun_id Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03 15:38   ` Stefan Schmidt
  2020-03-03  5:05 ` [PATCH net 05/16] nl802154: add missing attribute validation for dev_type Jakub Kicinski
                   ` (12 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem
  Cc: netdev, Jakub Kicinski, Alexander Aring, Stefan Schmidt,
	Dmitry Eremin-Solenikov, Sergey Lapin, linux-wpan

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 <kuba@kernel.org>
---
CC: Alexander Aring <alex.aring@gmail.com>
CC: Stefan Schmidt <stefan@datenfreihafen.org>
CC: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
CC: Sergey Lapin <slapin@ossfans.org>
CC: linux-wpan@vger.kernel.org
---
 net/ieee802154/nl_policy.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/ieee802154/nl_policy.c b/net/ieee802154/nl_policy.c
index 2c7a38d76a3a..824e7e84014c 100644
--- a/net/ieee802154/nl_policy.c
+++ b/net/ieee802154/nl_policy.c
@@ -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, },
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 05/16] nl802154: add missing attribute validation for dev_type
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (3 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 04/16] nl802154: add missing attribute validation Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03 15:39   ` Stefan Schmidt
  2020-03-03  5:05 ` [PATCH net 06/16] can: add missing attribute validation for termination Jakub Kicinski
                   ` (11 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem
  Cc: netdev, Jakub Kicinski, Alexander Aring, Stefan Schmidt,
	alex.bluesman.smirnov, linux-wpan

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

Fixes: 90c049b2c6ae ("ieee802154: interface type to be added")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Alexander Aring <alex.aring@gmail.com>
CC: Stefan Schmidt <stefan@datenfreihafen.org>
CC: alex.bluesman.smirnov@gmail.com
CC: linux-wpan@vger.kernel.org
---
 net/ieee802154/nl_policy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ieee802154/nl_policy.c b/net/ieee802154/nl_policy.c
index 824e7e84014c..0672b2f01586 100644
--- a/net/ieee802154/nl_policy.c
+++ b/net/ieee802154/nl_policy.c
@@ -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, },
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 06/16] can: add missing attribute validation for termination
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (4 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 05/16] nl802154: add missing attribute validation for dev_type Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03 19:58   ` Oliver Hartkopp
  2020-03-03  5:05 ` [PATCH net 07/16] macsec: add missing attribute validation for port Jakub Kicinski
                   ` (10 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem
  Cc: netdev, Jakub Kicinski, Wolfgang Grandegger, Marc Kleine-Budde,
	Oliver Hartkopp, linux-can

Add missing attribute validation for IFLA_CAN_TERMINATION
to the netlink policy.

Fixes: 12a6075cabc0 ("can: dev: add CAN interface termination API")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Wolfgang Grandegger <wg@grandegger.com>
CC: Marc Kleine-Budde <mkl@pengutronix.de>
CC: Oliver Hartkopp <socketcan@hartkopp.net>
CC: linux-can@vger.kernel.org
---
 drivers/net/can/dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 6ee06a49fb4c..68834a2853c9 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -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[],
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 07/16] macsec: add missing attribute validation for port
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (5 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 06/16] can: add missing attribute validation for termination Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03  5:05 ` [PATCH net 08/16] openvswitch: add missing attribute validation for hash Jakub Kicinski
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Antoine Tenart, Sabrina Dubroca

Add missing attribute validation for IFLA_MACSEC_PORT
to the netlink policy.

Fixes: c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Antoine Tenart <antoine.tenart@bootlin.com>
CC: Sabrina Dubroca <sd@queasysnail.net>
---
 drivers/net/macsec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 45bfd99f17fa..5af424eeea86 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -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 },
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 08/16] openvswitch: add missing attribute validation for hash
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (6 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 07/16] macsec: add missing attribute validation for port Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03 21:24   ` [ovs-dev] " Gregory Rose
  2020-03-03  5:05 ` [PATCH net 09/16] net: fq: add missing attribute validation for orphan mask Jakub Kicinski
                   ` (8 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Pravin B Shelar, Tonghao Zhang, dev

Add missing attribute validation for OVS_PACKET_ATTR_HASH
to the netlink policy.

Fixes: bd1903b7c459 ("net: openvswitch: add hash info to upcall")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Pravin B Shelar <pshelar@ovn.org>
CC: Tonghao Zhang <xiangxia.m.yue@gmail.com>
CC: dev@openvswitch.org
---
 net/openvswitch/datapath.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index c047afd12116..07a7dd185995 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -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[] = {
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 09/16] net: fq: add missing attribute validation for orphan mask
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (7 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 08/16] openvswitch: add missing attribute validation for hash Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03  5:05 ` [PATCH net 10/16] net: taprio: add missing attribute validation for txtime delay Jakub Kicinski
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem
  Cc: netdev, Jakub Kicinski, Jamal Hadi Salim, Cong Wang, Jiri Pirko,
	Eric Dumazet

Add missing attribute validation for TCA_FQ_ORPHAN_MASK
to the netlink policy.

Fixes: 06eb395fa985 ("pkt_sched: fq: better control of DDOS traffic")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Jamal Hadi Salim <jhs@mojatatu.com>
CC: Cong Wang <xiyou.wangcong@gmail.com>
CC: Jiri Pirko <jiri@resnulli.us>
CC: Eric Dumazet <edumazet@google.com>
---
 net/sched/sch_fq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
index a5a295477ecc..371ad84def3b 100644
--- a/net/sched/sch_fq.c
+++ b/net/sched/sch_fq.c
@@ -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 },
 };
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 10/16] net: taprio: add missing attribute validation for txtime delay
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (8 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 09/16] net: fq: add missing attribute validation for orphan mask Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03 18:39   ` Vinicius Costa Gomes
  2020-03-03  5:05 ` [PATCH net 11/16] team: add missing attribute validation for port ifindex Jakub Kicinski
                   ` (6 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem
  Cc: netdev, Jakub Kicinski, Jamal Hadi Salim, Cong Wang, Jiri Pirko,
	Vedang Patel, Vinicius Costa Gomes

Add missing attribute validation for TCA_TAPRIO_ATTR_TXTIME_DELAY
to the netlink policy.

Fixes: 4cfd5779bd6e ("taprio: Add support for txtime-assist mode")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Jamal Hadi Salim <jhs@mojatatu.com>
CC: Cong Wang <xiyou.wangcong@gmail.com>
CC: Jiri Pirko <jiri@resnulli.us>
CC: Vedang Patel <vedang.patel@intel.com>
CC: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
 net/sched/sch_taprio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 660fc45ee40f..ee717e05372b 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -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,
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 11/16] team: add missing attribute validation for port ifindex
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (9 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 10/16] net: taprio: add missing attribute validation for txtime delay Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03  9:53   ` Jiri Pirko
  2020-03-03  5:05 ` [PATCH net 12/16] team: add missing attribute validation for array index Jakub Kicinski
                   ` (5 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Jiri Pirko

Add missing attribute validation for TEAM_ATTR_OPTION_PORT_IFINDEX
to the netlink policy.

Fixes: 80f7c6683fe0 ("team: add support for per-port options")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Jiri Pirko <jiri@resnulli.us>
---
 drivers/net/team/team.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index ca70a1d840eb..44dd26a62a6d 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -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)
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 12/16] team: add missing attribute validation for array index
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (10 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 11/16] team: add missing attribute validation for port ifindex Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03  9:53   ` Jiri Pirko
  2020-03-03  5:05 ` [PATCH net 13/16] tipc: add missing attribute validation for MTU property Jakub Kicinski
                   ` (4 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Jiri Pirko

Add missing attribute validation for TEAM_ATTR_OPTION_ARRAY_INDEX
to the netlink policy.

Fixes: b13033262d24 ("team: introduce array options")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Jiri Pirko <jiri@resnulli.us>
---
 drivers/net/team/team.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 44dd26a62a6d..4004f98e50d9 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -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)
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 13/16] tipc: add missing attribute validation for MTU property
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (11 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 12/16] team: add missing attribute validation for array index Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03 10:26   ` Xue, Ying
  2020-03-03  5:05 ` [PATCH net 14/16] nfc: add missing attribute validation for SE API Jakub Kicinski
                   ` (3 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem
  Cc: netdev, Jakub Kicinski, Jon Maloy, Ying Xue,
	GhantaKrishnamurthy MohanKrishna

Add missing attribute validation for TIPC_NLA_PROP_MTU
to the netlink policy.

Fixes: 901271e0403a ("tipc: implement configuration of UDP media MTU")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Jon Maloy <jmaloy@redhat.com>
CC: Ying Xue <ying.xue@windriver.com>
CC: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com>
---
 net/tipc/netlink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index 7c35094c20b8..bb9862410e68 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -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 }
 };
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 14/16] nfc: add missing attribute validation for SE API
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (12 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 13/16] tipc: add missing attribute validation for MTU property Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03  5:05 ` [PATCH net 15/16] nfc: add missing attribute validation for deactivate target Jakub Kicinski
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Johannes Berg, Jiri Pirko, Samuel Ortiz

Add missing attribute validation for NFC_ATTR_SE_INDEX
to the netlink policy.

Fixes: 5ce3f32b5264 ("NFC: netlink: SE API implementation")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Johannes Berg <johannes.berg@intel.com>
CC: Jiri Pirko <jiri@mellanox.com>
CC: Samuel Ortiz <sameo@linux.intel.com>
---
 net/nfc/netlink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index eee0dddb7749..842407a48f96 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -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 },
 
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 15/16] nfc: add missing attribute validation for deactivate target
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (13 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 14/16] nfc: add missing attribute validation for SE API Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03  5:05 ` [PATCH net 16/16] nfc: add missing attribute validation for vendor subcommand Jakub Kicinski
  2020-03-03 21:29 ` [PATCH net 00/16] net: add missing netlink policies David Miller
  16 siblings, 0 replies; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem
  Cc: netdev, Jakub Kicinski, Johannes Berg, Jiri Pirko,
	Michal Kubecek, Samuel Ortiz, Mark Greer

Add missing attribute validation for NFC_ATTR_TARGET_INDEX
to the netlink policy.

Fixes: 4d63adfe12dd ("NFC: Add NFC_CMD_DEACTIVATE_TARGET support")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Johannes Berg <johannes.berg@intel.com>
CC: Jiri Pirko <jiri@mellanox.com>
CC: Michal Kubecek <mkubecek@suse.cz>
CC: Samuel Ortiz <sameo@linux.intel.com>
CC: Mark Greer <mgreer@animalcreek.com>
---
 net/nfc/netlink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 842407a48f96..e988ca486d66 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -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 },
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH net 16/16] nfc: add missing attribute validation for vendor subcommand
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (14 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 15/16] nfc: add missing attribute validation for deactivate target Jakub Kicinski
@ 2020-03-03  5:05 ` Jakub Kicinski
  2020-03-03 21:29 ` [PATCH net 00/16] net: add missing netlink policies David Miller
  16 siblings, 0 replies; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03  5:05 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Johannes Berg, Jiri Pirko, Samuel Ortiz

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

Fixes: 9e58095f9660 ("NFC: netlink: Implement vendor command support")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Johannes Berg <johannes.berg@intel.com>
CC: Jiri Pirko <jiri@mellanox.com>
CC: Samuel Ortiz <sameo@linux.intel.com>
---
 net/nfc/netlink.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index e988ca486d66..e894254c17d4 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -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 },
 
 };
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH net 11/16] team: add missing attribute validation for port ifindex
  2020-03-03  5:05 ` [PATCH net 11/16] team: add missing attribute validation for port ifindex Jakub Kicinski
@ 2020-03-03  9:53   ` Jiri Pirko
  0 siblings, 0 replies; 30+ messages in thread
From: Jiri Pirko @ 2020-03-03  9:53 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev

Tue, Mar 03, 2020 at 06:05:21AM CET, kuba@kernel.org wrote:
>Add missing attribute validation for TEAM_ATTR_OPTION_PORT_IFINDEX
>to the netlink policy.
>
>Fixes: 80f7c6683fe0 ("team: add support for per-port options")
>Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH net 12/16] team: add missing attribute validation for array index
  2020-03-03  5:05 ` [PATCH net 12/16] team: add missing attribute validation for array index Jakub Kicinski
@ 2020-03-03  9:53   ` Jiri Pirko
  0 siblings, 0 replies; 30+ messages in thread
From: Jiri Pirko @ 2020-03-03  9:53 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev

Tue, Mar 03, 2020 at 06:05:22AM CET, kuba@kernel.org wrote:
>Add missing attribute validation for TEAM_ATTR_OPTION_ARRAY_INDEX
>to the netlink policy.
>
>Fixes: b13033262d24 ("team: introduce array options")
>Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH net 01/16] devlink: validate length of param values
  2020-03-03  5:05 ` [PATCH net 01/16] devlink: validate length of param values Jakub Kicinski
@ 2020-03-03 10:23   ` Jiri Pirko
  0 siblings, 0 replies; 30+ messages in thread
From: Jiri Pirko @ 2020-03-03 10:23 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, Jiri Pirko, Moshe Shemesh

Tue, Mar 03, 2020 at 06:05:11AM CET, kuba@kernel.org 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")
>Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH net 13/16] tipc: add missing attribute validation for MTU property
  2020-03-03  5:05 ` [PATCH net 13/16] tipc: add missing attribute validation for MTU property Jakub Kicinski
@ 2020-03-03 10:26   ` Xue, Ying
  0 siblings, 0 replies; 30+ messages in thread
From: Xue, Ying @ 2020-03-03 10:26 UTC (permalink / raw)
  To: Jakub Kicinski, davem; +Cc: netdev, Jon Maloy, GhantaKrishnamurthy MohanKrishna

Thanks! The patch looks good to me.

-----Original Message-----
From: Jakub Kicinski [mailto:kuba@kernel.org] 
Sent: Tuesday, March 3, 2020 1:05 PM
To: davem@davemloft.net
Cc: netdev@vger.kernel.org; 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")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Jon Maloy <jmaloy@redhat.com>
CC: Ying Xue <ying.xue@windriver.com>
CC: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com>
---
 net/tipc/netlink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index 7c35094c20b8..bb9862410e68 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -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 }
 };
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH net 02/16] devlink: validate length of region addr/len
  2020-03-03  5:05 ` [PATCH net 02/16] devlink: validate length of region addr/len Jakub Kicinski
@ 2020-03-03 13:31   ` Jiri Pirko
  0 siblings, 0 replies; 30+ messages in thread
From: Jiri Pirko @ 2020-03-03 13:31 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, Jiri Pirko, Alex Vesker

Tue, Mar 03, 2020 at 06:05:12AM CET, kuba@kernel.org 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")
>Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH net 04/16] nl802154: add missing attribute validation
  2020-03-03  5:05 ` [PATCH net 04/16] nl802154: add missing attribute validation Jakub Kicinski
@ 2020-03-03 15:38   ` Stefan Schmidt
  0 siblings, 0 replies; 30+ messages in thread
From: Stefan Schmidt @ 2020-03-03 15:38 UTC (permalink / raw)
  To: Jakub Kicinski, davem
  Cc: netdev, Alexander Aring, Dmitry Eremin-Solenikov, Sergey Lapin,
	linux-wpan

Hello.

On 03.03.20 06:05, Jakub Kicinski wrote:
> 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 <kuba@kernel.org>
> ---
> CC: Alexander Aring <alex.aring@gmail.com>
> CC: Stefan Schmidt <stefan@datenfreihafen.org>
> CC: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> CC: Sergey Lapin <slapin@ossfans.org>
> CC: linux-wpan@vger.kernel.org
> ---
>   net/ieee802154/nl_policy.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/net/ieee802154/nl_policy.c b/net/ieee802154/nl_policy.c
> index 2c7a38d76a3a..824e7e84014c 100644
> --- a/net/ieee802154/nl_policy.c
> +++ b/net/ieee802154/nl_policy.c
> @@ -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, },
> 


Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>

regards
Stefan Schmidt

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH net 05/16] nl802154: add missing attribute validation for dev_type
  2020-03-03  5:05 ` [PATCH net 05/16] nl802154: add missing attribute validation for dev_type Jakub Kicinski
@ 2020-03-03 15:39   ` Stefan Schmidt
  2020-03-03 17:55     ` Jakub Kicinski
  0 siblings, 1 reply; 30+ messages in thread
From: Stefan Schmidt @ 2020-03-03 15:39 UTC (permalink / raw)
  To: Jakub Kicinski, davem
  Cc: netdev, Alexander Aring, alex.bluesman.smirnov, linux-wpan

Hello.

On 03.03.20 06:05, Jakub Kicinski wrote:
> Add missing attribute type validation for IEEE802154_ATTR_DEV_TYPE
> to the netlink policy.
> 
> Fixes: 90c049b2c6ae ("ieee802154: interface type to be added")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: Alexander Aring <alex.aring@gmail.com>
> CC: Stefan Schmidt <stefan@datenfreihafen.org>
> CC: alex.bluesman.smirnov@gmail.com
> CC: linux-wpan@vger.kernel.org
> ---
>   net/ieee802154/nl_policy.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/net/ieee802154/nl_policy.c b/net/ieee802154/nl_policy.c
> index 824e7e84014c..0672b2f01586 100644
> --- a/net/ieee802154/nl_policy.c
> +++ b/net/ieee802154/nl_policy.c
> @@ -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:


Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>

regards
Stefan Schmidt

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH net 03/16] fib: add missing attribute validation for tun_id
  2020-03-03  5:05 ` [PATCH net 03/16] fib: add missing attribute validation for tun_id Jakub Kicinski
@ 2020-03-03 16:01   ` David Ahern
  0 siblings, 0 replies; 30+ messages in thread
From: David Ahern @ 2020-03-03 16:01 UTC (permalink / raw)
  To: Jakub Kicinski, davem; +Cc: netdev, dsahern, Thomas Graf

On 3/2/20 10:05 PM, Jakub Kicinski wrote:
> Add missing netlink policy entry for FRA_TUN_ID.
> 
> Fixes: e7030878fc84 ("fib: Add fib rule match on tunnel id")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: dsahern@kernel.org
> CC: Thomas Graf <tgraf@suug.ch>
> ---
>  include/net/fib_rules.h | 1 +
>  1 file changed, 1 insertion(+)
> 

Reviewed-by: David Ahern <dsahern@gmail.com>



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH net 05/16] nl802154: add missing attribute validation for dev_type
  2020-03-03 15:39   ` Stefan Schmidt
@ 2020-03-03 17:55     ` Jakub Kicinski
  0 siblings, 0 replies; 30+ messages in thread
From: Jakub Kicinski @ 2020-03-03 17:55 UTC (permalink / raw)
  To: Stefan Schmidt
  Cc: davem, netdev, Alexander Aring, alex.bluesman.smirnov, linux-wpan

On Tue, 3 Mar 2020 16:39:55 +0100 Stefan Schmidt wrote:
> On 03.03.20 06:05, Jakub Kicinski wrote:
> > Add missing attribute type validation for IEEE802154_ATTR_DEV_TYPE
> > to the netlink policy.
> > 
> > Fixes: 90c049b2c6ae ("ieee802154: interface type to be added")
> > Signed-off-by: Jakub Kicinski <kuba@kernel.org>

> > diff --git a/net/ieee802154/nl_policy.c b/net/ieee802154/nl_policy.c
> > index 824e7e84014c..0672b2f01586 100644
> > --- a/net/ieee802154/nl_policy.c
> > +++ b/net/ieee802154/nl_policy.c
> > @@ -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 :)

> Might be a bit to much work for this little subsystem, but you did it 
> already, so:
> 
> Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>

Thanks!

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH net 10/16] net: taprio: add missing attribute validation for txtime delay
  2020-03-03  5:05 ` [PATCH net 10/16] net: taprio: add missing attribute validation for txtime delay Jakub Kicinski
@ 2020-03-03 18:39   ` Vinicius Costa Gomes
  0 siblings, 0 replies; 30+ messages in thread
From: Vinicius Costa Gomes @ 2020-03-03 18:39 UTC (permalink / raw)
  To: Jakub Kicinski, davem
  Cc: netdev, Jakub Kicinski, Jamal Hadi Salim, Cong Wang, Jiri Pirko,
	Vedang Patel

Jakub Kicinski <kuba@kernel.org> writes:

> Add missing attribute validation for TCA_TAPRIO_ATTR_TXTIME_DELAY
> to the netlink policy.
>
> Fixes: 4cfd5779bd6e ("taprio: Add support for txtime-assist mode")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: Jamal Hadi Salim <jhs@mojatatu.com>
> CC: Cong Wang <xiyou.wangcong@gmail.com>
> CC: Jiri Pirko <jiri@resnulli.us>
> CC: Vedang Patel <vedang.patel@intel.com>
> CC: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> ---

Reviewed-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>

-- 
Vinicius

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH net 06/16] can: add missing attribute validation for termination
  2020-03-03  5:05 ` [PATCH net 06/16] can: add missing attribute validation for termination Jakub Kicinski
@ 2020-03-03 19:58   ` Oliver Hartkopp
  0 siblings, 0 replies; 30+ messages in thread
From: Oliver Hartkopp @ 2020-03-03 19:58 UTC (permalink / raw)
  To: Jakub Kicinski, davem
  Cc: netdev, Wolfgang Grandegger, Marc Kleine-Budde, linux-can



On 03/03/2020 06.05, Jakub Kicinski wrote:
> Add missing attribute validation for IFLA_CAN_TERMINATION
> to the netlink policy.
> 
> Fixes: 12a6075cabc0 ("can: dev: add CAN interface termination API")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: Wolfgang Grandegger <wg@grandegger.com>
> CC: Marc Kleine-Budde <mkl@pengutronix.de>
> CC: Oliver Hartkopp <socketcan@hartkopp.net>
> CC: linux-can@vger.kernel.org
> ---
>   drivers/net/can/dev.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
> index 6ee06a49fb4c..68834a2853c9 100644
> --- a/drivers/net/can/dev.c
> +++ b/drivers/net/can/dev.c
> @@ -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[],

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>

Thanks Jakub for catching all these missing defs!

Best regards,
Oliver

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [ovs-dev] [PATCH net 08/16] openvswitch: add missing attribute validation for hash
  2020-03-03  5:05 ` [PATCH net 08/16] openvswitch: add missing attribute validation for hash Jakub Kicinski
@ 2020-03-03 21:24   ` Gregory Rose
  0 siblings, 0 replies; 30+ messages in thread
From: Gregory Rose @ 2020-03-03 21:24 UTC (permalink / raw)
  To: Jakub Kicinski, davem; +Cc: dev, netdev


On 3/2/2020 9:05 PM, Jakub Kicinski wrote:
> Add missing attribute validation for OVS_PACKET_ATTR_HASH
> to the netlink policy.
>
> Fixes: bd1903b7c459 ("net: openvswitch: add hash info to upcall")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: Pravin B Shelar <pshelar@ovn.org>
> CC: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> CC: dev@openvswitch.org
> ---
>   net/openvswitch/datapath.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
> index c047afd12116..07a7dd185995 100644
> --- a/net/openvswitch/datapath.c
> +++ b/net/openvswitch/datapath.c
> @@ -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

Reviewed-by: Greg Rose <gvrose8192@gmail.com>


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH net 00/16] net: add missing netlink policies
  2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
                   ` (15 preceding siblings ...)
  2020-03-03  5:05 ` [PATCH net 16/16] nfc: add missing attribute validation for vendor subcommand Jakub Kicinski
@ 2020-03-03 21:29 ` David Miller
  16 siblings, 0 replies; 30+ messages in thread
From: David Miller @ 2020-03-03 21:29 UTC (permalink / raw)
  To: kuba; +Cc: netdev

From: Jakub Kicinski <kuba@kernel.org>
Date: Mon,  2 Mar 2020 21:05:10 -0800

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2020-03-03 21:29 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03  5:05 [PATCH net 00/16] net: add missing netlink policies Jakub Kicinski
2020-03-03  5:05 ` [PATCH net 01/16] devlink: validate length of param values Jakub Kicinski
2020-03-03 10:23   ` Jiri Pirko
2020-03-03  5:05 ` [PATCH net 02/16] devlink: validate length of region addr/len Jakub Kicinski
2020-03-03 13:31   ` Jiri Pirko
2020-03-03  5:05 ` [PATCH net 03/16] fib: add missing attribute validation for tun_id Jakub Kicinski
2020-03-03 16:01   ` David Ahern
2020-03-03  5:05 ` [PATCH net 04/16] nl802154: add missing attribute validation Jakub Kicinski
2020-03-03 15:38   ` Stefan Schmidt
2020-03-03  5:05 ` [PATCH net 05/16] nl802154: add missing attribute validation for dev_type Jakub Kicinski
2020-03-03 15:39   ` Stefan Schmidt
2020-03-03 17:55     ` Jakub Kicinski
2020-03-03  5:05 ` [PATCH net 06/16] can: add missing attribute validation for termination Jakub Kicinski
2020-03-03 19:58   ` Oliver Hartkopp
2020-03-03  5:05 ` [PATCH net 07/16] macsec: add missing attribute validation for port Jakub Kicinski
2020-03-03  5:05 ` [PATCH net 08/16] openvswitch: add missing attribute validation for hash Jakub Kicinski
2020-03-03 21:24   ` [ovs-dev] " Gregory Rose
2020-03-03  5:05 ` [PATCH net 09/16] net: fq: add missing attribute validation for orphan mask Jakub Kicinski
2020-03-03  5:05 ` [PATCH net 10/16] net: taprio: add missing attribute validation for txtime delay Jakub Kicinski
2020-03-03 18:39   ` Vinicius Costa Gomes
2020-03-03  5:05 ` [PATCH net 11/16] team: add missing attribute validation for port ifindex Jakub Kicinski
2020-03-03  9:53   ` Jiri Pirko
2020-03-03  5:05 ` [PATCH net 12/16] team: add missing attribute validation for array index Jakub Kicinski
2020-03-03  9:53   ` Jiri Pirko
2020-03-03  5:05 ` [PATCH net 13/16] tipc: add missing attribute validation for MTU property Jakub Kicinski
2020-03-03 10:26   ` Xue, Ying
2020-03-03  5:05 ` [PATCH net 14/16] nfc: add missing attribute validation for SE API Jakub Kicinski
2020-03-03  5:05 ` [PATCH net 15/16] nfc: add missing attribute validation for deactivate target Jakub Kicinski
2020-03-03  5:05 ` [PATCH net 16/16] nfc: add missing attribute validation for vendor subcommand Jakub Kicinski
2020-03-03 21:29 ` [PATCH net 00/16] net: add missing netlink policies David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).