Commit 9c5d03d3 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller
Browse files

genetlink: start to validate reserved header bytes



We had historically not checked that genlmsghdr.reserved
is 0 on input which prevents us from using those precious
bytes in the future.

One use case would be to extend the cmd field, which is
currently just 8 bits wide and 256 is not a lot of commands
for some core families.

To make sure that new families do the right thing by default
put the onus of opting out of validation on existing families.

Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Acked-by: Paul Moore <paul@paul-moore.com> (NetLabel)
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 53a40680
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2322,6 +2322,7 @@ static struct genl_family nbd_genl_family __ro_after_init = {
	.module		= THIS_MODULE,
	.small_ops	= nbd_connect_genl_ops,
	.n_small_ops	= ARRAY_SIZE(nbd_connect_genl_ops),
	.resv_start_op	= NBD_CMD_STATUS + 1,
	.maxattr	= NBD_ATTR_MAX,
	.policy = nbd_attr_policy,
	.mcgrps		= nbd_mcast_grps,
+1 −0
Original line number Diff line number Diff line
@@ -1859,6 +1859,7 @@ static struct genl_family gtp_genl_family __ro_after_init = {
	.module		= THIS_MODULE,
	.small_ops	= gtp_genl_ops,
	.n_small_ops	= ARRAY_SIZE(gtp_genl_ops),
	.resv_start_op	= GTP_CMD_ECHOREQ + 1,
	.mcgrps		= gtp_genl_mcgrps,
	.n_mcgrps	= ARRAY_SIZE(gtp_genl_mcgrps),
};
+1 −0
Original line number Diff line number Diff line
@@ -630,6 +630,7 @@ static struct genl_family hwsim_genl_family __ro_after_init = {
	.module = THIS_MODULE,
	.small_ops = hwsim_nl_ops,
	.n_small_ops = ARRAY_SIZE(hwsim_nl_ops),
	.resv_start_op = MAC802154_HWSIM_CMD_NEW_EDGE + 1,
	.mcgrps = hwsim_mcgrps,
	.n_mcgrps = ARRAY_SIZE(hwsim_mcgrps),
};
+1 −0
Original line number Diff line number Diff line
@@ -3404,6 +3404,7 @@ static struct genl_family macsec_fam __ro_after_init = {
	.module		= THIS_MODULE,
	.small_ops	= macsec_genl_ops,
	.n_small_ops	= ARRAY_SIZE(macsec_genl_ops),
	.resv_start_op	= MACSEC_CMD_UPD_OFFLOAD + 1,
};

static netdev_tx_t macsec_start_xmit(struct sk_buff *skb,
+1 −0
Original line number Diff line number Diff line
@@ -2840,6 +2840,7 @@ static struct genl_family team_nl_family __ro_after_init = {
	.module		= THIS_MODULE,
	.small_ops	= team_nl_ops,
	.n_small_ops	= ARRAY_SIZE(team_nl_ops),
	.resv_start_op	= TEAM_CMD_PORT_LIST_GET + 1,
	.mcgrps		= team_nl_mcgrps,
	.n_mcgrps	= ARRAY_SIZE(team_nl_mcgrps),
};
Loading