Skip to content

Commit 65d6914

Browse files
lxinkuba-moo
authored andcommitted
rtnetlink: add the missing IFLA_GRO_ tb check in validate_linkmsg
This fixes the issue that dev gro_max_size and gso_ipv4_max_size can be set to a huge value: # ip link add dummy1 type dummy # ip link set dummy1 gro_max_size 4294967295 # ip -d link show dummy1 dummy addrgenmode eui64 ... gro_max_size 4294967295 Fixes: 0fe79f2 ("net: allow gro_max_size to exceed 65536") Fixes: 9eefedd ("net: add gso_ipv4_max_size and gro_ipv4_max_size per device") Reported-by: Xiumei Mu <xmu@redhat.com> Signed-off-by: Xin Long <lucien.xin@gmail.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent fef5b22 commit 65d6914

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

net/core/rtnetlink.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,11 +2399,23 @@ static int validate_linkmsg(struct net_device *dev, struct nlattr *tb[],
23992399
return -EINVAL;
24002400
}
24012401

2402+
if (tb[IFLA_GRO_MAX_SIZE] &&
2403+
nla_get_u32(tb[IFLA_GRO_MAX_SIZE]) > GRO_MAX_SIZE) {
2404+
NL_SET_ERR_MSG(extack, "too big gro_max_size");
2405+
return -EINVAL;
2406+
}
2407+
24022408
if (tb[IFLA_GSO_IPV4_MAX_SIZE] &&
24032409
nla_get_u32(tb[IFLA_GSO_IPV4_MAX_SIZE]) > dev->tso_max_size) {
24042410
NL_SET_ERR_MSG(extack, "too big gso_ipv4_max_size");
24052411
return -EINVAL;
24062412
}
2413+
2414+
if (tb[IFLA_GRO_IPV4_MAX_SIZE] &&
2415+
nla_get_u32(tb[IFLA_GRO_IPV4_MAX_SIZE]) > GRO_MAX_SIZE) {
2416+
NL_SET_ERR_MSG(extack, "too big gro_ipv4_max_size");
2417+
return -EINVAL;
2418+
}
24072419
}
24082420

24092421
if (tb[IFLA_AF_SPEC]) {

0 commit comments

Comments
 (0)