Skip to content

Commit 9c5d03d

Browse files
kuba-moodavem330
authored andcommitted
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: Jakub Kicinski <[email protected]> Acked-by: Paul Moore <[email protected]> (NetLabel) Signed-off-by: David S. Miller <[email protected]>
1 parent 53a4068 commit 9c5d03d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+56
-2
lines changed

drivers/block/nbd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,6 +2322,7 @@ static struct genl_family nbd_genl_family __ro_after_init = {
23222322
.module = THIS_MODULE,
23232323
.small_ops = nbd_connect_genl_ops,
23242324
.n_small_ops = ARRAY_SIZE(nbd_connect_genl_ops),
2325+
.resv_start_op = NBD_CMD_STATUS + 1,
23252326
.maxattr = NBD_ATTR_MAX,
23262327
.policy = nbd_attr_policy,
23272328
.mcgrps = nbd_mcast_grps,

drivers/net/gtp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,6 +1859,7 @@ static struct genl_family gtp_genl_family __ro_after_init = {
18591859
.module = THIS_MODULE,
18601860
.small_ops = gtp_genl_ops,
18611861
.n_small_ops = ARRAY_SIZE(gtp_genl_ops),
1862+
.resv_start_op = GTP_CMD_ECHOREQ + 1,
18621863
.mcgrps = gtp_genl_mcgrps,
18631864
.n_mcgrps = ARRAY_SIZE(gtp_genl_mcgrps),
18641865
};

drivers/net/ieee802154/mac802154_hwsim.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ static struct genl_family hwsim_genl_family __ro_after_init = {
630630
.module = THIS_MODULE,
631631
.small_ops = hwsim_nl_ops,
632632
.n_small_ops = ARRAY_SIZE(hwsim_nl_ops),
633+
.resv_start_op = MAC802154_HWSIM_CMD_NEW_EDGE + 1,
633634
.mcgrps = hwsim_mcgrps,
634635
.n_mcgrps = ARRAY_SIZE(hwsim_mcgrps),
635636
};

drivers/net/macsec.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3404,6 +3404,7 @@ static struct genl_family macsec_fam __ro_after_init = {
34043404
.module = THIS_MODULE,
34053405
.small_ops = macsec_genl_ops,
34063406
.n_small_ops = ARRAY_SIZE(macsec_genl_ops),
3407+
.resv_start_op = MACSEC_CMD_UPD_OFFLOAD + 1,
34073408
};
34083409

34093410
static netdev_tx_t macsec_start_xmit(struct sk_buff *skb,

drivers/net/team/team.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2840,6 +2840,7 @@ static struct genl_family team_nl_family __ro_after_init = {
28402840
.module = THIS_MODULE,
28412841
.small_ops = team_nl_ops,
28422842
.n_small_ops = ARRAY_SIZE(team_nl_ops),
2843+
.resv_start_op = TEAM_CMD_PORT_LIST_GET + 1,
28432844
.mcgrps = team_nl_mcgrps,
28442845
.n_mcgrps = ARRAY_SIZE(team_nl_mcgrps),
28452846
};

drivers/net/wireguard/netlink.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ static const struct genl_ops genl_ops[] = {
621621
static struct genl_family genl_family __ro_after_init = {
622622
.ops = genl_ops,
623623
.n_ops = ARRAY_SIZE(genl_ops),
624+
.resv_start_op = WG_CMD_SET_DEVICE + 1,
624625
.name = WG_GENL_NAME,
625626
.version = WG_GENL_VERSION,
626627
.maxattr = WGDEVICE_A_MAX,

drivers/net/wireless/mac80211_hwsim.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5288,6 +5288,7 @@ static struct genl_family hwsim_genl_family __ro_after_init = {
52885288
.module = THIS_MODULE,
52895289
.small_ops = hwsim_ops,
52905290
.n_small_ops = ARRAY_SIZE(hwsim_ops),
5291+
.resv_start_op = HWSIM_CMD_DEL_MAC_ADDR + 1,
52915292
.mcgrps = hwsim_mcgrps,
52925293
.n_mcgrps = ARRAY_SIZE(hwsim_mcgrps),
52935294
};

drivers/target/target_core_user.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ static struct genl_family tcmu_genl_family __ro_after_init = {
486486
.netnsok = true,
487487
.small_ops = tcmu_genl_ops,
488488
.n_small_ops = ARRAY_SIZE(tcmu_genl_ops),
489+
.resv_start_op = TCMU_CMD_SET_FEATURES + 1,
489490
};
490491

491492
#define tcmu_cmd_set_dbi_cur(cmd, index) ((cmd)->dbi_cur = (index))

drivers/thermal/thermal_netlink.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ static struct genl_family thermal_gnl_family __ro_after_init = {
693693
.policy = thermal_genl_policy,
694694
.small_ops = thermal_genl_ops,
695695
.n_small_ops = ARRAY_SIZE(thermal_genl_ops),
696+
.resv_start_op = THERMAL_GENL_CMD_CDEV_GET + 1,
696697
.mcgrps = thermal_genl_mcgrps,
697698
.n_mcgrps = ARRAY_SIZE(thermal_genl_mcgrps),
698699
};

drivers/vdpa/vdpa.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,7 @@ static struct genl_family vdpa_nl_family __ro_after_init = {
11831183
.module = THIS_MODULE,
11841184
.ops = vdpa_nl_ops,
11851185
.n_ops = ARRAY_SIZE(vdpa_nl_ops),
1186+
.resv_start_op = VDPA_CMD_DEV_VSTATS_GET + 1,
11861187
};
11871188

11881189
static int vdpa_init(void)

0 commit comments

Comments
 (0)